96df226 "KVM: PPC: Book3S PR: Preserve storage control bits" added WIMG
bits preserving but it missed 2 special cases:
- a magic page in kvmppc_mmu_book3s_64_xlate() and
- guest real mode in kvmppc_handle_pagefault().
For these ptes WIMG were 0 and pHyp failed on these causing a guest to
stop in the very beginning at NIP=0x100 (due to bd9166ffe
"KVM: PPC: Book3S PR: Exit KVM on failed mapping").
This initializes WIMG to non-zero value HPTE_R_M. The value is chosen
as (0x192 & HPTE_R_WIMG); 0x192 is a magic value from
kvmppc_mmu_map_page().
Fixes: 96df226 "KVM: PPC: Book3S PR: Preserve storage control bits"
Signed-off-by: Alexey Kardashevskiy <redacted>
---
This indeed fixes PR KVM + VFIO under pHyp but selection of HPTE_R_M
is arguable.
---
arch/powerpc/kvm/book3s_64_mmu.c | 1 +
arch/powerpc/kvm/book3s_pr.c | 1 +
2 files changed, 2 insertions(+)
From: Alexander Graf <hidden> Date: 2017-11-22 15:02:47
On 22.11.17 04:42, Alexey Kardashevskiy wrote:
96df226 "KVM: PPC: Book3S PR: Preserve storage control bits" added WIMG
bits preserving but it missed 2 special cases:
- a magic page in kvmppc_mmu_book3s_64_xlate() and
- guest real mode in kvmppc_handle_pagefault().
For these ptes WIMG were 0 and pHyp failed on these causing a guest to
stop in the very beginning at NIP=0x100 (due to bd9166ffe
"KVM: PPC: Book3S PR: Exit KVM on failed mapping").
This initializes WIMG to non-zero value HPTE_R_M. The value is chosen
as (0x192 & HPTE_R_WIMG); 0x192 is a magic value from
kvmppc_mmu_map_page().
Fixes: 96df226 "KVM: PPC: Book3S PR: Preserve storage control bits"
Signed-off-by: Alexey Kardashevskiy <redacted>
---
This indeed fixes PR KVM + VFIO under pHyp but selection of HPTE_R_M
is arguable.
This does indeed fix the breakage we've seen:
Tested-by: Ruediger Oertel <redacted>
Alex
From: Greg Kurz <hidden> Date: 2017-11-24 02:18:43
On Wed, 22 Nov 2017 14:42:21 +1100
Alexey Kardashevskiy [off-list ref] wrote:
96df226 "KVM: PPC: Book3S PR: Preserve storage control bits" added WIMG
bits preserving but it missed 2 special cases:
- a magic page in kvmppc_mmu_book3s_64_xlate() and
- guest real mode in kvmppc_handle_pagefault().
For these ptes WIMG were 0 and pHyp failed on these causing a guest to
stop in the very beginning at NIP=0x100 (due to bd9166ffe
"KVM: PPC: Book3S PR: Exit KVM on failed mapping").
This initializes WIMG to non-zero value HPTE_R_M. The value is chosen
as (0x192 & HPTE_R_WIMG); 0x192 is a magic value from
kvmppc_mmu_map_page().
Fixes: 96df226 "KVM: PPC: Book3S PR: Preserve storage control bits"
Signed-off-by: Alexey Kardashevskiy <redacted>
---
This indeed fixes PR KVM + VFIO under pHyp but selection of HPTE_R_M
is arguable.
The initial page fault at 0x100 on machine startup causes H_ENTER to fail in
pHyp with H_PARAMETER, as described in PAPR:
The hypervisor checks that the WIMG bits within the PTE are appropriate for the
physical page number else H_Parameter return. (For System Memory pages WIMG=0010,
or, 1110 if the SAO option is enabled, and for IO pages WIMG=01**.)
I'm not aware we care for SAO so HPTE_R_M looks like the only sensible choice,
or I'm missing something ?
Anyway, this patch allows to start a PR guest on PowerVM again.
Reviewed-by: Greg Kurz <redacted>
and
Tested-by: Greg Kurz <redacted>
From: Alexander Graf <hidden> Date: 2017-12-11 10:51:39
On 24.11.17 00:33, Greg Kurz wrote:
On Wed, 22 Nov 2017 14:42:21 +1100
Alexey Kardashevskiy [off-list ref] wrote:
quoted
96df226 "KVM: PPC: Book3S PR: Preserve storage control bits" added WIMG
bits preserving but it missed 2 special cases:
- a magic page in kvmppc_mmu_book3s_64_xlate() and
- guest real mode in kvmppc_handle_pagefault().
For these ptes WIMG were 0 and pHyp failed on these causing a guest to
stop in the very beginning at NIP=0x100 (due to bd9166ffe
"KVM: PPC: Book3S PR: Exit KVM on failed mapping").
This initializes WIMG to non-zero value HPTE_R_M. The value is chosen
as (0x192 & HPTE_R_WIMG); 0x192 is a magic value from
kvmppc_mmu_map_page().
Fixes: 96df226 "KVM: PPC: Book3S PR: Preserve storage control bits"
Signed-off-by: Alexey Kardashevskiy <redacted>
---
This indeed fixes PR KVM + VFIO under pHyp but selection of HPTE_R_M
is arguable.
The initial page fault at 0x100 on machine startup causes H_ENTER to fail in
pHyp with H_PARAMETER, as described in PAPR:
The hypervisor checks that the WIMG bits within the PTE are appropriate for the
physical page number else H_Parameter return. (For System Memory pages WIMG=0010,
or, 1110 if the SAO option is enabled, and for IO pages WIMG=01**.)
I'm not aware we care for SAO so HPTE_R_M looks like the only sensible choice,
or I'm missing something ?
Anyway, this patch allows to start a PR guest on PowerVM again.
Reviewed-by: Greg Kurz <redacted>
and
Tested-by: Greg Kurz <redacted>
So doesn't that mean we should pick it up, mark it CC stable and push it
upstream?
Alex
Paul,
I saw comments about the commit log but did this go to any tree eventually?
On 22/11/17 14:42, Alexey Kardashevskiy wrote:
quoted hunk
96df226 "KVM: PPC: Book3S PR: Preserve storage control bits" added WIMG
bits preserving but it missed 2 special cases:
- a magic page in kvmppc_mmu_book3s_64_xlate() and
- guest real mode in kvmppc_handle_pagefault().
For these ptes WIMG were 0 and pHyp failed on these causing a guest to
stop in the very beginning at NIP=0x100 (due to bd9166ffe
"KVM: PPC: Book3S PR: Exit KVM on failed mapping").
This initializes WIMG to non-zero value HPTE_R_M. The value is chosen
as (0x192 & HPTE_R_WIMG); 0x192 is a magic value from
kvmppc_mmu_map_page().
Fixes: 96df226 "KVM: PPC: Book3S PR: Preserve storage control bits"
Signed-off-by: Alexey Kardashevskiy <redacted>
---
This indeed fixes PR KVM + VFIO under pHyp but selection of HPTE_R_M
is arguable.
---
arch/powerpc/kvm/book3s_64_mmu.c | 1 +
arch/powerpc/kvm/book3s_pr.c | 1 +
2 files changed, 2 insertions(+)
From: Paul Mackerras <hidden> Date: 2018-01-11 10:01:53
On Wed, Nov 22, 2017 at 02:42:21PM +1100, Alexey Kardashevskiy wrote:
96df226 "KVM: PPC: Book3S PR: Preserve storage control bits" added WIMG
bits preserving but it missed 2 special cases:
- a magic page in kvmppc_mmu_book3s_64_xlate() and
- guest real mode in kvmppc_handle_pagefault().
For these ptes WIMG were 0 and pHyp failed on these causing a guest to
stop in the very beginning at NIP=0x100 (due to bd9166ffe
"KVM: PPC: Book3S PR: Exit KVM on failed mapping").
This initializes WIMG to non-zero value HPTE_R_M. The value is chosen
as (0x192 & HPTE_R_WIMG); 0x192 is a magic value from
kvmppc_mmu_map_page().
Fixes: 96df226 "KVM: PPC: Book3S PR: Preserve storage control bits"
Signed-off-by: Alexey Kardashevskiy <redacted>
Thanks, applied to my kvm-ppc-fixes branch, with an updated commit
message, fixes: tag, and cc:stable@vger.kernel.org.
Paul.