Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cxl: Set endianess of kernel contexts

A process element (defined in CAIA) keeps track of the endianess of
contexts through the Little Endian (LE) bit of the State Register. It
is currently set for user contexts, but was somehow forgotten for
kernel contexts, so this patch fixes it.
It could lead to erratic behavior from an AFU when the context is
attached through the kernel API.

Fixes: 2f663527bd6a ("cxl: Configure PSL for kernel contexts and merge code")
Cc: stable@vger.kernel.org # 4.2+
Signed-off-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
Suggested-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

authored by

Frederic Barrat and committed by
Michael Ellerman
e606e035 25642e14

+1 -1
+1 -1
drivers/misc/cxl/native.c
··· 497 497 { 498 498 u64 sr = 0; 499 499 500 + set_endian(sr); 500 501 if (ctx->master) 501 502 sr |= CXL_PSL_SR_An_MP; 502 503 if (mfspr(SPRN_LPCR) & LPCR_TC) ··· 507 506 sr |= CXL_PSL_SR_An_HV; 508 507 } else { 509 508 sr |= CXL_PSL_SR_An_PR | CXL_PSL_SR_An_R; 510 - set_endian(sr); 511 509 sr &= ~(CXL_PSL_SR_An_HV); 512 510 if (!test_tsk_thread_flag(current, TIF_32BIT)) 513 511 sr |= CXL_PSL_SR_An_SF;