ppc patch queue 2013-12-20
Hi Blue / Aurelien / Anthony,
This is my current patch queue for ppc. Please pull.
Alex
The following changes since commit 3dc7e2a3fedafc2f951bd62300b342c84e3606f8:
Merge remote-tracking branch 'pmaydell/tags/pull-target-arm-20131217' into staging (2013-12-19 11:56:33 -0800)
are available in the git repository at:
git://github.com/agraf/qemu.git tags/signed-ppc-for-upstream
for you to fetch changes up to 5fe269b16c6dc8f19da3e8c13d4c66958b00d2f0:
spapr: limit numa memory regions by ram size (2013-12-20 01:58:14 +0100)
----------------------------------------------------------------
Patch queue for ppc - 2013-12-20
Alexander Graf (3):
PPC: Use default pci bus name for grackle and heathrow
roms: Flush icache when writing roms to guest memory
PPC: Add VSX to hflags
Alexey Kardashevskiy (5):
powerpc: add PVR mask support
target-ppc: move POWER7+ to a separate family
spapr-rtas: replace return code constants with macros
spapr-rtas: add ibm, (get|set)-system-parameter
spapr: make sure RMA is in first mode of first memory node
Greg Kurz (1):
target-ppc: add stubs for KVM breakpoints
Paolo Bonzini (1):
spapr: tie spapr-nvram to -pflash
Paul Mackerras (1):
spapr: limit numa memory regions by ram size
Peter Crosthwaite (2):
device_tree: s/qemu_devtree/qemu_fdt globally
device_tree: qemu_fdt_setprop: Rename val_array arg
Tom Musta (19):
Declare and Enable VSX
Add MSR VSX and Associated Exception
Add VSX Instruction Decoders
Add VSR to Global Registers
Add lxvd2x
Add stxvd2x
Add xxpermdi
Add lxsdx
Add lxvdsx
Add lxvw4x
Add stxsdx
Add stxvw4x
Add VSX Scalar Move Instructions
Add VSX Vector Move Instructions
Add Power7 VSX Logical Instructions
Add xxmrgh/xxmrgl
Add xxsel
Add xxspltw
Add xxsldwi
----------------------------------------------------------------
Alexander Graf (3):
PPC: Use default pci bus name for grackle and heathrow
roms: Flush icache when writing roms to guest memory
PPC: Add VSX to hflags
Alexey Kardashevskiy (5):
powerpc: add PVR mask support
target-ppc: move POWER7+ to a separate family
spapr-rtas: replace return code constants with macros
spapr-rtas: add ibm, (get|set)-system-parameter
spapr: make sure RMA is in first mode of first memory node
Greg Kurz (1):
target-ppc: add stubs for KVM breakpoints
Paolo Bonzini (1):
spapr: tie spapr-nvram to -pflash
Paul Mackerras (1):
spapr: limit numa memory regions by ram size
Peter Crosthwaite (2):
device_tree: s/qemu_devtree/qemu_fdt globally
device_tree: qemu_fdt_setprop: Rename val_array arg
Tom Musta (19):
Declare and Enable VSX
Add MSR VSX and Associated Exception
Add VSX Instruction Decoders
Add VSR to Global Registers
Add lxvd2x
Add stxvd2x
Add xxpermdi
Add lxsdx
Add lxvdsx
Add lxvw4x
Add stxsdx
Add stxvw4x
Add VSX Scalar Move Instructions
Add VSX Vector Move Instructions
Add Power7 VSX Logical Instructions
Add xxmrgh/xxmrgl
Add xxsel
Add xxspltw
Add xxsldwi
device_tree.c | 64 ++--- exec.c | 44 +++- hw/arm/boot.c | 24 +- hw/arm/vexpress.c | 18 +- hw/arm/virt.c | 106 ++++---- hw/core/loader.c | 7 + hw/intc/xics.c | 24 +- hw/microblaze/boot.c | 12 +- hw/nvram/spapr_nvram.c | 16 +- hw/pci-host/grackle.c | 2 +- hw/pci-host/uninorth.c | 4 +- hw/ppc/e500.c | 213 +++++++-------- hw/ppc/e500plat.c | 6 +- hw/ppc/mpc8544ds.c | 6 +- hw/ppc/ppc440_bamboo.c | 24 +- hw/ppc/spapr.c | 49 ++-- hw/ppc/spapr_events.c | 6 +- hw/ppc/spapr_pci.c | 42 +-- hw/ppc/spapr_rtas.c | 97 +++++-- hw/ppc/spapr_vio.c | 12 +- hw/ppc/virtex_ml507.c | 2 +- include/exec/cpu-common.h | 1 + include/hw/ppc/spapr.h | 9 + include/sysemu/device_tree.h | 80 +++--- target-ppc/cpu-models.c | 3 +- target-ppc/cpu-models.h | 7 + target-ppc/cpu-qom.h | 2 + target-ppc/cpu.h | 9 +- target-ppc/excp_helper.c | 5 + target-ppc/helper_regs.h | 2 +- target-ppc/kvm.c | 32 +++ target-ppc/translate.c | 605 ++++++++++++++++++++++++++++++++++++++++++- target-ppc/translate_init.c | 91 ++++++- 33 files changed, 1237 insertions(+), 387 deletions(-)
[Qemu-devel] [PULL 11/32] Add lxvdsx
From: Tom Musta <[email protected]>
This patch adds the Load VSX Vector Doubleword & Splat Indexed (lxvdsx) instruction.
--- target-ppc/translate.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
target-ppc/translate.c +16 -0
@@ -7034,6 +7034,21 @@ static void gen_lxvd2x(DisasContext *ctx)tcg_temp_free (EA ); } +static void gen_lxvdsx (DisasContext *ctx) +{ +TCGv EA ; +if (unlikely (!ctx->vsx_enabled)) { +gen_exception (ctx,POWERPC_EXCP_VSXU ); +return ; + } +gen_set_access_type (ctx,ACCESS_INT ); +EA =tcg_temp_new (); +gen_addr_reg_index (ctx,EA ); +gen_qemu_ld64 (ctx,cpu_vsrh (xT (ctx->opcode)),EA ); +tcg_gen_mov_tl (cpu_vsrl (xT (ctx->opcode)),cpu_vsrh (xT (ctx->opcode))); +tcg_temp_free (EA ); +} +static void gen_stxvd2x (DisasContext *ctx) {TCGv EA ;
@@ -9519,6 +9534,7 @@ GEN_VAFORM_PAIRED(vmaddfp, vnmsubfp, 23),GEN_HANDLER_E (lxsdx,0x1F ,0x0C ,0x12 ,0 ,PPC_NONE ,PPC2_VSX ),GEN_HANDLER_E (lxvd2x,0x1F ,0x0C ,0x1A ,0 ,PPC_NONE ,PPC2_VSX ), +GEN_HANDLER_E (lxvdsx,0x1F ,0x0C ,0x0A ,0 ,PPC_NONE ,PPC2_VSX ), GEN_HANDLER_E(stxvd2x, 0x1F, 0xC, 0x1E, 0, PPC_NONE, PPC2_VSX),
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 14/32] Add stxvw4x
In reply to Alexander GrafFrom: Tom Musta <[email protected]>
This patch adds the Store VSX Vector Word*4 Indexed (stxvw4x) instruction.
--- target-ppc/translate.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
target-ppc/translate.c +28 -0
@@ -7107,6 +7107,33 @@ static void gen_stxvd2x(DisasContext *ctx)tcg_temp_free (EA ); } +static void gen_stxvw4x (DisasContext *ctx) +{ +TCGv EA , tmp; +if (unlikely (!ctx->vsx_enabled)) { +gen_exception (ctx,POWERPC_EXCP_VSXU ); +return ; + } +gen_set_access_type (ctx,ACCESS_INT ); +EA =tcg_temp_new (); +gen_addr_reg_index (ctx,EA ); + tmp =tcg_temp_new (); + +tcg_gen_shri_i64 (tmp,cpu_vsrh (xS (ctx->opcode)),32 ); +gen_qemu_st32 (ctx, tmp,EA ); +tcg_gen_addi_tl (EA ,EA ,4 ); +gen_qemu_st32 (ctx,cpu_vsrh (xS (ctx->opcode)),EA ); + +tcg_gen_shri_i64 (tmp,cpu_vsrl (xS (ctx->opcode)),32 ); +tcg_gen_addi_tl (EA ,EA ,4 ); +gen_qemu_st32 (ctx, tmp,EA ); +tcg_gen_addi_tl (EA ,EA ,4 ); +gen_qemu_st32 (ctx,cpu_vsrl (xS (ctx->opcode)),EA ); + +tcg_temp_free (EA ); +tcg_temp_free (tmp); +} +static void gen_xxpermdi (DisasContext *ctx) {if (unlikely (!ctx->vsx_enabled)) {
@@ -9581,6 +9608,7 @@ GEN_HANDLER_E(lxvw4x, 0x1F, 0x0C, 0x18, 0, PPC_NONE, PPC2_VSX),GEN_HANDLER_E (stxsdx,0x1F ,0xC ,0x16 ,0 ,PPC_NONE ,PPC2_VSX ),GEN_HANDLER_E (stxvd2x,0x1F ,0xC ,0x1E ,0 ,PPC_NONE ,PPC2_VSX ), +GEN_HANDLER_E (stxvw4x,0x1F ,0xC ,0x1C ,0 ,PPC_NONE ,PPC2_VSX ), #undef GEN_XX3FORM_DM #define GEN_XX3FORM_DM(name, opc2, opc3) \
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 01/32] target-ppc: add stubs for KVM breakpoints
In reply to Alexander GrafFrom: Greg Kurz <[email protected]>
The latest update to v3.13-rc3 (bf63839f) breaks the ppc build with KVM:
kvm-all.o: In function `kvm_update_guest_debug':
kvm-all.c:1910: undefined reference to kvm_arch_update_guest_debug' kvm-all.o: In function kvm_insert_breakpoint':
kvm-all.c:1937: undefined reference to kvm_arch_insert_sw_breakpoint' kvm-all.c:1945: undefined reference to kvm_arch_insert_hw_breakpoint' kvm-all.o: In function `kvm_remove_breakpoint':
kvm-all.c:1977: undefined reference to kvm_arch_remove_sw_breakpoint' kvm-all.c:1985: undefined reference to kvm_arch_remove_hw_breakpoint' kvm-all.o: In function `kvm_remove_all_breakpoints':
kvm-all.c:2009: undefined reference to kvm_arch_remove_sw_breakpoint' kvm-all.c:2006: undefined reference to kvm_arch_remove_sw_breakpoint' kvm-all.c:2017: undefined reference to `kvm_arch_remove_all_hw_breakpoints'
We need stubs until something gets implemented.
--- target-ppc/kvm.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
target-ppc/kvm.c +28 -0
@@ -1902,3 +1902,31 @@ int kvm_arch_on_sigbus(int code, void *addr)void kvm_arch_init_irq_routing (KVMState *s) { } + +int kvm_arch_insert_sw_breakpoint (CPUState *cpu,struct kvm_sw_breakpoint *bp) +{ +return -EINVAL ; +} + +int kvm_arch_remove_sw_breakpoint (CPUState *cpu,struct kvm_sw_breakpoint *bp) +{ +return -EINVAL ; +} + +int kvm_arch_insert_hw_breakpoint (target_ulong addr,target_ulong len,int type) +{ +return -EINVAL ; +} + +int kvm_arch_remove_hw_breakpoint (target_ulong addr,target_ulong len,int type) +{ +return -EINVAL ; +} + +void kvm_arch_remove_all_hw_breakpoints (void ) +{ +} + +void kvm_arch_update_guest_debug (CPUState *cpu,struct kvm_guest_debug *dbg) +{ +}
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 24/32] Add xxmrgh/xxmrgl
In reply to Alexander GrafFrom: Tom Musta <[email protected]>
This patch adds the VSX Merge High Word and VSX Merge Low Word instructions.
V2: Now implemented using deposit (per Richard Henderson's comment)
--- target-ppc/translate.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+)
target-ppc/translate.c +41 -0
@@ -7287,6 +7287,45 @@ VSX_LOGICAL(xxlor, tcg_gen_or_tl) VSX_LOGICAL(xxlxor, tcg_gen_xor_tl) VSX_LOGICAL(xxlnor, tcg_gen_nor_tl) +#define VSX_XXMRG (name, high) \ +static void glue(gen_, name)(DisasContext * ctx) \ + { \ + TCGv_i64 a0, a1, b0, b1; \ + if (unlikely(!ctx->vsx_enabled)) { \ + gen_exception(ctx, POWERPC_EXCP_VSXU); \ + return; \ + } \ + a0 = tcg_temp_new(); \ + a1 = tcg_temp_new(); \ + b0 = tcg_temp_new(); \ + b1 = tcg_temp_new(); \ + if (high) { \ + tcg_gen_mov_i64(a0, cpu_vsrh(xA(ctx->opcode))); \ + tcg_gen_mov_i64(a1, cpu_vsrh(xA(ctx->opcode))); \ + tcg_gen_mov_i64(b0, cpu_vsrh(xB(ctx->opcode))); \ + tcg_gen_mov_i64(b1, cpu_vsrh(xB(ctx->opcode))); \ + } else { \ + tcg_gen_mov_i64(a0, cpu_vsrl(xA(ctx->opcode))); \ + tcg_gen_mov_i64(a1, cpu_vsrl(xA(ctx->opcode))); \ + tcg_gen_mov_i64(b0, cpu_vsrl(xB(ctx->opcode))); \ + tcg_gen_mov_i64(b1, cpu_vsrl(xB(ctx->opcode))); \ + } \ + tcg_gen_shri_i64(a0, a0, 32); \ + tcg_gen_shri_i64(b0, b0, 32); \ + tcg_gen_deposit_i64(cpu_vsrh(xT(ctx->opcode)), \ + b0, a0, 32, 32); \ + tcg_gen_deposit_i64(cpu_vsrl(xT(ctx->opcode)), \ + b1, a1, 32, 32); \ + tcg_temp_free(a0); \ + tcg_temp_free(a1); \ + tcg_temp_free(b0); \ + tcg_temp_free(b1); \ + } + +VSX_XXMRG(xxmrghw, 1) +VSX_XXMRG (xxmrglw,0 ) + +/*** SPE extension ***/ /* Register moves */
@@ -9798,6 +9837,8 @@ VSX_LOGICAL(xxlandc, 0x8, 0x11, PPC2_VSX),VSX_LOGICAL (xxlor,0x8 ,0x12 ,PPC2_VSX ),VSX_LOGICAL (xxlxor,0x8 ,0x13 ,PPC2_VSX ),VSX_LOGICAL (xxlnor,0x8 ,0x14 ,PPC2_VSX ), +GEN_XX3FORM (xxmrghw,0x08 ,0x02 ,PPC2_VSX ), +GEN_XX3FORM (xxmrglw,0x08 ,0x06 ,PPC2_VSX ), GEN_XX3FORM_DM(xxpermdi, 0x08, 0x01),
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 02/32] powerpc: add PVR mask support
In reply to Alexander GrafFrom: Alexey Kardashevskiy <[email protected]>
IBM POWERPC processors encode PVR as a CPU family in higher 16 bits and a CPU version in lower 16 bits. Since there is no significant change in behavior between versions, there is no point to add every single CPU version in QEMU's CPU list. Also, new CPU versions of already supported CPU won't break the existing code.
This adds PVR value/mask support for KVM, i.e. for -cpu host option.
As CPU family class name for POWER7 is "POWER7-family", there is no need to touch aliases.
--- target-ppc/cpu-models.c | 1 + target-ppc/cpu-models.h | 5 +++++ target-ppc/cpu-qom.h | 2 ++ target-ppc/kvm.c | 4 ++++ target-ppc/translate_init.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 56 insertions(+)
target-ppc/cpu-models.c +1 -0
@@ -44,6 +44,7 @@PowerPCCPUClass *pcc =POWERPC_CPU_CLASS (oc); \ \ pcc->pvr = _pvr; \ + pcc->pvr_mask =CPU_POWERPC_DEFAULT_MASK ; \ pcc->svr = _svr; \ dc->desc = _desc; \ } \
target-ppc/cpu-models.h +5 -0
@@ -39,6 +39,7 @@ extern PowerPCCPUAlias ppc_cpu_aliases[];/*****************************************************************************/ /* PVR definitions for most known PowerPC */ enum { +CPU_POWERPC_DEFAULT_MASK =0xFFFFFFFF ,/* PowerPC 401 family */ /* Generic PowerPC 401 */ #define CPU_POWERPC_401 CPU_POWERPC_401G2
@@ -552,10 +553,14 @@ enum {CPU_POWERPC_POWER6 =0x003E0000 ,CPU_POWERPC_POWER6_5 =0x0F000001 ,/* POWER6 in POWER5 mode */ CPU_POWERPC_POWER6A =0x0F000002 , +CPU_POWERPC_POWER7_BASE =0x003F0000 , +CPU_POWERPC_POWER7_MASK =0xFFFF0000 , CPU_POWERPC_POWER7_v20 =0x003F0200 , CPU_POWERPC_POWER7_v21 =0x003F0201 , CPU_POWERPC_POWER7_v23 =0x003F0203 , CPU_POWERPC_POWER7P_v21 =0x004A0201 , +CPU_POWERPC_POWER8_BASE =0x004B0000 , +CPU_POWERPC_POWER8_MASK =0xFFFF0000 , CPU_POWERPC_POWER8_v10 =0x004B0100 ,CPU_POWERPC_970 =0x00390202 , CPU_POWERPC_970FX_v10 = 0x00391100,
target-ppc/cpu-qom.h +2 -0
@@ -54,6 +54,7 @@ typedef struct PowerPCCPUClass {void (*parent_reset)(CPUState *cpu);uint32_t pvr; +uint32_t pvr_mask;uint32_t svr;uint64_t insns_flags;uint64_t insns_flags2;
@@ -99,6 +100,7 @@ static inline PowerPCCPU *ppc_env_get_cpu(CPUPPCState *env)#define ENV_OFFSET offsetof(PowerPCCPU, env)PowerPCCPUClass *ppc_cpu_class_by_pvr (uint32_t pvr); +PowerPCCPUClass *ppc_cpu_class_by_pvr_mask (uint32_t pvr);void ppc_cpu_do_interrupt (CPUState *cpu); void ppc_cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
target-ppc/kvm.c +4 -0
@@ -1745,6 +1745,7 @@ static void kvmppc_host_cpu_class_init(ObjectClass *oc, void *data)uint32_t icache_size =kvmppc_read_int_cpu_dt ("i-cache-size" );/* Now fix up the class with information we can query from the host */ + pcc->pvr =mfpvr ();if (vmx !=-1 ) {/* Only override when we know what the host supports */
@@ -1795,6 +1796,9 @@ static int kvm_ppc_register_host_cpu_type(void) pvr_pcc =ppc_cpu_class_by_pvr (host_pvr);if (pvr_pcc ==NULL ) { + pvr_pcc =ppc_cpu_class_by_pvr_mask (host_pvr); + } +if (pvr_pcc ==NULL ) {return -1 ; } type_info.parent =object_class_get_name (OBJECT_CLASS (pvr_pcc));
target-ppc/translate_init.c +44 -0
68 lines not on this page · raw message
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 03/32] Declare and Enable VSX
In reply to Alexander GrafFrom: Tom Musta <[email protected]>
This patch adds the flag POWERPC_FLAG_VSX to the list of defined flags and also adds this flag to the list of supported features of the Power7 and Power8 CPUs. Additionally, the VSX instructions are added to the list of TCG-enabled instruction.
--- target-ppc/cpu.h | 5 ++++- target-ppc/translate_init.c | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-)
target-ppc/cpu.h +4 -1
@@ -549,6 +549,8 @@ enum {POWERPC_FLAG_BUS_CLK =0x00020000 ,/* Has CFAR */ POWERPC_FLAG_CFAR =0x00040000 , +/* Has VSX */ + POWERPC_FLAG_VSX = 0x00080000, };/*****************************************************************************/
@@ -1870,7 +1872,8 @@ enum {/* Book I 2.05 PowerPC specification */ PPC2_ISA205 = 0x0000000000000020ULL, -#define PPC_TCG_INSNS2 (PPC2_BOOKE206 | PPC2_PRCNTL | PPC2_DBRX | PPC2_ISA205) +#define PPC_TCG_INSNS2 (PPC2_BOOKE206 | PPC2_VSX | PPC2_PRCNTL | PPC2_DBRX | \ + PPC2_ISA205) };/*****************************************************************************/
target-ppc/translate_init.c +4 -2
@@ -7246,7 +7246,8 @@ POWERPC_FAMILY(POWER7)(ObjectClass *oc, void *data) pcc->bfd_mach = bfd_mach_ppc64; pcc->flags =POWERPC_FLAG_VRE |POWERPC_FLAG_SE |POWERPC_FLAG_BE |POWERPC_FLAG_PMM | -POWERPC_FLAG_BUS_CLK |POWERPC_FLAG_CFAR ; +POWERPC_FLAG_BUS_CLK |POWERPC_FLAG_CFAR | +POWERPC_FLAG_VSX ; pcc->l1_dcache_size =0x8000 ; pcc->l1_icache_size =0x8000 ; }
@@ -7283,7 +7284,8 @@ POWERPC_FAMILY(POWER8)(ObjectClass *oc, void *data) pcc->bfd_mach = bfd_mach_ppc64; pcc->flags =POWERPC_FLAG_VRE |POWERPC_FLAG_SE |POWERPC_FLAG_BE |POWERPC_FLAG_PMM | -POWERPC_FLAG_BUS_CLK |POWERPC_FLAG_CFAR ; +POWERPC_FLAG_BUS_CLK |POWERPC_FLAG_CFAR | +POWERPC_FLAG_VSX ; pcc->l1_dcache_size =0x8000 ; pcc->l1_icache_size =0x8000 ; }
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 04/32] Add MSR VSX and Associated Exception
In reply to Alexander GrafFrom: Tom Musta <[email protected]>
This patch adds support for the VSX bit of the PowerPC Machine State Register (MSR) as well as the corresponding VSX Unavailable exception.
The VSX bit is added to the defined bits masks of the Power7 and Power8 CPU models.
--- target-ppc/cpu.h | 4 ++++ target-ppc/excp_helper.c | 5 +++++ target-ppc/translate.c | 6 ++++++ target-ppc/translate_init.c | 5 +++-- 4 files changed, 18 insertions(+), 2 deletions(-)
target-ppc/cpu.h +4 -0
@@ -236,6 +236,8 @@ enum {POWERPC_EXCP_NMEXTBR =91 ,/* Non maskable external breakpoint */ POWERPC_EXCP_ITLBE =92 ,/* Instruction TLB error */ POWERPC_EXCP_DTLBE =93 ,/* Data TLB error */ +/* VSX Unavailable (Power ISA 2.06 and later) */ +POWERPC_EXCP_VSXU =94 ,/* VSX Unavailable */ /* EOL */ POWERPC_EXCP_NB = 96,/* QEMU exceptions: used internally during code translation */
@@ -427,6 +429,7 @@ struct ppc_slb_t {#define MSR_VR 25/* altivec available x hflags */ #define MSR_SPE 25/* SPE enable for BookE x hflags */ #define MSR_AP 23/* Access privilege state on 602 hflags */ +#define MSR_VSX 23/* Vector Scalar Extension (ISA 2.06 and later) x hflags */ #define MSR_SA 22/* Supervisor access mode on 602 hflags */ #define MSR_KEY 19/* key bit on 603e */ #define MSR_POW 18/* Power management */
@@ -467,6 +470,7 @@ struct ppc_slb_t {#define msr_vr ((env->msr >> MSR_VR) & 1)#define msr_spe ((env->msr >> MSR_SPE) & 1)#define msr_ap ((env->msr >> MSR_AP) & 1) +#define msr_vsx ((env->msr >> MSR_VSX) & 1)#define msr_sa ((env->msr >> MSR_SA) & 1)#define msr_key ((env->msr >> MSR_KEY) & 1)#define msr_pow ((env->msr >> MSR_POW) & 1)
target-ppc/excp_helper.c +5 -0
@@ -390,6 +390,11 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp) new_msr |= (target_ulong )MSR_HVB ; } goto store_current; +case POWERPC_EXCP_VSXU :/* VSX unavailable exception */ +if (lpes1 ==0 ) { + new_msr |= (target_ulong )MSR_HVB ; + } + goto store_current;case POWERPC_EXCP_PIT :/* Programmable interval timer interrupt */ LOG_EXCP ("PIT exception\n" ); goto store_next;
target-ppc/translate.c +6 -0
@@ -195,6 +195,7 @@ typedef struct DisasContext {#endif int fpu_enabled;int altivec_enabled; +int vsx_enabled;int spe_enabled;ppc_spr_t *spr_cb;/* Needed to check rights for mfspr/mtspr */ int singlestep_enabled;
@@ -9759,6 +9760,11 @@ static inline void gen_intermediate_code_internal(PowerPCCPU *cpu, ctx.altivec_enabled = msr_vr; else ctx.altivec_enabled = 0; +if ((env->flags &POWERPC_FLAG_VSX ) && msr_vsx) { + ctx.vsx_enabled = msr_vsx; + }else { + ctx.vsx_enabled =0 ; + }if ((env->flags &POWERPC_FLAG_SE ) && msr_se) ctx.singlestep_enabled =CPU_SINGLE_STEP ;else
target-ppc/translate_init.c +3 -2
@@ -3061,6 +3061,7 @@ static void init_excp_POWER7 (CPUPPCState *env) env->excp_vectors[POWERPC_EXCP_TRACE ] =0x00000D00 ; env->excp_vectors[POWERPC_EXCP_PERFM ] =0x00000F00 ; env->excp_vectors[POWERPC_EXCP_VPU ] =0x00000F20 ; + env->excp_vectors[POWERPC_EXCP_VSXU ] =0x00000F40 ; env->excp_vectors[POWERPC_EXCP_IABR ] =0x00001300 ; env->excp_vectors[POWERPC_EXCP_MAINT ] =0x00001600 ; env->excp_vectors[POWERPC_EXCP_VPUA ] =0x00001700 ;
@@ -7236,7 +7237,7 @@ POWERPC_FAMILY(POWER7)(ObjectClass *oc, void *data)PPC_SEGMENT_64B |PPC_SLBI |PPC_POPCNTB |PPC_POPCNTWD ; pcc->insns_flags2 =PPC2_VSX |PPC2_DFP |PPC2_DBRX |PPC2_ISA205 ; - pcc->msr_mask =0x800000000204FF37ULL ; + pcc->msr_mask =0x800000000284FF37ULL ; pcc->mmu_model =POWERPC_MMU_2_06 ;#if defined(CONFIG_SOFTMMU ) pcc->handle_mmu_fault = ppc_hash64_handle_mmu_fault;
@@ -7274,7 +7275,7 @@ POWERPC_FAMILY(POWER8)(ObjectClass *oc, void *data)PPC_SEGMENT_64B |PPC_SLBI |PPC_POPCNTB |PPC_POPCNTWD ; pcc->insns_flags2 =PPC2_VSX |PPC2_DFP |PPC2_DBRX ; - pcc->msr_mask =0x800000000204FF36ULL ; + pcc->msr_mask =0x800000000284FF36ULL ; pcc->mmu_model =POWERPC_MMU_2_06 ;#if defined(CONFIG_SOFTMMU ) pcc->handle_mmu_fault = ppc_hash64_handle_mmu_fault;
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 05/32] Add VSX Instruction Decoders
In reply to Alexander GrafFrom: Tom Musta <[email protected]>
This patch adds decoders for the VSX fields XT, XS, XA, XB and DM. The first four are split fields and a general helper for these types of fields is also added.
--- target-ppc/translate.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
target-ppc/translate.c +11 -0
@@ -366,6 +366,12 @@ static inline int32_t name(uint32_t opcode) \return (int16_t )((opcode >> (shift)) & ((1 << (nb)) -1 )); \ } +#define EXTRACT_HELPER_SPLIT (name, shift1, nb1, shift2, nb2) \ +static inline uint32_t name(uint32_t opcode) \ +{ \ + return (((opcode >> (shift1)) & ((1 << (nb1)) - 1)) << nb2) | \ + ((opcode >> (shift2)) & ((1 << (nb2)) - 1)); \ +}/* Opcode part 1 */ EXTRACT_HELPER (opc1,26 ,6 );/* Opcode part 2 */
@@ -480,6 +486,11 @@ static inline target_ulong MASK(uint32_t start, uint32_t end)return ret; } +EXTRACT_HELPER_SPLIT (xT,0 ,1 ,21 ,5 ); +EXTRACT_HELPER_SPLIT (xS,0 ,1 ,21 ,5 ); +EXTRACT_HELPER_SPLIT (xA,2 ,1 ,16 ,5 ); +EXTRACT_HELPER_SPLIT (xB,1 ,1 ,11 ,5 ); +EXTRACT_HELPER (DM ,8 ,2 );/*****************************************************************************/ /* PowerPC instructions table */
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 06/32] Add VSR to Global Registers
In reply to Alexander GrafFrom: Tom Musta <[email protected]>
This patch adds VSX VSRs to the the list of global register indices. More specifically, it adds the lower halves of the first 32 VSRs to the list of global register indices. The upper halves of the first 32 VSRs are already defined via cpu_fpr[]. And the second 32 VSRs are already defined via the cpu_avrh[] and cpu_avrl[] arrays.
--- target-ppc/translate.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
target-ppc/translate.c +27 -0
@@ -51,6 +51,7 @@ static char cpu_reg_names[10*3 + 22*4 /* GPR */#endif +10 *4 +22 *5 /* FPR */ +2 *(10 *6 +22 *7 )/* AVRh, AVRl */ + +10 *5 +22 *6 /* VSR */ + 8*5 /* CRF */];static TCGv cpu_gpr[32 ];#if !defined(TARGET_PPC64 )
@@ -58,6 +59,7 @@ static TCGv cpu_gprh[32];#endif static TCGv_i64 cpu_fpr[32 ];static TCGv_i64 cpu_avrh[32 ], cpu_avrl[32 ]; +static TCGv_i64 cpu_vsr[32 ];static TCGv_i32 cpu_crf[8 ];static TCGv cpu_nip;static TCGv cpu_msr;
@@ -137,6 +139,11 @@ void ppc_translate_init(void)#endif p += (i <10 ) ?6 :7 ; cpu_reg_names_size -= (i <10 ) ?6 :7 ; +snprintf (p, cpu_reg_names_size,"vsr%d" , i); + cpu_vsr[i] =tcg_global_mem_new_i64 (TCG_AREG0 , + offsetof(CPUPPCState, vsr[i]), p); + p += (i <10 ) ?5 :6 ; + cpu_reg_names_size -= (i <10 ) ?5 :6 ; } cpu_nip = tcg_global_mem_new(TCG_AREG0,
@@ -6976,6 +6983,26 @@ GEN_VAFORM_PAIRED(vmsumshm, vmsumshs, 20) GEN_VAFORM_PAIRED(vsel, vperm, 21)GEN_VAFORM_PAIRED (vmaddfp, vnmsubfp,23 ) +/*** VSX extension ***/ + +static inline TCGv_i64 cpu_vsrh (int n) +{ +if (n <32 ) { +return cpu_fpr[n]; + }else { +return cpu_avrh[n-32 ]; + } +} + +static inline TCGv_i64 cpu_vsrl (int n) +{ +if (n <32 ) { +return cpu_vsr[n]; + }else { +return cpu_avrl[n-32 ]; + } +} +/*** SPE extension ***/ /* Register moves */
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 07/32] Add lxvd2x
In reply to Alexander GrafFrom: Tom Musta <[email protected]>
This patch adds the lxvd2x instruction.
--- target-ppc/translate.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
target-ppc/translate.c +18 -0
@@ -7003,6 +7003,22 @@ static inline TCGv_i64 cpu_vsrl(int n) } } +static void gen_lxvd2x (DisasContext *ctx) +{ +TCGv EA ; +if (unlikely (!ctx->vsx_enabled)) { +gen_exception (ctx,POWERPC_EXCP_VSXU ); +return ; + } +gen_set_access_type (ctx,ACCESS_INT ); +EA =tcg_temp_new (); +gen_addr_reg_index (ctx,EA ); +gen_qemu_ld64 (ctx,cpu_vsrh (xT (ctx->opcode)),EA ); +tcg_gen_addi_tl (EA ,EA ,8 ); +gen_qemu_ld64 (ctx,cpu_vsrl (xT (ctx->opcode)),EA ); +tcg_temp_free (EA ); +} +/*** SPE extension ***/ /* Register moves */
@@ -9452,6 +9468,8 @@ GEN_VAFORM_PAIRED(vmsumshm, vmsumshs, 20),GEN_VAFORM_PAIRED (vsel, vperm,21 ),GEN_VAFORM_PAIRED (vmaddfp, vnmsubfp,23 ), +GEN_HANDLER_E (lxvd2x,0x1F ,0x0C ,0x1A ,0 ,PPC_NONE ,PPC2_VSX ), + #undef GEN_SPE #define GEN_SPE(name0, name1, opc2, opc3, inval0, inval1, type) \ GEN_OPCODE_DUAL(name0##_##name1, 0x04, opc2, opc3, inval0, inval1, type, PPC_NONE)
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 08/32] Add stxvd2x
In reply to Alexander GrafFrom: Tom Musta <[email protected]>
This patch adds the stxvd2x instruction.
--- target-ppc/translate.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
target-ppc/translate.c +18 -0
@@ -7019,6 +7019,22 @@ static void gen_lxvd2x(DisasContext *ctx)tcg_temp_free (EA ); } +static void gen_stxvd2x (DisasContext *ctx) +{ +TCGv EA ; +if (unlikely (!ctx->vsx_enabled)) { +gen_exception (ctx,POWERPC_EXCP_VSXU ); +return ; + } +gen_set_access_type (ctx,ACCESS_INT ); +EA =tcg_temp_new (); +gen_addr_reg_index (ctx,EA ); +gen_qemu_st64 (ctx,cpu_vsrh (xS (ctx->opcode)),EA ); +tcg_gen_addi_tl (EA ,EA ,8 ); +gen_qemu_st64 (ctx,cpu_vsrl (xS (ctx->opcode)),EA ); +tcg_temp_free (EA ); +} +/*** SPE extension ***/ /* Register moves */
@@ -9470,6 +9486,8 @@ GEN_VAFORM_PAIRED(vmaddfp, vnmsubfp, 23),GEN_HANDLER_E (lxvd2x,0x1F ,0x0C ,0x1A ,0 ,PPC_NONE ,PPC2_VSX ), +GEN_HANDLER_E (stxvd2x,0x1F ,0xC ,0x1E ,0 ,PPC_NONE ,PPC2_VSX ), + #undef GEN_SPE #define GEN_SPE(name0, name1, opc2, opc3, inval0, inval1, type) \ GEN_OPCODE_DUAL(name0##_##name1, 0x04, opc2, opc3, inval0, inval1, type, PPC_NONE)
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 09/32] Add xxpermdi
In reply to Alexander GrafFrom: Tom Musta <[email protected]>
This patch adds the xxpermdi instruction. The instruction uses bits 22, 23, 29 and 30 for non-opcode fields (DM, AX and BX). This results in overloading of the opcode table with aliases, which can be seen in the GEN_XX3FORM_DM macro.
--- target-ppc/translate.c | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-)
target-ppc/translate.c +40 -1
@@ -7035,10 +7035,28 @@ static void gen_stxvd2x(DisasContext *ctx)tcg_temp_free (EA ); } +static void gen_xxpermdi (DisasContext *ctx) +{ +if (unlikely (!ctx->vsx_enabled)) { +gen_exception (ctx,POWERPC_EXCP_VSXU ); +return ; + } + +if ((DM (ctx->opcode) &2 ) ==0 ) { +tcg_gen_mov_i64 (cpu_vsrh (xT (ctx->opcode)),cpu_vsrh (xA (ctx->opcode))); + }else { +tcg_gen_mov_i64 (cpu_vsrh (xT (ctx->opcode)),cpu_vsrl (xA (ctx->opcode))); + } +if ((DM (ctx->opcode) &1 ) ==0 ) { +tcg_gen_mov_i64 (cpu_vsrl (xT (ctx->opcode)),cpu_vsrh (xB (ctx->opcode))); + }else { +tcg_gen_mov_i64 (cpu_vsrl (xT (ctx->opcode)),cpu_vsrl (xB (ctx->opcode))); + } +} +/*** SPE extension ***/ /* Register moves */ -static inline void gen_evmra (DisasContext *ctx) {
@@ -9488,6 +9506,27 @@ GEN_HANDLER_E(lxvd2x, 0x1F, 0x0C, 0x1A, 0, PPC_NONE, PPC2_VSX), GEN_HANDLER_E(stxvd2x, 0x1F, 0xC, 0x1E, 0, PPC_NONE, PPC2_VSX), +#undef GEN_XX3FORM_DM +#define GEN_XX3FORM_DM (name, opc2, opc3) \ +GEN_HANDLER2_E(name, #name, 0x3C, opc2|0x00, opc3|0x00, 0, PPC_NONE, PPC2_VSX),\ +GEN_HANDLER2_E(name, #name, 0x3C, opc2|0x01, opc3|0x00, 0, PPC_NONE, PPC2_VSX),\ +GEN_HANDLER2_E(name, #name, 0x3C, opc2|0x02, opc3|0x00, 0, PPC_NONE, PPC2_VSX),\ +GEN_HANDLER2_E(name, #name, 0x3C, opc2|0x03, opc3|0x00, 0, PPC_NONE, PPC2_VSX),\ +GEN_HANDLER2_E(name, #name, 0x3C, opc2|0x00, opc3|0x04, 0, PPC_NONE, PPC2_VSX),\ +GEN_HANDLER2_E(name, #name, 0x3C, opc2|0x01, opc3|0x04, 0, PPC_NONE, PPC2_VSX),\ +GEN_HANDLER2_E(name, #name, 0x3C, opc2|0x02, opc3|0x04, 0, PPC_NONE, PPC2_VSX),\ +GEN_HANDLER2_E(name, #name, 0x3C, opc2|0x03, opc3|0x04, 0, PPC_NONE, PPC2_VSX),\ +GEN_HANDLER2_E(name, #name, 0x3C, opc2|0x00, opc3|0x08, 0, PPC_NONE, PPC2_VSX),\ +GEN_HANDLER2_E(name, #name, 0x3C, opc2|0x01, opc3|0x08, 0, PPC_NONE, PPC2_VSX),\ +GEN_HANDLER2_E(name, #name, 0x3C, opc2|0x02, opc3|0x08, 0, PPC_NONE, PPC2_VSX),\ +GEN_HANDLER2_E(name, #name, 0x3C, opc2|0x03, opc3|0x08, 0, PPC_NONE, PPC2_VSX),\ +GEN_HANDLER2_E(name, #name, 0x3C, opc2|0x00, opc3|0x0C, 0, PPC_NONE, PPC2_VSX),\ +GEN_HANDLER2_E(name, #name, 0x3C, opc2|0x01, opc3|0x0C, 0, PPC_NONE, PPC2_VSX),\ +GEN_HANDLER2_E(name, #name, 0x3C, opc2|0x02, opc3|0x0C, 0, PPC_NONE, PPC2_VSX),\ +GEN_HANDLER2_E(name, #name, 0x3C, opc2|0x03, opc3|0x0C, 0, PPC_NONE, PPC2_VSX) + +GEN_XX3FORM_DM(xxpermdi, 0x08, 0x01), +#undef GEN_SPE#define GEN_SPE (name0, name1, opc2, opc3, inval0, inval1, type) \ GEN_OPCODE_DUAL(name0##_##name1, 0x04, opc2, opc3, inval0, inval1, type, PPC_NONE)
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 10/32] Add lxsdx
In reply to Alexander GrafFrom: Tom Musta <[email protected]>
This patch adds the Load VSX Scalar Doubleowrd Indexed (lxsdx) instruction.
The lower 8 bytes of the target register are undefined; this implementation leaves those bytes unaltered.
--- target-ppc/translate.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
target-ppc/translate.c +16 -0
@@ -7003,6 +7003,21 @@ static inline TCGv_i64 cpu_vsrl(int n) } } +static void gen_lxsdx (DisasContext *ctx) +{ +TCGv EA ; +if (unlikely (!ctx->vsx_enabled)) { +gen_exception (ctx,POWERPC_EXCP_VSXU ); +return ; + } +gen_set_access_type (ctx,ACCESS_INT ); +EA =tcg_temp_new (); +gen_addr_reg_index (ctx,EA ); +gen_qemu_ld64 (ctx,cpu_vsrh (xT (ctx->opcode)),EA ); +/* NOTE: cpu_vsrl is undefined */ +tcg_temp_free (EA ); +} +static void gen_lxvd2x (DisasContext *ctx) {TCGv EA ;
@@ -9502,6 +9517,7 @@ GEN_VAFORM_PAIRED(vmsumshm, vmsumshs, 20),GEN_VAFORM_PAIRED (vsel, vperm,21 ),GEN_VAFORM_PAIRED (vmaddfp, vnmsubfp,23 ), +GEN_HANDLER_E (lxsdx,0x1F ,0x0C ,0x12 ,0 ,PPC_NONE ,PPC2_VSX ),GEN_HANDLER_E (lxvd2x,0x1F ,0x0C ,0x1A ,0 ,PPC_NONE ,PPC2_VSX ), GEN_HANDLER_E(stxvd2x, 0x1F, 0xC, 0x1E, 0, PPC_NONE, PPC2_VSX),
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 12/32] Add lxvw4x
In reply to Alexander GrafFrom: Tom Musta <[email protected]>
This patch adds the Load VSX Vector Word*4 Indexed (lxvw4x) instruction.
V2: changed to use deposit_i64 per Richard Henderson's review.
--- target-ppc/translate.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
target-ppc/translate.c +29 -0
@@ -7049,6 +7049,34 @@ static void gen_lxvdsx(DisasContext *ctx)tcg_temp_free (EA ); } +static void gen_lxvw4x (DisasContext *ctx) +{ +TCGv EA , tmp; +TCGv_i64 xth =cpu_vsrh (xT (ctx->opcode)); +TCGv_i64 xtl =cpu_vsrl (xT (ctx->opcode)); +if (unlikely (!ctx->vsx_enabled)) { +gen_exception (ctx,POWERPC_EXCP_VSXU ); +return ; + } +gen_set_access_type (ctx,ACCESS_INT ); +EA =tcg_temp_new (); + tmp =tcg_temp_new (); +gen_addr_reg_index (ctx,EA ); +gen_qemu_ld32u (ctx, tmp,EA ); +tcg_gen_addi_tl (EA ,EA ,4 ); +gen_qemu_ld32u (ctx, xth,EA ); +tcg_gen_deposit_i64 (xth, xth, tmp,32 ,32 ); + +tcg_gen_addi_tl (EA ,EA ,4 ); +gen_qemu_ld32u (ctx, tmp,EA ); +tcg_gen_addi_tl (EA ,EA ,4 ); +gen_qemu_ld32u (ctx, xtl,EA ); +tcg_gen_deposit_i64 (xtl, xtl, tmp,32 ,32 ); + +tcg_temp_free (EA ); +tcg_temp_free (tmp); +} +static void gen_stxvd2x (DisasContext *ctx) {TCGv EA ;
@@ -9535,6 +9563,7 @@ GEN_VAFORM_PAIRED(vmaddfp, vnmsubfp, 23),GEN_HANDLER_E (lxsdx,0x1F ,0x0C ,0x12 ,0 ,PPC_NONE ,PPC2_VSX ),GEN_HANDLER_E (lxvd2x,0x1F ,0x0C ,0x1A ,0 ,PPC_NONE ,PPC2_VSX ),GEN_HANDLER_E (lxvdsx,0x1F ,0x0C ,0x0A ,0 ,PPC_NONE ,PPC2_VSX ), +GEN_HANDLER_E (lxvw4x,0x1F ,0x0C ,0x18 ,0 ,PPC_NONE ,PPC2_VSX ), GEN_HANDLER_E(stxvd2x, 0x1F, 0xC, 0x1E, 0, PPC_NONE, PPC2_VSX),
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 13/32] Add stxsdx
In reply to Alexander GrafFrom: Tom Musta <[email protected]>
This patch adds the Store VSX Scalar Doubleword Indexed (stxsdx) instruction.
--- target-ppc/translate.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
target-ppc/translate.c +15 -0
@@ -7077,6 +7077,20 @@ static void gen_lxvw4x(DisasContext *ctx)tcg_temp_free (tmp); } +static void gen_stxsdx (DisasContext *ctx) +{ +TCGv EA ; +if (unlikely (!ctx->vsx_enabled)) { +gen_exception (ctx,POWERPC_EXCP_VSXU ); +return ; + } +gen_set_access_type (ctx,ACCESS_INT ); +EA =tcg_temp_new (); +gen_addr_reg_index (ctx,EA ); +gen_qemu_st64 (ctx,cpu_vsrh (xS (ctx->opcode)),EA ); +tcg_temp_free (EA ); +} +static void gen_stxvd2x (DisasContext *ctx) {TCGv EA ;
@@ -9565,6 +9579,7 @@ GEN_HANDLER_E(lxvd2x, 0x1F, 0x0C, 0x1A, 0, PPC_NONE, PPC2_VSX),GEN_HANDLER_E (lxvdsx,0x1F ,0x0C ,0x0A ,0 ,PPC_NONE ,PPC2_VSX ),GEN_HANDLER_E (lxvw4x,0x1F ,0x0C ,0x18 ,0 ,PPC_NONE ,PPC2_VSX ), +GEN_HANDLER_E (stxsdx,0x1F ,0xC ,0x16 ,0 ,PPC_NONE ,PPC2_VSX ),GEN_HANDLER_E (stxvd2x,0x1F ,0xC ,0x1E ,0 ,PPC_NONE ,PPC2_VSX ), #undef GEN_XX3FORM_DM
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 15/32] target-ppc: move POWER7+ to a separate family
In reply to Alexander GrafFrom: Alexey Kardashevskiy <[email protected]>
So far POWER7+ was a part of POWER7 family. However it has a different PVR base value so in order to support PVR masks, it needs a separate family class.
This adds a new family class, PVR base and mask values and moves Power7+ v2.1 CPU to a new family. The class init function is copied from the POWER7 family.
This defines a firmware name for the new family as "PowerPC,POWER7+" instead of previously used "PowerPC,POWER7" from the POWER7 family. The reason for that is that the Sapphire firmware (a h0st firmware) uses "PowerPC,POWER7+" already and since no specification defines exactly the CPU nodes naming in the device tree, we better stay in sync with the host firmware.
--- target-ppc/cpu-models.c | 2 +- target-ppc/cpu-models.h | 2 ++ target-ppc/translate_init.c | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-)
target-ppc/cpu-models.c +1 -1
@@ -1140,7 +1140,7 @@ "POWER7 v2.1") POWERPC_DEF("POWER7_v2.3", CPU_POWERPC_POWER7_v23, POWER7, "POWER7 v2.3") - POWERPC_DEF("POWER7+_v2.1", CPU_POWERPC_POWER7P_v21, POWER7, + POWERPC_DEF("POWER7+_v2.1", CPU_POWERPC_POWER7P_v21, POWER7P, "POWER7+ v2.1")POWERPC_DEF ("POWER8_v1.0" , CPU_POWERPC_POWER8_v10,POWER8 ,"POWER8 v1.0" )
target-ppc/cpu-models.h +2 -0
@@ -558,6 +558,8 @@ enum { CPU_POWERPC_POWER7_v20 =0x003F0200 , CPU_POWERPC_POWER7_v21 =0x003F0201 , CPU_POWERPC_POWER7_v23 =0x003F0203 , +CPU_POWERPC_POWER7P_BASE =0x004A0000 , +CPU_POWERPC_POWER7P_MASK =0xFFFF0000 , CPU_POWERPC_POWER7P_v21 =0x004A0201 ,CPU_POWERPC_POWER8_BASE =0x004B0000 , CPU_POWERPC_POWER8_MASK = 0xFFFF0000,
target-ppc/translate_init.c +38 -0
@@ -7253,6 +7253,44 @@ POWERPC_FAMILY(POWER7)(ObjectClass *oc, void *data) pcc->l1_icache_size =0x8000 ; } +POWERPC_FAMILY (POWER7P )(ObjectClass *oc,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (oc); +PowerPCCPUClass *pcc =POWERPC_CPU_CLASS (oc); + + dc->fw_name ="PowerPC,POWER7+" ; + dc->desc ="POWER7+" ; + pcc->pvr =CPU_POWERPC_POWER7P_BASE ; + pcc->pvr_mask =CPU_POWERPC_POWER7P_MASK ; + pcc->init_proc = init_proc_POWER7; + pcc->check_pow = check_pow_nocheck; + pcc->insns_flags =PPC_INSNS_BASE |PPC_ISEL |PPC_STRING |PPC_MFTB | +PPC_FLOAT |PPC_FLOAT_FSEL |PPC_FLOAT_FRES | +PPC_FLOAT_FSQRT |PPC_FLOAT_FRSQRTE | +PPC_FLOAT_STFIWX | +PPC_CACHE |PPC_CACHE_ICBI |PPC_CACHE_DCBZ | +PPC_MEM_SYNC |PPC_MEM_EIEIO | +PPC_MEM_TLBIE |PPC_MEM_TLBSYNC | +PPC_64B |PPC_ALTIVEC | +PPC_SEGMENT_64B |PPC_SLBI | +PPC_POPCNTB |PPC_POPCNTWD ; + pcc->insns_flags2 =PPC2_VSX |PPC2_DFP |PPC2_DBRX |PPC2_ISA205 ; + pcc->msr_mask =0x800000000204FF37ULL ; + pcc->mmu_model =POWERPC_MMU_2_06 ; +#if defined(CONFIG_SOFTMMU ) + pcc->handle_mmu_fault = ppc_hash64_handle_mmu_fault; +#endif + pcc->excp_model =POWERPC_EXCP_POWER7 ; + pcc->bus_model =PPC_FLAGS_INPUT_POWER7 ; + pcc->bfd_mach = bfd_mach_ppc64; + pcc->flags =POWERPC_FLAG_VRE |POWERPC_FLAG_SE | +POWERPC_FLAG_BE |POWERPC_FLAG_PMM | +POWERPC_FLAG_BUS_CLK |POWERPC_FLAG_CFAR | +POWERPC_FLAG_VSX ; + pcc->l1_dcache_size =0x8000 ; + pcc->l1_icache_size =0x8000 ; +} +POWERPC_FAMILY (POWER8 )(ObjectClass *oc,void *data) {DeviceClass *dc =DEVICE_CLASS (oc);
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 17/32] spapr-rtas: add ibm, (get|set)-system-parameter
In reply to Alexander GrafFrom: Alexey Kardashevskiy <[email protected]>
This adds very basic handlers for ibm,get-system-parameter and ibm,set-system-parameter RTAS calls.
The only parameter handled at the moment is "platform-processor-diagnostics-run-mode" which is always disabled and does not support changing. This is expected to make "ppc64_cpu --run-mode=1" happy.
--- hw/ppc/spapr_rtas.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ include/hw/ppc/spapr.h | 2 ++ 2 files changed, 49 insertions(+)
hw/ppc/spapr_rtas.c +47 -0
@@ -224,6 +224,49 @@ static void rtas_stop_self(PowerPCCPU *cpu, sPAPREnvironment *spapr, env->msr =0 ; } +#define DIAGNOSTICS_RUN_MODE 42 + +static void rtas_ibm_get_system_parameter (PowerPCCPU *cpu, +sPAPREnvironment *spapr, +uint32_t token,uint32_t nargs, +target_ulong args, +uint32_t nret,target_ulong rets) +{ +target_ulong parameter =rtas_ld (args,0 ); +target_ulong buffer =rtas_ld (args,1 ); +target_ulong length =rtas_ld (args,2 ); +target_ulong ret =RTAS_OUT_NOT_SUPPORTED ; + +switch (parameter) { +case DIAGNOSTICS_RUN_MODE : +if (length ==1 ) { +rtas_st (buffer,0 ,0 ); + ret =RTAS_OUT_SUCCESS ; + } +break ; + } + +rtas_st (rets,0 , ret); +} + +static void rtas_ibm_set_system_parameter (PowerPCCPU *cpu, +sPAPREnvironment *spapr, +uint32_t token,uint32_t nargs, +target_ulong args, +uint32_t nret,target_ulong rets) +{ +target_ulong parameter =rtas_ld (args,0 ); +target_ulong ret =RTAS_OUT_NOT_SUPPORTED ; + +switch (parameter) { +case DIAGNOSTICS_RUN_MODE : + ret =RTAS_OUT_NOT_AUTHORIZED ; +break ; + } + +rtas_st (rets,0 , ret); +} + static struct rtas_call { const char *name; spapr_rtas_fn fn;
@@ -345,6 +388,10 @@ static void core_rtas_register_types(void) rtas_query_cpu_stopped_state);spapr_rtas_register ("start-cpu" , rtas_start_cpu);spapr_rtas_register ("stop-self" , rtas_stop_self); +spapr_rtas_register ("ibm,get-system-parameter" , + rtas_ibm_get_system_parameter); +spapr_rtas_register ("ibm,set-system-parameter" , + rtas_ibm_set_system_parameter); }type_init (core_rtas_register_types)
include/hw/ppc/spapr.h +2 -0
@@ -338,6 +338,8 @@ static inline int spapr_allocate_lsi(int hint)#define RTAS_OUT_HW_ERROR -1#define RTAS_OUT_BUSY -2#define RTAS_OUT_PARAM_ERROR -3 +#define RTAS_OUT_NOT_SUPPORTED -3 +#define RTAS_OUT_NOT_AUTHORIZED -9002static inline uint64_t ppc64_phys_to_real (uint64_t addr) {
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 19/32] spapr: tie spapr-nvram to -pflash
In reply to Alexander GrafFrom: Paolo Bonzini <[email protected]>
spapr-nvram's drive property is currently connected to a non-existent "-machine nvram=<drivename>" option. Instead, tie it to -pflash like other non-volatile RAM devices. This provides the following possibilities for adding a backend for the sPAPR non-volatile RAM:
* -pflash filename
* -drive if=pflash,file=filename,format=raw,...
* -drive if=none,file=filename,format=raw,id=foo,... -global spapr-nvram.drive=foo
--- hw/ppc/spapr.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
hw/ppc/spapr.c +3 -11
@@ -739,18 +739,10 @@ static void spapr_cpu_reset(void *opaque)static void spapr_create_nvram (sPAPREnvironment *spapr) {DeviceState *dev =qdev_create (&spapr->vio_bus->bus,"spapr-nvram" ); -const char *drivename =qemu_opt_get (qemu_get_machine_opts (),"nvram" ); +DriveInfo *dinfo =drive_get (IF_PFLASH ,0 ,0 ); -if (drivename) { -BlockDriverState *bs; - - bs =bdrv_find (drivename); -if (!bs) { -fprintf (stderr,"No such block device \"%s\" for nvram\n" , - drivename); -exit (1 ); - } -qdev_prop_set_drive_nofail (dev,"drive" , bs); +if (dinfo) { +qdev_prop_set_drive_nofail (dev,"drive" , dinfo->bdrv); }qdev_init_nofail (dev);
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 23/32] Add Power7 VSX Logical Instructions
In reply to Alexander GrafFrom: Tom Musta <[email protected]>
This patch adds the VSX logical instructions that are defined by the Version 2.06 Power ISA (aka Power7):
- xxland
- xxlandc
- xxlor
- xxlxor
- xxlnor
--- target-ppc/translate.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
target-ppc/translate.c +29 -0
@@ -7268,6 +7268,24 @@ VSX_VECTOR_MOVE(xvnegsp, OP_NEG, SGN_MASK_SP) VSX_VECTOR_MOVE(xvcpsgnsp, OP_CPSGN, SGN_MASK_SP) +#define VSX_LOGICAL (name, tcg_op) \ +static void glue(gen_, name)(DisasContext * ctx) \ + { \ + if (unlikely(!ctx->vsx_enabled)) { \ + gen_exception(ctx, POWERPC_EXCP_VSXU); \ + return; \ + } \ + tcg_op(cpu_vsrh(xT(ctx->opcode)), cpu_vsrh(xA(ctx->opcode)), \ + cpu_vsrh(xB(ctx->opcode))); \ + tcg_op(cpu_vsrl(xT(ctx->opcode)), cpu_vsrl(xA(ctx->opcode)), \ + cpu_vsrl(xB(ctx->opcode))); \ + } + +VSX_LOGICAL(xxland, tcg_gen_and_tl) +VSX_LOGICAL(xxlandc, tcg_gen_andc_tl) +VSX_LOGICAL(xxlor, tcg_gen_or_tl) +VSX_LOGICAL(xxlxor, tcg_gen_xor_tl) +VSX_LOGICAL (xxlnor, tcg_gen_nor_tl)/*** SPE extension ***/ /* Register moves */
@@ -9770,6 +9788,17 @@ GEN_XX2FORM(xvabssp, 0x12, 0x19, PPC2_VSX),GEN_XX2FORM (xvnabssp,0x12 ,0x1A ,PPC2_VSX ),GEN_XX2FORM (xvnegsp,0x12 ,0x1B ,PPC2_VSX ),GEN_XX3FORM (xvcpsgnsp,0x00 ,0x1A ,PPC2_VSX ), + +#undef VSX_LOGICAL +#define VSX_LOGICAL(name, opc2, opc3, fl2) \ +GEN_XX3FORM(name, opc2, opc3, fl2) + +VSX_LOGICAL (xxland,0x8 ,0x10 ,PPC2_VSX ), +VSX_LOGICAL (xxlandc,0x8 ,0x11 ,PPC2_VSX ), +VSX_LOGICAL (xxlor,0x8 ,0x12 ,PPC2_VSX ), +VSX_LOGICAL (xxlxor,0x8 ,0x13 ,PPC2_VSX ), +VSX_LOGICAL (xxlnor,0x8 ,0x14 ,PPC2_VSX ), +GEN_XX3FORM_DM (xxpermdi,0x08 ,0x01 ), #undef GEN_SPE
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 18/32] PPC: Use default pci bus name for grackle and heathrow
In reply to Alexander GrafThere's no good reason to call our bus "pci" rather than let the default bus name take over ("pci.0").
The big downside to calling it different from anyone else is that tools that pass -device get confused. They are looking for a bus "pci.0" rather than "pci".
To make life easier for everyone, let's just drop the name override.
--- hw/pci-host/grackle.c | 2 +- hw/pci-host/uninorth.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
hw/pci-host/grackle.c +1 -1
@@ -82,7 +82,7 @@ PCIBus *pci_grackle_init(uint32_t base, qemu_irq *pic,memory_region_add_subregion (address_space_mem,0x80000000ULL , &d->pci_hole); - phb->bus = pci_register_bus(dev, "pci", + phb->bus = pci_register_bus(dev, NULL, pci_grackle_set_irq, pci_grackle_map_irq, pic,
hw/pci-host/uninorth.c +2 -2
@@ -234,7 +234,7 @@ PCIBus *pci_pmac_init(qemu_irq *pic,memory_region_add_subregion (address_space_mem,0x80000000ULL , &d->pci_hole); - h->bus = pci_register_bus(dev, "pci", + h->bus = pci_register_bus(dev, NULL, pci_unin_set_irq, pci_unin_map_irq, pic, &d->pci_mmio,
@@ -300,7 +300,7 @@ PCIBus *pci_pmac_u3_init(qemu_irq *pic,memory_region_add_subregion (address_space_mem,0x80000000ULL , &d->pci_hole); - h->bus = pci_register_bus(dev, "pci", + h->bus = pci_register_bus(dev, NULL, pci_unin_set_irq, pci_unin_map_irq, pic, &d->pci_mmio,
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 28/32] PPC: Add VSX to hflags
In reply to Alexander GrafWe generate different code depending on whether MSR_VSX is set or clear, so it needs to be part of our hflags too which indicate whether we're still in the same translation block cache bucket.
--- target-ppc/helper_regs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target-ppc/helper_regs.h +1 -1
@@ -56,7 +56,7 @@ static inline void hreg_compute_hflags(CPUPPCState *env)/* We 'forget' FE0 & FE1: we'll never generate imprecise exceptions */ hflags_mask = (1 <<MSR_VR ) | (1 <<MSR_AP ) | (1 <<MSR_SA ) | (1 <<MSR_PR ) | (1 <<MSR_FP ) | (1 <<MSR_SE ) | (1 <<MSR_BE ) | - (1 <<MSR_LE ); + (1 <<MSR_LE ) | (1 <<MSR_VSX ); hflags_mask |= (1ULL <<MSR_CM ) | (1ULL <<MSR_SF ) |MSR_HVB ;hreg_compute_mem_idx (env); env->hflags = env->msr & hflags_mask;
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 31/32] spapr: make sure RMA is in first mode of first memory node
In reply to Alexander GrafFrom: Alexey Kardashevskiy <[email protected]>
The SPAPR specification says that the RMA starts at the LPAR's logical address 0 and is the first logical memory block reported in the LPAR’s device tree.
So SLOF only maps the first block and that block needs to span the full RMA.
This makes sure that the RMA area is where SLOF expects it.
--- hw/ppc/spapr.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
hw/ppc/spapr.c +11 -6
@@ -532,9 +532,6 @@ static int spapr_populate_memory(sPAPREnvironment *spapr, void *fdt)/* memory node(s) */ node0_size = (nb_numa_nodes >1 ) ? node_mem[0 ] : ram_size; -if (spapr->rma_size > node0_size) { - spapr->rma_size = node0_size; - }/* RMA */ mem_reg_property[0 ] =0 ;
@@ -688,7 +685,8 @@ static void spapr_reset_htab(sPAPREnvironment *spapr)/* Update the RMA size if necessary */ if (spapr->vrma_adjust) { - spapr->rma_size =kvmppc_rma_size (ram_size, spapr->htab_shift); +hwaddr node0_size = (nb_numa_nodes >1 ) ? node_mem[0 ] : ram_size; + spapr->rma_size =kvmppc_rma_size (node0_size, spapr->htab_shift); } }
@@ -1105,6 +1103,7 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args)MemoryRegion *sysmem =get_system_memory ();MemoryRegion *ram =g_new (MemoryRegion,1 );hwaddr rma_alloc_size; +hwaddr node0_size = (nb_numa_nodes >1 ) ? node_mem[0 ] : ram_size;uint32_t initrd_base =0 ;long kernel_size =0 , initrd_size =0 ;long load_limit, rtas_limit, fw_size;
@@ -1126,10 +1125,10 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args)exit (1 ); } -if (rma_alloc_size && (rma_alloc_size < ram_size)) { +if (rma_alloc_size && (rma_alloc_size < node0_size)) { spapr->rma_size = rma_alloc_size; }else { - spapr->rma_size = ram_size; + spapr->rma_size = node0_size;/* With KVM, we don't actually know whether KVM supports an * unbounded RMA (PR KVM) or is limited by the hash table size
@@ -1146,6 +1145,12 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args) } } +if (spapr->rma_size > node0_size) { +fprintf (stderr,"Error: Numa node 0 has to span the RMA (%#08" HWADDR_PRIx")\n" , + spapr->rma_size); +exit (1 ); + } +/* We place the device tree and RTAS just below either the top of the RMA, * or just below 2GB, whichever is lowere, so that it can be * processed with 32-bit real mode code if necessary */
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 22/32] Add VSX Vector Move Instructions
In reply to Alexander GrafFrom: Tom Musta <[email protected]>
This patch adds the vector move instructions:
- xvabsdp - Vector Absolute Value Double-Precision
- xvnabsdp - Vector Negative Absolute Value Double-Precision
- xvnegdp - Vector Negate Double-Precision
- xvcpsgndp - Vector Copy Sign Double-Precision
- xvabssp - Vector Absolute Value Single-Precision
- xvnabssp - Vector Negative Absolute Value Single-Precision
- xvnegsp - Vector Negate Single-Precision
- xvcpsgnsp - Vector Copy Sign Single-Precision
V3: Per Paolo Bonzini's suggestion, used a temporary for the sign mask and andc.
--- target-ppc/translate.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+)
target-ppc/translate.c +71 -0
@@ -7205,6 +7205,69 @@ VSX_SCALAR_MOVE(xsnabsdp, OP_NABS, SGN_MASK_DP) VSX_SCALAR_MOVE(xsnegdp, OP_NEG, SGN_MASK_DP) VSX_SCALAR_MOVE(xscpsgndp, OP_CPSGN, SGN_MASK_DP) +#define VSX_VECTOR_MOVE (name, op, sgn_mask) \ +static void glue(gen_, name)(DisasContext * ctx) \ + { \ + TCGv_i64 xbh, xbl, sgm; \ + if (unlikely(!ctx->vsx_enabled)) { \ + gen_exception(ctx, POWERPC_EXCP_VSXU); \ + return; \ + } \ + xbh = tcg_temp_new(); \ + xbl = tcg_temp_new(); \ + sgm = tcg_temp_new(); \ + tcg_gen_mov_i64(xbh, cpu_vsrh(xB(ctx->opcode))); \ + tcg_gen_mov_i64(xbl, cpu_vsrl(xB(ctx->opcode))); \ + tcg_gen_movi_i64(sgm, sgn_mask); \ + switch (op) { \ + case OP_ABS: { \ + tcg_gen_andc_i64(xbh, xbh, sgm); \ + tcg_gen_andc_i64(xbl, xbl, sgm); \ + break; \ + } \ + case OP_NABS: { \ + tcg_gen_or_i64(xbh, xbh, sgm); \ + tcg_gen_or_i64(xbl, xbl, sgm); \ + break; \ + } \ + case OP_NEG: { \ + tcg_gen_xor_i64(xbh, xbh, sgm); \ + tcg_gen_xor_i64(xbl, xbl, sgm); \ + break; \ + } \ + case OP_CPSGN: { \ + TCGv_i64 xah = tcg_temp_new(); \ + TCGv_i64 xal = tcg_temp_new(); \ + tcg_gen_mov_i64(xah, cpu_vsrh(xA(ctx->opcode))); \ + tcg_gen_mov_i64(xal, cpu_vsrl(xA(ctx->opcode))); \ + tcg_gen_and_i64(xah, xah, sgm); \ + tcg_gen_and_i64(xal, xal, sgm); \ + tcg_gen_andc_i64(xbh, xbh, sgm); \ + tcg_gen_andc_i64(xbl, xbl, sgm); \ + tcg_gen_or_i64(xbh, xbh, xah); \ + tcg_gen_or_i64(xbl, xbl, xal); \ + tcg_temp_free(xah); \ + tcg_temp_free(xal); \ + break; \ + } \ + } \ + tcg_gen_mov_i64(cpu_vsrh(xT(ctx->opcode)), xbh); \ + tcg_gen_mov_i64(cpu_vsrl(xT(ctx->opcode)), xbl); \ + tcg_temp_free(xbh); \ + tcg_temp_free(xbl); \ + tcg_temp_free(sgm); \ + } + +VSX_VECTOR_MOVE(xvabsdp, OP_ABS, SGN_MASK_DP) +VSX_VECTOR_MOVE(xvnabsdp, OP_NABS, SGN_MASK_DP) +VSX_VECTOR_MOVE(xvnegdp, OP_NEG, SGN_MASK_DP) +VSX_VECTOR_MOVE(xvcpsgndp, OP_CPSGN, SGN_MASK_DP) +VSX_VECTOR_MOVE(xvabssp, OP_ABS, SGN_MASK_SP) +VSX_VECTOR_MOVE(xvnabssp, OP_NABS, SGN_MASK_SP) +VSX_VECTOR_MOVE(xvnegsp, OP_NEG, SGN_MASK_SP) +VSX_VECTOR_MOVE (xvcpsgnsp,OP_CPSGN ,SGN_MASK_SP ) + +/*** SPE extension ***/ /* Register moves */
@@ -9699,6 +9762,14 @@ GEN_XX2FORM(xsnabsdp, 0x12, 0x16, PPC2_VSX),GEN_XX2FORM (xsnegdp,0x12 ,0x17 ,PPC2_VSX ),GEN_XX3FORM (xscpsgndp,0x00 ,0x16 ,PPC2_VSX ), +GEN_XX2FORM (xvabsdp,0x12 ,0x1D ,PPC2_VSX ), +GEN_XX2FORM (xvnabsdp,0x12 ,0x1E ,PPC2_VSX ), +GEN_XX2FORM (xvnegdp,0x12 ,0x1F ,PPC2_VSX ), +GEN_XX3FORM (xvcpsgndp,0x00 ,0x1E ,PPC2_VSX ), +GEN_XX2FORM (xvabssp,0x12 ,0x19 ,PPC2_VSX ), +GEN_XX2FORM (xvnabssp,0x12 ,0x1A ,PPC2_VSX ), +GEN_XX2FORM (xvnegsp,0x12 ,0x1B ,PPC2_VSX ), +GEN_XX3FORM (xvcpsgnsp,0x00 ,0x1A ,PPC2_VSX ),GEN_XX3FORM_DM (xxpermdi,0x08 ,0x01 ), #undef GEN_SPE
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 26/32] Add xxspltw
In reply to Alexander GrafFrom: Tom Musta <[email protected]>
This patch adds the VSX Splat Word (xxsplatw) instruction.
This is the first instruction to use the UIM immediate field and consequently a decoder is also added.
V2: reworked implementation per Richard Henderson's comments.
--- target-ppc/translate.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
target-ppc/translate.c +31 -0
@@ -499,6 +499,7 @@ EXTRACT_HELPER_SPLIT(xA, 2, 1, 16, 5);EXTRACT_HELPER_SPLIT (xB,1 ,1 ,11 ,5 );EXTRACT_HELPER_SPLIT (xC,3 ,1 ,6 ,5 );EXTRACT_HELPER (DM ,8 ,2 ); +EXTRACT_HELPER (UIM ,16 ,2 );/*****************************************************************************/ /* PowerPC instructions table */
@@ -7358,6 +7359,35 @@ static void gen_xxsel(DisasContext * ctx)tcg_temp_free (c); } +static void gen_xxspltw (DisasContext *ctx) +{ +TCGv_i64 b, b2; +TCGv_i64 vsr = (UIM (ctx->opcode) &2 ) ? +cpu_vsrl (xB (ctx->opcode)) : +cpu_vsrh (xB (ctx->opcode)); + +if (unlikely (!ctx->vsx_enabled)) { +gen_exception (ctx,POWERPC_EXCP_VSXU ); +return ; + } + + b =tcg_temp_new (); + b2 =tcg_temp_new (); + +if (UIM (ctx->opcode) &1 ) { +tcg_gen_ext32u_i64 (b, vsr); + }else { +tcg_gen_shri_i64 (b, vsr,32 ); + } + +tcg_gen_shli_i64 (b2, b,32 ); +tcg_gen_or_i64 (cpu_vsrh (xT (ctx->opcode)), b, b2); +tcg_gen_mov_i64 (cpu_vsrl (xT (ctx->opcode)),cpu_vsrh (xT (ctx->opcode))); + +tcg_temp_free (b); +tcg_temp_free (b2); +} +/*** SPE extension ***/ /* Register moves */
@@ -9872,6 +9902,7 @@ VSX_LOGICAL(xxlxor, 0x8, 0x13, PPC2_VSX),VSX_LOGICAL (xxlnor,0x8 ,0x14 ,PPC2_VSX ),GEN_XX3FORM (xxmrghw,0x08 ,0x02 ,PPC2_VSX ),GEN_XX3FORM (xxmrglw,0x08 ,0x06 ,PPC2_VSX ), +GEN_XX2FORM (xxspltw,0x08 ,0x0A ,PPC2_VSX ), #define GEN_XXSEL_ROW(opc3) \ GEN_HANDLER2_E(xxsel, "xxsel", 0x3C, 0x18, opc3, 0, PPC_NONE, PPC2_VSX), \
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 27/32] Add xxsldwi
In reply to Alexander GrafFrom: Tom Musta <[email protected]>
This patch adds the VSX Shift Left Double by Word Immediate (xxsldwi) instruction.
--- target-ppc/translate.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+)
target-ppc/translate.c +62 -0
@@ -500,6 +500,7 @@ EXTRACT_HELPER_SPLIT(xB, 1, 1, 11, 5);EXTRACT_HELPER_SPLIT (xC,3 ,1 ,6 ,5 );EXTRACT_HELPER (DM ,8 ,2 );EXTRACT_HELPER (UIM ,16 ,2 ); +EXTRACT_HELPER (SHW ,8 ,2 );/*****************************************************************************/ /* PowerPC instructions table */
@@ -7388,6 +7389,66 @@ static void gen_xxspltw(DisasContext *ctx)tcg_temp_free (b2); } +static void gen_xxsldwi (DisasContext *ctx) +{ +TCGv_i64 xth, xtl; +if (unlikely (!ctx->vsx_enabled)) { +gen_exception (ctx,POWERPC_EXCP_VSXU ); +return ; + } + xth =tcg_temp_new (); + xtl =tcg_temp_new (); + +switch (SHW (ctx->opcode)) { +case 0 : { +tcg_gen_mov_i64 (xth,cpu_vsrh (xA (ctx->opcode))); +tcg_gen_mov_i64 (xtl,cpu_vsrl (xA (ctx->opcode))); +break ; + } +case 1 : { +TCGv_i64 t0 =tcg_temp_new (); +tcg_gen_mov_i64 (xth,cpu_vsrh (xA (ctx->opcode))); +tcg_gen_shli_i64 (xth, xth,32 ); +tcg_gen_mov_i64 (t0,cpu_vsrl (xA (ctx->opcode))); +tcg_gen_shri_i64 (t0, t0,32 ); +tcg_gen_or_i64 (xth, xth, t0); +tcg_gen_mov_i64 (xtl,cpu_vsrl (xA (ctx->opcode))); +tcg_gen_shli_i64 (xtl, xtl,32 ); +tcg_gen_mov_i64 (t0,cpu_vsrh (xB (ctx->opcode))); +tcg_gen_shri_i64 (t0, t0,32 ); +tcg_gen_or_i64 (xtl, xtl, t0); +tcg_temp_free (t0); +break ; + } +case 2 : { +tcg_gen_mov_i64 (xth,cpu_vsrl (xA (ctx->opcode))); +tcg_gen_mov_i64 (xtl,cpu_vsrh (xB (ctx->opcode))); +break ; + } +case 3 : { +TCGv_i64 t0 =tcg_temp_new (); +tcg_gen_mov_i64 (xth,cpu_vsrl (xA (ctx->opcode))); +tcg_gen_shli_i64 (xth, xth,32 ); +tcg_gen_mov_i64 (t0,cpu_vsrh (xB (ctx->opcode))); +tcg_gen_shri_i64 (t0, t0,32 ); +tcg_gen_or_i64 (xth, xth, t0); +tcg_gen_mov_i64 (xtl,cpu_vsrh (xB (ctx->opcode))); +tcg_gen_shli_i64 (xtl, xtl,32 ); +tcg_gen_mov_i64 (t0,cpu_vsrl (xB (ctx->opcode))); +tcg_gen_shri_i64 (t0, t0,32 ); +tcg_gen_or_i64 (xtl, xtl, t0); +tcg_temp_free (t0); +break ; + } + } + +tcg_gen_mov_i64 (cpu_vsrh (xT (ctx->opcode)), xth); +tcg_gen_mov_i64 (cpu_vsrl (xT (ctx->opcode)), xtl); + +tcg_temp_free (xth); +tcg_temp_free (xtl); +} +/*** SPE extension ***/ /* Register moves */
@@ -9903,6 +9964,7 @@ VSX_LOGICAL(xxlnor, 0x8, 0x14, PPC2_VSX),GEN_XX3FORM (xxmrghw,0x08 ,0x02 ,PPC2_VSX ),GEN_XX3FORM (xxmrglw,0x08 ,0x06 ,PPC2_VSX ),GEN_XX2FORM (xxspltw,0x08 ,0x0A ,PPC2_VSX ), +GEN_XX3FORM_DM (xxsldwi,0x08 ,0x00 ), #define GEN_XXSEL_ROW(opc3) \ GEN_HANDLER2_E(xxsel, "xxsel", 0x3C, 0x18, opc3, 0, PPC_NONE, PPC2_VSX), \
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 16/32] spapr-rtas: replace return code constants with macros
In reply to Alexander GrafFrom: Alexey Kardashevskiy <[email protected]>
--- hw/intc/xics.c | 24 ++++++++++++------------ hw/nvram/spapr_nvram.c | 16 ++++++++-------- hw/ppc/spapr_events.c | 6 +++--- hw/ppc/spapr_pci.c | 42 +++++++++++++++++++++--------------------- hw/ppc/spapr_rtas.c | 34 +++++++++++++++++----------------- hw/ppc/spapr_vio.c | 12 ++++++------ include/hw/ppc/spapr.h | 7 +++++++ 7 files changed, 74 insertions(+), 67 deletions(-)
hw/intc/xics.c +12 -12
@@ -723,7 +723,7 @@ static void rtas_set_xive(PowerPCCPU *cpu, sPAPREnvironment *spapr,uint32_t nr, server, priority;if ((nargs !=3 ) || (nret !=1 )) { -rtas_st (rets,0 ,-3 ); +rtas_st (rets,0 ,RTAS_OUT_PARAM_ERROR );return ; }
@@ -733,13 +733,13 @@ static void rtas_set_xive(PowerPCCPU *cpu, sPAPREnvironment *spapr,if (!ics_valid_irq (ics, nr) || (server >= ics->icp->nr_servers) || (priority >0xff )) { -rtas_st (rets,0 ,-3 ); +rtas_st (rets,0 ,RTAS_OUT_PARAM_ERROR );return ; }ics_write_xive (ics, nr, server, priority, priority); -rtas_st (rets,0 ,0 );/* Success */ +rtas_st (rets,0 ,RTAS_OUT_SUCCESS ); } static void rtas_get_xive(PowerPCCPU *cpu, sPAPREnvironment *spapr,
@@ -751,18 +751,18 @@ static void rtas_get_xive(PowerPCCPU *cpu, sPAPREnvironment *spapr,uint32_t nr;if ((nargs !=1 ) || (nret !=3 )) { -rtas_st (rets,0 ,-3 ); +rtas_st (rets,0 ,RTAS_OUT_PARAM_ERROR );return ; } nr =rtas_ld (args,0 );if (!ics_valid_irq (ics, nr)) { -rtas_st (rets,0 ,-3 ); +rtas_st (rets,0 ,RTAS_OUT_PARAM_ERROR );return ; } -rtas_st (rets,0 ,0 );/* Success */ +rtas_st (rets,0 ,RTAS_OUT_SUCCESS );rtas_st (rets,1 , ics->irqs[nr - ics->offset].server);rtas_st (rets,2 , ics->irqs[nr - ics->offset].priority); }
@@ -776,21 +776,21 @@ static void rtas_int_off(PowerPCCPU *cpu, sPAPREnvironment *spapr,uint32_t nr;if ((nargs !=1 ) || (nret !=1 )) { -rtas_st (rets,0 ,-3 ); +rtas_st (rets,0 ,RTAS_OUT_PARAM_ERROR );return ; } nr =rtas_ld (args,0 );if (!ics_valid_irq (ics, nr)) { -rtas_st (rets,0 ,-3 ); +rtas_st (rets,0 ,RTAS_OUT_PARAM_ERROR );return ; }ics_write_xive (ics, nr, ics->irqs[nr - ics->offset].server,0xff , ics->irqs[nr - ics->offset].priority); -rtas_st (rets,0 ,0 );/* Success */ +rtas_st (rets,0 ,RTAS_OUT_SUCCESS ); } static void rtas_int_on(PowerPCCPU *cpu, sPAPREnvironment *spapr,
@@ -802,14 +802,14 @@ static void rtas_int_on(PowerPCCPU *cpu, sPAPREnvironment *spapr,uint32_t nr;if ((nargs !=1 ) || (nret !=1 )) { -rtas_st (rets,0 ,-3 ); +rtas_st (rets,0 ,RTAS_OUT_PARAM_ERROR );return ; } nr =rtas_ld (args,0 );if (!ics_valid_irq (ics, nr)) { -rtas_st (rets,0 ,-3 ); +rtas_st (rets,0 ,RTAS_OUT_PARAM_ERROR );return ; }
@@ -817,7 +817,7 @@ static void rtas_int_on(PowerPCCPU *cpu, sPAPREnvironment *spapr, ics->irqs[nr - ics->offset].saved_priority, ics->irqs[nr - ics->offset].saved_priority); -rtas_st (rets,0 ,0 );/* Success */ +rtas_st (rets,0 ,RTAS_OUT_SUCCESS ); }/*
hw/nvram/spapr_nvram.c +8 -8
@@ -55,12 +55,12 @@ static void rtas_nvram_fetch(PowerPCCPU *cpu, sPAPREnvironment *spapr,void *membuf;if ((nargs !=3 ) || (nret !=2 )) { -rtas_st (rets,0 ,-3 ); +rtas_st (rets,0 ,RTAS_OUT_PARAM_ERROR );return ; }if (!nvram) { -rtas_st (rets,0 ,-1 ); +rtas_st (rets,0 ,RTAS_OUT_HW_ERROR );rtas_st (rets,1 ,0 );return ; }
@@ -71,7 +71,7 @@ static void rtas_nvram_fetch(PowerPCCPU *cpu, sPAPREnvironment *spapr,if (((offset + len) < offset) || ((offset + len) > nvram->size)) { -rtas_st (rets,0 ,-3 ); +rtas_st (rets,0 ,RTAS_OUT_PARAM_ERROR );rtas_st (rets,1 ,0 );return ; }
@@ -87,7 +87,7 @@ static void rtas_nvram_fetch(PowerPCCPU *cpu, sPAPREnvironment *spapr, }cpu_physical_memory_unmap (membuf, len,1 , len); -rtas_st (rets,0 , (alen < len) ?-1 :0 ); +rtas_st (rets,0 , (alen < len) ?RTAS_OUT_HW_ERROR :RTAS_OUT_SUCCESS );rtas_st (rets,1 , (alen <0 ) ?0 : alen); }
@@ -102,12 +102,12 @@ static void rtas_nvram_store(PowerPCCPU *cpu, sPAPREnvironment *spapr,void *membuf;if ((nargs !=3 ) || (nret !=2 )) { -rtas_st (rets,0 ,-3 ); +rtas_st (rets,0 ,RTAS_OUT_PARAM_ERROR );return ; }if (!nvram) { -rtas_st (rets,0 ,-1 ); +rtas_st (rets,0 ,RTAS_OUT_HW_ERROR );return ; }
@@ -117,7 +117,7 @@ static void rtas_nvram_store(PowerPCCPU *cpu, sPAPREnvironment *spapr,if (((offset + len) < offset) || ((offset + len) > nvram->size)) { -rtas_st (rets,0 ,-3 ); +rtas_st (rets,0 ,RTAS_OUT_PARAM_ERROR );return ; }
@@ -132,7 +132,7 @@ static void rtas_nvram_store(PowerPCCPU *cpu, sPAPREnvironment *spapr, }cpu_physical_memory_unmap (membuf, len,0 , len); -rtas_st (rets,0 , (alen < len) ?-1 :0 ); +rtas_st (rets,0 , (alen < len) ?RTAS_OUT_HW_ERROR :RTAS_OUT_SUCCESS );rtas_st (rets,1 , (alen <0 ) ?0 : alen); }
hw/ppc/spapr_events.c +3 -3
@@ -286,7 +286,7 @@ static void check_exception(PowerPCCPU *cpu, sPAPREnvironment *spapr,uint64_t xinfo;if ((nargs <6 ) || (nargs >7 ) || nret !=1 ) { -rtas_st (rets,0 ,-3 ); +rtas_st (rets,0 ,RTAS_OUT_PARAM_ERROR );return ; }
@@ -306,9 +306,9 @@ static void check_exception(PowerPCCPU *cpu, sPAPREnvironment *spapr,cpu_physical_memory_write (buf, pending_epow, len);g_free (pending_epow); pending_epow =NULL ; -rtas_st (rets,0 ,0 ); +rtas_st (rets,0 ,RTAS_OUT_SUCCESS ); }else { -rtas_st (rets,0 ,1 ); +rtas_st (rets,0 ,RTAS_OUT_NO_ERRORS_FOUND ); } }
hw/ppc/spapr_pci.c +21 -21
165 lines not on this page · raw message
hw/ppc/spapr_rtas.c +17 -17
@@ -47,10 +47,10 @@ static void rtas_display_character(PowerPCCPU *cpu, sPAPREnvironment *spapr,VIOsPAPRDevice *sdev =vty_lookup (spapr,0 );if (!sdev) { -rtas_st (rets,0 ,-1 ); +rtas_st (rets,0 ,RTAS_OUT_HW_ERROR ); }else {vty_putchars (sdev, &c,sizeof (c)); -rtas_st (rets,0 ,0 ); +rtas_st (rets,0 ,RTAS_OUT_SUCCESS ); } }
@@ -62,13 +62,13 @@ static void rtas_get_time_of_day(PowerPCCPU *cpu, sPAPREnvironment *spapr,struct tm tm;if (nret !=8 ) { -rtas_st (rets,0 ,-3 ); +rtas_st (rets,0 ,RTAS_OUT_PARAM_ERROR );return ; }qemu_get_timedate (&tm, spapr->rtc_offset); -rtas_st (rets,0 ,0 );/* Success */ +rtas_st (rets,0 ,RTAS_OUT_SUCCESS );rtas_st (rets,1 , tm.tm_year +1900 );rtas_st (rets,2 , tm.tm_mon +1 );rtas_st (rets,3 , tm.tm_mday);
@@ -96,7 +96,7 @@ static void rtas_set_time_of_day(PowerPCCPU *cpu, sPAPREnvironment *spapr,rtc_change_mon_event (&tm); spapr->rtc_offset =qemu_timedate_diff (&tm); -rtas_st (rets,0 ,0 );/* Success */ +rtas_st (rets,0 ,RTAS_OUT_SUCCESS ); } static void rtas_power_off(PowerPCCPU *cpu, sPAPREnvironment *spapr,
@@ -104,11 +104,11 @@ static void rtas_power_off(PowerPCCPU *cpu, sPAPREnvironment *spapr, uint32_t nret, target_ulong rets) {if (nargs !=2 || nret !=1 ) { -rtas_st (rets,0 ,-3 ); +rtas_st (rets,0 ,RTAS_OUT_PARAM_ERROR );return ; }qemu_system_shutdown_request (); -rtas_st (rets,0 ,0 ); +rtas_st (rets,0 ,RTAS_OUT_SUCCESS ); } static void rtas_system_reboot(PowerPCCPU *cpu, sPAPREnvironment *spapr,
@@ -117,11 +117,11 @@ static void rtas_system_reboot(PowerPCCPU *cpu, sPAPREnvironment *spapr, uint32_t nret, target_ulong rets) {if (nargs !=0 || nret !=1 ) { -rtas_st (rets,0 ,-3 ); +rtas_st (rets,0 ,RTAS_OUT_PARAM_ERROR );return ; }qemu_system_reset_request (); -rtas_st (rets,0 ,0 ); +rtas_st (rets,0 ,RTAS_OUT_SUCCESS ); } static void rtas_query_cpu_stopped_state(PowerPCCPU *cpu_,
@@ -134,7 +134,7 @@ static void rtas_query_cpu_stopped_state(PowerPCCPU *cpu_,CPUState *cpu;if (nargs !=1 || nret !=2 ) { -rtas_st (rets,0 ,-3 ); +rtas_st (rets,0 ,RTAS_OUT_PARAM_ERROR );return ; }
@@ -147,12 +147,12 @@ static void rtas_query_cpu_stopped_state(PowerPCCPU *cpu_,rtas_st (rets,1 ,2 ); } -rtas_st (rets,0 ,0 ); +rtas_st (rets,0 ,RTAS_OUT_SUCCESS );return ; }/* Didn't find a matching cpu */ -rtas_st (rets,0 ,-3 ); +rtas_st (rets,0 ,RTAS_OUT_PARAM_ERROR ); } static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPREnvironment *spapr,
@@ -164,7 +164,7 @@ static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPREnvironment *spapr,CPUState *cs;if (nargs !=3 || nret !=1 ) { -rtas_st (rets,0 ,-3 ); +rtas_st (rets,0 ,RTAS_OUT_PARAM_ERROR );return ; }
@@ -178,7 +178,7 @@ static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPREnvironment *spapr,CPUPPCState *env = &cpu->env;if (!cs->halted) { -rtas_st (rets,0 ,-1 ); +rtas_st (rets,0 ,RTAS_OUT_HW_ERROR );return ; }
@@ -194,12 +194,12 @@ static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPREnvironment *spapr,qemu_cpu_kick (cs); -rtas_st (rets,0 ,0 ); +rtas_st (rets,0 ,RTAS_OUT_SUCCESS );return ; }/* Didn't find a matching cpu */ -rtas_st (rets,0 ,-3 ); +rtas_st (rets,0 ,RTAS_OUT_PARAM_ERROR ); } static void rtas_stop_self(PowerPCCPU *cpu, sPAPREnvironment *spapr,
@@ -255,7 +255,7 @@ target_ulong spapr_rtas_call(PowerPCCPU *cpu, sPAPREnvironment *spapr, }hcall_dprintf ("Unknown RTAS token 0x%x\n" , token); -rtas_st (rets,0 ,-3 ); +rtas_st (rets,0 ,RTAS_OUT_PARAM_ERROR );return H_PARAMETER ; }
hw/ppc/spapr_vio.c +6 -6
@@ -331,25 +331,25 @@ static void rtas_set_tce_bypass(PowerPCCPU *cpu, sPAPREnvironment *spapr,uint32_t unit, enable;if (nargs !=2 ) { -rtas_st (rets,0 ,-3 ); +rtas_st (rets,0 ,RTAS_OUT_PARAM_ERROR );return ; } unit =rtas_ld (args,0 ); enable =rtas_ld (args,1 ); dev =spapr_vio_find_by_reg (bus, unit);if (!dev) { -rtas_st (rets,0 ,-3 ); +rtas_st (rets,0 ,RTAS_OUT_PARAM_ERROR );return ; }if (!dev->tcet) { -rtas_st (rets,0 ,-3 ); +rtas_st (rets,0 ,RTAS_OUT_PARAM_ERROR );return ; }spapr_tce_set_bypass (dev->tcet, !!enable); -rtas_st (rets,0 ,0 ); +rtas_st (rets,0 ,RTAS_OUT_SUCCESS ); } static void rtas_quiesce(PowerPCCPU *cpu, sPAPREnvironment *spapr,
@@ -362,7 +362,7 @@ static void rtas_quiesce(PowerPCCPU *cpu, sPAPREnvironment *spapr,VIOsPAPRDevice *dev =NULL ;if (nargs !=0 ) { -rtas_st (rets,0 ,-3 ); +rtas_st (rets,0 ,RTAS_OUT_PARAM_ERROR );return ; }
@@ -371,7 +371,7 @@ static void rtas_quiesce(PowerPCCPU *cpu, sPAPREnvironment *spapr,spapr_vio_quiesce_one (dev); } -rtas_st (rets,0 ,0 ); +rtas_st (rets,0 ,RTAS_OUT_SUCCESS ); }static VIOsPAPRDevice *reg_conflict (VIOsPAPRDevice *dev)
include/hw/ppc/spapr.h +7 -0
@@ -332,6 +332,13 @@ static inline int spapr_allocate_lsi(int hint)return spapr_allocate_irq (hint, true); } +/* RTAS return codes */ +#define RTAS_OUT_SUCCESS 0 +#define RTAS_OUT_NO_ERRORS_FOUND 1 +#define RTAS_OUT_HW_ERROR -1 +#define RTAS_OUT_BUSY -2 +#define RTAS_OUT_PARAM_ERROR -3 +static inline uint64_t ppc64_phys_to_real (uint64_t addr) {return addr & ~0xF000000000000000ULL ;
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 29/32] device_tree: s/qemu_devtree/qemu_fdt globally
In reply to Alexander GrafFrom: Peter Crosthwaite <[email protected]>
The qemu_devtree API is a wrapper around the fdt_ set of APIs. Rename accordingly.
--- device_tree.c | 62 ++++++------- hw/arm/boot.c | 24 ++--- hw/arm/vexpress.c | 18 ++-- hw/arm/virt.c | 106 ++++++++++----------- hw/microblaze/boot.c | 12 +-- hw/ppc/e500.c | 213 ++++++++++++++++++++++--------------------- hw/ppc/e500plat.c | 6 +- hw/ppc/mpc8544ds.c | 6 +- hw/ppc/ppc440_bamboo.c | 24 ++--- hw/ppc/spapr_rtas.c | 16 ++-- hw/ppc/virtex_ml507.c | 2 +- include/sysemu/device_tree.h | 80 ++++++++-------- 12 files changed, 285 insertions(+), 284 deletions(-)
device_tree.c +31 -31
@@ -131,8 +131,8 @@ static int findnode_nofail(void *fdt, const char *node_path)return offset; } -int qemu_devtree_setprop (void *fdt,const char *node_path, -const char *property,const void *val_array,int size) +int qemu_fdt_setprop (void *fdt,const char *node_path, +const char *property,const void *val_array,int size) {int r;
@@ -146,8 +146,8 @@ int qemu_devtree_setprop(void *fdt, const char *node_path,return r; } -int qemu_devtree_setprop_cell (void *fdt,const char *node_path, -const char *property,uint32_t val) +int qemu_fdt_setprop_cell (void *fdt,const char *node_path, +const char *property,uint32_t val) {int r;
@@ -161,15 +161,15 @@ int qemu_devtree_setprop_cell(void *fdt, const char *node_path,return r; } -int qemu_devtree_setprop_u64 (void *fdt,const char *node_path, -const char *property,uint64_t val) +int qemu_fdt_setprop_u64 (void *fdt,const char *node_path, +const char *property,uint64_t val) { val =cpu_to_be64 (val); -return qemu_devtree_setprop (fdt, node_path, property, &val,sizeof (val)); +return qemu_fdt_setprop (fdt, node_path, property, &val,sizeof (val)); } -int qemu_devtree_setprop_string (void *fdt,const char *node_path, -const char *property,const char *string) +int qemu_fdt_setprop_string (void *fdt,const char *node_path, +const char *property,const char *string) {int r;
@@ -183,8 +183,8 @@ int qemu_devtree_setprop_string(void *fdt, const char *node_path,return r; } -const void *qemu_devtree_getprop (void *fdt,const char *node_path, -const char *property,int *lenp) +const void *qemu_fdt_getprop (void *fdt,const char *node_path, +const char *property,int *lenp) {int len;const void *r;
@@ -200,11 +200,11 @@ const void *qemu_devtree_getprop(void *fdt, const char *node_path,return r; } -uint32_t qemu_devtree_getprop_cell (void *fdt,const char *node_path, -const char *property) +uint32_t qemu_fdt_getprop_cell (void *fdt,const char *node_path, +const char *property) {int len; -const uint32_t *p =qemu_devtree_getprop (fdt, node_path, property, &len); +const uint32_t *p =qemu_fdt_getprop (fdt, node_path, property, &len);if (len !=4 ) {fprintf (stderr,"%s: %s/%s not 4 bytes long (not a cell?)\n" , __func__, node_path, property);
@@ -213,7 +213,7 @@ uint32_t qemu_devtree_getprop_cell(void *fdt, const char *node_path,return be32_to_cpu (*p); } -uint32_t qemu_devtree_get_phandle (void *fdt,const char *path) +uint32_t qemu_fdt_get_phandle (void *fdt,const char *path) {uint32_t r;
@@ -227,15 +227,15 @@ uint32_t qemu_devtree_get_phandle(void *fdt, const char *path)return r; } -int qemu_devtree_setprop_phandle (void *fdt,const char *node_path, -const char *property, -const char *target_node_path) +int qemu_fdt_setprop_phandle (void *fdt,const char *node_path, +const char *property, +const char *target_node_path) { -uint32_t phandle =qemu_devtree_get_phandle (fdt, target_node_path); -return qemu_devtree_setprop_cell (fdt, node_path, property, phandle); +uint32_t phandle =qemu_fdt_get_phandle (fdt, target_node_path); +return qemu_fdt_setprop_cell (fdt, node_path, property, phandle); } -uint32_t qemu_devtree_alloc_phandle (void *fdt) +uint32_t qemu_fdt_alloc_phandle (void *fdt) {static int phandle =0x0 ;
@@ -259,7 +259,7 @@ uint32_t qemu_devtree_alloc_phandle(void *fdt)return phandle++; } -int qemu_devtree_nop_node (void *fdt,const char *node_path) +int qemu_fdt_nop_node (void *fdt,const char *node_path) {int r;
@@ -273,7 +273,7 @@ int qemu_devtree_nop_node(void *fdt, const char *node_path)return r; } -int qemu_devtree_add_subnode (void *fdt,const char *name) +int qemu_fdt_add_subnode (void *fdt,const char *name) {char *dupname =g_strdup (name);char *basename =strrchr (dupname,'/' );
@@ -303,7 +303,7 @@ int qemu_devtree_add_subnode(void *fdt, const char *name)return retval; } -void qemu_devtree_dumpdtb (void *fdt,int size) +void qemu_fdt_dumpdtb (void *fdt,int size) {const char *dumpdtb =qemu_opt_get (qemu_get_machine_opts (),"dumpdtb" );
@@ -313,11 +313,11 @@ void qemu_devtree_dumpdtb(void *fdt, int size) } } -int qemu_devtree_setprop_sized_cells_from_array (void *fdt, -const char *node_path, -const char *property, -int numvalues, -uint64_t *values) +int qemu_fdt_setprop_sized_cells_from_array (void *fdt, +const char *node_path, +const char *property, +int numvalues, +uint64_t *values) {uint32_t *propcells;uint64_t value;
@@ -342,6 +342,6 @@ int qemu_devtree_setprop_sized_cells_from_array(void *fdt, propcells[cellnum++] =cpu_to_be32 (value); } -return qemu_devtree_setprop (fdt, node_path, property, propcells, - cellnum *sizeof (uint32_t )); +return qemu_fdt_setprop (fdt, node_path, property, propcells, + cellnum *sizeof (uint32_t )); }
hw/arm/boot.c +12 -12
@@ -335,8 +335,8 @@ static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo) } } - acells =qemu_devtree_getprop_cell (fdt,"/" ,"#address-cells" ); - scells =qemu_devtree_getprop_cell (fdt,"/" ,"#size-cells" ); + acells =qemu_fdt_getprop_cell (fdt,"/" ,"#address-cells" ); + scells =qemu_fdt_getprop_cell (fdt,"/" ,"#size-cells" );if (acells ==0 || scells ==0 ) {fprintf (stderr,"dtb file invalid (#address-cells or #size-cells 0)\n" ); goto fail;
@@ -351,17 +351,17 @@ static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo) goto fail; } - rc =qemu_devtree_setprop_sized_cells (fdt,"/memory" ,"reg" , - acells, binfo->loader_start, - scells, binfo->ram_size); + rc =qemu_fdt_setprop_sized_cells (fdt,"/memory" ,"reg" , + acells, binfo->loader_start, + scells, binfo->ram_size);if (rc <0 ) {fprintf (stderr,"couldn't set /memory/reg\n" ); goto fail; }if (binfo->kernel_cmdline && *binfo->kernel_cmdline) { - rc =qemu_devtree_setprop_string (fdt,"/chosen" ,"bootargs" , - binfo->kernel_cmdline); + rc =qemu_fdt_setprop_string (fdt,"/chosen" ,"bootargs" , + binfo->kernel_cmdline);if (rc <0 ) {fprintf (stderr,"couldn't set /chosen/bootargs\n" ); goto fail;
@@ -369,15 +369,15 @@ static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo) }if (binfo->initrd_size) { - rc =qemu_devtree_setprop_cell (fdt,"/chosen" ,"linux,initrd-start" , - binfo->initrd_start); + rc =qemu_fdt_setprop_cell (fdt,"/chosen" ,"linux,initrd-start" , + binfo->initrd_start);if (rc <0 ) {fprintf (stderr,"couldn't set /chosen/linux,initrd-start\n" ); goto fail; } - rc =qemu_devtree_setprop_cell (fdt,"/chosen" ,"linux,initrd-end" , - binfo->initrd_start + binfo->initrd_size); + rc =qemu_fdt_setprop_cell (fdt,"/chosen" ,"linux,initrd-end" , + binfo->initrd_start + binfo->initrd_size);if (rc <0 ) {fprintf (stderr,"couldn't set /chosen/linux,initrd-end\n" ); goto fail;
@@ -388,7 +388,7 @@ static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo) binfo->modify_dtb (binfo, fdt); } -qemu_devtree_dumpdtb (fdt, size); +qemu_fdt_dumpdtb (fdt, size);cpu_physical_memory_write (addr, fdt, size);
hw/arm/vexpress.c +9 -9
@@ -419,13 +419,13 @@ static int add_virtio_mmio_node(void *fdt, uint32_t acells, uint32_t scells,int rc;char *nodename =g_strdup_printf ("/virtio_mmio@%" PRIx64, addr); - rc =qemu_devtree_add_subnode (fdt, nodename); - rc |=qemu_devtree_setprop_string (fdt, nodename, -"compatible" ,"virtio,mmio" ); - rc |=qemu_devtree_setprop_sized_cells (fdt, nodename,"reg" , - acells, addr, scells, size); -qemu_devtree_setprop_cells (fdt, nodename,"interrupt-parent" , intc); -qemu_devtree_setprop_cells (fdt, nodename,"interrupts" ,0 , irq,1 ); + rc =qemu_fdt_add_subnode (fdt, nodename); + rc |=qemu_fdt_setprop_string (fdt, nodename, +"compatible" ,"virtio,mmio" ); + rc |=qemu_fdt_setprop_sized_cells (fdt, nodename,"reg" , + acells, addr, scells, size); +qemu_fdt_setprop_cells (fdt, nodename,"interrupt-parent" , intc); +qemu_fdt_setprop_cells (fdt, nodename,"interrupts" ,0 , irq,1 );g_free (nodename);if (rc) {return -1 ;
@@ -456,8 +456,8 @@ static void vexpress_modify_dtb(const struct arm_boot_info *info, void *fdt)uint32_t acells, scells, intc;const VEDBoardInfo *daughterboard = (const VEDBoardInfo *)info; - acells =qemu_devtree_getprop_cell (fdt,"/" ,"#address-cells" ); - scells =qemu_devtree_getprop_cell (fdt,"/" ,"#size-cells" ); + acells =qemu_fdt_getprop_cell (fdt,"/" ,"#address-cells" ); + scells =qemu_fdt_getprop_cell (fdt,"/" ,"#size-cells" ); intc =find_int_controller (fdt);if (!intc) {/* Not fatal, we just won't provide virtio. This will
hw/arm/virt.c +53 -53
182 lines not on this page · raw message
hw/microblaze/boot.c +6 -6
@@ -79,19 +79,19 @@ static int microblaze_load_dtb(hwaddr addr, }if (kernel_cmdline) { - r =qemu_devtree_setprop_string (fdt,"/chosen" ,"bootargs" , - kernel_cmdline); + r =qemu_fdt_setprop_string (fdt,"/chosen" ,"bootargs" , + kernel_cmdline);if (r <0 ) {fprintf (stderr,"couldn't set /chosen/bootargs\n" ); } }if (initrd_start) { -qemu_devtree_setprop_cell (fdt,"/chosen" ,"linux,initrd-start" , - initrd_start); +qemu_fdt_setprop_cell (fdt,"/chosen" ,"linux,initrd-start" , + initrd_start); -qemu_devtree_setprop_cell (fdt,"/chosen" ,"linux,initrd-end" , - initrd_end); +qemu_fdt_setprop_cell (fdt,"/chosen" ,"linux,initrd-end" , + initrd_end); }cpu_physical_memory_write (addr, fdt, fdt_size);
hw/ppc/e500.c +107 -106
297 lines not on this page · raw message
hw/ppc/e500plat.c +3 -3
@@ -23,9 +23,9 @@ static void e500plat_fixup_devtree(PPCE500Params *params, void *fdt)const char model[] ="QEMU ppce500" ;const char compatible[] ="fsl,qemu-e500" ; -qemu_devtree_setprop (fdt,"/" ,"model" , model,sizeof (model)); -qemu_devtree_setprop (fdt,"/" ,"compatible" , compatible, -sizeof (compatible)); +qemu_fdt_setprop (fdt,"/" ,"model" , model,sizeof (model)); +qemu_fdt_setprop (fdt,"/" ,"compatible" , compatible, +sizeof (compatible)); }static void e500plat_init (QEMUMachineInitArgs *args)
hw/ppc/mpc8544ds.c +3 -3
@@ -21,9 +21,9 @@ static void mpc8544ds_fixup_devtree(PPCE500Params *params, void *fdt)const char model[] ="MPC8544DS" ;const char compatible[] ="MPC8544DS\0MPC85xxDS" ; -qemu_devtree_setprop (fdt,"/" ,"model" , model,sizeof (model)); -qemu_devtree_setprop (fdt,"/" ,"compatible" , compatible, -sizeof (compatible)); +qemu_fdt_setprop (fdt,"/" ,"model" , model,sizeof (model)); +qemu_fdt_setprop (fdt,"/" ,"compatible" , compatible, +sizeof (compatible)); }static void mpc8544ds_init (QEMUMachineInitArgs *args)
hw/ppc/ppc440_bamboo.c +12 -12
@@ -77,23 +77,23 @@ static int bamboo_load_device_tree(hwaddr addr,/* Manipulate device tree in memory. */ - ret =qemu_devtree_setprop (fdt,"/memory" ,"reg" , mem_reg_property, -sizeof (mem_reg_property)); + ret =qemu_fdt_setprop (fdt,"/memory" ,"reg" , mem_reg_property, +sizeof (mem_reg_property));if (ret <0 )fprintf (stderr,"couldn't set /memory/reg\n" ); - ret =qemu_devtree_setprop_cell (fdt,"/chosen" ,"linux,initrd-start" , - initrd_base); + ret =qemu_fdt_setprop_cell (fdt,"/chosen" ,"linux,initrd-start" , + initrd_base);if (ret <0 )fprintf (stderr,"couldn't set /chosen/linux,initrd-start\n" ); - ret =qemu_devtree_setprop_cell (fdt,"/chosen" ,"linux,initrd-end" , - (initrd_base + initrd_size)); + ret =qemu_fdt_setprop_cell (fdt,"/chosen" ,"linux,initrd-end" , + (initrd_base + initrd_size));if (ret <0 )fprintf (stderr,"couldn't set /chosen/linux,initrd-end\n" ); - ret =qemu_devtree_setprop_string (fdt,"/chosen" ,"bootargs" , - kernel_cmdline); + ret =qemu_fdt_setprop_string (fdt,"/chosen" ,"bootargs" , + kernel_cmdline);if (ret <0 )fprintf (stderr,"couldn't set /chosen/bootargs\n" );
@@ -105,10 +105,10 @@ static int bamboo_load_device_tree(hwaddr addr, clock_freq =kvmppc_get_clockfreq (); } -qemu_devtree_setprop_cell (fdt,"/cpus/cpu@0" ,"clock-frequency" , - clock_freq); -qemu_devtree_setprop_cell (fdt,"/cpus/cpu@0" ,"timebase-frequency" , - tb_freq); +qemu_fdt_setprop_cell (fdt,"/cpus/cpu@0" ,"clock-frequency" , + clock_freq); +qemu_fdt_setprop_cell (fdt,"/cpus/cpu@0" ,"timebase-frequency" , + tb_freq);rom_add_blob_fixed (BINARY_DEVICE_TREE_FILE , fdt, fdt_size, addr);g_free (fdt);
hw/ppc/spapr_rtas.c +8 -8
@@ -334,24 +334,24 @@ int spapr_rtas_device_tree_setup(void *fdt, hwaddr rtas_addr,return ret; } - ret =qemu_devtree_setprop_cell (fdt,"/rtas" ,"linux,rtas-base" , - rtas_addr); + ret =qemu_fdt_setprop_cell (fdt,"/rtas" ,"linux,rtas-base" , + rtas_addr);if (ret <0 ) {fprintf (stderr,"Couldn't add linux,rtas-base property: %s\n" ,fdt_strerror (ret));return ret; } - ret =qemu_devtree_setprop_cell (fdt,"/rtas" ,"linux,rtas-entry" , - rtas_addr); + ret =qemu_fdt_setprop_cell (fdt,"/rtas" ,"linux,rtas-entry" , + rtas_addr);if (ret <0 ) {fprintf (stderr,"Couldn't add linux,rtas-entry property: %s\n" ,fdt_strerror (ret));return ret; } - ret =qemu_devtree_setprop_cell (fdt,"/rtas" ,"rtas-size" , - rtas_size); + ret =qemu_fdt_setprop_cell (fdt,"/rtas" ,"rtas-size" , + rtas_size);if (ret <0 ) {fprintf (stderr,"Couldn't add rtas-size property: %s\n" ,fdt_strerror (ret));
@@ -365,8 +365,8 @@ int spapr_rtas_device_tree_setup(void *fdt, hwaddr rtas_addr,continue ; } - ret =qemu_devtree_setprop_cell (fdt,"/rtas" , call->name, - i +TOKEN_BASE ); + ret =qemu_fdt_setprop_cell (fdt,"/rtas" , call->name, + i +TOKEN_BASE );if (ret <0 ) {fprintf (stderr,"Couldn't add rtas token for %s: %s\n" , call->name,fdt_strerror (ret));
hw/ppc/virtex_ml507.c +1 -1
@@ -166,7 +166,7 @@ static int xilinx_load_device_tree(hwaddr addr,if (!fdt) {return 0 ; } - r =qemu_devtree_setprop_string (fdt,"/chosen" ,"bootargs" , kernel_cmdline); + r =qemu_fdt_setprop_string (fdt,"/chosen" ,"bootargs" , kernel_cmdline);if (r <0 )fprintf (stderr,"couldn't set /chosen/bootargs\n" );cpu_physical_memory_write (addr, fdt, fdt_size);
include/sysemu/device_tree.h +40 -40
118 lines not on this page · raw message
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 21/32] Add VSX Scalar Move Instructions
In reply to Alexander GrafFrom: Tom Musta <[email protected]>
This patch adds the VSX scalar move instructions:
- xsabsdp (Scalar Absolute Value Double-Precision)
- xsnabspd (Scalar Negative Absolute Value Double-Precision)
- xsnegdp (Scalar Negate Double-Precision)
- xscpsgndp (Scalar Copy Sign Double-Precision)
A common generator macro (VSX_SCALAR_MOVE) is added since these instructions vary only slightly from each other.
Macros to support VSX XX2 and XX3 form opcodes are also added. These macros handle the overloading of "opcode 2" space (instruction bits 26:30) caused by AX and BX bits (29 and 30, respectively).
V3: Per feedback from Paolo Bonzini, moved the sign mask into a temporary and used andc.
--- target-ppc/translate.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+)
target-ppc/translate.c +70 -0
@@ -7153,6 +7153,59 @@ static void gen_xxpermdi(DisasContext *ctx) } } +#define OP_ABS 1 +#define OP_NABS 2 +#define OP_NEG 3 +#define OP_CPSGN 4 +#define SGN_MASK_DP 0x8000000000000000ul +#define SGN_MASK_SP 0x8000000080000000ul + +#define VSX_SCALAR_MOVE (name, op, sgn_mask) \ +static void glue(gen_, name)(DisasContext * ctx) \ + { \ + TCGv_i64 xb, sgm; \ + if (unlikely(!ctx->vsx_enabled)) { \ + gen_exception(ctx, POWERPC_EXCP_VSXU); \ + return; \ + } \ + xb = tcg_temp_new(); \ + sgm = tcg_temp_new(); \ + tcg_gen_mov_i64(xb, cpu_vsrh(xB(ctx->opcode))); \ + tcg_gen_movi_i64(sgm, sgn_mask); \ + switch (op) { \ + case OP_ABS: { \ + tcg_gen_andc_i64(xb, xb, sgm); \ + break; \ + } \ + case OP_NABS: { \ + tcg_gen_or_i64(xb, xb, sgm); \ + break; \ + } \ + case OP_NEG: { \ + tcg_gen_xor_i64(xb, xb, sgm); \ + break; \ + } \ + case OP_CPSGN: { \ + TCGv_i64 xa = tcg_temp_new(); \ + tcg_gen_mov_i64(xa, cpu_vsrh(xA(ctx->opcode))); \ + tcg_gen_and_i64(xa, xa, sgm); \ + tcg_gen_andc_i64(xb, xb, sgm); \ + tcg_gen_or_i64(xb, xb, xa); \ + tcg_temp_free(xa); \ + break; \ + } \ + } \ + tcg_gen_mov_i64(cpu_vsrh(xT(ctx->opcode)), xb); \ + tcg_temp_free(xb); \ + tcg_temp_free(sgm); \ + } + +VSX_SCALAR_MOVE(xsabsdp, OP_ABS, SGN_MASK_DP) +VSX_SCALAR_MOVE(xsnabsdp, OP_NABS, SGN_MASK_DP) +VSX_SCALAR_MOVE(xsnegdp, OP_NEG, SGN_MASK_DP) +VSX_SCALAR_MOVE (xscpsgndp,OP_CPSGN ,SGN_MASK_DP ) + +/*** SPE extension ***/ /* Register moves */
@@ -9610,6 +9663,18 @@ GEN_HANDLER_E(stxsdx, 0x1F, 0xC, 0x16, 0, PPC_NONE, PPC2_VSX), GEN_HANDLER_E(stxvd2x, 0x1F, 0xC, 0x1E, 0, PPC_NONE, PPC2_VSX), GEN_HANDLER_E(stxvw4x, 0x1F, 0xC, 0x1C, 0, PPC_NONE, PPC2_VSX), +#undef GEN_XX2FORM +#define GEN_XX2FORM (name, opc2, opc3, fl2) \ +GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 0, opc3, 0, PPC_NONE, fl2), \ +GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 1, opc3, 0, PPC_NONE, fl2) + +#undef GEN_XX3FORM +#define GEN_XX3FORM (name, opc2, opc3, fl2) \ +GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 0, opc3, 0, PPC_NONE, fl2), \ +GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 1, opc3, 0, PPC_NONE, fl2), \ +GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 2, opc3, 0, PPC_NONE, fl2), \ +GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 3, opc3, 0, PPC_NONE, fl2) +#undef GEN_XX3FORM_DM#define GEN_XX3FORM_DM (name, opc2, opc3) \ GEN_HANDLER2_E(name, #name, 0x3C, opc2|0x00, opc3|0x00, 0, PPC_NONE, PPC2_VSX),\
@@ -9629,6 +9694,11 @@ GEN_HANDLER2_E(name, #name, 0x3C, opc2|0x01, opc3|0x0C, 0, PPC_NONE, PPC2_VSX),\ GEN_HANDLER2_E(name, #name, 0x3C, opc2|0x02, opc3|0x0C, 0, PPC_NONE, PPC2_VSX),\ GEN_HANDLER2_E(name, #name, 0x3C, opc2|0x03, opc3|0x0C, 0, PPC_NONE, PPC2_VSX) +GEN_XX2FORM (xsabsdp,0x12 ,0x15 ,PPC2_VSX ), +GEN_XX2FORM (xsnabsdp,0x12 ,0x16 ,PPC2_VSX ), +GEN_XX2FORM (xsnegdp,0x12 ,0x17 ,PPC2_VSX ), +GEN_XX3FORM (xscpsgndp,0x00 ,0x16 ,PPC2_VSX ), +GEN_XX3FORM_DM (xxpermdi,0x08 ,0x01 ), #undef GEN_SPE
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 25/32] Add xxsel
In reply to Alexander GrafFrom: Tom Musta <[email protected]>
This patch adds the VSX Select (xxsel) instruction.
The xxsel instruction has four VSR operands. Thus the xC instruction decoder is added.
The xxsel instruction is massively overloaded in the opcode table since only bits 26 and 27 are opcode bits. This overloading is done in matrix fashion with two macros (GEN_XXSEL_ROW and GEN_XX_SEL).
V2: (1) eliminated unecessary XXSEL macro (2) tighter implementation using tcg_gen_andc_i64.
--- target-ppc/translate.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+)
target-ppc/translate.c +76 -0
@@ -497,6 +497,7 @@ EXTRACT_HELPER_SPLIT(xT, 0, 1, 21, 5);EXTRACT_HELPER_SPLIT (xS,0 ,1 ,21 ,5 );EXTRACT_HELPER_SPLIT (xA,2 ,1 ,16 ,5 );EXTRACT_HELPER_SPLIT (xB,1 ,1 ,11 ,5 ); +EXTRACT_HELPER_SPLIT (xC,3 ,1 ,6 ,5 );EXTRACT_HELPER (DM ,8 ,2 );/*****************************************************************************/ /* PowerPC instructions table */
@@ -7325,6 +7326,38 @@ static void glue(gen_, name)(DisasContext * ctx) \ VSX_XXMRG(xxmrghw, 1) VSX_XXMRG(xxmrglw, 0) +static void gen_xxsel (DisasContext * ctx) +{ +TCGv_i64 a, b, c; +if (unlikely (!ctx->vsx_enabled)) { +gen_exception (ctx,POWERPC_EXCP_VSXU ); +return ; + } + a =tcg_temp_new (); + b =tcg_temp_new (); + c =tcg_temp_new (); + +tcg_gen_mov_i64 (a,cpu_vsrh (xA (ctx->opcode))); +tcg_gen_mov_i64 (b,cpu_vsrh (xB (ctx->opcode))); +tcg_gen_mov_i64 (c,cpu_vsrh (xC (ctx->opcode))); + +tcg_gen_and_i64 (b, b, c); +tcg_gen_andc_i64 (a, a, c); +tcg_gen_or_i64 (cpu_vsrh (xT (ctx->opcode)), a, b); + +tcg_gen_mov_i64 (a,cpu_vsrl (xA (ctx->opcode))); +tcg_gen_mov_i64 (b,cpu_vsrl (xB (ctx->opcode))); +tcg_gen_mov_i64 (c,cpu_vsrl (xC (ctx->opcode))); + +tcg_gen_and_i64 (b, b, c); +tcg_gen_andc_i64 (a, a, c); +tcg_gen_or_i64 (cpu_vsrl (xT (ctx->opcode)), a, b); + +tcg_temp_free (a); +tcg_temp_free (b); +tcg_temp_free (c); +} +/*** SPE extension ***/ /* Register moves */
@@ -9840,6 +9873,49 @@ VSX_LOGICAL(xxlnor, 0x8, 0x14, PPC2_VSX),GEN_XX3FORM (xxmrghw,0x08 ,0x02 ,PPC2_VSX ),GEN_XX3FORM (xxmrglw,0x08 ,0x06 ,PPC2_VSX ), +#define GEN_XXSEL_ROW(opc3) \ +GEN_HANDLER2_E (xxsel,"xxsel" ,0x3C ,0x18 , opc3,0 ,PPC_NONE ,PPC2_VSX ), \ +GEN_HANDLER2_E (xxsel,"xxsel" ,0x3C ,0x19 , opc3,0 ,PPC_NONE ,PPC2_VSX ), \ +GEN_HANDLER2_E (xxsel,"xxsel" ,0x3C ,0x1A , opc3,0 ,PPC_NONE ,PPC2_VSX ), \ +GEN_HANDLER2_E (xxsel,"xxsel" ,0x3C ,0x1B , opc3,0 ,PPC_NONE ,PPC2_VSX ), \ +GEN_HANDLER2_E (xxsel,"xxsel" ,0x3C ,0x1C , opc3,0 ,PPC_NONE ,PPC2_VSX ), \ +GEN_HANDLER2_E (xxsel,"xxsel" ,0x3C ,0x1D , opc3,0 ,PPC_NONE ,PPC2_VSX ), \ +GEN_HANDLER2_E (xxsel,"xxsel" ,0x3C ,0x1E , opc3,0 ,PPC_NONE ,PPC2_VSX ), \ +GEN_HANDLER2_E (xxsel,"xxsel" ,0x3C ,0x1F , opc3,0 ,PPC_NONE ,PPC2_VSX ), \ + +GEN_XXSEL_ROW(0x00) +GEN_XXSEL_ROW(0x01) +GEN_XXSEL_ROW(0x02) +GEN_XXSEL_ROW(0x03) +GEN_XXSEL_ROW(0x04) +GEN_XXSEL_ROW(0x05) +GEN_XXSEL_ROW(0x06) +GEN_XXSEL_ROW(0x07) +GEN_XXSEL_ROW(0x08) +GEN_XXSEL_ROW(0x09) +GEN_XXSEL_ROW(0x0A) +GEN_XXSEL_ROW(0x0B) +GEN_XXSEL_ROW(0x0C) +GEN_XXSEL_ROW(0x0D) +GEN_XXSEL_ROW(0x0E) +GEN_XXSEL_ROW(0x0F) +GEN_XXSEL_ROW(0x10) +GEN_XXSEL_ROW(0x11) +GEN_XXSEL_ROW(0x12) +GEN_XXSEL_ROW(0x13) +GEN_XXSEL_ROW(0x14) +GEN_XXSEL_ROW(0x15) +GEN_XXSEL_ROW(0x16) +GEN_XXSEL_ROW(0x17) +GEN_XXSEL_ROW(0x18) +GEN_XXSEL_ROW(0x19) +GEN_XXSEL_ROW(0x1A) +GEN_XXSEL_ROW(0x1B) +GEN_XXSEL_ROW(0x1C) +GEN_XXSEL_ROW(0x1D) +GEN_XXSEL_ROW(0x1E) +GEN_XXSEL_ROW(0x1F) +GEN_XX3FORM_DM (xxpermdi,0x08 ,0x01 ), #undef GEN_SPE
Signature · 1 line
1.8.1.4
Re: [Qemu-devel] [PULL 25/32] Add xxsel
Hi,
this patch or one of the two following patches breaks compilation with --enable-debug (lots of TCGv_i32 - TCGv_i64 mismatches).
Cheers,
Stefan
Am 20.12.2013 02:00, schrieb Alexander Graf:
Quoted 123 lines
From: Tom Musta <[email protected]>
This patch adds the VSX Select (xxsel) instruction.
The xxsel instruction has four VSR operands. Thus the xC instruction decoder is added.
The xxsel instruction is massively overloaded in the opcode table since only bits 26 and 27 are opcode bits. This overloading is done in matrix fashion with two macros (
GEN_XXSEL_ROWandGEN_XX_SEL).V2: (1) eliminated unecessary XXSEL macro (2) tighter implementation using
tcg_gen_andc_i64.Signed-off-by Tom Musta <[email protected]>Reviewed-by Richard Henderson <[email protected]>Signed-off-by Alexander Graf <[email protected]>--- target-ppc/translate.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+)target-ppc/translate.c +76
-0@@ -497,6 +497,7 @@ EXTRACT_HELPER_SPLIT(xT, 0, 1, 21, 5);EXTRACT_HELPER_SPLIT (xS,0 ,1 ,21 ,5 );EXTRACT_HELPER_SPLIT (xA,2 ,1 ,16 ,5 );EXTRACT_HELPER_SPLIT (xB,1 ,1 ,11 ,5 ); +EXTRACT_HELPER_SPLIT (xC,3 ,1 ,6 ,5 );EXTRACT_HELPER (DM ,8 ,2 );/*****************************************************************************/ /* PowerPC instructions table */ @@ -7325,6 +7326,38 @@ static void glue(gen_, name)(DisasContext * ctx) \ VSX_XXMRG(xxmrghw, 1) VSX_XXMRG(xxmrglw, 0) +static void gen_xxsel (DisasContext * ctx) +{ +TCGv_i64 a, b, c; +if (unlikely (!ctx->vsx_enabled)) { +gen_exception (ctx,POWERPC_EXCP_VSXU ); +return ; + } + a =tcg_temp_new (); + b =tcg_temp_new (); + c =tcg_temp_new (); + +tcg_gen_mov_i64 (a,cpu_vsrh (xA (ctx->opcode))); +tcg_gen_mov_i64 (b,cpu_vsrh (xB (ctx->opcode))); +tcg_gen_mov_i64 (c,cpu_vsrh (xC (ctx->opcode))); + +tcg_gen_and_i64 (b, b, c); +tcg_gen_andc_i64 (a, a, c); +tcg_gen_or_i64 (cpu_vsrh (xT (ctx->opcode)), a, b); + +tcg_gen_mov_i64 (a,cpu_vsrl (xA (ctx->opcode))); +tcg_gen_mov_i64 (b,cpu_vsrl (xB (ctx->opcode))); +tcg_gen_mov_i64 (c,cpu_vsrl (xC (ctx->opcode))); + +tcg_gen_and_i64 (b, b, c); +tcg_gen_andc_i64 (a, a, c); +tcg_gen_or_i64 (cpu_vsrl (xT (ctx->opcode)), a, b); + +tcg_temp_free (a); +tcg_temp_free (b); +tcg_temp_free (c); +} +/*** SPE extension ***/ /* Register moves */ @@ -9840,6 +9873,49 @@ VSX_LOGICAL(xxlnor, 0x8, 0x14, PPC2_VSX),GEN_XX3FORM (xxmrghw,0x08 ,0x02 ,PPC2_VSX ),GEN_XX3FORM (xxmrglw,0x08 ,0x06 ,PPC2_VSX ), +#define GEN_XXSEL_ROW(opc3) \ +GEN_HANDLER2_E (xxsel,"xxsel" ,0x3C ,0x18 , opc3,0 ,PPC_NONE ,PPC2_VSX ), \ +GEN_HANDLER2_E (xxsel,"xxsel" ,0x3C ,0x19 , opc3,0 ,PPC_NONE ,PPC2_VSX ), \ +GEN_HANDLER2_E (xxsel,"xxsel" ,0x3C ,0x1A , opc3,0 ,PPC_NONE ,PPC2_VSX ), \ +GEN_HANDLER2_E (xxsel,"xxsel" ,0x3C ,0x1B , opc3,0 ,PPC_NONE ,PPC2_VSX ), \ +GEN_HANDLER2_E (xxsel,"xxsel" ,0x3C ,0x1C , opc3,0 ,PPC_NONE ,PPC2_VSX ), \ +GEN_HANDLER2_E (xxsel,"xxsel" ,0x3C ,0x1D , opc3,0 ,PPC_NONE ,PPC2_VSX ), \ +GEN_HANDLER2_E (xxsel,"xxsel" ,0x3C ,0x1E , opc3,0 ,PPC_NONE ,PPC2_VSX ), \ +GEN_HANDLER2_E (xxsel,"xxsel" ,0x3C ,0x1F , opc3,0 ,PPC_NONE ,PPC2_VSX ), \ + +GEN_XXSEL_ROW(0x00) +GEN_XXSEL_ROW(0x01) +GEN_XXSEL_ROW(0x02) +GEN_XXSEL_ROW(0x03) +GEN_XXSEL_ROW(0x04) +GEN_XXSEL_ROW(0x05) +GEN_XXSEL_ROW(0x06) +GEN_XXSEL_ROW(0x07) +GEN_XXSEL_ROW(0x08) +GEN_XXSEL_ROW(0x09) +GEN_XXSEL_ROW(0x0A) +GEN_XXSEL_ROW(0x0B) +GEN_XXSEL_ROW(0x0C) +GEN_XXSEL_ROW(0x0D) +GEN_XXSEL_ROW(0x0E) +GEN_XXSEL_ROW(0x0F) +GEN_XXSEL_ROW(0x10) +GEN_XXSEL_ROW(0x11) +GEN_XXSEL_ROW(0x12) +GEN_XXSEL_ROW(0x13) +GEN_XXSEL_ROW(0x14) +GEN_XXSEL_ROW(0x15) +GEN_XXSEL_ROW(0x16) +GEN_XXSEL_ROW(0x17) +GEN_XXSEL_ROW(0x18) +GEN_XXSEL_ROW(0x19) +GEN_XXSEL_ROW(0x1A) +GEN_XXSEL_ROW(0x1B) +GEN_XXSEL_ROW(0x1C) +GEN_XXSEL_ROW(0x1D) +GEN_XXSEL_ROW(0x1E) +GEN_XXSEL_ROW(0x1F) +GEN_XX3FORM_DM (xxpermdi,0x08 ,0x01 ), #undef GEN_SPE
Re: [Qemu-devel] [PULL 25/32] Add xxsel
Quoted 4 lines · Stefan Weil
Hi,
this patch or one of the two following patches breaks compilation with --enable-debug (lots of
TCGv_i32-TCGv_i64mismatches).
Bleks. Didn't we have buildbots for that?
I guess I will have to add a compile run with --enable-debug to my own autotest steps :(.
Either way, I'll write up a patch to fix this.
Alex
[Qemu-devel] [PULL 32/32] spapr: limit numa memory regions by ram size
In reply to Alexander GrafFrom: Paul Mackerras <[email protected]>
This makes sure that all NUMA memory blocks reside within RAM or have zero length.
--- hw/ppc/spapr.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
hw/ppc/spapr.c +16 -4
@@ -526,12 +526,16 @@ static int spapr_populate_memory(sPAPREnvironment *spapr, void *fdt)cpu_to_be32 (0x0 ),cpu_to_be32 (0x0 ), cpu_to_be32(0x0)};char mem_name[32 ]; -hwaddr node0_size, mem_start; +hwaddr node0_size, mem_start, node_size;uint64_t mem_reg_property[2 ];int i, off;/* memory node(s) */ - node0_size = (nb_numa_nodes >1 ) ? node_mem[0 ] : ram_size; +if (nb_numa_nodes >1 && node_mem[0 ] < ram_size) { + node0_size = node_mem[0 ]; + }else { + node0_size = ram_size; + }/* RMA */ mem_reg_property[0 ] =0 ;
@@ -563,7 +567,15 @@ static int spapr_populate_memory(sPAPREnvironment *spapr, void *fdt) mem_start = node0_size;for (i =1 ; i < nb_numa_nodes; i++) { mem_reg_property[0 ] =cpu_to_be64 (mem_start); - mem_reg_property[1 ] =cpu_to_be64 (node_mem[i]); +if (mem_start >= ram_size) { + node_size =0 ; + }else { + node_size = node_mem[i]; +if (node_size > ram_size - mem_start) { + node_size = ram_size - mem_start; + } + } + mem_reg_property[1 ] =cpu_to_be64 (node_size); associativity[3 ] = associativity[4 ] =cpu_to_be32 (i);sprintf (mem_name,"memory@" TARGET_FMT_lx, mem_start); off =fdt_add_subnode (fdt,0 , mem_name);
@@ -573,7 +585,7 @@ static int spapr_populate_memory(sPAPREnvironment *spapr, void *fdt) sizeof(mem_reg_property))));_FDT ((fdt_setprop (fdt, off,"ibm,associativity" , associativity,sizeof (associativity)))); - mem_start += node_mem[i]; + mem_start += node_size; }return 0 ;
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 20/32] roms: Flush icache when writing roms to guest memory
In reply to Alexander GrafWe use the rom infrastructure to write firmware and/or initial kernel blobs into guest address space. So we're basically emulating the cache off phase on very early system bootup.
That phase is usually responsible for clearing the instruction cache for anything it writes into cachable memory, to ensure that after reboot we don't happen to execute stale bits from the instruction cache.
So we need to invalidate the icache every time we write a rom into guest address space. We do not need to do this for every DMA since the guest expects it has to flush the icache manually in that case.
This fixes random reboot issues on e5500 (booke ppc) for me.
--- exec.c | 44 +++++++++++++++++++++++++++++++++++++++----- hw/core/loader.c | 7 +++++++ include/exec/cpu-common.h | 1 + 3 files changed, 47 insertions(+), 5 deletions(-)
exec.c +39 -5
@@ -50,6 +50,7 @@#include "translate-all.h" #include "exec/memory-internal.h" +#include "qemu/cache-utils.h" #include "qemu/range.h"
@@ -2070,9 +2071,13 @@ void cpu_physical_memory_rw(hwaddr addr, uint8_t *buf,address_space_rw (&address_space_memory, addr, buf, len, is_write); } -/* used for ROM loading : can write in RAM and ROM */ -void cpu_physical_memory_write_rom (hwaddr addr, -const uint8_t *buf,int len) +enum write_rom_type { +WRITE_DATA , +FLUSH_CACHE , +}; + +static inline void cpu_physical_memory_write_rom_internal ( +hwaddr addr,const uint8_t *buf,int len,enum write_rom_type type) {hwaddr l;uint8_t *ptr;
@@ -2091,8 +2096,15 @@ void cpu_physical_memory_write_rom(hwaddr addr, addr1 +=memory_region_get_ram_addr (mr);/* ROM/RAM case */ ptr =qemu_get_ram_ptr (addr1); -memcpy (ptr, buf, l); -invalidate_and_set_dirty (addr1, l); +switch (type) { +case WRITE_DATA : +memcpy (ptr, buf, l); +invalidate_and_set_dirty (addr1, l); +break ; +case FLUSH_CACHE : +flush_icache_range ((uintptr_t )ptr, (uintptr_t )ptr + l); +break ; + } } len -= l; buf += l;
@@ -2100,6 +2112,28 @@ void cpu_physical_memory_write_rom(hwaddr addr, } } +/* used for ROM loading : can write in RAM and ROM */ +void cpu_physical_memory_write_rom (hwaddr addr, +const uint8_t *buf,int len) +{ +cpu_physical_memory_write_rom_internal (addr, buf, len,WRITE_DATA ); +} + +void cpu_flush_icache_range (hwaddr start,int len) +{ +/* +* This function should do the same thing as an icache flush that was +* triggered from within the guest. For TCG we are always cache coherent, +* so there is no need to flush anything. For KVM / Xen we need to flush +* the host's instruction cache at least. +*/ +if (tcg_enabled ()) { +return ; + } + +cpu_physical_memory_write_rom_internal (start,NULL , len,FLUSH_CACHE ); +} + typedef struct { MemoryRegion *mr; void *buffer;
hw/core/loader.c +7 -0
@@ -785,6 +785,13 @@ static void rom_reset(void *unused)g_free (rom->data); rom->data =NULL ; } +/* +* The rom loader is really on the same level as firmware in the guest +* shadowing a ROM into RAM. Such a shadowing mechanism needs to ensure +* that the instruction cache for that new region is clear, so that the +* CPU definitely fetches its instructions from the just written data. +*/ +cpu_flush_icache_range (rom->addr, rom->datasize); } }
include/exec/cpu-common.h +1 -0
@@ -110,6 +110,7 @@ void stq_phys(hwaddr addr, uint64_t val);void cpu_physical_memory_write_rom (hwaddr addr,const uint8_t *buf,int len); +void cpu_flush_icache_range (hwaddr start,int len);extern struct MemoryRegion io_mem_rom;extern struct MemoryRegion io_mem_notdirty;
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 30/32] device_tree: qemu_fdt_setprop: Rename val_array arg
In reply to Alexander GrafFrom: Peter Crosthwaite <[email protected]>
Looking at the implementation, this doesn't really have a lot to do with arrays. Its just a pointer to a buffer and is passed through to the wrapped fn (qemu_fdt_setprop) unchanged. So rename to make it consistent with libfdt, which in the wrapped function just calls it "val".
--- device_tree.c | 4 ++-- include/sysemu/device_tree.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
device_tree.c +2 -2
@@ -132,11 +132,11 @@ static int findnode_nofail(void *fdt, const char *node_path) }int qemu_fdt_setprop (void *fdt,const char *node_path, -const char *property,const void *val_array,int size) +const char *property,const void *val,int size) {int r; - r =fdt_setprop (fdt,findnode_nofail (fdt, node_path), property, val_array, size); + r =fdt_setprop (fdt,findnode_nofail (fdt, node_path), property, val, size);if (r <0 ) {fprintf (stderr,"%s: Couldn't set %s/%s: %s\n" , __func__, node_path, property,fdt_strerror (r));
include/sysemu/device_tree.h +1 -1
@@ -18,7 +18,7 @@ void *create_device_tree(int *sizep);void *load_device_tree (const char *filename_path,int *sizep);int qemu_fdt_setprop (void *fdt,const char *node_path, -const char *property,const void *val_array,int size); +const char *property,const void *val,int size);int qemu_fdt_setprop_cell (void *fdt,const char *node_path,const char *property,uint32_t val); int qemu_fdt_setprop_u64(void *fdt, const char *node_path,
Signature · 1 line
1.8.1.4
Am 20.12.2013 02:00, schrieb Alexander Graf:
Quoted 12 lines
Tom Musta (19):
Declare and Enable VSX
Add MSR VSX and Associated Exception
Add VSX Instruction Decoders
Add VSR to Global Registers
Add lxvd2x
Add stxvd2x
Add xxpermdi
Add lxsdx
Add lxvdsx
Add lxvw4x
Add stxsdx
Quoted 8 lines
Add stxvw4x
Add VSX Scalar Move Instructions
Add VSX Vector Move Instructions
Add Power7 VSX Logical Instructions
Add xxmrgh/xxmrgl
Add xxsel
Add xxspltw
Add xxsldwi
Alex, we now have those meaningless-without-context commit messages in qemu.git history. I'm pretty sure I asked the contributor nicely to add a meaningful PPC'ish prefix, and lacking to do so you could've easily edited these yourself before sending them out to the world! :(
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Quoted 22 lines · Andreas Färber
Am 20.12.2013 02:00, schrieb Alexander Graf:
Quoted 12 lines
Tom Musta (19):
Declare and Enable VSX
Add MSR VSX and Associated Exception
Add VSX Instruction Decoders
Add VSR to Global Registers
Add lxvd2x
Add stxvd2x
Add xxpermdi
Add lxsdx
Add lxvdsx
Add lxvw4x
Add stxsdxQuoted 8 lines
Add stxvw4x
Add VSX Scalar Move Instructions
Add VSX Vector Move Instructions
Add Power7 VSX Logical Instructions
Add xxmrgh/xxmrgl
Add xxsel
Add xxspltw
Add xxsldwi
Quoted 4 lines
Alex, we now have those meaningless-without-context commit messages in qemu.git history. I'm pretty sure I asked the contributor nicely to add a meaningful PPC'ish prefix, and lacking to do so you could've easily edited these yourself before sending them out to the world! :(
Ok, Tom, please prefix the next ones with "PPC:" :).
Alex
Quoted 11 lines · Alexander Graf
Quoted 7 lines · Andreas Färber
Am 20.12.2013 02:00, schrieb Alexander Graf:
Alex, we now have those meaningless-without-context commit messages in qemu.git history. I'm pretty sure I asked the contributor nicely to add a meaningful PPC'ish prefix, and lacking to do so you could've easily edited these yourself before sending them out to the world! :(
Quoted 5 lines
Ok, Tom, please prefix the next ones with "PPC:" :).
Alex
Yes. I have been doing so with all of my subsequent patches. I did not understand that it was necessary to go back and resubmit just for this.
I have to republish stage 3 and 4 and the other ISA 2.06 changes for TCG debug/compilation issues. Those will have a "target-ppc" prefix. It probably will be after the new year.