Skip to content

Commit cd81acc

Browse files
npigginmpe
authored andcommitted
powerpc/64s/exception: KVM Fix for host DSI being taken in HPT guest MMU context
Commit 2284ffe ("powerpc/64s/exception: Only test KVM in SRR interrupts when PR KVM is supported") removed KVM guest tests from interrupts that do not set HV=1, when PR-KVM is not configured. This is wrong for HV-KVM HPT guest MMIO emulation case which attempts to load the faulting instruction word with MSR[DR]=1 and MSR[HV]=1 with the guest MMU context loaded. This can cause host DSI, DSLB interrupts which must test for KVM guest. Restore this and add a comment. Fixes: 2284ffe ("powerpc/64s/exception: Only test KVM in SRR interrupts when PR KVM is supported") Cc: stable@vger.kernel.org # v5.7+ Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20201117135617.3521127-1-npiggin@gmail.com
1 parent e02152b commit cd81acc

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

arch/powerpc/kernel/exceptions-64s.S

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1410,6 +1410,11 @@ END_FTR_SECTION_IFSET(CPU_FTR_HVMODE)
14101410
* If none is found, do a Linux page fault. Linux page faults can happen in
14111411
* kernel mode due to user copy operations of course.
14121412
*
1413+
* KVM: The KVM HDSI handler may perform a load with MSR[DR]=1 in guest
1414+
* MMU context, which may cause a DSI in the host, which must go to the
1415+
* KVM handler. MSR[IR] is not enabled, so the real-mode handler will
1416+
* always be used regardless of AIL setting.
1417+
*
14131418
* - Radix MMU
14141419
* The hardware loads from the Linux page table directly, so a fault goes
14151420
* immediately to Linux page fault.
@@ -1420,10 +1425,8 @@ INT_DEFINE_BEGIN(data_access)
14201425
IVEC=0x300
14211426
IDAR=1
14221427
IDSISR=1
1423-
#ifdef CONFIG_KVM_BOOK3S_PR_POSSIBLE
14241428
IKVM_SKIP=1
14251429
IKVM_REAL=1
1426-
#endif
14271430
INT_DEFINE_END(data_access)
14281431

14291432
EXC_REAL_BEGIN(data_access, 0x300, 0x80)
@@ -1462,6 +1465,8 @@ ALT_MMU_FTR_SECTION_END_IFCLR(MMU_FTR_TYPE_RADIX)
14621465
* ppc64_bolted_size (first segment). The kernel handler must avoid stomping
14631466
* on user-handler data structures.
14641467
*
1468+
* KVM: Same as 0x300, DSLB must test for KVM guest.
1469+
*
14651470
* A dedicated save area EXSLB is used (XXX: but it actually need not be
14661471
* these days, we could use EXGEN).
14671472
*/
@@ -1470,10 +1475,8 @@ INT_DEFINE_BEGIN(data_access_slb)
14701475
IAREA=PACA_EXSLB
14711476
IRECONCILE=0
14721477
IDAR=1
1473-
#ifdef CONFIG_KVM_BOOK3S_PR_POSSIBLE
14741478
IKVM_SKIP=1
14751479
IKVM_REAL=1
1476-
#endif
14771480
INT_DEFINE_END(data_access_slb)
14781481

14791482
EXC_REAL_BEGIN(data_access_slb, 0x380, 0x80)

0 commit comments

Comments
 (0)