qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
To: David Gibson <david@gibson.dropbear.id.au>,
	groug@kaod.org, mdroth@linux.vnet.ibm.com, surajjs@au1.ibm.com
Cc: satheera@in.ibm.com, qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH] spapr: Correct compatibility mode setting for hotplugged CPUs
Date: Thu, 4 Jan 2018 16:02:05 -0200	[thread overview]
Message-ID: <7e394ec8-a0fd-f89b-379f-4a85758627d5@linux.vnet.ibm.com> (raw)
In-Reply-To: <20180104042405.29773-1-david@gibson.dropbear.id.au>



On 01/04/2018 02:24 AM, David Gibson wrote:
> Currently the pseries machine sets the compatibility mode for the
> guest's cpus in two places: 1) at machine reset and 2) after CAS
> negotiation.
>
> This means that if we set or negotiate a compatiblity mode, then

s/compatiblity/compatibility

> hotplug a cpu, the hotplugged cpu doesn't get the right mode set and
> will incorrectly have the full native features.
>
> To correct this, we set the compatibility mode on a cpu when it is
> brought online with the 'start-cpu' RTAS call.  Given that we no
> longer need to set the compatibility mode on all CPUs at machine
> reset, so we change that to only set the mode for the boot cpu.
>
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> ---
Reviewed-by: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
>   hw/ppc/spapr.c      | 2 +-
>   hw/ppc/spapr_rtas.c | 8 ++++++++
>   2 files changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index e22888ba06..d1acfe8858 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -1510,7 +1510,7 @@ static void spapr_machine_reset(void)
>           spapr_ovec_cleanup(spapr->ov5_cas);
>           spapr->ov5_cas = spapr_ovec_new();
>
> -        ppc_set_compat_all(spapr->max_compat_pvr, &error_fatal);
> +        ppc_set_compat(first_ppc_cpu, spapr->max_compat_pvr, &error_fatal);
>       }
>
>       fdt = spapr_build_fdt(spapr, rtas_addr, spapr->rtas_size);
> diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
> index 4bb939d3d1..2ed00548c1 100644
> --- a/hw/ppc/spapr_rtas.c
> +++ b/hw/ppc/spapr_rtas.c
> @@ -163,6 +163,7 @@ static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPRMachineState *spapr,
>           CPUState *cs = CPU(cpu);
>           CPUPPCState *env = &cpu->env;
>           PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu);
> +        Error *local_err = NULL;
>
>           if (!cs->halted) {
>               rtas_st(rets, 0, RTAS_OUT_HW_ERROR);
> @@ -174,6 +175,13 @@ static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPRMachineState *spapr,
>            * new cpu enters */
>           kvm_cpu_synchronize_state(cs);
>
> +        /* Set compatibility mode to match existing cpus */
> +        ppc_set_compat(cpu, POWERPC_CPU(first_cpu)->compat_pvr, &local_err);
> +        if (local_err) {
> +            rtas_st(rets, 0, RTAS_OUT_HW_ERROR);
> +            return;
> +        }
> +
>           env->msr = (1ULL << MSR_SF) | (1ULL << MSR_ME);
>
>           /* Enable Power-saving mode Exit Cause exceptions for the new CPU */

      parent reply	other threads:[~2018-01-04 18:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-04  4:24 [Qemu-devel] [PATCH] spapr: Correct compatibility mode setting for hotplugged CPUs David Gibson
2018-01-04  4:35 ` Alexey Kardashevskiy
2018-01-04 17:47 ` Greg Kurz
2018-01-04 21:11   ` Michael Roth
2018-01-05  3:37     ` David Gibson
2018-01-05  3:07   ` David Gibson
2018-01-11 12:24     ` Greg Kurz
2018-01-12  1:47       ` David Gibson
2018-01-04 18:02 ` Daniel Henrique Barboza [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=7e394ec8-a0fd-f89b-379f-4a85758627d5@linux.vnet.ibm.com \
    --to=danielhb@linux.vnet.ibm.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=groug@kaod.org \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=satheera@in.ibm.com \
    --cc=surajjs@au1.ibm.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).