diff mbox series

KVM: PPC: Book3S PR: Set hflag to indicate that POWER9 supports 1T segments

Message ID 20181207034326.3564-2-sjitindarsingh@gmail.com
State Not Applicable
Headers show
Series KVM: PPC: Book3S PR: Set hflag to indicate that POWER9 supports 1T segments | expand

Commit Message

Suraj Jitindar Singh Dec. 7, 2018, 3:43 a.m. UTC
When booting a kvm-pr guest on a POWER9 machine the following message is
observed:
"qemu-system-ppc64: KVM does not support 1TiB segments which guest expects"

This is because the guest is expecting to be able to use 1T segments
however we don't indicate support for it. This is because we don't set
the BOOK3S_HFLAG_MULTI_PGSIZE flag in the hflags in kvmppc_set_pvr_pr()
on POWER9.

POWER9 does indeed have support for 1T segments, so add a case for
POWER9 to the switch statement to ensure it is set.

Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
---
 arch/powerpc/kvm/book3s_pr.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Michael Ellerman Dec. 7, 2018, 11:08 a.m. UTC | #1
Suraj Jitindar Singh <sjitindarsingh@gmail.com> writes:

> When booting a kvm-pr guest on a POWER9 machine the following message is
> observed:
> "qemu-system-ppc64: KVM does not support 1TiB segments which guest expects"
>
> This is because the guest is expecting to be able to use 1T segments
> however we don't indicate support for it. This is because we don't set
> the BOOK3S_HFLAG_MULTI_PGSIZE flag in the hflags in kvmppc_set_pvr_pr()
> on POWER9.
>
> POWER9 does indeed have support for 1T segments, so add a case for
> POWER9 to the switch statement to ensure it is set.

If this just checked mmu_has_feature(MMU_FTR_1T_SEGMENT) it would have
been right in this case, and we'd also never have to update it in
future.

Any reason not to?

cheers

> diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
> index 4efd65d9e828..82840160c606 100644
> --- a/arch/powerpc/kvm/book3s_pr.c
> +++ b/arch/powerpc/kvm/book3s_pr.c
> @@ -587,6 +587,7 @@ void kvmppc_set_pvr_pr(struct kvm_vcpu *vcpu, u32 pvr)
>  	case PVR_POWER8:
>  	case PVR_POWER8E:
>  	case PVR_POWER8NVL:
> +	case PVR_POWER9:
>  		vcpu->arch.hflags |= BOOK3S_HFLAG_MULTI_PGSIZE |
>  			BOOK3S_HFLAG_NEW_TLBIE;
>  		break;
> -- 
> 2.13.6
Paul Mackerras Dec. 7, 2018, 11:42 a.m. UTC | #2
On Fri, Dec 07, 2018 at 10:08:20PM +1100, Michael Ellerman wrote:
> Suraj Jitindar Singh <sjitindarsingh@gmail.com> writes:
> 
> > When booting a kvm-pr guest on a POWER9 machine the following message is
> > observed:
> > "qemu-system-ppc64: KVM does not support 1TiB segments which guest expects"
> >
> > This is because the guest is expecting to be able to use 1T segments
> > however we don't indicate support for it. This is because we don't set
> > the BOOK3S_HFLAG_MULTI_PGSIZE flag in the hflags in kvmppc_set_pvr_pr()
> > on POWER9.
> >
> > POWER9 does indeed have support for 1T segments, so add a case for
> > POWER9 to the switch statement to ensure it is set.
> 
> If this just checked mmu_has_feature(MMU_FTR_1T_SEGMENT) it would have
> been right in this case, and we'd also never have to update it in
> future.
> 
> Any reason not to?

PR KVM can emulate a different processor from the host.  Checking
mmu_has_feature() will tell you about the host, not the CPU being
emulated.

Paul.
Paul Mackerras Dec. 18, 2018, 1 a.m. UTC | #3
On Fri, Dec 07, 2018 at 02:43:18PM +1100, Suraj Jitindar Singh wrote:
> When booting a kvm-pr guest on a POWER9 machine the following message is
> observed:
> "qemu-system-ppc64: KVM does not support 1TiB segments which guest expects"
> 
> This is because the guest is expecting to be able to use 1T segments
> however we don't indicate support for it. This is because we don't set
> the BOOK3S_HFLAG_MULTI_PGSIZE flag in the hflags in kvmppc_set_pvr_pr()
> on POWER9.
> 
> POWER9 does indeed have support for 1T segments, so add a case for
> POWER9 to the switch statement to ensure it is set.
> 
> Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>

Thanks, patch applied to my kvm-ppc-next branch.

Paul.
diff mbox series

Patch

diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
index 4efd65d9e828..82840160c606 100644
--- a/arch/powerpc/kvm/book3s_pr.c
+++ b/arch/powerpc/kvm/book3s_pr.c
@@ -587,6 +587,7 @@  void kvmppc_set_pvr_pr(struct kvm_vcpu *vcpu, u32 pvr)
 	case PVR_POWER8:
 	case PVR_POWER8E:
 	case PVR_POWER8NVL:
+	case PVR_POWER9:
 		vcpu->arch.hflags |= BOOK3S_HFLAG_MULTI_PGSIZE |
 			BOOK3S_HFLAG_NEW_TLBIE;
 		break;