qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH qemu] target/ppc: Add Directed Privileged Door-bell Exception State (DPDES) SPR
@ 2019-08-16  6:17 Alexey Kardashevskiy
  2019-08-17  3:29 ` David Gibson
  0 siblings, 1 reply; 2+ messages in thread
From: Alexey Kardashevskiy @ 2019-08-16  6:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alexey Kardashevskiy, Paul Mackerras, qemu-ppc, David Gibson

DPDES stores a status of a doorbell message and if it is lost in
migration, the destination CPU won't receive it. This does not hit us
much as IPIs complete too quick to catch a pending one and even if
we missed one, broadcasts happen often enough to wake that CPU.

This defines DPDES and registers with KVM for migration.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
 target/ppc/cpu.h                |  1 +
 target/ppc/translate_init.inc.c | 14 ++++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
index 64799386f9ab..f0521a435d2d 100644
--- a/target/ppc/cpu.h
+++ b/target/ppc/cpu.h
@@ -1466,6 +1466,7 @@ typedef PowerPCCPU ArchCPU;
 #define SPR_MPC_ICTRL         (0x09E)
 #define SPR_MPC_BAR           (0x09F)
 #define SPR_PSPB              (0x09F)
+#define SPR_DPDES             (0x0B0)
 #define SPR_DAWR              (0x0B4)
 #define SPR_RPR               (0x0BA)
 #define SPR_CIABR             (0x0BB)
diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.inc.c
index c9fcd87095f5..7e41ae145600 100644
--- a/target/ppc/translate_init.inc.c
+++ b/target/ppc/translate_init.inc.c
@@ -8198,6 +8198,18 @@ static void gen_spr_power8_pspb(CPUPPCState *env)
                      KVM_REG_PPC_PSPB, 0);
 }
 
+static void gen_spr_power8_dpdes(CPUPPCState *env)
+{
+#if !defined(CONFIG_USER_ONLY)
+    /* Directed Privileged Door-bell Exception State, used for IPI */
+    spr_register_kvm_hv(env, SPR_DPDES, "DPDES",
+                        SPR_NOACCESS, SPR_NOACCESS,
+                        &spr_read_generic, SPR_NOACCESS,
+                        &spr_read_generic, &spr_write_generic,
+                        KVM_REG_PPC_DPDES, 0x00000000);
+#endif
+}
+
 static void gen_spr_power8_ic(CPUPPCState *env)
 {
 #if !defined(CONFIG_USER_ONLY)
@@ -8629,6 +8641,7 @@ static void init_proc_POWER8(CPUPPCState *env)
     gen_spr_power8_pmu_user(env);
     gen_spr_power8_tm(env);
     gen_spr_power8_pspb(env);
+    gen_spr_power8_dpdes(env);
     gen_spr_vtb(env);
     gen_spr_power8_ic(env);
     gen_spr_power8_book4(env);
@@ -8817,6 +8830,7 @@ static void init_proc_POWER9(CPUPPCState *env)
     gen_spr_power8_pmu_user(env);
     gen_spr_power8_tm(env);
     gen_spr_power8_pspb(env);
+    gen_spr_power8_dpdes(env);
     gen_spr_vtb(env);
     gen_spr_power8_ic(env);
     gen_spr_power8_book4(env);
-- 
2.17.1



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

* Re: [Qemu-devel] [PATCH qemu] target/ppc: Add Directed Privileged Door-bell Exception State (DPDES) SPR
  2019-08-16  6:17 [Qemu-devel] [PATCH qemu] target/ppc: Add Directed Privileged Door-bell Exception State (DPDES) SPR Alexey Kardashevskiy
@ 2019-08-17  3:29 ` David Gibson
  0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2019-08-17  3:29 UTC (permalink / raw)
  To: Alexey Kardashevskiy; +Cc: Paul Mackerras, qemu-ppc, qemu-devel

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

On Fri, Aug 16, 2019 at 04:17:33PM +1000, Alexey Kardashevskiy wrote:
> DPDES stores a status of a doorbell message and if it is lost in
> migration, the destination CPU won't receive it. This does not hit us
> much as IPIs complete too quick to catch a pending one and even if
> we missed one, broadcasts happen often enough to wake that CPU.
> 
> This defines DPDES and registers with KVM for migration.
> 
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>

Ouch, I'm kind of surprised this hasn't bitten us before.

Really we ought to also wire this up to the emulated doorbell
instructions as well, but this certainly improves the behaviour so
I've merged it to ppc-for-4.2.

> ---
>  target/ppc/cpu.h                |  1 +
>  target/ppc/translate_init.inc.c | 14 ++++++++++++++
>  2 files changed, 15 insertions(+)
> 
> diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
> index 64799386f9ab..f0521a435d2d 100644
> --- a/target/ppc/cpu.h
> +++ b/target/ppc/cpu.h
> @@ -1466,6 +1466,7 @@ typedef PowerPCCPU ArchCPU;
>  #define SPR_MPC_ICTRL         (0x09E)
>  #define SPR_MPC_BAR           (0x09F)
>  #define SPR_PSPB              (0x09F)
> +#define SPR_DPDES             (0x0B0)
>  #define SPR_DAWR              (0x0B4)
>  #define SPR_RPR               (0x0BA)
>  #define SPR_CIABR             (0x0BB)
> diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.inc.c
> index c9fcd87095f5..7e41ae145600 100644
> --- a/target/ppc/translate_init.inc.c
> +++ b/target/ppc/translate_init.inc.c
> @@ -8198,6 +8198,18 @@ static void gen_spr_power8_pspb(CPUPPCState *env)
>                       KVM_REG_PPC_PSPB, 0);
>  }
>  
> +static void gen_spr_power8_dpdes(CPUPPCState *env)
> +{
> +#if !defined(CONFIG_USER_ONLY)
> +    /* Directed Privileged Door-bell Exception State, used for IPI */
> +    spr_register_kvm_hv(env, SPR_DPDES, "DPDES",
> +                        SPR_NOACCESS, SPR_NOACCESS,
> +                        &spr_read_generic, SPR_NOACCESS,
> +                        &spr_read_generic, &spr_write_generic,
> +                        KVM_REG_PPC_DPDES, 0x00000000);
> +#endif
> +}
> +
>  static void gen_spr_power8_ic(CPUPPCState *env)
>  {
>  #if !defined(CONFIG_USER_ONLY)
> @@ -8629,6 +8641,7 @@ static void init_proc_POWER8(CPUPPCState *env)
>      gen_spr_power8_pmu_user(env);
>      gen_spr_power8_tm(env);
>      gen_spr_power8_pspb(env);
> +    gen_spr_power8_dpdes(env);
>      gen_spr_vtb(env);
>      gen_spr_power8_ic(env);
>      gen_spr_power8_book4(env);
> @@ -8817,6 +8830,7 @@ static void init_proc_POWER9(CPUPPCState *env)
>      gen_spr_power8_pmu_user(env);
>      gen_spr_power8_tm(env);
>      gen_spr_power8_pspb(env);
> +    gen_spr_power8_dpdes(env);
>      gen_spr_vtb(env);
>      gen_spr_power8_ic(env);
>      gen_spr_power8_book4(env);

-- 
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] 2+ messages in thread

end of thread, other threads:[~2019-08-17  4:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-16  6:17 [Qemu-devel] [PATCH qemu] target/ppc: Add Directed Privileged Door-bell Exception State (DPDES) SPR Alexey Kardashevskiy
2019-08-17  3:29 ` David Gibson

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