powerpc: kvm: Set M flag for KVM PTE depending on CPU_FTR_NEED_COHERENT
Subsystems (2)
PATCH 1/1 powerpc: kvm: Set M flag for KVM PTE depending on CPU_FTR_NEED_COHERENT
Usually page table entries only have the M (coherence) flag set, if the kernel is in SMP mode or to avoid data corruption due to CPU bugs (e.g. some 74xx CPUs). KVM on book3s_32 however always sets the M flag for a PTE, which locks up machines based on the amigaone platform when running QEMU or MoL.
Setting the M flag depending on CPU_FTR_NEED_COHERENT also makes KVM work on this platform and aligns the PTE setup to the rest of the kernel.
Signed-off-by Gerhard Pircher <[email protected]>
---
With this patch I could successfully run a Debian Wheezy installation inside QEMU started with --enable-kvm on my AmigaOneG3SE.
arch/powerpc/kvm/book3s_32_mmu_host.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/powerpc/kvm/book3s_32_mmu_host.c +4 -1
@@ -204,7 +204,10 @@ next_pteg: pteg0 = ((eaddr &0x0fffffff ) >>22 ) | (vsid <<7 ) |PTE_V | (primary ?0 :PTE_SEC ); - pteg1 = hpaddr |PTE_M |PTE_R |PTE_C ; + pteg1 = hpaddr |PTE_R |PTE_C ; + +if (cpu_has_feature (CPU_FTR_NEED_COHERENT )) + pteg1 |=PTE_M ;if (orig_pte->may_write && writable) { pteg1 |=PP_RWRW ;
Signature · 1 line
1.9.1