qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-ppc] [QEMU-ppc for-2.10][PATCH V4 3/6] target/ppc: Update tlbie to


From: Suraj Jitindar Singh
Subject: [Qemu-ppc] [QEMU-ppc for-2.10][PATCH V4 3/6] target/ppc: Update tlbie to check privilege level based on GTSE
Date: Thu, 13 Apr 2017 16:02:37 +1000

The Guest Translation Shootdown Enable (GTSE) bit in the Logical Partition
Control Register (LPCR) can be set to enable a guest to use the tlbie
instruction directly to invalidate translations.

When the GTSE bit is set then the tlbie instruction is supervisor
privileged, otherwise it is hypervisor privileged.

Update the tblie tcg code generation to check the correct privilege
level based on the GTSE value in the LPCR.

Signed-off-by: Suraj Jitindar Singh <address@hidden>

---

-> V4:

- Added patch to series
---
 target/ppc/translate.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/target/ppc/translate.c b/target/ppc/translate.c
index f40b5a1..5f90c03 100644
--- a/target/ppc/translate.c
+++ b/target/ppc/translate.c
@@ -4513,7 +4513,27 @@ static void gen_tlbie(DisasContext *ctx)
     GEN_PRIV;
 #else
     TCGv_i32 t1;
+    TCGv t2, t3;
+    TCGLabel *l1, *l2;
+
+    l1 = gen_new_label();
+    l2 = gen_new_label();
+    t2 = tcg_temp_new();
+    t3 = tcg_temp_new();
+
+    tcg_gen_ld_tl(t2, cpu_env, offsetof(CPUPPCState, spr[SPR_LPCR]));
+    tcg_gen_andi_tl(t3, t2, LPCR_GTSE);
+    tcg_temp_free(t2);
+    tcg_gen_brcondi_tl(TCG_COND_EQ, t3, 0, l1);
+    /* LPCR_GTSE == 1 -> Instruction is Supervisor Privileged */
+    tcg_temp_free(t3);
+    CHK_SV;
+    tcg_gen_br(l2);
+    gen_set_label(l1);
+    /* LPCR_GTSE == 0 -> Instruction is Hypervisor Privileged */
+    tcg_temp_free(t3);
     CHK_HV;
+    gen_set_label(l2);
 
     if (NARROW_MODE(ctx)) {
         TCGv t0 = tcg_temp_new();
-- 
2.5.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]