ppc-for-4.2 queue 20190821
The following changes since commit 17dc57990320edaad52ac9ea808be9719c91cea6:
Merge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2019-08-20' into staging (2019-08-20 14:14:20 +0100)
are available in the Git repository at:
git://github.com/dgibson/qemu.git tags/ppc-for-4.2-20190821
for you to fetch changes up to c0e6616b6685ffdb4c5e091bc152e46e14703dd1:
ppc: Fix emulated single to double denormalized conversions (2019-08-21 17:17:39 +1000)
----------------------------------------------------------------
ppc patch queue for 2019-08-21
First ppc and spapr pull request for qemu-4.2. Includes:
* Some TCG emulation fixes and performance improvements
* Support for the mffsl instruction in TCG
* Added missing DPDES SPR
* Some enhancements to the emulation of the XIVE interrupt controller
* Cleanups to spapr MSI management
* Some new suspend/resume infrastructure and a draft suspend implementation for spapr
* New spapr hypercall for TPM communication (will be needed for secure guests under an Ultravisor)
* Fix several memory leaks
And a few other assorted fixes.
----------------------------------------------------------------
Alex Bennée (1):
target/ppc: move opcode decode tables to PowerPCCPU
Alexey Kardashevskiy (3):
spapr_iommu: Fix xlate trace to print translated address
pseries: Update SLOF firmware image
target/ppc: Add Directed Privileged Door-bell Exception State (DPDES) SPR
Cornelia Huck (1):
hw: add compat machines for 4.2
Cédric Le Goater (8):
ppc/xive: use an abstract type for XiveNotifier ppc/xive: Implement TM_PULL_OS_CTX special command ppc/xive: Provide backlog support ppc/xive: Provide escalation support ppc/xive: Provide unconditional escalation support ppc/xive: Provide silent escalation support ppc/xive: Improve 'info pic' support spapr/xive: Mask the EAS when allocating an IRQ
Daniel Black (1):
spapr: quantify error messages regarding capability settings
David Gibson (1):
spapr_pci: Allow 2MiB and 16MiB IOMMU pagesizes by default
Greg Kurz (3):
spapr/pci: Consolidate de-allocation of MSIs spapr/pci: Free MSIs during reset spapr/irq: Drop spapr_irq_msi_reset()
Maxiwell S. Garcia (1):
migration: Do not re-read the clock on pre_save in case of paused guest
Michael Roth (2):
docs/specs: initial spec summary for Ultravisor-related hcalls
spapr: initial implementation for H_TPM_COMM/spapr-tpm-proxy
Nicholas Piggin (7):
spapr: Implement dispatch tracking for tcg
spapr: Implement H_PROD
spapr: Implement H_CONFER
spapr: Implement H_JOIN
machine: Add wakeup method to MachineClass
i386: use machine class ->wakeup method
spapr: Implement ibm,suspend-me
Paul A. Clarke (4):
ppc: Add support for 'mffsl' instruction
ppc: conform to processor User's Manual for xscvdpspn
ppc: Fix emulated INFINITY and NAN conversions
ppc: Fix emulated single to double denormalized conversions
Paul Mackerras (1):
spapr: Implement better workaround in spapr-vty device
Shivaprasad G Bhat (4):
ppc: fix memory leak in spapr_caps_add_properties
ppc: fix memory leak in spapr_dt_drc()
ppc: fix leak in h_client_architecture_support
ppc: remove idle_timer logic
Stefan Brankovic (5):
target/ppc: Optimize emulation of lvsl and lvsr instructions target/ppc: Optimize emulation of vsl and vsr instructions target/ppc: Optimize emulation of vgbbd instruction target/ppc: Optimize emulation of vclzd instruction target/ppc: Optimize emulation of vclzw instruction
disas/ppc.c | 5 + docs/specs/ppc-spapr-uv-hcalls.txt | 76 ++++++++ hw/arm/virt.c | 9 +- hw/char/spapr_vty.c | 30 ++- hw/core/machine.c | 3 + hw/i386/pc.c | 11 ++ hw/i386/pc_piix.c | 14 +- hw/i386/pc_q35.c | 13 +- hw/intc/pnv_xive.c | 9 + hw/intc/spapr_xive.c | 6 +- hw/intc/xive.c | 206 ++++++++++++++++----- hw/ppc/Makefile.objs | 1 + hw/ppc/ppc.c | 13 +- hw/ppc/spapr.c | 115 +++++++++++- hw/ppc/spapr_caps.c | 46 +++-- hw/ppc/spapr_drc.c | 7 +- hw/ppc/spapr_hcall.c | 167 ++++++++++++++++- hw/ppc/spapr_iommu.c | 2 +- hw/ppc/spapr_irq.c | 7 +- hw/ppc/spapr_pci.c | 29 ++- hw/ppc/spapr_rtas.c | 32 ++++ hw/ppc/spapr_tpm_proxy.c | 178 ++++++++++++++++++ hw/ppc/trace-events | 4 + hw/s390x/s390-virtio-ccw.c | 14 +- include/hw/boards.h | 4 + include/hw/i386/pc.h | 3 + include/hw/ppc/spapr.h | 21 ++- include/hw/ppc/spapr_cpu_core.h | 1 + include/hw/ppc/spapr_irq.h | 1 - include/hw/ppc/spapr_tpm_proxy.h | 31 ++++ include/hw/ppc/xive.h | 11 +- include/hw/ppc/xive_regs.h | 10 + pc-bios/README | 2 +- pc-bios/slof.bin | Bin 926432 -> 926784 bytes roms/SLOF | 2 +- target/ppc/cpu-qom.h | 1 + target/ppc/cpu.h | 28 ++- target/ppc/fpu_helper.c | 42 +++-- target/ppc/helper.h | 7 - target/ppc/int_helper.c | 335 ---------------------------------- target/ppc/kvm.c | 75 +------- target/ppc/translate.c | 3 +- target/ppc/translate/fp-impl.inc.c | 22 +++ target/ppc/translate/fp-ops.inc.c | 4 +- target/ppc/translate/vmx-impl.inc.c | 355 ++++++++++++++++++++++++++++++++---- target/ppc/translate_init.inc.c | 57 +++++- vl.c | 16 +- 47 files changed, 1417 insertions(+), 611 deletions(-) create mode 100644 docs/specs/ppc-spapr-uv-hcalls.txt create mode 100644 hw/ppc/spapr_tpm_proxy.c create mode 100644 include/hw/ppc/spapr_tpm_proxy.h
[Qemu-devel] [PULL 04/42] spapr_pci: Allow 2MiB and 16MiB IOMMU pagesizes by default
We've had the qemu and kernel KVM infrastructure to handle larger TCE page sizes for a while, but forgot to update the defaults to actually allow them. This turns that change on.
--- hw/ppc/spapr.c | 6 ++++++ hw/ppc/spapr_pci.c | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-)
hw/ppc/spapr.c +6 -0
@@ -4445,8 +4445,14 @@ DEFINE_SPAPR_MACHINE(4_2, "4.2", true);*/ static void spapr_machine_4_1_class_options (MachineClass *mc) { +static GlobalProperty compat[] = { +/* Only allow 4kiB and 64kiB IOMMU pagesizes */ + {TYPE_SPAPR_PCI_HOST_BRIDGE ,"pgsz" ,"0x11000" }, + }; +spapr_machine_4_2_class_options (mc);compat_props_add (mc->compat_props, hw_compat_4_1, hw_compat_4_1_len); +compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); } DEFINE_SPAPR_MACHINE(4_1, "4.1", false);
hw/ppc/spapr_pci.c +2 -1
@@ -2093,7 +2093,8 @@ static Property spapr_phb_properties[] = { 0x800000000000000ULL),DEFINE_PROP_BOOL ("ddw" , SpaprPhbState, ddw_enabled, true),DEFINE_PROP_UINT64 ("pgsz" , SpaprPhbState, page_size_mask, - (1ULL <<12 ) | (1ULL <<16 )), + (1ULL <<12 ) | (1ULL <<16 ) + | (1ULL <<21 ) | (1ULL <<24 )),DEFINE_PROP_UINT32 ("numa_node" , SpaprPhbState, numa_node,-1 ),DEFINE_PROP_BOOL ("pre-2.8-migration" , SpaprPhbState, pre_2_8_migration, false),
Signature · 1 line
2.21.0
[Qemu-devel] [PULL 05/42] migration: Do not re-read the clock on pre_save in case of paused guest
In reply to David GibsonFrom: "Maxiwell S. Garcia" <[email protected]>
Re-read the timebase before migrate was ported from x86 commit:
6053a86fe7bd: kvmclock: reduce kvmclock difference on migration
The clock move makes the guest knows about the paused time between the stop and migrate commands. This is an issue in an already-paused VM because some side effects, like process stalls, could happen after migration.
So, this patch checks the runstate of guest in the pre_save handler and do not re-reads the timebase in case of paused state (cold migration).
Message-Id: <[email protected]>
--- hw/ppc/ppc.c | 13 +++++++++---- target/ppc/cpu-qom.h | 1 + 2 files changed, 10 insertions(+), 4 deletions(-)
hw/ppc/ppc.c +9 -4
@@ -1011,6 +1011,8 @@ static void timebase_save(PPCTimebase *tb)* there is no need to update it from KVM here */ tb->guest_timebase = ticks + first_ppc_cpu->env.tb_env->tb_offset; + + tb->runstate_paused =runstate_check (RUN_STATE_PAUSED ); }static void timebase_load (PPCTimebase *tb)
@@ -1054,9 +1056,9 @@ void cpu_ppc_clock_vm_state_change(void *opaque, int running, }/* -* When migrating, read the clock just before migration, -* so that the guest clock counts during the events -* between: +* When migrating a running guest, read the clock just +* before migration, so that the guest clock counts +* during the events between: * * * vm_stop() * *
@@ -1071,7 +1073,10 @@ static int timebase_pre_save(void *opaque) {PPCTimebase *tb = opaque; -timebase_save (tb); +/* guest_timebase won't be overridden in case of paused guest */ +if (!tb->runstate_paused) { +timebase_save (tb); + }return 0 ; }
target/ppc/cpu-qom.h +1 -0
@@ -201,6 +201,7 @@ typedef struct PowerPCCPUClass {typedef struct PPCTimebase {uint64_t guest_timebase;int64_t time_of_the_day_ns; +bool runstate_paused; }PPCTimebase ;extern const VMStateDescription vmstate_ppc_timebase;
Signature · 1 line
2.21.0
[Qemu-devel] [PULL 01/42] spapr: quantify error messages regarding capability settings
In reply to David GibsonFrom: Daniel Black <[email protected]>
Its not immediately obvious how cap-X=Y setting need to be applied to the command line so, for spapr capability error messages, this has been clarified to:
appending -machine cap-X=Y
The wrong value messages have been left as is, as the user has found the right location.
Message-Id: <[email protected]>
--- hw/ppc/spapr_caps.c | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-)
hw/ppc/spapr_caps.c +28 -14
@@ -195,10 +195,12 @@ static void cap_htm_apply(SpaprMachineState *spapr, uint8_t val, Error **errp) }if (tcg_enabled ()) {error_setg (errp, -"No Transactional Memory support in TCG, try cap-htm=off" ); +"No Transactional Memory support in TCG," +" try appending -machine cap-htm=off" ); }else if (kvm_enabled () && !kvmppc_has_cap_htm ()) {error_setg (errp, -"KVM implementation does not support Transactional Memory, try cap-htm=off" +"KVM implementation does not support Transactional Memory," +" try appending -machine cap-htm=off" ); } }
@@ -216,7 +218,8 @@ static void cap_vsx_apply(SpaprMachineState *spapr, uint8_t val, Error **errp)* rid of anything that doesn't do VMX */ g_assert (env->insns_flags &PPC_ALTIVEC );if (!(env->insns_flags2 &PPC2_VSX )) { -error_setg (errp,"VSX support not available, try cap-vsx=off" ); +error_setg (errp,"VSX support not available," +" try appending -machine cap-vsx=off" ); } }
@@ -230,7 +233,8 @@ static void cap_dfp_apply(SpaprMachineState *spapr, uint8_t val, Error **errp)return ; }if (!(env->insns_flags2 &PPC2_DFP )) { -error_setg (errp,"DFP support not available, try cap-dfp=off" ); +error_setg (errp,"DFP support not available," +" try appending -machine cap-dfp=off" ); } }
@@ -254,7 +258,8 @@ static void cap_safe_cache_apply(SpaprMachineState *spapr, uint8_t val, cap_cfpc_possible.vals[val]); }else if (kvm_enabled () && (val > kvm_val)) {error_setg (errp, -"Requested safe cache capability level not supported by kvm, try cap-cfpc=%s" , +"Requested safe cache capability level not supported by kvm," +" try appending -machine cap-cfpc=%s" , cap_cfpc_possible.vals[kvm_val]); }
@@ -282,7 +287,8 @@ static void cap_safe_bounds_check_apply(SpaprMachineState *spapr, uint8_t val, cap_sbbc_possible.vals[val]); }else if (kvm_enabled () && (val > kvm_val)) {error_setg (errp, -"Requested safe bounds check capability level not supported by kvm, try cap-sbbc=%s" , +"Requested safe bounds check capability level not supported by kvm," +" try appending -machine cap-sbbc=%s" , cap_sbbc_possible.vals[kvm_val]); }
@@ -313,7 +319,8 @@ static void cap_safe_indirect_branch_apply(SpaprMachineState *spapr, cap_ibs_possible.vals[val]); }else if (kvm_enabled () && (val > kvm_val)) {error_setg (errp, -"Requested safe indirect branch capability level not supported by kvm, try cap-ibs=%s" , +"Requested safe indirect branch capability level not supported by kvm," +" try appending -machine cap-ibs=%s" , cap_ibs_possible.vals[kvm_val]); }
@@ -402,11 +409,13 @@ static void cap_nested_kvm_hv_apply(SpaprMachineState *spapr,if (tcg_enabled ()) {error_setg (errp, -"No Nested KVM-HV support in tcg, try cap-nested-hv=off" ); +"No Nested KVM-HV support in tcg," +" try appending -machine cap-nested-hv=off" ); }else if (kvm_enabled ()) {if (!kvmppc_has_cap_nested_kvm_hv ()) {error_setg (errp, -"KVM implementation does not support Nested KVM-HV, try cap-nested-hv=off" ); +"KVM implementation does not support Nested KVM-HV," +" try appending -machine cap-nested-hv=off" ); }else if (kvmppc_set_cap_nested_kvm_hv (val) <0 ) {error_setg (errp,"Error enabling cap-nested-hv with KVM, try cap-nested-hv=off" );
@@ -436,10 +445,12 @@ static void cap_large_decr_apply(SpaprMachineState *spapr,if (!kvm_nr_bits) {error_setg (errp, -"No large decrementer support, try cap-large-decr=off" ); +"No large decrementer support," +" try appending -machine cap-large-decr=off" ); }else if (pcc->lrg_decr_bits != kvm_nr_bits) {error_setg (errp, -"KVM large decrementer size (%d) differs to model (%d), try -cap-large-decr=off" , +"KVM large decrementer size (%d) differs to model (%d)," +" try appending -machine cap-large-decr=off" , kvm_nr_bits, pcc->lrg_decr_bits); } }
@@ -455,7 +466,8 @@ static void cap_large_decr_cpu_apply(SpaprMachineState *spapr,if (kvm_enabled ()) {if (kvmppc_enable_cap_large_decr (cpu, val)) {error_setg (errp, -"No large decrementer support, try cap-large-decr=off" ); +"No large decrementer support," +" try appending -machine cap-large-decr=off" ); } }
@@ -475,10 +487,12 @@ static void cap_ccf_assist_apply(SpaprMachineState *spapr, uint8_t val,if (tcg_enabled () && val) {/* TODO - for now only allow broken for TCG */ error_setg (errp, -"Requested count cache flush assist capability level not supported by tcg, try cap-ccf-assist=off" ); +"Requested count cache flush assist capability level not supported by tcg," +" try appending -machine cap-ccf-assist=off" ); }else if (kvm_enabled () && (val > kvm_val)) {error_setg (errp, -"Requested count cache flush assist capability level not supported by kvm, try cap-ccf-assist=off" ); +"Requested count cache flush assist capability level not supported by kvm," +" try appending -machine cap-ccf-assist=off" ); } }
Signature · 1 line
2.21.0
[Qemu-devel] [PULL 09/42] target/ppc: Optimize emulation of vgbbd instruction
In reply to David GibsonFrom: Stefan Brankovic <[email protected]>
Optimize altivec instruction vgbbd (Vector Gather Bits by Bytes by Doubleword) All ith bits (i in range 1 to 8) of each byte of doubleword element in source register are concatenated and placed into ith byte of appropriate doubleword element in destination register.
Following solution is done for both doubleword elements of source register in parallel, in order to reduce the number of instructions needed(that's why arrays are used):
First, both doubleword elements of source register vB are placed in appropriate element of array avr. Bits are gathered in 2x8 iterations(2 for loops). In first iteration bit 1 of byte 1, bit 2 of byte 2,... bit 8 of byte 8 are in their final spots so avr[i], i={0,1} can be and-ed with tcg_mask. For every following iteration, both avr[i] and tcg_mask variables have to be shifted right for 7 and 8 places, respectively, in order to get bit 1 of byte 2, bit 2 of byte 3.. bit 7 of byte 8 in their final spots so shifted avr values(saved in tmp) can be and-ed with new value of tcg_mask... After first 8 iteration(first loop), all the first bits are in their final places, all second bits but second bit from eight byte are in their places... only 1 eight bit from eight byte is in it's place). In second loop we do all operations symmetrically, in order to get other half of bits in their final spots. Results for first and second doubleword elements are saved in result[0] and result[1] respectively. In the end those results are saved in appropriate doubleword element of destination register vD.
Message-Id: <[email protected]>
--- target/ppc/helper.h | 1 - target/ppc/int_helper.c | 276 ---------------------------- target/ppc/translate/vmx-impl.inc.c | 77 +++++++- 3 files changed, 76 insertions(+), 278 deletions(-)
target/ppc/helper.h +0 -1
@@ -324,7 +324,6 @@ 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) DEF_HELPER_3(vpmsumb, void, avr, avr, avr) DEF_HELPER_3(vpmsumh, void, avr, avr, avr)DEF_HELPER_3 (vpmsumw, void, avr, avr, avr)
target/ppc/int_helper.c +0 -276
282 lines not on this page · raw message
target/ppc/translate/vmx-impl.inc.c +76 -1
89 lines not on this page · raw message
Signature · 1 line
2.21.0
[Qemu-devel] [PULL 02/42] spapr_iommu: Fix xlate trace to print translated address
In reply to David GibsonFrom: Alexey Kardashevskiy <[email protected]>
Currently we basically print IO address twice, fix this.
Message-Id: <[email protected]>
--- hw/ppc/spapr_iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/spapr_iommu.c +1 -1
@@ -136,7 +136,7 @@ static IOMMUTLBEntry spapr_tce_translate_iommu(IOMMUMemoryRegion *iommu, ret.addr_mask = ~page_mask; ret.perm =spapr_tce_iommu_access_flags (tce); } -trace_spapr_iommu_xlate (tcet->liobn, addr, ret.iova, ret.perm, +trace_spapr_iommu_xlate (tcet->liobn, addr, ret.translated_addr, ret.perm, ret.addr_mask);return ret;
Signature · 1 line
2.21.0
[Qemu-devel] [PULL 10/42] target/ppc: Optimize emulation of vclzd instruction
In reply to David GibsonFrom: Stefan Brankovic <[email protected]>
Optimize Altivec instruction vclzd (Vector Count Leading Zeros Doubleword). This instruction counts the number of leading zeros of each doubleword element in source register and places result in the appropriate doubleword element of destination register.
Using tcg-s count leading zeros instruction two times(once for each doubleword element of source register vB) and placing result in appropriate doubleword element of destination register vD.
Message-Id: <[email protected]>
--- target/ppc/helper.h | 1 - target/ppc/int_helper.c | 3 --- target/ppc/translate/vmx-impl.inc.c | 28 +++++++++++++++++++++++++++- 3 files changed, 27 insertions(+), 5 deletions(-)
target/ppc/helper.h +0 -1
@@ -311,7 +311,6 @@ DEF_HELPER_4(vctsxs, void, env, avr, avr, i32) DEF_HELPER_2(vclzb, void, avr, avr) DEF_HELPER_2(vclzh, void, avr, avr) DEF_HELPER_2(vclzw, void, avr, avr) -DEF_HELPER_2(vclzd, void, avr, avr) DEF_HELPER_2(vctzb, void, avr, avr) DEF_HELPER_2(vctzh, void, avr, avr)DEF_HELPER_2 (vctzw, void, avr, avr)
target/ppc/int_helper.c +0 -3
@@ -1820,17 +1820,14 @@ VUPK(lsw, s64, s32, UPKLO)#define clzb (v) ((v) ? clz32((uint32_t)(v) << 24) : 8)#define clzh (v) ((v) ? clz32((uint32_t)(v) << 16) : 16)#define clzw (v) clz32((v)) -#define clzd (v) clz64((v)) VGENERIC_DO(clzb, u8) VGENERIC_DO(clzh, u16) VGENERIC_DO(clzw, u32) -VGENERIC_DO(clzd, u64)#undef clzb#undef clzh#undef clzw -#undef clzd#define ctzb (v) ((v) ? ctz32(v) : 8)#define ctzh (v) ((v) ? ctz32(v) : 16)
target/ppc/translate/vmx-impl.inc.c +27 -1
@@ -742,6 +742,32 @@ static void trans_vgbbd(DisasContext *ctx)tcg_temp_free_i64 (avr[1 ]); } +/* +* vclzd VRT,VRB - Vector Count Leading Zeros Doubleword +* +* Counting the number of leading zero bits of each doubleword element in source +* register and placing result in appropriate doubleword element of destination +* register. +*/ +static void trans_vclzd (DisasContext *ctx) +{ +int VT =rD (ctx->opcode); +int VB =rB (ctx->opcode); +TCGv_i64 avr =tcg_temp_new_i64 (); + +/* high doubleword */ +get_avr64 (avr,VB , true); +tcg_gen_clzi_i64 (avr, avr,64 ); +set_avr64 (VT , avr, true); + +/* low doubleword */ +get_avr64 (avr,VB , false); +tcg_gen_clzi_i64 (avr, avr,64 ); +set_avr64 (VT , avr, false); + +tcg_temp_free_i64 (avr); +} +GEN_VXFORM (vmuloub,4 ,0 );GEN_VXFORM (vmulouh,4 ,1 );GEN_VXFORM (vmulouw,4 ,2 );
@@ -1258,7 +1284,7 @@ GEN_VAFORM_PAIRED(vmaddfp, vnmsubfp, 23) GEN_VXFORM_NOA(vclzb, 1, 28) GEN_VXFORM_NOA(vclzh, 1, 29) GEN_VXFORM_NOA(vclzw, 1, 30) -GEN_VXFORM_NOA(vclzd, 1, 31) +GEN_VXFORM_TRANS(vclzd, 1, 31) GEN_VXFORM_NOA_2(vnegw, 1, 24, 6) GEN_VXFORM_NOA_2(vnegd, 1, 24, 7)GEN_VXFORM_NOA_2 (vextsb2w,1 ,24 ,16 )
Signature · 1 line
2.21.0
[Qemu-devel] [PULL 03/42] hw: add compat machines for 4.2
In reply to David GibsonFrom: Cornelia Huck <[email protected]>
Add 4.2 machine types for arm/i440fx/q35/s390x/spapr.
For i440fx and q35, unversioned cpu models are still translated to -v1, as 0788a56bd1ae ("i386: Make unversioned CPU models be aliases") states this should only transition to the latest cpu model version in 4.3 (or later).
Message-Id: <[email protected]>
--- hw/arm/virt.c | 9 ++++++++- hw/core/machine.c | 3 +++ hw/i386/pc.c | 3 +++ hw/i386/pc_piix.c | 14 +++++++++++++- hw/i386/pc_q35.c | 13 ++++++++++++- hw/ppc/spapr.c | 15 +++++++++++++-- hw/s390x/s390-virtio-ccw.c | 14 +++++++++++++- include/hw/boards.h | 3 +++ include/hw/i386/pc.h | 3 +++ 9 files changed, 71 insertions(+), 6 deletions(-)
hw/arm/virt.c +8 -1
@@ -2050,10 +2050,17 @@ static void machvirt_machine_init(void) }type_init (machvirt_machine_init); +static void virt_machine_4_2_options (MachineClass *mc) +{ +} +DEFINE_VIRT_MACHINE_AS_LATEST(4, 2) +static void virt_machine_4_1_options (MachineClass *mc) { +virt_machine_4_2_options (mc); +compat_props_add (mc->compat_props, hw_compat_4_1, hw_compat_4_1_len); } -DEFINE_VIRT_MACHINE_AS_LATEST(4, 1) +DEFINE_VIRT_MACHINE(4, 1)static void virt_machine_4_0_options (MachineClass *mc) {
hw/core/machine.c +3 -0
@@ -27,6 +27,9 @@#include "hw/pci/pci.h" #include "hw/mem/nvdimm.h" +GlobalProperty hw_compat_4_1[] = {}; +const size_t hw_compat_4_1_len =G_N_ELEMENTS (hw_compat_4_1); +GlobalProperty hw_compat_4_0[] = { {"VGA" ,"edid" ,"false" }, {"secondary-vga" ,"edid" ,"false" },
hw/i386/pc.c +3 -0
@@ -119,6 +119,9 @@ struct hpet_fw_config hpet_cfg = {.count = UINT8_MAX};/* Physical Address of PVH entry point read from kernel ELF NOTE */ static size_t pvh_start_addr; +GlobalProperty pc_compat_4_1[] = {}; +const size_t pc_compat_4_1_len =G_N_ELEMENTS (pc_compat_4_1); +GlobalProperty pc_compat_4_0[] = {};const size_t pc_compat_4_0_len =G_N_ELEMENTS (pc_compat_4_0);
hw/i386/pc_piix.c +13 -1
@@ -432,7 +432,7 @@ static void pc_i440fx_machine_options(MachineClass *m)machine_class_allow_dynamic_sysbus_dev (m,TYPE_RAMFB_DEVICE ); } -static void pc_i440fx_4_1_machine_options (MachineClass *m) +static void pc_i440fx_4_2_machine_options (MachineClass *m) {PCMachineClass *pcmc =PC_MACHINE_CLASS (m);pc_i440fx_machine_options (m);
@@ -441,6 +441,18 @@ static void pc_i440fx_4_1_machine_options(MachineClass *m) pcmc->default_cpu_version =1 ; } +DEFINE_I440FX_MACHINE (v4_2,"pc-i440fx-4.2" ,NULL , + pc_i440fx_4_2_machine_options); + +static void pc_i440fx_4_1_machine_options (MachineClass *m) +{ +pc_i440fx_4_2_machine_options (m); + m->alias =NULL ; + m->is_default =0 ; +compat_props_add (m->compat_props, hw_compat_4_1, hw_compat_4_1_len); +compat_props_add (m->compat_props, pc_compat_4_1, pc_compat_4_1_len); +} +DEFINE_I440FX_MACHINE (v4_1,"pc-i440fx-4.1" ,NULL , pc_i440fx_4_1_machine_options);
hw/i386/pc_q35.c +12 -1
@@ -364,7 +364,7 @@ static void pc_q35_machine_options(MachineClass *m) m->max_cpus =288 ; } -static void pc_q35_4_1_machine_options (MachineClass *m) +static void pc_q35_4_2_machine_options (MachineClass *m) {PCMachineClass *pcmc =PC_MACHINE_CLASS (m);pc_q35_machine_options (m);
@@ -372,6 +372,17 @@ static void pc_q35_4_1_machine_options(MachineClass *m) pcmc->default_cpu_version =1 ; } +DEFINE_Q35_MACHINE (v4_2,"pc-q35-4.2" ,NULL , + pc_q35_4_2_machine_options); + +static void pc_q35_4_1_machine_options (MachineClass *m) +{ +pc_q35_4_2_machine_options (m); + m->alias =NULL ; +compat_props_add (m->compat_props, hw_compat_4_1, hw_compat_4_1_len); +compat_props_add (m->compat_props, pc_compat_4_1, pc_compat_4_1_len); +} +DEFINE_Q35_MACHINE (v4_1,"pc-q35-4.1" ,NULL , pc_q35_4_1_machine_options);
hw/ppc/spapr.c +13 -2
@@ -4430,15 +4430,26 @@ static const TypeInfo spapr_machine_info = { } \ type_init(spapr_machine_register_##suffix) +/* +* pseries-4.2 +*/ +static void spapr_machine_4_2_class_options(MachineClass *mc) +{ +/* Defaults for the latest behaviour inherited from the base class */ +} + +DEFINE_SPAPR_MACHINE(4_2, "4.2", true); +/* * pseries-4.1 */ static void spapr_machine_4_1_class_options (MachineClass *mc) { -/* Defaults for the latest behaviour inherited from the base class */ +spapr_machine_4_2_class_options (mc); +compat_props_add (mc->compat_props, hw_compat_4_1, hw_compat_4_1_len); } -DEFINE_SPAPR_MACHINE(4_1, "4.1", true); +DEFINE_SPAPR_MACHINE(4_1, "4.1", false);/* * pseries-4.0
hw/s390x/s390-virtio-ccw.c +13 -1
@@ -663,14 +663,26 @@ bool css_migration_enabled(void) } \ type_init(ccw_machine_register_##suffix) +static void ccw_machine_4_2_instance_options(MachineState *machine) +{ +} + +static void ccw_machine_4_2_class_options (MachineClass *mc) +{ +} +DEFINE_CCW_MACHINE(4_2, "4.2", true); +static void ccw_machine_4_1_instance_options (MachineState *machine) { +ccw_machine_4_2_instance_options (machine); }static void ccw_machine_4_1_class_options (MachineClass *mc) { +ccw_machine_4_2_class_options (mc); +compat_props_add (mc->compat_props, hw_compat_4_1, hw_compat_4_1_len); } -DEFINE_CCW_MACHINE(4_1, "4.1", true); +DEFINE_CCW_MACHINE(4_1, "4.1", false);static void ccw_machine_4_0_instance_options (MachineState *machine) {
include/hw/boards.h +3 -0
@@ -317,6 +317,9 @@ struct MachineState { } \ type_init(machine_initfn##_register_types) +extern GlobalProperty hw_compat_4_1[]; +extern const size_t hw_compat_4_1_len; +extern GlobalProperty hw_compat_4_0[];extern const size_t hw_compat_4_0_len;
include/hw/i386/pc.h +3 -0
@@ -301,6 +301,9 @@ int e820_add_entry(uint64_t, uint64_t, uint32_t);int e820_get_num_entries (void );bool e820_get_entry (int ,uint32_t ,uint64_t *,uint64_t *); +extern GlobalProperty pc_compat_4_1[]; +extern const size_t pc_compat_4_1_len; +extern GlobalProperty pc_compat_4_0[];extern const size_t pc_compat_4_0_len;
Signature · 1 line
2.21.0
[Qemu-devel] [PULL 26/42] ppc/xive: Provide unconditional escalation support
In reply to David GibsonFrom: Cédric Le Goater <[email protected]>
When the 'u' bit is set the escalation is said to be 'unconditional' which means that the ESe PQ bits are not used. Introduce a xive_router_end_es_notify() routine to share code with the ESn notification.
Message-Id: <[email protected]>
--- hw/intc/xive.c | 44 ++++++++++++++++++++++++++++++-------- include/hw/ppc/xive_regs.h | 2 ++ 2 files changed, 37 insertions(+), 9 deletions(-)
hw/intc/xive.c +35 -9
@@ -1429,6 +1429,27 @@ static bool xive_presenter_notify(XiveRouter *xrtr, uint8_t format,return found; } +/* +* Notification using the END ESe/ESn bit (Event State Buffer for +* escalation and notification). Profide futher coalescing in the +* Router. +*/ +static bool xive_router_end_es_notify (XiveRouter *xrtr,uint8_t end_blk, +uint32_t end_idx,XiveEND *end, +uint32_t end_esmask) +{ +uint8_t pq =xive_get_field32 (end_esmask, end->w1); +bool notify =xive_esb_trigger (&pq); + +if (pq !=xive_get_field32 (end_esmask, end->w1)) { + end->w1 =xive_set_field32 (end_esmask, end->w1, pq); +xive_router_write_end (xrtr, end_blk, end_idx, end,1 ); + } + +/* ESe/n[Q]=1 : end of notification */ +return notify; +} +/* * An END trigger can come from an event trigger (IPI or HW) or from * another chip. We don't model the PowerBus but the END trigger
@@ -1485,16 +1506,9 @@ static void xive_router_end_notify(XiveRouter *xrtr, uint8_t end_blk,* even futher coalescing in the Router */ if (!xive_end_is_notify (&end)) { -uint8_t pq =xive_get_field32 (END_W1_ESn, end.w1); -bool notify =xive_esb_trigger (&pq); - -if (pq !=xive_get_field32 (END_W1_ESn, end.w1)) { - end.w1 =xive_set_field32 (END_W1_ESn, end.w1, pq); -xive_router_write_end (xrtr, end_blk, end_idx, &end,1 ); - } -/* ESn[Q]=1 : end of notification */ -if (!notify) { +if (!xive_router_end_es_notify (xrtr, end_blk, end_idx, + &end, END_W1_ESn)) {return ; } }
@@ -1558,6 +1572,18 @@ static void xive_router_end_notify(XiveRouter *xrtr, uint8_t end_blk,return ; } +/* +* Check the END ESe (Event State Buffer for escalation) for even +* futher coalescing in the Router +*/ +if (!xive_end_is_uncond_escalation (&end)) { +/* ESe[Q]=1 : end of notification */ +if (!xive_router_end_es_notify (xrtr, end_blk, end_idx, + &end, END_W1_ESe)) { +return ; + } + } +/* * The END trigger becomes an Escalation trigger */
include/hw/ppc/xive_regs.h +2 -0
@@ -210,6 +210,8 @@ typedef struct XiveEND {#define xive_end_is_notify (end) (be32_to_cpu((end)->w0) & END_W0_UCOND_NOTIFY)#define xive_end_is_backlog (end) (be32_to_cpu((end)->w0) & END_W0_BACKLOG)#define xive_end_is_escalate (end) (be32_to_cpu((end)->w0) & END_W0_ESCALATE_CTL) +#define xive_end_is_uncond_escalation (end) \ + (be32_to_cpu((end)->w0) & END_W0_UNCOND_ESCALATE)static inline uint64_t xive_end_qaddr (XiveEND *end) {
Signature · 1 line
2.21.0
[Qemu-devel] [PULL 19/42] docs/specs: initial spec summary for Ultravisor-related hcalls
In reply to David GibsonFrom: Michael Roth <[email protected]>
For now this only covers hcalls relating to TPM communication since it's the only one particularly important from a QEMU perspective atm, but others can be added here where it makes sense.
The full specification for all hcalls/ucalls will eventually be made available in the public/OpenPower version of the PAPR specification.
Message-Id: <[email protected]>
--- docs/specs/ppc-spapr-uv-hcalls.txt | 76 ++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 docs/specs/ppc-spapr-uv-hcalls.txt
docs/specs/ppc-spapr-uv-hcalls.txt new file +76 -0
@@ -0,0 +1,76 @@ +On PPC64 systems supporting Protected Execution Facility (PEF), system +memory can be placed in a secured region where only an "ultravisor" +running in firmware can provide to access it. pseries guests on such +systems can communicate with the ultravisor (via ultracalls) to switch to a +secure VM mode (SVM) where the guest's memory is relocated to this secured +region, making its memory inaccessible to normal processes/guests running on +the host. + +The various ultracalls/hypercalls relating to SVM mode are currently +only documented internally, but are planned for direct inclusion into the +public OpenPOWER version of the PAPR specification (LoPAPR/LoPAR). An internal +ACR has been filed to reserve a hypercall number range specific to this +use-case to avoid any future conflicts with the internally-maintained PAPR +specification. This document summarizes some of these details as they relate +to QEMU. + +== hypercalls needed by the ultravisor == + +Switching to SVM mode involves a number of hcalls issued by the ultravisor +to the hypervisor to orchestrate the movement of guest memory to secure +memory and various other aspects SVM mode. Numbers are assigned for these +hcalls within the reserved range 0xEF00-0xEF80. The below documents the +hcalls relevant to QEMU. + +- H_TPM_COMM (0xef10) + + For TPM_COMM_OP_EXECUTE operation: + Send a request to a TPM and receive a response, opening a new TPM session + if one has not already been opened. + + For TPM_COMM_OP_CLOSE_SESSION operation: + Close the existing TPM session, if any. + + Arguments: + + r3 : H_TPM_COMM (0xef10) + r4 : TPM operation, one of: + TPM_COMM_OP_EXECUTE (0x1) + TPM_COMM_OP_CLOSE_SESSION (0x2) + r5 : in_buffer, guest physical address of buffer containing the request + - Caller may use the same address for both request and response + r6 : in_size, size of the in buffer + - Must be less than or equal to 4KB + r7 : out_buffer, guest physical address of buffer to store the response + - Caller may use the same address for both request and response + r8 : out_size, size of the out buffer + - Must be at least 4KB, as this is the maximum request/response size + supported by most TPM implementations, including the TPM Resource + Manager in the linux kernel. + + Return values: + + r3 : H_Success request processed successfully + H_PARAMETER invalid TPM operation + H_P2 in_buffer is invalid + H_P3 in_size is invalid + H_P4 out_buffer is invalid + H_P5 out_size is invalid + H_RESOURCE problem communicating with TPM + H_FUNCTION TPM access is not currently allowed/configured + r4 : For TPM_COMM_OP_EXECUTE, the size of the response will be stored here + upon success. + + Use-case/notes: + + SVM filesystems are encrypted using a symmetric key. This key is then + wrapped/encrypted using the public key of a trusted system which has the + private key stored in the system's TPM. An Ultravisor will use this + hcall to unwrap/unseal the symmetric key using the system's TPM device + or a TPM Resource Manager associated with the device. + + The Ultravisor sets up a separate session key with the TPM in advance + during host system boot. All sensitive in and out values will be + encrypted using the session key. Though the hypervisor will see the 'in' + and 'out' buffers in raw form, any sensitive contents will generally be + encrypted using this session key.
Signature · 1 line
2.21.0
[Qemu-devel] [PULL 08/42] target/ppc: move opcode decode tables to PowerPCCPU
In reply to David GibsonFrom: Alex Bennée <[email protected]>
The opcode decode tables aren't really part of the CPUPPCState but an internal implementation detail for the translator. This can cause problems with memcpy in cpu_copy as any table created during ppc_cpu_realize get written over causing a memory leak. To avoid this move the tables into PowerPCCPU which is better suited to hold internal implementation details.
Attempts to fix: https://bugs.launchpad.net/qemu/+bug/1836558
Message-Id: <[email protected]>
--- target/ppc/cpu.h | 8 ++++---- target/ppc/translate.c | 3 ++- target/ppc/translate_init.inc.c | 16 +++++++--------- 3 files changed, 13 insertions(+), 14 deletions(-)
target/ppc/cpu.h +4 -4
@@ -1104,10 +1104,6 @@ struct CPUPPCState {bool resume_as_sreset;#endif -/* Those resources are used only during code translation */ -/* opcode handlers */ -opc_handler_t *opcodes[PPC_CPU_OPCODES_LEN ]; -/* Those resources are used only in QEMU core */ target_ulong hflags;/* hflags is a MSR & HFLAGS_MASK */ target_ulong hflags_nmsr;/* specific hflags, not coming from MSR */
@@ -1191,6 +1187,10 @@ struct PowerPCCPU {int32_t node_id;/* NUMA node this CPU belongs to */ PPCHash64Options *hash64_opts; +/* Those resources are used only during code translation */ +/* opcode handlers */ +opc_handler_t *opcodes[PPC_CPU_OPCODES_LEN ]; +/* Fields related to migration compatibility hacks */ bool pre_2_8_migration;target_ulong mig_msr_mask;
target/ppc/translate.c +2 -1
@@ -7858,6 +7858,7 @@ static bool ppc_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cs,static void ppc_tr_translate_insn (DisasContextBase *dcbase,CPUState *cs) {DisasContext *ctx =container_of (dcbase, DisasContext, base); +PowerPCCPU *cpu =POWERPC_CPU (cs);CPUPPCState *env = cs->env_ptr;opc_handler_t **table, *handler;
@@ -7875,7 +7876,7 @@ static void ppc_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs)opc3 (ctx->opcode),opc4 (ctx->opcode), ctx->le_mode ? "little" : "big"); ctx->base.pc_next +=4 ; - table = env->opcodes; + table = cpu->opcodes; handler = table[opc1 (ctx->opcode)];if (is_indirect_opcode (handler)) { table =ind_table (handler);
target/ppc/translate_init.inc.c +7 -9
@@ -9440,14 +9440,13 @@ static void fix_opcode_tables(opc_handler_t **ppc_opcodes)static void create_ppc_opcodes (PowerPCCPU *cpu,Error **errp) {PowerPCCPUClass *pcc =POWERPC_CPU_GET_CLASS (cpu); -CPUPPCState *env = &cpu->env;opcode_t *opc; -fill_new_table (env->opcodes,PPC_CPU_OPCODES_LEN ); +fill_new_table (cpu->opcodes,PPC_CPU_OPCODES_LEN );for (opc = opcodes; opc < &opcodes[ARRAY_SIZE (opcodes)]; opc++) {if (((opc->handler.type & pcc->insns_flags) !=0 ) || ((opc->handler.type2 & pcc->insns_flags2) !=0 )) { -if (register_insn (env->opcodes, opc) <0 ) { +if (register_insn (cpu->opcodes, opc) <0 ) {error_setg (errp,"ERROR initializing PowerPC instruction " "0x%02x 0x%02x 0x%02x" , opc->opc1, opc->opc2, opc->opc3);
@@ -9455,7 +9454,7 @@ static void create_ppc_opcodes(PowerPCCPU *cpu, Error **errp) } } } -fix_opcode_tables (env->opcodes); +fix_opcode_tables (cpu->opcodes);fflush (stdout);fflush (stderr); }
@@ -10023,7 +10022,6 @@ static void ppc_cpu_unrealize(DeviceState *dev, Error **errp) {PowerPCCPU *cpu =POWERPC_CPU (dev);PowerPCCPUClass *pcc =POWERPC_CPU_GET_CLASS (cpu); -CPUPPCState *env = &cpu->env;Error *local_err =NULL ;opc_handler_t **table, **table_2;int i, j, k;
@@ -10035,11 +10033,11 @@ static void ppc_cpu_unrealize(DeviceState *dev, Error **errp) }for (i =0 ; i <PPC_CPU_OPCODES_LEN ; i++) { -if (env->opcodes[i] == &invalid_handler) { +if (cpu->opcodes[i] == &invalid_handler) {continue ; } -if (is_indirect_opcode (env->opcodes[i])) { - table =ind_table (env->opcodes[i]); +if (is_indirect_opcode (cpu->opcodes[i])) { + table =ind_table (cpu->opcodes[i]);for (j =0 ; j <PPC_CPU_INDIRECT_OPCODES_LEN ; j++) {if (table[j] == &invalid_handler) {continue ;
@@ -10057,7 +10055,7 @@ static void ppc_cpu_unrealize(DeviceState *dev, Error **errp) ~PPC_INDIRECT)); } } -g_free ((opc_handler_t *)((uintptr_t )env->opcodes[i] & +g_free ((opc_handler_t *)((uintptr_t )cpu->opcodes[i] & ~PPC_INDIRECT )); } }
Signature · 1 line
2.21.0
[Qemu-devel] [PULL 33/42] spapr/pci: Consolidate de-allocation of MSIs
In reply to David GibsonFrom: Greg Kurz <[email protected]>
When freeing MSIs, we need to:
- remove them from the machine's MSI bitmap
- remove them from the IC backend
- remove them from the PHB's MSI cache
This is currently open coded in two places in rtas_ibm_change_msi(), and we're about to need this in spapr_phb_reset() as well. Instead of duplicating this code again, make it a destroy function for the PHB's MSI cache. Removing an MSI device from the cache will call the destroy function internally.
Message-Id: <[email protected]>
--- hw/ppc/spapr_pci.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-)
hw/ppc/spapr_pci.c +15 -9
@@ -338,10 +338,6 @@ static void rtas_ibm_change_msi(PowerPCCPU *cpu, SpaprMachineState *spapr,return ; } -if (!smc->legacy_irq_allocation) { -spapr_irq_msi_free (spapr, msi->first_irq, msi->num); - } -spapr_irq_free (spapr, msi->first_irq, msi->num);if (msi_present (pdev)) {spapr_msi_setmsg (pdev,0 , false,0 ,0 ); }
@@ -411,10 +407,6 @@ static void rtas_ibm_change_msi(PowerPCCPU *cpu, SpaprMachineState *spapr,/* Release previous MSIs */ if (msi) { -if (!smc->legacy_irq_allocation) { -spapr_irq_msi_free (spapr, msi->first_irq, msi->num); - } -spapr_irq_free (spapr, msi->first_irq, msi->num);g_hash_table_remove (phb->msi, &config_addr); }
@@ -1808,6 +1800,19 @@ static void spapr_phb_unrealize(DeviceState *dev, Error **errp)memory_region_del_subregion (get_system_memory (), &sphb->mem32window); } +static void spapr_phb_destroy_msi (gpointer opaque) +{ +SpaprMachineState *spapr =SPAPR_MACHINE (qdev_get_machine ()); +SpaprMachineClass *smc =SPAPR_MACHINE_GET_CLASS (spapr); +spapr_pci_msi *msi = opaque; + +if (!smc->legacy_irq_allocation) { +spapr_irq_msi_free (spapr, msi->first_irq, msi->num); + } +spapr_irq_free (spapr, msi->first_irq, msi->num); +g_free (msi); +} +static void spapr_phb_realize (DeviceState *dev,Error **errp) {/* We don't use SPAPR_MACHINE() in order to exit gracefully if the user
@@ -2019,7 +2024,8 @@ static void spapr_phb_realize(DeviceState *dev, Error **errp) spapr_tce_get_iommu(tcet)); } - sphb->msi =g_hash_table_new_full (g_int_hash, g_int_equal, g_free, g_free); + sphb->msi =g_hash_table_new_full (g_int_hash, g_int_equal, g_free, + spapr_phb_destroy_msi);return ; unrealize:
Signature · 1 line
2.21.0
[Qemu-devel] [PULL 11/42] target/ppc: Optimize emulation of vclzw instruction
In reply to David GibsonFrom: Stefan Brankovic <[email protected]>
Optimize Altivec instruction vclzw (Vector Count Leading Zeros Word). This instruction counts the number of leading zeros of each word element in source register and places result in the appropriate word element of destination register.
Counting is to be performed in four iterations of for loop(one for each word elemnt of source register vB). Every iteration consists of loading appropriate word element from source register, counting leading zeros with tcg_gen_clzi_i32, and saving the result in appropriate word element of destination register.
Message-Id: <[email protected]>
--- target/ppc/helper.h | 1 - target/ppc/int_helper.c | 3 --- target/ppc/translate/vmx-impl.inc.c | 28 +++++++++++++++++++++++++++- 3 files changed, 27 insertions(+), 5 deletions(-)
target/ppc/helper.h +0 -1
@@ -310,7 +310,6 @@ DEF_HELPER_4(vctsxs, void, env, avr, avr, i32) DEF_HELPER_2(vclzb, void, avr, avr) DEF_HELPER_2(vclzh, void, avr, avr) -DEF_HELPER_2(vclzw, void, avr, avr) DEF_HELPER_2(vctzb, void, avr, avr) DEF_HELPER_2(vctzh, void, avr, avr)DEF_HELPER_2 (vctzw, void, avr, avr)
target/ppc/int_helper.c +0 -3
@@ -1819,15 +1819,12 @@ VUPK(lsw, s64, s32, UPKLO)#define clzb (v) ((v) ? clz32((uint32_t)(v) << 24) : 8)#define clzh (v) ((v) ? clz32((uint32_t)(v) << 16) : 16) -#define clzw (v) clz32((v)) VGENERIC_DO(clzb, u8) VGENERIC_DO(clzh, u16) -VGENERIC_DO(clzw, u32)#undef clzb#undef clzh -#undef clzw#define ctzb (v) ((v) ? ctz32(v) : 8)#define ctzh (v) ((v) ? ctz32(v) : 16)
target/ppc/translate/vmx-impl.inc.c +27 -1
@@ -742,6 +742,32 @@ static void trans_vgbbd(DisasContext *ctx)tcg_temp_free_i64 (avr[1 ]); } +/* +* vclzw VRT,VRB - Vector Count Leading Zeros Word +* +* Counting the number of leading zero bits of each word element in source +* register and placing result in appropriate word element of destination +* register. +*/ +static void trans_vclzw (DisasContext *ctx) +{ +int VT =rD (ctx->opcode); +int VB =rB (ctx->opcode); +TCGv_i32 tmp =tcg_temp_new_i32 (); +int i; + +/* Perform count for every word element using tcg_gen_clzi_i32. */ +for (i =0 ; i <4 ; i++) { +tcg_gen_ld_i32 (tmp, cpu_env, + offsetof(CPUPPCState, vsr[32 + VB].u64[0]) + i * 4); +tcg_gen_clzi_i32 (tmp, tmp,32 ); +tcg_gen_st_i32 (tmp, cpu_env, + offsetof(CPUPPCState, vsr[32 + VT].u64[0]) + i * 4); + } + +tcg_temp_free_i32 (tmp); +} +/* * vclzd VRT,VRB - Vector Count Leading Zeros Doubleword *
@@ -1283,7 +1309,7 @@ GEN_VAFORM_PAIRED(vmaddfp, vnmsubfp, 23) GEN_VXFORM_NOA(vclzb, 1, 28) GEN_VXFORM_NOA(vclzh, 1, 29) -GEN_VXFORM_NOA(vclzw, 1, 30) +GEN_VXFORM_TRANS(vclzw, 1, 30) GEN_VXFORM_TRANS(vclzd, 1, 31) GEN_VXFORM_NOA_2(vnegw, 1, 24, 6)GEN_VXFORM_NOA_2 (vnegd,1 ,24 ,7 )
Signature · 1 line
2.21.0
[Qemu-devel] [PULL 15/42] spapr: Implement dispatch tracking for tcg
In reply to David GibsonFrom: Nicholas Piggin <[email protected]>
Implement cpu_exec_enter/exit on ppc which calls into new methods of the same name in PPCVirtualHypervisorClass. These are used by spapr to implement the splpar VPA dispatch counter initially.
Message-Id: <[email protected]>
--- hw/ppc/spapr.c | 48 +++++++++++++++++++++++++++++++++ hw/ppc/spapr_hcall.c | 5 ---- include/hw/ppc/spapr.h | 7 +++++ target/ppc/cpu.h | 4 +++ target/ppc/translate_init.inc.c | 27 +++++++++++++++++++ 5 files changed, 86 insertions(+), 5 deletions(-)
hw/ppc/spapr.c +48 -0
@@ -4306,6 +4306,52 @@ PowerPCCPU *spapr_find_cpu(int vcpu_id)return NULL ; } +static void spapr_cpu_exec_enter (PPCVirtualHypervisor *vhyp,PowerPCCPU *cpu) +{ +SpaprCpuState *spapr_cpu =spapr_cpu_state (cpu); + +/* These are only called by TCG, KVM maintains dispatch state */ + +if (spapr_cpu->vpa_addr) { +CPUState *cs =CPU (cpu); +uint32_t dispatch; + + dispatch =ldl_be_phys (cs->as, + spapr_cpu->vpa_addr +VPA_DISPATCH_COUNTER ); + dispatch++; +if ((dispatch &1 ) !=0 ) { +qemu_log_mask (LOG_GUEST_ERROR , +"VPA: incorrect dispatch counter value for " +"dispatched partition %u, correcting.\n" , dispatch); + dispatch++; + } +stl_be_phys (cs->as, + spapr_cpu->vpa_addr +VPA_DISPATCH_COUNTER , dispatch); + } +} + +static void spapr_cpu_exec_exit (PPCVirtualHypervisor *vhyp,PowerPCCPU *cpu) +{ +SpaprCpuState *spapr_cpu =spapr_cpu_state (cpu); + +if (spapr_cpu->vpa_addr) { +CPUState *cs =CPU (cpu); +uint32_t dispatch; + + dispatch =ldl_be_phys (cs->as, + spapr_cpu->vpa_addr +VPA_DISPATCH_COUNTER ); + dispatch++; +if ((dispatch &1 ) !=1 ) { +qemu_log_mask (LOG_GUEST_ERROR , +"VPA: incorrect dispatch counter value for " +"preempted partition %u, correcting.\n" , dispatch); + dispatch++; + } +stl_be_phys (cs->as, + spapr_cpu->vpa_addr +VPA_DISPATCH_COUNTER , dispatch); + } +} +static void spapr_machine_class_init (ObjectClass *oc,void *data) {MachineClass *mc =MACHINE_CLASS (oc);
@@ -4362,6 +4408,8 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data) vhc->hpte_set_r = spapr_hpte_set_r; vhc->get_pate = spapr_get_pate; vhc->encode_hpt_for_kvm_pr = spapr_encode_hpt_for_kvm_pr; + vhc->cpu_exec_enter = spapr_cpu_exec_enter; + vhc->cpu_exec_exit = spapr_cpu_exec_exit; xic->ics_get = spapr_ics_get; xic->ics_resend = spapr_ics_resend; xic->icp_get = spapr_icp_get;
hw/ppc/spapr_hcall.c +0 -5
@@ -875,11 +875,6 @@ unmap_out:#define FLAGS_DEREGISTER_DTL 0x0000c00000000000ULL#define FLAGS_DEREGISTER_SLBSHADOW 0x0000e00000000000ULL -#define VPA_MIN_SIZE 640 -#define VPA_SIZE_OFFSET 0x4 -#define VPA_SHARED_PROC_OFFSET 0x9 -#define VPA_SHARED_PROC_VAL 0x2 -static target_ulong register_vpa (PowerPCCPU *cpu,target_ulong vpa) {CPUState *cs =CPU (cpu);
include/hw/ppc/spapr.h +7 -0
@@ -525,6 +525,13 @@ void spapr_register_hypercall(target_ulong opcode, spapr_hcall_fn fn);target_ulong spapr_hypercall (PowerPCCPU *cpu,target_ulong opcode,target_ulong *args); +/* Virtual Processor Area structure constants */ +#define VPA_MIN_SIZE 640 +#define VPA_SIZE_OFFSET 0x4 +#define VPA_SHARED_PROC_OFFSET 0x9 +#define VPA_SHARED_PROC_VAL 0x2 +#define VPA_DISPATCH_COUNTER 0x100 +/* ibm,set-eeh-option */ #define RTAS_EEH_DISABLE 0#define RTAS_EEH_ENABLE 1
target/ppc/cpu.h +4 -0
@@ -1224,6 +1224,10 @@ struct PPCVirtualHypervisorClass {void (*hpte_set_r)(PPCVirtualHypervisor *vhyp,hwaddr ptex,uint64_t pte1);void (*get_pate)(PPCVirtualHypervisor *vhyp,ppc_v3_pate_t *entry);target_ulong (*encode_hpt_for_kvm_pr)(PPCVirtualHypervisor *vhyp); +#ifndef CONFIG_USER_ONLY +void (*cpu_exec_enter)(PPCVirtualHypervisor *vhyp,PowerPCCPU *cpu); +void (*cpu_exec_exit)(PPCVirtualHypervisor *vhyp,PowerPCCPU *cpu); +#endif };#define TYPE_PPC_VIRTUAL_HYPERVISOR "ppc-virtual-hypervisor"
target/ppc/translate_init.inc.c +27 -0
@@ -10469,6 +10469,28 @@ static bool ppc_cpu_is_big_endian(CPUState *cs) return !msr_le; } + +static void ppc_cpu_exec_enter (CPUState *cs) +{ +PowerPCCPU *cpu =POWERPC_CPU (cs); + +if (cpu->vhyp) { +PPCVirtualHypervisorClass *vhc = +PPC_VIRTUAL_HYPERVISOR_GET_CLASS (cpu->vhyp); + vhc->cpu_exec_enter (cpu->vhyp, cpu); + } +} + +static void ppc_cpu_exec_exit (CPUState *cs) +{ +PowerPCCPU *cpu =POWERPC_CPU (cs); + +if (cpu->vhyp) { +PPCVirtualHypervisorClass *vhc = +PPC_VIRTUAL_HYPERVISOR_GET_CLASS (cpu->vhyp); + vhc->cpu_exec_exit (cpu->vhyp, cpu); + } +}#endif static void ppc_cpu_instance_init (Object *obj)
@@ -10622,6 +10644,11 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data) cc->tcg_initialize = ppc_translate_init; cc->tlb_fill = ppc_cpu_tlb_fill;#endif +#ifndef CONFIG_USER_ONLY + cc->cpu_exec_enter = ppc_cpu_exec_enter; + cc->cpu_exec_exit = ppc_cpu_exec_exit; +#endif + cc->disas_set_info = ppc_disas_set_info; dc->fw_name ="PowerPC,UNKNOWN" ;
Signature · 1 line
2.21.0
[Qemu-devel] [PULL 06/42] target/ppc: Optimize emulation of lvsl and lvsr instructions
In reply to David GibsonFrom: Stefan Brankovic <[email protected]>
Adding simple macro that is calling tcg implementation of appropriate instruction if altivec support is active.
Optimization of altivec instruction lvsl (Load Vector for Shift Left). Place bytes sh:sh+15 of value 0x00 || 0x01 || 0x02 || ... || 0x1E || 0x1F in destination register. Sh is calculated by adding 2 source registers and getting bits 60-63 of result.
First, the bits [28-31] are placed from EA to variable sh. After that, the bytes are created in the following way:
sh:(sh+7) of X(from description) by multiplying sh with 0x0101010101010101 followed by addition of the result with 0x0001020304050607. Value obtained is placed in higher doubleword element of vD.
(sh+8):(sh+15) by adding the result of previous multiplication with 0x08090a0b0c0d0e0f. Value obtained is placed in lower doubleword element of vD.
Optimization of altivec instruction lvsr (Load Vector for Shift Right). Place bytes 16-sh:31-sh of value 0x00 || 0x01 || 0x02 || ... || 0x1E || 0x1F in destination register. Sh is calculated by adding 2 source registers and getting bits 60-63 of result.
First, the bits [28-31] are placed from EA to variable sh. After that, the bytes are created in the following way:
sh:(sh+7) of X(from description) by multiplying sh with 0x0101010101010101 followed by substraction of the result from 0x1011121314151617. Value obtained is placed in higher doubleword element of vD. (sh+8):(sh+15) by substracting the result of previous multiplication from 0x18191a1b1c1d1e1f. Value obtained is placed in lower doubleword element of vD.
Message-Id: <[email protected]>
--- target/ppc/helper.h | 2 - target/ppc/int_helper.c | 18 ----- target/ppc/translate/vmx-impl.inc.c | 121 ++++++++++++++++++++-------- 3 files changed, 89 insertions(+), 52 deletions(-)
target/ppc/helper.h +0 -2
@@ -193,8 +193,6 @@ DEF_HELPER_2(vprtybw, void, avr, avr) DEF_HELPER_2(vprtybd, void, avr, avr) DEF_HELPER_2(vprtybq, void, avr, avr) DEF_HELPER_3(vsubcuw, void, avr, avr, avr) -DEF_HELPER_2(lvsl, void, avr, tl) -DEF_HELPER_2(lvsr, void, avr, tl) DEF_HELPER_FLAGS_5(vaddsbs, TCG_CALL_NO_RWG, void, avr, avr, avr, avr, i32) DEF_HELPER_FLAGS_5(vaddshs, TCG_CALL_NO_RWG, void, avr, avr, avr, avr, i32)DEF_HELPER_FLAGS_5 (vaddsws,TCG_CALL_NO_RWG , void, avr, avr, avr, avr, i32)
target/ppc/int_helper.c +0 -18
@@ -459,24 +459,6 @@ SATCVT(sd, uw, int64_t, uint32_t, 0, UINT32_MAX)#undef SATCVT#undef SATCVTU -void helper_lvsl (ppc_avr_t *r,target_ulong sh) -{ -int i, j = (sh &0xf ); - -for (i =0 ; i <ARRAY_SIZE (r->u8); i++) { - r->VsrB (i) = j++; - } -} - -void helper_lvsr (ppc_avr_t *r,target_ulong sh) -{ -int i, j =0x10 - (sh &0xf ); - -for (i =0 ; i <ARRAY_SIZE (r->u8); i++) { - r->VsrB (i) = j++; - } -} -void helper_mtvscr (CPUPPCState *env,uint32_t vscr) { env->vscr = vscr & ~(1u <<VSCR_SAT );
target/ppc/translate/vmx-impl.inc.c +89 -32
145 lines not on this page · raw message
Signature · 1 line
2.21.0
[Qemu-devel] [PULL 37/42] spapr/xive: Mask the EAS when allocating an IRQ
In reply to David GibsonFrom: Cédric Le Goater <[email protected]>
If an IRQ is allocated and not configured, such as a MSI requested by a PCI driver, it can be saved in its default state and possibly later on restored using the same state. If not initially MASKED, KVM will try to find a matching priority/target tuple for the interrupt and fail to restore the VM because 0/0 is not a valid target.
When allocating a IRQ number, the EAS should be set to a sane default :
VALID and MASKED.
Message-Id: <[email protected]>
--- hw/intc/spapr_xive.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
hw/intc/spapr_xive.c +4 -1
@@ -536,7 +536,10 @@ bool spapr_xive_irq_claim(SpaprXive *xive, uint32_t lisn, bool lsi)return false; } - xive->eat[lisn].w |=cpu_to_be64 (EAS_VALID ); +/* +* Set default values when allocating an IRQ number +*/ + xive->eat[lisn].w |=cpu_to_be64 (EAS_VALID |EAS_MASKED );if (lsi) {xive_source_irq_set_lsi (xsrc, lisn); }
Signature · 1 line
2.21.0
[Qemu-devel] [PULL 07/42] target/ppc: Optimize emulation of vsl and vsr instructions
In reply to David GibsonFrom: Stefan Brankovic <[email protected]>
Optimization of altivec instructions vsl and vsr(Vector Shift Left/Rigt). Perform shift operation (left and right respectively) on 128 bit value of register vA by value specified in bits 125-127 of register vB. Lowest 3 bits in each byte element of register vB must be identical or result is undefined.
For vsl instruction, the first step is bits 125-127 of register vB have to be saved in variable sh. Then, the highest sh bits of the lower doubleword element of register vA are saved in variable shifted, in order not to lose those bits when shift operation is performed on the lower doubleword element of register vA, which is the next step. After shifting the lower doubleword element shift operation is performed on higher doubleword element of vA, with replacement of the lowest sh bits(that are now 0) with bits saved in shifted.
For vsr instruction, firstly, the bits 125-127 of register vB have to be saved in variable sh. Then, the lowest sh bits of the higher doubleword element of register vA are saved in variable shifted, in odred not to lose those bits when the shift operation is performed on the higher doubleword element of register vA, which is the next step. After shifting higher doubleword element, shift operation is performed on lower doubleword element of vA, with replacement of highest sh bits(that are now 0) with bits saved in shifted.
Message-Id: <[email protected]>
--- target/ppc/helper.h | 2 - target/ppc/int_helper.c | 35 ---------- target/ppc/translate/vmx-impl.inc.c | 101 +++++++++++++++++++++++++++- 3 files changed, 99 insertions(+), 39 deletions(-)
target/ppc/helper.h +0 -2
@@ -217,8 +217,6 @@ DEF_HELPER_3(vrlb, void, avr, avr, avr) DEF_HELPER_3(vrlh, void, avr, avr, avr) DEF_HELPER_3(vrlw, void, avr, avr, avr) DEF_HELPER_3(vrld, void, avr, avr, avr) -DEF_HELPER_3(vsl, void, avr, avr, avr) -DEF_HELPER_3(vsr, void, avr, avr, avr) DEF_HELPER_4(vsldoi, void, avr, avr, avr, i32) DEF_HELPER_3(vextractub, void, avr, avr, i32)DEF_HELPER_3 (vextractuh, void, avr, avr, i32)
target/ppc/int_helper.c +0 -35
@@ -1740,41 +1740,6 @@ VEXTU_X_DO(vextuhrx, 16, 0) VEXTU_X_DO(vextuwrx, 32, 0)#undef VEXTU_X_DO -/* -* The specification says that the results are undefined if all of the -* shift counts are not identical. We check to make sure that they -* are to conform to what real hardware appears to do. -*/ -#define VSHIFT (suffix, leftp) \ - void helper_vs##suffix(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) \ - { \ - int shift = b->VsrB(15) & 0x7; \ - int doit = 1; \ - int i; \ - \ - for (i = 0; i < ARRAY_SIZE(r->u8); i++) { \ - doit = doit && ((b->u8[i] & 0x7) == shift); \ - } \ - if (doit) { \ - if (shift == 0) { \ - *r = *a; \ - } else if (leftp) { \ - uint64_t carry = a->VsrD(1) >> (64 - shift); \ - \ - r->VsrD(0) = (a->VsrD(0) << shift) | carry; \ - r->VsrD(1) = a->VsrD(1) << shift; \ - } else { \ - uint64_t carry = a->VsrD(0) << (64 - shift); \ - \ - r->VsrD(1) = (a->VsrD(1) >> shift) | carry; \ - r->VsrD(0) = a->VsrD(0) >> shift; \ - } \ - } \ - } -VSHIFT(l, 1) -VSHIFT(r, 0) -#undef VSHIFT -void helper_vslv (ppc_avr_t *r,ppc_avr_t *a,ppc_avr_t *b) {int i;
target/ppc/translate/vmx-impl.inc.c +99 -2
116 lines not on this page · raw message
Signature · 1 line
2.21.0
[Qemu-devel] [PULL 12/42] ppc: fix memory leak in spapr_caps_add_properties
In reply to David GibsonFrom: Shivaprasad G Bhat <[email protected]>
Free the capability name string after setting
the capability.
Message-Id: <156335156198.82682.8756968724044750843.stgit@lep8c.aus.stglabs.ibm.com>
--- hw/ppc/spapr_caps.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
hw/ppc/spapr_caps.c +3 -1
@@ -793,7 +793,7 @@ void spapr_caps_add_properties(SpaprMachineClass *smc, Error **errp)for (i =0 ; i <ARRAY_SIZE (capability_table); i++) {SpaprCapabilityInfo *cap = &capability_table[i]; -const char *name =g_strdup_printf ("cap-%s" , cap->name); +char *name =g_strdup_printf ("cap-%s" , cap->name);char *desc; object_class_property_add(klass, name, cap->type,
@@ -801,11 +801,13 @@ void spapr_caps_add_properties(SpaprMachineClass *smc, Error **errp) NULL, cap, &local_err);if (local_err) {error_propagate (errp, local_err); +g_free (name);return ; } desc =g_strdup_printf ("%s" , cap->description);object_class_property_set_description (klass, name, desc, &local_err); +g_free (name);g_free (desc);if (local_err) {error_propagate (errp, local_err);
Signature · 1 line
2.21.0
[Qemu-devel] [PULL 34/42] spapr/pci: Free MSIs during reset
In reply to David GibsonFrom: Greg Kurz <[email protected]>
When the machine is reset, the MSI bitmap is cleared but the allocated MSIs are not freed. Some operating systems, such as AIX, can detect the previous configuration and assert.
Empty the MSI cache, this performs the needed cleanup.
Message-Id: <[email protected]>
--- hw/ppc/spapr_pci.c | 2 ++ 1 file changed, 2 insertions(+)
hw/ppc/spapr_pci.c +2 -0
@@ -2080,6 +2080,8 @@ static void spapr_phb_reset(DeviceState *qdev)if (spapr_phb_eeh_available (SPAPR_PCI_HOST_BRIDGE (qdev))) {spapr_phb_vfio_reset (qdev); } + +g_hash_table_remove_all (sphb->msi); }static Property spapr_phb_properties[] = {
Signature · 1 line
2.21.0
[Qemu-devel] [PULL 29/42] machine: Add wakeup method to MachineClass
In reply to David GibsonFrom: Nicholas Piggin <[email protected]>
Waking from suspend is not logically a machine reset on all machines, particularly in the paravirtualized case rather than hardware emulated. The ppc spapr machine for example just invokes hypervisor to suspend, and expects that call to return with the machine in the same state (modulo some possible migration and reconfiguration details).
Implement a machine ->wakeup method and use that if it exists.
Message-Id: <[email protected]>
--- include/hw/boards.h | 1 + vl.c | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-)
include/hw/boards.h +1 -0
@@ -180,6 +180,7 @@ struct MachineClass {void (*init)(MachineState *state);void (*reset)(MachineState *state); +void (*wakeup)(MachineState *state);void (*hot_add_cpu)(MachineState *state,const int64_t id,Error **errp);int (*kvm_type)(MachineState *machine,const char *arg);void (*smp_parse)(MachineState *ms,QemuOpts *opts);
vl.c +17 -1
@@ -1557,6 +1557,22 @@ void qemu_system_reset(ShutdownCause reason)cpu_synchronize_all_post_reset (); } +/* +* Wake the VM after suspend. +*/ +static void qemu_system_wakeup (void ) +{ +MachineClass *mc; + + mc = current_machine ?MACHINE_GET_CLASS (current_machine) :NULL ; + +if (mc && mc->wakeup) { + mc->wakeup (current_machine); + }else { +qemu_system_reset (SHUTDOWN_CAUSE_NONE ); + } +} +void qemu_system_guest_panicked (GuestPanicInformation *info) {qemu_log_mask (LOG_GUEST_ERROR ,"Guest crashed" );
@@ -1765,7 +1781,7 @@ static bool main_loop_should_exit(void) }if (qemu_wakeup_requested ()) {pause_all_vcpus (); -qemu_system_reset (SHUTDOWN_CAUSE_NONE ); +qemu_system_wakeup ();notifier_list_notify (&wakeup_notifiers, &wakeup_reason); wakeup_reason =QEMU_WAKEUP_REASON_NONE ;resume_all_vcpus ();
Signature · 1 line
2.21.0
[Qemu-devel] [PULL 16/42] spapr: Implement H_PROD
In reply to David GibsonFrom: Nicholas Piggin <[email protected]>
H_PROD is added, and H_CEDE is modified to test the prod bit according to PAPR.
Message-Id: <[email protected]>
--- hw/ppc/spapr.c | 1 + hw/ppc/spapr_hcall.c | 32 ++++++++++++++++++++++++++++++++ include/hw/ppc/spapr_cpu_core.h | 1 + 3 files changed, 34 insertions(+)
hw/ppc/spapr.c +1 -0
@@ -4312,6 +4312,7 @@ static void spapr_cpu_exec_enter(PPCVirtualHypervisor *vhyp, PowerPCCPU *cpu)/* These are only called by TCG, KVM maintains dispatch state */ + spapr_cpu->prod = false;if (spapr_cpu->vpa_addr) {CPUState *cs =CPU (cpu);uint32_t dispatch;
hw/ppc/spapr_hcall.c +32 -0
@@ -1051,14 +1051,44 @@ static target_ulong h_cede(PowerPCCPU *cpu, SpaprMachineState *spapr, {CPUPPCState *env = &cpu->env;CPUState *cs =CPU (cpu); +SpaprCpuState *spapr_cpu =spapr_cpu_state (cpu); env->msr |= (1ULL <<MSR_EE );hreg_compute_hflags (env); + +if (spapr_cpu->prod) { + spapr_cpu->prod = false; +return H_SUCCESS ; + } +if (!cpu_has_work (cs)) { cs->halted =1 ; cs->exception_index =EXCP_HLT ; cs->exit_request =1 ; } + +return H_SUCCESS ; +} + +static target_ulong h_prod (PowerPCCPU *cpu,SpaprMachineState *spapr, +target_ulong opcode,target_ulong *args) +{ +target_long target = args[0 ]; +PowerPCCPU *tcpu; +CPUState *cs; +SpaprCpuState *spapr_cpu; + + tcpu =spapr_find_cpu (target); + cs =CPU (tcpu); +if (!cs) { +return H_PARAMETER ; + } + + spapr_cpu =spapr_cpu_state (tcpu); + spapr_cpu->prod = true; + cs->halted =0 ; +qemu_cpu_kick (cs); +return H_SUCCESS ; }
@@ -1885,6 +1915,8 @@ static void hypercall_register_types(void)/* hcall-splpar */ spapr_register_hypercall (H_REGISTER_VPA , h_register_vpa);spapr_register_hypercall (H_CEDE , h_cede); +spapr_register_hypercall (H_PROD , h_prod); +spapr_register_hypercall (H_SIGNAL_SYS_RESET , h_signal_sys_reset);/* processor register resource access h-calls */
include/hw/ppc/spapr_cpu_core.h +1 -0
@@ -46,6 +46,7 @@ typedef struct SpaprCpuState {uint64_t vpa_addr;uint64_t slb_shadow_addr, slb_shadow_size;uint64_t dtl_addr, dtl_size; +bool prod;/* not migrated, only used to improve dispatch latencies */ struct ICPState *icp;struct XiveTCTX *tctx; } SpaprCpuState;
Signature · 1 line
2.21.0
[Qemu-devel] [PULL 18/42] spapr: Implement H_JOIN
In reply to David GibsonFrom: Nicholas Piggin <[email protected]>
This has been useful to modify and test the Linux pseries suspend code but it requires modification to the guest to call it (due to being gated by other unimplemented features). It is not otherwise used by Linux yet, but work is slowly progressing there.
Message-Id: <[email protected]>
--- hw/ppc/spapr.c | 1 + hw/ppc/spapr_hcall.c | 74 ++++++++++++++++++++++++++++++++++++-------- 2 files changed, 62 insertions(+), 13 deletions(-)
hw/ppc/spapr.c +1 -0
@@ -1070,6 +1070,7 @@ static void spapr_dt_rtas(SpaprMachineState *spapr, void *fdt)add_str (hypertas,"hcall-tce" );add_str (hypertas,"hcall-vio" );add_str (hypertas,"hcall-splpar" ); +add_str (hypertas,"hcall-join" );add_str (hypertas,"hcall-bulk" );add_str (hypertas,"hcall-set-mode" );add_str (hypertas,"hcall-sprg0" );
hw/ppc/spapr_hcall.c +61 -13
99 lines not on this page · raw message
Signature · 1 line
2.21.0
[Qemu-devel] [PULL 41/42] ppc: Fix emulated INFINITY and NAN conversions
In reply to David GibsonFrom: "Paul A. Clarke" <[email protected]>
helper_todouble() was not properly converting INFINITY from 32 bit float to 64 bit double.
(Normalized operand conversion is unchanged, other than indentation.)
Message-Id: <[email protected]>
--- target/ppc/fpu_helper.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
target/ppc/fpu_helper.c +11 -4
@@ -58,10 +58,17 @@ uint64_t helper_todouble(uint32_t arg)uint64_t ret;if (likely (abs_arg >=0x00800000 )) { -/* Normalized operand, or Inf, or NaN. */ - ret = (uint64_t )extract32 (arg,30 ,2 ) <<62 ; - ret |= ((extract32 (arg,30 ,1 ) ^1 ) * (uint64_t )7 ) <<59 ; - ret |= (uint64_t )extract32 (arg,0 ,30 ) <<29 ; +if (unlikely (extract32 (arg,23 ,8 ) ==0xff )) { +/* Inf or NAN. */ + ret = (uint64_t )extract32 (arg,31 ,1 ) <<63 ; + ret |= (uint64_t )0x7ff <<52 ; + ret |= (uint64_t )extract32 (arg,0 ,23 ) <<29 ; + }else { +/* Normalized operand. */ + ret = (uint64_t )extract32 (arg,30 ,2 ) <<62 ; + ret |= ((extract32 (arg,30 ,1 ) ^1 ) * (uint64_t )7 ) <<59 ; + ret |= (uint64_t )extract32 (arg,0 ,30 ) <<29 ; + } }else {/* Zero or Denormalized operand. */ ret = (uint64_t )extract32 (arg,31 ,1 ) <<63 ;
Signature · 1 line
2.21.0
[Qemu-devel] [PULL 28/42] ppc/xive: Improve 'info pic' support
In reply to David GibsonFrom: Cédric Le Goater <[email protected]>
Provide a better output of the XIVE END structures including the escalation information and extend the PowerNV machine 'info pic' command with a dump of the END EAS table used for escalations.
Message-Id: <[email protected]>
--- hw/intc/pnv_xive.c | 9 +++++++ hw/intc/spapr_xive.c | 1 - hw/intc/xive.c | 48 +++++++++++++++++++++++++++++++++----- include/hw/ppc/xive.h | 5 ---- include/hw/ppc/xive_regs.h | 6 +++++ 5 files changed, 57 insertions(+), 12 deletions(-)
hw/intc/pnv_xive.c +9 -0
@@ -1595,6 +1595,15 @@ void pnv_xive_pic_print_info(PnvXive *xive, Monitor *mon) }xive_end_pic_print_info (&end, i, mon); } + +monitor_printf (mon,"XIVE[%x] END Escalation %08x .. %08x\n" , blk,0 , + nr_ends -1 ); +for (i =0 ; i < nr_ends; i++) { +if (xive_router_get_end (xrtr, blk, i, &end)) { +break ; + } +xive_end_eas_pic_print_info (&end, i, mon); + } }static void pnv_xive_reset (void *dev)
hw/intc/spapr_xive.c +0 -1
@@ -146,7 +146,6 @@ static void spapr_xive_end_pic_print_info(SpaprXive *xive, XiveEND *end, priority, qindex, qentries, qaddr_base, qgen);xive_end_queue_pic_print_info (end,6 , mon); -monitor_printf (mon,"]" ); }void spapr_xive_pic_print_info (SpaprXive *xive,Monitor *mon)
hw/intc/xive.c +42 -6
78 lines not on this page · raw message
include/hw/ppc/xive.h +0 -5
@@ -354,8 +354,6 @@ typedef struct XiveRouterClass { XiveTCTX *(*get_tctx)(XiveRouter *xrtr, CPUState *cs); } XiveRouterClass; -void xive_eas_pic_print_info (XiveEAS *eas,uint32_t lisn,Monitor *mon); -int xive_router_get_eas (XiveRouter *xrtr,uint8_t eas_blk,uint32_t eas_idx,XiveEAS *eas); int xive_router_get_end(XiveRouter *xrtr, uint8_t end_blk, uint32_t end_idx,
@@ -397,9 +395,6 @@ typedef struct XiveENDSource {*/ #define XIVE_PRIORITY_MAX 7 -void xive_end_pic_print_info (XiveEND *end,uint32_t end_idx,Monitor *mon); -void xive_end_queue_pic_print_info (XiveEND *end,uint32_t width,Monitor *mon); -/* * XIVE Thread Interrupt Management Aera (TIMA) *
include/hw/ppc/xive_regs.h +6 -0
@@ -131,6 +131,8 @@ typedef struct XiveEAS {#define xive_eas_is_valid (eas) (be64_to_cpu((eas)->w) & EAS_VALID)#define xive_eas_is_masked (eas) (be64_to_cpu((eas)->w) & EAS_MASKED) +void xive_eas_pic_print_info (XiveEAS *eas,uint32_t lisn,Monitor *mon); +static inline uint64_t xive_get_field64 (uint64_t mask,uint64_t word) {return (be64_to_cpu (word) & mask) >>ctz64 (mask);
@@ -221,6 +223,10 @@ static inline uint64_t xive_end_qaddr(XiveEND *end)be32_to_cpu (end->w3); } +void xive_end_pic_print_info (XiveEND *end,uint32_t end_idx,Monitor *mon); +void xive_end_queue_pic_print_info (XiveEND *end,uint32_t width,Monitor *mon); +void xive_end_eas_pic_print_info (XiveEND *end,uint32_t end_idx,Monitor *mon); +/* Notification Virtual Target (NVT) */ typedef struct XiveNVT { uint32_t w0;
Signature · 1 line
2.21.0
[Qemu-devel] [PULL 13/42] ppc: fix memory leak in spapr_dt_drc()
In reply to David GibsonFrom: Shivaprasad G Bhat <[email protected]>
Leaking the drc_name while preparing the DT properties. Fixing that.
Also, remove the const qualifier from spapr_drc_name().
Message-Id: <156335159028.82682.5404622104535818162.stgit@lep8c.aus.stglabs.ibm.com>
--- hw/ppc/spapr_drc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
hw/ppc/spapr_drc.c +5 -2
@@ -227,7 +227,7 @@ static uint32_t drc_set_unusable(SpaprDrc *drc)return RTAS_OUT_SUCCESS ; } -static const char *spapr_drc_name (SpaprDrc *drc) +static char *spapr_drc_name (SpaprDrc *drc) {SpaprDrcClass *drck =SPAPR_DR_CONNECTOR_GET_CLASS (drc);
@@ -828,6 +828,7 @@ int spapr_dt_drc(void *fdt, int offset, Object *owner, uint32_t drc_type_mask)Object *obj;SpaprDrc *drc;SpaprDrcClass *drck; +char *drc_name =NULL ;uint32_t drc_index, drc_power_domain;if (!strstart (prop->type,"link<" ,NULL )) {
@@ -857,8 +858,10 @@ int spapr_dt_drc(void *fdt, int offset, Object *owner, uint32_t drc_type_mask)g_array_append_val (drc_power_domains, drc_power_domain);/* ibm,drc-names */ - drc_names =g_string_append (drc_names,spapr_drc_name (drc)); + drc_name =spapr_drc_name (drc); + drc_names =g_string_append (drc_names, drc_name); drc_names =g_string_insert_len (drc_names,-1 ,"\0" ,1 ); +g_free (drc_name);/* ibm,drc-types */ drc_types =g_string_append (drc_types, drck->typename);
Signature · 1 line
2.21.0
[Qemu-devel] [PULL 17/42] spapr: Implement H_CONFER
In reply to David GibsonFrom: Nicholas Piggin <[email protected]>
This does not do directed yielding and is not quite as strict as PAPR specifies in terms of precise dispatch behaviour. This generally will mean suboptimal performance, rather than guest misbehaviour. Linux does not rely on exact dispatch behaviour.
Message-Id: <[email protected]>
--- hw/ppc/spapr_hcall.c | 67 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+)
hw/ppc/spapr_hcall.c +67 -0
@@ -1070,6 +1070,72 @@ static target_ulong h_cede(PowerPCCPU *cpu, SpaprMachineState *spapr,return H_SUCCESS ; } +static target_ulong h_confer (PowerPCCPU *cpu,SpaprMachineState *spapr, +target_ulong opcode,target_ulong *args) +{ +target_long target = args[0 ]; +uint32_t dispatch = args[1 ]; +CPUState *cs =CPU (cpu); +SpaprCpuState *spapr_cpu; + +/* +* -1 means confer to all other CPUs without dispatch counter check, +* otherwise it's a targeted confer. +*/ +if (target !=-1 ) { +PowerPCCPU *target_cpu =spapr_find_cpu (target); +uint32_t target_dispatch; + +if (!target_cpu) { +return H_PARAMETER ; + } + + spapr_cpu =spapr_cpu_state (target_cpu); + +/* +* target == self is a special case, we wait until prodded, without +* dispatch counter check. +*/ +if (cpu == target_cpu) { +if (spapr_cpu->prod) { + spapr_cpu->prod = false; + +return H_SUCCESS ; + } + + cs->halted =1 ; + cs->exception_index =EXCP_HALTED ; + cs->exit_request =1 ; + +return H_SUCCESS ; + } + +if (!spapr_cpu->vpa_addr || ((dispatch &1 ) ==0 )) { +return H_SUCCESS ; + } + + target_dispatch =ldl_be_phys (cs->as, + spapr_cpu->vpa_addr +VPA_DISPATCH_COUNTER ); +if (target_dispatch != dispatch) { +return H_SUCCESS ; + } + +/* +* The targeted confer does not do anything special beyond yielding +* the current vCPU, but even this should be better than nothing. +* At least for single-threaded tcg, it gives the target a chance to +* run before we run again. Multi-threaded tcg does not really do +* anything with EXCP_YIELD yet. +*/ + } + + cs->exception_index =EXCP_YIELD ; + cs->exit_request =1 ; +cpu_loop_exit (cs); + +return H_SUCCESS ; +} +static target_ulong h_prod (PowerPCCPU *cpu,SpaprMachineState *spapr,target_ulong opcode,target_ulong *args) {
@@ -1915,6 +1981,7 @@ static void hypercall_register_types(void)/* hcall-splpar */ spapr_register_hypercall (H_REGISTER_VPA , h_register_vpa);spapr_register_hypercall (H_CEDE , h_cede); +spapr_register_hypercall (H_CONFER , h_confer);spapr_register_hypercall (H_PROD , h_prod);spapr_register_hypercall (H_SIGNAL_SYS_RESET , h_signal_sys_reset);
Signature · 1 line
2.21.0
[Qemu-devel] [PULL 36/42] spapr: Implement better workaround in spapr-vty device
In reply to David GibsonFrom: Paul Mackerras <[email protected]>
Linux guest kernels have code which scans the string of characters returned from the H_GET_TERM_CHAR hypercall and removes any \0 character which comes immediately after a \r character. This is to work around a bug which was present in some ancient versions of PowerVM. In order to avoid the corruption of the console byte stream that this introduced, commit 6c3bc244d3cb ("spapr: Implement bug in spapr-vty device to be compatible with PowerVM") added a workaround which adds a \0 character after every \r character. Unfortunately, this corrupts the console byte stream for those operating systems, such as AIX, which don't remove the null bytes.
We can avoid triggering the Linux kernel workaround if we avoid returning a buffer which contains a \0 after a \r. We can do that by breaking out of the loop in vty_getchars() if we are about to insert a \0 and the previous character in the buffer is a \r. That means we return the characters up to the \r for the current H_GET_TERM_CHAR, and the characters starting with the \0 for the next one.
With this workaround, we don't insert any spurious characters and we avoid triggering the Linux kernel workaround, so the guest will receive an uncorrupted stream whether or not they have the workaround.
Message-Id: <[email protected]>
--- hw/char/spapr_vty.c | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-)
hw/char/spapr_vty.c +12 -18
@@ -59,25 +59,19 @@ static int vty_getchars(SpaprVioDevice *sdev, uint8_t *buf, int max)int n =0 ;while ((n < max) && (dev->out != dev->in)) { - buf[n++] = dev->buf[dev->out++ %VTERM_BUFSIZE ]; - -/* PowerVM's vty implementation has a bug where it inserts a -* \0 after every \r going to the guest. Existing guests have -* a workaround for this which removes every \0 immediately -* following a \r, so here we make ourselves bug-for-bug -* compatible, so that the guest won't drop a real \0-after-\r -* that happens to occur in a binary stream. */ -if (buf[n -1 ] =='\r' ) { -if (n < max) { - buf[n++] ='\0' ; - }else { -/* No room for the extra \0, roll back and try again -* next time */ - dev->out--; - n--; -break ; - } +/* +* Long ago, PowerVM's vty implementation had a bug where it +* inserted a \0 after every \r going to the guest. Existing +* guests have a workaround for this which removes every \0 +* immediately following a \r. To avoid triggering this +* workaround, we stop before inserting a \0 if the preceding +* character in the output buffer is a \r. +*/ +if (n >0 && (buf[n -1 ] =='\r' ) && + (dev->buf[dev->out %VTERM_BUFSIZE ] =='\0' )) { +break ; } + buf[n++] = dev->buf[dev->out++ %VTERM_BUFSIZE ]; }qemu_chr_fe_accept_input (&dev->chardev);
Signature · 1 line
2.21.0
[Qemu-devel] [PULL 14/42] ppc: fix leak in h_client_architecture_support
In reply to David GibsonFrom: Shivaprasad G Bhat <[email protected]>
Free all SpaprOptionVector local pointers after use.
Message-Id: <156335160761.82682.11912058325777251614.stgit@lep8c.aus.stglabs.ibm.com>
--- hw/ppc/spapr_hcall.c | 2 ++ 1 file changed, 2 insertions(+)
hw/ppc/spapr_hcall.c +2 -0
@@ -1613,6 +1613,7 @@ static target_ulong h_client_architecture_support(PowerPCCPU *cpu, ov5_updates =spapr_ovec_new (); spapr->cas_reboot =spapr_ovec_diff (ov5_updates, ov5_cas_old, spapr->ov5_cas); +spapr_ovec_cleanup (ov5_cas_old);/* Now that processing is finished, set the radix/hash bit for the * guest if it requested a valid mode; otherwise terminate the boot. */ if (guest_radix) {
@@ -1630,6 +1631,7 @@ static target_ulong h_client_architecture_support(PowerPCCPU *cpu, } spapr->cas_legacy_guest_workaround = !spapr_ovec_test (ov1_guest,OV1_PPC_3_00 ); +spapr_ovec_cleanup (ov1_guest);if (!spapr->cas_reboot) {/* If spapr_machine_reset() did not set up a HPT but one is necessary * (because the guest isn't going to use radix) then set it up here. */
Signature · 1 line
2.21.0
[Qemu-devel] [PULL 38/42] target/ppc: Add Directed Privileged Door-bell Exception State (DPDES) SPR
In reply to David GibsonFrom: Alexey Kardashevskiy <[email protected]>
DPDES stores a status of a doorbell message and if it is lost in migration, the destination CPU won't receive it. This does not hit us much as IPIs complete too quick to catch a pending one and even if we missed one, broadcasts happen often enough to wake that CPU.
This defines DPDES and registers with KVM for migration.
Message-Id: <[email protected]>
--- target/ppc/cpu.h | 1 + target/ppc/translate_init.inc.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+)
target/ppc/cpu.h +1 -0
@@ -1466,6 +1466,7 @@ typedef PowerPCCPU ArchCPU;#define SPR_MPC_ICTRL (0x09E)#define SPR_MPC_BAR (0x09F)#define SPR_PSPB (0x09F) +#define SPR_DPDES (0x0B0)#define SPR_DAWR (0x0B4)#define SPR_RPR (0x0BA)#define SPR_CIABR (0x0BB)
target/ppc/translate_init.inc.c +14 -0
@@ -8198,6 +8198,18 @@ static void gen_spr_power8_pspb(CPUPPCState *env) KVM_REG_PPC_PSPB, 0); } +static void gen_spr_power8_dpdes (CPUPPCState *env) +{ +#if !defined(CONFIG_USER_ONLY ) +/* Directed Privileged Door-bell Exception State, used for IPI */ +spr_register_kvm_hv (env,SPR_DPDES ,"DPDES" , +SPR_NOACCESS ,SPR_NOACCESS , + &spr_read_generic,SPR_NOACCESS , + &spr_read_generic, &spr_write_generic, +KVM_REG_PPC_DPDES ,0x00000000 ); +#endif +} +static void gen_spr_power8_ic (CPUPPCState *env) {#if !defined(CONFIG_USER_ONLY )
@@ -8629,6 +8641,7 @@ static void init_proc_POWER8(CPUPPCState *env)gen_spr_power8_pmu_user (env);gen_spr_power8_tm (env);gen_spr_power8_pspb (env); +gen_spr_power8_dpdes (env);gen_spr_vtb (env);gen_spr_power8_ic (env);gen_spr_power8_book4 (env);
@@ -8817,6 +8830,7 @@ static void init_proc_POWER9(CPUPPCState *env)gen_spr_power8_pmu_user (env);gen_spr_power8_tm (env);gen_spr_power8_pspb (env); +gen_spr_power8_dpdes (env);gen_spr_vtb (env);gen_spr_power8_ic (env);gen_spr_power8_book4 (env);
Signature · 1 line
2.21.0
[Qemu-devel] [PULL 23/42] ppc/xive: Implement TM_PULL_OS_CTX special command
In reply to David GibsonFrom: Cédric Le Goater <[email protected]>
When a vCPU is not dispatched anymore on a HW thread, the Hypervisor (KVM on Linux) invalidates the OS interrupt context of a vCPU with this special command. It returns the OS CAM line value and resets the VO bit.
Message-Id: <[email protected]>
--- hw/intc/xive.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
hw/intc/xive.c +14 -1
@@ -337,6 +337,17 @@ static void xive_tm_set_os_pending(XiveTCTX *tctx, hwaddr offset,xive_tctx_notify (tctx,TM_QW1_OS ); } +static uint64_t xive_tm_pull_os_ctx (XiveTCTX *tctx,hwaddr offset, +unsigned size) +{ +uint32_t qw1w2_prev =xive_tctx_word2 (&tctx->regs[TM_QW1_OS ]); +uint32_t qw1w2; + + qw1w2 =xive_set_field32 (TM_QW1W2_VO , qw1w2_prev,0 ); +memcpy (&tctx->regs[TM_QW1_OS +TM_WORD2 ], &qw1w2,4 ); +return qw1w2; +} +/* * Define a mapping of "special" operations depending on the TIMA page * offset and the size of the operation.
@@ -363,6 +374,8 @@ static const XiveTmOp xive_tm_operations[] = {/* MMIOs above 2K : special operations with side effects */ { XIVE_TM_OS_PAGE, TM_SPC_ACK_OS_REG, 2, NULL, xive_tm_ack_os_reg }, { XIVE_TM_OS_PAGE, TM_SPC_SET_OS_PENDING, 1, xive_tm_set_os_pending, NULL }, + { XIVE_TM_HV_PAGE, TM_SPC_PULL_OS_CTX, 4, NULL, xive_tm_pull_os_ctx }, + { XIVE_TM_HV_PAGE, TM_SPC_PULL_OS_CTX, 8, NULL, xive_tm_pull_os_ctx }, { XIVE_TM_HV_PAGE, TM_SPC_ACK_HV_REG, 2, NULL, xive_tm_ack_hv_reg }, { XIVE_TM_HV_PAGE, TM_SPC_PULL_POOL_CTX, 4, NULL, xive_tm_pull_pool_ctx }, { XIVE_TM_HV_PAGE, TM_SPC_PULL_POOL_CTX, 8, NULL, xive_tm_pull_pool_ctx },
@@ -406,7 +419,7 @@ void xive_tctx_tm_write(XiveTCTX *tctx, hwaddr offset, uint64_t value,if (offset &0x800 ) { xto =xive_tm_find_op (offset, size, true);if (!xto) { -qemu_log_mask (LOG_GUEST_ERROR ,"XIVE: invalid write access at TIMA" +qemu_log_mask (LOG_GUEST_ERROR ,"XIVE: invalid write access at TIMA " "@%" HWADDR_PRIx"\n" , offset); }else { xto->write_handler (tctx, offset, value, size);
Signature · 1 line
2.21.0
[Qemu-devel] [PULL 20/42] spapr: initial implementation for H_TPM_COMM/spapr-tpm-proxy
In reply to David GibsonFrom: Michael Roth <[email protected]>
This implements the H_TPM_COMM hypercall, which is used by an Ultravisor to pass TPM commands directly to the host's TPM device, or a TPM Resource Manager associated with the device.
This also introduces a new virtual device, spapr-tpm-proxy, which is used to configure the host TPM path to be used to service requests sent by H_TPM_COMM hcalls, for example:
-device spapr-tpm-proxy,id=tpmp0,host-path=/dev/tpmrm0
By default, no spapr-tpm-proxy will be created, and hcalls will return H_FUNCTION.
The full specification for this hypercall can be found in docs/specs/ppc-spapr-uv-hcalls.txt
Since SVM-related hcalls like H_TPM_COMM use a reserved range of 0xEF00-0xEF80, we introduce a separate hcall table here to handle them.
Message-Id: <[email protected]>
--- hw/ppc/Makefile.objs | 1 + hw/ppc/spapr.c | 33 +++++- hw/ppc/spapr_hcall.c | 13 +++ hw/ppc/spapr_tpm_proxy.c | 178 +++++++++++++++++++++++++++++++ hw/ppc/trace-events | 4 + include/hw/ppc/spapr.h | 11 ++ include/hw/ppc/spapr_tpm_proxy.h | 31 ++++++ 7 files changed, 270 insertions(+), 1 deletion(-) create mode 100644 hw/ppc/spapr_tpm_proxy.c create mode 100644 include/hw/ppc/spapr_tpm_proxy.h
hw/ppc/Makefile.objs +1 -0
@@ -5,6 +5,7 @@ obj-$(CONFIG_PSERIES) += spapr.o spapr_caps.o spapr_vio.o spapr_events.o obj-$(CONFIG_PSERIES) += spapr_hcall.o spapr_iommu.o spapr_rtas.o obj-$(CONFIG_PSERIES) += spapr_pci.o spapr_rtc.o spapr_drc.o obj-$(CONFIG_PSERIES) += spapr_cpu_core.o spapr_ovec.o spapr_irq.o +obj-$(CONFIG_PSERIES) += spapr_tpm_proxy.o obj-$(CONFIG_SPAPR_RNG) += spapr_rng.o # IBM PowerNV obj-$(CONFIG_POWERNV) += pnv.o pnv_xscom.o pnv_core.o pnv_lpc.o pnv_psi.o pnv_occ.o pnv_bmc.o
hw/ppc/spapr.c +32 -1
@@ -79,6 +79,7 @@#include "qemu/cutils.h" #include "hw/ppc/spapr_cpu_core.h" #include "hw/mem/memory-device.h" +#include "hw/ppc/spapr_tpm_proxy.h" #include <libfdt.h>
@@ -4036,6 +4037,29 @@ static void spapr_phb_unplug_request(HotplugHandler *hotplug_dev, } } +static void spapr_tpm_proxy_plug (HotplugHandler *hotplug_dev,DeviceState *dev, +Error **errp) +{ +SpaprMachineState *spapr =SPAPR_MACHINE (OBJECT (hotplug_dev)); +SpaprTpmProxy *tpm_proxy =SPAPR_TPM_PROXY (dev); + +if (spapr->tpm_proxy !=NULL ) { +error_setg (errp,"Only one TPM proxy can be specified for this machine" ); +return ; + } + + spapr->tpm_proxy = tpm_proxy; +} + +static void spapr_tpm_proxy_unplug (HotplugHandler *hotplug_dev,DeviceState *dev) +{ +SpaprMachineState *spapr =SPAPR_MACHINE (OBJECT (hotplug_dev)); + +object_property_set_bool (OBJECT (dev), false,"realized" ,NULL ); +object_unparent (OBJECT (dev)); + spapr->tpm_proxy =NULL ; +} +static void spapr_machine_device_plug (HotplugHandler *hotplug_dev,DeviceState *dev,Error **errp) {
@@ -4045,6 +4069,8 @@ static void spapr_machine_device_plug(HotplugHandler *hotplug_dev,spapr_core_plug (hotplug_dev, dev, errp); }else if (object_dynamic_cast (OBJECT (dev),TYPE_SPAPR_PCI_HOST_BRIDGE )) {spapr_phb_plug (hotplug_dev, dev, errp); + }else if (object_dynamic_cast (OBJECT (dev),TYPE_SPAPR_TPM_PROXY )) { +spapr_tpm_proxy_plug (hotplug_dev, dev, errp); } }
@@ -4057,6 +4083,8 @@ static void spapr_machine_device_unplug(HotplugHandler *hotplug_dev,spapr_core_unplug (hotplug_dev, dev); }else if (object_dynamic_cast (OBJECT (dev),TYPE_SPAPR_PCI_HOST_BRIDGE )) {spapr_phb_unplug (hotplug_dev, dev); + }else if (object_dynamic_cast (OBJECT (dev),TYPE_SPAPR_TPM_PROXY )) { +spapr_tpm_proxy_unplug (hotplug_dev, dev); } }
@@ -4091,6 +4119,8 @@ static void spapr_machine_device_unplug_request(HotplugHandler *hotplug_dev,return ; }spapr_phb_unplug_request (hotplug_dev, dev, errp); + }else if (object_dynamic_cast (OBJECT (dev),TYPE_SPAPR_TPM_PROXY )) { +spapr_tpm_proxy_unplug (hotplug_dev, dev); } }
@@ -4111,7 +4141,8 @@ static HotplugHandler *spapr_get_hotplug_handler(MachineState *machine, {if (object_dynamic_cast (OBJECT (dev),TYPE_PC_DIMM ) ||object_dynamic_cast (OBJECT (dev),TYPE_SPAPR_CPU_CORE ) || -object_dynamic_cast (OBJECT (dev),TYPE_SPAPR_PCI_HOST_BRIDGE )) { +object_dynamic_cast (OBJECT (dev),TYPE_SPAPR_PCI_HOST_BRIDGE ) || +object_dynamic_cast (OBJECT (dev),TYPE_SPAPR_TPM_PROXY )) {return HOTPLUG_HANDLER (machine); }if (object_dynamic_cast (OBJECT (dev),TYPE_PCI_DEVICE )) {
hw/ppc/spapr_hcall.c +13 -0
@@ -1963,6 +1963,7 @@ static target_ulong h_update_dt(PowerPCCPU *cpu, SpaprMachineState *spapr,static spapr_hcall_fn papr_hypercall_table[(MAX_HCALL_OPCODE /4 ) +1 ];static spapr_hcall_fn kvmppc_hypercall_table[KVMPPC_HCALL_MAX -KVMPPC_HCALL_BASE +1 ]; +static spapr_hcall_fn svm_hypercall_table[(SVM_HCALL_MAX -SVM_HCALL_BASE ) /4 +1 ];void spapr_register_hypercall (target_ulong opcode,spapr_hcall_fn fn) {
@@ -1972,6 +1973,11 @@ void spapr_register_hypercall(target_ulong opcode, spapr_hcall_fn fn)assert ((opcode &0x3 ) ==0 ); slot = &papr_hypercall_table[opcode /4 ]; + }else if (opcode >=SVM_HCALL_BASE && opcode <=SVM_HCALL_MAX ) { +/* we only have SVM-related hcall numbers assigned in multiples of 4 */ +assert ((opcode &0x3 ) ==0 ); + + slot = &svm_hypercall_table[(opcode -SVM_HCALL_BASE ) /4 ]; }else {assert ((opcode >=KVMPPC_HCALL_BASE ) && (opcode <=KVMPPC_HCALL_MAX ));
@@ -1991,6 +1997,13 @@ target_ulong spapr_hypercall(PowerPCCPU *cpu, target_ulong opcode, && ((opcode & 0x3) == 0)) {spapr_hcall_fn fn = papr_hypercall_table[opcode /4 ]; +if (fn) { +return fn (cpu, spapr, opcode, args); + } + } else if ((opcode >= SVM_HCALL_BASE) && + (opcode <= SVM_HCALL_MAX)) { +spapr_hcall_fn fn = svm_hypercall_table[(opcode -SVM_HCALL_BASE ) /4 ]; +if (fn) {return fn (cpu, spapr, opcode, args); }
hw/ppc/spapr_tpm_proxy.c new file +178 -0
178 lines not on this page · raw message
hw/ppc/trace-events +4 -0
@@ -25,6 +25,10 @@ spapr_update_dt(unsigned cb) "New blob %u bytes" spapr_update_dt_failed_size(unsigned cbold, unsigned cbnew, unsigned magic) "Old blob %u bytes, new blob %u bytes, magic 0x%x" spapr_update_dt_failed_check(unsigned cbold, unsigned cbnew, unsigned magic) "Old blob %u bytes, new blob %u bytes, magic 0x%x" +# spapr_hcall_tpm.c +spapr_h_tpm_comm(const char *device_path, uint64_t operation) "tpm_device_path=%s operation=0x%"PRIu64 +spapr_tpm_execute(uint64_t data_in, uint64_t data_in_sz, uint64_t data_out, uint64_t data_out_sz) "data_in=0x%"PRIx64", data_in_sz=%"PRIu64", data_out=0x%"PRIx64", data_out_sz=%"PRIu64 + # spapr_iommu.c spapr_iommu_put(uint64_t liobn, uint64_t ioba, uint64_t tce, uint64_t ret) "liobn=0x%"PRIx64" ioba=0x%"PRIx64" tce=0x%"PRIx64" ret=%"PRId64 spapr_iommu_get(uint64_t liobn, uint64_t ioba, uint64_t ret, uint64_t tce) "liobn=0x%"PRIx64" ioba=0x%"PRIx64" ret=%"PRId64" tce=0x%"PRIx64
include/hw/ppc/spapr.h +11 -0
@@ -10,6 +10,7 @@#include "hw/ppc/spapr_irq.h" #include "hw/ppc/spapr_xive.h" /* For SpaprXive */ #include "hw/ppc/xics.h" /* For ICSState */ +#include "hw/ppc/spapr_tpm_proxy.h" struct SpaprVioBus ;struct SpaprPhbState ;
@@ -203,6 +204,7 @@ struct SpaprMachineState {SpaprCapabilities def, eff, mig;unsigned gpu_numa_id; +SpaprTpmProxy *tpm_proxy; };#define H_SUCCESS 0
@@ -508,6 +510,15 @@ struct SpaprMachineState {#define KVMPPC_H_UPDATE_DT (KVMPPC_HCALL_BASE + 0x3)#define KVMPPC_HCALL_MAX KVMPPC_H_UPDATE_DT +/* +* The hcall range 0xEF00 to 0xEF80 is reserved for use in facilitating +* Secure VM mode via an Ultravisor / Protected Execution Facility +*/ +#define SVM_HCALL_BASE 0xEF00 +#define SVM_H_TPM_COMM 0xEF10 +#define SVM_HCALL_MAX SVM_H_TPM_COMM + +typedef struct SpaprDeviceTreeUpdateHeader {uint32_t version_id; }SpaprDeviceTreeUpdateHeader ;
include/hw/ppc/spapr_tpm_proxy.h new file +31 -0
@@ -0,0 +1,31 @@ +/* +* SPAPR TPM Proxy/Hypercall +* +* Copyright IBM Corp. 2019 +* +* Authors: +* Michael Roth <[email protected]> +* +* 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 HW_SPAPR_TPM_PROXY_H +#define HW_SPAPR_TPM_PROXY_H + +#include "qom/object.h" +#include "hw/qdev-core.h" + +#define TYPE_SPAPR_TPM_PROXY "spapr-tpm-proxy" +#define SPAPR_TPM_PROXY (obj) OBJECT_CHECK(SpaprTpmProxy, (obj), \ + TYPE_SPAPR_TPM_PROXY) + +typedef struct SpaprTpmProxy { +/*< private >*/ +DeviceState parent; + +char *host_path; +int host_fd; +}SpaprTpmProxy ; + +#endif /* HW_SPAPR_TPM_PROXY_H */
Signature · 1 line
2.21.0
Re: [Qemu-devel] [PULL 20/42] spapr: initial implementation for H_TPM_COMM/spapr-tpm-proxy
Quoted 19 lines · David Gibson
From: Michael Roth <[email protected]>
This implements the
H_TPM_COMMhypercall, which is used by an Ultravisor to pass TPM commands directly to the host's TPM device, or a TPM Resource Manager associated with the device.This also introduces a new virtual device, spapr-tpm-proxy, which is used to configure the host TPM path to be used to service requests sent by
H_TPM_COMMhcalls, for example:-device spapr-tpm-proxy,id=tpmp0,host-path=/dev/tpmrm0
By default, no spapr-tpm-proxy will be created, and hcalls will return
H_FUNCTION.The full specification for this hypercall can be found in
docs/specs/ppc-spapr-uv-hcalls.txt
Quoted 8 lines
Since SVM-related hcalls like
H_TPM_COMMuse a reserved range of 0xEF00-0xEF80, we introduce a separate hcall table here to handle them.Signed-off-by Michael Roth <[email protected]Message-Id: <[email protected]>
[dwg: Corrected #include for upstream change]Signed-off-by David Gibson <[email protected]>
Hi; Coverity reports an issue in this change (CID 1405304):
Quoted 45 lines
hw/ppc/spapr_tpm_proxy.c new file +45
-0+static ssize_t tpm_execute (SpaprTpmProxy *tpm_proxy,target_ulong *args) +{ +uint64_t data_in =ppc64_phys_to_real (args[1 ]); +target_ulong data_in_size = args[2 ]; +uint64_t data_out =ppc64_phys_to_real (args[3 ]); +target_ulong data_out_size = args[4 ]; +uint8_t buf_in[TPM_SPAPR_BUFSIZE ]; +uint8_t buf_out[TPM_SPAPR_BUFSIZE ]; +ssize_t ret; + +trace_spapr_tpm_execute (data_in, data_in_size, data_out, data_out_size); + +if (data_in_size >TPM_SPAPR_BUFSIZE ) { +error_report ("invalid TPM input buffer size: " TARGET_FMT_lu, + data_in_size); +return H_P3 ; + } + +if (data_out_size <TPM_SPAPR_BUFSIZE ) { +error_report ("invalid TPM output buffer size: " TARGET_FMT_lu, + data_out_size); +return H_P5 ; + } + +if (tpm_proxy->host_fd ==-1 ) { + tpm_proxy->host_fd =open (tpm_proxy->host_path,O_RDWR ); +if (tpm_proxy->host_fd ==-1 ) { +error_report ("failed to open TPM device %s: %d" , + tpm_proxy->host_path, errno); +return H_RESOURCE ; + } + } + +cpu_physical_memory_read (data_in, buf_in, data_in_size); + +do { + ret =write (tpm_proxy->host_fd, buf_in, data_in_size); +if (ret >0 ) { + data_in_size -= ret; + } + }while ((ret >=0 && data_in_size >0 ) || (ret ==-1 && errno ==EINTR )); + +if (ret ==-1 ) { +error_report ("failed to write to TPM device %s: %d" , + tpm_proxy->host_path, errno);
hw/ppc/spapr_tpm_proxy.c line 94
Quoted 10 lines
hw/ppc/spapr_tpm_proxy.c new file +10
-0+return H_RESOURCE ; + } + +do { + ret =read (tpm_proxy->host_fd, buf_out, data_out_size); + }while (ret ==0 || (ret ==-1 && errno ==EINTR )); + +if (ret ==-1 ) { +error_report ("failed to read from TPM device %s: %d" , + tpm_proxy->host_path, errno);
The tpm_execute() function can unconditionally dereference tpm_proxy->host_path, implying it can never be NULL...
Quoted 13 lines
hw/ppc/spapr_tpm_proxy.c new file +13
-0+return H_RESOURCE ; + } + +cpu_physical_memory_write (data_out, buf_out, ret); + args[0 ] = ret; + +return H_SUCCESS ; +} + +static target_ulong h_tpm_comm (PowerPCCPU *cpu, +SpaprMachineState *spapr, +target_ulong opcode, +target_ulong *args)
hw/ppc/spapr_tpm_proxy.c line 117
Quoted 10 lines
hw/ppc/spapr_tpm_proxy.c new file +10
-0+{ +target_ulong op = args[0 ]; +SpaprTpmProxy *tpm_proxy = spapr->tpm_proxy; + +if (!tpm_proxy) { +error_report ("TPM proxy not available" ); +return H_FUNCTION ; + } + +trace_spapr_h_tpm_comm (tpm_proxy->host_path ?:"null" , op);
...but in this tracing at the callsite we check for whether it is NULL or not, implying that it can be NULL.
hw/ppc/spapr_tpm_proxy.c line 128
Quoted 11 lines
hw/ppc/spapr_tpm_proxy.c new file +11
-0+ +switch (op) { +case TPM_COMM_OP_EXECUTE : +return tpm_execute (tpm_proxy, args); +case TPM_COMM_OP_CLOSE_SESSION : +spapr_tpm_proxy_reset (tpm_proxy); +return H_SUCCESS ; +default : +return H_PARAMETER ; + } +}
Coverity isn't happy about the possible use-after-NULL-check.
thanks
-- PMM
Re: [Qemu-devel] [PULL 20/42] spapr: initial implementation for H_TPM_COMM/spapr-tpm-proxy
Quoted 108 lines · On Mon, 9 Sep 2019 18:23:20 +0100 Peter Maydell <[email protected]>…
Quoted 19 lines · David Gibson
From: Michael Roth <[email protected]>
This implements the
H_TPM_COMMhypercall, which is used by an Ultravisor to pass TPM commands directly to the host's TPM device, or a TPM Resource Manager associated with the device.This also introduces a new virtual device, spapr-tpm-proxy, which is used to configure the host TPM path to be used to service requests sent by
H_TPM_COMMhcalls, for example:-device spapr-tpm-proxy,id=tpmp0,host-path=/dev/tpmrm0
By default, no spapr-tpm-proxy will be created, and hcalls will return
H_FUNCTION.The full specification for this hypercall can be found in
docs/specs/ppc-spapr-uv-hcalls.txtQuoted 8 lines
Since SVM-related hcalls like
H_TPM_COMMuse a reserved range of 0xEF00-0xEF80, we introduce a separate hcall table here to handle them.Signed-off-by Michael Roth <[email protected]Message-Id: <[email protected]>
[dwg: Corrected #include for upstream change]Signed-off-by David Gibson <[email protected]>Hi; Coverity reports an issue in this change (CID 1405304):
Quoted 45 lines
hw/ppc/spapr_tpm_proxy.c new file +45
-0+static ssize_t tpm_execute (SpaprTpmProxy *tpm_proxy,target_ulong *args) +{ +uint64_t data_in =ppc64_phys_to_real (args[1 ]); +target_ulong data_in_size = args[2 ]; +uint64_t data_out =ppc64_phys_to_real (args[3 ]); +target_ulong data_out_size = args[4 ]; +uint8_t buf_in[TPM_SPAPR_BUFSIZE ]; +uint8_t buf_out[TPM_SPAPR_BUFSIZE ]; +ssize_t ret; + +trace_spapr_tpm_execute (data_in, data_in_size, data_out, data_out_size); + +if (data_in_size >TPM_SPAPR_BUFSIZE ) { +error_report ("invalid TPM input buffer size: " TARGET_FMT_lu, + data_in_size); +return H_P3 ; + } + +if (data_out_size <TPM_SPAPR_BUFSIZE ) { +error_report ("invalid TPM output buffer size: " TARGET_FMT_lu, + data_out_size); +return H_P5 ; + } + +if (tpm_proxy->host_fd ==-1 ) { + tpm_proxy->host_fd =open (tpm_proxy->host_path,O_RDWR ); +if (tpm_proxy->host_fd ==-1 ) { +error_report ("failed to open TPM device %s: %d" , + tpm_proxy->host_path, errno); +return H_RESOURCE ; + } + } + +cpu_physical_memory_read (data_in, buf_in, data_in_size); + +do { + ret =write (tpm_proxy->host_fd, buf_in, data_in_size); +if (ret >0 ) { + data_in_size -= ret; + } + }while ((ret >=0 && data_in_size >0 ) || (ret ==-1 && errno ==EINTR )); + +if (ret ==-1 ) { +error_report ("failed to write to TPM device %s: %d" , + tpm_proxy->host_path, errno);hw/ppc/spapr_tpm_proxy.c line 94
Quoted 10 lines
hw/ppc/spapr_tpm_proxy.c new file +10
-0+return H_RESOURCE ; + } + +do { + ret =read (tpm_proxy->host_fd, buf_out, data_out_size); + }while (ret ==0 || (ret ==-1 && errno ==EINTR )); + +if (ret ==-1 ) { +error_report ("failed to read from TPM device %s: %d" , + tpm_proxy->host_path, errno);The
tpm_execute()function can unconditionally dereferencetpm_proxy->host_path, implying it can never be NULL...Quoted 18 lines
hw/ppc/spapr_tpm_proxy.c new file +18
-0+return H_RESOURCE ; + } + +cpu_physical_memory_write (data_out, buf_out, ret); + args[0 ] = ret; + +return H_SUCCESS ; +} + +static target_ulong h_tpm_comm (PowerPCCPU *cpu, +SpaprMachineState *spapr, +target_ulong opcode, +target_ulong *args) +{ +target_ulong op = args[0 ]; +SpaprTpmProxy *tpm_proxy = spapr->tpm_proxy; + +if (!tpm_proxy) {
Quoted 9 lines
hw/ppc/spapr_tpm_proxy.c line 117
Quoted 5 lines
hw/ppc/spapr_tpm_proxy.c new file +5
-0+error_report ("TPM proxy not available" ); +return H_FUNCTION ; + } + +trace_spapr_h_tpm_comm (tpm_proxy->host_path ?:"null" , op);...but in this tracing at the callsite we check for whether it is NULL or not, implying that it can be NULL.
And we have this in the device realize function:
static void spapr_tpm_proxy_realize(DeviceState *d, Error **errp)
{
SpaprTpmProxy *tpm_proxy = SPAPR_TPM_PROXY(d);
if (tpm_proxy->host_path == NULL) {
error_setg(errp, "must specify 'host-path' option for device");
return;
}[...]
}
so we can safely assume host_path is never NULL. I guess the fix is to stop checking tpm_proxy->host_path in the trace callsite above.
Quoted 16 lines
hw/ppc/spapr_tpm_proxy.c line 128
Quoted 11 lines
hw/ppc/spapr_tpm_proxy.c new file +11
-0+ +switch (op) { +case TPM_COMM_OP_EXECUTE : +return tpm_execute (tpm_proxy, args); +case TPM_COMM_OP_CLOSE_SESSION : +spapr_tpm_proxy_reset (tpm_proxy); +return H_SUCCESS ; +default : +return H_PARAMETER ; + } +}Coverity isn't happy about the possible use-after-NULL-check.
thanks
-- PMM
[Qemu-devel] [PULL 22/42] ppc/xive: use an abstract type for XiveNotifier
In reply to David GibsonFrom: Cédric Le Goater <[email protected]>
Message-Id: <[email protected]>
--- include/hw/ppc/xive.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
include/hw/ppc/xive.h +2 -4
@@ -148,13 +148,11 @@* XIVE Notifier (Interface between Source and Router) */ -typedef struct XiveNotifier { -Object parent; -}XiveNotifier ; +typedef struct XiveNotifier XiveNotifier ;#define TYPE_XIVE_NOTIFIER "xive-notifier"#define XIVE_NOTIFIER (obj) \ - OBJECT_CHECK(XiveNotifier, (obj), TYPE_XIVE_NOTIFIER) + INTERFACE_CHECK(XiveNotifier, (obj), TYPE_XIVE_NOTIFIER)#define XIVE_NOTIFIER_CLASS (klass) \ OBJECT_CLASS_CHECK(XiveNotifierClass, (klass), TYPE_XIVE_NOTIFIER)#define XIVE_NOTIFIER_GET_CLASS (obj) \
Signature · 1 line
2.21.0
[Qemu-devel] [PULL 27/42] ppc/xive: Provide silent escalation support
In reply to David GibsonFrom: Cédric Le Goater <[email protected]>
When the 's' bit is set the escalation is said to be 'silent' or 'silent/gather'. In such configuration, the notification sequence is skipped and only the escalation sequence is performed. This is used to configure all the EQs of a vCPU to escalate on a single EQ which will then target the hypervisor.
Message-Id: <[email protected]>
--- hw/intc/xive.c | 8 ++++++++ include/hw/ppc/xive_regs.h | 2 ++ 2 files changed, 10 insertions(+)
hw/intc/xive.c +8 -0
@@ -1485,6 +1485,13 @@ static void xive_router_end_notify(XiveRouter *xrtr, uint8_t end_blk,xive_router_write_end (xrtr, end_blk, end_idx, &end,1 ); } +/* +* When the END is silent, we skip the notification part. +*/ +if (xive_end_is_silent_escalation (&end)) { + goto do_escalation; + } +/* * The W7 format depends on the F bit in W6. It defines the type * of the notification :
@@ -1564,6 +1571,7 @@ static void xive_router_end_notify(XiveRouter *xrtr, uint8_t end_blk,*/ } +do_escalation:/* * If activated, escalate notification using the ESe PQ bits and * the EAS in w4-5
include/hw/ppc/xive_regs.h +2 -0
@@ -212,6 +212,8 @@ typedef struct XiveEND {#define xive_end_is_escalate (end) (be32_to_cpu((end)->w0) & END_W0_ESCALATE_CTL)#define xive_end_is_uncond_escalation (end) \ (be32_to_cpu((end)->w0) & END_W0_UNCOND_ESCALATE) +#define xive_end_is_silent_escalation (end) \ + (be32_to_cpu((end)->w0) & END_W0_SILENT_ESCALATE)static inline uint64_t xive_end_qaddr (XiveEND *end) {
Signature · 1 line
2.21.0
[Qemu-devel] [PULL 21/42] pseries: Update SLOF firmware image
In reply to David GibsonFrom: Alexey Kardashevskiy <[email protected]>
The only change that SLOF does not rely on QEMU providing an RTAS blob and provides one itself:
https://git.qemu.org/?p=SLOF.git;a=commitdiff;h=5e4ed1fd0f39e
--- pc-bios/README | 2 +- pc-bios/slof.bin | Bin 926432 -> 926784 bytes roms/SLOF | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-)
pc-bios/README +1 -1
@@ -17,7 +17,7 @@ - SLOF (Slimline Open Firmware) is a free IEEE 1275 Open Firmware implementation for certain IBM POWER hardware. The sources are at https://github.com/aik/SLOF, and the image currently in qemu is - built from git tag qemu-slof-20190703. + built from git tag qemu-slof-20190719. - sgabios (the Serial Graphics Adapter option ROM) provides a means for legacy x86 software to communicate with an attached serial console as
pc-bios/slof.bin binary +0 -0
roms/SLOF +1 -1
@@ -1 +1 @@ -Subproject commit ba1ab360eebe6338bb8d7d83a9220ccf7e213af3 +Subproject commit 7bfe584e321946771692711ff83ad2b5850daca7
Signature · 1 line
2.21.0
[Qemu-devel] [PULL 42/42] ppc: Fix emulated single to double denormalized conversions
In reply to David GibsonFrom: "Paul A. Clarke" <[email protected]>
helper_todouble() was not properly converting any denormalized 32 bit float to 64 bit double.
v2:
- Splitting patch "ppc: Three floating point fixes"; this is just one part.
- Original suggested "fix" was likely flawed. v2 is rewritten by Richard Henderson (Thanks, Richard!); I reformatted the comments in a couple of places, compiled, and tested.
Message-Id: <[email protected]>
--- target/ppc/fpu_helper.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
target/ppc/fpu_helper.c +13 -4
@@ -73,11 +73,20 @@ uint64_t helper_todouble(uint32_t arg)/* Zero or Denormalized operand. */ ret = (uint64_t )extract32 (arg,31 ,1 ) <<63 ;if (unlikely (abs_arg !=0 )) { -/* Denormalized operand. */ -int shift =clz32 (abs_arg) -9 ; -int exp =-126 - shift +1023 ; +/* +* Denormalized operand. +* Shift fraction so that the msb is in the implicit bit position. +* Thus, shift is in the range [1:23]. +*/ +int shift =clz32 (abs_arg) -8 ; +/* +* The first 3 terms compute the float64 exponent. We then bias +* this result by -1 so that we can swallow the implicit bit below. +*/ +int exp =-126 - shift +1023 -1 ; + ret |= (uint64_t )exp <<52 ; - ret |= abs_arg << (shift +29 ); + ret += (uint64_t )abs_arg << (52 -23 + shift); } }return ret;
Signature · 1 line
2.21.0
[Qemu-devel] [PULL 24/42] ppc/xive: Provide backlog support
In reply to David GibsonFrom: Cédric Le Goater <[email protected]>
If backlog is activated ('b' bit) on the END, the pending priority of a missed event is recorded in the IPB field of the NVT for a later resend.
Message-Id: <[email protected]>
--- hw/intc/xive.c | 77 +++++++++++++++++++++++++++++++------------------- 1 file changed, 48 insertions(+), 29 deletions(-)
hw/intc/xive.c +48 -29
@@ -1411,46 +1411,22 @@ static bool xive_presenter_match(XiveRouter *xrtr, uint8_t format,* * The parameters represent what is sent on the PowerBus */ -static void xive_presenter_notify (XiveRouter *xrtr,uint8_t format, +static bool xive_presenter_notify (XiveRouter *xrtr,uint8_t format,uint8_t nvt_blk,uint32_t nvt_idx,bool cam_ignore,uint8_t priority,uint32_t logic_serv) { -XiveNVT nvt;XiveTCTXMatch match = { .tctx =NULL , .ring =0 };bool found; -/* NVT cache lookup */ -if (xive_router_get_nvt (xrtr, nvt_blk, nvt_idx, &nvt)) { -qemu_log_mask (LOG_GUEST_ERROR ,"XIVE: no NVT %x/%x\n" , - nvt_blk, nvt_idx); -return ; - } - -if (!xive_nvt_is_valid (&nvt)) { -qemu_log_mask (LOG_GUEST_ERROR ,"XIVE: NVT %x/%x is invalid\n" , - nvt_blk, nvt_idx); -return ; - } - found =xive_presenter_match (xrtr, format, nvt_blk, nvt_idx, cam_ignore, priority, logic_serv, &match);if (found) {ipb_update (&match.tctx->regs[match.ring], priority);xive_tctx_notify (match.tctx, match.ring); -return ; } -/* Record the IPB in the associated NVT structure */ -ipb_update ((uint8_t *) &nvt.w4, priority); -xive_router_write_nvt (xrtr, nvt_blk, nvt_idx, &nvt,4 ); - -/* -* If no matching NVT is dispatched on a HW thread : -* - update the NVT structure if backlog is activated -* - escalate (ESe PQ bits and EAS in w4-5) if escalation is -* activated -*/ +return found; }/*
@@ -1464,6 +1440,10 @@ static void xive_router_end_notify(XiveRouter *xrtr, uint8_t end_blk,XiveEND end;uint8_t priority;uint8_t format; +uint8_t nvt_blk; +uint32_t nvt_idx; +XiveNVT nvt; +bool found;/* END cache lookup */ if (xive_router_get_end (xrtr, end_blk, end_idx, &end)) {
@@ -1522,14 +1502,53 @@ static void xive_router_end_notify(XiveRouter *xrtr, uint8_t end_blk,/* * Follows IVPE notification */ -xive_presenter_notify (xrtr, format, -xive_get_field32 (END_W6_NVT_BLOCK , end.w6), -xive_get_field32 (END_W6_NVT_INDEX , end.w6), + nvt_blk =xive_get_field32 (END_W6_NVT_BLOCK , end.w6); + nvt_idx =xive_get_field32 (END_W6_NVT_INDEX , end.w6); + +/* NVT cache lookup */ +if (xive_router_get_nvt (xrtr, nvt_blk, nvt_idx, &nvt)) { +qemu_log_mask (LOG_GUEST_ERROR ,"XIVE: no NVT %x/%x\n" , + nvt_blk, nvt_idx); +return ; + } + +if (!xive_nvt_is_valid (&nvt)) { +qemu_log_mask (LOG_GUEST_ERROR ,"XIVE: NVT %x/%x is invalid\n" , + nvt_blk, nvt_idx); +return ; + } + + found =xive_presenter_notify (xrtr, format, nvt_blk, nvt_idx,xive_get_field32 (END_W7_F0_IGNORE , end.w7), priority,xive_get_field32 (END_W7_F1_LOG_SERVER_ID , end.w7));/* TODO: Auto EOI. */ + +if (found) { +return ; + } + +/* +* If no matching NVT is dispatched on a HW thread : +* - specific VP: update the NVT structure if backlog is activated +* - logical server : forward request to IVPE (not supported) +*/ +if (xive_end_is_backlog (&end)) { +if (format ==1 ) { +qemu_log_mask (LOG_GUEST_ERROR , +"XIVE: END %x/%x invalid config: F1 & backlog\n" , + end_blk, end_idx); +return ; + } +/* Record the IPB in the associated NVT structure */ +ipb_update ((uint8_t *) &nvt.w4, priority); +xive_router_write_nvt (xrtr, nvt_blk, nvt_idx, &nvt,4 ); + +/* +* On HW, follows a "Broadcast Backlog" to IVPEs +*/ + } }void xive_router_notify (XiveNotifier *xn,uint32_t lisn)
Signature · 1 line
2.21.0
[Qemu-devel] [PULL 25/42] ppc/xive: Provide escalation support
In reply to David GibsonFrom: Cédric Le Goater <[email protected]>
If the XIVE presenter can not find the NVT dispatched on any of the HW threads, it can not deliver the interrupt. XIVE offers an escalation mechanism to handle such scenarios and inform the hypervisor that an action should be taken.
Escalation is configured by setting the 'e' bit and the EAS in word 4 & 5 to let the HW look for the escalation END on which to trigger a new event.
Message-Id: <[email protected]>
--- hw/intc/xive.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
hw/intc/xive.c +16 -0
@@ -1549,6 +1549,22 @@ static void xive_router_end_notify(XiveRouter *xrtr, uint8_t end_blk,* On HW, follows a "Broadcast Backlog" to IVPEs */ } + +/* +* If activated, escalate notification using the ESe PQ bits and +* the EAS in w4-5 +*/ +if (!xive_end_is_escalate (&end)) { +return ; + } + +/* +* The END trigger becomes an Escalation trigger +*/ +xive_router_end_notify (xrtr, +xive_get_field32 (END_W4_ESC_END_BLOCK , end.w4), +xive_get_field32 (END_W4_ESC_END_INDEX , end.w4), +xive_get_field32 (END_W5_ESC_END_DATA , end.w5)); }void xive_router_notify (XiveNotifier *xn,uint32_t lisn)
Signature · 1 line
2.21.0
[Qemu-devel] [PULL 32/42] ppc: remove idle_timer logic
In reply to David GibsonFrom: Shivaprasad G Bhat <[email protected]>
The logic is broken for multiple vcpu guests, also causing memory leak. The logic is in place to handle kvm not having KVM_CAP_PPC_IRQ_LEVEL, which is part of the kernel now since 2.6.37. Instead of fixing the leak, drop the redundant logic which is not excercised on new kernels anymore. Exit with error on older kernels.
Message-Id: <156406409479.19996.7606556689856621111.stgit@lep8c.aus.stglabs.ibm.com>
--- target/ppc/kvm.c | 75 ++++-------------------------------------------- 1 file changed, 5 insertions(+), 70 deletions(-)
target/ppc/kvm.c +5 -70
@@ -58,7 +58,6 @@ const KVMCapabilityInfo kvm_arch_required_capabilities[] = { };static int cap_interrupt_unset; -static int cap_interrupt_level;static int cap_segstate;static int cap_booke_sregs;static int cap_ppc_smt;
@@ -89,25 +88,6 @@ static int cap_large_decr;static uint32_t debug_inst_opcode; -/* -* XXX We have a race condition where we actually have a level triggered -* interrupt, but the infrastructure can't expose that yet, so the guest -* takes but ignores it, goes to sleep and never gets notified that there's -* still an interrupt pending. -* -* As a quick workaround, let's just wake up again 20 ms after we injected -* an interrupt. That way we can assure that we're always reinjecting -* interrupts in case the guest swallowed them. -*/ -static QEMUTimer *idle_timer; - -static void kvm_kick_cpu (void *opaque) -{ -PowerPCCPU *cpu = 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
@@ -127,7 +107,6 @@ static int kvmppc_get_dec_bits(void);int kvm_arch_init (MachineState *ms,KVMState *s) { cap_interrupt_unset =kvm_check_extension (s,KVM_CAP_PPC_UNSET_IRQ ); - cap_interrupt_level =kvm_check_extension (s,KVM_CAP_PPC_IRQ_LEVEL ); cap_segstate =kvm_check_extension (s,KVM_CAP_PPC_SEGSTATE ); cap_booke_sregs =kvm_check_extension (s,KVM_CAP_PPC_BOOKE_SREGS ); cap_ppc_smt_possible =kvm_vm_check_extension (s,KVM_CAP_PPC_SMT_POSSIBLE );
@@ -163,9 +142,9 @@ int kvm_arch_init(MachineState *ms, KVMState *s)*/ cap_ppc_pvr_compat = false; -if (!cap_interrupt_level) { -fprintf (stderr,"KVM: Couldn't find level irq capability. Expect the " -"VM to stall at times!\n" ); +if (!kvm_check_extension (s,KVM_CAP_PPC_IRQ_LEVEL )) { +error_report ("KVM: Host kernel doesn't have level irq capability" ); +exit (1 ); }kvm_ppc_register_host_cpu_type (ms);
@@ -493,8 +472,6 @@ int kvm_arch_init_vcpu(CPUState *cs)return ret; } - idle_timer =timer_new_ns (QEMU_CLOCK_VIRTUAL , kvm_kick_cpu, cpu); -switch (cenv->mmu_model) {case POWERPC_MMU_BOOKE206 :/* This target supports access to KVM's guest TLB */
@@ -1334,7 +1311,7 @@ int kvmppc_set_interrupt(PowerPCCPU *cpu, int irq, int level)return 0 ; } -if (!kvm_enabled () || !cap_interrupt_unset || !cap_interrupt_level) { +if (!kvm_enabled () || !cap_interrupt_unset) {return 0 ; }
@@ -1351,49 +1328,7 @@ int kvmppc_set_interrupt(PowerPCCPU *cpu, int irq, int level)void kvm_arch_pre_run (CPUState *cs,struct kvm_run *run) { -PowerPCCPU *cpu =POWERPC_CPU (cs); -CPUPPCState *env = &cpu->env; -int r; -unsigned irq; - -qemu_mutex_lock_iothread (); - -/* -* PowerPC QEMU tracks the various core input pins (interrupt, -* critical interrupt, reset, etc) in PPC-specific -* env->irq_input_state. -*/ -if (!cap_interrupt_level && - run->ready_for_interrupt_injection && - (cs->interrupt_request &CPU_INTERRUPT_HARD ) && - (env->irq_input_state & (1 <<PPC_INPUT_INT ))) - { -/* -* For now KVM disregards the 'irq' argument. However, in the -* future KVM could cache it in-kernel to avoid a heavyweight -* exit when reading the UIC. -*/ - irq =KVM_INTERRUPT_SET ; - -trace_kvm_injected_interrupt (irq); - r =kvm_vcpu_ioctl (cs,KVM_INTERRUPT , &irq); -if (r <0 ) { -printf ("cpu %d fail inject %x\n" , cs->cpu_index, irq); - } - -/* Always wake up soon in case the interrupt was level based */ -timer_mod (idle_timer,qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ) + - (NANOSECONDS_PER_SECOND /50 )); - } - -/* -* We don't know if there are more interrupts pending after -* this. However, the guest will return to userspace in the course -* of handling this one anyways, so we will get a chance to -* deliver the rest. -*/ - -qemu_mutex_unlock_iothread (); +return ; }MemTxAttrs kvm_arch_post_run (CPUState *cs,struct kvm_run *run)
Signature · 1 line
2.21.0
[Qemu-devel] [PULL 40/42] ppc: conform to processor User's Manual for xscvdpspn
In reply to David GibsonFrom: "Paul A. Clarke" <[email protected]>
The POWER8 and POWER9 User's Manuals specify the implementation behavior for what the ISA leaves "undefined" behavior for the xscvdpspn and xscvdpsp instructions. This patch corrects the QEMU implementation to match the hardware implementation for that case.
ISA 3.0B has xscvdpspn leaving its result in word 0 of the target register, with the other words of the target register left "undefined".
The User's Manuals specify:
VSX scalar convert from double-precision to single-precision (xscvdpsp, xscvdpspn).
VSR[32:63] is set to VSR[0:31].
So, words 0 and 1 both contain the result.
Note: this is important because GCC as of version 8 or so, assumes and takes advantage of this behavior to optimize the following sequence:
xscvdpspn vs0,vs1
mffprwz r8,f0
ISA 3.0B has xscvdpspn leaving its result in word 0 of the target register, and mffprwz expecting its input to come from word 1 of the source register. This sequence fails with QEMU, as a shift is required between those two instructions. However, since the hardware splats the result to both words 0 and 1 of its output register, the shift is not necessary.
Expect a future revision of the ISA to specify this behavior.
v2
- Splitting patch "ppc: Three floating point fixes"; this is just one part.
- Updated commit message to clarify behavior is documented in User's Manuals.
- Updated commit message to correct which words are in output and source of xscvdpspn and mffprz.
- No source changes to this part of the original patch.
Message-Id: <[email protected]>
--- target/ppc/fpu_helper.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
target/ppc/fpu_helper.c +5 -1
@@ -2871,10 +2871,14 @@ void helper_xscvqpdp(CPUPPCState *env, uint32_t opcode,uint64_t helper_xscvdpspn (CPUPPCState *env,uint64_t xb) { +uint64_t result; +float_status tstat = env->fp_status;set_float_exception_flags (0 , &tstat); -return (uint64_t )float64_to_float32 (xb, &tstat) <<32 ; + result = (uint64_t )float64_to_float32 (xb, &tstat); +/* hardware replicates result to both words of the doubleword result. */ +return (result <<32 ) | result; }uint64_t helper_xscvspdpn (CPUPPCState *env,uint64_t xb)
Signature · 1 line
2.21.0
[Qemu-devel] [PULL 35/42] spapr/irq: Drop spapr_irq_msi_reset()
In reply to David GibsonFrom: Greg Kurz <[email protected]>
PHBs already take care of clearing the MSIs from the bitmap during reset or unplug. No need to do this globally from the machine code. Rather add an assert to ensure that PHBs have acted as expected.
Message-Id: <[email protected]>
[dwg: Fix crash in qtest case where spapr->irq_map can be NULL at the
new assert()]
--- hw/ppc/spapr.c | 4 ---- hw/ppc/spapr_irq.c | 7 ++----- include/hw/ppc/spapr_irq.h | 1 - 3 files changed, 2 insertions(+), 10 deletions(-)
hw/ppc/spapr.c +0 -4
@@ -1755,10 +1755,6 @@ static void spapr_machine_reset(MachineState *machine)ppc_set_compat (first_ppc_cpu, spapr->max_compat_pvr, &error_fatal); } -if (!SPAPR_MACHINE_GET_CLASS (spapr)->legacy_irq_allocation) { -spapr_irq_msi_reset (spapr); - } -/* * This is fixing some of the default configuration of the XIVE * devices. To be called after the reset of the machine devices.
hw/ppc/spapr_irq.c +2 -5
@@ -59,11 +59,6 @@ void spapr_irq_msi_free(SpaprMachineState *spapr, int irq, uint32_t num)bitmap_clear (spapr->irq_map, irq -SPAPR_IRQ_MSI , num); } -void spapr_irq_msi_reset (SpaprMachineState *spapr) -{ -bitmap_clear (spapr->irq_map,0 , spapr->irq_map_nr); -} -static void spapr_irq_init_kvm (SpaprMachineState *spapr,SpaprIrq *irq,Error **errp) {
@@ -731,6 +726,8 @@ int spapr_irq_post_load(SpaprMachineState *spapr, int version_id)void spapr_irq_reset (SpaprMachineState *spapr,Error **errp) { +assert (!spapr->irq_map ||bitmap_empty (spapr->irq_map, spapr->irq_map_nr)); +if (spapr->irq->reset) { spapr->irq->reset (spapr, errp); }
include/hw/ppc/spapr_irq.h +0 -1
@@ -30,7 +30,6 @@ void spapr_irq_msi_init(SpaprMachineState *spapr, uint32_t nr_msis);int spapr_irq_msi_alloc (SpaprMachineState *spapr,uint32_t num,bool align,Error **errp);void spapr_irq_msi_free (SpaprMachineState *spapr,int irq,uint32_t num); -void spapr_irq_msi_reset (SpaprMachineState *spapr); typedef struct SpaprIrq { uint32_t nr_irqs;
Signature · 1 line
2.21.0
[Qemu-devel] [PULL 30/42] i386: use machine class ->wakeup method
In reply to David GibsonFrom: Nicholas Piggin <[email protected]>
Move the i386 suspend_wakeup logic out of the fallback path, and into the new ->wakeup method.
Message-Id: <[email protected]>
--- hw/i386/pc.c | 8 ++++++++ vl.c | 2 -- 2 files changed, 8 insertions(+), 2 deletions(-)
hw/i386/pc.c +8 -0
@@ -2834,6 +2834,13 @@ static void pc_machine_reset(MachineState *machine) } } +static void pc_machine_wakeup (MachineState *machine) +{ +cpu_synchronize_all_states (); +pc_machine_reset (machine); +cpu_synchronize_all_post_reset (); +} +static CpuInstanceProperties pc_cpu_index_to_props (MachineState *ms,unsigned cpu_index) {
@@ -2946,6 +2953,7 @@ static void pc_machine_class_init(ObjectClass *oc, void *data) mc->block_default_type =IF_IDE ; mc->max_cpus =255 ; mc->reset = pc_machine_reset; + mc->wakeup = pc_machine_wakeup; hc->pre_plug = pc_machine_device_pre_plug_cb; hc->plug = pc_machine_device_plug_cb; hc->unplug_request = pc_machine_device_unplug_request_cb;
vl.c +0 -2
@@ -1568,8 +1568,6 @@ static void qemu_system_wakeup(void)if (mc && mc->wakeup) { mc->wakeup (current_machine); - }else { -qemu_system_reset (SHUTDOWN_CAUSE_NONE ); } }
Signature · 1 line
2.21.0
[Qemu-devel] [PULL 31/42] spapr: Implement ibm,suspend-me
In reply to David GibsonFrom: Nicholas Piggin <[email protected]>
This has been useful to modify and test the Linux pseries suspend code but it requires modification to the guest to call it (due to being gated by other unimplemented features). It is not otherwise used by Linux yet, but work is slowly progressing there.
This allows a (lightly modified) guest kernel to suspend with echo mem > /sys/power/state and be resumed with system_wakeup monitor command.
Message-Id: <[email protected]>
--- hw/ppc/spapr.c | 7 +++++++ hw/ppc/spapr_rtas.c | 32 ++++++++++++++++++++++++++++++++ include/hw/ppc/spapr.h | 3 ++- 3 files changed, 41 insertions(+), 1 deletion(-)
hw/ppc/spapr.c +7 -0
@@ -3083,6 +3083,13 @@ static void spapr_machine_init(MachineState *machine)qemu_register_boot_set (spapr_boot_set, spapr); +/* +* Nothing needs to be done to resume a suspended guest because +* suspending does not change the machine state, so no need for +* a ->wakeup method. +*/ +qemu_register_wakeup_support (); +if (kvm_enabled ()) {/* to stop and start vmclock */ qemu_add_vm_change_state_handler(cpu_ppc_clock_vm_state_change,
hw/ppc/spapr_rtas.c +32 -0
@@ -217,6 +217,36 @@ static void rtas_stop_self(PowerPCCPU *cpu, SpaprMachineState *spapr,qemu_cpu_kick (cs); } +static void rtas_ibm_suspend_me (PowerPCCPU *cpu,SpaprMachineState *spapr, +uint32_t token,uint32_t nargs, +target_ulong args, +uint32_t nret,target_ulong rets) +{ +CPUState *cs; + +if (nargs !=0 || nret !=1 ) { +rtas_st (rets,0 ,RTAS_OUT_PARAM_ERROR ); +return ; + } + +CPU_FOREACH (cs) { +PowerPCCPU *c =POWERPC_CPU (cs); +CPUPPCState *e = &c->env; +if (c == cpu) { +continue ; + } + +/* See h_join */ +if (!cs->halted || (e->msr & (1ULL <<MSR_EE ))) { +rtas_st (rets,0 ,H_MULTI_THREADS_ACTIVE ); +return ; + } + } + +qemu_system_suspend_request (); +rtas_st (rets,0 ,RTAS_OUT_SUCCESS ); +} +static inline int sysparm_st (target_ulong addr,target_ulong len,const void *val,uint16_t vallen) {
@@ -484,6 +514,8 @@ static void core_rtas_register_types(void) rtas_query_cpu_stopped_state);spapr_rtas_register (RTAS_START_CPU ,"start-cpu" , rtas_start_cpu);spapr_rtas_register (RTAS_STOP_SELF ,"stop-self" , rtas_stop_self); +spapr_rtas_register (RTAS_IBM_SUSPEND_ME ,"ibm,suspend-me" , + rtas_ibm_suspend_me);spapr_rtas_register (RTAS_IBM_GET_SYSTEM_PARAMETER ,"ibm,get-system-parameter" , rtas_ibm_get_system_parameter);
include/hw/ppc/spapr.h +2 -1
@@ -642,8 +642,9 @@ target_ulong spapr_hypercall(PowerPCCPU *cpu, target_ulong opcode,#define RTAS_IBM_CREATE_PE_DMA_WINDOW (RTAS_TOKEN_BASE + 0x27)#define RTAS_IBM_REMOVE_PE_DMA_WINDOW (RTAS_TOKEN_BASE + 0x28)#define RTAS_IBM_RESET_PE_DMA_WINDOW (RTAS_TOKEN_BASE + 0x29) +#define RTAS_IBM_SUSPEND_ME (RTAS_TOKEN_BASE + 0x2A) -#define RTAS_TOKEN_MAX (RTAS_TOKEN_BASE + 0x2A) +#define RTAS_TOKEN_MAX (RTAS_TOKEN_BASE + 0x2B)/* RTAS ibm,get-system-parameter token values */ #define RTAS_SYSPARM_SPLPAR_CHARACTERISTICS 20
Signature · 1 line
2.21.0
[Qemu-devel] [PULL 39/42] ppc: Add support for 'mffsl' instruction
In reply to David GibsonFrom: "Paul A. Clarke" <[email protected]>
ISA 3.0B added a set of Floating-Point Status and Control Register (FPSCR)
instructions: mffsce, mffscdrn, mffscdrni, mffscrn, mffscrni, mffsl. This patch adds support for 'mffsl'.
'mffsl' is identical to 'mffs', except it only returns mode, status, and enable bits from the FPSCR.
On CPUs without support for 'mffsl' (below ISA 3.0), the 'mffsl' instruction will execute identically to 'mffs'.
Note: I renamed FPSCR_RN to FPSCR_RN0 so I could create an FPSCR_RN mask which is both bits of the FPSCR rounding mode, as defined in the ISA.
I also fixed a typo in the definition of FPSCR_FR.
v4:
- nit: added some braces to resolve a checkpatch complaint.
v3:
- Changed tcg_gen_and_i64 to tcg_gen_andi_i64, eliminating the need for a temporary, per review from Richard Henderson.
v2:
- I found that I copied too much of the 'mffs' implementation. The 'Rc' condition code bits are not needed for 'mffsl'. Removed.
- I now free the (renamed) 'tmask' temporary.
- I now bail early for older ISA to the original 'mffs' implementation.
Message-Id: <[email protected]>
--- disas/ppc.c | 5 +++++ target/ppc/cpu.h | 15 ++++++++++----- target/ppc/fpu_helper.c | 4 ++-- target/ppc/translate/fp-impl.inc.c | 22 ++++++++++++++++++++++ target/ppc/translate/fp-ops.inc.c | 4 +++- 5 files changed, 42 insertions(+), 8 deletions(-)
disas/ppc.c +5 -0
@@ -1765,6 +1765,9 @@ extract_tbr (unsigned long insn,/* An X_MASK with the RA and RB fields fixed. */ #define XRARB_MASK (X_MASK | RA_MASK | RB_MASK) +/* An X form instruction with the RA field fixed. */ +#define XRA (op, xop, ra) (X((op), (xop)) | (((ra) << 16) & XRA_MASK)) +/* An XRARB_MASK, but with the L bit clear. */ #define XRLARB_MASK (XRARB_MASK & ~((unsigned long) 1 << 16))
@@ -4998,6 +5001,8 @@ const struct powerpc_opcode powerpc_opcodes[] = { { "ddivq", XRC(63,546,0), X_MASK, POWER6, { FRT, FRA, FRB } }, { "ddivq.", XRC(63,546,1), X_MASK, POWER6, { FRT, FRA, FRB } }, +{ "mffsl", XRA(63,583,12), XRARB_MASK, POWER9, { FRT } }, + { "mffs", XRC(63,583,0), XRARB_MASK, COM, { FRT } }, { "mffs.", XRC(63,583,1), XRARB_MASK, COM, { FRT } },
target/ppc/cpu.h +10 -5
@@ -591,7 +591,7 @@ enum {#define FPSCR_XE 3/* Floating-point inexact exception enable */ #define FPSCR_NI 2/* Floating-point non-IEEE mode */ #define FPSCR_RN1 1 -#define FPSCR_RN 0/* Floating-point rounding control */ +#define FPSCR_RN0 0/* Floating-point rounding control */ #define fpscr_fex (((env->fpscr) >> FPSCR_FEX) & 0x1)#define fpscr_vx (((env->fpscr) >> FPSCR_VX) & 0x1)#define fpscr_ox (((env->fpscr) >> FPSCR_OX) & 0x1)
@@ -614,7 +614,7 @@ enum {#define fpscr_ze (((env->fpscr) >> FPSCR_ZE) & 0x1)#define fpscr_xe (((env->fpscr) >> FPSCR_XE) & 0x1)#define fpscr_ni (((env->fpscr) >> FPSCR_NI) & 0x1) -#define fpscr_rn (((env->fpscr) >> FPSCR_RN) & 0x3) +#define fpscr_rn (((env->fpscr) >> FPSCR_RN0) & 0x3)/* Invalid operation exception summary */ #define fpscr_ix ((env->fpscr) & ((1 << FPSCR_VXSNAN) | (1 << FPSCR_VXISI) | \ (1 << FPSCR_VXIDI) | (1 << FPSCR_VXZDZ) | \
@@ -640,7 +640,7 @@ enum {#define FP_VXZDZ (1ull << FPSCR_VXZDZ)#define FP_VXIMZ (1ull << FPSCR_VXIMZ)#define FP_VXVC (1ull << FPSCR_VXVC) -#define FP_FR (1ull << FSPCR_FR) +#define FP_FR (1ull << FPSCR_FR)#define FP_FI (1ull << FPSCR_FI)#define FP_C (1ull << FPSCR_C)#define FP_FL (1ull << FPSCR_FL)
@@ -648,7 +648,7 @@ enum {#define FP_FE (1ull << FPSCR_FE)#define FP_FU (1ull << FPSCR_FU)#define FP_FPCC (FP_FL | FP_FG | FP_FE | FP_FU) -#define FP_FPRF (FP_C | FP_FL | FP_FG | FP_FE | FP_FU) +#define FP_FPRF (FP_C | FP_FPCC)#define FP_VXSOFT (1ull << FPSCR_VXSOFT)#define FP_VXSQRT (1ull << FPSCR_VXSQRT)#define FP_VXCVI (1ull << FPSCR_VXCVI)
@@ -659,7 +659,12 @@ enum {#define FP_XE (1ull << FPSCR_XE)#define FP_NI (1ull << FPSCR_NI)#define FP_RN1 (1ull << FPSCR_RN1) -#define FP_RN (1ull << FPSCR_RN) +#define FP_RN0 (1ull << FPSCR_RN0) +#define FP_RN (FP_RN1 | FP_RN0) + +#define FP_MODE FP_RN +#define FP_ENABLES (FP_VE | FP_OE | FP_UE | FP_ZE | FP_XE) +#define FP_STATUS (FP_FR | FP_FI | FP_FPRF)/* the exception bits which can be cleared by mcrfs - includes FX */ #define FP_EX_CLEAR_BITS (FP_FX | FP_OX | FP_UX | FP_ZX | \
target/ppc/fpu_helper.c +2 -2
@@ -403,7 +403,7 @@ void helper_fpscr_clrbit(CPUPPCState *env, uint32_t bit)if (prev ==1 ) {switch (bit) {case FPSCR_RN1 : -case FPSCR_RN : +case FPSCR_RN0 :fpscr_set_rounding_mode (env);break ;case FPSCR_VXSNAN :
@@ -557,7 +557,7 @@ void helper_fpscr_setbit(CPUPPCState *env, uint32_t bit) }break ;case FPSCR_RN1 : -case FPSCR_RN : +case FPSCR_RN0 :fpscr_set_rounding_mode (env);break ;default :
target/ppc/translate/fp-impl.inc.c +22 -0
@@ -617,6 +617,28 @@ static void gen_mffs(DisasContext *ctx)tcg_temp_free_i64 (t0); } +/* mffsl */ +static void gen_mffsl (DisasContext *ctx) +{ +TCGv_i64 t0; + +if (unlikely (!(ctx->insns_flags2 &PPC2_ISA300 ))) { +return gen_mffs (ctx); + } + +if (unlikely (!ctx->fpu_enabled)) { +gen_exception (ctx,POWERPC_EXCP_FPU ); +return ; + } + t0 =tcg_temp_new_i64 (); +gen_reset_fpstatus (); +tcg_gen_extu_tl_i64 (t0, cpu_fpscr); +/* Mask everything except mode, status, and enables. */ +tcg_gen_andi_i64 (t0, t0,FP_MODE |FP_STATUS |FP_ENABLES ); +set_fpr (rD (ctx->opcode), t0); +tcg_temp_free_i64 (t0); +} +/* mtfsb0 */ static void gen_mtfsb0 (DisasContext *ctx) {
target/ppc/translate/fp-ops.inc.c +3 -1
@@ -104,7 +104,9 @@ GEN_HANDLER_E(fcpsgn, 0x3F, 0x08, 0x00, 0x00000000, PPC_NONE, PPC2_ISA205),GEN_HANDLER_E (fmrgew,0x3F ,0x06 ,0x1E ,0x00000001 ,PPC_NONE ,PPC2_VSX207 ),GEN_HANDLER_E (fmrgow,0x3F ,0x06 ,0x1A ,0x00000001 ,PPC_NONE ,PPC2_VSX207 ),GEN_HANDLER (mcrfs,0x3F ,0x00 ,0x02 ,0x0063F801 ,PPC_FLOAT ), -GEN_HANDLER (mffs,0x3F ,0x07 ,0x12 ,0x001FF800 ,PPC_FLOAT ), +GEN_HANDLER_E_2 (mffs,0x3F ,0x07 ,0x12 ,0x00 ,0x00000000 ,PPC_FLOAT ,PPC_NONE ), +GEN_HANDLER_E_2 (mffsl,0x3F ,0x07 ,0x12 ,0x18 ,0x00000000 ,PPC_FLOAT , +PPC2_ISA300 ),GEN_HANDLER (mtfsb0,0x3F ,0x06 ,0x02 ,0x001FF800 ,PPC_FLOAT ),GEN_HANDLER (mtfsb1,0x3F ,0x06 ,0x01 ,0x001FF800 ,PPC_FLOAT ), GEN_HANDLER(mtfsf, 0x3F, 0x07, 0x16, 0x00000000, PPC_FLOAT),
Signature · 1 line
2.21.0
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series seems to have some coding style problems. See output below for more information:
Type: series
Subject: [Qemu-devel] [PULL 00/42] ppc-for-4.2 queue 20190821
Message-id: [email protected]
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
* [new tag] patchew/[email protected] -> patchew/[email protected]
Submodule 'capstone' (https://git.qemu.org/git/capstone.git) registered for path 'capstone'
Submodule 'dtc' (https://git.qemu.org/git/dtc.git) registered for path 'dtc'
Submodule 'roms/QemuMacDrivers' (https://git.qemu.org/git/QemuMacDrivers.git) registered for path 'roms/QemuMacDrivers' Submodule 'roms/SLOF' (https://git.qemu.org/git/SLOF.git) registered for path 'roms/SLOF'
Submodule 'roms/edk2' (https://git.qemu.org/git/edk2.git) registered for path 'roms/edk2'
Submodule 'roms/ipxe' (https://git.qemu.org/git/ipxe.git) registered for path 'roms/ipxe'
Submodule 'roms/openbios' (https://git.qemu.org/git/openbios.git) registered for path 'roms/openbios'
Submodule 'roms/openhackware' (https://git.qemu.org/git/openhackware.git) registered for path 'roms/openhackware'
Submodule 'roms/opensbi' (https://git.qemu.org/git/opensbi.git) registered for path 'roms/opensbi'
Submodule 'roms/qemu-palcode' (https://git.qemu.org/git/qemu-palcode.git) registered for path 'roms/qemu-palcode'
Submodule 'roms/seabios' (https://git.qemu.org/git/seabios.git/) registered for path 'roms/seabios'
Submodule 'roms/seabios-hppa' (https://git.qemu.org/git/seabios-hppa.git) registered for path 'roms/seabios-hppa'
Submodule 'roms/sgabios' (https://git.qemu.org/git/sgabios.git) registered for path 'roms/sgabios'
Submodule 'roms/skiboot' (https://git.qemu.org/git/skiboot.git) registered for path 'roms/skiboot'
Submodule 'roms/u-boot' (https://git.qemu.org/git/u-boot.git) registered for path 'roms/u-boot'
Submodule 'roms/u-boot-sam460ex' (https://git.qemu.org/git/u-boot-sam460ex.git) registered for path 'roms/u-boot-sam460ex' Submodule 'slirp' (https://git.qemu.org/git/libslirp.git) registered for path 'slirp'
Submodule 'tests/fp/berkeley-softfloat-3' (https://git.qemu.org/git/berkeley-softfloat-3.git) registered for path 'tests/fp/berkeley-softfloat-3' Submodule 'tests/fp/berkeley-testfloat-3' (https://git.qemu.org/git/berkeley-testfloat-3.git) registered for path 'tests/fp/berkeley-testfloat-3' Submodule 'ui/keycodemapdb' (https://git.qemu.org/git/keycodemapdb.git) registered for path 'ui/keycodemapdb'
Cloning into 'capstone'...
Submodule path 'capstone': checked out '22ead3e0bfdb87516656453336160e0a37b066bf'
Cloning into 'dtc'...
Submodule path 'dtc': checked out '88f18909db731a627456f26d779445f84e449536'
Cloning into 'roms/QemuMacDrivers'...
Submodule path 'roms/QemuMacDrivers': checked out '90c488d5f4a407342247b9ea869df1c2d9c8e266'
Cloning into 'roms/SLOF'...
Submodule path 'roms/SLOF': checked out 'ba1ab360eebe6338bb8d7d83a9220ccf7e213af3'
Cloning into 'roms/edk2'...
Submodule path 'roms/edk2': checked out '20d2e5a125e34fc8501026613a71549b2a1a3e54'
Submodule 'SoftFloat' (https://github.com/ucb-bar/berkeley-softfloat-3.git) registered for path 'ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3' Submodule 'CryptoPkg/Library/OpensslLib/openssl' (https://github.com/openssl/openssl) registered for path 'CryptoPkg/Library/OpensslLib/openssl' Cloning into 'ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3'...
Submodule path 'roms/edk2/ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3': checked out 'b64af41c3276f97f0e181920400ee056b9c88037' Cloning into 'CryptoPkg/Library/OpensslLib/openssl'...
Submodule path 'roms/edk2/CryptoPkg/Library/OpensslLib/openssl': checked out '50eaac9f3337667259de725451f201e784599687' Submodule 'boringssl' (https://boringssl.googlesource.com/boringssl) registered for path 'boringssl'
Submodule 'krb5' (https://github.com/krb5/krb5) registered for path 'krb5'
Submodule 'pyca.cryptography' (https://github.com/pyca/cryptography.git) registered for path 'pyca-cryptography'
Cloning into 'boringssl'...
Submodule path 'roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl': checked out '2070f8ad9151dc8f3a73bffaa146b5e6937a583f' Cloning into 'krb5'...
Submodule path 'roms/edk2/CryptoPkg/Library/OpensslLib/openssl/krb5': checked out 'b9ad6c49505c96a088326b62a52568e3484f2168' Cloning into 'pyca-cryptography'...
Submodule path 'roms/edk2/CryptoPkg/Library/OpensslLib/openssl/pyca-cryptography': checked out '09403100de2f6f1cdd0d484dcb8e620f1c335c8f' Cloning into 'roms/ipxe'...
Submodule path 'roms/ipxe': checked out 'de4565cbe76ea9f7913a01f331be3ee901bb6e17'
Cloning into 'roms/openbios'...
Submodule path 'roms/openbios': checked out 'c79e0ecb84f4f1ee3f73f521622e264edd1bf174'
Cloning into 'roms/openhackware'...
Submodule path 'roms/openhackware': checked out 'c559da7c8eec5e45ef1f67978827af6f0b9546f5'
Cloning into 'roms/opensbi'...
Submodule path 'roms/opensbi': checked out 'ce228ee0919deb9957192d723eecc8aaae2697c6'
Cloning into 'roms/qemu-palcode'...
Submodule path 'roms/qemu-palcode': checked out 'bf0e13698872450164fa7040da36a95d2d4b326f'
Cloning into 'roms/seabios'...
Submodule path 'roms/seabios': checked out 'a5cab58e9a3fb6e168aba919c5669bea406573b4'
Cloning into 'roms/seabios-hppa'...
Submodule path 'roms/seabios-hppa': checked out '0f4fe84658165e96ce35870fd19fc634e182e77b'
Cloning into 'roms/sgabios'...
Submodule path 'roms/sgabios': checked out 'cbaee52287e5f32373181cff50a00b6c4ac9015a'
Cloning into 'roms/skiboot'...
Submodule path 'roms/skiboot': checked out '261ca8e779e5138869a45f174caa49be6a274501'
Cloning into 'roms/u-boot'...
Submodule path 'roms/u-boot': checked out 'd3689267f92c5956e09cc7d1baa4700141662bff'
Cloning into 'roms/u-boot-sam460ex'...
Submodule path 'roms/u-boot-sam460ex': checked out '60b3916f33e617a815973c5a6df77055b2e3a588'
Cloning into 'slirp'...
Submodule path 'slirp': checked out '126c04acbabd7ad32c2b018fe10dfac2a3bc1210'
Cloning into 'tests/fp/berkeley-softfloat-3'...
Submodule path 'tests/fp/berkeley-softfloat-3': checked out 'b64af41c3276f97f0e181920400ee056b9c88037'
Cloning into 'tests/fp/berkeley-testfloat-3'...
Submodule path 'tests/fp/berkeley-testfloat-3': checked out '5a59dcec19327396a011a17fd924aed4fec416b3'
Cloning into 'ui/keycodemapdb'...
Submodule path 'ui/keycodemapdb': checked out '6b3d716e2b6472eb7189d3220552280ef3d832ce'
Switched to a new branch 'test'
M roms/SLOF
54dd837 ppc: Fix emulated single to double denormalized conversions
14d703d ppc: Fix emulated INFINITY and NAN conversions
875d0fd ppc: conform to processor User's Manual for xscvdpspn
82207bc ppc: Add support for 'mffsl' instruction
af4ad8e target/ppc: Add Directed Privileged Door-bell Exception State (DPDES) SPR
1a18dd2 spapr/xive: Mask the EAS when allocating an IRQ
8f81179 spapr: Implement better workaround in spapr-vty device
8b785b8 spapr/irq: Drop spapr_irq_msi_reset()
b74b4ea spapr/pci: Free MSIs during reset
b7e1b2c spapr/pci: Consolidate de-allocation of MSIs
eb9fcda ppc: remove idle_timer logic
b8ba07f spapr: Implement ibm,suspend-me
15e6c56 i386: use machine class ->wakeup method
924f65e machine: Add wakeup method to MachineClass
24ace21 ppc/xive: Improve 'info pic' support
42ccbc3 ppc/xive: Provide silent escalation support
59c0620 ppc/xive: Provide unconditional escalation support
87d9104 ppc/xive: Provide escalation support
ea6752a ppc/xive: Provide backlog support
a4ae484 ppc/xive: Implement TM_PULL_OS_CTX special command
ee83ebc ppc/xive: use an abstract type for XiveNotifier
37517c0 pseries: Update SLOF firmware image
07a7213 spapr: initial implementation for H_TPM_COMM/spapr-tpm-proxy
7cb0a81 docs/specs: initial spec summary for Ultravisor-related hcalls
424be1f spapr: Implement H_JOIN
423838e spapr: Implement H_CONFER
92a57a6 spapr: Implement H_PROD
9ae8240 spapr: Implement dispatch tracking for tcg
893d49b ppc: fix leak in h_client_architecture_support
80c8de0 ppc: fix memory leak in spapr_dt_drc()
c609592 ppc: fix memory leak in spapr_caps_add_properties
518df27 target/ppc: Optimize emulation of vclzw instruction
2094f12 target/ppc: Optimize emulation of vclzd instruction
7038398 target/ppc: Optimize emulation of vgbbd instruction
e6510ae target/ppc: move opcode decode tables to PowerPCCPU
eed2cf3 target/ppc: Optimize emulation of vsl and vsr instructions
e97dfd1 target/ppc: Optimize emulation of lvsl and lvsr instructions
50e1c5d migration: Do not re-read the clock on pre_save in case of paused guest
dbb2b77 spapr_pci: Allow 2MiB and 16MiB IOMMU pagesizes by default
76c767f hw: add compat machines for 4.2
a63b538 spapr_iommu: Fix xlate trace to print translated address
95360a9 spapr: quantify error messages regarding capability settings
=== OUTPUT BEGIN ===
1/42 Checking commit 95360a990d28 (spapr: quantify error messages regarding capability settings) 2/42 Checking commit a63b5380c35e (spapr_iommu: Fix xlate trace to print translated address) 3/42 Checking commit 76c767fc3bee (hw: add compat machines for 4.2)
4/42 Checking commit dbb2b7783a11 (spapr_pci: Allow 2MiB and 16MiB IOMMU pagesizes by default) 5/42 Checking commit 50e1c5dcabaa (migration: Do not re-read the clock on pre_save in case of paused guest) 6/42 Checking commit e97dfd19f5f4 (target/ppc: Optimize emulation of lvsl and lvsr instructions) 7/42 Checking commit eed2cf382e58 (target/ppc: Optimize emulation of vsl and vsr instructions) 8/42 Checking commit e6510aec0e3e (target/ppc: move opcode decode tables to PowerPCCPU) 9/42 Checking commit 703839822a70 (target/ppc: Optimize emulation of vgbbd instruction) 10/42 Checking commit 2094f1269392 (target/ppc: Optimize emulation of vclzd instruction) 11/42 Checking commit 518df27684f9 (target/ppc: Optimize emulation of vclzw instruction) 12/42 Checking commit c6095924b8e2 (ppc: fix memory leak in spapr_caps_add_properties) 13/42 Checking commit 80c8de09b2df (ppc: fix memory leak in spapr_dt_drc())
14/42 Checking commit 893d49b36e4a (ppc: fix leak in h_client_architecture_support)
15/42 Checking commit 9ae82400ac01 (spapr: Implement dispatch tracking for tcg)
16/42 Checking commit 92a57a6a73c2 (spapr: Implement H_PROD)
17/42 Checking commit 423838e528bb (spapr: Implement H_CONFER)
18/42 Checking commit 424be1f65853 (spapr: Implement H_JOIN)
19/42 Checking commit 7cb0a819f560 (docs/specs: initial spec summary for Ultravisor-related hcalls)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#20:
new file mode 100644
total: 0 errors, 1 warnings, 76 lines checked
Patch 19/42 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
20/42 Checking commit 07a72139f9d9 (spapr: initial implementation for H_TPM_COMM/spapr-tpm-proxy)
WARNING: line over 80 characters
#68: FILE: hw/ppc/spapr.c:4047:
+ error_setg(errp, "Only one TPM proxy can be specified for this machine");
WARNING: line over 80 characters
#75: FILE: hw/ppc/spapr.c:4054:
+static void spapr_tpm_proxy_unplug(HotplugHandler *hotplug_dev, DeviceState *dev)
WARNING: line over 80 characters
#132: FILE: hw/ppc/spapr_hcall.c:1966:
+static spapr_hcall_fn svm_hypercall_table[(SVM_HCALL_MAX - SVM_HCALL_BASE) / 4 + 1];
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #163:
new file mode 100644
total: 0 errors, 4 warnings, 355 lines checked
Patch 20/42 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
21/42 Checking commit 37517c005b4e (pseries: Update SLOF firmware image)
22/42 Checking commit ee83ebcca358 (ppc/xive: use an abstract type for XiveNotifier)
23/42 Checking commit a4ae48469e5e (ppc/xive: Implement TM_PULL_OS_CTX special command) 24/42 Checking commit ea6752acd411 (ppc/xive: Provide backlog support)
25/42 Checking commit 87d910405de8 (ppc/xive: Provide escalation support)
26/42 Checking commit 59c06201056c (ppc/xive: Provide unconditional escalation support) 27/42 Checking commit 42ccbc3ebd3b (ppc/xive: Provide silent escalation support)
28/42 Checking commit 24ace212fd02 (ppc/xive: Improve 'info pic' support)
29/42 Checking commit 924f65e77d6d (machine: Add wakeup method to MachineClass)
30/42 Checking commit 15e6c567de33 (i386: use machine class ->wakeup method)
31/42 Checking commit b8ba07f7b2c6 (spapr: Implement ibm,suspend-me)
32/42 Checking commit eb9fcdab93e5 (ppc: remove idle_timer logic)
33/42 Checking commit b7e1b2c100aa (spapr/pci: Consolidate de-allocation of MSIs)
34/42 Checking commit b74b4eaf7046 (spapr/pci: Free MSIs during reset)
35/42 Checking commit 8b785b8968b7 (spapr/irq: Drop spapr_irq_msi_reset())
36/42 Checking commit 8f81179e22e2 (spapr: Implement better workaround in spapr-vty device) 37/42 Checking commit 1a18dd2c0829 (spapr/xive: Mask the EAS when allocating an IRQ)
38/42 Checking commit af4ad8eb2ebd (target/ppc: Add Directed Privileged Door-bell Exception State (DPDES) SPR) 39/42 Checking commit 82207bc06043 (ppc: Add support for 'mffsl' instruction)
ERROR: code indent should never use tabs
#59: FILE: disas/ppc.c:5004:
+{ "mffsl", XRA(63,583,12), XRARB_MASK,^IPOWER9,^I{ FRT } },$
ERROR: space required after that ',' (ctx:VxV)
#59: FILE: disas/ppc.c:5004:
+{ "mffsl", XRA(63,583,12), XRARB_MASK, POWER9, { FRT } },
^
ERROR: space required after that ',' (ctx:VxV)
#59: FILE: disas/ppc.c:5004:
+{ "mffsl", XRA(63,583,12), XRARB_MASK, POWER9, { FRT } },
^
total: 3 errors, 0 warnings, 116 lines checked
Patch 39/42 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
40/42 Checking commit 875d0fd7004c (ppc: conform to processor User's Manual for xscvdpspn) 41/42 Checking commit 14d703db4d4e (ppc: Fix emulated INFINITY and NAN conversions) 42/42 Checking commit 54dd83778e03 (ppc: Fix emulated single to double denormalized conversions) === OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]
Peter Maydell
AppliedQuoted 29 lines · David Gibson
The following changes since commit
17dc57990320edaad52ac9ea808be9719c91cea6:Merge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2019-08-20' into staging (2019-08-20 14:14:20 +0100)
are available in the Git repository at:
git://github.com/dgibson/qemu.gittags/ppc-for-4.2-20190821for you to fetch changes up to
c0e6616b6685ffdb4c5e091bc152e46e14703dd1:ppc: Fix emulated single to double denormalized conversions (2019-08-21 17:17:39 +1000)
----------------------------------------------------------------
ppc patch queue for 2019-08-21First ppc and spapr pull request for qemu-4.2. Includes:
* Some TCG emulation fixes and performance improvements
* Support for the mffsl instruction in TCG
* Added missing DPDES SPR
* Some enhancements to the emulation of the XIVE interrupt controller
* Cleanups to spapr MSI management
* Some new suspend/resume infrastructure and a draft suspend implementation for spapr
* New spapr hypercall for TPM communication (will be needed for secure guests under an Ultravisor)
* Fix several memory leaks
Quoted 2 lines
And a few other assorted fixes.
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/4.2
for any user-visible changes.
-- PMM