ppc-for-2.8 queue 20161006
The following changes since commit bbc4c3f4f3c624e2de64fdcb79f4dd8c1a508e9d:
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2016-10-04 14:25:08 +0100)
are available in the git repository at:
git://github.com/dgibson/qemu.git tags/ppc-for-2.8-20161006
for you to fetch changes up to 3daa4a9f9580ffda47df93c7c53371af226bf970:
hw/ppc/spapr: Use POWER8 by default for the pseries-2.8 machine (2016-10-06 16:15:53 +1100)
----------------------------------------------------------------
ppc patch queue 2016-10-06
Currently accumulated target-ppc and spapr machine related patches.
- More POWER9 instruction implementations
- Additional test case / enabling of test cases for Power
- Assorted fixes
----------------------------------------------------------------
Avinesh Kumar (1):
target-ppc: fix invalid mask - cmpl, bctar
David Gibson (1):
pseries: Add 2.8 machine type, set up compatibility macros
Felipe Franciosi (1):
spapr_vscsi: fix build error introduced by f19661c8
Greg Kurz (1):
spapr: fix check of cpu alias name in spapr_get_cpu_core_type()
Laurent Vivier (4):
libqos: add PPC64 PCI support
libqos: add PCI management in qtest_vboot()/qtest_shutdown()
libqos: use generic qtest_shutdown()
tests: enable ohci/uhci/xhci tests on PPC64
Nikunj A Dadhania (7):
target-ppc: improve lxvw4x implementation
target-ppc: improve stxvw4x implementation
target-ppc: add lxvh8x instruction
target-ppc: add stxvh8x instruction
target-ppc: add lxvb16x instruction
target-ppc: add stxvb16x instruction
target-ppc: fix vmx instruction type/type2
Rajalakshmi Srinivasaraghavan (2):
target-ppc: add vector compare not equal instructions
target-ppc: add vclzlsbb/vctzlsbb instructions
Ravi Bangoria (3):
target-ppc: Implement mfvsrld instruction
target-ppc: Implement mtvsrdd instruction
target-ppc: Implement mtvsrws instruction
Thomas Huth (9):
tests: Test IPv6 and ppc64 in the PXE tester
hw/ppc/spapr: Move code related to "ibm,pa-features" to a separate function hw/ppc/spapr: Fix the selection of the processor features
ppc: Check the availability of transactional memory
MAINTAINERS: Add two more ppc related files
target-ppc/kvm: Add a wrapper function to check for KVM-PR target-ppc/kvm: Enable transactional memory on POWER8 with KVM-HV, too tests/pxe: Use -nodefaults to speed up ppc64/ipv6 pxe test hw/ppc/spapr: Use POWER8 by default for the pseries-2.8 machine
MAINTAINERS | 2 + hw/ppc/spapr.c | 104 ++++++++----- hw/ppc/spapr_cpu_core.c | 8 +- hw/scsi/spapr_vscsi.c | 2 +- hw/scsi/trace-events | 2 +- include/hw/ppc/spapr.h | 1 + target-ppc/helper.h | 8 + target-ppc/int_helper.c | 61 ++++++-- target-ppc/kvm.c | 42 ++++-- target-ppc/kvm_ppc.h | 6 + target-ppc/translate.c | 4 +- target-ppc/translate/vmx-impl.inc.c | 49 ++++-- target-ppc/translate/vmx-ops.inc.c | 20 +-- target-ppc/translate/vsx-impl.inc.c | 234 ++++++++++++++++++++++++++--- target-ppc/translate/vsx-ops.inc.c | 7 + tests/Makefile.include | 10 +- tests/boot-sector.c | 9 ++ tests/e1000e-test.c | 2 +- tests/i440fx-test.c | 2 +- tests/ide-test.c | 2 +- tests/ivshmem-test.c | 2 +- tests/libqos/ahci.c | 2 +- tests/libqos/libqos-pc.c | 8 +- tests/libqos/libqos-spapr.c | 8 +- tests/libqos/libqos.c | 32 +++- tests/libqos/libqos.h | 11 +- tests/libqos/pci-pc.c | 24 +-- tests/libqos/pci-pc.h | 3 +- tests/libqos/pci-spapr.c | 288 ++++++++++++++++++++++++++++++++++++ tests/libqos/pci-spapr.h | 17 +++ tests/libqos/pci.c | 22 ++- tests/libqos/rtas.c | 45 ++++++ tests/libqos/rtas.h | 4 + tests/pxe-test.c | 22 ++- tests/q35-test.c | 2 +- tests/rtas-test.c | 2 +- tests/rtl8139-test.c | 2 +- tests/tco-test.c | 2 +- tests/usb-hcd-ehci-test.c | 2 +- tests/usb-hcd-uhci-test.c | 24 ++- tests/vhost-user-test.c | 4 +- tests/virtio-9p-test.c | 2 +- tests/virtio-blk-test.c | 2 +- tests/virtio-net-test.c | 2 +- tests/virtio-scsi-test.c | 2 +- 45 files changed, 930 insertions(+), 179 deletions(-) create mode 100644 tests/libqos/pci-spapr.c create mode 100644 tests/libqos/pci-spapr.h
[Qemu-devel] [PULL 02/29] tests: Test IPv6 and ppc64 in the PXE tester
From: Thomas Huth <[email protected]>
The firmware of the pseries machine, SLOF, is able to load files via IPv6 networking, too. So to test both, network bootloading on ppc64 and IPv6 (via Slirp) , let's add some PXE tests for this environment, too. Since we can not use the normal x86 boot sector for network boot loading, we use a simple Forth script on ppc64 instead.
--- tests/Makefile.include | 1 + tests/boot-sector.c | 9 +++++++++ tests/pxe-test.c | 22 +++++++++++++++------- 3 files changed, 25 insertions(+), 7 deletions(-)
tests/Makefile.include +1 -0
@@ -271,6 +271,7 @@ check-qtest-ppc64-y += tests/drive_del-test$(EXESUF) check-qtest-ppc64-y += tests/postcopy-test$(EXESUF) check-qtest-ppc64-y += tests/boot-serial-test$(EXESUF) check-qtest-ppc64-y += tests/rtas-test$(EXESUF) +check-qtest-ppc64-y += tests/pxe-test$(EXESUF) check-qtest-sh4-y = tests/endianness-test$(EXESUF)
tests/boot-sector.c +9 -0
@@ -77,6 +77,15 @@ int boot_sector_init(const char *fname)fprintf (stderr,"Couldn't open \"%s\": %s" , fname,strerror (errno));return 1 ; } + +/* For Open Firmware based system, we can use a Forth script instead */ +if (strcmp (qtest_get_arch (),"ppc64" ) ==0 ) { +memset (boot_sector,' ' ,sizeof boot_sector); +sprintf ((char *)boot_sector,"\\ Bootscript\n%x %x c! %x %x c!\n" , +LOW (SIGNATURE ),BOOT_SECTOR_ADDRESS +SIGNATURE_OFFSET , +HIGH (SIGNATURE ),BOOT_SECTOR_ADDRESS +SIGNATURE_OFFSET +1 ); + } +fwrite (boot_sector,1 ,sizeof boot_sector, f);fclose (f);return 0 ;
tests/pxe-test.c +15 -7
@@ -21,14 +21,14 @@static const char *disk ="tests/pxe-test-disk.raw" ; -static void test_pxe_one (const char *params) +static void test_pxe_one (const char *params,bool ipv6) {char *args; - args =g_strdup_printf ("-machine accel=tcg " -"-netdev user,id=" NETNAME ",tftp=./,bootfile=%s " -"%s " , - disk, params); + args =g_strdup_printf ("-machine accel=tcg -boot order=n " +"-netdev user,id=" NETNAME ",tftp=./,bootfile=%s," +"ipv4=%s,ipv6=%s %s" , disk, ipv6 ?"off" :"on" , + ipv6 ?"on" :"off" , params);qtest_start (args);boot_sector_test ();
@@ -38,12 +38,17 @@ static void test_pxe_one(const char *params)static void test_pxe_e1000 (void ) { -test_pxe_one ("-device e1000,netdev=" NETNAME ); +test_pxe_one ("-device e1000,netdev=" NETNAME , false); }static void test_pxe_virtio_pci (void ) { -test_pxe_one ("-device virtio-net-pci,netdev=" NETNAME ); +test_pxe_one ("-device virtio-net-pci,netdev=" NETNAME , false); +} + +static void test_pxe_spapr_vlan (void ) +{ +test_pxe_one ("-vga none -device spapr-vlan,netdev=" NETNAME , true); }int main (int argc,char *argv[])
@@ -60,6 +65,9 @@ int main(int argc, char *argv[])if (strcmp (arch,"i386" ) ==0 ||strcmp (arch,"x86_64" ) ==0 ) {qtest_add_func ("pxe/e1000" , test_pxe_e1000);qtest_add_func ("pxe/virtio" , test_pxe_virtio_pci); + }else if (strcmp (arch,"ppc64" ) ==0 ) { +qtest_add_func ("pxe/virtio" , test_pxe_virtio_pci); +qtest_add_func ("pxe/spapr-vlan" , test_pxe_spapr_vlan); } ret =g_test_run ();boot_sector_cleanup (disk);
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 20/29] target-ppc/kvm: Add a wrapper function to check for KVM-PR
In reply to David GibsonFrom: Thomas Huth <[email protected]>
It makes more sense if we have a proper function to check for KVM-PR than to check for the GET_PVINFO extension all over the place.
--- target-ppc/kvm.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-)
target-ppc/kvm.c +16 -10
@@ -102,6 +102,16 @@ static void kvm_kick_cpu(void *opaque)qemu_cpu_kick (CPU (cpu)); } +/* Check whether we are running with KVM-PR (instead of KVM-HV). This +* should only be used for fallback tests - generally we should use +* explicit capabilities for the features we want, rather than +* assuming what is/isn't available depending on the KVM variant. */ +static bool kvmppc_is_pr (KVMState *ks) +{ +/* Assume KVM-PR if the GET_PVINFO capability is available */ +return kvm_check_extension (ks,KVM_CAP_PPC_GET_PVINFO ) !=0 ; +} +static int kvm_ppc_register_host_cpu_type (void );int kvm_arch_init (MachineState *ms,KVMState *s)
@@ -223,10 +233,9 @@ static void kvm_get_fallback_smmu_info(PowerPCCPU *cpu,* * For that to work we make a few assumptions: * -* - If KVM_CAP_PPC_GET_PVINFO is supported we are running "PR" -* KVM which only supports 4K and 16M pages, but supports them -* regardless of the backing store characteritics. We also don't -* support 1T segments. +* - Check whether we are running "PR" KVM which only supports 4K +* and 16M pages, but supports them regardless of the backing +* store characteritics. We also don't support 1T segments. * * This is safe as if HV KVM ever supports that capability or PR * KVM grows supports for more page/segment sizes, those versions
@@ -241,7 +250,7 @@ static void kvm_get_fallback_smmu_info(PowerPCCPU *cpu,* implements KVM_CAP_PPC_GET_SMMU_INFO and thus doesn't hit * this fallback. */ -if (kvm_check_extension (cs->kvm_state,KVM_CAP_PPC_GET_PVINFO )) { +if (kvmppc_is_pr (cs->kvm_state)) {/* No flags */ info->flags =0 ; info->slb_size =64 ;
@@ -2270,11 +2279,8 @@ int kvmppc_reset_htab(int shift_hint)/* We have a kernel that predates the htab reset calls. For PR * KVM, we need to allocate the htab ourselves, for an HV KVM of -* this era, it has allocated a 16MB fixed size hash table -* already. Kernels of this era have the GET_PVINFO capability -* only on PR, so we use this hack to determine the right -* answer */ -if (kvm_check_extension (kvm_state,KVM_CAP_PPC_GET_PVINFO )) { +* this era, it has allocated a 16MB fixed size hash table already. */ +if (kvmppc_is_pr (kvm_state)) {/* PR - tell caller to allocate htab */ return 0 ; }else {
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 07/29] target-ppc: Implement mfvsrld instruction
In reply to David GibsonFrom: Ravi Bangoria <[email protected]>
mfvsrld: Move From VSR Lower Doubleword
--- target-ppc/translate/vsx-impl.inc.c | 17 +++++++++++++++++ target-ppc/translate/vsx-ops.inc.c | 1 + 2 files changed, 18 insertions(+)
target-ppc/translate/vsx-impl.inc.c +17 -0
@@ -217,6 +217,23 @@ static void gen_##name(DisasContext *ctx) \ MV_VSRD(mfvsrd, cpu_gpr[rA(ctx->opcode)], cpu_vsrh(xS(ctx->opcode))) MV_VSRD(mtvsrd, cpu_vsrh(xT(ctx->opcode)), cpu_gpr[rA(ctx->opcode)]) +static void gen_mfvsrld (DisasContext *ctx) +{ +if (xS (ctx->opcode) <32 ) { +if (unlikely (!ctx->vsx_enabled)) { +gen_exception (ctx,POWERPC_EXCP_VSXU ); +return ; + } + }else { +if (unlikely (!ctx->altivec_enabled)) { +gen_exception (ctx,POWERPC_EXCP_VPU ); +return ; + } + } + +tcg_gen_mov_i64 (cpu_gpr[rA (ctx->opcode)],cpu_vsrl (xS (ctx->opcode))); +} +#endif static void gen_xxpermdi (DisasContext *ctx)
target-ppc/translate/vsx-ops.inc.c +1 -0
@@ -22,6 +22,7 @@ GEN_HANDLER_E(mtvsrwz, 0x1F, 0x13, 0x07, 0x0000F800, PPC_NONE, PPC2_VSX207),#if defined(TARGET_PPC64 )GEN_HANDLER_E (mfvsrd,0x1F ,0x13 ,0x01 ,0x0000F800 ,PPC_NONE ,PPC2_VSX207 ),GEN_HANDLER_E (mtvsrd,0x1F ,0x13 ,0x05 ,0x0000F800 ,PPC_NONE ,PPC2_VSX207 ), +GEN_HANDLER_E (mfvsrld,0X1F ,0x13 ,0x09 ,0x0000F800 ,PPC_NONE ,PPC2_ISA300 ), #endif #define GEN_XX1FORM(name, opc2, opc3, fl2) \
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 16/29] target-ppc: add vector compare not equal instructions
In reply to David GibsonFrom: Rajalakshmi Srinivasaraghavan <[email protected]>
The following vector compare not equal instructions are added from ISA 3.0.
vcmpneb - Vector Compare Not Equal Byte
vcmpneh - Vector Compare Not Equal Halfword
vcmpnew - Vector Compare Not Equal Word
--- target-ppc/helper.h | 6 ++++++ target-ppc/int_helper.c | 31 +++++++++++++++++++------------ target-ppc/translate/vmx-impl.inc.c | 11 ++++++++++- target-ppc/translate/vmx-ops.inc.c | 6 +++--- 4 files changed, 38 insertions(+), 16 deletions(-)
target-ppc/helper.h +6 -0
@@ -147,6 +147,9 @@ DEF_HELPER_4(vcmpequb, void, env, avr, avr, avr) DEF_HELPER_4(vcmpequh, void, env, avr, avr, avr) DEF_HELPER_4(vcmpequw, void, env, avr, avr, avr) DEF_HELPER_4(vcmpequd, void, env, avr, avr, avr) +DEF_HELPER_4(vcmpneb, void, env, avr, avr, avr) +DEF_HELPER_4(vcmpneh, void, env, avr, avr, avr) +DEF_HELPER_4(vcmpnew, void, env, avr, avr, avr) DEF_HELPER_4(vcmpnezb, void, env, avr, avr, avr) DEF_HELPER_4(vcmpnezh, void, env, avr, avr, avr)DEF_HELPER_4 (vcmpnezw, void, env, avr, avr, avr)
@@ -166,6 +169,9 @@ DEF_HELPER_4(vcmpequb_dot, void, env, avr, avr, avr) DEF_HELPER_4(vcmpequh_dot, void, env, avr, avr, avr) DEF_HELPER_4(vcmpequw_dot, void, env, avr, avr, avr) DEF_HELPER_4(vcmpequd_dot, void, env, avr, avr, avr) +DEF_HELPER_4(vcmpneb_dot, void, env, avr, avr, avr) +DEF_HELPER_4(vcmpneh_dot, void, env, avr, avr, avr) +DEF_HELPER_4(vcmpnew_dot, void, env, avr, avr, avr) DEF_HELPER_4(vcmpnezb_dot, void, env, avr, avr, avr) DEF_HELPER_4(vcmpnezh_dot, void, env, avr, avr, avr)DEF_HELPER_4 (vcmpnezw_dot, void, env, avr, avr, avr)
target-ppc/int_helper.c +19 -12
@@ -735,20 +735,24 @@ VCMP(gtsd, >, s64)#undef VCMP_DO#undef VCMP -#define VCMPNEZ_DO (suffix, element, etype, record) \ -void helper_vcmpnez##suffix(CPUPPCState *env, ppc_avr_t *r, \ +#define VCMPNE_DO (suffix, element, etype, cmpzero, record) \ +void helper_vcmpne##suffix(CPUPPCState *env, ppc_avr_t *r, \ ppc_avr_t *a, ppc_avr_t *b) \ { \ etype ones = (etype)-1; \ etype all = ones; \ - etype none = 0; \ + etype result, none = 0; \ int i; \ \ for (i = 0; i < ARRAY_SIZE(r->element); i++) { \ - etype result = ((a->element[i] == 0) \ + if (cmpzero) { \ + result = ((a->element[i] == 0) \ || (b->element[i] == 0) \ || (a->element[i] != b->element[i]) ? \ ones : 0x0); \ + } else { \ + result = (a->element[i] != b->element[i]) ? ones : 0x0; \ + } \ r->element[i] = result; \ all &= result; \ none |= result; \
@@ -762,14 +766,17 @@ void helper_vcmpnez##suffix(CPUPPCState *env, ppc_avr_t *r, \* suffix - instruction mnemonic suffix (b: byte, h: halfword, w: word) * element - element type to access from vector */ -#define VCMPNEZ (suffix, element, etype) \ - VCMPNEZ_DO(suffix, element, etype, 0) \ - VCMPNEZ_DO(suffix##_dot, element, etype, 1) -VCMPNEZ(b, u8, uint8_t) -VCMPNEZ(h, u16, uint16_t) -VCMPNEZ(w, u32, uint32_t) -#undef VCMPNEZ_DO -#undef VCMPNEZ +#define VCMPNE (suffix, element, etype, cmpzero) \ + VCMPNE_DO(suffix, element, etype, cmpzero, 0) \ + VCMPNE_DO(suffix##_dot, element, etype, cmpzero, 1) +VCMPNE(zb, u8, uint8_t, 1) +VCMPNE(zh, u16, uint16_t, 1) +VCMPNE(zw, u32, uint32_t, 1) +VCMPNE(b, u8, uint8_t, 0) +VCMPNE(h, u16, uint16_t, 0) +VCMPNE(w, u32, uint32_t, 0) +#undef VCMPNE_DO +#undef VCMPNE#define VCMPFP_DO (suffix, compare, order, record) \ void helper_vcmp##suffix(CPUPPCState *env, ppc_avr_t *r, \
target-ppc/translate/vmx-impl.inc.c +10 -1
@@ -510,7 +510,16 @@ GEN_VXRFORM(vcmpeqfp, 3, 3) GEN_VXRFORM(vcmpgefp, 3, 7) GEN_VXRFORM(vcmpgtfp, 3, 11) GEN_VXRFORM(vcmpbfp, 3, 15) - +GEN_VXRFORM(vcmpneb, 3, 0) +GEN_VXRFORM(vcmpneh, 3, 1) +GEN_VXRFORM(vcmpnew, 3, 2) + +GEN_VXRFORM_DUAL (vcmpequb,PPC_NONE ,PPC2_ALTIVEC_207 , \ + vcmpneb, PPC_NONE, PPC2_ISA300) +GEN_VXRFORM_DUAL (vcmpequh,PPC_NONE ,PPC2_ALTIVEC_207 , \ + vcmpneh, PPC_NONE, PPC2_ISA300) +GEN_VXRFORM_DUAL (vcmpequw,PPC_NONE ,PPC2_ALTIVEC_207 , \ + vcmpnew, PPC_NONE, PPC2_ISA300)GEN_VXRFORM_DUAL (vcmpeqfp,PPC_ALTIVEC ,PPC_NONE , \ vcmpequd, PPC_NONE, PPC2_ALTIVEC_207) GEN_VXRFORM_DUAL(vcmpbfp, PPC_ALTIVEC, PPC_NONE, \
target-ppc/translate/vmx-ops.inc.c +3 -3
@@ -181,9 +181,6 @@ GEN_HANDLER2_E(name, str, 0x4, opc2, opc3, 0x00000000, PPC_NONE, PPC2_ISA300), GEN_VXRFORM1_300(name, name, #name, opc2, opc3) \ GEN_VXRFORM1_300(name##_dot, name##_, #name ".", opc2, (opc3 | (0x1 << 4))) -GEN_VXRFORM(vcmpequb, 3, 0) -GEN_VXRFORM(vcmpequh, 3, 1) -GEN_VXRFORM(vcmpequw, 3, 2) GEN_VXRFORM_300(vcmpnezb, 3, 4) GEN_VXRFORM_300(vcmpnezh, 3, 5)GEN_VXRFORM_300 (vcmpnezw,3 ,6 )
@@ -197,6 +194,9 @@ GEN_VXRFORM_DUAL(vcmpeqfp, vcmpequd, 3, 3, PPC_ALTIVEC, PPC_NONE) GEN_VXRFORM(vcmpgefp, 3, 7) GEN_VXRFORM_DUAL(vcmpgtfp, vcmpgtud, 3, 11, PPC_ALTIVEC, PPC_NONE) GEN_VXRFORM_DUAL(vcmpbfp, vcmpgtsd, 3, 15, PPC_ALTIVEC, PPC_NONE) +GEN_VXRFORM_DUAL(vcmpequb, vcmpneb, 3, 0, PPC_NONE, PPC2_ALTIVEC_207) +GEN_VXRFORM_DUAL(vcmpequh, vcmpneh, 3, 1, PPC_NONE, PPC2_ALTIVEC_207) +GEN_VXRFORM_DUAL(vcmpequw, vcmpnew, 3, 2, PPC_NONE, PPC2_ALTIVEC_207)#define GEN_VXFORM_DUAL_INV (name0, name1, opc2, opc3, inval0, inval1, type) \ GEN_OPCODE_DUAL(name0##_##name1, 0x04, opc2, opc3, inval0, inval1, type, \
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 04/29] hw/ppc/spapr: Move code related to "ibm, pa-features" to a separate function
In reply to David GibsonFrom: Thomas Huth <[email protected]>
The function spapr_populate_cpu_dt() has become quite big already, and since we likely have to extend the pa-features property for every new processor generation, it is nicer if we put the related code into a separate function.
--- hw/ppc/spapr.c | 66 ++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 36 insertions(+), 30 deletions(-)
hw/ppc/spapr.c +36 -30
@@ -546,6 +546,41 @@ static int spapr_populate_memory(sPAPRMachineState *spapr, void *fdt)return 0 ; } +/* Populate the "ibm,pa-features" property */ +static void spapr_populate_pa_features (CPUPPCState *env,void *fdt,int offset) +{ +uint8_t pa_features_206[] = {6 ,0 , +0xf6 ,0x1f ,0xc7 ,0x00 ,0x80 ,0xc0 }; +uint8_t pa_features_207[] = {24 ,0 , +0xf6 ,0x1f ,0xc7 ,0xc0 ,0x80 ,0xf0 , +0x80 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 , +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 }; +uint8_t *pa_features; +size_t pa_size; + +if (env->mmu_model ==POWERPC_MMU_2_06 ) { + pa_features = pa_features_206; + pa_size =sizeof (pa_features_206); + }else {/* env->mmu_model == POWERPC_MMU_2_07 */ + pa_features = pa_features_207; + pa_size =sizeof (pa_features_207); + } + +if (env->ci_large_pages) { +/* +* Note: we keep CI large pages off by default because a 64K capable +* guest provisioned with large pages might otherwise try to map a qemu +* framebuffer (or other kind of memory mapped PCI BAR) using 64K pages +* even if that qemu runs on a 4k host. +* We dd this bit back here if we are confident this is not an issue +*/ + pa_features[3 ] |=0x20 ; + } + +_FDT ((fdt_setprop (fdt, offset,"ibm,pa-features" , pa_features, pa_size))); +} +static void spapr_populate_cpu_dt (CPUState *cs,void *fdt,int offset,sPAPRMachineState *spapr) {
@@ -573,24 +608,6 @@ static void spapr_populate_cpu_dt(CPUState *cs, void *fdt, int offset,_FDT ((fdt_setprop_cell (fdt, offset,"ibm,my-drc-index" , drc_index))); } -/* Note: we keep CI large pages off for now because a 64K capable guest -* provisioned with large pages might otherwise try to map a qemu -* framebuffer (or other kind of memory mapped PCI BAR) using 64K pages -* even if that qemu runs on a 4k host. -* -* We can later add this bit back when we are confident this is not -* an issue (!HV KVM or 64K host) -*/ -uint8_t pa_features_206[] = {6 ,0 , -0xf6 ,0x1f ,0xc7 ,0x00 ,0x80 ,0xc0 }; -uint8_t pa_features_207[] = {24 ,0 , -0xf6 ,0x1f ,0xc7 ,0xc0 ,0x80 ,0xf0 , -0x80 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , -0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 , -0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 }; -uint8_t *pa_features; -size_t pa_size; -_FDT ((fdt_setprop_cell (fdt, offset,"reg" , index)));_FDT ((fdt_setprop_string (fdt, offset,"device_type" ,"cpu" )));
@@ -657,18 +674,7 @@ static void spapr_populate_cpu_dt(CPUState *cs, void *fdt, int offset, page_sizes_prop, page_sizes_prop_size))); } -/* Do the ibm,pa-features property, adjust it for ci-large-pages */ -if (env->mmu_model ==POWERPC_MMU_2_06 ) { - pa_features = pa_features_206; - pa_size =sizeof (pa_features_206); - }else /* env->mmu_model == POWERPC_MMU_2_07 */ { - pa_features = pa_features_207; - pa_size =sizeof (pa_features_207); - } -if (env->ci_large_pages) { - pa_features[3 ] |=0x20 ; - } -_FDT ((fdt_setprop (fdt, offset,"ibm,pa-features" , pa_features, pa_size))); +spapr_populate_pa_features (env, fdt, offset);_FDT ((fdt_setprop_cell (fdt, offset,"ibm,chip-id" , cs->cpu_index / vcpus_per_socket)));
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 09/29] target-ppc: improve lxvw4x implementation
In reply to David GibsonFrom: Nikunj A Dadhania <[email protected]>
Load 8byte at a time and manipulate.
Big-Endian Storage
+-------------+-------------+-------------+-------------+ | 00 11 22 33 | 44 55 66 77 | 88 99 AA BB | CC DD EE FF | +-------------+-------------+-------------+-------------+
Little-Endian Storage
+-------------+-------------+-------------+-------------+ | 33 22 11 00 | 77 66 55 44 | BB AA 99 88 | FF EE DD CC | +-------------+-------------+-------------+-------------+
Vector load results in (32-bit elements):
+----------+----------+----------+----------+ | 00112233 | 44556677 | 8899AABB | CCDDEEFF | +----------+----------+----------+----------+
--- target-ppc/translate/vsx-impl.inc.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-)
target-ppc/translate/vsx-impl.inc.c +18 -14
@@ -75,7 +75,6 @@ static void gen_lxvdsx(DisasContext *ctx)static void gen_lxvw4x (DisasContext *ctx) {TCGv EA ; -TCGv_i64 tmp;TCGv_i64 xth =cpu_vsrh (xT (ctx->opcode));TCGv_i64 xtl =cpu_vsrl (xT (ctx->opcode));if (unlikely (!ctx->vsx_enabled)) {
@@ -84,22 +83,27 @@ static void gen_lxvw4x(DisasContext *ctx) }gen_set_access_type (ctx,ACCESS_INT );EA =tcg_temp_new (); - tmp =tcg_temp_new_i64 ();gen_addr_reg_index (ctx,EA ); -gen_qemu_ld32u_i64 (ctx, tmp,EA ); -tcg_gen_addi_tl (EA ,EA ,4 ); -gen_qemu_ld32u_i64 (ctx, xth,EA ); -tcg_gen_deposit_i64 (xth, xth, tmp,32 ,32 ); - -tcg_gen_addi_tl (EA ,EA ,4 ); -gen_qemu_ld32u_i64 (ctx, tmp,EA ); -tcg_gen_addi_tl (EA ,EA ,4 ); -gen_qemu_ld32u_i64 (ctx, xtl,EA ); -tcg_gen_deposit_i64 (xtl, xtl, tmp,32 ,32 ); - +if (ctx->le_mode) { +TCGv_i64 t0 =tcg_temp_new_i64 (); +TCGv_i64 t1 =tcg_temp_new_i64 (); + +tcg_gen_qemu_ld_i64 (t0,EA , ctx->mem_idx,MO_LEQ ); +tcg_gen_shri_i64 (t1, t0,32 ); +tcg_gen_deposit_i64 (xth, t1, t0,32 ,32 ); +tcg_gen_addi_tl (EA ,EA ,8 ); +tcg_gen_qemu_ld_i64 (t0,EA , ctx->mem_idx,MO_LEQ ); +tcg_gen_shri_i64 (t1, t0,32 ); +tcg_gen_deposit_i64 (xtl, t1, t0,32 ,32 ); +tcg_temp_free_i64 (t0); +tcg_temp_free_i64 (t1); + }else { +tcg_gen_qemu_ld_i64 (xth,EA , ctx->mem_idx,MO_BEQ ); +tcg_gen_addi_tl (EA ,EA ,8 ); +tcg_gen_qemu_ld_i64 (xtl,EA , ctx->mem_idx,MO_BEQ ); + }tcg_temp_free (EA ); -tcg_temp_free_i64 (tmp); }#define VSX_STORE_SCALAR (name, operation) \
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 10/29] target-ppc: improve stxvw4x implementation
In reply to David GibsonFrom: Nikunj A Dadhania <[email protected]>
Manipulate data and store 8bytes instead of 4bytes.
Vector (32-bit elements):
+----------+----------+----------+----------+ | 00112233 | 44556677 | 8899AABB | CCDDEEFF | +----------+----------+----------+----------+
Store results in following:
Big-Endian Storage
+-------------+-------------+-------------+-------------+ | 00 11 22 33 | 44 55 66 77 | 88 99 AA BB | CC DD EE FF | +-------------+-------------+-------------+-------------+
Little-Endian Storage
+-------------+-------------+-------------+-------------+ | 33 22 11 00 | 77 66 55 44 | BB AA 99 88 | FF EE DD CC | +-------------+-------------+-------------+-------------+
--- target-ppc/translate/vsx-impl.inc.c | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-)
target-ppc/translate/vsx-impl.inc.c +19 -14
@@ -146,7 +146,8 @@ static void gen_stxvd2x(DisasContext *ctx)static void gen_stxvw4x (DisasContext *ctx) { -TCGv_i64 tmp; +TCGv_i64 xsh =cpu_vsrh (xS (ctx->opcode)); +TCGv_i64 xsl =cpu_vsrl (xS (ctx->opcode));TCGv EA ;if (unlikely (!ctx->vsx_enabled)) {gen_exception (ctx,POWERPC_EXCP_VSXU );
@@ -155,21 +156,25 @@ static void gen_stxvw4x(DisasContext *ctx)gen_set_access_type (ctx,ACCESS_INT );EA =tcg_temp_new ();gen_addr_reg_index (ctx,EA ); - tmp =tcg_temp_new_i64 (); - -tcg_gen_shri_i64 (tmp,cpu_vsrh (xS (ctx->opcode)),32 ); -gen_qemu_st32_i64 (ctx, tmp,EA ); -tcg_gen_addi_tl (EA ,EA ,4 ); -gen_qemu_st32_i64 (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_i64 (ctx, tmp,EA ); -tcg_gen_addi_tl (EA ,EA ,4 ); -gen_qemu_st32_i64 (ctx,cpu_vsrl (xS (ctx->opcode)),EA ); +if (ctx->le_mode) { +TCGv_i64 t0 =tcg_temp_new_i64 (); +TCGv_i64 t1 =tcg_temp_new_i64 (); +tcg_gen_shri_i64 (t0, xsh,32 ); +tcg_gen_deposit_i64 (t1, t0, xsh,32 ,32 ); +tcg_gen_qemu_st_i64 (t1,EA , ctx->mem_idx,MO_LEQ ); +tcg_gen_addi_tl (EA ,EA ,8 ); +tcg_gen_shri_i64 (t0, xsl,32 ); +tcg_gen_deposit_i64 (t1, t0, xsl,32 ,32 ); +tcg_gen_qemu_st_i64 (t1,EA , ctx->mem_idx,MO_LEQ ); +tcg_temp_free_i64 (t0); +tcg_temp_free_i64 (t1); + }else { +tcg_gen_qemu_st_i64 (xsh,EA , ctx->mem_idx,MO_BEQ ); +tcg_gen_addi_tl (EA ,EA ,8 ); +tcg_gen_qemu_st_i64 (xsl,EA , ctx->mem_idx,MO_BEQ ); + }tcg_temp_free (EA ); -tcg_temp_free_i64 (tmp); }#define MV_VSRW (name, tcgop1, tcgop2, target, source) \
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 14/29] target-ppc: add stxvb16x instruction
In reply to David GibsonFrom: Nikunj A Dadhania <[email protected]>
stxvb16x: Store VSX Vector Byte*16
Vector (8-bit elements):
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |F0|F1|F2|F3|F4|F5|F6|F7|E0|E1|E2|E3|E4|E5|E6|E7| +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
Store results in following:
Little/Big-endian Storage
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |F0|F1|F2|F3|F4|F5|F6|F7|E0|E1|E2|E3|E4|E5|E6|E7| +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
--- target-ppc/translate/vsx-impl.inc.c | 19 +++++++++++++++++++ target-ppc/translate/vsx-ops.inc.c | 1 + 2 files changed, 20 insertions(+)
target-ppc/translate/vsx-impl.inc.c +19 -0
@@ -276,6 +276,25 @@ static void gen_stxvh8x(DisasContext *ctx)tcg_temp_free (EA ); } +static void gen_stxvb16x (DisasContext *ctx) +{ +TCGv_i64 xsh =cpu_vsrh (xS (ctx->opcode)); +TCGv_i64 xsl =cpu_vsrl (xS (ctx->opcode)); +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 ); +tcg_gen_qemu_st_i64 (xsh,EA , ctx->mem_idx,MO_BEQ ); +tcg_gen_addi_tl (EA ,EA ,8 ); +tcg_gen_qemu_st_i64 (xsl,EA , ctx->mem_idx,MO_BEQ ); +tcg_temp_free (EA ); +} +#define MV_VSRW (name, tcgop1, tcgop2, target, source) \ static void gen_##name(DisasContext *ctx) \ { \
target-ppc/translate/vsx-ops.inc.c +1 -0
@@ -18,6 +18,7 @@ GEN_HANDLER_E(stxsspx, 0x1F, 0xC, 0x14, 0, PPC_NONE, PPC2_VSX207),GEN_HANDLER_E (stxvd2x,0x1F ,0xC ,0x1E ,0 ,PPC_NONE ,PPC2_VSX ),GEN_HANDLER_E (stxvw4x,0x1F ,0xC ,0x1C ,0 ,PPC_NONE ,PPC2_VSX ),GEN_HANDLER_E (stxvh8x,0x1F ,0x0C ,0x1D ,0 ,PPC_NONE ,PPC2_ISA300 ), +GEN_HANDLER_E (stxvb16x,0x1F ,0x0C ,0x1F ,0 ,PPC_NONE ,PPC2_ISA300 ),GEN_HANDLER_E (mfvsrwz,0x1F ,0x13 ,0x03 ,0x0000F800 ,PPC_NONE ,PPC2_VSX207 ), GEN_HANDLER_E(mtvsrwa, 0x1F, 0x13, 0x06, 0x0000F800, PPC_NONE, PPC2_VSX207),
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 15/29] target-ppc: fix invalid mask - cmpl, bctar
In reply to David GibsonFrom: Avinesh Kumar <[email protected]>
cmpl: invalid bit mask should be 0x00400001 bctar: invalid bit mask should be 0x0000E000
--- target-ppc/translate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
target-ppc/translate.c +2 -2
@@ -6203,7 +6203,7 @@ static opcode_t opcodes[] = { GEN_HANDLER(invalid, 0x00, 0x00, 0x00, 0xFFFFFFFF, PPC_NONE), GEN_HANDLER(cmp, 0x1F, 0x00, 0x00, 0x00400000, PPC_INTEGER), GEN_HANDLER(cmpi, 0x0B, 0xFF, 0xFF, 0x00400000, PPC_INTEGER), -GEN_HANDLER(cmpl, 0x1F, 0x00, 0x01, 0x00400000, PPC_INTEGER), +GEN_HANDLER(cmpl, 0x1F, 0x00, 0x01, 0x00400001, PPC_INTEGER), GEN_HANDLER(cmpli, 0x0A, 0xFF, 0xFF, 0x00400000, PPC_INTEGER),#if defined(TARGET_PPC64 ) GEN_HANDLER_E(cmpeqb, 0x1F, 0x00, 0x07, 0x00600000, PPC_NONE, PPC2_ISA300),
@@ -6297,7 +6297,7 @@ GEN_HANDLER(b, 0x12, 0xFF, 0xFF, 0x00000000, PPC_FLOW),GEN_HANDLER (bc,0x10 ,0xFF ,0xFF ,0x00000000 ,PPC_FLOW ),GEN_HANDLER (bcctr,0x13 ,0x10 ,0x10 ,0x00000000 ,PPC_FLOW ),GEN_HANDLER (bclr,0x13 ,0x10 ,0x00 ,0x00000000 ,PPC_FLOW ), -GEN_HANDLER_E (bctar,0x13 ,0x10 ,0x11 ,0 ,PPC_NONE ,PPC2_BCTAR_ISA207 ), +GEN_HANDLER_E (bctar,0x13 ,0x10 ,0x11 ,0x0000E000 ,PPC_NONE ,PPC2_BCTAR_ISA207 ),GEN_HANDLER (mcrf,0x13 ,0x00 ,0xFF ,0x00000001 ,PPC_INTEGER ),GEN_HANDLER (rfi,0x13 ,0x12 ,0x01 ,0x03FF8001 ,PPC_FLOW ), #if defined(TARGET_PPC64)
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 05/29] hw/ppc/spapr: Fix the selection of the processor features
In reply to David GibsonFrom: Thomas Huth <[email protected]>
The current code uses pa_features_206 for POWERPC_MMU_2_06, and for everything else, it uses pa_features_207. This is bad in some cases because there is also a "degraded" MMU version of ISA 2.06, called POWERPC_MMU_2_06a, which should of course use the flags for 2.06 instead. And there is also the possibility that the user runs the pseries machine with a POWER5+ or even 970 processor. In that case we certainly do not want to set the flags for 2.07, and rather simply skip the setting of the pa-features property instead.
--- hw/ppc/spapr.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
hw/ppc/spapr.c +9 -2
@@ -559,12 +559,19 @@ static void spapr_populate_pa_features(CPUPPCState *env, void *fdt, int offset)uint8_t *pa_features;size_t pa_size; -if (env->mmu_model ==POWERPC_MMU_2_06 ) { +switch (env->mmu_model) { +case POWERPC_MMU_2_06 : +case POWERPC_MMU_2_06a: pa_features = pa_features_206; pa_size =sizeof (pa_features_206); - }else {/* env->mmu_model == POWERPC_MMU_2_07 */ +break ; +case POWERPC_MMU_2_07 : +case POWERPC_MMU_2_07a: pa_features = pa_features_207; pa_size =sizeof (pa_features_207); +break ; +default : +return ; }if (env->ci_large_pages) {
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 08/29] target-ppc: Implement mtvsrdd instruction
In reply to David GibsonFrom: Ravi Bangoria <[email protected]>
mtvsrdd: Move To VSR Double Doubleword
--- target-ppc/translate/vsx-impl.inc.c | 23 +++++++++++++++++++++++ target-ppc/translate/vsx-ops.inc.c | 1 + 2 files changed, 24 insertions(+)
target-ppc/translate/vsx-impl.inc.c +23 -0
@@ -234,6 +234,29 @@ static void gen_mfvsrld(DisasContext *ctx)tcg_gen_mov_i64 (cpu_gpr[rA (ctx->opcode)],cpu_vsrl (xS (ctx->opcode))); } +static void gen_mtvsrdd (DisasContext *ctx) +{ +if (xT (ctx->opcode) <32 ) { +if (unlikely (!ctx->vsx_enabled)) { +gen_exception (ctx,POWERPC_EXCP_VSXU ); +return ; + } + }else { +if (unlikely (!ctx->altivec_enabled)) { +gen_exception (ctx,POWERPC_EXCP_VPU ); +return ; + } + } + +if (!rA (ctx->opcode)) { +tcg_gen_movi_i64 (cpu_vsrh (xT (ctx->opcode)),0 ); + }else { +tcg_gen_mov_i64 (cpu_vsrh (xT (ctx->opcode)), cpu_gpr[rA (ctx->opcode)]); + } + +tcg_gen_mov_i64 (cpu_vsrl (xT (ctx->opcode)), cpu_gpr[rB (ctx->opcode)]); +} +#endif static void gen_xxpermdi (DisasContext *ctx)
target-ppc/translate/vsx-ops.inc.c +1 -0
@@ -23,6 +23,7 @@ GEN_HANDLER_E(mtvsrwz, 0x1F, 0x13, 0x07, 0x0000F800, PPC_NONE, PPC2_VSX207),GEN_HANDLER_E (mfvsrd,0x1F ,0x13 ,0x01 ,0x0000F800 ,PPC_NONE ,PPC2_VSX207 ),GEN_HANDLER_E (mtvsrd,0x1F ,0x13 ,0x05 ,0x0000F800 ,PPC_NONE ,PPC2_VSX207 ),GEN_HANDLER_E (mfvsrld,0X1F ,0x13 ,0x09 ,0x0000F800 ,PPC_NONE ,PPC2_ISA300 ), +GEN_HANDLER_E (mtvsrdd,0X1F ,0x13 ,0x0D ,0x0 ,PPC_NONE ,PPC2_ISA300 ), #endif #define GEN_XX1FORM(name, opc2, opc3, fl2) \
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 01/29] spapr_vscsi: fix build error introduced by f19661c8
In reply to David GibsonFrom: Felipe Franciosi <[email protected]>
A typo introduced in f19661c8 prevents qemu from building when configured with --enable-trace-backend=dtrace.
--- hw/scsi/spapr_vscsi.c | 2 +- hw/scsi/trace-events | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
hw/scsi/spapr_vscsi.c +1 -1
@@ -658,7 +658,7 @@ static void vscsi_process_login(VSCSIState *s, vscsi_req *req)struct srp_login_rsp *rsp = &iu->srp.login_rsp;uint64_t tag = iu->srp.rsp.tag; -trace_spapr_vscsi__process_login (); +trace_spapr_vscsi_process_login ();/* TODO handle case that requested size is wrong and * buffer format is wrong
hw/scsi/trace-events +1 -1
@@ -225,7 +225,7 @@ spapr_vscsi_command_complete_sense_data2(unsigned s8, unsigned s9, unsigned s10, spapr_vscsi_command_complete_status(uint32_t status) "Command complete err=%"PRIu32 spapr_vscsi_save_request(uint32_t qtag, unsigned desc, unsigned offset) "saving tag=%"PRIu32", current desc#%u, offset=0x%x" spapr_vscsi_load_request(uint32_t qtag, unsigned desc, unsigned offset) "restoring tag=%"PRIu32", current desc#%u, offset=0x%x" -spapr_vscsi__process_login(void) "Got login, sending response !" +spapr_vscsi_process_login(void) "Got login, sending response !" spapr_vscsi_queue_cmd_no_drive(uint64_t lun) "Command for lun %08" PRIx64 " with no drive" spapr_vscsi_queue_cmd(uint32_t qtag, unsigned cdb, const char *cmd, int lun, int ret) "Queued command tag 0x%"PRIx32" CMD 0x%x=%s LUN %d ret: %d" spapr_vscsi_do_crq(unsigned c0, unsigned c1) "crq: %02x %02x ..."
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 11/29] target-ppc: add lxvh8x instruction
In reply to David GibsonFrom: Nikunj A Dadhania <[email protected]>
lxvh8x: Load VSX Vector Halfword*8
Big-Endian Storage
+-------+-------+-------+-------+-------+-------+-------+-------+ | 00 01 | 10 11 | 20 21 | 30 31 | 40 41 | 50 51 | 60 61 | 70 71 | +-------+-------+-------+-------+-------+-------+-------+-------+
Little-Endian Storage
+-------+-------+-------+-------+-------+-------+-------+-------+ | 01 00 | 11 10 | 21 20 | 31 30 | 41 40 | 51 50 | 61 60 | 71 70 | +-------+-------+-------+-------+-------+-------+-------+-------+
Vector load results in (16-bit elements):
+------+------+------+------+------+------+------+------+ | 0001 | 1011 | 2021 | 3031 | 4041 | 5051 | 6061 | 7071 | +------+------+------+------+------+------+------+------+
--- target-ppc/translate/vsx-impl.inc.c | 49 +++++++++++++++++++++++++++++++++++++ target-ppc/translate/vsx-ops.inc.c | 1 + 2 files changed, 50 insertions(+)
target-ppc/translate/vsx-impl.inc.c +49 -0
@@ -106,6 +106,55 @@ static void gen_lxvw4x(DisasContext *ctx)tcg_temp_free (EA ); } +static void gen_bswap16x8 (TCGv_i64 outh,TCGv_i64 outl, +TCGv_i64 inh,TCGv_i64 inl) +{ +TCGv_i64 mask =tcg_const_i64 (0x00FF00FF00FF00FF ); +TCGv_i64 t0 =tcg_temp_new_i64 (); +TCGv_i64 t1 =tcg_temp_new_i64 (); + +/* outh = ((inh & mask) << 8) | ((inh >> 8) & mask) */ +tcg_gen_and_i64 (t0, inh, mask); +tcg_gen_shli_i64 (t0, t0,8 ); +tcg_gen_shri_i64 (t1, inh,8 ); +tcg_gen_and_i64 (t1, t1, mask); +tcg_gen_or_i64 (outh, t0, t1); + +/* outl = ((inl & mask) << 8) | ((inl >> 8) & mask) */ +tcg_gen_and_i64 (t0, inl, mask); +tcg_gen_shli_i64 (t0, t0,8 ); +tcg_gen_shri_i64 (t1, inl,8 ); +tcg_gen_and_i64 (t1, t1, mask); +tcg_gen_or_i64 (outl, t0, t1); + +tcg_temp_free_i64 (t0); +tcg_temp_free_i64 (t1); +tcg_temp_free_i64 (mask); +} + +static void gen_lxvh8x (DisasContext *ctx) +{ +TCGv EA ; +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 (); +gen_addr_reg_index (ctx,EA ); +tcg_gen_qemu_ld_i64 (xth,EA , ctx->mem_idx,MO_BEQ ); +tcg_gen_addi_tl (EA ,EA ,8 ); +tcg_gen_qemu_ld_i64 (xtl,EA , ctx->mem_idx,MO_BEQ ); +if (ctx->le_mode) { +gen_bswap16x8 (xth, xtl, xth, xtl); + } +tcg_temp_free (EA ); +} +#define VSX_STORE_SCALAR (name, operation) \ static void gen_##name(DisasContext *ctx) \ { \
target-ppc/translate/vsx-ops.inc.c +1 -0
@@ -7,6 +7,7 @@ GEN_HANDLER_E(lxsspx, 0x1F, 0x0C, 0x10, 0, PPC_NONE, PPC2_VSX207),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 (lxvh8x,0x1F ,0x0C ,0x19 ,0 ,PPC_NONE ,PPC2_ISA300 ),GEN_HANDLER_E (stxsdx,0x1F ,0xC ,0x16 ,0 ,PPC_NONE ,PPC2_VSX ), GEN_HANDLER_E(stxsibx, 0x1F, 0xD, 0x1C, 0, PPC_NONE, PPC2_ISA300),
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 17/29] target-ppc: add vclzlsbb/vctzlsbb instructions
In reply to David GibsonFrom: Rajalakshmi Srinivasaraghavan <[email protected]>
The following vector instructions are added from ISA 3.0.
vclzlsbb - Vector Count Leading Zero Least-Significant Bits Byte vctzlsbb - Vector Count Trailing Zero Least-Significant Bits Byte
--- target-ppc/helper.h | 2 ++ target-ppc/int_helper.c | 30 ++++++++++++++++++++++++++++++ target-ppc/translate/vmx-impl.inc.c | 14 ++++++++++++++ target-ppc/translate/vmx-ops.inc.c | 2 ++ 4 files changed, 48 insertions(+)
target-ppc/helper.h +2 -0
@@ -343,6 +343,8 @@ DEF_HELPER_2(vpopcntb, void, avr, avr) DEF_HELPER_2(vpopcnth, void, avr, avr) DEF_HELPER_2(vpopcntw, void, avr, avr) DEF_HELPER_2(vpopcntd, void, avr, avr) +DEF_HELPER_1(vclzlsbb, tl, avr) +DEF_HELPER_1(vctzlsbb, tl, avr) DEF_HELPER_3(vbpermd, void, avr, avr, avr) DEF_HELPER_3(vbpermq, void, avr, avr, avr)DEF_HELPER_2 (vgbbd, void, avr, avr)
target-ppc/int_helper.c +30 -0
@@ -881,6 +881,36 @@ VCT(uxs, cvtsduw, u32) VCT(sxs, cvtsdsw, s32)#undef VCT +target_ulong helper_vclzlsbb (ppc_avr_t *r) +{ +target_ulong count =0 ; +int i; + VECTOR_FOR_INORDER_I(i, u8) { +if (r->u8[i] &0x01 ) { +break ; + } + count++; + } +return count; +} + +target_ulong helper_vctzlsbb (ppc_avr_t *r) +{ +target_ulong count =0 ; +int i; +#if defined(HOST_WORDS_BIGENDIAN ) +for (i =ARRAY_SIZE (r->u8) -1 ; i >=0 ; i--) { +#else +for (i =0 ; i <ARRAY_SIZE (r->u8); i++) { +#endif +if (r->u8[i] &0x01 ) { +break ; + } + count++; + } +return count; +} +void helper_vmhaddshs (CPUPPCState *env,ppc_avr_t *r,ppc_avr_t *a,ppc_avr_t *b,ppc_avr_t *c) {
target-ppc/translate/vmx-impl.inc.c +14 -0
@@ -593,6 +593,18 @@ static void glue(gen_, name)(DisasContext *ctx) \tcg_temp_free_ptr (rd); \ } +#define GEN_VXFORM_NOA_3 (name, opc2, opc3, opc4) \ +static void glue(gen_, name)(DisasContext *ctx) \ + { \ + TCGv_ptr rb; \ + if (unlikely(!ctx->altivec_enabled)) { \ + gen_exception(ctx, POWERPC_EXCP_VPU); \ + return; \ + } \ + rb = gen_avr_ptr(rB(ctx->opcode)); \ + gen_helper_##name(cpu_gpr[rD(ctx->opcode)], rb); \ + tcg_temp_free_ptr(rb); \ + }GEN_VXFORM_NOA (vupkhsb,7 ,8 );GEN_VXFORM_NOA (vupkhsh,7 ,9 );GEN_VXFORM_NOA (vupkhsw,7 ,25 );
@@ -807,6 +819,8 @@ GEN_VXFORM_NOA_2(vctzb, 1, 24, 28) GEN_VXFORM_NOA_2(vctzh, 1, 24, 29) GEN_VXFORM_NOA_2(vctzw, 1, 24, 30) GEN_VXFORM_NOA_2(vctzd, 1, 24, 31) +GEN_VXFORM_NOA_3(vclzlsbb, 1, 24, 0) +GEN_VXFORM_NOA_3(vctzlsbb, 1, 24, 1) GEN_VXFORM_NOA(vpopcntb, 1, 28) GEN_VXFORM_NOA(vpopcnth, 1, 29)GEN_VXFORM_NOA (vpopcntw,1 ,30 )
target-ppc/translate/vmx-ops.inc.c +2 -0
@@ -219,6 +219,8 @@ GEN_VXFORM_300_EO(vctzb, 0x01, 0x18, 0x1C),GEN_VXFORM_300_EO (vctzh,0x01 ,0x18 ,0x1D ),GEN_VXFORM_300_EO (vctzw,0x01 ,0x18 ,0x1E ),GEN_VXFORM_300_EO (vctzd,0x01 ,0x18 ,0x1F ), +GEN_VXFORM_300_EO (vclzlsbb,0x01 ,0x18 ,0x0 ), +GEN_VXFORM_300_EO (vctzlsbb,0x01 ,0x18 ,0x1 ),GEN_VXFORM_300 (vpermr,0x1D ,0xFF ), #define GEN_VXFORM_NOA(name, opc2, opc3) \
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 03/29] pseries: Add 2.8 machine type, set up compatibility macros
In reply to David GibsonNow that 2.7 is released, create the pseries-2.8 machine type and add the boilerplate compatiblity macro stuff. There's nothing new to put into the 2.7 compatiliby properties yet, but we'll need something eventually, so we might as well get it ready now.
--- hw/ppc/spapr.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)
hw/ppc/spapr.c +20 -2
@@ -2437,18 +2437,36 @@ static const TypeInfo spapr_machine_info = { type_init(spapr_machine_register_##suffix)/* +* pseries-2.8 +*/ +static void spapr_machine_2_8_instance_options(MachineState *machine) +{ +} + +static void spapr_machine_2_8_class_options (MachineClass *mc) +{ +/* Defaults for the latest behaviour inherited from the base class */ +} + +DEFINE_SPAPR_MACHINE(2_8, "2.8", true); + +/* * pseries-2.7 */ +#define SPAPR_COMPAT_2_7 \ + HW_COMPAT_2_7 \ +static void spapr_machine_2_7_instance_options (MachineState *machine) { }static void spapr_machine_2_7_class_options (MachineClass *mc) { -/* Defaults for the latest behaviour inherited from the base class */ +spapr_machine_2_8_class_options (mc); +SET_MACHINE_COMPAT (mc,SPAPR_COMPAT_2_7 ); } -DEFINE_SPAPR_MACHINE(2_7, "2.7", true); +DEFINE_SPAPR_MACHINE(2_7, "2.7", false);/* * pseries-2.6
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 13/29] target-ppc: add lxvb16x instruction
In reply to David GibsonFrom: Nikunj A Dadhania <[email protected]>
lxvb16x: Load VSX Vector Byte*16
Little/Big-endian Storage
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |F0|F1|F2|F3|F4|F5|F6|F7|E0|E1|E2|E3|E4|E5|E6|E7| +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
Vector load results in (8-bit elements):
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |F0|F1|F2|F3|F4|F5|F6|F7|E0|E1|E2|E3|E4|E5|E6|E7| +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
--- target-ppc/translate/vsx-impl.inc.c | 19 +++++++++++++++++++ target-ppc/translate/vsx-ops.inc.c | 1 + 2 files changed, 20 insertions(+)
target-ppc/translate/vsx-impl.inc.c +19 -0
@@ -155,6 +155,25 @@ static void gen_lxvh8x(DisasContext *ctx)tcg_temp_free (EA ); } +static void gen_lxvb16x (DisasContext *ctx) +{ +TCGv EA ; +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 (); +gen_addr_reg_index (ctx,EA ); +tcg_gen_qemu_ld_i64 (xth,EA , ctx->mem_idx,MO_BEQ ); +tcg_gen_addi_tl (EA ,EA ,8 ); +tcg_gen_qemu_ld_i64 (xtl,EA , ctx->mem_idx,MO_BEQ ); +tcg_temp_free (EA ); +} +#define VSX_STORE_SCALAR (name, operation) \ static void gen_##name(DisasContext *ctx) \ { \
target-ppc/translate/vsx-ops.inc.c +1 -0
@@ -8,6 +8,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 (lxvh8x,0x1F ,0x0C ,0x19 ,0 ,PPC_NONE ,PPC2_ISA300 ), +GEN_HANDLER_E (lxvb16x,0x1F ,0x0C ,0x1B ,0 ,PPC_NONE ,PPC2_ISA300 ),GEN_HANDLER_E (stxsdx,0x1F ,0xC ,0x16 ,0 ,PPC_NONE ,PPC2_VSX ), GEN_HANDLER_E(stxsibx, 0x1F, 0xD, 0x1C, 0, PPC_NONE, PPC2_ISA300),
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 06/29] ppc: Check the availability of transactional memory
In reply to David GibsonFrom: Thomas Huth <[email protected]>
KVM-PR currently does not support transactional memory, and the implementation in TCG is just a fake. We should not announce TM support in the ibm,pa-features property when running on such a system, so disable it by default and only enable it if the KVM implementation supports it (i.e. recent versions of KVM-HV). These changes are based on some earlier work from Anton Blanchard (thanks!).
--- hw/ppc/spapr.c | 5 ++++- target-ppc/kvm.c | 7 +++++++ target-ppc/kvm_ppc.h | 6 ++++++ 3 files changed, 17 insertions(+), 1 deletion(-)
hw/ppc/spapr.c +4 -1
@@ -555,7 +555,7 @@ static void spapr_populate_pa_features(CPUPPCState *env, void *fdt, int offset)0xf6 ,0x1f ,0xc7 ,0xc0 ,0x80 ,0xf0 ,0x80 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 , - 0x80, 0x00, 0x80, 0x00, 0x80, 0x00 }; + 0x80, 0x00, 0x80, 0x00, 0x00, 0x00 };uint8_t *pa_features;size_t pa_size;
@@ -584,6 +584,9 @@ static void spapr_populate_pa_features(CPUPPCState *env, void *fdt, int offset)*/ pa_features[3 ] |=0x20 ; } +if (kvmppc_has_cap_htm () && pa_size >24 ) { + pa_features[24 ] |=0x80 ;/* Transactional memory support */ + }_FDT ((fdt_setprop (fdt, offset,"ibm,pa-features" , pa_features, pa_size))); }
target-ppc/kvm.c +7 -0
@@ -80,6 +80,7 @@ static int cap_ppc_watchdog;static int cap_papr;static int cap_htab_fd;static int cap_fixup_hcalls; +static int cap_htm;/* Hardware transactional memory support */ static uint32_t debug_inst_opcode;
@@ -122,6 +123,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s)* only activated after this by kvmppc_set_papr() */ cap_htab_fd =kvm_check_extension (s,KVM_CAP_PPC_HTAB_FD ); cap_fixup_hcalls =kvm_check_extension (s,KVM_CAP_PPC_FIXUP_HCALL ); + cap_htm =kvm_vm_check_extension (s,KVM_CAP_PPC_HTM );if (!cap_interrupt_level) { fprintf(stderr, "KVM: Couldn't find level irq capability. Expect the "
@@ -2353,6 +2355,11 @@ bool kvmppc_has_cap_fixup_hcalls(void)return cap_fixup_hcalls; } +bool kvmppc_has_cap_htm (void ) +{ +return cap_htm; +} +static PowerPCCPUClass *ppc_cpu_get_family_class (PowerPCCPUClass *pcc) {ObjectClass *oc =OBJECT_CLASS (pcc);
target-ppc/kvm_ppc.h +6 -0
@@ -55,6 +55,7 @@ void kvmppc_hash64_free_pteg(uint64_t token);void kvmppc_hash64_write_pte (CPUPPCState *env,target_ulong pte_index,target_ulong pte0,target_ulong pte1);bool kvmppc_has_cap_fixup_hcalls (void ); +bool kvmppc_has_cap_htm (void );int kvmppc_enable_hwrng (void );int kvmppc_put_books_sregs (PowerPCCPU *cpu);PowerPCCPUClass *kvm_ppc_get_host_cpu_class (void );
@@ -249,6 +250,11 @@ static inline bool kvmppc_has_cap_fixup_hcalls(void)abort (); } +static inline bool kvmppc_has_cap_htm (void ) +{ +return false; +} +static inline int kvmppc_enable_hwrng (void ) {return -1 ;
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 18/29] target-ppc: Implement mtvsrws instruction
In reply to David GibsonFrom: Ravi Bangoria <[email protected]>
mtvsrws: Move To VSR Word & Splat
--- target-ppc/translate/vsx-impl.inc.c | 19 +++++++++++++++++++ target-ppc/translate/vsx-ops.inc.c | 1 + 2 files changed, 20 insertions(+)
target-ppc/translate/vsx-impl.inc.c +19 -0
@@ -384,6 +384,25 @@ static void gen_mtvsrdd(DisasContext *ctx)tcg_gen_mov_i64 (cpu_vsrl (xT (ctx->opcode)), cpu_gpr[rB (ctx->opcode)]); } +static void gen_mtvsrws (DisasContext *ctx) +{ +if (xT (ctx->opcode) <32 ) { +if (unlikely (!ctx->vsx_enabled)) { +gen_exception (ctx,POWERPC_EXCP_VSXU ); +return ; + } + }else { +if (unlikely (!ctx->altivec_enabled)) { +gen_exception (ctx,POWERPC_EXCP_VPU ); +return ; + } + } + +tcg_gen_deposit_i64 (cpu_vsrl (xT (ctx->opcode)), cpu_gpr[rA (ctx->opcode)], + cpu_gpr[rA (ctx->opcode)],32 ,32 ); +tcg_gen_mov_i64 (cpu_vsrh (xT (ctx->opcode)),cpu_vsrl (xT (ctx->opcode))); +} +#endif static void gen_xxpermdi (DisasContext *ctx)
target-ppc/translate/vsx-ops.inc.c +1 -0
@@ -28,6 +28,7 @@ GEN_HANDLER_E(mfvsrd, 0x1F, 0x13, 0x01, 0x0000F800, PPC_NONE, PPC2_VSX207),GEN_HANDLER_E (mtvsrd,0x1F ,0x13 ,0x05 ,0x0000F800 ,PPC_NONE ,PPC2_VSX207 ),GEN_HANDLER_E (mfvsrld,0X1F ,0x13 ,0x09 ,0x0000F800 ,PPC_NONE ,PPC2_ISA300 ),GEN_HANDLER_E (mtvsrdd,0X1F ,0x13 ,0x0D ,0x0 ,PPC_NONE ,PPC2_ISA300 ), +GEN_HANDLER_E (mtvsrws,0x1F ,0x13 ,0x0C ,0x0000F800 ,PPC_NONE ,PPC2_ISA300 ), #endif #define GEN_XX1FORM(name, opc2, opc3, fl2) \
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 21/29] target-ppc/kvm: Enable transactional memory on POWER8 with KVM-HV, too
In reply to David GibsonFrom: Thomas Huth <[email protected]>
Transactional memory is also supported on POWER8 KVM-HV if the KVM_CAP_PPC_HTM is not available in the kernel yet, so add a hack to allow TM here, too.
--- target-ppc/kvm.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
target-ppc/kvm.c +8 -1
@@ -570,11 +570,18 @@ int kvm_arch_init_vcpu(CPUState *cs) idle_timer =timer_new_ns (QEMU_CLOCK_VIRTUAL , kvm_kick_cpu, cpu); -/* Some targets support access to KVM's guest TLB. */ switch (cenv->mmu_model) {case POWERPC_MMU_BOOKE206 : +/* This target supports access to KVM's guest TLB */ ret =kvm_booke206_tlb_init (cpu);break ; +case POWERPC_MMU_2_07 : +if (!cap_htm && !kvmppc_is_pr (cs->kvm_state)) { +/* KVM-HV has transactional memory on POWER8 also without the +* KVM_CAP_PPC_HTM extension, so enable it here instead. */ + cap_htm = true; + } +break ;default :break ; }
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 27/29] spapr: fix check of cpu alias name in spapr_get_cpu_core_type()
In reply to David GibsonFrom: Greg Kurz <[email protected]>
If the user passes an alias name and a property to -cpu, QEMU fails to find the CPU definition and exits.
$ qemu-system-ppc64 -cpu POWER8E,compat=power7 qemu-system-ppc64: Unable to find sPAPR CPU Core definition
This happens because spapr_get_cpu_core_type() passes the full string from the command line (i.e. "POWER8E,compat=power7") to ppc_cpu_lookup_alias(), instead of the alias name piece only (i.e. "POWER8E").
The fix is to pass model_pieces[0] to ppc_cpu_lookup_alias().
--- hw/ppc/spapr_cpu_core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
hw/ppc/spapr_cpu_core.c +4 -4
@@ -92,20 +92,20 @@ char *spapr_get_cpu_core_type(const char *model)gchar **model_pieces =g_strsplit (model,"," ,2 ); core_type =g_strdup_printf ("%s-%s" , model_pieces[0 ],TYPE_SPAPR_CPU_CORE ); -g_strfreev (model_pieces);/* Check whether it exists or whether we have to look up an alias name */ if (!object_class_by_name (core_type)) {const char *realmodel;g_free (core_type); - realmodel =ppc_cpu_lookup_alias (model); + core_type =NULL ; + realmodel =ppc_cpu_lookup_alias (model_pieces[0 ]);if (realmodel) { -return spapr_get_cpu_core_type (realmodel); + core_type =spapr_get_cpu_core_type (realmodel); } -return NULL ; } +g_strfreev (model_pieces);return core_type; }
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 19/29] MAINTAINERS: Add two more ppc related files
In reply to David GibsonFrom: Thomas Huth <[email protected]>
The file hw/intc/heathrow_pic.c belongs to the Old World Mac machine, and pc-bios/ppc_rom.bin belongs to the PReP machine.
--- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+)
MAINTAINERS +2 -0
@@ -620,6 +620,7 @@ S: Maintained F: hw/ppc/mac_oldworld.c F: hw/pci-host/grackle.c F: hw/misc/macio/ +F: hw/intc/heathrow_pic.c PReP L: [email protected]
@@ -628,6 +629,7 @@ S: Odd Fixes F: hw/ppc/prep.c F: hw/pci-host/prep.[hc] F: hw/isa/pc87312.[hc] +F: pc-bios/ppc_rom.bin sPAPR M: David Gibson <[email protected]>
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 22/29] target-ppc: fix vmx instruction type/type2
In reply to David GibsonFrom: Nikunj A Dadhania <[email protected]>
A few of the new instructions added inadvertently changed the type of old instruction(PPC_ALTIVEC) to PPC2_ALTIVEC_207 in the dual form declaration.
commit: b5d569a1 (target-ppc: add vector extract instructions)
commit: e7b1e06f (target-ppc: add vector insert instructions)
commit: 3aa56a19 (target-ppc: add vector compare not equal instructions)
New ISA 3.0 instructions added:
vextractub PPC_NONE PPC2_ISA300
vextractuh PPC_NONE PPC2_ISA300
vextractuw PPC_NONE PPC2_ISA300
vinsertb PPC_NONE PPC2_ISA300
vinserth PPC_NONE PPC2_ISA300
vinsertw PPC_NONE PPC2_ISA300
vcmpneb PPC_NONE PPC2_ISA300
vcmpneh PPC_NONE PPC2_ISA300
vcmpnew PPC_NONE PPC2_ISA300Affected older instructions:
vspltb PPC_ALTIVEC PPC_NONE
vsplth PPC_ALTIVEC PPC_NONE
vspltw PPC_ALTIVEC PPC_NONE
vspltisb PPC_ALTIVEC PPC_NONE
vspltish PPC_ALTIVEC PPC_NONE
vspltisw PPC_ALTIVEC PPC_NONE
vcmpequb PPC_ALTIVEC PPC_NONE
vcmpequh PPC_ALTIVEC PPC_NONE
vcmpequw PPC_ALTIVEC PPC_NONEChange the instruction type/type2 for the older instructions back to what it was(PPC_ALTIVEC).
--- target-ppc/translate/vmx-impl.inc.c | 30 +++++++++++++++--------------- target-ppc/translate/vmx-ops.inc.c | 18 +++++++++--------- 2 files changed, 24 insertions(+), 24 deletions(-)
target-ppc/translate/vmx-impl.inc.c +15 -15
@@ -514,11 +514,11 @@ GEN_VXRFORM(vcmpneb, 3, 0) GEN_VXRFORM(vcmpneh, 3, 1) GEN_VXRFORM(vcmpnew, 3, 2) -GEN_VXRFORM_DUAL (vcmpequb,PPC_NONE ,PPC2_ALTIVEC_207 , \ +GEN_VXRFORM_DUAL (vcmpequb,PPC_ALTIVEC ,PPC_NONE , \ vcmpneb, PPC_NONE, PPC2_ISA300) -GEN_VXRFORM_DUAL (vcmpequh,PPC_NONE ,PPC2_ALTIVEC_207 , \ +GEN_VXRFORM_DUAL (vcmpequh,PPC_ALTIVEC ,PPC_NONE , \ vcmpneh, PPC_NONE, PPC2_ISA300) -GEN_VXRFORM_DUAL (vcmpequw,PPC_NONE ,PPC2_ALTIVEC_207 , \ +GEN_VXRFORM_DUAL (vcmpequw,PPC_ALTIVEC ,PPC_NONE , \ vcmpnew, PPC_NONE, PPC2_ISA300)GEN_VXRFORM_DUAL (vcmpeqfp,PPC_ALTIVEC ,PPC_NONE , \ vcmpequd,PPC_NONE ,PPC2_ALTIVEC_207 )
@@ -712,18 +712,18 @@ GEN_VXFORM_UIMM_ENV(vcfux, 5, 12);GEN_VXFORM_UIMM_ENV (vcfsx,5 ,13 );GEN_VXFORM_UIMM_ENV (vctuxs,5 ,14 );GEN_VXFORM_UIMM_ENV (vctsxs,5 ,15 ); -GEN_VXFORM_DUAL (vspltb,PPC_NONE ,PPC2_ALTIVEC_207 , - vextractub,PPC_NONE ,PPC2_ISA300 ); -GEN_VXFORM_DUAL (vsplth,PPC_NONE ,PPC2_ALTIVEC_207 , - vextractuh,PPC_NONE ,PPC2_ISA300 ); -GEN_VXFORM_DUAL (vspltw,PPC_NONE ,PPC2_ALTIVEC_207 , - vextractuw,PPC_NONE ,PPC2_ISA300 ); -GEN_VXFORM_DUAL (vspltisb,PPC_NONE ,PPC2_ALTIVEC_207 , - vinsertb,PPC_NONE ,PPC2_ISA300 ); -GEN_VXFORM_DUAL (vspltish,PPC_NONE ,PPC2_ALTIVEC_207 , - vinserth,PPC_NONE ,PPC2_ISA300 ); -GEN_VXFORM_DUAL (vspltisw,PPC_NONE ,PPC2_ALTIVEC_207 , - vinsertw,PPC_NONE ,PPC2_ISA300 ); +GEN_VXFORM_DUAL (vspltb,PPC_ALTIVEC ,PPC_NONE , + vextractub,PPC_NONE ,PPC2_ISA300 ); +GEN_VXFORM_DUAL (vsplth,PPC_ALTIVEC ,PPC_NONE , + vextractuh,PPC_NONE ,PPC2_ISA300 ); +GEN_VXFORM_DUAL (vspltw,PPC_ALTIVEC ,PPC_NONE , + vextractuw,PPC_NONE ,PPC2_ISA300 ); +GEN_VXFORM_DUAL (vspltisb,PPC_ALTIVEC ,PPC_NONE , + vinsertb,PPC_NONE ,PPC2_ISA300 ); +GEN_VXFORM_DUAL (vspltish,PPC_ALTIVEC ,PPC_NONE , + vinserth,PPC_NONE ,PPC2_ISA300 ); +GEN_VXFORM_DUAL (vspltisw,PPC_ALTIVEC ,PPC_NONE , + vinsertw,PPC_NONE ,PPC2_ISA300 );static void gen_vsldoi (DisasContext *ctx) {
target-ppc/translate/vmx-ops.inc.c +9 -9
@@ -194,26 +194,26 @@ GEN_VXRFORM_DUAL(vcmpeqfp, vcmpequd, 3, 3, PPC_ALTIVEC, PPC_NONE) GEN_VXRFORM(vcmpgefp, 3, 7) GEN_VXRFORM_DUAL(vcmpgtfp, vcmpgtud, 3, 11, PPC_ALTIVEC, PPC_NONE) GEN_VXRFORM_DUAL(vcmpbfp, vcmpgtsd, 3, 15, PPC_ALTIVEC, PPC_NONE) -GEN_VXRFORM_DUAL(vcmpequb, vcmpneb, 3, 0, PPC_NONE, PPC2_ALTIVEC_207) -GEN_VXRFORM_DUAL(vcmpequh, vcmpneh, 3, 1, PPC_NONE, PPC2_ALTIVEC_207) -GEN_VXRFORM_DUAL(vcmpequw, vcmpnew, 3, 2, PPC_NONE, PPC2_ALTIVEC_207) +GEN_VXRFORM_DUAL(vcmpequb, vcmpneb, 3, 0, PPC_ALTIVEC, PPC_NONE) +GEN_VXRFORM_DUAL(vcmpequh, vcmpneh, 3, 1, PPC_ALTIVEC, PPC_NONE) +GEN_VXRFORM_DUAL(vcmpequw, vcmpnew, 3, 2, PPC_ALTIVEC, PPC_NONE)#define GEN_VXFORM_DUAL_INV (name0, name1, opc2, opc3, inval0, inval1, type) \ GEN_OPCODE_DUAL(name0##_##name1, 0x04, opc2, opc3, inval0, inval1, type, \ PPC_NONE)GEN_VXFORM_DUAL_INV (vspltb, vextractub,6 ,8 ,0x00000000 ,0x100000 , -PPC2_ALTIVEC_207 ), +PPC_ALTIVEC ),GEN_VXFORM_DUAL_INV (vsplth, vextractuh,6 ,9 ,0x00000000 ,0x100000 , -PPC2_ALTIVEC_207 ), +PPC_ALTIVEC ),GEN_VXFORM_DUAL_INV (vspltw, vextractuw,6 ,10 ,0x00000000 ,0x100000 , -PPC2_ALTIVEC_207 ), +PPC_ALTIVEC ),GEN_VXFORM_300_EXT (vextractd,6 ,11 ,0x100000 ),GEN_VXFORM_DUAL_INV (vspltisb, vinsertb,6 ,12 ,0x00000000 ,0x100000 , -PPC2_ALTIVEC_207 ), +PPC_ALTIVEC ),GEN_VXFORM_DUAL_INV (vspltish, vinserth,6 ,13 ,0x00000000 ,0x100000 , -PPC2_ALTIVEC_207 ), +PPC_ALTIVEC ),GEN_VXFORM_DUAL_INV (vspltisw, vinsertw,6 ,14 ,0x00000000 ,0x100000 , -PPC2_ALTIVEC_207 ), +PPC_ALTIVEC ),GEN_VXFORM_300_EXT (vinsertd,6 ,15 ,0x100000 ),GEN_VXFORM_300_EO (vctzb,0x01 ,0x18 ,0x1C ), GEN_VXFORM_300_EO(vctzh, 0x01, 0x18, 0x1D),
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 24/29] libqos: add PCI management in qtest_vboot()/qtest_shutdown()
In reply to David GibsonFrom: Laurent Vivier <[email protected]>
--- tests/e1000e-test.c | 2 +- tests/i440fx-test.c | 2 +- tests/ide-test.c | 2 +- tests/ivshmem-test.c | 2 +- tests/libqos/ahci.c | 2 +- tests/libqos/libqos-pc.c | 5 ++++- tests/libqos/libqos-spapr.c | 5 ++++- tests/libqos/libqos.c | 21 ++++++++++++++++----- tests/libqos/libqos.h | 3 +++ tests/libqos/pci-pc.c | 2 +- tests/libqos/pci-pc.h | 3 ++- tests/q35-test.c | 2 +- tests/rtl8139-test.c | 2 +- tests/tco-test.c | 2 +- tests/usb-hcd-ehci-test.c | 2 +- tests/usb-hcd-uhci-test.c | 2 +- tests/vhost-user-test.c | 4 ++-- tests/virtio-9p-test.c | 2 +- tests/virtio-blk-test.c | 2 +- tests/virtio-net-test.c | 2 +- tests/virtio-scsi-test.c | 2 +- 21 files changed, 46 insertions(+), 25 deletions(-)
tests/e1000e-test.c +1 -1
@@ -390,7 +390,7 @@ static void data_test_init(e1000e_device *d)qtest_start (cmdline);g_free (cmdline); - test_bus =qpci_init_pc (); + test_bus =qpci_init_pc (NULL );g_assert_nonnull (test_bus); test_alloc =pc_alloc_init ();
tests/i440fx-test.c +1 -1
@@ -38,7 +38,7 @@ static QPCIBus *test_start_get_bus(const TestData *s) cmdline =g_strdup_printf ("-smp %d" , s->num_cpus);qtest_start (cmdline);g_free (cmdline); -return qpci_init_pc (); +return qpci_init_pc (NULL ); }static void test_i440fx_defaults (gconstpointer opaque)
tests/ide-test.c +1 -1
@@ -143,7 +143,7 @@ static QPCIDevice *get_pci_device(uint16_t *bmdma_base)uint16_t vendor_id, device_id;if (!pcibus) { - pcibus =qpci_init_pc (); + pcibus =qpci_init_pc (NULL ); }/* Find PCI device and verify it's the right one */
tests/ivshmem-test.c +1 -1
@@ -105,7 +105,7 @@ static void setup_vm_cmd(IVState *s, const char *cmd, bool msix)uint64_t barsize; s->qtest =qtest_start (cmd); - s->pcibus =qpci_init_pc (); + s->pcibus =qpci_init_pc (NULL ); s->dev =get_device (s->pcibus); s->reg_base =qpci_iomap (s->dev,0 , &barsize);
tests/libqos/ahci.c +1 -1
@@ -128,7 +128,7 @@ QPCIDevice *get_ahci_device(uint32_t *fingerprint)uint32_t ahci_fingerprint;QPCIBus *pcibus; - pcibus =qpci_init_pc (); + pcibus =qpci_init_pc (NULL );/* Find the AHCI PCI device and verify it's the right one. */ ahci =qpci_device_find (pcibus,QPCI_DEVFN (0x1F ,0x02 ));
tests/libqos/libqos-pc.c +4 -1
@@ -1,10 +1,13 @@#include "qemu/osdep.h" #include "libqos/libqos-pc.h" #include "libqos/malloc-pc.h" +#include "libqos/pci-pc.h" static QOSOps qos_ops = { .init_allocator = pc_alloc_init_flags, - .uninit_allocator = pc_alloc_uninit + .uninit_allocator = pc_alloc_uninit, + .qpci_init = qpci_init_pc, + .qpci_free = qpci_free_pc, };QOSState *qtest_pc_vboot (const char *cmdline_fmt,va_list ap)
tests/libqos/libqos-spapr.c +4 -1
@@ -1,10 +1,13 @@#include "qemu/osdep.h" #include "libqos/libqos-spapr.h" #include "libqos/malloc-spapr.h" +#include "libqos/pci-spapr.h" static QOSOps qos_ops = { .init_allocator = spapr_alloc_init_flags, - .uninit_allocator = spapr_alloc_uninit + .uninit_allocator = spapr_alloc_uninit, + .qpci_init = qpci_init_spapr, + .qpci_free = qpci_free_spapr, };QOSState *qtest_spapr_vboot (const char *cmdline_fmt,va_list ap)
tests/libqos/libqos.c +16 -5
@@ -20,8 +20,13 @@ QOSState *qtest_vboot(QOSOps *ops, const char *cmdline_fmt, va_list ap) cmdline =g_strdup_vprintf (cmdline_fmt, ap); qs->qts =qtest_start (cmdline); qs->ops = ops; -if (ops && ops->init_allocator) { - qs->alloc = ops->init_allocator (ALLOC_NO_FLAGS ); +if (ops) { +if (ops->init_allocator) { + qs->alloc = ops->init_allocator (ALLOC_NO_FLAGS ); + } +if (ops->qpci_init && qs->alloc) { + qs->pcibus = ops->qpci_init (qs->alloc); + } }g_free (cmdline);
@@ -49,9 +54,15 @@ QOSState *qtest_boot(QOSOps *ops, const char *cmdline_fmt, ...)*/ void qtest_shutdown (QOSState *qs) { -if (qs->alloc && qs->ops && qs->ops->uninit_allocator) { - qs->ops->uninit_allocator (qs->alloc); - qs->alloc =NULL ; +if (qs->ops) { +if (qs->pcibus && qs->ops->qpci_free) { + qs->ops->qpci_free (qs->pcibus); + qs->pcibus =NULL ; + } +if (qs->alloc && qs->ops->uninit_allocator) { + qs->ops->uninit_allocator (qs->alloc); + qs->alloc =NULL ; + } }qtest_quit (qs->qts);g_free (qs);
tests/libqos/libqos.h +3 -0
@@ -8,11 +8,14 @@typedef struct QOSOps {QGuestAllocator *(*init_allocator)(QAllocOpts );void (*uninit_allocator)(QGuestAllocator *); +QPCIBus *(*qpci_init)(QGuestAllocator *alloc); +void (*qpci_free)(QPCIBus *bus); }QOSOps ;typedef struct QOSState {QTestState *qts;QGuestAllocator *alloc; +QPCIBus *pcibus;QOSOps *ops; }QOSState ;
tests/libqos/pci-pc.c +1 -1
@@ -212,7 +212,7 @@ static void qpci_pc_iounmap(QPCIBus *bus, void *data)/* FIXME */ } -QPCIBus *qpci_init_pc (void ) +QPCIBus *qpci_init_pc (QGuestAllocator *alloc) {QPCIBusPC *ret;
tests/libqos/pci-pc.h +2 -1
@@ -14,8 +14,9 @@#define LIBQOS_PCI_PC_H #include "libqos/pci.h" +#include "libqos/malloc.h" -QPCIBus *qpci_init_pc (void ); +QPCIBus *qpci_init_pc (QGuestAllocator *alloc);void qpci_free_pc (QPCIBus *bus);#endif
tests/q35-test.c +1 -1
@@ -42,7 +42,7 @@ static void test_smram_lock(void)QPCIDevice *pcidev;QDict *response; - pcibus =qpci_init_pc (); + pcibus =qpci_init_pc (NULL );g_assert (pcibus !=NULL ); pcidev =qpci_device_find (pcibus,0 );
tests/rtl8139-test.c +1 -1
@@ -35,7 +35,7 @@ static QPCIDevice *get_device(void) {QPCIDevice *dev; - pcibus =qpci_init_pc (); + pcibus =qpci_init_pc (NULL );qpci_device_foreach (pcibus,0x10ec ,0x8139 , save_fn, &dev);g_assert (dev !=NULL );
tests/tco-test.c +1 -1
@@ -57,7 +57,7 @@ static void test_init(TestData *d)qtest_irq_intercept_in (qs,"ioapic" );g_free (s); - bus =qpci_init_pc (); + bus =qpci_init_pc (NULL ); d->dev =qpci_device_find (bus,QPCI_DEVFN (0x1f ,0x00 ));g_assert (d->dev !=NULL );
tests/usb-hcd-ehci-test.c +1 -1
@@ -56,7 +56,7 @@ static void pci_init(void)if (pcibus) {return ; } - pcibus =qpci_init_pc (); + pcibus =qpci_init_pc (NULL );g_assert (pcibus !=NULL );qusb_pci_init_one (pcibus, &uhci1,QPCI_DEVFN (0x1d ,0 ),4 );
tests/usb-hcd-uhci-test.c +1 -1
@@ -23,7 +23,7 @@ static void test_port(int port)struct qhc uhci;g_assert (port >0 ); - pcibus =qpci_init_pc (); + pcibus =qpci_init_pc (NULL );g_assert (pcibus !=NULL );qusb_pci_init_one (pcibus, &uhci,QPCI_DEVFN (0x1d ,0 ),4 );uhci_port_test (&uhci, port -1 ,UHCI_PORT_CCS );
tests/vhost-user-test.c +2 -2
@@ -163,7 +163,7 @@ static void init_virtio_dev(TestServer *s)QVirtioPCIDevice *dev;uint32_t features; - bus =qpci_init_pc (); + bus =qpci_init_pc (NULL );g_assert_nonnull (bus); dev =qvirtio_pci_device_find (bus,VIRTIO_ID_NET );
@@ -884,7 +884,7 @@ static void test_multiqueue(void)qtest_start (cmd);g_free (cmd); - bus =qpci_init_pc (); + bus =qpci_init_pc (NULL ); dev =virtio_net_pci_init (bus,PCI_SLOT ); alloc =pc_alloc_init ();
tests/virtio-9p-test.c +1 -1
@@ -63,7 +63,7 @@ static QVirtIO9P *qvirtio_9p_pci_init(void) v9p =g_new0 (QVirtIO9P,1 ); v9p->alloc =pc_alloc_init (); - v9p->bus =qpci_init_pc (); + v9p->bus =qpci_init_pc (NULL ); dev =qvirtio_pci_device_find (v9p->bus,VIRTIO_ID_9P );g_assert_nonnull (dev);
tests/virtio-blk-test.c +1 -1
@@ -75,7 +75,7 @@ static QPCIBus *pci_test_start(void)g_free (tmp_path);g_free (cmdline); -return qpci_init_pc (); +return qpci_init_pc (NULL ); }static void arm_test_start (void )
tests/virtio-net-test.c +1 -1
@@ -62,7 +62,7 @@ static QPCIBus *pci_test_start(int socket)qtest_start (cmdline);g_free (cmdline); -return qpci_init_pc (); +return qpci_init_pc (NULL ); }static void driver_init (const QVirtioBus *bus,QVirtioDevice *dev)
tests/virtio-scsi-test.c +1 -1
@@ -146,7 +146,7 @@ static QVirtIOSCSI *qvirtio_scsi_pci_init(int slot) vs =g_new0 (QVirtIOSCSI,1 ); vs->alloc =pc_alloc_init (); - vs->bus =qpci_init_pc (); + vs->bus =qpci_init_pc (NULL ); dev =qvirtio_pci_device_find (vs->bus,VIRTIO_ID_SCSI ); vs->dev = (QVirtioDevice *)dev;
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 25/29] libqos: use generic qtest_shutdown()
In reply to David GibsonFrom: Laurent Vivier <[email protected]>
Machine specific shutdown function can be registered by the machine specific qtest_XXX_boot() if needed.
So we will not have to test twice the architecture (on boot and on shutdown) if the test can be run on several architectures.
--- tests/libqos/libqos-pc.c | 3 ++- tests/libqos/libqos-spapr.c | 3 ++- tests/libqos/libqos.c | 11 ++++++++++- tests/libqos/libqos.h | 8 ++++++-- tests/rtas-test.c | 2 +- 5 files changed, 21 insertions(+), 6 deletions(-)
tests/libqos/libqos-pc.c +2 -1
@@ -8,6 +8,7 @@ static QOSOps qos_ops = { .uninit_allocator = pc_alloc_uninit, .qpci_init = qpci_init_pc, .qpci_free = qpci_free_pc, + .shutdown = qtest_pc_shutdown, };QOSState *qtest_pc_vboot (const char *cmdline_fmt,va_list ap)
@@ -31,5 +32,5 @@ QOSState *qtest_pc_boot(const char *cmdline_fmt, ...)void qtest_pc_shutdown (QOSState *qs) { -return qtest_shutdown (qs); +return qtest_common_shutdown (qs); }
tests/libqos/libqos-spapr.c +2 -1
@@ -8,6 +8,7 @@ static QOSOps qos_ops = { .uninit_allocator = spapr_alloc_uninit, .qpci_init = qpci_init_spapr, .qpci_free = qpci_free_spapr, + .shutdown = qtest_spapr_shutdown, };QOSState *qtest_spapr_vboot (const char *cmdline_fmt,va_list ap)
@@ -29,5 +30,5 @@ QOSState *qtest_spapr_boot(const char *cmdline_fmt, ...)void qtest_spapr_shutdown (QOSState *qs) { -return qtest_shutdown (qs); +return qtest_common_shutdown (qs); }
tests/libqos/libqos.c +10 -1
@@ -52,7 +52,7 @@ QOSState *qtest_boot(QOSOps *ops, const char *cmdline_fmt, ...)/** * Tear down the QEMU instance. */ -void qtest_shutdown (QOSState *qs) +void qtest_common_shutdown (QOSState *qs) {if (qs->ops) {if (qs->pcibus && qs->ops->qpci_free) {
@@ -68,6 +68,15 @@ void qtest_shutdown(QOSState *qs)g_free (qs); } +void qtest_shutdown (QOSState *qs) +{ +if (qs->ops && qs->ops->shutdown) { + qs->ops->shutdown (qs); + }else { +qtest_common_shutdown (qs); + } +} +void set_context (QOSState *s) { global_qtest = s->qts;
tests/libqos/libqos.h +6 -2
@@ -5,22 +5,26 @@#include "libqos/pci.h" #include "libqos/malloc-pc.h" +typedef struct QOSState QOSState ; +typedef struct QOSOps {QGuestAllocator *(*init_allocator)(QAllocOpts );void (*uninit_allocator)(QGuestAllocator *);QPCIBus *(*qpci_init)(QGuestAllocator *alloc);void (*qpci_free)(QPCIBus *bus); +void (*shutdown)(QOSState *); }QOSOps ; -typedef struct QOSState { +struct QOSState {QTestState *qts;QGuestAllocator *alloc;QPCIBus *pcibus;QOSOps *ops; -}QOSState ; +};QOSState *qtest_vboot (QOSOps *ops,const char *cmdline_fmt,va_list ap);QOSState *qtest_boot (QOSOps *ops,const char *cmdline_fmt, ...); +void qtest_common_shutdown (QOSState *qs);void qtest_shutdown (QOSState *qs);bool have_qemu_img (void );void mkimg (const char *file,const char *fmt,unsigned size_mb);
tests/rtas-test.c +1 -1
@@ -22,7 +22,7 @@ static void test_rtas_get_time_of_day(void) t2 =mktimegm (&tm);g_assert (t2 - t1 <5 );/* 5 sec max to run the test */ -qtest_spapr_shutdown (qs); +qtest_shutdown (qs); }int main (int argc,char *argv[])
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 26/29] tests: enable ohci/uhci/xhci tests on PPC64
In reply to David GibsonFrom: Laurent Vivier <[email protected]>
--- tests/Makefile.include | 8 +++++++- tests/usb-hcd-uhci-test.c | 24 ++++++++++++++++-------- 2 files changed, 23 insertions(+), 9 deletions(-)
tests/Makefile.include +7 -1
@@ -272,6 +272,12 @@ check-qtest-ppc64-y += tests/postcopy-test$(EXESUF) check-qtest-ppc64-y += tests/boot-serial-test$(EXESUF) check-qtest-ppc64-y += tests/rtas-test$(EXESUF) check-qtest-ppc64-y += tests/pxe-test$(EXESUF) +check-qtest-ppc64-y += tests/usb-hcd-ohci-test$(EXESUF) +gcov-files-ppc64-y += hw/usb/hcd-ohci.c +check-qtest-ppc64-y += tests/usb-hcd-uhci-test$(EXESUF) +gcov-files-ppc64-y += hw/usb/hcd-uhci.c +check-qtest-ppc64-y += tests/usb-hcd-xhci-test$(EXESUF) +gcov-files-ppc64-y += hw/usb/hcd-xhci.c check-qtest-sh4-y = tests/endianness-test$(EXESUF)
@@ -597,7 +603,7 @@ libqos-pc-obj-y += tests/libqos/malloc-pc.o tests/libqos/libqos-pc.o libqos-pc-obj-y += tests/libqos/ahci.o libqos-omap-obj-y = $(libqos-obj-y) tests/libqos/i2c-omap.o libqos-imx-obj-y = $(libqos-obj-y) tests/libqos/i2c-imx.o -libqos-usb-obj-y = $(libqos-pc-obj-y) tests/libqos/usb.o +libqos-usb-obj-y = $(libqos-spapr-obj-y) $(libqos-pc-obj-y) tests/libqos/usb.o libqos-virtio-obj-y = $(libqos-pc-obj-y) tests/libqos/virtio.o tests/libqos/virtio-pci.o tests/libqos/virtio-mmio.o tests/libqos/malloc-generic.o tests/device-introspect-test$(EXESUF): tests/device-introspect-test.o
tests/usb-hcd-uhci-test.c +16 -8
@@ -9,9 +9,13 @@#include "qemu/osdep.h" #include "libqtest.h" +#include "libqos/libqos.h" #include "libqos/usb.h" +#include "libqos/libqos-pc.h" +#include "libqos/libqos-spapr.h" #include "hw/usb/uhci-regs.h" +static QOSState *qs;static void test_uhci_init (void ) {
@@ -19,13 +23,10 @@ static void test_uhci_init(void)static void test_port (int port) { -QPCIBus *pcibus;struct qhc uhci;g_assert (port >0 ); - pcibus =qpci_init_pc (NULL ); -g_assert (pcibus !=NULL ); -qusb_pci_init_one (pcibus, &uhci,QPCI_DEVFN (0x1d ,0 ),4 ); +qusb_pci_init_one (qs->pcibus, &uhci,QPCI_DEVFN (0x1d ,0 ),4 );uhci_port_test (&uhci, port -1 ,UHCI_PORT_CCS ); }
@@ -75,6 +76,7 @@ static void test_usb_storage_hotplug(void)int main (int argc,char **argv) { +const char *arch =qtest_get_arch ();int ret;g_test_init (&argc, &argv,NULL );
@@ -84,11 +86,17 @@ int main(int argc, char **argv)qtest_add_func ("/uhci/pci/hotplug" , test_uhci_hotplug);qtest_add_func ("/uhci/pci/hotplug/usb-storage" , test_usb_storage_hotplug); -qtest_start ("-device piix3-usb-uhci,id=uhci,addr=1d.0" -" -drive id=drive0,if=none,file=/dev/null,format=raw" -" -device usb-tablet,bus=uhci.0,port=1" ); +if (strcmp (arch,"i386" ) ==0 ||strcmp (arch,"x86_64" ) ==0 ) { + qs =qtest_pc_boot ("-device piix3-usb-uhci,id=uhci,addr=1d.0" +" -drive id=drive0,if=none,file=/dev/null,format=raw" +" -device usb-tablet,bus=uhci.0,port=1" ); + }else if (strcmp (arch,"ppc64" ) ==0 ) { + qs =qtest_spapr_boot ("-device piix3-usb-uhci,id=uhci,addr=1d.0" +" -drive id=drive0,if=none,file=/dev/null,format=raw" +" -device usb-tablet,bus=uhci.0,port=1" ); + } ret =g_test_run (); -qtest_end (); +qtest_shutdown (qs);return ret; }
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 12/29] target-ppc: add stxvh8x instruction
In reply to David GibsonFrom: Nikunj A Dadhania <[email protected]>
stxvh8x: Store VSX Vector Halfword*8
Vector (16-bit elements):
+------+------+------+------+------+------+------+------+ | 0001 | 1011 | 2021 | 3031 | 4041 | 5051 | 6061 | 7071 | +------+------+------+------+------+------+------+------+
Store results in following:
Big-Endian Storage
+-------+-------+-------+-------+-------+-------+-------+-------+ | 00 01 | 10 11 | 20 21 | 30 31 | 40 41 | 50 51 | 60 61 | 70 71 | +-------+-------+-------+-------+-------+-------+-------+-------+
Little-Endian Storage
+-------+-------+-------+-------+-------+-------+-------+-------+ | 01 00 | 11 10 | 21 20 | 31 30 | 41 40 | 51 50 | 61 60 | 71 70 | +-------+-------+-------+-------+-------+-------+-------+-------+
--- target-ppc/translate/vsx-impl.inc.c | 31 +++++++++++++++++++++++++++++++ target-ppc/translate/vsx-ops.inc.c | 1 + 2 files changed, 32 insertions(+)
target-ppc/translate/vsx-impl.inc.c +31 -0
@@ -226,6 +226,37 @@ static void gen_stxvw4x(DisasContext *ctx)tcg_temp_free (EA ); } +static void gen_stxvh8x (DisasContext *ctx) +{ +TCGv_i64 xsh =cpu_vsrh (xS (ctx->opcode)); +TCGv_i64 xsl =cpu_vsrl (xS (ctx->opcode)); +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 ); +if (ctx->le_mode) { +TCGv_i64 outh =tcg_temp_new_i64 (); +TCGv_i64 outl =tcg_temp_new_i64 (); + +gen_bswap16x8 (outh, outl, xsh, xsl); +tcg_gen_qemu_st_i64 (outh,EA , ctx->mem_idx,MO_BEQ ); +tcg_gen_addi_tl (EA ,EA ,8 ); +tcg_gen_qemu_st_i64 (outl,EA , ctx->mem_idx,MO_BEQ ); +tcg_temp_free_i64 (outh); +tcg_temp_free_i64 (outl); + }else { +tcg_gen_qemu_st_i64 (xsh,EA , ctx->mem_idx,MO_BEQ ); +tcg_gen_addi_tl (EA ,EA ,8 ); +tcg_gen_qemu_st_i64 (xsl,EA , ctx->mem_idx,MO_BEQ ); + } +tcg_temp_free (EA ); +} +#define MV_VSRW (name, tcgop1, tcgop2, target, source) \ static void gen_##name(DisasContext *ctx) \ { \
target-ppc/translate/vsx-ops.inc.c +1 -0
@@ -16,6 +16,7 @@ GEN_HANDLER_E(stxsiwx, 0x1F, 0xC, 0x04, 0, PPC_NONE, PPC2_VSX207),GEN_HANDLER_E (stxsspx,0x1F ,0xC ,0x14 ,0 ,PPC_NONE ,PPC2_VSX207 ),GEN_HANDLER_E (stxvd2x,0x1F ,0xC ,0x1E ,0 ,PPC_NONE ,PPC2_VSX ),GEN_HANDLER_E (stxvw4x,0x1F ,0xC ,0x1C ,0 ,PPC_NONE ,PPC2_VSX ), +GEN_HANDLER_E (stxvh8x,0x1F ,0x0C ,0x1D ,0 ,PPC_NONE ,PPC2_ISA300 ),GEN_HANDLER_E (mfvsrwz,0x1F ,0x13 ,0x03 ,0x0000F800 ,PPC_NONE ,PPC2_VSX207 ), GEN_HANDLER_E(mtvsrwa, 0x1F, 0x13, 0x06, 0x0000F800, PPC_NONE, PPC2_VSX207),
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 23/29] libqos: add PPC64 PCI support
In reply to David GibsonFrom: Laurent Vivier <[email protected]>
--- tests/Makefile.include | 1 + tests/libqos/pci-pc.c | 22 ---- tests/libqos/pci-spapr.c | 288 +++++++++++++++++++++++++++++++++++++++++++++++ tests/libqos/pci-spapr.h | 17 +++ tests/libqos/pci.c | 22 +++- tests/libqos/rtas.c | 45 ++++++++ tests/libqos/rtas.h | 4 + 7 files changed, 376 insertions(+), 23 deletions(-) create mode 100644 tests/libqos/pci-spapr.c create mode 100644 tests/libqos/pci-spapr.h
tests/Makefile.include +1 -0
@@ -591,6 +591,7 @@ libqos-obj-y += tests/libqos/i2c.o tests/libqos/libqos.o libqos-spapr-obj-y = $(libqos-obj-y) tests/libqos/malloc-spapr.o libqos-spapr-obj-y += tests/libqos/libqos-spapr.o libqos-spapr-obj-y += tests/libqos/rtas.o +libqos-spapr-obj-y += tests/libqos/pci-spapr.o libqos-pc-obj-y = $(libqos-obj-y) tests/libqos/pci-pc.o libqos-pc-obj-y += tests/libqos/malloc-pc.o tests/libqos/libqos-pc.o libqos-pc-obj-y += tests/libqos/ahci.o
tests/libqos/pci-pc.c +0 -22
@@ -255,28 +255,6 @@ void qpci_free_pc(QPCIBus *bus)g_free (s); } -void qpci_plug_device_test (const char *driver,const char *id, -uint8_t slot,const char *opts) -{ -QDict *response; -char *cmd; - - cmd =g_strdup_printf ("{'execute': 'device_add'," -" 'arguments': {" -" 'driver': '%s'," -" 'addr': '%d'," -" %s%s" -" 'id': '%s'" -"}}" , driver, slot, - opts ? opts :"" , opts ?"," :"" , - id); - response =qmp (cmd); -g_free (cmd); -g_assert (response); -g_assert (!qdict_haskey (response,"error" )); -QDECREF (response); -} -void qpci_unplug_acpi_device_test (const char *id,uint8_t slot) {QDict *response;
tests/libqos/pci-spapr.c new file +288 -0
288 lines not on this page · raw message
tests/libqos/pci-spapr.h new file +17 -0
@@ -0,0 +1,17 @@ +/* +* libqos PCI bindings for SPAPR +* +* This work is licensed under the terms of the GNU GPL, version 2 or later. +* See the COPYING file in the top-level directory. +*/ + +#ifndef LIBQOS_PCI_SPAPR_H +#define LIBQOS_PCI_SPAPR_H + +#include "libqos/malloc.h" +#include "libqos/pci.h" + +QPCIBus *qpci_init_spapr (QGuestAllocator *alloc); +void qpci_free_spapr (QPCIBus *bus); + +#endif
tests/libqos/pci.c +21 -1
@@ -263,4 +263,24 @@ void qpci_iounmap(QPCIDevice *dev, void *data) dev->bus->iounmap (dev->bus, data); } - +void qpci_plug_device_test (const char *driver,const char *id, +uint8_t slot,const char *opts) +{ +QDict *response; +char *cmd; + + cmd =g_strdup_printf ("{'execute': 'device_add'," +" 'arguments': {" +" 'driver': '%s'," +" 'addr': '%d'," +" %s%s" +" 'id': '%s'" +"}}" , driver, slot, + opts ? opts :"" , opts ?"," :"" , + id); + response =qmp (cmd); +g_free (cmd); +g_assert (response); +g_assert (!qdict_haskey (response,"error" )); +QDECREF (response); +}
tests/libqos/rtas.c +45 -0
48 lines not on this page · raw message
tests/libqos/rtas.h +4 -0
@@ -8,4 +8,8 @@#include "libqos/malloc.h" int qrtas_get_time_of_day (QGuestAllocator *alloc,struct tm *tm,uint32_t *ns); +uint32_t qrtas_ibm_read_pci_config (QGuestAllocator *alloc,uint64_t buid, +uint32_t addr,uint32_t size); +int qrtas_ibm_write_pci_config (QGuestAllocator *alloc,uint64_t buid, +uint32_t addr,uint32_t size,uint32_t val);#endif /* LIBQOS_RTAS_H */
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 28/29] tests/pxe: Use -nodefaults to speed up ppc64/ipv6 pxe test
In reply to David GibsonFrom: Thomas Huth <[email protected]>
SLOF is unfortunately quite slow when running with TCG, so the pxe test is also performing rather slow here. By using "-nodefaults" we can disable some devices (vscsi) that we are not interested in here, so that SLOF does not have to scan them during boot and thus starts up a little bit faster. The ppc64 pxe-test now only takes 27 seconds on my laptop instead of 33 seconds.
The "-nodefaults" flag seems to work fine for the x86 tests, too, so it is added here unconditionally here (though there is no speed-up on x86 by using this flag).
--- tests/pxe-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tests/pxe-test.c +2 -2
@@ -25,7 +25,7 @@ static void test_pxe_one(const char *params, bool ipv6) {char *args; - args =g_strdup_printf ("-machine accel=tcg -boot order=n " + args =g_strdup_printf ("-machine accel=tcg -nodefaults -boot order=n " "-netdev user,id=" NETNAME ",tftp=./,bootfile=%s," "ipv4=%s,ipv6=%s %s" , disk, ipv6 ?"off" :"on" , ipv6 ?"on" :"off" , params);
@@ -48,7 +48,7 @@ static void test_pxe_virtio_pci(void)static void test_pxe_spapr_vlan (void ) { -test_pxe_one ("-vga none -device spapr-vlan,netdev=" NETNAME , true); +test_pxe_one ("-device spapr-vlan,netdev=" NETNAME , true); }int main (int argc,char *argv[])
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 29/29] hw/ppc/spapr: Use POWER8 by default for the pseries-2.8 machine
In reply to David GibsonFrom: Thomas Huth <[email protected]>
A couple of distributors are compiling their distributions with "-mcpu=power8" for ppc64le these days, so the user sooner or later runs into a crash there when not explicitely specifying the "-cpu POWER8" option to QEMU (which is currently using POWER7 for the "pseries" machine by default). Due to this reason, the linux-user target already switched to POWER8 a while ago (see commit de3f1b98410e0d5b406a0df3a48547b559d18602). Since the softmmu target of course has the same problem, we should switch there to POWER8 for the newer machine types, too.
--- hw/ppc/spapr.c | 6 +++++- include/hw/ppc/spapr.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-)
hw/ppc/spapr.c +5 -1
@@ -1775,7 +1775,7 @@ static void ppc_spapr_init(MachineState *machine)/* init CPUs */ if (machine->cpu_model ==NULL ) { - machine->cpu_model =kvm_enabled () ?"host" :"POWER7" ; + machine->cpu_model =kvm_enabled () ?"host" : smc->tcg_default_cpu; }ppc_cpu_parse_features (machine->cpu_model);
@@ -2402,6 +2402,7 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data) mc->cpu_index_to_socket_id = spapr_cpu_index_to_socket_id; smc->dr_lmb_enabled = true; + smc->tcg_default_cpu ="POWER8" ; mc->query_hotpluggable_cpus = spapr_query_hotpluggable_cpus; fwc->get_dev_path = spapr_get_fw_dev_path; nc->nmi_monitor_handler = spapr_nmi;
@@ -2478,7 +2479,10 @@ static void spapr_machine_2_7_instance_options(MachineState *machine)static void spapr_machine_2_7_class_options (MachineClass *mc) { +sPAPRMachineClass *smc =SPAPR_MACHINE_CLASS (mc); +spapr_machine_2_8_class_options (mc); + smc->tcg_default_cpu ="POWER7" ;SET_MACHINE_COMPAT (mc,SPAPR_COMPAT_2_7 ); }
include/hw/ppc/spapr.h +1 -0
@@ -39,6 +39,7 @@ struct sPAPRMachineClass {/*< public >*/ bool dr_lmb_enabled;/* enable dynamic-reconfig/hotplug of LMBs */ bool use_ohci_by_default;/* use USB-OHCI instead of XHCI */ +const char *tcg_default_cpu;/* which (TCG) CPU to simulate by default */ };/**
Signature · 1 line
2.7.4
Peter Maydell
AppliedQuoted 12 lines · David Gibson
The following changes since commit
bbc4c3f4f3c624e2de64fdcb79f4dd8c1a508e9d:Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2016-10-04 14:25:08 +0100)
are available in the git repository at:
git://github.com/dgibson/qemu.gittags/ppc-for-2.8-20161006for you to fetch changes up to
3daa4a9f9580ffda47df93c7c53371af226bf970:hw/ppc/spapr: Use POWER8 by default for the pseries-2.8 machine (2016-10-06 16:15:53 +1100)
Quoted 8 lines
----------------------------------------------------------------
ppc patch queue 2016-10-06Currently accumulated target-ppc and spapr machine related patches.
- More POWER9 instruction implementations
- Additional test case / enabling of test cases for Power
- Assorted fixes
Applied, thanks.
-- PMM