qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] target/ppc: fix CPU hotplug when radix is enabled (TCG)
@ 2017-07-14 16:13 Cédric Le Goater
  2017-07-17  1:05 ` David Gibson
  2017-07-17  6:28 ` Suraj Jitindar Singh
  0 siblings, 2 replies; 3+ messages in thread
From: Cédric Le Goater @ 2017-07-14 16:13 UTC (permalink / raw)
  To: David Gibson
  Cc: Suraj Jitindar Singh, qemu-ppc, qemu-devel, Cédric Le Goater

But when a guest initializes radix mode, it issues a H_REGISTER_PROC_TBL
to update the LPCR of all CPUs. Hot-plugged CPUs inherit from the same
setting under KVM but not under TCG. So, Let's check for radix and update
the default LPCR to keep new CPUs in sync.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 target/ppc/translate_init.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/target/ppc/translate_init.c b/target/ppc/translate_init.c
index 8b9807665dd5..8776e9b0f8fa 100644
--- a/target/ppc/translate_init.c
+++ b/target/ppc/translate_init.c
@@ -9014,8 +9014,16 @@ void cpu_ppc_set_papr(PowerPCCPU *cpu, PPCVirtualHypervisor *vhyp)
         /* By default we choose legacy mode and switch to new hash or radix
          * when a register process table hcall is made. So disable process
          * tables and guest translation shootdown by default
+         *
+         * Hot-plugged CPUs inherit from the guest radix setting under
+         * KVM but not under TCG. Update the default LPCR to keep new
+         * CPUs in sync when radix is enabled.
          */
-        lpcr->default_value &= ~(LPCR_UPRT | LPCR_GTSE);
+        if (ppc64_radix_guest(cpu)) {
+            lpcr->default_value |= LPCR_UPRT | LPCR_GTSE;
+        } else {
+            lpcr->default_value &= ~(LPCR_UPRT | LPCR_GTSE);
+        }
         lpcr->default_value |= LPCR_PDEE | LPCR_HDEE | LPCR_EEE | LPCR_DEE |
                                LPCR_OEE;
         break;
-- 
2.7.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] target/ppc: fix CPU hotplug when radix is enabled (TCG)
  2017-07-14 16:13 [Qemu-devel] [PATCH] target/ppc: fix CPU hotplug when radix is enabled (TCG) Cédric Le Goater
@ 2017-07-17  1:05 ` David Gibson
  2017-07-17  6:28 ` Suraj Jitindar Singh
  1 sibling, 0 replies; 3+ messages in thread
From: David Gibson @ 2017-07-17  1:05 UTC (permalink / raw)
  To: Cédric Le Goater; +Cc: Suraj Jitindar Singh, qemu-ppc, qemu-devel

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

On Fri, Jul 14, 2017 at 06:13:58PM +0200, Cédric Le Goater wrote:
> But when a guest initializes radix mode, it issues a H_REGISTER_PROC_TBL
> to update the LPCR of all CPUs. Hot-plugged CPUs inherit from the same
> setting under KVM but not under TCG. So, Let's check for radix and update
> the default LPCR to keep new CPUs in sync.
> 
> Signed-off-by: Cédric Le Goater <clg@kaod.org>

Applied to ppc-for-2.10, thanks.

> ---
>  target/ppc/translate_init.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/target/ppc/translate_init.c b/target/ppc/translate_init.c
> index 8b9807665dd5..8776e9b0f8fa 100644
> --- a/target/ppc/translate_init.c
> +++ b/target/ppc/translate_init.c
> @@ -9014,8 +9014,16 @@ void cpu_ppc_set_papr(PowerPCCPU *cpu, PPCVirtualHypervisor *vhyp)
>          /* By default we choose legacy mode and switch to new hash or radix
>           * when a register process table hcall is made. So disable process
>           * tables and guest translation shootdown by default
> +         *
> +         * Hot-plugged CPUs inherit from the guest radix setting under
> +         * KVM but not under TCG. Update the default LPCR to keep new
> +         * CPUs in sync when radix is enabled.
>           */
> -        lpcr->default_value &= ~(LPCR_UPRT | LPCR_GTSE);
> +        if (ppc64_radix_guest(cpu)) {
> +            lpcr->default_value |= LPCR_UPRT | LPCR_GTSE;
> +        } else {
> +            lpcr->default_value &= ~(LPCR_UPRT | LPCR_GTSE);
> +        }
>          lpcr->default_value |= LPCR_PDEE | LPCR_HDEE | LPCR_EEE | LPCR_DEE |
>                                 LPCR_OEE;
>          break;

-- 
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 --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] target/ppc: fix CPU hotplug when radix is enabled (TCG)
  2017-07-14 16:13 [Qemu-devel] [PATCH] target/ppc: fix CPU hotplug when radix is enabled (TCG) Cédric Le Goater
  2017-07-17  1:05 ` David Gibson
@ 2017-07-17  6:28 ` Suraj Jitindar Singh
  1 sibling, 0 replies; 3+ messages in thread
From: Suraj Jitindar Singh @ 2017-07-17  6:28 UTC (permalink / raw)
  To: Cédric Le Goater, David Gibson; +Cc: qemu-ppc, qemu-devel

On Fri, 2017-07-14 at 18:13 +0200, Cédric Le Goater wrote:
> But when a guest initializes radix mode, it issues a
> H_REGISTER_PROC_TBL
> to update the LPCR of all CPUs. Hot-plugged CPUs inherit from the
> same
> setting under KVM but not under TCG. So, Let's check for radix and
> update
> the default LPCR to keep new CPUs in sync.
> 
> Signed-off-by: Cédric Le Goater <clg@kaod.org>

Reviewed-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>

> ---
>  target/ppc/translate_init.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/target/ppc/translate_init.c
> b/target/ppc/translate_init.c
> index 8b9807665dd5..8776e9b0f8fa 100644
> --- a/target/ppc/translate_init.c
> +++ b/target/ppc/translate_init.c
> @@ -9014,8 +9014,16 @@ void cpu_ppc_set_papr(PowerPCCPU *cpu,
> PPCVirtualHypervisor *vhyp)
>          /* By default we choose legacy mode and switch to new hash
> or radix
>           * when a register process table hcall is made. So disable
> process
>           * tables and guest translation shootdown by default
> +         *
> +         * Hot-plugged CPUs inherit from the guest radix setting
> under
> +         * KVM but not under TCG. Update the default LPCR to keep
> new
> +         * CPUs in sync when radix is enabled.
>           */
> -        lpcr->default_value &= ~(LPCR_UPRT | LPCR_GTSE);
> +        if (ppc64_radix_guest(cpu)) {
> +            lpcr->default_value |= LPCR_UPRT | LPCR_GTSE;

Since we can't do radix without GTSE, I guess for now at least RADIX
implies GTSE.

> +        } else {
> +            lpcr->default_value &= ~(LPCR_UPRT | LPCR_GTSE);
> +        }
>          lpcr->default_value |= LPCR_PDEE | LPCR_HDEE | LPCR_EEE |
> LPCR_DEE |
>                                 LPCR_OEE;
>          break;

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-07-17  6:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-14 16:13 [Qemu-devel] [PATCH] target/ppc: fix CPU hotplug when radix is enabled (TCG) Cédric Le Goater
2017-07-17  1:05 ` David Gibson
2017-07-17  6:28 ` Suraj Jitindar Singh

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).