Skip to content

Commit dae5818

Browse files
committed
KVM: PPC: Book3S HV: Use GLOBAL_TOC for kvmppc_h_set_dabr/xdabr()
kvmppc_h_set_dabr(), and kvmppc_h_set_xdabr() which jumps into it, need to use _GLOBAL_TOC to setup the kernel TOC pointer, because kvmppc_h_set_dabr() uses LOAD_REG_ADDR() to load dawr_force_enable. When called from hcall_try_real_mode() we have the kernel TOC in r2, established near the start of kvmppc_interrupt_hv(), so there is no issue. But they can also be called from kvmppc_pseries_do_hcall() which is module code, so the access ends up happening with the kvm-hv module's r2, which will not point at dawr_force_enable and could even cause a fault. With the current code layout and compilers we haven't observed a fault in practice, the load hits somewhere in kvm-hv.ko and silently returns some bogus value. Note that we we expect p8/p9 guests to use the DAWR, but SLOF uses h_set_dabr() to test if sc1 works correctly, see SLOF's lib/libhvcall/brokensc1.c. Fixes: c1fe190 ("powerpc: Add force enable of DAWR on P9 option") Signed-off-by: Michael Ellerman <[email protected]> Reviewed-by: Daniel Axtens <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 158ea2d commit dae5818

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/powerpc/kvm/book3s_hv_rmhandlers.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2005,7 +2005,7 @@ hcall_real_table:
20052005
.globl hcall_real_table_end
20062006
hcall_real_table_end:
20072007

2008-
_GLOBAL(kvmppc_h_set_xdabr)
2008+
_GLOBAL_TOC(kvmppc_h_set_xdabr)
20092009
EXPORT_SYMBOL_GPL(kvmppc_h_set_xdabr)
20102010
andi. r0, r5, DABRX_USER | DABRX_KERNEL
20112011
beq 6f
@@ -2015,7 +2015,7 @@ EXPORT_SYMBOL_GPL(kvmppc_h_set_xdabr)
20152015
6: li r3, H_PARAMETER
20162016
blr
20172017

2018-
_GLOBAL(kvmppc_h_set_dabr)
2018+
_GLOBAL_TOC(kvmppc_h_set_dabr)
20192019
EXPORT_SYMBOL_GPL(kvmppc_h_set_dabr)
20202020
li r5, DABRX_USER | DABRX_KERNEL
20212021
3:

0 commit comments

Comments
 (0)