diff mbox

[1/1] ppc: Fix MMU model values needed by PR KVM

Message ID 7f505322e0bfb2b0c8fb64035b042695ddfdf878.1469080542.git.sam.bobroff@au1.ibm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Sam Bobroff July 21, 2016, 5:55 a.m. UTC
Commit 4322e8c "ppc: Fix 64K pages support in full emulation" added
the POWERPC_MMU_64K flag to the POWERPC_MMU_2_06 and POWERPC_MMU_2_07
definitions but not to their "degraded" variants. When running with PR
KVM, kvm_fixup_page_sizes() removes the POWERPC_MMU_1TSEG flag from
the MMU value then later ppc_tlb_invalidate_all() expects the value to
be one from the list, but it isn't because the POWERPC_MMU_64K bit is
missing from the (otherwise) matching "degraded" entry. This causes
QEMU to exit with "fatal: Unknown MMU model".

This patch adds the POWERPC_MMU_64K flag to the POWERPC_MMU_2_06a and
POWERPC_MMU_2_07a values, preventing the error.

Signed-off-by: Sam Bobroff <sam.bobroff@au1.ibm.com>
---
I recently discovered that I can't start QEMU with KVM PR for modern
pseries machines:

$ rmmod kvm_hv
$ modprobe kvm-pr
$ qemu-system-ppc64 -nographic -vga none -machine pseries,accel=kvm
qemu: fatal: Unknown MMU model

A quick investigation seems to indicate that it's just a missing flag
in the MMU definition. If it's really that simple then here's a patch
for it.

Cheers,
Sam.

 target-ppc/cpu-qom.h | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Mark Cave-Ayland July 21, 2016, 7:07 a.m. UTC | #1
On 21/07/16 06:55, Sam Bobroff wrote:

> Commit 4322e8c "ppc: Fix 64K pages support in full emulation" added
> the POWERPC_MMU_64K flag to the POWERPC_MMU_2_06 and POWERPC_MMU_2_07
> definitions but not to their "degraded" variants. When running with PR
> KVM, kvm_fixup_page_sizes() removes the POWERPC_MMU_1TSEG flag from
> the MMU value then later ppc_tlb_invalidate_all() expects the value to
> be one from the list, but it isn't because the POWERPC_MMU_64K bit is
> missing from the (otherwise) matching "degraded" entry. This causes
> QEMU to exit with "fatal: Unknown MMU model".
> 
> This patch adds the POWERPC_MMU_64K flag to the POWERPC_MMU_2_06a and
> POWERPC_MMU_2_07a values, preventing the error.
> 
> Signed-off-by: Sam Bobroff <sam.bobroff@au1.ibm.com>
> ---
> I recently discovered that I can't start QEMU with KVM PR for modern
> pseries machines:
> 
> $ rmmod kvm_hv
> $ modprobe kvm-pr
> $ qemu-system-ppc64 -nographic -vga none -machine pseries,accel=kvm
> qemu: fatal: Unknown MMU model
> 
> A quick investigation seems to indicate that it's just a missing flag
> in the MMU definition. If it's really that simple then here's a patch
> for it.
> 
> Cheers,
> Sam.
> 
>  target-ppc/cpu-qom.h | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/target-ppc/cpu-qom.h b/target-ppc/cpu-qom.h
> index 2864105..0f1e011 100644
> --- a/target-ppc/cpu-qom.h
> +++ b/target-ppc/cpu-qom.h
> @@ -71,6 +71,10 @@ enum powerpc_mmu_t {
>  #define POWERPC_MMU_1TSEG    0x00020000
>  #define POWERPC_MMU_AMR      0x00040000
>  #define POWERPC_MMU_64K      0x00080000
> +/* Any entry that include POWERPC_MMU_1TSEG must have a matching
> + * entry without it, because it may be removed by
> + * kvm_fixup_page_sizes() and the new value must exist here.
> + * See ppc_tlb_invalidate_*(). */
>      /* 64 bits PowerPC MMU                                     */
>      POWERPC_MMU_64B        = POWERPC_MMU_64 | 0x00000001,
>      /* Architecture 2.03 and later (has LPCR) */
> @@ -81,6 +85,7 @@ enum powerpc_mmu_t {
>                               | POWERPC_MMU_AMR | 0x00000003,
>      /* Architecture 2.06 "degraded" (no 1T segments)           */
>      POWERPC_MMU_2_06a      = POWERPC_MMU_64 | POWERPC_MMU_AMR
> +                             | POWERPC_MMU_64K
>                               | 0x00000003,
>      /* Architecture 2.07 variant                               */
>      POWERPC_MMU_2_07       = POWERPC_MMU_64 | POWERPC_MMU_1TSEG
> @@ -88,6 +93,7 @@ enum powerpc_mmu_t {
>                               | POWERPC_MMU_AMR | 0x00000004,
>      /* Architecture 2.07 "degraded" (no 1T segments)           */
>      POWERPC_MMU_2_07a      = POWERPC_MMU_64 | POWERPC_MMU_AMR
> +                             | POWERPC_MMU_64K
>                               | 0x00000004,
>  };
>  
> 

Added David as CC to make sure it gets caught by a PPC maintainer.


ATB,

Mark.
Sam Bobroff Dec. 2, 2016, 4:42 a.m. UTC | #2
Ping?

On Thu, Jul 21, 2016 at 08:07:25AM +0100, Mark Cave-Ayland wrote:
> On 21/07/16 06:55, Sam Bobroff wrote:
> 
> > Commit 4322e8c "ppc: Fix 64K pages support in full emulation" added
> > the POWERPC_MMU_64K flag to the POWERPC_MMU_2_06 and POWERPC_MMU_2_07
> > definitions but not to their "degraded" variants. When running with PR
> > KVM, kvm_fixup_page_sizes() removes the POWERPC_MMU_1TSEG flag from
> > the MMU value then later ppc_tlb_invalidate_all() expects the value to
> > be one from the list, but it isn't because the POWERPC_MMU_64K bit is
> > missing from the (otherwise) matching "degraded" entry. This causes
> > QEMU to exit with "fatal: Unknown MMU model".
> > 
> > This patch adds the POWERPC_MMU_64K flag to the POWERPC_MMU_2_06a and
> > POWERPC_MMU_2_07a values, preventing the error.
> > 
> > Signed-off-by: Sam Bobroff <sam.bobroff@au1.ibm.com>
> > ---
> > I recently discovered that I can't start QEMU with KVM PR for modern
> > pseries machines:
> > 
> > $ rmmod kvm_hv
> > $ modprobe kvm-pr
> > $ qemu-system-ppc64 -nographic -vga none -machine pseries,accel=kvm
> > qemu: fatal: Unknown MMU model
> > 
> > A quick investigation seems to indicate that it's just a missing flag
> > in the MMU definition. If it's really that simple then here's a patch
> > for it.
> > 
> > Cheers,
> > Sam.
> > 
> >  target-ppc/cpu-qom.h | 6 ++++++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/target-ppc/cpu-qom.h b/target-ppc/cpu-qom.h
> > index 2864105..0f1e011 100644
> > --- a/target-ppc/cpu-qom.h
> > +++ b/target-ppc/cpu-qom.h
> > @@ -71,6 +71,10 @@ enum powerpc_mmu_t {
> >  #define POWERPC_MMU_1TSEG    0x00020000
> >  #define POWERPC_MMU_AMR      0x00040000
> >  #define POWERPC_MMU_64K      0x00080000
> > +/* Any entry that include POWERPC_MMU_1TSEG must have a matching
> > + * entry without it, because it may be removed by
> > + * kvm_fixup_page_sizes() and the new value must exist here.
> > + * See ppc_tlb_invalidate_*(). */
> >      /* 64 bits PowerPC MMU                                     */
> >      POWERPC_MMU_64B        = POWERPC_MMU_64 | 0x00000001,
> >      /* Architecture 2.03 and later (has LPCR) */
> > @@ -81,6 +85,7 @@ enum powerpc_mmu_t {
> >                               | POWERPC_MMU_AMR | 0x00000003,
> >      /* Architecture 2.06 "degraded" (no 1T segments)           */
> >      POWERPC_MMU_2_06a      = POWERPC_MMU_64 | POWERPC_MMU_AMR
> > +                             | POWERPC_MMU_64K
> >                               | 0x00000003,
> >      /* Architecture 2.07 variant                               */
> >      POWERPC_MMU_2_07       = POWERPC_MMU_64 | POWERPC_MMU_1TSEG
> > @@ -88,6 +93,7 @@ enum powerpc_mmu_t {
> >                               | POWERPC_MMU_AMR | 0x00000004,
> >      /* Architecture 2.07 "degraded" (no 1T segments)           */
> >      POWERPC_MMU_2_07a      = POWERPC_MMU_64 | POWERPC_MMU_AMR
> > +                             | POWERPC_MMU_64K
> >                               | 0x00000004,
> >  };
> >  
> > 
> 
> Added David as CC to make sure it gets caught by a PPC maintainer.
> 
> 
> ATB,
> 
> Mark.
>
Greg Kurz Dec. 2, 2016, 8:15 a.m. UTC | #3
On Fri, 2 Dec 2016 15:42:49 +1100
Sam Bobroff <sam.bobroff@au1.ibm.com> wrote:

> Ping?
> 

The issue got addressed by this commit:

commit 0d594f5565837fe2886a8aa307ef8abb65eab8f7
Author: Thomas Huth <thuth@redhat.com>
Date:   Wed Sep 21 11:42:15 2016 +0200

    ppc/kvm: Mark 64kB page size support as disabled if not available

Cheers.

--
Greg

> On Thu, Jul 21, 2016 at 08:07:25AM +0100, Mark Cave-Ayland wrote:
> > On 21/07/16 06:55, Sam Bobroff wrote:
> >   
> > > Commit 4322e8c "ppc: Fix 64K pages support in full emulation" added
> > > the POWERPC_MMU_64K flag to the POWERPC_MMU_2_06 and POWERPC_MMU_2_07
> > > definitions but not to their "degraded" variants. When running with PR
> > > KVM, kvm_fixup_page_sizes() removes the POWERPC_MMU_1TSEG flag from
> > > the MMU value then later ppc_tlb_invalidate_all() expects the value to
> > > be one from the list, but it isn't because the POWERPC_MMU_64K bit is
> > > missing from the (otherwise) matching "degraded" entry. This causes
> > > QEMU to exit with "fatal: Unknown MMU model".
> > > 
> > > This patch adds the POWERPC_MMU_64K flag to the POWERPC_MMU_2_06a and
> > > POWERPC_MMU_2_07a values, preventing the error.
> > > 
> > > Signed-off-by: Sam Bobroff <sam.bobroff@au1.ibm.com>
> > > ---
> > > I recently discovered that I can't start QEMU with KVM PR for modern
> > > pseries machines:
> > > 
> > > $ rmmod kvm_hv
> > > $ modprobe kvm-pr
> > > $ qemu-system-ppc64 -nographic -vga none -machine pseries,accel=kvm
> > > qemu: fatal: Unknown MMU model
> > > 
> > > A quick investigation seems to indicate that it's just a missing flag
> > > in the MMU definition. If it's really that simple then here's a patch
> > > for it.
> > > 
> > > Cheers,
> > > Sam.
> > > 
> > >  target-ppc/cpu-qom.h | 6 ++++++
> > >  1 file changed, 6 insertions(+)
> > > 
> > > diff --git a/target-ppc/cpu-qom.h b/target-ppc/cpu-qom.h
> > > index 2864105..0f1e011 100644
> > > --- a/target-ppc/cpu-qom.h
> > > +++ b/target-ppc/cpu-qom.h
> > > @@ -71,6 +71,10 @@ enum powerpc_mmu_t {
> > >  #define POWERPC_MMU_1TSEG    0x00020000
> > >  #define POWERPC_MMU_AMR      0x00040000
> > >  #define POWERPC_MMU_64K      0x00080000
> > > +/* Any entry that include POWERPC_MMU_1TSEG must have a matching
> > > + * entry without it, because it may be removed by
> > > + * kvm_fixup_page_sizes() and the new value must exist here.
> > > + * See ppc_tlb_invalidate_*(). */
> > >      /* 64 bits PowerPC MMU                                     */
> > >      POWERPC_MMU_64B        = POWERPC_MMU_64 | 0x00000001,
> > >      /* Architecture 2.03 and later (has LPCR) */
> > > @@ -81,6 +85,7 @@ enum powerpc_mmu_t {
> > >                               | POWERPC_MMU_AMR | 0x00000003,
> > >      /* Architecture 2.06 "degraded" (no 1T segments)           */
> > >      POWERPC_MMU_2_06a      = POWERPC_MMU_64 | POWERPC_MMU_AMR
> > > +                             | POWERPC_MMU_64K
> > >                               | 0x00000003,
> > >      /* Architecture 2.07 variant                               */
> > >      POWERPC_MMU_2_07       = POWERPC_MMU_64 | POWERPC_MMU_1TSEG
> > > @@ -88,6 +93,7 @@ enum powerpc_mmu_t {
> > >                               | POWERPC_MMU_AMR | 0x00000004,
> > >      /* Architecture 2.07 "degraded" (no 1T segments)           */
> > >      POWERPC_MMU_2_07a      = POWERPC_MMU_64 | POWERPC_MMU_AMR
> > > +                             | POWERPC_MMU_64K
> > >                               | 0x00000004,
> > >  };
> > >  
> > >   
> > 
> > Added David as CC to make sure it gets caught by a PPC maintainer.
> > 
> > 
> > ATB,
> > 
> > Mark.
> >   
> 
>
diff mbox

Patch

diff --git a/target-ppc/cpu-qom.h b/target-ppc/cpu-qom.h
index 2864105..0f1e011 100644
--- a/target-ppc/cpu-qom.h
+++ b/target-ppc/cpu-qom.h
@@ -71,6 +71,10 @@  enum powerpc_mmu_t {
 #define POWERPC_MMU_1TSEG    0x00020000
 #define POWERPC_MMU_AMR      0x00040000
 #define POWERPC_MMU_64K      0x00080000
+/* Any entry that include POWERPC_MMU_1TSEG must have a matching
+ * entry without it, because it may be removed by
+ * kvm_fixup_page_sizes() and the new value must exist here.
+ * See ppc_tlb_invalidate_*(). */
     /* 64 bits PowerPC MMU                                     */
     POWERPC_MMU_64B        = POWERPC_MMU_64 | 0x00000001,
     /* Architecture 2.03 and later (has LPCR) */
@@ -81,6 +85,7 @@  enum powerpc_mmu_t {
                              | POWERPC_MMU_AMR | 0x00000003,
     /* Architecture 2.06 "degraded" (no 1T segments)           */
     POWERPC_MMU_2_06a      = POWERPC_MMU_64 | POWERPC_MMU_AMR
+                             | POWERPC_MMU_64K
                              | 0x00000003,
     /* Architecture 2.07 variant                               */
     POWERPC_MMU_2_07       = POWERPC_MMU_64 | POWERPC_MMU_1TSEG
@@ -88,6 +93,7 @@  enum powerpc_mmu_t {
                              | POWERPC_MMU_AMR | 0x00000004,
     /* Architecture 2.07 "degraded" (no 1T segments)           */
     POWERPC_MMU_2_07a      = POWERPC_MMU_64 | POWERPC_MMU_AMR
+                             | POWERPC_MMU_64K
                              | 0x00000004,
 };