diff mbox

[14/17] ppc: Add dummy write to VTB

Message ID 1457974600-13828-15-git-send-email-clg@fr.ibm.com
State New
Headers show

Commit Message

Cédric Le Goater March 14, 2016, 4:56 p.m. UTC
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>

The Hypervisor can write it. We don't handle that properly yet but
at least let's not blow up when it is written.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 target-ppc/translate_init.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

Comments

Thomas Huth March 14, 2016, 8:54 p.m. UTC | #1
On 14.03.2016 17:56, Cédric Le Goater wrote:
> From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> 
> The Hypervisor can write it. We don't handle that properly yet but
> at least let's not blow up when it is written.
> 
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
>  target-ppc/translate_init.c | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
> index 2fac6ea58698..28a9c2e73156 100644
> --- a/target-ppc/translate_init.c
> +++ b/target-ppc/translate_init.c
> @@ -300,6 +300,12 @@ static void spr_write_purr(DisasContext *ctx, int gprn, int sprn)
>      /* Temporary placeholder */
>  }
>  
> +__attribute__ ((unused))
> +static void spr_write_vtb(DisasContext *ctx, int gprn, int sprn)
> +{
> +    /* Temporary placeholder */
> +}

Why "__attribute__ ((unused))" here (again)?

>  #endif
>  #endif
>  
> @@ -8089,10 +8095,11 @@ static void gen_spr_power8_ebb(CPUPPCState *env)
>  /* Virtual Time Base */
>  static void gen_spr_vtb(CPUPPCState *env)
>  {
> -    spr_register(env, SPR_VTB, "VTB",
> -                 SPR_NOACCESS, SPR_NOACCESS,
> -                 &spr_read_tbl, SPR_NOACCESS,
> -                 0x00000000);
> +    spr_register_hv(env, SPR_VTB, "VTB",
> +                   SPR_NOACCESS, SPR_NOACCESS,
> +                   &spr_read_tbl, SPR_NOACCESS,
> +                   &spr_read_tbl, spr_write_vtb,
> +                   0x00000000);
>  }

I think it would also be possible to use spr_access_nop() for now
instead of introducing more dummy functions like spr_write_vtb.

 Thomas
Benjamin Herrenschmidt March 14, 2016, 9:07 p.m. UTC | #2
On Mon, 2016-03-14 at 21:54 +0100, Thomas Huth wrote:
> I think it would also be possible to use spr_access_nop() for now
> instead of introducing more dummy functions like spr_write_vtb.

Well, the goal was to eventually put some real code in there...

Cheers,
Ben.
David Gibson March 16, 2016, 1:12 a.m. UTC | #3
On Mon, Mar 14, 2016 at 05:56:37PM +0100, Cédric Le Goater wrote:
> From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> 
> The Hypervisor can write it. We don't handle that properly yet but
> at least let's not blow up when it is written.
> 
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

AFAICT this should be for 2.7, not 2.6?

> ---
>  target-ppc/translate_init.c | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
> index 2fac6ea58698..28a9c2e73156 100644
> --- a/target-ppc/translate_init.c
> +++ b/target-ppc/translate_init.c
> @@ -300,6 +300,12 @@ static void spr_write_purr(DisasContext *ctx, int gprn, int sprn)
>      /* Temporary placeholder */
>  }
>  
> +__attribute__ ((unused))
> +static void spr_write_vtb(DisasContext *ctx, int gprn, int sprn)
> +{
> +    /* Temporary placeholder */
> +}
> +
>  #endif
>  #endif
>  
> @@ -8089,10 +8095,11 @@ static void gen_spr_power8_ebb(CPUPPCState *env)
>  /* Virtual Time Base */
>  static void gen_spr_vtb(CPUPPCState *env)
>  {
> -    spr_register(env, SPR_VTB, "VTB",
> -                 SPR_NOACCESS, SPR_NOACCESS,
> -                 &spr_read_tbl, SPR_NOACCESS,
> -                 0x00000000);
> +    spr_register_hv(env, SPR_VTB, "VTB",
> +                   SPR_NOACCESS, SPR_NOACCESS,
> +                   &spr_read_tbl, SPR_NOACCESS,
> +                   &spr_read_tbl, spr_write_vtb,
> +                   0x00000000);
>  }
>  
>  static void gen_spr_power8_fscr(CPUPPCState *env)
diff mbox

Patch

diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index 2fac6ea58698..28a9c2e73156 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -300,6 +300,12 @@  static void spr_write_purr(DisasContext *ctx, int gprn, int sprn)
     /* Temporary placeholder */
 }
 
+__attribute__ ((unused))
+static void spr_write_vtb(DisasContext *ctx, int gprn, int sprn)
+{
+    /* Temporary placeholder */
+}
+
 #endif
 #endif
 
@@ -8089,10 +8095,11 @@  static void gen_spr_power8_ebb(CPUPPCState *env)
 /* Virtual Time Base */
 static void gen_spr_vtb(CPUPPCState *env)
 {
-    spr_register(env, SPR_VTB, "VTB",
-                 SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_tbl, SPR_NOACCESS,
-                 0x00000000);
+    spr_register_hv(env, SPR_VTB, "VTB",
+                   SPR_NOACCESS, SPR_NOACCESS,
+                   &spr_read_tbl, SPR_NOACCESS,
+                   &spr_read_tbl, spr_write_vtb,
+                   0x00000000);
 }
 
 static void gen_spr_power8_fscr(CPUPPCState *env)