qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Laurent Vivier <lvivier@redhat.com>
Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org,
	Suraj Jitindar Singh <sjitindarsingh@gmail.com>
Subject: Re: [Qemu-devel] [PATCH] spapr: don't initialize PATB entry if max-cpu-compat < power9
Date: Fri, 15 Dec 2017 09:50:41 +1100	[thread overview]
Message-ID: <20171214225041.GZ2226@umbus.fritz.box> (raw)
In-Reply-To: <20171214180948.981-1-lvivier@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 2461 bytes --]

On Thu, Dec 14, 2017 at 07:09:48PM +0100, Laurent Vivier wrote:
> if KVM is enabled and KVM capabilities MMU radix is available,
> the partition table entry (patb_entry) for the radix mode is
> initialized by default in ppc_spapr_reset().
> 
> It's a problem if we want to migrate the guest to a POWER8 host
> while the kernel is not started to set the value to the one
> expected for a POWER8 CPU.
> 
> The "-machine max-cpu-compat=power8" should allow to migrate
> a POWER9 KVM host to a POWER8 KVM host, but because patb_entry
> is set, the destination QEMU tries to enable radix mode on the
> POWER8 host. This fails and cancels the migration:
> 
>     Process table config unsupported by the host
>     error while loading state for instance 0x0 of device 'spapr'
>     load of migration failed: Invalid argument
> 
> This patch doesn't set the PATB entry if the user provides
> a CPU compatibility mode that doesn't support radix mode.
> 
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>

Applied to ppc-for-2.12.

> ---
>  hw/ppc/spapr.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 1ac7eb0f8c..66d0ed5256 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -1440,7 +1440,10 @@ static void ppc_spapr_reset(void)
>      /* Check for unknown sysbus devices */
>      foreach_dynamic_sysbus_device(find_unknown_sysbus_device, NULL);
>  
> -    if (kvm_enabled() && kvmppc_has_cap_mmu_radix()) {
> +    first_ppc_cpu = POWERPC_CPU(first_cpu);
> +    if (kvm_enabled() && kvmppc_has_cap_mmu_radix() &&
> +        ppc_check_compat(first_ppc_cpu, CPU_POWERPC_LOGICAL_3_00, 0,
> +                         spapr->max_compat_pvr)) {
>          /* If using KVM with radix mode available, VCPUs can be started
>           * without a HPT because KVM will start them in radix mode.
>           * Set the GR bit in PATB so that we know there is no HPT. */
> @@ -1499,7 +1502,6 @@ static void ppc_spapr_reset(void)
>      g_free(fdt);
>  
>      /* Set up the entry state */
> -    first_ppc_cpu = POWERPC_CPU(first_cpu);
>      first_ppc_cpu->env.gpr[3] = fdt_addr;
>      first_ppc_cpu->env.gpr[5] = 0;
>      first_cpu->halted = 0;

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2017-12-14 23:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-14 18:09 [Qemu-devel] [PATCH] spapr: don't initialize PATB entry if max-cpu-compat < power9 Laurent Vivier
2017-12-14 22:50 ` David Gibson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171214225041.GZ2226@umbus.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=lvivier@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=sjitindarsingh@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).