Skip to contentSkip to conversation

target/ppc/translate: Add dummy implementation for dcblc instruction

PATCH In review Bernhard Beschow 3 participants 4 messages Jan 30, 2023 – Feb 25, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/ppc/translate: Add dummy implementation for dcblc instruction

The dcblc instruction is used by u-boot in mpc85xx/start.S. Without it, an illegal istruction exception is generated very early in the boot process where the processor is not yet able to handle exceptions. See:

https://github.com/u-boot/u-boot/blob/v2023.01/arch/powerpc/cpu/mpc85xx/start.S#L1840

---
 target/ppc/translate.c | 9 +++++++++
 1 file changed, 9 insertions(+)
target/ppc/translate.c +9 -0
index edb3daa9b5..8c32e697d9 100644
@@ -5261,6 +5261,14 @@ static void gen_dcbtls(DisasContext *ctx)
     tcg_temp_free(t0);
 }
 
+/* dcblc */
+static void gen_dcblc(DisasContext *ctx)
+{
+    /*
+     * interpreted as no-op
+     */
+}
+
 /* dcbz */
 static void gen_dcbz(DisasContext *ctx)
 {
@@ -6832,6 +6840,7 @@ GEN_HANDLER_E(dcbtep, 0x1F, 0x1F, 0x09, 0x00000001, PPC_NONE, PPC2_BOOKE206),
 GEN_HANDLER(dcbtst, 0x1F, 0x16, 0x07, 0x00000001, PPC_CACHE),
 GEN_HANDLER_E(dcbtstep, 0x1F, 0x1F, 0x07, 0x00000001, PPC_NONE, PPC2_BOOKE206),
 GEN_HANDLER_E(dcbtls, 0x1F, 0x06, 0x05, 0x02000001, PPC_BOOKE, PPC2_BOOKE206),
+GEN_HANDLER_E(dcblc, 0x1F, 0x06, 0x0c, 0x02000001, PPC_BOOKE, PPC2_BOOKE206),
 GEN_HANDLER(dcbz, 0x1F, 0x16, 0x1F, 0x03C00001, PPC_CACHE_DCBZ),
 GEN_HANDLER_E(dcbzep, 0x1F, 0x1F, 0x1F, 0x03C00001, PPC_NONE, PPC2_BOOKE206),
 GEN_HANDLER(dst, 0x1F, 0x16, 0x0A, 0x01800001, PPC_ALTIVEC),
Signature · 1 line
2.39.1
Acked-by on v1 1/1
#1 lore raw
Quoted 16 lines · Bernhard Beschow

The dcblc instruction is used by u-boot in mpc85xx/start.S. Without it, an illegal istruction exception is generated very early in the boot process where the processor is not yet able to handle exceptions. See:

https://github.com/u-boot/u-boot/blob/v2023.01/arch/powerpc/cpu/mpc85xx/start.S#L1840

---
  target/ppc/translate.c | 9 +++++++++
  1 file changed, 9 insertions(+)
target/ppc/translate.c +0 -0
index edb3daa9b5..8c32e697d9 100644

target/ppc/translate.c static void gen_dcbtls(DisasContext *ctx) · line 5269

Quoted 9 lines
target/ppc/translate.c +6 -0
@@ -5261,6 +5261,14 @@ static void gen_dcbtls(DisasContext *ctx)
      tcg_temp_free(t0);
  }
 
+/* dcblc */
+static void gen_dcblc(DisasContext *ctx)
+{
+    /*
+     * interpreted as no-op
+     */

Missing

If MSR[UCLE] (user-mode cache lock enable) is set, dcblc[e] may be performed while in user mode (MSR[PR] = 1). If MSR[UCLE] is clear, an attempt to perform this instructions in user mode causes a DSI. ESR[DLK] is set for this DSI.

but that's also true for the current implementation of dcbtls. So,

r~

#2 lore raw

Am 30. Januar 2023 22:23:59 UTC schrieb Richard Henderson <[email protected]>:

Quoted 28 lines · Bernhard Beschow
Quoted 16 lines

The dcblc instruction is used by u-boot in mpc85xx/start.S. Without it, an illegal istruction exception is generated very early in the boot process where the processor is not yet able to handle exceptions. See:

https://github.com/u-boot/u-boot/blob/v2023.01/arch/powerpc/cpu/mpc85xx/start.S#L1840

---
  target/ppc/translate.c | 9 +++++++++
  1 file changed, 9 insertions(+)
target/ppc/translate.c +0 -0
index edb3daa9b5..8c32e697d9 100644

target/ppc/translate.c static void gen_dcbtls(DisasContext *ctx) · line 5268

Quoted 8 lines
target/ppc/translate.c +5 -0
@@ -5261,6 +5261,14 @@ static void gen_dcbtls(DisasContext *ctx)
      tcg_temp_free(t0);
  }
  +/* dcblc */
+static void gen_dcblc(DisasContext *ctx)
+{
+    /*
+     * interpreted as no-op
+     */

Missing

Quoted 7 lines

If MSR[UCLE] (user-mode cache lock enable) is set, dcblc[e] may be performed while in user mode (MSR[PR] = 1). If MSR[UCLE] is clear, an attempt to perform this instructions in user mode causes a DSI. ESR[DLK] is set for this DSI.

but that's also true for the current implementation of dcbtls. So,

Ping

Does that mean it's ready to be queued or do we need a Reviewed-by as well?

Quoted 3 lines

r~

Reviewed-by on v1 1/1
#3 lore raw
In reply to Bernhard Beschow
Quoted 8 lines · Bernhard Beschow

The dcblc instruction is used by u-boot in mpc85xx/start.S. Without it, an illegal istruction exception is generated very early in the boot process where the processor is not yet able to handle exceptions. See:

https://github.com/u-boot/u-boot/blob/v2023.01/arch/powerpc/cpu/mpc85xx/start.S#L1840

---

And queued to ppc-next. Thanks,

Daniel

Quoted 30 lines
  target/ppc/translate.c | 9 +++++++++
  1 file changed, 9 insertions(+)
target/ppc/translate.c +9 -0
index edb3daa9b5..8c32e697d9 100644
@@ -5261,6 +5261,14 @@ static void gen_dcbtls(DisasContext *ctx)
      tcg_temp_free(t0);
  }
 
+/* dcblc */
+static void gen_dcblc(DisasContext *ctx)
+{
+    /*
+     * interpreted as no-op
+     */
+}
+
  /* dcbz */
  static void gen_dcbz(DisasContext *ctx)
  {
@@ -6832,6 +6840,7 @@ GEN_HANDLER_E(dcbtep, 0x1F, 0x1F, 0x09, 0x00000001, PPC_NONE, PPC2_BOOKE206),
  GEN_HANDLER(dcbtst, 0x1F, 0x16, 0x07, 0x00000001, PPC_CACHE),
  GEN_HANDLER_E(dcbtstep, 0x1F, 0x1F, 0x07, 0x00000001, PPC_NONE, PPC2_BOOKE206),
  GEN_HANDLER_E(dcbtls, 0x1F, 0x06, 0x05, 0x02000001, PPC_BOOKE, PPC2_BOOKE206),
+GEN_HANDLER_E(dcblc, 0x1F, 0x06, 0x0c, 0x02000001, PPC_BOOKE, PPC2_BOOKE206),
  GEN_HANDLER(dcbz, 0x1F, 0x16, 0x1F, 0x03C00001, PPC_CACHE_DCBZ),
  GEN_HANDLER_E(dcbzep, 0x1F, 0x1F, 0x1F, 0x03C00001, PPC_NONE, PPC2_BOOKE206),
  GEN_HANDLER(dst, 0x1F, 0x16, 0x0A, 0x01800001, PPC_ALTIVEC),