Skip to contentSkip to conversation

target/ppc: fix tlbsync to check privilege level depending on GTSE

PATCH Applied Cédric Le Goater 3 participants 4 messages Mar 14, 2018 – Mar 15, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/ppc: fix tlbsync to check privilege level depending on GTSE

tlbsync also needs to check the Guest Translation Shootdown Enable (GTSE) bit in the Logical Partition Control Register (LPCR) to determine at which privilege level it is running.

See commit c6fd28fd573d ("target/ppc: Update tlbie to check privilege level based on GTSE")

---

This will have its importance when we activate the HV bit on the POWER9 CPU for the PowerNV machine.

 target/ppc/translate.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
target/ppc/translate.c +7 -2
index 0a0c090c9978..218665b4080b 100644
@@ -4526,7 +4526,7 @@ static void gen_tlbie(DisasContext *ctx)
     TCGv_i32 t1;
 
     if (ctx->gtse) {
-        CHK_SV; /* If gtse is set then tblie is supervisor privileged */
+        CHK_SV; /* If gtse is set then tlbie is supervisor privileged */
     } else {
         CHK_HV; /* Else hypervisor privileged */
     }
@@ -4553,7 +4553,12 @@ static void gen_tlbsync(DisasContext *ctx)
 #if defined(CONFIG_USER_ONLY)
     GEN_PRIV;
 #else
-    CHK_HV;
+
+    if (ctx->gtse) {
+        CHK_SV; /* If gtse is set then tlbsync is supervisor privileged */
+    } else {
+        CHK_HV; /* Else hypervisor privileged */
+    }
 
     /* BookS does both ptesync and tlbsync make tlbsync a nop for server */
     if (ctx->insns_flags & PPC_BOOKE) {
Signature · 1 line
2.13.6
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Cédric Le Goater

tlbsync also needs to check the Guest Translation Shootdown Enable (GTSE) bit in the Logical Partition Control Register (LPCR) to determine at which privilege level it is running.

See commit c6fd28fd573d ("target/ppc: Update tlbie to check privilege level based on GTSE")

Quoted 17 lines

---

This will have its importance when we activate the HV bit on the POWER9 CPU for the PowerNV machine.

 target/ppc/translate.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
target/ppc/translate.c +0 -1
index 0a0c090c9978..218665b4080b 100644
@@ -4526,7 +4526,7 @@ static void gen_tlbie(DisasContext *ctx)
     TCGv_i32 t1;
 
     if (ctx->gtse) {
-        CHK_SV; /* If gtse is set then tblie is supervisor
Quoted 3 lines

privileged */
+ CHK_SV; /* If gtse is set then tlbie is supervisor
privileged */

^^^ Did that line actually change? :)

Quoted 19 lines
     } else {
         CHK_HV; /* Else hypervisor privileged */
     }
target/ppc/translate.c +3 -1
@@ -4553,7 +4553,12 @@ static void gen_tlbsync(DisasContext *ctx)
 #if defined(CONFIG_USER_ONLY)
     GEN_PRIV;
 #else
-    CHK_HV;
+
+    if (ctx->gtse) {
+        CHK_SV; /* If gtse is set then tlbsync is supervisor

privileged */

target/ppc/translate.c +3 -0
+    } else {
+        CHK_HV; /* Else hypervisor privileged */
+    }
 
     /* BookS does both ptesync and tlbsync make tlbsync a nop for

server */

     if (ctx->insns_flags & PPC_BOOKE) {
#2 lore raw
Quoted 5 lines
Quoted 5 lines
target/ppc/translate.c +0 -0
@@ -4526,7 +4526,7 @@ static void gen_tlbie(DisasContext *ctx)
     TCGv_i32 t1;
 
Quoted 7 lines
Quoted 5 lines
target/ppc/translate.c +0 -1
     if (ctx->gtse) {
-        CHK_SV; /* If gtse is set then tblie is supervisor

privileged */
+ CHK_SV; /* If gtse is set then tlbie is supervisor
privileged */

^^^ Did that line actually change? :)

It did. Look closer :)

C.

Applied
#3 lore raw
In reply to Cédric Le Goater
Quoted 7 lines · Cédric Le Goater

tlbsync also needs to check the Guest Translation Shootdown Enable (GTSE) bit in the Logical Partition Control Register (LPCR) to determine at which privilege level it is running.

See commit c6fd28fd573d ("target/ppc: Update tlbie to check privilege level based on GTSE")

Quoted 8 lines

---

This will have its importance when we activate the HV bit on the POWER9 CPU for the PowerNV machine.

 target/ppc/translate.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Applied to ppc-for-2.12, thanks.

Quoted 28 lines
target/ppc/translate.c +7 -2
index 0a0c090c9978..218665b4080b 100644
@@ -4526,7 +4526,7 @@ static void gen_tlbie(DisasContext *ctx)
     TCGv_i32 t1;
 
     if (ctx->gtse) {
-        CHK_SV; /* If gtse is set then tblie is supervisor privileged */
+        CHK_SV; /* If gtse is set then tlbie is supervisor privileged */
     } else {
         CHK_HV; /* Else hypervisor privileged */
     }
@@ -4553,7 +4553,12 @@ static void gen_tlbsync(DisasContext *ctx)
 #if defined(CONFIG_USER_ONLY)
     GEN_PRIV;
 #else
-    CHK_HV;
+
+    if (ctx->gtse) {
+        CHK_SV; /* If gtse is set then tlbsync is supervisor privileged */
+    } else {
+        CHK_HV; /* Else hypervisor privileged */
+    }
 
     /* BookS does both ptesync and tlbsync make tlbsync a nop for server */
     if (ctx->insns_flags & PPC_BOOKE) {
Signature · 4 lines
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