target/ppc: PPC ISA 2.07 flag cleanup and updates
v2 cover target/ppc: PPC ISA 2.07 flag cleanup and updates
While working with some PPC instructions from a ISA 2.07 POV, I observed the following :
1. Unlike ISA versions 2.05, 3.0 and 3.1 which have one specific flag for usage in the insns_flags2 field in the CPUPPCState struct, ISA 2.07 and 2.06 have multiple flags. Upon further investigation, I see that during CPU intialization (POWER 8+), all those variations of the ISA 2.07 flags are only ever used all together. There is no instance in the code where a CPU is initialzed in a more granular level, using only a subset of the ISA 2.07 flag variations.
This patch series hence consolidates the different 2.07 flags, and frees up bits in the insns_flags2 field for future use. I intend to do the same analysis for the ISA 2.06 flags as well.
2. The "Summary of changes in Power ISA 2.07B" section in the ISA version 2.07B mentions : "The icbt instruction has been moved from the Embedded category to the Base category."
This change has not been incorporated in the QEMU code resulting in illegal instruction exception upon encountering ICBT instruction in Power VMs where it should be recognized. Hence adding the necessary flag to the instruction. Also correcting the invalid mask for the decoding as per the ISA.
This series is based on top of the patches from another series that I had posted :
[A] : https://lore.kernel.org/qemu-devel/[email protected]/
Link to Gitlab CI with patches :
https://gitlab.com/rathc/qemu/-/pipelines/2776338293
Changes in v2 :
-Retained all 'Reviewed-by's and 'Tested-by's received.
-In patch 2: Change instruction flag in BCTAR instruction. The above series [A] now incorpates the following review comment received on its respective RFC series :
https://lore.kernel.org/qemu-devel/[email protected]/
Due to this. Doing the necessary change in patch 2.
Chinmay Rath (7):
target/ppc: Replace PPC2_VSX207 flag with PPC2_ISA207 target/ppc: Use PPC2_ISA207 instead of PPC2_BCTAR_ISA207 target/ppc: Use PPC2_ISA207 instead of PPC2_LSQ_ISA207 target/ppc: Use PPC2_ISA207 instead of PPC2_ALTIVEC_207 target/ppc: Use PPC2_ISA207 instead of PPC2_ISA207S target/ppc: Reorder PPC2 flags
target/ppc: Add ICBT support for ISA version 2.07
hw/ppc/spapr_caps.c | 2 +- linux-user/ppc/elfload.c | 6 +- target/ppc/cpu.h | 38 +++---- target/ppc/cpu_init.c | 6 +- target/ppc/cpu_init.h | 7 +- target/ppc/tcg-excp_helper.c | 8 +- target/ppc/translate.c | 10 +- target/ppc/translate/bhrb-impl.c.inc | 4 +- target/ppc/translate/branch-impl.c.inc | 4 +- target/ppc/translate/fixedpoint-impl.c.inc | 4 +- target/ppc/translate/fp-impl.c.inc | 4 +- .../ppc/translate/processor-ctrl-impl.c.inc | 8 +- target/ppc/translate/vmx-impl.c.inc | 102 +++++++++--------- target/ppc/translate/vmx-ops.c.inc | 18 ++-- target/ppc/translate/vsx-impl.c.inc | 56 +++++----- target/ppc/translate/vsx-ops.c.inc | 24 ++--- 16 files changed, 143 insertions(+), 158 deletions(-)
Signature · 1 line
2.55.0
PATCH v2 1/7 target/ppc: Replace PPC2_VSX207 flag with PPC2_ISA207
There are several flags for Power ISA 2.07 currently in use, namely :PPC2_VSX207, PPC2_BCTAR_ISA207, PPC2_LSQ_ISA207, etc, but most of them are used together without any individual use.
Create a generic ISA 2.07 flag and switch usage of PPC2_VSX207 to it instead. Next commits would consolidate the remaining flags.
--- target/ppc/cpu.h | 6 ++-- target/ppc/cpu_init.c | 2 +- target/ppc/cpu_init.h | 2 +- target/ppc/translate/fp-impl.c.inc | 4 +-- target/ppc/translate/vsx-impl.c.inc | 56 ++++++++++++++--------------- target/ppc/translate/vsx-ops.c.inc | 24 ++++++------- 6 files changed, 47 insertions(+), 47 deletions(-)
target/ppc/cpu.h +3 -3
@@ -2565,8 +2565,8 @@ enum {PPC2_DBRX =0x0000000000000010ULL ,/* Book I 2.05 PowerPC specification */ PPC2_ISA205 =0x0000000000000020ULL , -/* VSX additions in ISA 2.07 */ -PPC2_VSX207 =0x0000000000000040ULL , +/* POWER ISA 2.07 */ +PPC2_ISA207 =0x0000000000000040ULL ,/* ISA 2.06B bpermd */ PPC2_PERM_ISA206 = 0x0000000000000080ULL,/* ISA 2.06B divide extended variants */
@@ -2607,7 +2607,7 @@ enum { PPC2_PPE42XM = 0x0000000002000000ULL,#define PPC_TCG_INSNS2 (PPC2_BOOKE206 | PPC2_VSX | PPC2_PRCNTL | PPC2_DBRX | \ - PPC2_ISA205 | PPC2_VSX207 | PPC2_PERM_ISA206 | \ + PPC2_ISA205 | PPC2_ISA207 | PPC2_PERM_ISA206 | \ PPC2_DIVE_ISA206 | PPC2_ATOMIC_ISA206 | \ PPC2_FP_CVT_ISA206 | PPC2_FP_TST_ISA206 | \ PPC2_BCTAR_ISA207 | PPC2_LSQ_ISA207 | \
target/ppc/cpu_init.c +1 -1
@@ -6346,7 +6346,7 @@ POWERPC_FAMILY(POWER8)(ObjectClass *oc, const void *data)PPC_SEGMENT_64B |PPC_SLBI |PPC_POPCNTB |PPC_POPCNTWD |PPC_CILDST ; - pcc->insns_flags2 =PPC2_VSX |PPC2_VSX207 |PPC2_DFP |PPC2_DBRX | + pcc->insns_flags2 =PPC2_VSX |PPC2_ISA207 |PPC2_DFP |PPC2_DBRX |PPC2_PERM_ISA206 |PPC2_DIVE_ISA206 |PPC2_ATOMIC_ISA206 |PPC2_FP_CVT_ISA206 | PPC2_FP_TST_ISA206 | PPC2_BCTAR_ISA207 |
target/ppc/cpu_init.h +1 -1
@@ -15,7 +15,7 @@#define PPC_INSNS_FLAGS_POWER11 PPC_INSNS_FLAGS_POWER10#define PPC_INSNS_FLAGS2_POWER_COMMON \ - (PPC2_VSX | PPC2_VSX207 | PPC2_DFP | PPC2_DBRX | \ + (PPC2_VSX | PPC2_ISA207 | PPC2_DFP | PPC2_DBRX | \ PPC2_PERM_ISA206 | PPC2_DIVE_ISA206 | PPC2_ATOMIC_ISA206 | \ PPC2_FP_CVT_ISA206 | PPC2_FP_TST_ISA206 | PPC2_BCTAR_ISA207 | \ PPC2_LSQ_ISA207 | PPC2_ALTIVEC_207 | PPC2_ISA205 | \
target/ppc/translate/fp-impl.c.inc +2 -2
@@ -342,7 +342,7 @@ static bool trans_FCPSGN(DisasContext *ctx, arg_FCPSGN *a) static bool trans_FMRGEW(DisasContext *ctx, arg_FMRGEW *a) { TCGv_i64 t0, t1, t2; - REQUIRE_INSNS_FLAGS2(ctx, VSX207); + REQUIRE_INSNS_FLAGS2(ctx, ISA207); REQUIRE_FPU(ctx); t0 = tcg_temp_new_i64(); t1 = tcg_temp_new_i64();
@@ -358,7 +358,7 @@ static bool trans_FMRGEW(DisasContext *ctx, arg_FMRGEW *a) static bool trans_FMRGOW(DisasContext *ctx, arg_FMRGOW *a) { TCGv_i64 t0, t1, t2; - REQUIRE_INSNS_FLAGS2(ctx, VSX207); + REQUIRE_INSNS_FLAGS2(ctx, ISA207); REQUIRE_FPU(ctx); t0 = tcg_temp_new_i64(); t1 = tcg_temp_new_i64();
target/ppc/translate/vsx-impl.c.inc +28 -28
110 lines not on this page · raw message
target/ppc/translate/vsx-ops.c.inc +12 -12
@@ -1,9 +1,9 @@ -GEN_HANDLER_E(mfvsrwz, 0x1F, 0x13, 0x03, 0x0000F800, PPC_NONE, PPC2_VSX207), -GEN_HANDLER_E(mtvsrwa, 0x1F, 0x13, 0x06, 0x0000F800, PPC_NONE, PPC2_VSX207), -GEN_HANDLER_E(mtvsrwz, 0x1F, 0x13, 0x07, 0x0000F800, PPC_NONE, PPC2_VSX207), +GEN_HANDLER_E(mfvsrwz, 0x1F, 0x13, 0x03, 0x0000F800, PPC_NONE, PPC2_ISA207), +GEN_HANDLER_E(mtvsrwa, 0x1F, 0x13, 0x06, 0x0000F800, PPC_NONE, PPC2_ISA207), +GEN_HANDLER_E(mtvsrwz, 0x1F, 0x13, 0x07, 0x0000F800, PPC_NONE, PPC2_ISA207), #if defined(TARGET_PPC64) -GEN_HANDLER_E(mfvsrd, 0x1F, 0x13, 0x01, 0x0000F800, PPC_NONE, PPC2_VSX207), -GEN_HANDLER_E(mtvsrd, 0x1F, 0x13, 0x05, 0x0000F800, PPC_NONE, PPC2_VSX207), +GEN_HANDLER_E(mfvsrd, 0x1F, 0x13, 0x01, 0x0000F800, PPC_NONE, PPC2_ISA207), +GEN_HANDLER_E(mtvsrd, 0x1F, 0x13, 0x05, 0x0000F800, PPC_NONE, PPC2_ISA207), GEN_HANDLER_E(mfvsrld, 0X1F, 0x13, 0x09, 0x0000F800, PPC_NONE, PPC2_ISA300), GEN_HANDLER_E(mtvsrdd, 0X1F, 0x13, 0x0D, 0x0, PPC_NONE, PPC2_ISA300), GEN_HANDLER_E(mtvsrws, 0x1F, 0x13, 0x0C, 0x0000F800, PPC_NONE, PPC2_ISA300),
@@ -127,7 +127,7 @@ GEN_VSX_XFORM_300(xscmpoqp, 0x04, 0x04, 0x00600001), GEN_VSX_XFORM_300(xscmpuqp, 0x04, 0x14, 0x00600001), GEN_XX2FORM_EO(xscvdphp, 0x16, 0x15, 0x11, PPC2_ISA300), GEN_XX2FORM(xscvdpsp, 0x12, 0x10, PPC2_VSX), -GEN_XX2FORM(xscvdpspn, 0x16, 0x10, PPC2_VSX207), +GEN_XX2FORM(xscvdpspn, 0x16, 0x10, PPC2_ISA207), GEN_XX2FORM_EO(xscvhpdp, 0x16, 0x15, 0x10, PPC2_ISA300), GEN_VSX_XFORM_300_EO(xscvsdqp, 0x04, 0x1A, 0x0A, 0x00000001), GEN_XX2FORM(xscvspdp, 0x12, 0x14, PPC2_VSX),
@@ -145,12 +145,12 @@ GEN_XX2FORM(xsrdpip, 0x12, 0x06, PPC2_VSX), GEN_XX2FORM(xsrdpiz, 0x12, 0x05, PPC2_VSX), GEN_VSX_XFORM_300(xsdivqp, 0x04, 0x11, 0x0), -GEN_XX2FORM(xsresp, 0x14, 0x01, PPC2_VSX207), -GEN_XX2FORM(xsrsp, 0x12, 0x11, PPC2_VSX207), -GEN_XX2FORM(xssqrtsp, 0x16, 0x00, PPC2_VSX207), -GEN_XX2FORM(xsrsqrtesp, 0x14, 0x00, PPC2_VSX207), -GEN_XX2FORM(xscvsxdsp, 0x10, 0x13, PPC2_VSX207), -GEN_XX2FORM(xscvuxdsp, 0x10, 0x12, PPC2_VSX207), +GEN_XX2FORM(xsresp, 0x14, 0x01, PPC2_ISA207), +GEN_XX2FORM(xsrsp, 0x12, 0x11, PPC2_ISA207), +GEN_XX2FORM(xssqrtsp, 0x16, 0x00, PPC2_ISA207), +GEN_XX2FORM(xsrsqrtesp, 0x14, 0x00, PPC2_ISA207), +GEN_XX2FORM(xscvsxdsp, 0x10, 0x13, PPC2_ISA207), +GEN_XX2FORM(xscvuxdsp, 0x10, 0x12, PPC2_ISA207), GEN_XX2FORM(xvredp, 0x14, 0x0D, PPC2_VSX), GEN_XX2FORM(xvsqrtdp, 0x16, 0x0C, PPC2_VSX),
Signature · 1 line
2.55.0
PATCH v2 2/7 target/ppc: Use PPC2_ISA207 instead of PPC2_BCTAR_ISA207
In reply to Chinmay RathPPC2_BCTAR_ISA207 is only ever set in the CPUPPCState's insns_flags2 alongside PPC2_ISA207. Checks made by PPC2_BCTAR_ISA207 could be replaced with PPC2_ISA207, hence rendering it useless and apt for removal. This patch does the same.
--- linux-user/ppc/elfload.c | 7 +++---- target/ppc/cpu.h | 4 +--- target/ppc/cpu_init.c | 2 +- target/ppc/cpu_init.h | 2 +- target/ppc/translate/branch-impl.c.inc | 2 +- 5 files changed, 7 insertions(+), 10 deletions(-)
linux-user/ppc/elfload.c +3 -4
@@ -116,10 +116,9 @@ abi_ulong get_elf_hwcap2(CPUState *cs) do { if (cpu->env.insns_flags2 & flag) { features |= feature; } } while (0)GET_FEATURE (PPC_ISEL ,QEMU_PPC_FEATURE2_HAS_ISEL ); -GET_FEATURE2 (PPC2_BCTAR_ISA207 ,QEMU_PPC_FEATURE2_HAS_TAR ); -GET_FEATURE2 ((PPC2_BCTAR_ISA207 |PPC2_LSQ_ISA207 |PPC2_ALTIVEC_207 | -PPC2_ISA207S ),QEMU_PPC_FEATURE2_ARCH_2_07 | -QEMU_PPC_FEATURE2_VEC_CRYPTO ); +GET_FEATURE2 ((PPC2_ISA207 |PPC2_LSQ_ISA207 |PPC2_ALTIVEC_207 | +PPC2_ISA207S ), (QEMU_PPC_FEATURE2_ARCH_2_07 | +QEMU_PPC_FEATURE2_VEC_CRYPTO |QEMU_PPC_FEATURE2_HAS_TAR ));GET_FEATURE2 (PPC2_ISA300 ,QEMU_PPC_FEATURE2_ARCH_3_00 |QEMU_PPC_FEATURE2_DARN |QEMU_PPC_FEATURE2_HAS_IEEE128 ); GET_FEATURE2(PPC2_ISA310, QEMU_PPC_FEATURE2_ARCH_3_1 |
target/ppc/cpu.h +1 -3
@@ -2577,8 +2577,6 @@ enum {PPC2_FP_CVT_ISA206 =0x0000000000000400ULL ,/* ISA 2.06B floating point test instructions */ PPC2_FP_TST_ISA206 =0x0000000000000800ULL , -/* ISA 2.07 bctar instruction */ -PPC2_BCTAR_ISA207 =0x0000000000001000ULL ,/* ISA 2.07 load/store quadword */ PPC2_LSQ_ISA207 = 0x0000000000002000ULL,/* ISA 2.07 Altivec */
@@ -2610,7 +2608,7 @@ enum {PPC2_ISA205 |PPC2_ISA207 |PPC2_PERM_ISA206 | \PPC2_DIVE_ISA206 |PPC2_ATOMIC_ISA206 | \PPC2_FP_CVT_ISA206 |PPC2_FP_TST_ISA206 | \ -PPC2_BCTAR_ISA207 |PPC2_LSQ_ISA207 | \ +PPC2_LSQ_ISA207 | \PPC2_ALTIVEC_207 |PPC2_ISA207S |PPC2_DFP | \PPC2_FP_CVT_S64 |PPC2_TM |PPC2_PM_ISA206 | \ PPC2_ISA300 | PPC2_ISA310 | PPC2_MEM_LWSYNC | \
target/ppc/cpu_init.c +1 -1
@@ -6349,7 +6349,7 @@ POWERPC_FAMILY(POWER8)(ObjectClass *oc, const void *data) pcc->insns_flags2 =PPC2_VSX |PPC2_ISA207 |PPC2_DFP |PPC2_DBRX |PPC2_PERM_ISA206 |PPC2_DIVE_ISA206 |PPC2_ATOMIC_ISA206 |PPC2_FP_CVT_ISA206 | -PPC2_FP_TST_ISA206 |PPC2_BCTAR_ISA207 | +PPC2_FP_TST_ISA206 |PPC2_LSQ_ISA207 |PPC2_ALTIVEC_207 |PPC2_ISA205 |PPC2_ISA207S |PPC2_FP_CVT_S64 | PPC2_TM | PPC2_PM_ISA206 | PPC2_MEM_LWSYNC |
target/ppc/cpu_init.h +1 -1
@@ -17,7 +17,7 @@#define PPC_INSNS_FLAGS2_POWER_COMMON \ (PPC2_VSX | PPC2_ISA207 | PPC2_DFP | PPC2_DBRX | \ PPC2_PERM_ISA206 | PPC2_DIVE_ISA206 | PPC2_ATOMIC_ISA206 | \ - PPC2_FP_CVT_ISA206 | PPC2_FP_TST_ISA206 | PPC2_BCTAR_ISA207 | \ + PPC2_FP_CVT_ISA206 | PPC2_FP_TST_ISA206 | \ PPC2_LSQ_ISA207 | PPC2_ALTIVEC_207 | PPC2_ISA205 | \ PPC2_ISA207S | PPC2_FP_CVT_S64 | PPC2_ISA300 | PPC2_PRCNTL | \ PPC2_MEM_LWSYNC | PPC2_BCDA_ISA206)
target/ppc/translate/branch-impl.c.inc +1 -1
@@ -210,5 +210,5 @@ static bool bclr_helper(DisasContext *ctx, arg_bclr *a, int type) TRANS(BCLR, bclr_helper, BCOND_LR) TRANS(BCCTR, bclr_helper, BCOND_CTR) -TRANS_FLAGS2(BCTAR_ISA207, BCTAR, bclr_helper, BCOND_TAR) +TRANS_FLAGS2(ISA207, BCTAR, bclr_helper, BCOND_TAR)
Signature · 1 line
2.55.0
PATCH v2 3/7 target/ppc: Use PPC2_ISA207 instead of PPC2_LSQ_ISA207
In reply to Chinmay RathPPC2_LSQ_ISA207 is only ever set in the CPUPPCState's insns_flags2 alongside PPC2_ISA207. Checks made by PPC2_LSQ_ISA207 could be replaced with PPC2_ISA207, hence rendering it useless and apt for removal. This patch does the same.
--- linux-user/ppc/elfload.c | 2 +- target/ppc/cpu.h | 3 --- target/ppc/cpu_init.c | 3 +-- target/ppc/cpu_init.h | 2 +- target/ppc/translate/fixedpoint-impl.c.inc | 4 ++-- 5 files changed, 5 insertions(+), 9 deletions(-)
linux-user/ppc/elfload.c +1 -1
@@ -116,7 +116,7 @@ abi_ulong get_elf_hwcap2(CPUState *cs) do { if (cpu->env.insns_flags2 & flag) { features |= feature; } } while (0)GET_FEATURE (PPC_ISEL ,QEMU_PPC_FEATURE2_HAS_ISEL ); -GET_FEATURE2 ((PPC2_ISA207 |PPC2_LSQ_ISA207 |PPC2_ALTIVEC_207 | +GET_FEATURE2 ((PPC2_ISA207 |PPC2_ALTIVEC_207 |PPC2_ISA207S ), (QEMU_PPC_FEATURE2_ARCH_2_07 |QEMU_PPC_FEATURE2_VEC_CRYPTO |QEMU_PPC_FEATURE2_HAS_TAR )); GET_FEATURE2(PPC2_ISA300, QEMU_PPC_FEATURE2_ARCH_3_00 |
target/ppc/cpu.h +0 -3
@@ -2577,8 +2577,6 @@ enum {PPC2_FP_CVT_ISA206 =0x0000000000000400ULL ,/* ISA 2.06B floating point test instructions */ PPC2_FP_TST_ISA206 =0x0000000000000800ULL , -/* ISA 2.07 load/store quadword */ -PPC2_LSQ_ISA207 =0x0000000000002000ULL ,/* ISA 2.07 Altivec */ PPC2_ALTIVEC_207 = 0x0000000000004000ULL,/* PowerISA 2.07 Book3s specification */
@@ -2608,7 +2606,6 @@ enum {PPC2_ISA205 |PPC2_ISA207 |PPC2_PERM_ISA206 | \PPC2_DIVE_ISA206 |PPC2_ATOMIC_ISA206 | \PPC2_FP_CVT_ISA206 |PPC2_FP_TST_ISA206 | \ -PPC2_LSQ_ISA207 | \PPC2_ALTIVEC_207 |PPC2_ISA207S |PPC2_DFP | \PPC2_FP_CVT_S64 |PPC2_TM |PPC2_PM_ISA206 | \ PPC2_ISA300 | PPC2_ISA310 | PPC2_MEM_LWSYNC | \
target/ppc/cpu_init.c +1 -2
@@ -6349,8 +6349,7 @@ POWERPC_FAMILY(POWER8)(ObjectClass *oc, const void *data) pcc->insns_flags2 =PPC2_VSX |PPC2_ISA207 |PPC2_DFP |PPC2_DBRX |PPC2_PERM_ISA206 |PPC2_DIVE_ISA206 |PPC2_ATOMIC_ISA206 |PPC2_FP_CVT_ISA206 | -PPC2_FP_TST_ISA206 | -PPC2_LSQ_ISA207 |PPC2_ALTIVEC_207 | +PPC2_FP_TST_ISA206 |PPC2_ALTIVEC_207 |PPC2_ISA205 |PPC2_ISA207S |PPC2_FP_CVT_S64 |PPC2_TM |PPC2_PM_ISA206 |PPC2_MEM_LWSYNC |PPC2_BCDA_ISA206 ;
target/ppc/cpu_init.h +1 -1
@@ -18,7 +18,7 @@ (PPC2_VSX |PPC2_ISA207 |PPC2_DFP |PPC2_DBRX | \PPC2_PERM_ISA206 |PPC2_DIVE_ISA206 |PPC2_ATOMIC_ISA206 | \PPC2_FP_CVT_ISA206 |PPC2_FP_TST_ISA206 | \ -PPC2_LSQ_ISA207 |PPC2_ALTIVEC_207 |PPC2_ISA205 | \ +PPC2_ALTIVEC_207 |PPC2_ISA205 | \PPC2_ISA207S |PPC2_FP_CVT_S64 |PPC2_ISA300 |PPC2_PRCNTL | \PPC2_MEM_LWSYNC |PPC2_BCDA_ISA206 )
target/ppc/translate/fixedpoint-impl.c.inc +2 -2
@@ -116,7 +116,7 @@ static bool do_ldst_quad(DisasContext *ctx, arg_D *a, bool store, bool prefixed) REQUIRE_INSNS_FLAGS(ctx, 64BX); - if (!prefixed && !(ctx->insns_flags2 & PPC2_LSQ_ISA207)) { + if (!prefixed && !(ctx->insns_flags2 & PPC2_ISA207)) { /* lq and stq were privileged prior to V. 2.07 */ REQUIRE_SV(ctx);
@@ -280,7 +280,7 @@ TRANS64(STDCX, do_store_cond, MO_UQ); static bool trans_STQCX(DisasContext *ctx, arg_STQCX *a) { REQUIRE_64BIT(ctx); - REQUIRE_INSNS_FLAGS2(ctx, LSQ_ISA207); + REQUIRE_INSNS_FLAGS2(ctx, ISA207); #if defined(TARGET_PPC64) TCGLabel *lfail = gen_new_label(); TCGv ea = do_ea_calc(ctx, a->ra, cpu_gpr[a->rb]);
Signature · 1 line
2.55.0
PATCH v2 4/7 target/ppc: Use PPC2_ISA207 instead of PPC2_ALTIVEC_207
In reply to Chinmay RathPPC2_ALTIVEC_207 is only ever set in the CPUPPCState's insns_flags2 alongside PPC2_ISA207. Checks made by PPC2_ALTIVEC_207 could be replaced with PPC2_ISA207, hence rendering it useless and apt for removal. This patch does the same.
--- linux-user/ppc/elfload.c | 3 +- target/ppc/cpu.h | 4 +- target/ppc/cpu_init.c | 2 +- target/ppc/cpu_init.h | 3 +- target/ppc/translate/vmx-impl.c.inc | 102 ++++++++++++++-------------- target/ppc/translate/vmx-ops.c.inc | 18 ++--- 6 files changed, 64 insertions(+), 68 deletions(-)
linux-user/ppc/elfload.c +1 -2
@@ -116,8 +116,7 @@ abi_ulong get_elf_hwcap2(CPUState *cs) do { if (cpu->env.insns_flags2 & flag) { features |= feature; } } while (0)GET_FEATURE (PPC_ISEL ,QEMU_PPC_FEATURE2_HAS_ISEL ); -GET_FEATURE2 ((PPC2_ISA207 |PPC2_ALTIVEC_207 | -PPC2_ISA207S ), (QEMU_PPC_FEATURE2_ARCH_2_07 | +GET_FEATURE2 ((PPC2_ISA207 |PPC2_ISA207S ), (QEMU_PPC_FEATURE2_ARCH_2_07 |QEMU_PPC_FEATURE2_VEC_CRYPTO |QEMU_PPC_FEATURE2_HAS_TAR ));GET_FEATURE2 (PPC2_ISA300 ,QEMU_PPC_FEATURE2_ARCH_3_00 |QEMU_PPC_FEATURE2_DARN |QEMU_PPC_FEATURE2_HAS_IEEE128 );
target/ppc/cpu.h +1 -3
@@ -2577,8 +2577,6 @@ enum {PPC2_FP_CVT_ISA206 =0x0000000000000400ULL ,/* ISA 2.06B floating point test instructions */ PPC2_FP_TST_ISA206 =0x0000000000000800ULL , -/* ISA 2.07 Altivec */ -PPC2_ALTIVEC_207 =0x0000000000004000ULL ,/* PowerISA 2.07 Book3s specification */ PPC2_ISA207S = 0x0000000000008000ULL,/* Double precision floating point conversion for signed integer 64 */
@@ -2606,7 +2604,7 @@ enum {PPC2_ISA205 |PPC2_ISA207 |PPC2_PERM_ISA206 | \PPC2_DIVE_ISA206 |PPC2_ATOMIC_ISA206 | \PPC2_FP_CVT_ISA206 |PPC2_FP_TST_ISA206 | \ -PPC2_ALTIVEC_207 |PPC2_ISA207S |PPC2_DFP | \ +PPC2_ISA207S |PPC2_DFP | \PPC2_FP_CVT_S64 |PPC2_TM |PPC2_PM_ISA206 | \PPC2_ISA300 |PPC2_ISA310 |PPC2_MEM_LWSYNC | \ PPC2_BCDA_ISA206 | PPC2_PPE42 | PPC2_PPE42X | \
target/ppc/cpu_init.c +1 -1
@@ -6349,7 +6349,7 @@ POWERPC_FAMILY(POWER8)(ObjectClass *oc, const void *data) pcc->insns_flags2 =PPC2_VSX |PPC2_ISA207 |PPC2_DFP |PPC2_DBRX |PPC2_PERM_ISA206 |PPC2_DIVE_ISA206 |PPC2_ATOMIC_ISA206 |PPC2_FP_CVT_ISA206 | -PPC2_FP_TST_ISA206 |PPC2_ALTIVEC_207 | +PPC2_FP_TST_ISA206 |PPC2_ISA205 |PPC2_ISA207S |PPC2_FP_CVT_S64 |PPC2_TM |PPC2_PM_ISA206 |PPC2_MEM_LWSYNC |PPC2_BCDA_ISA206 ;
target/ppc/cpu_init.h +1 -2
@@ -17,8 +17,7 @@#define PPC_INSNS_FLAGS2_POWER_COMMON \ (PPC2_VSX | PPC2_ISA207 | PPC2_DFP | PPC2_DBRX | \ PPC2_PERM_ISA206 | PPC2_DIVE_ISA206 | PPC2_ATOMIC_ISA206 | \ - PPC2_FP_CVT_ISA206 | PPC2_FP_TST_ISA206 | \ - PPC2_ALTIVEC_207 | PPC2_ISA205 | \ + PPC2_FP_CVT_ISA206 | PPC2_FP_TST_ISA206 | PPC2_ISA205 | \ PPC2_ISA207S | PPC2_FP_CVT_S64 | PPC2_ISA300 | PPC2_PRCNTL | \ PPC2_MEM_LWSYNC | PPC2_BCDA_ISA206)
target/ppc/translate/vmx-impl.c.inc +51 -51
234 lines not on this page · raw message
target/ppc/translate/vmx-ops.c.inc +9 -9
@@ -2,7 +2,7 @@ GEN_HANDLER(name, 0x04, opc2, opc3, 0x00000000, PPC_ALTIVEC) #define GEN_VXFORM_207(name, opc2, opc3) \ -GEN_HANDLER_E(name, 0x04, opc2, opc3, 0x00000000, PPC_NONE, PPC2_ALTIVEC_207) +GEN_HANDLER_E(name, 0x04, opc2, opc3, 0x00000000, PPC_NONE, PPC2_ISA207) #define GEN_VXFORM_300(name, opc2, opc3) \ GEN_HANDLER_E(name, 0x04, opc2, opc3, 0x00000000, PPC_NONE, PPC2_ISA300)
@@ -26,10 +26,10 @@ GEN_HANDLER_E(name0##_##name1, 0x4, opc2, (opc3 | 0x10), 0x00000000, tp0, tp1), GEN_VXFORM_300(vextublx, 6, 24), GEN_VXFORM_300(vextuhlx, 6, 25), -GEN_VXFORM_DUAL(vmrgow, vextuwlx, 6, 26, PPC_NONE, PPC2_ALTIVEC_207), +GEN_VXFORM_DUAL(vmrgow, vextuwlx, 6, 26, PPC_NONE, PPC2_ISA207), GEN_VXFORM_300(vextubrx, 6, 28), GEN_VXFORM_300(vextuhrx, 6, 29), -GEN_VXFORM_DUAL(vmrgew, vextuwrx, 6, 30, PPC_NONE, PPC2_ALTIVEC_207), +GEN_VXFORM_DUAL(vmrgew, vextuwrx, 6, 30, PPC_NONE, PPC2_ISA207), GEN_VXFORM_300(vsrv, 2, 28), GEN_VXFORM_300(vslv, 2, 29), GEN_VXFORM(vslo, 6, 16),
@@ -113,10 +113,10 @@ GEN_VXFORM_UIMM(vctsxs, 5, 15), GEN_HANDLER(name0##_##name1, 0x04, opc2, 0xFF, 0x00000000, PPC_ALTIVEC) GEN_VAFORM_PAIRED(vmaddfp, vnmsubfp, 23), -GEN_VXFORM_DUAL(vclzb, vpopcntb, 1, 28, PPC_NONE, PPC2_ALTIVEC_207), -GEN_VXFORM_DUAL(vclzh, vpopcnth, 1, 29, PPC_NONE, PPC2_ALTIVEC_207), -GEN_VXFORM_DUAL(vclzw, vpopcntw, 1, 30, PPC_NONE, PPC2_ALTIVEC_207), -GEN_VXFORM_DUAL(vclzd, vpopcntd, 1, 31, PPC_NONE, PPC2_ALTIVEC_207), +GEN_VXFORM_DUAL(vclzb, vpopcntb, 1, 28, PPC_NONE, PPC2_ISA207), +GEN_VXFORM_DUAL(vclzh, vpopcnth, 1, 29, PPC_NONE, PPC2_ISA207), +GEN_VXFORM_DUAL(vclzw, vpopcntw, 1, 30, PPC_NONE, PPC2_ISA207), +GEN_VXFORM_DUAL(vclzd, vpopcntd, 1, 31, PPC_NONE, PPC2_ISA207), GEN_VXFORM_300(vbpermd, 6, 23), GEN_VXFORM_207(vbpermq, 6, 21),
@@ -127,8 +127,8 @@ GEN_VXFORM_207(vpmsumw, 4, 18), GEN_VXFORM_207(vsbox, 4, 23), -GEN_VXFORM_DUAL(vcipher, vcipherlast, 4, 20, PPC_NONE, PPC2_ALTIVEC_207), -GEN_VXFORM_DUAL(vncipher, vncipherlast, 4, 21, PPC_NONE, PPC2_ALTIVEC_207), +GEN_VXFORM_DUAL(vcipher, vcipherlast, 4, 20, PPC_NONE, PPC2_ISA207), +GEN_VXFORM_DUAL(vncipher, vncipherlast, 4, 21, PPC_NONE, PPC2_ISA207), GEN_VXFORM_207(vshasigmaw, 1, 26), GEN_VXFORM_207(vshasigmad, 1, 27),
Signature · 1 line
2.55.0
PATCH v2 5/7 target/ppc: Use PPC2_ISA207 instead of PPC2_ISA207S
In reply to Chinmay RathPPC2_ISA207S is only ever set in the CPUPPCState's insns_flags2 alongside PPC2_ISA207. Checks made by PPC2_ISA207S could be replaced with PPC2_ISA207, hence rendering it useless and apt for removal. This patch does the same.
--- hw/ppc/spapr_caps.c | 2 +- linux-user/ppc/elfload.c | 2 +- target/ppc/cpu.h | 5 +---- target/ppc/cpu_init.c | 3 +-- target/ppc/cpu_init.h | 2 +- target/ppc/tcg-excp_helper.c | 8 ++++---- target/ppc/translate.c | 6 +++--- target/ppc/translate/bhrb-impl.c.inc | 4 ++-- target/ppc/translate/branch-impl.c.inc | 2 +- target/ppc/translate/processor-ctrl-impl.c.inc | 8 ++++---- 10 files changed, 19 insertions(+), 23 deletions(-)
hw/ppc/spapr_caps.c +1 -1
@@ -676,7 +676,7 @@ static void cap_ail_mode_3_apply(SpaprMachineState *spapr,if (tcg_enabled ()) {/* AIL-3 is only supported on POWER8 and above CPUs. */ -if (!(pcc->insns_flags2 &PPC2_ISA207S )) { +if (!(pcc->insns_flags2 &PPC2_ISA207 )) {error_setg (errp,"TCG only supports cap-ail-mode-3 on POWER8 and later CPUs" );error_append_hint (errp,"Try appending -machine cap-ail-mode-3=off\n" );return ;
linux-user/ppc/elfload.c +1 -1
@@ -116,7 +116,7 @@ abi_ulong get_elf_hwcap2(CPUState *cs) do { if (cpu->env.insns_flags2 & flag) { features |= feature; } } while (0)GET_FEATURE (PPC_ISEL ,QEMU_PPC_FEATURE2_HAS_ISEL ); -GET_FEATURE2 ((PPC2_ISA207 |PPC2_ISA207S ), (QEMU_PPC_FEATURE2_ARCH_2_07 | +GET_FEATURE2 (PPC2_ISA207 , (QEMU_PPC_FEATURE2_ARCH_2_07 |QEMU_PPC_FEATURE2_VEC_CRYPTO |QEMU_PPC_FEATURE2_HAS_TAR ));GET_FEATURE2 (PPC2_ISA300 ,QEMU_PPC_FEATURE2_ARCH_3_00 |QEMU_PPC_FEATURE2_DARN |QEMU_PPC_FEATURE2_HAS_IEEE128 );
target/ppc/cpu.h +1 -4
@@ -2577,8 +2577,6 @@ enum {PPC2_FP_CVT_ISA206 =0x0000000000000400ULL ,/* ISA 2.06B floating point test instructions */ PPC2_FP_TST_ISA206 =0x0000000000000800ULL , -/* PowerISA 2.07 Book3s specification */ -PPC2_ISA207S =0x0000000000008000ULL ,/* Double precision floating point conversion for signed integer 64 */ PPC2_FP_CVT_S64 = 0x0000000000010000ULL,/* Transactional Memory (ISA 2.07, Book II) */
@@ -2603,8 +2601,7 @@ enum {#define PPC_TCG_INSNS2 (PPC2_BOOKE206 | PPC2_VSX | PPC2_PRCNTL | PPC2_DBRX | \ PPC2_ISA205 | PPC2_ISA207 | PPC2_PERM_ISA206 | \ PPC2_DIVE_ISA206 | PPC2_ATOMIC_ISA206 | \ - PPC2_FP_CVT_ISA206 | PPC2_FP_TST_ISA206 | \ - PPC2_ISA207S | PPC2_DFP | \ + PPC2_FP_CVT_ISA206 | PPC2_FP_TST_ISA206 | PPC2_DFP | \ PPC2_FP_CVT_S64 | PPC2_TM | PPC2_PM_ISA206 | \ PPC2_ISA300 | PPC2_ISA310 | PPC2_MEM_LWSYNC | \ PPC2_BCDA_ISA206 | PPC2_PPE42 | PPC2_PPE42X | \
target/ppc/cpu_init.c +1 -2
@@ -6349,8 +6349,7 @@ POWERPC_FAMILY(POWER8)(ObjectClass *oc, const void *data) pcc->insns_flags2 =PPC2_VSX |PPC2_ISA207 |PPC2_DFP |PPC2_DBRX |PPC2_PERM_ISA206 |PPC2_DIVE_ISA206 |PPC2_ATOMIC_ISA206 |PPC2_FP_CVT_ISA206 | -PPC2_FP_TST_ISA206 | -PPC2_ISA205 |PPC2_ISA207S |PPC2_FP_CVT_S64 | +PPC2_FP_TST_ISA206 |PPC2_ISA205 |PPC2_FP_CVT_S64 |PPC2_TM |PPC2_PM_ISA206 |PPC2_MEM_LWSYNC |PPC2_BCDA_ISA206 ; pcc->msr_mask = (1ull << MSR_SF) |
target/ppc/cpu_init.h +1 -1
@@ -18,7 +18,7 @@ (PPC2_VSX |PPC2_ISA207 |PPC2_DFP |PPC2_DBRX | \PPC2_PERM_ISA206 |PPC2_DIVE_ISA206 |PPC2_ATOMIC_ISA206 | \PPC2_FP_CVT_ISA206 |PPC2_FP_TST_ISA206 |PPC2_ISA205 | \ -PPC2_ISA207S |PPC2_FP_CVT_S64 |PPC2_ISA300 |PPC2_PRCNTL | \ +PPC2_FP_CVT_S64 |PPC2_ISA300 |PPC2_PRCNTL | \ PPC2_MEM_LWSYNC | PPC2_BCDA_ISA206)#define PPC_INSNS_FLAGS2_POWER9 \
target/ppc/tcg-excp_helper.c +4 -4
@@ -314,7 +314,7 @@ void ppc_cpu_debug_excp_handler(CPUState *cs)#if defined(TARGET_PPC64 )CPUPPCState *env =cpu_env (cs); -if (env->insns_flags2 &PPC2_ISA207S ) { +if (env->insns_flags2 &PPC2_ISA207 ) {if (cs->watchpoint_hit) {if (cs->watchpoint_hit->flags &BP_CPU ) { env->spr[SPR_DAR ] = cs->watchpoint_hit->hitaddr;
@@ -336,7 +336,7 @@ bool ppc_cpu_debug_check_breakpoint(CPUState *cs)#if defined(TARGET_PPC64 )CPUPPCState *env =cpu_env (cs); -if (env->insns_flags2 &PPC2_ISA207S ) { +if (env->insns_flags2 &PPC2_ISA207 ) {target_ulong priv; priv = env->spr[SPR_CIABR ] &PPC_BITMASK (62 ,63 );
@@ -365,7 +365,7 @@ bool ppc_cpu_debug_check_watchpoint(CPUState *cs, CPUWatchpoint *wp)bool wt, wti, hv, sv, pr;uint32_t dawrx; -if ((env->insns_flags2 &PPC2_ISA207S ) && +if ((env->insns_flags2 &PPC2_ISA207 ) && (wp == env->dawr_watchpoint[0 ])) { dawrx = env->spr[SPR_DAWRX0 ]; } else if ((env->insns_flags2 & PPC2_ISA310) &&
@@ -849,7 +849,7 @@ void helper_book3s_msgsndp(CPUPPCState *env, target_ulong rb)void helper_book3s_trace (CPUPPCState *env,target_ulong prev_ip) {uint32_t error_code =0 ; -if (env->insns_flags2 &PPC2_ISA207S ) { +if (env->insns_flags2 &PPC2_ISA207 ) {/* Load/store reporting, SRR1[35, 36] and SDAR, are not implemented. */ env->spr[SPR_POWER_SIAR ] = prev_ip; error_code =PPC_BIT (33 );
target/ppc/translate.c +3 -3
@@ -2775,7 +2775,7 @@ static inline void gen_op_mfspr(DisasContext *ctx) } }else {/* ISA 2.07 defines these as no-ops */ -if ((ctx->insns_flags2 &PPC2_ISA207S ) && +if ((ctx->insns_flags2 &PPC2_ISA207 ) && (sprn >=808 && sprn <=811 )) {/* This is a nop */ return ;
@@ -2841,7 +2841,7 @@ static void gen_mtspr(DisasContext *ctx) } }else {/* ISA 2.07 defines these as no-ops */ -if ((ctx->insns_flags2 &PPC2_ISA207S ) && +if ((ctx->insns_flags2 &PPC2_ISA207 ) && (sprn >=808 && sprn <=811 )) {/* This is a nop */ return ;
@@ -4105,7 +4105,7 @@ TRANS64(LDARX, do_load_locked, DEF_MEMOP(MO_UQ))static bool trans_LQARX (DisasContext *ctx,arg_LQARX *a) {REQUIRE_64BIT (ctx); -REQUIRE_INSNS_FLAGS2 (ctx,ISA207S ); +REQUIRE_INSNS_FLAGS2 (ctx,ISA207 );#if defined(TARGET_PPC64 )TCGv EA ;TCGv_i128 t16;
target/ppc/translate/bhrb-impl.c.inc +2 -2
@@ -14,7 +14,7 @@ static bool trans_MFBHRBE(DisasContext *ctx, arg_XFX_bhrbe *arg) { - REQUIRE_INSNS_FLAGS2(ctx, ISA207S); + REQUIRE_INSNS_FLAGS2(ctx, ISA207); TCGv_i32 bhrbe = tcg_constant_i32(arg->bhrbe); gen_helper_mfbhrbe(cpu_gpr[arg->rt], tcg_env, bhrbe); return true;
@@ -22,7 +22,7 @@ static bool trans_MFBHRBE(DisasContext *ctx, arg_XFX_bhrbe *arg) static bool trans_CLRBHRB(DisasContext *ctx, arg_CLRBHRB *arg) { - REQUIRE_INSNS_FLAGS2(ctx, ISA207S); + REQUIRE_INSNS_FLAGS2(ctx, ISA207); gen_helper_clrbhrb(tcg_env); return true; }
target/ppc/translate/branch-impl.c.inc +1 -1
@@ -14,7 +14,7 @@ static bool trans_RFEBB(DisasContext *ctx, arg_XL_s *arg) { - REQUIRE_INSNS_FLAGS2(ctx, ISA207S); + REQUIRE_INSNS_FLAGS2(ctx, ISA207); translator_io_start(&ctx->base); gen_update_branch_history(ctx, ctx->cia, NULL, BHRB_TYPE_NORECORD);
target/ppc/translate/processor-ctrl-impl.c.inc +4 -4
@@ -23,7 +23,7 @@ static bool trans_MSGCLR(DisasContext *ctx, arg_X_rb *a) { - if (!(ctx->insns_flags2 & PPC2_ISA207S)) { + if (!(ctx->insns_flags2 & PPC2_ISA207)) { /* * Before Power ISA 2.07, processor control instructions were only * implemented in the "Embedded.Processor Control" category.
@@ -47,7 +47,7 @@ static bool trans_MSGCLR(DisasContext *ctx, arg_X_rb *a) static bool trans_MSGSND(DisasContext *ctx, arg_X_rb *a) { - if (!(ctx->insns_flags2 & PPC2_ISA207S)) { + if (!(ctx->insns_flags2 & PPC2_ISA207)) { /* * Before Power ISA 2.07, processor control instructions were only * implemented in the "Embedded.Processor Control" category.
@@ -72,7 +72,7 @@ static bool trans_MSGSND(DisasContext *ctx, arg_X_rb *a) static bool trans_MSGCLRP(DisasContext *ctx, arg_X_rb *a) { REQUIRE_64BIT(ctx); - REQUIRE_INSNS_FLAGS2(ctx, ISA207S); + REQUIRE_INSNS_FLAGS2(ctx, ISA207); REQUIRE_SV(ctx); #if !defined(CONFIG_USER_ONLY) && defined(TARGET_PPC64) gen_helper_book3s_msgclrp(tcg_env, cpu_gpr[a->rb]);
@@ -85,7 +85,7 @@ static bool trans_MSGCLRP(DisasContext *ctx, arg_X_rb *a) static bool trans_MSGSNDP(DisasContext *ctx, arg_X_rb *a) { REQUIRE_64BIT(ctx); - REQUIRE_INSNS_FLAGS2(ctx, ISA207S); + REQUIRE_INSNS_FLAGS2(ctx, ISA207); REQUIRE_SV(ctx); #if !defined(CONFIG_USER_ONLY) && defined(TARGET_PPC64) gen_helper_book3s_msgsndp(tcg_env, cpu_gpr[a->rb]);
Signature · 1 line
2.55.0
PATCH v2 6/7 target/ppc: Reorder PPC2 flags
In reply to Chinmay RathConsolidation of different variations of Power ISA 2.07 flags into the PPC2_ISA207 flag has left gaps in the flag encoding. This patch reorders them, restoring the expected incremental order without any gaps, freeing up bits for future use.
--- target/ppc/cpu.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
target/ppc/cpu.h +10 -10
@@ -2578,25 +2578,25 @@ enum {/* ISA 2.06B floating point test instructions */ PPC2_FP_TST_ISA206 =0x0000000000000800ULL ,/* Double precision floating point conversion for signed integer 64 */ -PPC2_FP_CVT_S64 =0x0000000000010000ULL , +PPC2_FP_CVT_S64 =0x0000000000001000ULL ,/* Transactional Memory (ISA 2.07, Book II) */ -PPC2_TM =0x0000000000020000ULL , +PPC2_TM =0x0000000000002000ULL ,/* Server PM instructgions (ISA 2.06, Book III) */ -PPC2_PM_ISA206 =0x0000000000040000ULL , +PPC2_PM_ISA206 =0x0000000000004000ULL ,/* POWER ISA 3.0 */ -PPC2_ISA300 =0x0000000000080000ULL , +PPC2_ISA300 =0x0000000000008000ULL ,/* POWER ISA 3.1 */ -PPC2_ISA310 =0x0000000000100000ULL , +PPC2_ISA310 =0x0000000000010000ULL ,/* lwsync instruction */ -PPC2_MEM_LWSYNC =0x0000000000200000ULL , +PPC2_MEM_LWSYNC =0x0000000000020000ULL ,/* ISA 2.06 BCD assist instructions */ -PPC2_BCDA_ISA206 =0x0000000000400000ULL , +PPC2_BCDA_ISA206 =0x0000000000040000ULL ,/* PPE42 instructions */ -PPC2_PPE42 =0x0000000000800000ULL , +PPC2_PPE42 =0x0000000000080000ULL ,/* PPE42X instructions */ -PPC2_PPE42X =0x0000000001000000ULL , +PPC2_PPE42X =0x0000000000100000ULL ,/* PPE42XM instructions */ -PPC2_PPE42XM =0x0000000002000000ULL , +PPC2_PPE42XM =0x0000000000200000ULL , #define PPC_TCG_INSNS2 (PPC2_BOOKE206 | PPC2_VSX | PPC2_PRCNTL | PPC2_DBRX | \ PPC2_ISA205 | PPC2_ISA207 | PPC2_PERM_ISA206 | \
Signature · 1 line
2.55.0
PATCH v2 7/7 target/ppc: Add ICBT support for ISA version 2.07
In reply to Chinmay RathThe summary of changes in Power ISA version 2.07B mentions :
"ICBT instruction has been moved from the Embedded category to the Base category".
Updating ICBT flag for the same.
While we are at it, correct the invalid mask as per the ISA as well.
--- target/ppc/translate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
target/ppc/translate.c +2 -2
@@ -4509,8 +4509,8 @@ GEN_HANDLER2_E(tlbilx_booke206, "tlbilx", 0x1F, 0x12, 0x00, 0x03800001,GEN_HANDLER (wrtee,0x1F ,0x03 ,0x04 ,0x000FFC01 ,PPC_WRTEE ),GEN_HANDLER (wrteei,0x1F ,0x03 ,0x05 ,0x000E7C01 ,PPC_WRTEE ),GEN_HANDLER (dlmzb,0x1F ,0x0E ,0x02 ,0x00000000 ,PPC_440_SPEC ), -GEN_HANDLER2_E (icbt_440,"icbt" ,0x1F ,0x16 ,0x00 ,0x03E00001 , -PPC_BOOKE ,PPC2_BOOKE206 ), +GEN_HANDLER2_E (icbt_440,"icbt" ,0x1F ,0x16 ,0x00 ,0x02000001 , +PPC_BOOKE , (PPC2_BOOKE206 |PPC2_ISA207 )),GEN_HANDLER2 (icbt_440,"icbt" ,0x1F ,0x06 ,0x08 ,0x03E00001 ,PPC_440_SPEC ), GEN_HANDLER(mfvscr, 0x04, 0x2, 0x18, 0x001ff800, PPC_ALTIVEC),
Signature · 1 line
2.55.0
Quoted 8 lines · Chinmay Rath
Chinmay Rath (7):
target/ppc: ReplacePPC2_VSX207flag withPPC2_ISA207target/ppc: UsePPC2_ISA207instead ofPPC2_BCTAR_ISA207target/ppc: UsePPC2_ISA207instead ofPPC2_LSQ_ISA207target/ppc: UsePPC2_ISA207instead ofPPC2_ALTIVEC_207target/ppc: UsePPC2_ISA207instead ofPPC2_ISA207Starget/ppc: Reorder PPC2 flags
target/ppc: Add ICBT support for ISA version 2.07
r~
Quoted 10 lines · Richard Henderson
Quoted 8 lines · Chinmay Rath
Chinmay Rath (7):
target/ppc: ReplacePPC2_VSX207flag withPPC2_ISA207target/ppc: UsePPC2_ISA207instead ofPPC2_BCTAR_ISA207target/ppc: UsePPC2_ISA207instead ofPPC2_LSQ_ISA207target/ppc: UsePPC2_ISA207instead ofPPC2_ALTIVEC_207target/ppc: UsePPC2_ISA207instead ofPPC2_ISA207Starget/ppc: Reorder PPC2 flags
target/ppc: Add ICBT support for ISA version 2.07
Quoted 2 lines
Reviewed-by Richard Henderson <[email protected]>
Thanks Richard !
Quoted 2 lines
r~
Hi Chinmay,
Quoted 23 lines · Chinmay Rath
While working with some PPC instructions from a ISA 2.07 POV, I observed the following :
1. Unlike ISA versions 2.05, 3.0 and 3.1 which have one specific flag for usage in the
insns_flags2field in the CPUPPCState struct, ISA 2.07 and 2.06 have multiple flags. Upon further investigation, I see that during CPU intialization (POWER 8+), all those variations of the ISA 2.07 flags are only ever used all together. There is no instance in the code where a CPU is initialzed in a more granular level, using only a subset of the ISA 2.07 flag variations.
This patch series hence consolidates the different 2.07 flags, and frees up bits in theinsns_flags2field for future use. I intend to do the same analysis for the ISA 2.06 flags as well.2. The "Summary of changes in Power ISA 2.07B" section in the ISA version 2.07B mentions : "The icbt instruction has been moved from the Embedded category to the Base category."
This change has not been incorporated in the QEMU code resulting in illegal instruction exception upon encountering ICBT instruction in Power VMs where it should be recognized. Hence adding the necessary flag to the instruction. Also correcting the invalid mask for the decoding as per the ISA.
Quoted 3 lines
This series is based on top of the patches from another series that I had posted :
[A] : https://lore.kernel.org/qemu-devel/[email protected]/
Thanks for these improvements.
I see the pre-req decodetree series is still undergoing review by Glenn and others while this is reviewed already, therefore this needs to wait a little more.
regards,
Harsh
Quoted 41 lines
Link to Gitlab CI with patches :
https://gitlab.com/rathc/qemu/-/pipelines/2776338293Changes in v2 :
(quoted diff) +0
-2-Retained all 'Reviewed-by's and 'Tested-by's received. -In patch 2: Change instruction flag in BCTAR instruction.The above series [A] now incorpates the following review comment received on its respective RFC series :
https://lore.kernel.org/qemu-devel/[email protected]/
Due to this. Doing the necessary change in patch 2.Chinmay Rath (7):
target/ppc: ReplacePPC2_VSX207flag withPPC2_ISA207target/ppc: UsePPC2_ISA207instead ofPPC2_BCTAR_ISA207target/ppc: UsePPC2_ISA207instead ofPPC2_LSQ_ISA207target/ppc: UsePPC2_ISA207instead ofPPC2_ALTIVEC_207target/ppc: UsePPC2_ISA207instead ofPPC2_ISA207Starget/ppc: Reorder PPC2 flags
target/ppc: Add ICBT support for ISA version 2.07hw/ppc/spapr_caps.c | 2 +- linux-user/ppc/elfload.c | 6 +- target/ppc/cpu.h | 38 +++---- target/ppc/cpu_init.c | 6 +- target/ppc/cpu_init.h | 7 +- target/ppc/tcg-excp_helper.c | 8 +- target/ppc/translate.c | 10 +- target/ppc/translate/bhrb-impl.c.inc | 4 +- target/ppc/translate/branch-impl.c.inc | 4 +- target/ppc/translate/fixedpoint-impl.c.inc | 4 +- target/ppc/translate/fp-impl.c.inc | 4 +- .../ppc/translate/processor-ctrl-impl.c.inc | 8 +- target/ppc/translate/vmx-impl.c.inc | 102 +++++++++--------- target/ppc/translate/vmx-ops.c.inc | 18 ++-- target/ppc/translate/vsx-impl.c.inc | 56 +++++----- target/ppc/translate/vsx-ops.c.inc | 24 ++--- 16 files changed, 143 insertions(+), 158 deletions(-)