All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/1] target/ppc: Fix emulated userspace access to USPRG3
@ 2017-04-20  1:44 Sam Bobroff
  2017-04-20  1:48 ` David Gibson
  0 siblings, 1 reply; 2+ messages in thread
From: Sam Bobroff @ 2017-04-20  1:44 UTC (permalink / raw)
  To: qemu-ppc; +Cc: qemu-devel, david

On a fully emulated Power8 system, user space is currently unable to
read from USPRG3 (SPR number 0x103) because it receives an illegal
instruction exception.

However the ISA indicates that it should have read access (to the
content of SPR 0x113, similar to some other registers with user space
read-only counterparts).

This patch registers the new SPR for Book 3S processors and has it
provide read-only access to SPR 0x113.

Signed-off-by: Sam Bobroff <sam.bobroff@au1.ibm.com>
---
 target/ppc/translate_init.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/target/ppc/translate_init.c b/target/ppc/translate_init.c
index c1a901455c..f863875835 100644
--- a/target/ppc/translate_init.c
+++ b/target/ppc/translate_init.c
@@ -8235,6 +8235,14 @@ static void gen_spr_power8_rpr(CPUPPCState *env)
 #endif
 }
 
+static void gen_spr_book3s_usprg3(CPUPPCState *env)
+{
+    spr_register(env, SPR_USPRG3, "USPRG3",
+                 &spr_read_ureg, SPR_NOACCESS,
+                 &spr_read_ureg, SPR_NOACCESS,
+                 0x00000000);
+}
+
 static void init_proc_book3s_common(CPUPPCState *env)
 {
     gen_spr_ne_601(env);
@@ -8243,6 +8251,7 @@ static void init_proc_book3s_common(CPUPPCState *env)
     gen_spr_book3s_pmu_sup(env);
     gen_spr_book3s_pmu_user(env);
     gen_spr_book3s_ctrl(env);
+    gen_spr_book3s_usprg3(env);
 }
 
 static void init_proc_970(CPUPPCState *env)
-- 
2.12.1.382.gc0f9c7058

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

* Re: [Qemu-devel] [PATCH 1/1] target/ppc: Fix emulated userspace access to USPRG3
  2017-04-20  1:44 [Qemu-devel] [PATCH 1/1] target/ppc: Fix emulated userspace access to USPRG3 Sam Bobroff
@ 2017-04-20  1:48 ` David Gibson
  0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2017-04-20  1:48 UTC (permalink / raw)
  To: Sam Bobroff; +Cc: qemu-ppc, qemu-devel

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

On Thu, Apr 20, 2017 at 11:44:17AM +1000, Sam Bobroff wrote:
> On a fully emulated Power8 system, user space is currently unable to
> read from USPRG3 (SPR number 0x103) because it receives an illegal
> instruction exception.
> 
> However the ISA indicates that it should have read access (to the
> content of SPR 0x113, similar to some other registers with user space
> read-only counterparts).
> 
> This patch registers the new SPR for Book 3S processors and has it
> provide read-only access to SPR 0x113.
> 
> Signed-off-by: Sam Bobroff <sam.bobroff@au1.ibm.com>

Heh.  I merged a more or less equivalent patch from someone else just
this morning.

> ---
>  target/ppc/translate_init.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/target/ppc/translate_init.c b/target/ppc/translate_init.c
> index c1a901455c..f863875835 100644
> --- a/target/ppc/translate_init.c
> +++ b/target/ppc/translate_init.c
> @@ -8235,6 +8235,14 @@ static void gen_spr_power8_rpr(CPUPPCState *env)
>  #endif
>  }
>  
> +static void gen_spr_book3s_usprg3(CPUPPCState *env)
> +{
> +    spr_register(env, SPR_USPRG3, "USPRG3",
> +                 &spr_read_ureg, SPR_NOACCESS,
> +                 &spr_read_ureg, SPR_NOACCESS,
> +                 0x00000000);
> +}
> +
>  static void init_proc_book3s_common(CPUPPCState *env)
>  {
>      gen_spr_ne_601(env);
> @@ -8243,6 +8251,7 @@ static void init_proc_book3s_common(CPUPPCState *env)
>      gen_spr_book3s_pmu_sup(env);
>      gen_spr_book3s_pmu_user(env);
>      gen_spr_book3s_ctrl(env);
> +    gen_spr_book3s_usprg3(env);
>  }
>  
>  static void init_proc_970(CPUPPCState *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: 819 bytes --]

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

end of thread, other threads:[~2017-04-20  2:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-20  1:44 [Qemu-devel] [PATCH 1/1] target/ppc: Fix emulated userspace access to USPRG3 Sam Bobroff
2017-04-20  1:48 ` David Gibson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.