Skip to contentSkip to conversation

target-ppc: disable unsupported modes for SPR_CTRL/SPR_UCTRL

PATCH Applied Alexey Kardashevskiy 2 participants 3 messages Dec 23, 2013 – Jan 20, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target-ppc: disable unsupported modes for SPR_CTRL/SPR_UCTRL

The Figure 17 "SPR encodings" of the PowerISA 2.07 describes CTRL SPR as:

priviledged
# spr5-9 spr0-4 name mtspr mfspr len cat

136 00100  01000  CTRL   -    no    32  S
152 00100  11000  CTRL  yes    -    32  S

According to this chart, the hypervisor's CTRL (#152) does not support reading, the user-space's CTRL (UCTRL, #136) does not support writing.

This replaces unsupported operations with the default SPR_NOACCESS hook.

---

While we are on this topic, I thought it makes sense to fix this too. This does not seem to affect anything in the current QEMU but it is more correct/clean.

---
 target-ppc/translate_init.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
target-ppc/translate_init.c +6 -6
index 93ad762..860e241 100644
@@ -6737,11 +6737,11 @@ static void init_proc_970FX (CPUPPCState *env)
                  0x00000000);
     spr_register(env, SPR_CTRL, "SPR_CTRL",
                  SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_generic,
+                 SPR_NOACCESS, &spr_write_generic,
                  0x00000000);
     spr_register(env, SPR_UCTRL, "SPR_UCTRL",
                  SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_generic,
+                 &spr_read_generic, SPR_NOACCESS,
                  0x00000000);
     spr_register(env, SPR_VRSAVE, "SPR_VRSAVE",
                  &spr_read_generic, &spr_write_generic,
@@ -6902,11 +6902,11 @@ static void init_proc_power5plus(CPUPPCState *env)
                  0x00000000);
     spr_register(env, SPR_CTRL, "SPR_CTRL",
                  SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_generic,
+                 SPR_NOACCESS, &spr_write_generic,
                  0x00000000);
     spr_register(env, SPR_UCTRL, "SPR_UCTRL",
                  SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_generic,
+                 &spr_read_generic, SPR_NOACCESS,
                  0x00000000);
     spr_register(env, SPR_VRSAVE, "SPR_VRSAVE",
                  &spr_read_generic, &spr_write_generic,
@@ -7002,11 +7002,11 @@ static void init_proc_POWER7 (CPUPPCState *env)
     /* XXX : not implemented */
     spr_register(env, SPR_CTRL, "SPR_CTRLT",
                  SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_generic,
+                 SPR_NOACCESS, &spr_write_generic,
                  0x80800000);
     spr_register(env, SPR_UCTRL, "SPR_CTRLF",
                  SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_generic,
+                 &spr_read_generic, SPR_NOACCESS,
                  0x80800000);
     spr_register(env, SPR_VRSAVE, "SPR_VRSAVE",
                  &spr_read_generic, &spr_write_generic,
Signature · 1 line
1.8.4.rc4
#1 lore raw
Quoted 10 lines · Alexey Kardashevskiy

The Figure 17 "SPR encodings" of the PowerISA 2.07 describes CTRL SPR as:

priviledged
# spr5-9 spr0-4 name mtspr mfspr len cat

136 00100  01000  CTRL   -    no    32  S
152 00100  11000  CTRL  yes    -    32  S

According to this chart, the hypervisor's CTRL (#152) does not support reading, the user-space's CTRL (UCTRL, #136) does not support writing.

Quoted 8 lines

This replaces unsupported operations with the default SPR_NOACCESS hook.

---

While we are on this topic, I thought it makes sense to fix this too. This does not seem to affect anything in the current QEMU but it is more correct/clean.

Alex, ping.

Is it complicated or controversial patch? :)

Quoted 53 lines

---
 target-ppc/translate_init.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
target-ppc/translate_init.c +6 -6
index 93ad762..860e241 100644
@@ -6737,11 +6737,11 @@ static void init_proc_970FX (CPUPPCState *env)
                  0x00000000);
     spr_register(env, SPR_CTRL, "SPR_CTRL",
                  SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_generic,
+                 SPR_NOACCESS, &spr_write_generic,
                  0x00000000);
     spr_register(env, SPR_UCTRL, "SPR_UCTRL",
                  SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_generic,
+                 &spr_read_generic, SPR_NOACCESS,
                  0x00000000);
     spr_register(env, SPR_VRSAVE, "SPR_VRSAVE",
                  &spr_read_generic, &spr_write_generic,
@@ -6902,11 +6902,11 @@ static void init_proc_power5plus(CPUPPCState *env)
                  0x00000000);
     spr_register(env, SPR_CTRL, "SPR_CTRL",
                  SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_generic,
+                 SPR_NOACCESS, &spr_write_generic,
                  0x00000000);
     spr_register(env, SPR_UCTRL, "SPR_UCTRL",
                  SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_generic,
+                 &spr_read_generic, SPR_NOACCESS,
                  0x00000000);
     spr_register(env, SPR_VRSAVE, "SPR_VRSAVE",
                  &spr_read_generic, &spr_write_generic,
@@ -7002,11 +7002,11 @@ static void init_proc_POWER7 (CPUPPCState *env)
     /* XXX : not implemented */
     spr_register(env, SPR_CTRL, "SPR_CTRLT",
                  SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_generic,
+                 SPR_NOACCESS, &spr_write_generic,
                  0x80800000);
     spr_register(env, SPR_UCTRL, "SPR_CTRLF",
                  SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_generic,
+                 &spr_read_generic, SPR_NOACCESS,
                  0x80800000);
     spr_register(env, SPR_VRSAVE, "SPR_VRSAVE",
                  &spr_read_generic, &spr_write_generic,
Signature · 1 line
Alexey
#2 lore raw
In reply to Alexey Kardashevskiy
Quoted 7 lines · Alexey Kardashevskiy

The Figure 17 "SPR encodings" of the PowerISA 2.07 describes CTRL SPR as:

priviledged
# spr5-9 spr0-4 name mtspr mfspr len cat

136 00100  01000  CTRL   -    no    32  S
152 00100  11000  CTRL  yes    -    32  S
Quoted 6 lines

According to this chart, the hypervisor's CTRL (#152) does not support reading, the user-space's CTRL (UCTRL, #136) does not support writing.

This replaces unsupported operations with the default SPR_NOACCESS hook.

Thanks, applied to ppc-next.

Alex