Patchwork KVM: PPC: Fix PR KVM on POWER7 bare metal

login
register
mail settings
Submitter Alexander Graf
Date April 25, 2012, 11:46 a.m.
Message ID <1335354386-29316-1-git-send-email-agraf@suse.de>
Download mbox | patch
Permalink /patch/154886/
State New
Headers show

Comments

Alexander Graf - April 25, 2012, 11:46 a.m.
When running on a system that is HV capable, some interrupts use HSRR
SPRs instead of the normal SRR SPRs. These are also used in the Linux
handlers to jump back to code after an interrupt got processed.

Unfortunately, in our "jump back to the real host handler after we've
done the context switch" code, we were only setting the SRR SPRs,
rendering Linux to jump back to some invalid IP after it's processed
the interrupt.

This fixes random crashes on p7 opal mode with PR KVM for me.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/powerpc/kvm/book3s_segment.S |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
Alexander Graf - April 26, 2012, 10:18 a.m.
On 25.04.2012, at 13:46, Alexander Graf wrote:

> When running on a system that is HV capable, some interrupts use HSRR
> SPRs instead of the normal SRR SPRs. These are also used in the Linux
> handlers to jump back to code after an interrupt got processed.
> 
> Unfortunately, in our "jump back to the real host handler after we've
> done the context switch" code, we were only setting the SRR SPRs,
> rendering Linux to jump back to some invalid IP after it's processed
> the interrupt.
> 
> This fixes random crashes on p7 opal mode with PR KVM for me.

Drop this one; better patch following.


Alex

--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/arch/powerpc/kvm/book3s_segment.S b/arch/powerpc/kvm/book3s_segment.S
index 0676ae2..64f9018 100644
--- a/arch/powerpc/kvm/book3s_segment.S
+++ b/arch/powerpc/kvm/book3s_segment.S
@@ -347,6 +347,13 @@  no_dcbz32_off:
 	/* Load highmem handler address */
 	mtsrr0	r8
 
+#ifdef CONFIG_PPC64
+BEGIN_FTR_SECTION
+	mtspr	SPRN_HSRR1, r6
+	mtspr	SPRN_HSRR0, r8
+END_FTR_SECTION_IFSET(CPU_FTR_HVMODE)
+#endif
+
 	/* RFI into the highmem handler, or jump to interrupt handler */
 	beqctr
 	RFI