Skip to contentSkip to conversation

target/ppc: Remove support for the PowerPC 602 CPU

PATCH Superseded Cédric Le Goater 3 participants 5 messages Jan 28, 2022

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/ppc: Remove support for the PowerPC 602 CPU

The 602 was derived from the PowerPC 603, for the gaming market it seems. It was hardly used and no firmware supporting the CPU could be found. Drop support.

---
 target/ppc/cpu-models.h      |   1 -
 target/ppc/cpu.h             |   2 -
 target/ppc/helper.h          |   1 -
 target/ppc/cpu-models.c      |   2 -
 target/ppc/cpu_init.c        | 145 -----------------------------------
 target/ppc/excp_helper.c     |   1 -
 target/ppc/int_helper.c      |  21 -----
 target/ppc/mfrom_table_gen.c |  34 --------
 target/ppc/translate.c       |  30 --------
 target/ppc/mfrom_table.c.inc |  78 -------------------
 10 files changed, 315 deletions(-)
 delete mode 100644 target/ppc/mfrom_table_gen.c
 delete mode 100644 target/ppc/mfrom_table.c.inc
target/ppc/cpu-models.h +0 -1
index bf1dc7e5ca3d..612978a3fbd2 100644
@@ -208,7 +208,6 @@ enum {
     CPU_POWERPC_601_v0             = 0x00010001,
     CPU_POWERPC_601_v1             = 0x00010001,
     CPU_POWERPC_601_v2             = 0x00010002,
-    CPU_POWERPC_602                = 0x00050100,
     CPU_POWERPC_603                = 0x00030100,
     CPU_POWERPC_603E_v11           = 0x00060101,
     CPU_POWERPC_603E_v12           = 0x00060102,
target/ppc/cpu.h +0 -2
index 66e13075c3df..b9119479958c 100644
@@ -2142,8 +2142,6 @@ enum {
     PPC_MFTB           = 0x0000000000000200ULL,
 
     /* Fixed-point unit extensions                                           */
-    /*   PowerPC 602 specific                                                */
-    PPC_602_SPEC       = 0x0000000000000400ULL,
     /*   isel instruction                                                    */
     PPC_ISEL           = 0x0000000000000800ULL,
     /*   popcntb instruction                                                 */
target/ppc/helper.h +0 -1
index bdbbd5e1d90f..f2e5060910de 100644
@@ -646,7 +646,6 @@ DEF_HELPER_FLAGS_2(slbieg, TCG_CALL_NO_RWG, void, env, tl)
 DEF_HELPER_FLAGS_2(load_sr, TCG_CALL_NO_RWG, tl, env, tl)
 DEF_HELPER_FLAGS_3(store_sr, TCG_CALL_NO_RWG, void, env, tl, tl)
 
-DEF_HELPER_FLAGS_1(602_mfrom, TCG_CALL_NO_RWG_SE, tl, tl)
 DEF_HELPER_1(msgsnd, void, tl)
 DEF_HELPER_2(msgclr, void, env, tl)
 DEF_HELPER_1(book3s_msgsnd, void, tl)
target/ppc/cpu-models.c +0 -2
index 764afe5a2afb..a2c720cc4d0c 100644
@@ -428,8 +428,6 @@
                 "PowerPC 601v1")
     POWERPC_DEF("601_v2",        CPU_POWERPC_601_v2,                 601v,
                 "PowerPC 601v2")
-    POWERPC_DEF("602",           CPU_POWERPC_602,                    602,
-                "PowerPC 602")
     POWERPC_DEF("603",           CPU_POWERPC_603,                    603,
                 "PowerPC 603")
     POWERPC_DEF("603e_v1.1",     CPU_POWERPC_603E_v11,               603E,
target/ppc/cpu_init.c +0 -145

163 lines not on this page · raw message

target/ppc/excp_helper.c +0 -1
index 4e6bb87b70a3..c107953dec10 100644
@@ -1422,7 +1422,6 @@ static inline void powerpc_excp_legacy(PowerPCCPU *cpu, int excp)
     case POWERPC_EXCP_DLTLB:     /* Data load TLB miss                       */
     case POWERPC_EXCP_DSTLB:     /* Data store TLB miss                      */
         switch (excp_model) {
-        case POWERPC_EXCP_602:
         case POWERPC_EXCP_603:
         case POWERPC_EXCP_G2:
             /* Swap temporary saved registers with GPRs */
target/ppc/int_helper.c +0 -21
index 9bc327bcba5a..d7765fd3e3d8 100644
@@ -488,27 +488,6 @@ target_ulong helper_divso(CPUPPCState *env, target_ulong arg1,
     }
 }
 
-/*****************************************************************************/
-/* 602 specific instructions */
-/* mfrom is the most crazy instruction ever seen, imho ! */
-/* Real implementation uses a ROM table. Do the same */
-/*
- * Extremely decomposed:
- *                      -arg / 256
- * return 256 * log10(10           + 1.0) + 0.5
- */
-#if !defined(CONFIG_USER_ONLY)
-target_ulong helper_602_mfrom(target_ulong arg)
-{
-    if (likely(arg < 602)) {
-#include "mfrom_table.c.inc"
-        return mfrom_ROM_table[arg];
-    } else {
-        return 0;
-    }
-}
-#endif
-
 /*****************************************************************************/
 /* Altivec extension helpers */
 #if defined(HOST_WORDS_BIGENDIAN)
target/ppc/mfrom_table_gen.c deleted +0 -34
deleted file mode 100644
index f96c4268ba70..000000000000
@@ -1,34 +0,0 @@
-#define _GNU_SOURCE
-#include "qemu/osdep.h"
-#include <math.h>
-
-int main(void)
-{
-    double d;
-    uint8_t n;
-    int i;
-
-    printf("static const uint8_t mfrom_ROM_table[602] =\n{\n    ");
-    for (i = 0; i < 602; i++) {
-        /*
-         * Extremely decomposed:
-         *                    -T0 / 256
-         * T0 = 256 * log10(10          + 1.0) + 0.5
-         */
-        d = -i;
-        d /= 256.0;
-        d = exp10(d);
-        d += 1.0;
-        d = log10(d);
-        d *= 256;
-        d += 0.5;
-        n = d;
-        printf("%3d, ", n);
-        if ((i & 7) == 7) {
-            printf("\n    ");
-        }
-    }
-    printf("\n};\n");
-
-    return 0;
-}
target/ppc/translate.c +0 -30
index d61c6f0e8f91..c2f436f8d3bc 100644
@@ -6272,33 +6272,6 @@ static void gen_srq(DisasContext *ctx)
     }
 }
 
-/* PowerPC 602 specific instructions */
-
-/* dsa  */
-static void gen_dsa(DisasContext *ctx)
-{
-    /* XXX: TODO */
-    gen_inval_exception(ctx, POWERPC_EXCP_INVAL_INVAL);
-}
-
-/* esa */
-static void gen_esa(DisasContext *ctx)
-{
-    /* XXX: TODO */
-    gen_inval_exception(ctx, POWERPC_EXCP_INVAL_INVAL);
-}
-
-/* mfrom */
-static void gen_mfrom(DisasContext *ctx)
-{
-#if defined(CONFIG_USER_ONLY)
-    GEN_PRIV;
-#else
-    CHK_SV;
-    gen_helper_602_mfrom(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]);
-#endif /* defined(CONFIG_USER_ONLY) */
-}
-
 /* 602 - 603 - G2 TLB management */
 
 /* tlbld */
@@ -7779,9 +7752,6 @@ GEN_HANDLER(sriq, 0x1F, 0x18, 0x15, 0x00000000, PPC_POWER_BR),
 GEN_HANDLER(srliq, 0x1F, 0x18, 0x17, 0x00000000, PPC_POWER_BR),
 GEN_HANDLER(srlq, 0x1F, 0x18, 0x16, 0x00000000, PPC_POWER_BR),
 GEN_HANDLER(srq, 0x1F, 0x18, 0x14, 0x00000000, PPC_POWER_BR),
-GEN_HANDLER(dsa, 0x1F, 0x14, 0x13, 0x03FFF801, PPC_602_SPEC),
-GEN_HANDLER(esa, 0x1F, 0x14, 0x12, 0x03FFF801, PPC_602_SPEC),
-GEN_HANDLER(mfrom, 0x1F, 0x09, 0x08, 0x03E0F801, PPC_602_SPEC),
 GEN_HANDLER2(tlbld_6xx, "tlbld", 0x1F, 0x12, 0x1E, 0x03FF0001, PPC_6xx_TLB),
 GEN_HANDLER2(tlbli_6xx, "tlbli", 0x1F, 0x12, 0x1F, 0x03FF0001, PPC_6xx_TLB),
 GEN_HANDLER(clf, 0x1F, 0x16, 0x03, 0x03E00000, PPC_POWER),
target/ppc/mfrom_table.c.inc deleted +0 -78

78 lines not on this page · raw message

Signature · 1 line
2.34.1
#1 lore raw
Quoted 5 lines · Cédric Le Goater

The 602 was derived from the PowerPC 603, for the gaming market it seems. It was hardly used and no firmware supporting the CPU could be found. Drop support.

Hello Cédric! I am having problems building QEMU with this patch applied. Tried on both master and legoater/ppc-7.0. I think you forgot one reference to PPC_602_SPEC on cpu.h:

 #define PPC_TCG_INSNS  (PPC_INSNS_BASE | PPC_POWER | PPC_POWER2 \
                         | PPC_POWER_RTC | PPC_POWER_BR | PPC_64B \
                         | PPC_64BX | PPC_64H | PPC_WAIT | PPC_MFTB \
-                        | PPC_602_SPEC | PPC_ISEL | PPC_POPCNTB \
+                        | PPC_ISEL | PPC_POPCNTB \
                         | PPC_STRING | PPC_FLOAT | PPC_FLOAT_EXT \
                         | PPC_FLOAT_FSQRT | PPC_FLOAT_FRES \
                         | PPC_FLOAT_FRSQRTE | PPC_FLOAT_FRSQRTES \

Could you take a look at it please? Thanks!

-- Víctor

#2 lore raw
Quoted 21 lines · Víctor Colombo
Quoted 5 lines · Cédric Le Goater

The 602 was derived from the PowerPC 603, for the gaming market it seems. It was hardly used and no firmware supporting the CPU could be found. Drop support.

Hello Cédric! I am having problems building QEMU with this patch applied. Tried on both master and legoater/ppc-7.0. I think you forgot one reference to PPC_602_SPEC on cpu.h:

 #define PPC_TCG_INSNS  (PPC_INSNS_BASE | PPC_POWER | PPC_POWER2 \

                          | PPC_POWER_RTC | PPC_POWER_BR | PPC_64B \
                          | PPC_64BX | PPC_64H | PPC_WAIT | PPC_MFTB \
-                        | PPC_602_SPEC | PPC_ISEL | PPC_POPCNTB \
+                        | PPC_ISEL | PPC_POPCNTB \
                          | PPC_STRING | PPC_FLOAT | PPC_FLOAT_EXT \
                          | PPC_FLOAT_FSQRT | PPC_FLOAT_FRES \
                          | PPC_FLOAT_FRSQRTE | PPC_FLOAT_FRSQRTES \
Quoted 1 line

Could you take a look at it please? Thanks!

Yes :/ Thanks for checking.

C.

#3 lore raw
In reply to Cédric Le Goater

target/ppc/cpu.h

Quoted 36 lines · Cédric Le Goater

The 602 was derived from the PowerPC 603, for the gaming market it seems. It was hardly used and no firmware supporting the CPU could be found. Drop support.

---
 target/ppc/cpu-models.h      |   1 -
 target/ppc/cpu.h             |   2 -
 target/ppc/helper.h          |   1 -
 target/ppc/cpu-models.c      |   2 -
 target/ppc/cpu_init.c        | 145 -----------------------------------
 target/ppc/excp_helper.c     |   1 -
 target/ppc/int_helper.c      |  21 -----
 target/ppc/mfrom_table_gen.c |  34 --------
 target/ppc/translate.c       |  30 --------
 target/ppc/mfrom_table.c.inc |  78 -------------------
 10 files changed, 315 deletions(-)
 delete mode 100644 target/ppc/mfrom_table_gen.c
 delete mode 100644 target/ppc/mfrom_table.c.inc
target/ppc/cpu-models.h +0 -1
index bf1dc7e5ca3d..612978a3fbd2 100644
@@ -208,7 +208,6 @@ enum {
     CPU_POWERPC_601_v0             = 0x00010001,
     CPU_POWERPC_601_v1             = 0x00010001,
     CPU_POWERPC_601_v2             = 0x00010002,
-    CPU_POWERPC_602                = 0x00050100,
     CPU_POWERPC_603                = 0x00030100,
     CPU_POWERPC_603E_v11           = 0x00060101,
     CPU_POWERPC_603E_v12           = 0x00060102,
target/ppc/cpu.h +0 -0
index 66e13075c3df..b9119479958c 100644

In cpu.h you could probably remove the MSR_AP and MSR_SA bit definitions as well. And the code in ppc_cpu_reset that sets them.

Quoted 9 lines
target/ppc/cpu.h +0 -2
@@ -2142,8 +2142,6 @@ enum {
     PPC_MFTB           = 0x0000000000000200ULL,
 
     /* Fixed-point unit extensions                                           */
-    /*   PowerPC 602 specific                                                */
-    PPC_602_SPEC       = 0x0000000000000400ULL,
     /*   isel instruction                                                    */
     PPC_ISEL           = 0x0000000000000800ULL,
     /*   popcntb instruction                                                 */

...

target/ppc/int_helper.c target_ulong helper_divso(CPUPPCState *env, target_ulong arg1, · line 493

Quoted 11 lines
target/ppc/int_helper.c +0 -3
index 9bc327bcba5a..d7765fd3e3d8 100644
@@ -488,27 +488,6 @@ target_ulong helper_divso(CPUPPCState *env, target_ulong arg1,
     }
 }
 
-/*****************************************************************************/
-/* 602 specific instructions */
-/* mfrom is the most crazy instruction ever seen, imho ! */

How do you have the heart to remove the "most crazy instruction ever seen"?

Quoted 17 lines
target/ppc/int_helper.c +0 -17
-/* Real implementation uses a ROM table. Do the same */
-/*
- * Extremely decomposed:
- *                      -arg / 256
- * return 256 * log10(10           + 1.0) + 0.5
- */
-#if !defined(CONFIG_USER_ONLY)
-target_ulong helper_602_mfrom(target_ulong arg)
-{
-    if (likely(arg < 602)) {
-#include "mfrom_table.c.inc"
-        return mfrom_ROM_table[arg];
-    } else {
-        return 0;
-    }
-}
-#endif
#4 lore raw
Quoted 7 lines

target/ppc/cpu.h

Quoted 4 lines
target/ppc/cpu.h +0 -0
index 66e13075c3df..b9119479958c 100644

In cpu.h you could probably remove the MSR_AP and MSR_SA bit definitions as well. And the code in ppc_cpu_reset that sets them.

done !

Quoted 21 lines
Quoted 10 lines
target/ppc/cpu.h +0 -2
@@ -2142,8 +2142,6 @@ enum {
      PPC_MFTB           = 0x0000000000000200ULL,
 
      /* Fixed-point unit extensions                                           */
-    /*   PowerPC 602 specific                                                */
-    PPC_602_SPEC       = 0x0000000000000400ULL,
      /*   isel instruction                                                    */
      PPC_ISEL           = 0x0000000000000800ULL,
      /*   popcntb instruction                                                 */

...

Quoted 8 lines
target/ppc/int_helper.c +0 -0
index 9bc327bcba5a..d7765fd3e3d8 100644
@@ -488,27 +488,6 @@ target_ulong helper_divso(CPUPPCState *env, target_ulong arg1,
      }
  }
 
Quoted 6 lines

target/ppc/int_helper.c target_ulong helper_divso(CPUPPCState *env, target_ulong arg1, · line 493

Quoted 3 lines
target/ppc/int_helper.c +0 -3
-/*****************************************************************************/
-/* 602 specific instructions */
-/* mfrom is the most crazy instruction ever seen, imho ! */

How do you have the heart to remove the "most crazy instruction ever seen"?

It is indeed crazy and QEMU is the perfect playground to implement instructions even more crazier but I am without heart for this one :)

Cheers,

C.