ppc-for-9.2-1 queue
Subsystems (2)
Nicholas Piggin
reviewerThe following changes since commit 92ec7805190313c9e628f8fc4eb4f932c15247bd:
Merge tag 'pull-riscv-to-apply-20241031-1' of https://github.com/alistair23/qemu into staging (2024-10-31 16:34:25 +0000)
are available in the Git repository at:
https://gitlab.com/npiggin/qemu.git tags/pull-ppc-for-9.2-1-20241104
for you to fetch changes up to bd4be4d9bd20a252e677239a18b6409ecee98f56:
MAINTAINERS: Remove myself as reviewer (2024-11-04 10:09:36 +1000)
----------------------------------------------------------------
* Various bug fixes
* Big cleanup of deprecated machines
* Power11 support for spapr
* XIVE improvements
* Goodbye Cedric and David as ppc reviewers, thank you both o7
----------------------------------------------------------------
Aditya Gupta (5):
target/ppc: Introduce 'PowerPCCPUClass::spapr_logical_pvr' target/ppc: Fix regression due to Power10 and Power11 having same PCR target/ppc: Add Power11 DD2.0 processor
ppc/pseries: Add Power11 cpu type
hw/ppc: Implement -dtb support for PowerNV
Amit Machhiwal (2):
spapr: nested: Add support for DPDES SPR in GSB for TCG L0
spapr: nested: Add Power11 capability support for Nested PAPR guests in TCG L0
BALATON Zoltan (2):
hw/ppc: Consolidate e500 initial mapping creation functions hw/ppc: Consolidate ppc440 initial mapping creation functions
Chalapathi V (1):
hw/ssi/pnv_spi: Fixes Coverity CID 1558831
Clément Chigot (1):
hw/ppc: fix decrementer with BookE timers
Cédric Le Goater (2):
MAINTAINERS: Remove myself from the PowerNV machines
MAINTAINERS: Remove myself from XIVE
David Gibson (1):
MAINTAINERS: Remove myself as reviewer
Frederic Barrat (5):
pnv/xive2: Define OGEN field in the TIMA
ppc/xive2: Support TIMA "Pull OS Context to Odd Thread Reporting Line" ppc/xive2: Dump more NVP state with 'info pic'
ppc/xive2: Dump the VP-group and crowd tables with 'info pic' tests/qtest: Add XIVE tests for the powernv10 machine
Glenn Miles (7):
pnv/xive2: Support for "OS LGS Push" TIMA operation ppc/xive2: Allow 1-byte write of Target field in TIMA ppc/xive2: Support "Pull Thread Context to Register" operation ppc/xive2: Support "Pull Thread Context to Odd Thread Reporting Line" pnv/xive: Add special handling for pool targets
pnv/xive: Update PIPR when updating CPPR
pnv/xive2: TIMA support for 8-byte OS context push for PHYP
Harsh Prateek Bora (23):
ppc/spapr: remove deprecated machine pseries-2.1 ppc/spapr: remove deprecated machine pseries-2.2 ppc/spapr: remove deprecated machine pseries-2.3 ppc/spapr: remove deprecated machine pseries-2.4 ppc/spapr: remove deprecated machine pseries-2.5 ppc/spapr: remove deprecated machine pseries-2.6 ppc/spapr: remove deprecated machine pseries-2.7 ppc/spapr: remove deprecated machine pseries-2.8 ppc/spapr: remove deprecated machine pseries-2.9 ppc/spapr: remove deprecated machine pseries-2.10 ppc/spapr: remove deprecated machine pseries-2.11 ppc/spapr: remove deprecated machine pseries-2.12-sxxm ppc/spapr: remove deprecated machine pseries-2.12 target/ppc: Reduce code duplication across Power9/10 init code target/ppc: use locally stored msr and avoid indirect access target/ppc: optimize hreg_compute_pmu_hflags_value target/ppc: optimize hreg_compute_pmu_hflags_value target/ppc: optimize p9 exception handling routines target/ppc: optimize p8 exception handling routines target/ppc: optimize p7 exception handling routines target/ppc: simplify var usage in ppc_next_unmasked_interrupt target/ppc: combine multiple ail checks into one target/ppc: reduce duplicate code between init_proc_POWER{9, 10}
Ilya Leoshkevich (3):
target/ppc: Set ctx->opcode for decode_insn32() target/ppc: Make divd[u] handler method decodetree compatible tests/tcg: Replace -mpower8-vector with -mcpu=power8
Michael Kowal (3):
pnv/xive: TIMA patch sets pre-req alignment and formatting changes ppc/xive2: Change context/ring specific functions to be generic pnv/xive2: TIMA CI ops using alternative offsets or byte lengths
Nicholas Piggin (9):
ppc/pnv: Fix LPC serirq routing calculation
ppc/pnv: Fix LPC POWER8 register sanity check target/ppc: Fix mtDPDES targeting SMT siblings target/ppc: PMIs are level triggered
target/ppc: Fix doorbell delivery to threads in powersave target/ppc: Fix HFSCR facility checks
target/ppc: Fix VRMA to not check virtual page class key protection ppc/pnv: ADU fix possible buffer overrun with invalid size ppc/xive: Fix ESB length overflow on 32-bit hosts
Philippe Mathieu-Daudé (3):
MAINTAINERS: Cover PowerPC SPI model in PowerNV section hw/ssi/pnv_spi: Match _xfer_buffer_free() with _xfer_buffer_new() hw/ssi/pnv_spi: Return early in transfer()
MAINTAINERS | 7 +- docs/about/deprecated.rst | 8 - docs/system/ppc/pseries.rst | 17 +- hw/core/machine.c | 27 --- hw/intc/pnv_xive2.c | 44 ++++- hw/intc/spapr_xive_kvm.c | 4 +- hw/intc/xics.c | 16 -- hw/intc/xive.c | 203 ++++++++++++++----- hw/intc/xive2.c | 317 +++++++++++++++++++++++++----- hw/ppc/e500.c | 41 ++-- hw/ppc/e500.h | 2 - hw/ppc/pnv.c | 51 +++-- hw/ppc/pnv_adu.c | 12 ++ hw/ppc/pnv_lpc.c | 14 +- hw/ppc/ppc.c | 4 +- hw/ppc/ppc440_bamboo.c | 28 +-- hw/ppc/ppc_booke.c | 10 + hw/ppc/ppce500_spin.c | 30 +-- hw/ppc/sam460ex.c | 45 +---- hw/ppc/spapr.c | 387 +------------------------------------ hw/ppc/spapr_cpu_core.c | 13 +- hw/ppc/spapr_nested.c | 13 +- hw/ppc/spapr_pci.c | 92 +-------- hw/ppc/virtex_ml507.c | 28 +-- hw/ssi/pnv_spi.c | 12 +- include/hw/boards.h | 9 - include/hw/pci-host/spapr.h | 5 - include/hw/ppc/ppc.h | 7 + include/hw/ppc/spapr.h | 3 - include/hw/ppc/spapr_cpu_core.h | 1 - include/hw/ppc/spapr_nested.h | 8 +- include/hw/ppc/xive.h | 4 +- include/hw/ppc/xive2.h | 18 ++ include/hw/ppc/xive2_regs.h | 25 ++- include/hw/ppc/xive_regs.h | 45 +++-- migration/savevm.c | 19 -- target/ppc/compat.c | 11 ++ target/ppc/cpu-models.c | 3 + target/ppc/cpu-models.h | 3 + target/ppc/cpu.h | 18 +- target/ppc/cpu_init.c | 252 +++++++++--------------- target/ppc/cpu_init.h | 91 +++++++++ target/ppc/excp_helper.c | 255 ++++++++++++------------ target/ppc/helper_regs.c | 19 +- target/ppc/machine.c | 72 +------ target/ppc/misc_helper.c | 2 +- target/ppc/mmu-hash64.c | 9 +- target/ppc/translate.c | 5 +- tests/qtest/meson.build | 2 + tests/qtest/pnv-xive2-common.c | 190 ++++++++++++++++++ tests/qtest/pnv-xive2-common.h | 111 +++++++++++ tests/qtest/pnv-xive2-flush-sync.c | 205 ++++++++++++++++++++ tests/qtest/pnv-xive2-test.c | 344 +++++++++++++++++++++++++++++++++ tests/tcg/ppc64/Makefile.target | 10 +- 54 files changed, 1946 insertions(+), 1225 deletions(-) create mode 100644 target/ppc/cpu_init.h create mode 100644 tests/qtest/pnv-xive2-common.c create mode 100644 tests/qtest/pnv-xive2-common.h create mode 100644 tests/qtest/pnv-xive2-flush-sync.c create mode 100644 tests/qtest/pnv-xive2-test.c
Nicholas Piggin
reviewer[PULL 04/67] ppc/pnv: Fix LPC POWER8 register sanity check
POWER8 does not have the ISA IRQ -> SERIRQ routing system of later CPUs, instead all ISA IRQs are sent to the CPU via a single PSI interrupt. There is a sanity check in the POWER8 case to ensure the routing bits have not been set, because that would indicate a programming error.
Those bits were incorrectly specified because of ppc bit numbering fun. Coverity detected this as an always-zero expression.
Resolves: Coverity CID 1558829 (partially)
--- hw/ppc/pnv_lpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/ppc/pnv_lpc.c +2 -2
@@ -427,8 +427,8 @@ static void pnv_lpc_eval_serirq_routes(PnvLpcController *lpc)int irq;if (!lpc->psi_has_serirq) { -if ((lpc->opb_irq_route0 &PPC_BITMASK (8 ,13 )) || - (lpc->opb_irq_route1 &PPC_BITMASK (4 ,31 ))) { +if ((lpc->opb_irq_route0 &PPC_BITMASK32 (8 ,13 )) || + (lpc->opb_irq_route1 &PPC_BITMASK32 (4 ,31 ))) {qemu_log_mask (LOG_GUEST_ERROR ,"OPB: setting serirq routing on POWER8 system, ignoring.\n" ); }
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 06/67] target/ppc: PMIs are level triggered
In reply to Nicholas PigginIn Book-S / Power processors, the performance monitor interrupts are driven by the MMCR0[PMAO] bit, which is level triggered and not cleared by the interrupt.
Others may have different performance monitor architecture, but none of those are implemented by QEMU.
--- target/ppc/excp_helper.c | 4 ---- 1 file changed, 4 deletions(-)
target/ppc/excp_helper.c +0 -4
@@ -2187,7 +2187,6 @@ static void p7_deliver_interrupt(CPUPPCState *env, int interrupt)powerpc_excp (cpu,POWERPC_EXCP_DECR );break ;case PPC_INTERRUPT_PERFM : - env->pending_interrupts &= ~PPC_INTERRUPT_PERFM ;powerpc_excp (cpu,POWERPC_EXCP_PERFM );break ;case 0 :
@@ -2250,7 +2249,6 @@ static void p8_deliver_interrupt(CPUPPCState *env, int interrupt)powerpc_excp (cpu,POWERPC_EXCP_SDOOR_HV );break ;case PPC_INTERRUPT_PERFM : - env->pending_interrupts &= ~PPC_INTERRUPT_PERFM ;powerpc_excp (cpu,POWERPC_EXCP_PERFM );break ;case PPC_INTERRUPT_EBB :/* EBB exception */
@@ -2330,7 +2328,6 @@ static void p9_deliver_interrupt(CPUPPCState *env, int interrupt)powerpc_excp (cpu,POWERPC_EXCP_SDOOR_HV );break ;case PPC_INTERRUPT_PERFM : - env->pending_interrupts &= ~PPC_INTERRUPT_PERFM ;powerpc_excp (cpu,POWERPC_EXCP_PERFM );break ;case PPC_INTERRUPT_EBB :/* EBB exception */
@@ -2444,7 +2441,6 @@ static void ppc_deliver_interrupt(CPUPPCState *env, int interrupt)powerpc_excp (cpu,POWERPC_EXCP_SDOOR_HV );break ;case PPC_INTERRUPT_PERFM : - env->pending_interrupts &= ~PPC_INTERRUPT_PERFM ;powerpc_excp (cpu,POWERPC_EXCP_PERFM );break ;case PPC_INTERRUPT_THERM :/* Thermal interrupt */
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 02/67] target/ppc: Make divd[u] handler method decodetree compatible
In reply to Nicholas PigginFrom: Ilya Leoshkevich <[email protected]>
This is like commit 86e6202a57b1 ("target/ppc: Make divw[u] handler method decodetree compatible."), but for gen_op_arith_divd().
--- target/ppc/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/ppc/translate.c +1 -1
@@ -1820,7 +1820,7 @@ static inline void gen_op_arith_divd(DisasContext *ctx, TCGv ret,tcg_gen_or_tl (cpu_so, cpu_so, cpu_ov); } -if (unlikely (Rc (ctx->opcode) !=0 )) { +if (unlikely (compute_rc0)) {gen_set_Rc0 (ctx, ret); } }
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 03/67] ppc/pnv: Fix LPC serirq routing calculation
In reply to Nicholas PigginThe serirq routing table is split over two registers, the calculation for the high irqs in the second register did not subtract the irq offset. This was spotted by Coverity as a shift-by-negative. Fix this and change the open-coded shifting and masking to use extract32() function so it's less error-prone.
This went unnoticed because irqs >= 14 are not used in a standard QEMU/OPAL boot, changing the first QEMU serial-isa irq to 14 to test does demonstrate serial irqs aren't received, and that this change fixes that.
Resolves: Coverity CID 1558829 (partially)
--- hw/ppc/pnv_lpc.c | 10 ++++++++-- target/ppc/cpu.h | 1 + 2 files changed, 9 insertions(+), 2 deletions(-)
hw/ppc/pnv_lpc.c +8 -2
@@ -435,13 +435,19 @@ static void pnv_lpc_eval_serirq_routes(PnvLpcController *lpc)return ; } +/* +* Each of the ISA irqs is routed to one of the 4 SERIRQ irqs with 2 +* bits, split across 2 OPB registers. +*/ for (irq =0 ; irq <=13 ; irq++) { -int serirq = (lpc->opb_irq_route1 >> (31 -5 - (irq *2 ))) &0x3 ; +int serirq =extract32 (lpc->opb_irq_route1, +PPC_BIT32_NR (5 + irq *2 ),2 ); lpc->irq_to_serirq_route[irq] = serirq; }for (irq =14 ; irq <ISA_NUM_IRQS ; irq++) { -int serirq = (lpc->opb_irq_route0 >> (31 -9 - (irq *2 ))) &0x3 ; +int serirq =extract32 (lpc->opb_irq_route0, +PPC_BIT32_NR (9 + (irq -14 ) *2 ),2 ); lpc->irq_to_serirq_route[irq] = serirq; } }
target/ppc/cpu.h +1 -0
@@ -40,6 +40,7 @@#define PPC_BIT_NR (bit) (63 - (bit))#define PPC_BIT (bit) (0x8000000000000000ULL >> (bit)) +#define PPC_BIT32_NR (bit) (31 - (bit))#define PPC_BIT32 (bit) (0x80000000 >> (bit))#define PPC_BIT8 (bit) (0x80 >> (bit))#define PPC_BITMASK (bs, be) ((PPC_BIT(bs) - PPC_BIT(be)) | PPC_BIT(bs))
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 14/67] hw/ssi/pnv_spi: Fixes Coverity CID 1558831
In reply to Nicholas PigginFrom: Chalapathi V <[email protected]>
In this commit the following coverity scan defect has been fixed CID 1558831: Resource leaks (RESOURCE_LEAK)
Variable "rsp_payload" going out of scope leaks the storage it points to.
--- hw/ssi/pnv_spi.c | 1 + 1 file changed, 1 insertion(+)
hw/ssi/pnv_spi.c +1 -0
@@ -239,6 +239,7 @@ static void transfer(PnvSpi *s, PnvXferBuffer *payload) } }spi_response (s, s->N1_bits, rsp_payload); +pnv_spi_xfer_buffer_free (rsp_payload); }static inline uint8_t get_seq_index (PnvSpi *s)
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 01/67] target/ppc: Set ctx->opcode for decode_insn32()
In reply to Nicholas PigginFrom: Ilya Leoshkevich <[email protected]>
divdu (without a dot) sometimes updates cr0, even though it shouldn't. The reason is that gen_op_arith_divd() checks Rc(ctx->opcode), which is not initialized. This field is initialized only for instructions that go through decode_legacy(), and not decodetree.
There already was a similar issue fixed in commit 86e6202a57b1 ("target/ppc: Make divw[u] handler method decodetree compatible.").
It's not immediately clear what else may access the uninitialized ctx->opcode, so instead of playing whack-a-mole and changing the check to compute_rc0, simply initialize ctx->opcode.
--- target/ppc/translate.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
target/ppc/translate.c +1 -2
@@ -6423,8 +6423,6 @@ static bool decode_legacy(PowerPCCPU *cpu, DisasContext *ctx, uint32_t insn)opc_handler_t **table, *handler;uint32_t inval; - ctx->opcode = insn; -LOG_DISAS ("translate opcode %08x (%02x %02x %02x %02x) (%s)\n" , insn,opc1 (insn),opc2 (insn),opc3 (insn),opc4 (insn), ctx->le_mode ?"little" :"big" );
@@ -6558,6 +6556,7 @@ static void ppc_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) ctx->base.pc_next = pc +=4 ;if (!is_prefix_insn (ctx, insn)) { + ctx->opcode = insn; ok = (decode_insn32 (ctx, insn) ||decode_legacy (cpu, ctx, insn)); }else if ((pc &63 ) ==0 ) {
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 05/67] target/ppc: Fix mtDPDES targeting SMT siblings
In reply to Nicholas PigginA typo in the loop over SMT threads to set irq level for doorbells when storing to DPDES meant everything was aimed at the CPU executing the instruction.
--- target/ppc/misc_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/ppc/misc_helper.c +1 -1
@@ -288,7 +288,7 @@ void helper_store_dpdes(CPUPPCState *env, target_ulong val)PowerPCCPU *ccpu =POWERPC_CPU (ccs);uint32_t thread_id =ppc_cpu_tir (ccpu); -ppc_set_irq (cpu,PPC_INTERRUPT_DOORBELL , val & (0x1 << thread_id)); +ppc_set_irq (ccpu,PPC_INTERRUPT_DOORBELL , val & (0x1 << thread_id)); }bql_unlock (); }
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 28/67] ppc/spapr: remove deprecated machine pseries-2.12-sxxm
In reply to Nicholas PigginFrom: Harsh Prateek Bora <[email protected]>
Commit 0cac0f1b964 marked pseries-2.12 machines as deprecated with reasons mentioned in its commit log.
Removing pseries-2.12-sxxm specific code with this patch.
--- hw/ppc/spapr.c | 14 -------------- 1 file changed, 14 deletions(-)
hw/ppc/spapr.c +0 -14
@@ -4731,8 +4731,6 @@ static void spapr_machine_latest_class_options(MachineClass *mc) DEFINE_SPAPR_MACHINE_IMPL(true, major, minor)#define DEFINE_SPAPR_MACHINE (major, minor) \ DEFINE_SPAPR_MACHINE_IMPL(false, major, minor) -#define DEFINE_SPAPR_MACHINE_TAGGED (major, minor, tag) \ - DEFINE_SPAPR_MACHINE_IMPL(false, major, minor, _, tag)/* * pseries-9.2
@@ -5042,18 +5040,6 @@ static void spapr_machine_2_12_class_options(MachineClass *mc)DEFINE_SPAPR_MACHINE (2 ,12 ); -static void spapr_machine_2_12_sxxm_class_options (MachineClass *mc) -{ -SpaprMachineClass *smc =SPAPR_MACHINE_CLASS (mc); - -spapr_machine_2_12_class_options (mc); - smc->default_caps.caps[SPAPR_CAP_CFPC ] =SPAPR_CAP_WORKAROUND ; - smc->default_caps.caps[SPAPR_CAP_SBBC ] =SPAPR_CAP_WORKAROUND ; - smc->default_caps.caps[SPAPR_CAP_IBS ] =SPAPR_CAP_FIXED_CCD ; -} - -DEFINE_SPAPR_MACHINE_TAGGED (2 ,12 , sxxm); -static void spapr_machine_register_types (void ) {type_register_static (&spapr_machine_info);
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 25/67] ppc/spapr: remove deprecated machine pseries-2.9
In reply to Nicholas PigginFrom: Harsh Prateek Bora <[email protected]>
Commit 1392617d3576 intended to tag pseries-2.1 - 2.11 machines as deprecated with reasons mentioned in its commit log. Removing pseries-2.9 specific code with this patch for now.
While at it, also remove the pre-2.10 migration hacks which now become obsolete.
--- hw/intc/xics.c | 16 ------- hw/ppc/spapr.c | 104 ----------------------------------------- include/hw/ppc/spapr.h | 1 - migration/savevm.c | 19 -------- target/ppc/cpu.h | 1 - target/ppc/cpu_init.c | 2 - target/ppc/machine.c | 2 +- 7 files changed, 1 insertion(+), 144 deletions(-)
hw/intc/xics.c +0 -16
@@ -335,22 +335,6 @@ static void icp_realize(DeviceState *dev, Error **errp)return ; } } -/* -* The way that pre_2_10_icp is handling is really, really hacky. -* We used to have here this call: -* -* vmstate_register(NULL, icp->cs->cpu_index, &vmstate_icp_server, icp); -* -* But we were doing: -* pre_2_10_vmstate_register_dummy_icp() -* this vmstate_register() -* pre_2_10_vmstate_unregister_dummy_icp() -* -* So for a short amount of time we had to vmstate entries with -* the same name. This fixes it. -*/ -vmstate_replace_hack_for_ppc (NULL , icp->cs->cpu_index, - &vmstate_icp_server, icp); }static void icp_unrealize (DeviceState *dev)
hw/ppc/spapr.c +0 -104
149 lines not on this page · raw message
include/hw/ppc/spapr.h +0 -1
@@ -143,7 +143,6 @@ struct SpaprMachineClass {/*< public >*/ bool dr_phb_enabled;/* enable dynamic-reconfig/hotplug of PHBs */ bool update_dt_enabled;/* enable KVMPPC_H_UPDATE_DT */ -bool pre_2_10_has_unused_icps;bool legacy_irq_allocation;uint32_t nr_xirqs;bool broken_host_serial_model;/* present real host info to the guest */
migration/savevm.c +0 -19
@@ -860,25 +860,6 @@ static void vmstate_check(const VMStateDescription *vmsd) } } -/* -* See comment in hw/intc/xics.c:icp_realize() -* -* This function can be removed when -* pre_2_10_vmstate_register_dummy_icp() is removed. -*/ -int vmstate_replace_hack_for_ppc (VMStateIf *obj,int instance_id, -const VMStateDescription *vmsd, -void *opaque) -{ -SaveStateEntry *se =find_se (vmsd->name, instance_id); - -if (se) { -savevm_state_handler_remove (se); -g_free (se->compat); -g_free (se); - } -return vmstate_register (obj, instance_id, vmsd, opaque); -} int vmstate_register_with_alias_id(VMStateIf *obj, uint32_t instance_id, const VMStateDescription *vmsd,
target/ppc/cpu.h +0 -1
@@ -1457,7 +1457,6 @@ struct ArchCPU {opc_handler_t *opcodes[PPC_CPU_OPCODES_LEN ];/* Fields related to migration compatibility hacks */ -bool pre_2_10_migration;bool pre_3_0_migration;int32_t mig_slb_nr; };
target/ppc/cpu_init.c +0 -2
@@ -7452,8 +7452,6 @@ static void ppc_disas_set_info(CPUState *cs, disassemble_info *info) }static Property ppc_cpu_properties[] = { -DEFINE_PROP_BOOL ("pre-2.10-migration" , PowerPCCPU, pre_2_10_migration, - false),DEFINE_PROP_BOOL ("pre-3.0-migration" , PowerPCCPU, pre_3_0_migration, false),DEFINE_PROP_END_OF_LIST (),
target/ppc/machine.c +1 -1
@@ -630,7 +630,7 @@ static bool compat_needed(void *opaque)PowerPCCPU *cpu = opaque;assert (!(cpu->compat_pvr && !cpu->vhyp)); -return !cpu->pre_2_10_migration && cpu->compat_pvr !=0 ; +return cpu->compat_pvr !=0 ; }static const VMStateDescription vmstate_compat = {
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 19/67] ppc/spapr: remove deprecated machine pseries-2.3
In reply to Nicholas PigginFrom: Harsh Prateek Bora <[email protected]>
Commit 1392617d3576 intended to tag pseries-2.1 - 2.11 machines as deprecated with reasons mentioned in its commit log. Removing pseries-2.3 specific code with this patch for now.
While at it, also remove the dynamic-reconfiguration option which was introduced to disable it by default for legacy machines until pseries-2.3.
--- hw/core/machine.c | 13 ------------- hw/ppc/spapr.c | 15 --------------- hw/ppc/spapr_pci.c | 35 ----------------------------------- include/hw/boards.h | 3 --- include/hw/pci-host/spapr.h | 1 - 5 files changed, 67 deletions(-)
hw/core/machine.c +0 -13
@@ -281,19 +281,6 @@ GlobalProperty hw_compat_2_4[] = { };const size_t hw_compat_2_4_len =G_N_ELEMENTS (hw_compat_2_4); -GlobalProperty hw_compat_2_3[] = { - {"virtio-blk-pci" ,"any_layout" ,"off" }, - {"virtio-balloon-pci" ,"any_layout" ,"off" }, - {"virtio-serial-pci" ,"any_layout" ,"off" }, - {"virtio-9p-pci" ,"any_layout" ,"off" }, - {"virtio-rng-pci" ,"any_layout" ,"off" }, - {TYPE_PCI_DEVICE ,"x-pcie-lnksta-dllla" ,"off" }, - {"migration" ,"send-configuration" ,"off" }, - {"migration" ,"send-section-footer" ,"off" }, - {"migration" ,"store-global-state" ,"off" }, -}; -const size_t hw_compat_2_3_len =G_N_ELEMENTS (hw_compat_2_3); -MachineState *current_machine;static char *machine_get_kernel (Object *obj,Error **errp)
hw/ppc/spapr.c +0 -15
@@ -5349,21 +5349,6 @@ static void spapr_machine_2_4_class_options(MachineClass *mc)DEFINE_SPAPR_MACHINE (2 ,4 ); -/* -* pseries-2.3 -*/ - -static void spapr_machine_2_3_class_options (MachineClass *mc) -{ -static GlobalProperty compat[] = { - {"spapr-pci-host-bridge" ,"dynamic-reconfiguration" ,"off" }, - }; -spapr_machine_2_4_class_options (mc); -compat_props_add (mc->compat_props, hw_compat_2_3, hw_compat_2_3_len); -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); -} -DEFINE_SPAPR_MACHINE (2 ,3 ); -static void spapr_machine_register_types (void ) {type_register_static (&spapr_machine_info);
hw/ppc/spapr_pci.c +0 -35
@@ -1237,10 +1237,6 @@ static void add_drcs(SpaprPhbState *phb, PCIBus *bus)int i;uint8_t chassis; -if (!phb->dr_enabled) { -return ; - } - chassis =chassis_from_bus (bus);if (pci_bus_is_root (bus)) {
@@ -1260,10 +1256,6 @@ static void remove_drcs(SpaprPhbState *phb, PCIBus *bus)int i;uint8_t chassis; -if (!phb->dr_enabled) { -return ; - } - chassis =chassis_from_bus (bus);for (i =PCI_SLOT_MAX *PCI_FUNC_MAX -1 ; i >=0 ; i--) {
@@ -1548,17 +1540,6 @@ static void spapr_pci_pre_plug(HotplugHandler *plug_handler,PCIBus *bus =PCI_BUS (qdev_get_parent_bus (DEVICE (pdev)));uint32_t slotnr =PCI_SLOT (pdev->devfn); -if (!phb->dr_enabled) { -/* if this is a hotplug operation initiated by the user -* we need to let them know it's not enabled -*/ -if (plugged_dev->hotplugged) { -error_setg (errp,"Bus '%s' does not support hotplugging" , - phb->parent_obj.bus->qbus.name); -return ; - } - } -if (IS_PCI_BRIDGE (plugged_dev)) {if (!bridge_has_valid_chassis_nr (OBJECT (plugged_dev), errp)) {return ;
@@ -1591,14 +1572,6 @@ static void spapr_pci_plug(HotplugHandler *plug_handler,SpaprDrc *drc =drc_from_dev (phb, pdev);uint32_t slotnr =PCI_SLOT (pdev->devfn); -/* -* If DR is disabled we don't need to do anything in the case of -* hotplug or coldplug callbacks. -*/ -if (!phb->dr_enabled) { -return ; - } -g_assert (drc);if (IS_PCI_BRIDGE (plugged_dev)) {
@@ -1673,12 +1646,6 @@ static void spapr_pci_unplug_request(HotplugHandler *plug_handler,PCIDevice *pdev =PCI_DEVICE (plugged_dev);SpaprDrc *drc =drc_from_dev (phb, pdev); -if (!phb->dr_enabled) { -error_setg (errp,"Bus '%s' does not support hotplugging" , - phb->parent_obj.bus->qbus.name); -return ; - } -g_assert (drc);g_assert (drc->dev == plugged_dev);
@@ -2089,8 +2056,6 @@ static Property spapr_phb_properties[] = { SPAPR_PCI_MEM64_WIN_SIZE),DEFINE_PROP_UINT64 ("io_win_size" , SpaprPhbState, io_win_size,SPAPR_PCI_IO_WIN_SIZE ), -DEFINE_PROP_BOOL ("dynamic-reconfiguration" , SpaprPhbState, dr_enabled, - true),/* Default DMA window is 0..1GB */ DEFINE_PROP_UINT64 ("dma_win_addr" , SpaprPhbState, dma_win_addr,0 ), DEFINE_PROP_UINT64("dma_win_size", SpaprPhbState, dma_win_size, 0x40000000),
include/hw/boards.h +0 -3
@@ -822,7 +822,4 @@ extern const size_t hw_compat_2_5_len;extern GlobalProperty hw_compat_2_4[];extern const size_t hw_compat_2_4_len; -extern GlobalProperty hw_compat_2_3[]; -extern const size_t hw_compat_2_3_len; -#endif
include/hw/pci-host/spapr.h +0 -1
@@ -53,7 +53,6 @@ struct SpaprPhbState {uint32_t index;uint64_t buid;char *dtbusname; -bool dr_enabled;MemoryRegion memspace, iospace;hwaddr mem_win_addr, mem_win_size, mem64_win_addr, mem64_win_size;
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 13/67] hw/ssi/pnv_spi: Return early in transfer()
In reply to Nicholas PigginFrom: Philippe Mathieu-Daudé <[email protected]>
Return early to simplify next commit.
No logical change intended.
--- hw/ssi/pnv_spi.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
hw/ssi/pnv_spi.c +4 -3
@@ -217,6 +217,9 @@ static void transfer(PnvSpi *s, PnvXferBuffer *payload)PnvXferBuffer *rsp_payload =NULL ; rsp_payload =pnv_spi_xfer_buffer_new (); +if (!rsp_payload) { +return ; + }for (int offset =0 ; offset < payload->len; offset += s->transfer_len) { tx =0 ;for (int i =0 ; i < s->transfer_len; i++) {
@@ -235,9 +238,7 @@ static void transfer(PnvSpi *s, PnvXferBuffer *payload) (rx >> (8 * (s->transfer_len -1 ) - i *8 )) &0xFF ; } } -if (rsp_payload !=NULL ) { -spi_response (s, s->N1_bits, rsp_payload); - } +spi_response (s, s->N1_bits, rsp_payload); }static inline uint8_t get_seq_index (PnvSpi *s)
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 35/67] target/ppc: use locally stored msr and avoid indirect access
In reply to Nicholas PigginFrom: Harsh Prateek Bora <[email protected]>
hreg_compute_hflags_value already stores msr locally to be used in most of the logic in the routine however some instances are still using env->msr which is unnecessary. Use locally stored value as available.
--- target/ppc/helper_regs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
target/ppc/helper_regs.c +2 -2
@@ -143,10 +143,10 @@ static uint32_t hreg_compute_hflags_value(CPUPPCState *env)if (ppc_flags &POWERPC_FLAG_DE ) {target_ulong dbcr0 = env->spr[SPR_BOOKE_DBCR0 ]; -if ((dbcr0 &DBCR0_ICMP ) &&FIELD_EX64 (env->msr,MSR ,DE )) { +if ((dbcr0 &DBCR0_ICMP ) &&FIELD_EX64 (msr,MSR ,DE )) { hflags |=1 <<HFLAGS_SE ; } -if ((dbcr0 &DBCR0_BRT ) &&FIELD_EX64 (env->msr,MSR ,DE )) { +if ((dbcr0 &DBCR0_BRT ) &&FIELD_EX64 (msr,MSR ,DE )) { hflags |=1 <<HFLAGS_BE ; } }else {
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 09/67] target/ppc: Fix VRMA to not check virtual page class key protection
In reply to Nicholas PigginHash virtual real mode addressing is defined by the architecture to not perform virtual page class key protection checks.
--- target/ppc/mmu-hash64.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
target/ppc/mmu-hash64.c +8 -1
@@ -993,6 +993,7 @@ bool ppc_hash64_xlate(PowerPCCPU *cpu, vaddr eaddr, MMUAccessType access_type,int exec_prot, pp_prot, amr_prot, prot;int need_prot;hwaddr raddr; +bool vrma = false;/* * Note on LPCR usage: 970 uses HID4, but our special variant of
@@ -1022,6 +1023,7 @@ bool ppc_hash64_xlate(PowerPCCPU *cpu, vaddr eaddr, MMUAccessType access_type, } }else if (ppc_hash64_use_vrma (env)) {/* Emulated VRMA mode */ + vrma = true; slb = &vrma_slbe;if (build_vrma_slbe (cpu, slb) !=0 ) {/* Invalid VRMA setup, machine check */
@@ -1136,7 +1138,12 @@ bool ppc_hash64_xlate(PowerPCCPU *cpu, vaddr eaddr, MMUAccessType access_type, exec_prot =ppc_hash64_pte_noexec_guard (cpu, pte); pp_prot =ppc_hash64_pte_prot (mmu_idx, slb, pte); - amr_prot =ppc_hash64_amr_prot (cpu, pte); +if (vrma) { +/* VRMA does not check keys */ + amr_prot =PAGE_READ |PAGE_WRITE |PAGE_EXEC ; + }else { + amr_prot =ppc_hash64_amr_prot (cpu, pte); + } prot = exec_prot & pp_prot & amr_prot; need_prot =check_prot_access_type (PAGE_RWX , access_type);
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 29/67] ppc/spapr: remove deprecated machine pseries-2.12
In reply to Nicholas PigginFrom: Harsh Prateek Bora <[email protected]>
Commit 0cac0f1b964 marked pseries-2.12 machines as deprecated with reasons mentioned in its commit log.
Removing pseries-2.12 specific code with this patch.
While at it, also remove pre-3.0-migration hacks introduced for backward compatibility which are now turned useless.
--- docs/about/deprecated.rst | 8 -------- hw/ppc/spapr.c | 25 ------------------------- hw/ppc/spapr_cpu_core.c | 12 +++--------- include/hw/ppc/spapr_cpu_core.h | 1 - target/ppc/cpu.h | 4 ---- target/ppc/cpu_init.c | 3 +-- target/ppc/machine.c | 18 +----------------- 7 files changed, 5 insertions(+), 66 deletions(-)
docs/about/deprecated.rst +0 -8
@@ -243,14 +243,6 @@ These old machine types are quite neglected nowadays and thus might have various pitfalls with regards to live migration. Use a newer machine type instead. -``pseries-2.1`` up to ``pseries-2.12`` (since 9.0) -'''''''''''''''''''''''''''''''''''''''''''''''''' - -Older pseries machines before version 3.0 have undergone many changes -to correct issues, mostly regarding migration compatibility. These are -no longer maintained and removing them will make the code easier to -read and maintain. Use versions 3.0 and above as a replacement. - PPC 405 ``ref405ep`` machine (since 9.1) ''''''''''''''''''''''''''''''''''''''''
hw/ppc/spapr.c +0 -25
@@ -5015,31 +5015,6 @@ static void spapr_machine_3_0_class_options(MachineClass *mc)DEFINE_SPAPR_MACHINE (3 ,0 ); -/* -* pseries-2.12 -*/ -static void spapr_machine_2_12_class_options (MachineClass *mc) -{ -SpaprMachineClass *smc =SPAPR_MACHINE_CLASS (mc); -static GlobalProperty compat[] = { - {TYPE_POWERPC_CPU ,"pre-3.0-migration" ,"on" }, - {TYPE_SPAPR_CPU_CORE ,"pre-3.0-migration" ,"on" }, - }; - -spapr_machine_3_0_class_options (mc); -compat_props_add (mc->compat_props, hw_compat_2_12, hw_compat_2_12_len); -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); - -/* We depend on kvm_enabled() to choose a default value for the -* hpt-max-page-size capability. Of course we can't do it here -* because this is too early and the HW accelerator isn't initialized -* yet. Postpone this to machine init (see default_caps_with_cpu()). -*/ - smc->default_caps.caps[SPAPR_CAP_HPT_MAXPAGESIZE ] =0 ; -} - -DEFINE_SPAPR_MACHINE (2 ,12 ); -static void spapr_machine_register_types (void ) {type_register_static (&spapr_machine_info);
hw/ppc/spapr_cpu_core.c +3 -9
@@ -197,9 +197,7 @@ static void spapr_unrealize_vcpu(PowerPCCPU *cpu, SpaprCpuCore *sc) {CPUPPCState *env = &cpu->env; -if (!sc->pre_3_0_migration) { -vmstate_unregister (NULL , &vmstate_spapr_cpu_state, cpu->machine_data); - } +vmstate_unregister (NULL , &vmstate_spapr_cpu_state, cpu->machine_data);spapr_irq_cpu_intc_destroy (SPAPR_MACHINE (qdev_get_machine ()), cpu);cpu_ppc_tb_free (env);qdev_unrealize (DEVICE (cpu));
@@ -285,10 +283,8 @@ static bool spapr_realize_vcpu(PowerPCCPU *cpu, SpaprMachineState *spapr,return false; } -if (!sc->pre_3_0_migration) { -vmstate_register (NULL , cs->cpu_index, &vmstate_spapr_cpu_state, - cpu->machine_data); - } +vmstate_register (NULL , cs->cpu_index, &vmstate_spapr_cpu_state, + cpu->machine_data);return true; }
@@ -366,8 +362,6 @@ static void spapr_cpu_core_realize(DeviceState *dev, Error **errp)static Property spapr_cpu_core_properties[] = {DEFINE_PROP_INT32 ("node-id" , SpaprCpuCore, node_id,CPU_UNSET_NUMA_NODE_ID ), -DEFINE_PROP_BOOL ("pre-3.0-migration" , SpaprCpuCore, pre_3_0_migration, - false),DEFINE_PROP_END_OF_LIST () };
include/hw/ppc/spapr_cpu_core.h +0 -1
@@ -28,7 +28,6 @@ struct SpaprCpuCore {/*< public >*/ PowerPCCPU **threads;int node_id; -bool pre_3_0_migration;/* older machine don't know about SpaprCpuState */ };struct SpaprCpuCoreClass {
target/ppc/cpu.h +0 -4
@@ -1455,10 +1455,6 @@ struct ArchCPU {/* 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_3_0_migration; -int32_t mig_slb_nr; };/**
target/ppc/cpu_init.c +1 -2
@@ -7452,8 +7452,7 @@ static void ppc_disas_set_info(CPUState *cs, disassemble_info *info) }static Property ppc_cpu_properties[] = { -DEFINE_PROP_BOOL ("pre-3.0-migration" , PowerPCCPU, pre_3_0_migration, - false), +/* add default property here */ DEFINE_PROP_END_OF_LIST (), };
target/ppc/machine.c +1 -17
@@ -118,15 +118,6 @@ static const VMStateInfo vmstate_info_vsr = {#define VMSTATE_VSR_ARRAY (_f, _s, _n) \ VMSTATE_VSR_ARRAY_V(_f, _s, _n, 0) -#if defined(TARGET_PPC64 ) -static bool cpu_pre_3_0_migration (void *opaque,int version_id) -{ -PowerPCCPU *cpu = opaque; - -return cpu->pre_3_0_migration; -} -#endif -static int cpu_pre_save (void *opaque) {PowerPCCPU *cpu = opaque;
@@ -154,12 +145,6 @@ static int cpu_pre_save(void *opaque) env->spr[SPR_IBAT4U +2 * i +1 ] = env->IBAT[1 ][i +4 ]; } -if (cpu->pre_3_0_migration) { -if (cpu->hash64_opts) { - cpu->mig_slb_nr = cpu->hash64_opts->slb_size; - } - } -/* Used to retain migration compatibility for pre 6.0 for 601 machines. */ env->hflags_compat_nmsr =0 ;
@@ -503,12 +488,11 @@ static int slb_post_load(void *opaque, int version_id)static const VMStateDescription vmstate_slb = { .name ="cpu/slb" , - .version_id =1 , + .version_id =2 , .minimum_version_id =1 , .needed = slb_needed, .post_load = slb_post_load, .fields = (const VMStateField []) { -VMSTATE_INT32_TEST (mig_slb_nr, PowerPCCPU, cpu_pre_3_0_migration),VMSTATE_SLB_ARRAY (env.slb, PowerPCCPU,MAX_SLB_ENTRIES ),VMSTATE_END_OF_LIST () }
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 10/67] ppc/pnv: ADU fix possible buffer overrun with invalid size
In reply to Nicholas PigginThe ADU LPC transfer-size field is 7 bits, but the supported sizes for LPC access via ADU appear to be 1, 2, 4, 8. The data buffer could overrun if firmware set an invalid size field, so add checks to reject them with a message.
Resolves: Coverity CID 1558830
--- hw/ppc/pnv_adu.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
hw/ppc/pnv_adu.c +12 -0
@@ -116,6 +116,12 @@ static void pnv_adu_xscom_write(void *opaque, hwaddr addr, uint64_t val,uint32_t lpc_size =lpc_cmd_size (adu);uint64_t data =0 ; +if (!is_power_of_2 (lpc_size) || lpc_size >sizeof (data)) { +qemu_log_mask (LOG_GUEST_ERROR ,"ADU: Unsupported LPC access " +"size:%" PRId32"\n" , lpc_size); +break ; + } +pnv_lpc_opb_read (adu->lpc, lpc_addr, (void *)&data, lpc_size);/*
@@ -135,6 +141,12 @@ static void pnv_adu_xscom_write(void *opaque, hwaddr addr, uint64_t val,uint32_t lpc_size =lpc_cmd_size (adu);uint64_t data; +if (!is_power_of_2 (lpc_size) || lpc_size >sizeof (data)) { +qemu_log_mask (LOG_GUEST_ERROR ,"ADU: Unsupported LPC access " +"size:%" PRId32"\n" , lpc_size); +break ; + } + data =cpu_to_be64 (val) >> ((lpc_addr &7 ) *8 );/* See above */ pnv_lpc_opb_write (adu->lpc, lpc_addr, (void *)&data, lpc_size); }
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 18/67] ppc/spapr: remove deprecated machine pseries-2.2
In reply to Nicholas PigginFrom: Harsh Prateek Bora <[email protected]>
Commit 1392617d3576 intended to tag pseries-2.1 - 2.11 machines as deprecated with reasons mentioned in its commit log. Removing pseries-2.2 specific code with this patch for now.
--- hw/core/machine.c | 3 --- hw/ppc/spapr.c | 17 ----------------- include/hw/boards.h | 3 --- 3 files changed, 23 deletions(-)
hw/core/machine.c +0 -3
@@ -294,9 +294,6 @@ GlobalProperty hw_compat_2_3[] = { };const size_t hw_compat_2_3_len =G_N_ELEMENTS (hw_compat_2_3); -GlobalProperty hw_compat_2_2[] = {}; -const size_t hw_compat_2_2_len =G_N_ELEMENTS (hw_compat_2_2); -MachineState *current_machine;static char *machine_get_kernel (Object *obj,Error **errp)
hw/ppc/spapr.c +0 -17
@@ -5364,23 +5364,6 @@ static void spapr_machine_2_3_class_options(MachineClass *mc) }DEFINE_SPAPR_MACHINE (2 ,3 ); -/* -* pseries-2.2 -*/ - -static void spapr_machine_2_2_class_options (MachineClass *mc) -{ -static GlobalProperty compat[] = { - {TYPE_SPAPR_PCI_HOST_BRIDGE ,"mem_win_size" ,"0x20000000" }, - }; - -spapr_machine_2_3_class_options (mc); -compat_props_add (mc->compat_props, hw_compat_2_2, hw_compat_2_2_len); -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); - mc->default_machine_opts ="modern-hotplug-events=off,suppress-vmdesc=on" ; -} -DEFINE_SPAPR_MACHINE (2 ,2 ); -static void spapr_machine_register_types (void ) {type_register_static (&spapr_machine_info);
include/hw/boards.h +0 -3
@@ -825,7 +825,4 @@ extern const size_t hw_compat_2_4_len;extern GlobalProperty hw_compat_2_3[];extern const size_t hw_compat_2_3_len; -extern GlobalProperty hw_compat_2_2[]; -extern const size_t hw_compat_2_2_len; -#endif
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 41/67] target/ppc: simplify var usage in ppc_next_unmasked_interrupt
In reply to Nicholas PigginFrom: Harsh Prateek Bora <[email protected]>
As previously done for arch specific handlers, simplify var usage in ppc_next_unmasked_interrupt by caching the env->pending_interrupts and env->spr[SPR_LPCR] in local vars and using it later at multiple places.
--- target/ppc/excp_helper.c | 54 ++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 27 deletions(-)
target/ppc/excp_helper.c +27 -27
@@ -2022,31 +2022,31 @@ static int p9_next_unmasked_interrupt(CPUPPCState *env,static int ppc_next_unmasked_interrupt (CPUPPCState *env) { +uint32_t pending_interrupts = env->pending_interrupts; +target_ulong lpcr = env->spr[SPR_LPCR ]; +bool async_deliver; +#ifdef TARGET_PPC64 switch (env->excp_model) {case POWERPC_EXCP_POWER7 : -return p7_next_unmasked_interrupt (env, env->pending_interrupts, - env->spr[SPR_LPCR ]); +return p7_next_unmasked_interrupt (env, pending_interrupts, lpcr);case POWERPC_EXCP_POWER8 : -return p8_next_unmasked_interrupt (env, env->pending_interrupts, - env->spr[SPR_LPCR ]); +return p8_next_unmasked_interrupt (env, pending_interrupts, lpcr);case POWERPC_EXCP_POWER9 :case POWERPC_EXCP_POWER10 :case POWERPC_EXCP_POWER11 : -return p9_next_unmasked_interrupt (env, env->pending_interrupts, - env->spr[SPR_LPCR ]); +return p9_next_unmasked_interrupt (env, pending_interrupts, lpcr);default :break ; }#endif -bool async_deliver;/* External reset */ -if (env->pending_interrupts &PPC_INTERRUPT_RESET ) { +if (pending_interrupts &PPC_INTERRUPT_RESET ) {return PPC_INTERRUPT_RESET ; }/* Machine check exception */ -if (env->pending_interrupts &PPC_INTERRUPT_MCK ) { +if (pending_interrupts &PPC_INTERRUPT_MCK ) {return PPC_INTERRUPT_MCK ; }#if 0 /* TODO */
@@ -2065,9 +2065,9 @@ static int ppc_next_unmasked_interrupt(CPUPPCState *env) async_deliver =FIELD_EX64 (env->msr,MSR ,EE ) || env->resume_as_sreset;/* Hypervisor decrementer exception */ -if (env->pending_interrupts &PPC_INTERRUPT_HDECR ) { +if (pending_interrupts &PPC_INTERRUPT_HDECR ) {/* LPCR will be clear when not supported so this will work */ -bool hdice = !!(env->spr[SPR_LPCR ] &LPCR_HDICE ); +bool hdice = !!(lpcr &LPCR_HDICE );if ((async_deliver || !FIELD_EX64_HV (env->msr)) && hdice) {/* HDEC clears on delivery */ return PPC_INTERRUPT_HDECR ;
@@ -2075,18 +2075,18 @@ static int ppc_next_unmasked_interrupt(CPUPPCState *env) }/* Hypervisor virtualization interrupt */ -if (env->pending_interrupts &PPC_INTERRUPT_HVIRT ) { +if (pending_interrupts &PPC_INTERRUPT_HVIRT ) {/* LPCR will be clear when not supported so this will work */ -bool hvice = !!(env->spr[SPR_LPCR ] &LPCR_HVICE ); +bool hvice = !!(lpcr &LPCR_HVICE );if ((async_deliver || !FIELD_EX64_HV (env->msr)) && hvice) {return PPC_INTERRUPT_HVIRT ; } }/* External interrupt can ignore MSR:EE under some circumstances */ -if (env->pending_interrupts &PPC_INTERRUPT_EXT ) { -bool lpes0 = !!(env->spr[SPR_LPCR ] &LPCR_LPES0 ); -bool heic = !!(env->spr[SPR_LPCR ] &LPCR_HEIC ); +if (pending_interrupts &PPC_INTERRUPT_EXT ) { +bool lpes0 = !!(lpcr &LPCR_LPES0 ); +bool heic = !!(lpcr &LPCR_HEIC );/* HEIC blocks delivery to the hypervisor */ if ((async_deliver && !(heic && FIELD_EX64_HV(env->msr) && !FIELD_EX64(env->msr, MSR, PR))) ||
@@ -2096,45 +2096,45 @@ static int ppc_next_unmasked_interrupt(CPUPPCState *env) }if (FIELD_EX64 (env->msr,MSR ,CE )) {/* External critical interrupt */ -if (env->pending_interrupts &PPC_INTERRUPT_CEXT ) { +if (pending_interrupts &PPC_INTERRUPT_CEXT ) {return PPC_INTERRUPT_CEXT ; } }if (async_deliver !=0 ) {/* Watchdog timer on embedded PowerPC */ -if (env->pending_interrupts &PPC_INTERRUPT_WDT ) { +if (pending_interrupts &PPC_INTERRUPT_WDT ) {return PPC_INTERRUPT_WDT ; } -if (env->pending_interrupts &PPC_INTERRUPT_CDOORBELL ) { +if (pending_interrupts &PPC_INTERRUPT_CDOORBELL ) {return PPC_INTERRUPT_CDOORBELL ; }/* Fixed interval timer on embedded PowerPC */ -if (env->pending_interrupts &PPC_INTERRUPT_FIT ) { +if (pending_interrupts &PPC_INTERRUPT_FIT ) {return PPC_INTERRUPT_FIT ; }/* Programmable interval timer on embedded PowerPC */ -if (env->pending_interrupts &PPC_INTERRUPT_PIT ) { +if (pending_interrupts &PPC_INTERRUPT_PIT ) {return PPC_INTERRUPT_PIT ; }/* Decrementer exception */ -if (env->pending_interrupts &PPC_INTERRUPT_DECR ) { +if (pending_interrupts &PPC_INTERRUPT_DECR ) {return PPC_INTERRUPT_DECR ; } -if (env->pending_interrupts &PPC_INTERRUPT_DOORBELL ) { +if (pending_interrupts &PPC_INTERRUPT_DOORBELL ) {return PPC_INTERRUPT_DOORBELL ; } -if (env->pending_interrupts &PPC_INTERRUPT_HDOORBELL ) { +if (pending_interrupts &PPC_INTERRUPT_HDOORBELL ) {return PPC_INTERRUPT_HDOORBELL ; } -if (env->pending_interrupts &PPC_INTERRUPT_PERFM ) { +if (pending_interrupts &PPC_INTERRUPT_PERFM ) {return PPC_INTERRUPT_PERFM ; }/* Thermal interrupt */ -if (env->pending_interrupts &PPC_INTERRUPT_THERM ) { +if (pending_interrupts &PPC_INTERRUPT_THERM ) {return PPC_INTERRUPT_THERM ; }/* EBB exception */ -if (env->pending_interrupts &PPC_INTERRUPT_EBB ) { +if (pending_interrupts &PPC_INTERRUPT_EBB ) {/* * EBB exception must be taken in problem state and * with BESCR_GE set.
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 24/67] ppc/spapr: remove deprecated machine pseries-2.8
In reply to Nicholas PigginFrom: Harsh Prateek Bora <[email protected]>
Commit 1392617d3576 intended to tag pseries-2.1 - 2.11 machines as deprecated with reasons mentioned in its commit log. Removing pseries-2.8 specific code with this patch for now.
--- hw/ppc/spapr.c | 18 ------------------ 1 file changed, 18 deletions(-)
hw/ppc/spapr.c +0 -18
@@ -5185,24 +5185,6 @@ static void spapr_machine_2_9_class_options(MachineClass *mc)DEFINE_SPAPR_MACHINE (2 ,9 ); -/* -* pseries-2.8 -*/ - -static void spapr_machine_2_8_class_options (MachineClass *mc) -{ -static GlobalProperty compat[] = { - {TYPE_SPAPR_PCI_HOST_BRIDGE ,"pcie-extended-configuration-space" ,"off" }, - }; - -spapr_machine_2_9_class_options (mc); -compat_props_add (mc->compat_props, hw_compat_2_8, hw_compat_2_8_len); -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); - mc->numa_mem_align_shift =23 ; -} - -DEFINE_SPAPR_MACHINE (2 ,8 ); -static void spapr_machine_register_types (void ) {type_register_static (&spapr_machine_info);
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 21/67] ppc/spapr: remove deprecated machine pseries-2.5
In reply to Nicholas PigginFrom: Harsh Prateek Bora <[email protected]>
Commit 1392617d3576 intended to tag pseries-2.1 - 2.11 machines as deprecated with reasons mentioned in its commit log. Removing pseries-2.5 specific code with this patch for now.
Also drop sPAPRMachineClass::use_ohci_by_default which is now useless.
--- hw/ppc/spapr.c | 25 +------------------------ include/hw/ppc/spapr.h | 1 - 2 files changed, 1 insertion(+), 25 deletions(-)
hw/ppc/spapr.c +1 -24
@@ -3070,11 +3070,7 @@ static void spapr_machine_init(MachineState *machine) }if (machine->usb) { -if (smc->use_ohci_by_default) { -pci_create_simple (phb->bus,-1 ,"pci-ohci" ); - }else { -pci_create_simple (phb->bus,-1 ,"nec-usb-xhci" ); - } +pci_create_simple (phb->bus,-1 ,"nec-usb-xhci" );if (has_vga) {USBBus *usb_bus;
@@ -5300,25 +5296,6 @@ static void spapr_machine_2_6_class_options(MachineClass *mc)DEFINE_SPAPR_MACHINE (2 ,6 ); -/* -* pseries-2.5 -*/ - -static void spapr_machine_2_5_class_options (MachineClass *mc) -{ -SpaprMachineClass *smc =SPAPR_MACHINE_CLASS (mc); -static GlobalProperty compat[] = { - {"spapr-vlan" ,"use-rx-buffer-pools" ,"off" }, - }; - -spapr_machine_2_6_class_options (mc); - smc->use_ohci_by_default = true; -compat_props_add (mc->compat_props, hw_compat_2_5, hw_compat_2_5_len); -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); -} - -DEFINE_SPAPR_MACHINE (2 ,5 ); -static void spapr_machine_register_types (void ) {type_register_static (&spapr_machine_info);
include/hw/ppc/spapr.h +0 -1
@@ -143,7 +143,6 @@ struct SpaprMachineClass {/*< public >*/ bool dr_phb_enabled;/* enable dynamic-reconfig/hotplug of PHBs */ bool update_dt_enabled;/* enable KVMPPC_H_UPDATE_DT */ -bool use_ohci_by_default;/* use USB-OHCI instead of XHCI */ bool pre_2_10_has_unused_icps;bool legacy_irq_allocation;uint32_t nr_xirqs;
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 22/67] ppc/spapr: remove deprecated machine pseries-2.6
In reply to Nicholas PigginFrom: Harsh Prateek Bora <[email protected]>
Commit 1392617d3576 intended to tag pseries-2.1 - 2.11 machines as deprecated with reasons mentioned in its commit log. Removing pseries-2.6 specific code with this patch for now.
--- hw/ppc/spapr.c | 18 ------------------ 1 file changed, 18 deletions(-)
hw/ppc/spapr.c +0 -18
@@ -5278,24 +5278,6 @@ static void spapr_machine_2_7_class_options(MachineClass *mc)DEFINE_SPAPR_MACHINE (2 ,7 ); -/* -* pseries-2.6 -*/ - -static void spapr_machine_2_6_class_options (MachineClass *mc) -{ -static GlobalProperty compat[] = { - {TYPE_SPAPR_PCI_HOST_BRIDGE ,"ddw" ,"off" }, - }; - -spapr_machine_2_7_class_options (mc); - mc->has_hotpluggable_cpus = false; -compat_props_add (mc->compat_props, hw_compat_2_6, hw_compat_2_6_len); -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); -} - -DEFINE_SPAPR_MACHINE (2 ,6 ); -static void spapr_machine_register_types (void ) {type_register_static (&spapr_machine_info);
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 11/67] MAINTAINERS: Cover PowerPC SPI model in PowerNV section
In reply to Nicholas PigginFrom: Philippe Mathieu-Daudé <[email protected]>
It is unfair to let the PowerNV SPI model to the SSI maintainers. Also include the PowerNV ones.
--- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+)
MAINTAINERS +2 -0
@@ -1505,8 +1505,10 @@ F: hw/ppc/pnv* F: hw/intc/pnv* F: hw/intc/xics_pnv.c F: hw/pci-host/pnv* +F: hw/ssi/pnv_spi.c F: include/hw/ppc/pnv* F: include/hw/pci-host/pnv* +F: include/hw/ssi/pnv_spi* F: pc-bios/skiboot.lid F: tests/qtest/pnv* F: tests/functional/test_ppc64_powernv.py
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 38/67] target/ppc: optimize p9 exception handling routines
In reply to Nicholas PigginFrom: Harsh Prateek Bora <[email protected]>
Currently, p9 exception handling has multiple if-condition checks where it does an indirect access to pending_interrupts and LPCR via env. Pass the values during entry to avoid multiple indirect accesses.
--- target/ppc/excp_helper.c | 72 ++++++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 33 deletions(-)
target/ppc/excp_helper.c +39 -33
@@ -1872,60 +1872,65 @@ static int p8_next_unmasked_interrupt(CPUPPCState *env) PPC_INTERRUPT_WDT | PPC_INTERRUPT_CDOORBELL | PPC_INTERRUPT_FIT | \ PPC_INTERRUPT_PIT | PPC_INTERRUPT_THERM) -static int p9_interrupt_powersave (CPUPPCState *env) +static int p9_interrupt_powersave (CPUPPCState *env, +uint32_t pending_interrupts, +target_ulong lpcr) { +/* External Exception */ -if ((env->pending_interrupts &PPC_INTERRUPT_EXT ) && - (env->spr[SPR_LPCR ] &LPCR_EEE )) { -bool heic = !!(env->spr[SPR_LPCR ] &LPCR_HEIC ); +if ((pending_interrupts &PPC_INTERRUPT_EXT ) && + (lpcr &LPCR_EEE )) { +bool heic = !!(lpcr &LPCR_HEIC );if (!heic || !FIELD_EX64_HV (env->msr) ||FIELD_EX64 (env->msr,MSR ,PR )) {return PPC_INTERRUPT_EXT ; } }/* Decrementer Exception */ -if ((env->pending_interrupts &PPC_INTERRUPT_DECR ) && - (env->spr[SPR_LPCR ] &LPCR_DEE )) { +if ((pending_interrupts &PPC_INTERRUPT_DECR ) && + (lpcr &LPCR_DEE )) {return PPC_INTERRUPT_DECR ; }/* Machine Check or Hypervisor Maintenance Exception */ -if (env->spr[SPR_LPCR ] &LPCR_OEE ) { -if (env->pending_interrupts &PPC_INTERRUPT_MCK ) { +if (lpcr &LPCR_OEE ) { +if (pending_interrupts &PPC_INTERRUPT_MCK ) {return PPC_INTERRUPT_MCK ; } -if (env->pending_interrupts &PPC_INTERRUPT_HMI ) { +if (pending_interrupts &PPC_INTERRUPT_HMI ) {return PPC_INTERRUPT_HMI ; } }/* Privileged Doorbell Exception */ -if ((env->pending_interrupts &PPC_INTERRUPT_DOORBELL ) && - (env->spr[SPR_LPCR ] &LPCR_PDEE )) { +if ((pending_interrupts &PPC_INTERRUPT_DOORBELL ) && + (lpcr &LPCR_PDEE )) {return PPC_INTERRUPT_DOORBELL ; }/* Hypervisor Doorbell Exception */ -if ((env->pending_interrupts &PPC_INTERRUPT_HDOORBELL ) && - (env->spr[SPR_LPCR ] &LPCR_HDEE )) { +if ((pending_interrupts &PPC_INTERRUPT_HDOORBELL ) && + (lpcr &LPCR_HDEE )) {return PPC_INTERRUPT_HDOORBELL ; }/* Hypervisor virtualization exception */ -if ((env->pending_interrupts &PPC_INTERRUPT_HVIRT ) && - (env->spr[SPR_LPCR ] &LPCR_HVEE )) { +if ((pending_interrupts &PPC_INTERRUPT_HVIRT ) && + (lpcr &LPCR_HVEE )) {return PPC_INTERRUPT_HVIRT ; } -if (env->pending_interrupts &PPC_INTERRUPT_RESET ) { +if (pending_interrupts &PPC_INTERRUPT_RESET ) {return PPC_INTERRUPT_RESET ; }return 0 ; } -static int p9_next_unmasked_interrupt (CPUPPCState *env) +static int p9_next_unmasked_interrupt (CPUPPCState *env, +uint32_t pending_interrupts, +target_ulong lpcr) {CPUState *cs =env_cpu (env);/* Ignore MSR[EE] when coming out of some power management states */ bool msr_ee =FIELD_EX64 (env->msr,MSR ,EE ) || env->resume_as_sreset; -assert ((env->pending_interrupts &P9_UNUSED_INTERRUPTS ) ==0 ); +assert ((pending_interrupts &P9_UNUSED_INTERRUPTS ) ==0 );if (cs->halted) {if (env->spr[SPR_PSSCR ] &PSSCR_EC ) {
@@ -1933,7 +1938,7 @@ static int p9_next_unmasked_interrupt(CPUPPCState *env)* When PSSCR[EC] is set, LPCR[PECE] controls which interrupts can * wakeup the processor */ -return p9_interrupt_powersave (env); +return p9_interrupt_powersave (env, pending_interrupts, lpcr); }else {/* * When it's clear, any system-caused exception exits power-saving
@@ -1944,14 +1949,14 @@ static int p9_next_unmasked_interrupt(CPUPPCState *env) }/* Machine check exception */ -if (env->pending_interrupts &PPC_INTERRUPT_MCK ) { +if (pending_interrupts &PPC_INTERRUPT_MCK ) {return PPC_INTERRUPT_MCK ; }/* Hypervisor decrementer exception */ -if (env->pending_interrupts &PPC_INTERRUPT_HDECR ) { +if (pending_interrupts &PPC_INTERRUPT_HDECR ) {/* LPCR will be clear when not supported so this will work */ -bool hdice = !!(env->spr[SPR_LPCR ] &LPCR_HDICE ); +bool hdice = !!(lpcr &LPCR_HDICE );if ((msr_ee || !FIELD_EX64_HV (env->msr)) && hdice) {/* HDEC clears on delivery */ return PPC_INTERRUPT_HDECR ;
@@ -1959,18 +1964,18 @@ static int p9_next_unmasked_interrupt(CPUPPCState *env) }/* Hypervisor virtualization interrupt */ -if (env->pending_interrupts &PPC_INTERRUPT_HVIRT ) { +if (pending_interrupts &PPC_INTERRUPT_HVIRT ) {/* LPCR will be clear when not supported so this will work */ -bool hvice = !!(env->spr[SPR_LPCR ] &LPCR_HVICE ); +bool hvice = !!(lpcr &LPCR_HVICE );if ((msr_ee || !FIELD_EX64_HV (env->msr)) && hvice) {return PPC_INTERRUPT_HVIRT ; } }/* External interrupt can ignore MSR:EE under some circumstances */ -if (env->pending_interrupts &PPC_INTERRUPT_EXT ) { -bool lpes0 = !!(env->spr[SPR_LPCR ] &LPCR_LPES0 ); -bool heic = !!(env->spr[SPR_LPCR ] &LPCR_HEIC ); +if (pending_interrupts &PPC_INTERRUPT_EXT ) { +bool lpes0 = !!(lpcr &LPCR_LPES0 ); +bool heic = !!(lpcr &LPCR_HEIC );/* HEIC blocks delivery to the hypervisor */ if ((msr_ee && !(heic && FIELD_EX64_HV(env->msr) && !FIELD_EX64(env->msr, MSR, PR))) ||
@@ -1980,20 +1985,20 @@ static int p9_next_unmasked_interrupt(CPUPPCState *env) }if (msr_ee !=0 ) {/* Decrementer exception */ -if (env->pending_interrupts &PPC_INTERRUPT_DECR ) { +if (pending_interrupts &PPC_INTERRUPT_DECR ) {return PPC_INTERRUPT_DECR ; } -if (env->pending_interrupts &PPC_INTERRUPT_DOORBELL ) { +if (pending_interrupts &PPC_INTERRUPT_DOORBELL ) {return PPC_INTERRUPT_DOORBELL ; } -if (env->pending_interrupts &PPC_INTERRUPT_HDOORBELL ) { +if (pending_interrupts &PPC_INTERRUPT_HDOORBELL ) {return PPC_INTERRUPT_HDOORBELL ; } -if (env->pending_interrupts &PPC_INTERRUPT_PERFM ) { +if (pending_interrupts &PPC_INTERRUPT_PERFM ) {return PPC_INTERRUPT_PERFM ; }/* EBB exception */ -if (env->pending_interrupts &PPC_INTERRUPT_EBB ) { +if (pending_interrupts &PPC_INTERRUPT_EBB ) {/* * EBB exception must be taken in problem state and * with BESCR_GE set.
@@ -2020,7 +2025,8 @@ static int ppc_next_unmasked_interrupt(CPUPPCState *env)case POWERPC_EXCP_POWER9 :case POWERPC_EXCP_POWER10 :case POWERPC_EXCP_POWER11 : -return p9_next_unmasked_interrupt (env); +return p9_next_unmasked_interrupt (env, env->pending_interrupts, + env->spr[SPR_LPCR ]);default :break ; }
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 20/67] ppc/spapr: remove deprecated machine pseries-2.4
In reply to Nicholas PigginFrom: Harsh Prateek Bora <[email protected]>
Commit 1392617d3576 intended to tag pseries-2.1 - 2.11 machines as deprecated with reasons mentioned in its commit log. Removing pseries-2.4 specific code with this patch for now.
While at it, also remove SpaprMachineClass::dr_lmb_enabled which is now turned useless.
--- hw/ppc/spapr.c | 38 ++++---------------------------------- include/hw/ppc/spapr.h | 1 - 2 files changed, 4 insertions(+), 35 deletions(-)
hw/ppc/spapr.c +4 -34
@@ -682,7 +682,6 @@ static int spapr_dt_dynamic_reconfiguration_memory(SpaprMachineState *spapr,static int spapr_dt_memory (SpaprMachineState *spapr,void *fdt) {MachineState *machine =MACHINE (spapr); -SpaprMachineClass *smc =SPAPR_MACHINE_GET_CLASS (spapr);hwaddr mem_start, node_size;int i, nb_nodes = machine->numa_state->num_nodes;NodeInfo *nodes = machine->numa_state->nodes;
@@ -724,7 +723,6 @@ static int spapr_dt_memory(SpaprMachineState *spapr, void *fdt)if (spapr_ovec_test (spapr->ov5_cas,OV5_DRCONF_MEMORY )) {int ret; -g_assert (smc->dr_lmb_enabled); ret =spapr_dt_dynamic_reconfiguration_memory (spapr, fdt);if (ret) {return ret;
@@ -1307,9 +1305,7 @@ void *spapr_build_fdt(SpaprMachineState *spapr, bool reset, size_t space)spapr_dt_cpus (fdt, spapr);/* ibm,drc-indexes and friends */ -if (smc->dr_lmb_enabled) { - root_drc_type_mask |=SPAPR_DR_CONNECTOR_TYPE_LMB ; - } + root_drc_type_mask |=SPAPR_DR_CONNECTOR_TYPE_LMB ;if (smc->dr_phb_enabled) { root_drc_type_mask |=SPAPR_DR_CONNECTOR_TYPE_PHB ; }
@@ -2929,10 +2925,8 @@ static void spapr_machine_init(MachineState *machine) spapr->ov5 =spapr_ovec_new (); spapr->ov5_cas =spapr_ovec_new (); -if (smc->dr_lmb_enabled) { -spapr_ovec_set (spapr->ov5,OV5_DRCONF_MEMORY ); -spapr_validate_node_memory (machine, &error_fatal); - } +spapr_ovec_set (spapr->ov5,OV5_DRCONF_MEMORY ); +spapr_validate_node_memory (machine, &error_fatal);spapr_ovec_set (spapr->ov5,OV5_FORM1_AFFINITY );
@@ -3016,9 +3010,7 @@ static void spapr_machine_init(MachineState *machine)machine_memory_devices_init (machine, device_mem_base, device_mem_size); } -if (smc->dr_lmb_enabled) { -spapr_create_lmb_dr_connectors (spapr); - } +spapr_create_lmb_dr_connectors (spapr);if (mc->nvdimm_supported) {spapr_create_nvdimm_dr_connectors (spapr);
@@ -3662,7 +3654,6 @@ static void spapr_memory_plug(HotplugHandler *hotplug_dev, DeviceState *dev)static void spapr_memory_pre_plug (HotplugHandler *hotplug_dev,DeviceState *dev,Error **errp) { -const SpaprMachineClass *smc =SPAPR_MACHINE_GET_CLASS (hotplug_dev);SpaprMachineState *spapr =SPAPR_MACHINE (hotplug_dev);bool is_nvdimm =object_dynamic_cast (OBJECT (dev),TYPE_NVDIMM );PCDIMMDevice *dimm =PC_DIMM (dev);
@@ -3671,11 +3662,6 @@ static void spapr_memory_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,Object *memdev;hwaddr pagesize; -if (!smc->dr_lmb_enabled) { -error_setg (errp,"Memory hotplug not supported for this machine" ); -return ; - } - size =memory_device_get_region_size (MEMORY_DEVICE (dimm), &local_err);if (local_err) {error_propagate (errp, local_err);
@@ -4713,7 +4699,6 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data) hc->unplug_request = spapr_machine_device_unplug_request; hc->unplug = spapr_machine_device_unplug; - smc->dr_lmb_enabled = true; smc->update_dt_enabled = true; mc->default_cpu_type =POWERPC_CPU_TYPE_NAME ("power10_v2.0" ); mc->has_hotpluggable_cpus = true;
@@ -5334,21 +5319,6 @@ static void spapr_machine_2_5_class_options(MachineClass *mc)DEFINE_SPAPR_MACHINE (2 ,5 ); -/* -* pseries-2.4 -*/ - -static void spapr_machine_2_4_class_options (MachineClass *mc) -{ -SpaprMachineClass *smc =SPAPR_MACHINE_CLASS (mc); - -spapr_machine_2_5_class_options (mc); - smc->dr_lmb_enabled = false; -compat_props_add (mc->compat_props, hw_compat_2_4, hw_compat_2_4_len); -} - -DEFINE_SPAPR_MACHINE (2 ,4 ); -static void spapr_machine_register_types (void ) {type_register_static (&spapr_machine_info);
include/hw/ppc/spapr.h +0 -1
@@ -141,7 +141,6 @@ struct SpaprMachineClass {MachineClass parent_class;/*< public >*/ -bool dr_lmb_enabled;/* enable dynamic-reconfig/hotplug of LMBs */ bool dr_phb_enabled;/* enable dynamic-reconfig/hotplug of PHBs */ bool update_dt_enabled;/* enable KVMPPC_H_UPDATE_DT */ bool use_ohci_by_default;/* use USB-OHCI instead of XHCI */
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 08/67] target/ppc: Fix HFSCR facility checks
In reply to Nicholas PigginThe HFSCR defines were being encoded as bit masks, but the users expect (and analogous FSCR defines are) bit numbers.
--- target/ppc/cpu.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
target/ppc/cpu.h +2 -2
@@ -635,8 +635,8 @@ FIELD(MSR, LE, MSR_LE, 1)#define PSSCR_EC PPC_BIT(43)/* Exit Criterion */ /* HFSCR bits */ -#define HFSCR_MSGP PPC_BIT(53)/* Privileged Message Send Facilities */ -#define HFSCR_BHRB PPC_BIT(59)/* BHRB Instructions */ +#define HFSCR_MSGP PPC_BIT_NR(53)/* Privileged Message Send Facilities */ +#define HFSCR_BHRB PPC_BIT_NR(59)/* BHRB Instructions */ #define HFSCR_IC_MSGP 0xA#define DBCR0_ICMP (1 << 27)
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 51/67] pnv/xive2: Support for "OS LGS Push" TIMA operation
In reply to Nicholas PigginFrom: Glenn Miles <[email protected]>
Adds support for single byte writes to offset 0x15 of the TIMA address space. This offset holds the Logical Server Group Size (LGS) field. The field is used to evenly distribute the interrupt load among the members of a group, but is unused in the current implementation so we just support the writing of the value for now.
--- hw/intc/xive.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
hw/intc/xive.c +15 -0
@@ -341,6 +341,19 @@ static void xive_tm_set_os_cppr(XivePresenter *xptr, XiveTCTX *tctx,xive_tctx_set_cppr (tctx,TM_QW1_OS , value &0xff ); } +static void xive_tctx_set_lgs (XiveTCTX *tctx,uint8_t ring,uint8_t lgs) +{ +uint8_t *regs = &tctx->regs[ring]; + + regs[TM_LGS ] = lgs; +} + +static void xive_tm_set_os_lgs (XivePresenter *xptr,XiveTCTX *tctx, +hwaddr offset,uint64_t value,unsigned size) +{ +xive_tctx_set_lgs (tctx,TM_QW1_OS , value &0xff ); +} +/* * Adjust the IPB to allow a CPU to process event queues of other * priorities during one physical interrupt cycle.
@@ -525,6 +538,8 @@ static const XiveTmOp xive2_tm_operations[] = { NULL }, {XIVE_TM_HV_PAGE ,TM_QW1_OS +TM_WORD2 ,4 , xive2_tm_push_os_ctx, NULL }, + { XIVE_TM_OS_PAGE, TM_QW1_OS + TM_LGS, 1, xive_tm_set_os_lgs, + NULL }, { XIVE_TM_HV_PAGE, TM_QW3_HV_PHYS + TM_CPPR, 1, xive_tm_set_hv_cppr, NULL }, { XIVE_TM_HV_PAGE, TM_QW3_HV_PHYS + TM_WORD2, 1, xive_tm_vt_push,
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 30/67] target/ppc: Reduce code duplication across Power9/10 init code
In reply to Nicholas PigginFrom: Harsh Prateek Bora <[email protected]>
Power9/10 initialization code consists of a lot of logical OR of various flag bits as supported by respective Power platform during its initialization, most of which is duplicated and only selected bits are added or removed as needed with each new platform support being added. Remove the duplicate code and share using common macros.
--- target/ppc/cpu_init.c | 124 +++++------------------------------------- target/ppc/cpu_init.h | 84 ++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+), 109 deletions(-) create mode 100644 target/ppc/cpu_init.h
target/ppc/cpu_init.c +15 -109
@@ -52,6 +52,7 @@#include "kvm_ppc.h" #endif +#include "cpu_init.h" /* #define PPC_DEBUG_SPR */ /* #define USE_APPLE_GDB */
@@ -6510,58 +6511,15 @@ POWERPC_FAMILY(POWER9)(ObjectClass *oc, void *data) dc->fw_name ="PowerPC,POWER9" ; dc->desc ="POWER9" ; pcc->pvr_match = ppc_pvr_match_power9; - pcc->pcr_mask =PCR_COMPAT_2_05 |PCR_COMPAT_2_06 |PCR_COMPAT_2_07 ; - pcc->pcr_supported =PCR_COMPAT_3_00 |PCR_COMPAT_2_07 |PCR_COMPAT_2_06 | -PCR_COMPAT_2_05 ; + pcc->pcr_mask =PPC_PCR_MASK_POWER9 ; + pcc->pcr_supported =PPC_PCR_SUPPORTED_POWER9 ; pcc->init_proc = init_proc_POWER9; pcc->check_pow = check_pow_nocheck; pcc->check_attn = check_attn_hid0_power9; - pcc->insns_flags =PPC_INSNS_BASE |PPC_ISEL |PPC_STRING |PPC_MFTB | -PPC_FLOAT |PPC_FLOAT_FSEL |PPC_FLOAT_FRES | -PPC_FLOAT_FSQRT |PPC_FLOAT_FRSQRTE | -PPC_FLOAT_FRSQRTES | -PPC_FLOAT_STFIWX | -PPC_FLOAT_EXT | -PPC_CACHE |PPC_CACHE_ICBI |PPC_CACHE_DCBZ | -PPC_MEM_SYNC |PPC_MEM_EIEIO | -PPC_MEM_TLBIE |PPC_MEM_TLBSYNC | -PPC_64B |PPC_64H |PPC_64BX |PPC_ALTIVEC | -PPC_SEGMENT_64B |PPC_SLBI | -PPC_POPCNTB |PPC_POPCNTWD | -PPC_CILDST ; - pcc->insns_flags2 =PPC2_VSX |PPC2_VSX207 |PPC2_DFP |PPC2_DBRX | -PPC2_PERM_ISA206 |PPC2_DIVE_ISA206 | -PPC2_ATOMIC_ISA206 |PPC2_FP_CVT_ISA206 | -PPC2_FP_TST_ISA206 |PPC2_BCTAR_ISA207 | -PPC2_LSQ_ISA207 |PPC2_ALTIVEC_207 | -PPC2_ISA205 |PPC2_ISA207S |PPC2_FP_CVT_S64 | -PPC2_TM |PPC2_ISA300 |PPC2_PRCNTL |PPC2_MEM_LWSYNC | -PPC2_BCDA_ISA206 ; - pcc->msr_mask = (1ull <<MSR_SF ) | - (1ull <<MSR_HV ) | - (1ull <<MSR_TM ) | - (1ull <<MSR_VR ) | - (1ull <<MSR_VSX ) | - (1ull <<MSR_EE ) | - (1ull <<MSR_PR ) | - (1ull <<MSR_FP ) | - (1ull <<MSR_ME ) | - (1ull <<MSR_FE0 ) | - (1ull <<MSR_SE ) | - (1ull <<MSR_DE ) | - (1ull <<MSR_FE1 ) | - (1ull <<MSR_IR ) | - (1ull <<MSR_DR ) | - (1ull <<MSR_PMM ) | - (1ull <<MSR_RI ) | - (1ull <<MSR_LE ); - pcc->lpcr_mask =LPCR_VPM1 |LPCR_ISL |LPCR_KBV |LPCR_DPFD | - (LPCR_PECE_U_MASK &LPCR_HVEE ) |LPCR_ILE |LPCR_AIL | -LPCR_UPRT |LPCR_EVIRT |LPCR_ONL |LPCR_HR |LPCR_LD | - (LPCR_PECE_L_MASK & (LPCR_PDEE |LPCR_HDEE |LPCR_EEE | -LPCR_DEE |LPCR_OEE )) - |LPCR_MER |LPCR_GTSE |LPCR_TC | -LPCR_HEIC |LPCR_LPES0 |LPCR_HVICE |LPCR_HDICE ; + pcc->insns_flags =PPC_INSNS_FLAGS_POWER9 ; + pcc->insns_flags2 =PPC_INSNS_FLAGS2_POWER9 ; + pcc->msr_mask =PPC_MSR_MASK_POWER9 ; + pcc->lpcr_mask =PPC_LPCR_MASK_POWER9 ; pcc->lpcr_pm =LPCR_PDEE |LPCR_HDEE |LPCR_EEE |LPCR_DEE |LPCR_OEE ; pcc->mmu_model =POWERPC_MMU_3_00 ;#if !defined(CONFIG_USER_ONLY )
@@ -6574,10 +6532,7 @@ POWERPC_FAMILY(POWER9)(ObjectClass *oc, void *data) pcc->excp_model =POWERPC_EXCP_POWER9 ; pcc->bus_model =PPC_FLAGS_INPUT_POWER9 ; pcc->bfd_mach = bfd_mach_ppc64; - pcc->flags =POWERPC_FLAG_VRE |POWERPC_FLAG_SE | -POWERPC_FLAG_BE |POWERPC_FLAG_PMM | -POWERPC_FLAG_BUS_CLK |POWERPC_FLAG_CFAR | -POWERPC_FLAG_VSX |POWERPC_FLAG_TM |POWERPC_FLAG_SCV ; + pcc->flags =POWERPC_FLAGS_POWER9 ; pcc->l1_dcache_size =0x8000 ; pcc->l1_icache_size =0x8000 ; }
@@ -6690,60 +6645,15 @@ POWERPC_FAMILY(POWER10)(ObjectClass *oc, void *data) dc->fw_name ="PowerPC,POWER10" ; dc->desc ="POWER10" ; pcc->pvr_match = ppc_pvr_match_power10; - pcc->pcr_mask =PCR_COMPAT_2_05 |PCR_COMPAT_2_06 |PCR_COMPAT_2_07 | -PCR_COMPAT_3_00 ; - pcc->pcr_supported =PCR_COMPAT_3_10 |PCR_COMPAT_3_00 |PCR_COMPAT_2_07 | -PCR_COMPAT_2_06 |PCR_COMPAT_2_05 ; + pcc->pcr_mask =PPC_PCR_MASK_POWER10 ; + pcc->pcr_supported =PPC_PCR_SUPPORTED_POWER10 ; pcc->init_proc = init_proc_POWER10; pcc->check_pow = check_pow_nocheck; pcc->check_attn = check_attn_hid0_power9; - pcc->insns_flags =PPC_INSNS_BASE |PPC_ISEL |PPC_STRING |PPC_MFTB | -PPC_FLOAT |PPC_FLOAT_FSEL |PPC_FLOAT_FRES | -PPC_FLOAT_FSQRT |PPC_FLOAT_FRSQRTE | -PPC_FLOAT_FRSQRTES | -PPC_FLOAT_STFIWX | -PPC_FLOAT_EXT | -PPC_CACHE |PPC_CACHE_ICBI |PPC_CACHE_DCBZ | -PPC_MEM_SYNC |PPC_MEM_EIEIO | -PPC_MEM_TLBIE |PPC_MEM_TLBSYNC | -PPC_64B |PPC_64H |PPC_64BX |PPC_ALTIVEC | -PPC_SEGMENT_64B |PPC_SLBI | -PPC_POPCNTB |PPC_POPCNTWD | -PPC_CILDST ; - pcc->insns_flags2 =PPC2_VSX |PPC2_VSX207 |PPC2_DFP |PPC2_DBRX | -PPC2_PERM_ISA206 |PPC2_DIVE_ISA206 | -PPC2_ATOMIC_ISA206 |PPC2_FP_CVT_ISA206 | -PPC2_FP_TST_ISA206 |PPC2_BCTAR_ISA207 | -PPC2_LSQ_ISA207 |PPC2_ALTIVEC_207 | -PPC2_ISA205 |PPC2_ISA207S |PPC2_FP_CVT_S64 | -PPC2_ISA300 |PPC2_PRCNTL |PPC2_ISA310 | -PPC2_MEM_LWSYNC |PPC2_BCDA_ISA206 ; - pcc->msr_mask = (1ull <<MSR_SF ) | - (1ull <<MSR_HV ) | - (1ull <<MSR_VR ) | - (1ull <<MSR_VSX ) | - (1ull <<MSR_EE ) | - (1ull <<MSR_PR ) | - (1ull <<MSR_FP ) | - (1ull <<MSR_ME ) | - (1ull <<MSR_FE0 ) | - (1ull <<MSR_SE ) | - (1ull <<MSR_DE ) | - (1ull <<MSR_FE1 ) | - (1ull <<MSR_IR ) | - (1ull <<MSR_DR ) | - (1ull <<MSR_PMM ) | - (1ull <<MSR_RI ) | - (1ull <<MSR_LE ); - pcc->lpcr_mask =LPCR_VPM1 |LPCR_ISL |LPCR_KBV |LPCR_DPFD | - (LPCR_PECE_U_MASK &LPCR_HVEE ) |LPCR_ILE |LPCR_AIL | -LPCR_UPRT |LPCR_EVIRT |LPCR_ONL |LPCR_HR |LPCR_LD | - (LPCR_PECE_L_MASK & (LPCR_PDEE |LPCR_HDEE |LPCR_EEE | -LPCR_DEE |LPCR_OEE )) - |LPCR_MER |LPCR_GTSE |LPCR_TC | -LPCR_HEIC |LPCR_LPES0 |LPCR_HVICE |LPCR_HDICE ; -/* DD2 adds an extra HAIL bit */ - pcc->lpcr_mask |=LPCR_HAIL ; + pcc->insns_flags =PPC_INSNS_FLAGS_POWER10 ; + pcc->insns_flags2 =PPC_INSNS_FLAGS2_POWER10 ; + pcc->msr_mask =PPC_MSR_MASK_POWER10 ; + pcc->lpcr_mask =PPC_LPCR_MASK_POWER10 ; pcc->lpcr_pm =LPCR_PDEE |LPCR_HDEE |LPCR_EEE |LPCR_DEE |LPCR_OEE ; pcc->mmu_model =POWERPC_MMU_3_00 ;
@@ -6756,11 +6666,7 @@ POWERPC_FAMILY(POWER10)(ObjectClass *oc, void *data) pcc->excp_model =POWERPC_EXCP_POWER10 ; pcc->bus_model =PPC_FLAGS_INPUT_POWER9 ; pcc->bfd_mach = bfd_mach_ppc64; - pcc->flags =POWERPC_FLAG_VRE |POWERPC_FLAG_SE | -POWERPC_FLAG_BE |POWERPC_FLAG_PMM | -POWERPC_FLAG_BUS_CLK |POWERPC_FLAG_CFAR | -POWERPC_FLAG_VSX |POWERPC_FLAG_SCV | -POWERPC_FLAG_BHRB ; + pcc->flags =POWERPC_FLAGS_POWER10 ; pcc->l1_dcache_size =0x8000 ; pcc->l1_icache_size =0x8000 ; }
target/ppc/cpu_init.h new file +84 -0
84 lines not on this page · raw message
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 55/67] ppc/xive2: Support "Pull Thread Context to Register" operation
In reply to Nicholas PigginFrom: Glenn Miles <[email protected]>
Adds support for single byte read of offset 0x838 of the TIMA address space. According to the XIVE2 Specification, this causes the hardware to atomically:
1. Read the number of bytes requested (lbz or lhz are supported).
2. Reset the valid bit of the thread context.
3. Return the number of bytes requested in step 1 to a register.
--- hw/intc/xive.c | 15 +++++++++++++++ include/hw/ppc/xive_regs.h | 2 ++ 2 files changed, 17 insertions(+)
hw/intc/xive.c +15 -0
@@ -179,6 +179,17 @@ static uint64_t xive_tm_pull_pool_ctx(XivePresenter *xptr, XiveTCTX *tctx,return qw2w2; } +static uint64_t xive_tm_pull_phys_ctx (XivePresenter *xptr,XiveTCTX *tctx, +hwaddr offset,unsigned size) +{ +uint8_t qw3b8_prev = tctx->regs[TM_QW3_HV_PHYS +TM_WORD2 ]; +uint8_t qw3b8; + + qw3b8 = qw3b8_prev & ~TM_QW3B8_VT ; + tctx->regs[TM_QW3_HV_PHYS +TM_WORD2 ] = qw3b8; +return qw3b8; +} +static void xive_tm_vt_push (XivePresenter *xptr,XiveTCTX *tctx,hwaddr offset,uint64_t value,unsigned size) {
@@ -527,6 +538,8 @@ static const XiveTmOp xive_tm_operations[] = { xive_tm_pull_pool_ctx }, {XIVE_TM_HV_PAGE ,TM_SPC_PULL_POOL_CTX ,8 ,NULL , xive_tm_pull_pool_ctx }, + { XIVE_TM_HV_PAGE, TM_SPC_PULL_PHYS_CTX, 1, NULL, + xive_tm_pull_phys_ctx }, }; static const XiveTmOp xive2_tm_operations[] = {
@@ -566,6 +579,8 @@ static const XiveTmOp xive2_tm_operations[] = { xive_tm_pull_pool_ctx }, {XIVE_TM_HV_PAGE ,TM_SPC_PULL_OS_CTX_OL ,1 , xive2_tm_pull_os_ctx_ol, NULL }, + { XIVE_TM_HV_PAGE, TM_SPC_PULL_PHYS_CTX, 1, NULL, + xive_tm_pull_phys_ctx }, }; static const XiveTmOp *xive_tm_find_op(XivePresenter *xptr, hwaddr offset,
include/hw/ppc/xive_regs.h +2 -0
@@ -101,6 +101,7 @@#define TM_QW3W2_LP PPC_BIT32(6)#define TM_QW3W2_LE PPC_BIT32(7)#define TM_QW3W2_T PPC_BIT32(31) +#define TM_QW3B8_VT PPC_BIT8(0)/* * In addition to normal loads to "peek" and writes (only when invalid)
@@ -128,6 +129,7 @@#define TM_SPC_PULL_POOL_CTX 0x828/* Load32/Load64 Pull/Invalidate Pool */ /* context to reg */ #define TM_SPC_ACK_HV_REG 0x830/* Load16 ack HV irq to reg */ +#define TM_SPC_PULL_PHYS_CTX 0x838/* Pull phys ctx to reg */ #define TM_SPC_PULL_USR_CTX_OL 0xc08/* Store8 Pull/Inval usr ctx to odd */ /* line */ #define TM_SPC_ACK_OS_EL 0xc10/* Store8 ack OS irq to even line */
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 48/67] pnv/xive: TIMA patch sets pre-req alignment and formatting changes
In reply to Nicholas PigginFrom: Michael Kowal <[email protected]>
Making some pre-requisite alignment changes ahead of the following patch sets. Making these changes now will ease the review of the patch sets.
Checkpatch wants the closing comment '*/' on a separate line, unless it is on the same line as the starting comment '/*'.
There are also changes to prevent lines from spanning 80 columns.
Changed block of defines from:
#define A 1 /* original define comment is not
* preferred, but not flagged... */
#define B 2 /* Newly added define comment
* is flagged with a warning */
To:
#define A 1 /* original define comment is */
/* now fine, no warning... */
#define B 2 /* Newly added define comment */
/* is fine... */--- hw/intc/xive.c | 72 +++++++++++++++++++++++++------------- include/hw/ppc/xive_regs.h | 32 ++++++++--------- 2 files changed, 64 insertions(+), 40 deletions(-)
hw/intc/xive.c +48 -24
@@ -488,20 +488,32 @@ static const XiveTmOp xive_tm_operations[] = {* MMIOs below 2K : raw values and special operations without side * effects */ - { XIVE_TM_OS_PAGE, TM_QW1_OS + TM_CPPR, 1, xive_tm_set_os_cppr, NULL }, - { XIVE_TM_HV_PAGE, TM_QW1_OS + TM_WORD2, 4, xive_tm_push_os_ctx, NULL }, - { XIVE_TM_HV_PAGE, TM_QW3_HV_PHYS + TM_CPPR, 1, xive_tm_set_hv_cppr, NULL }, - { XIVE_TM_HV_PAGE, TM_QW3_HV_PHYS + TM_WORD2, 1, xive_tm_vt_push, NULL }, - { XIVE_TM_HV_PAGE, TM_QW3_HV_PHYS + TM_WORD2, 1, NULL, xive_tm_vt_poll }, + {XIVE_TM_OS_PAGE ,TM_QW1_OS +TM_CPPR ,1 , xive_tm_set_os_cppr, + NULL }, + { XIVE_TM_HV_PAGE, TM_QW1_OS + TM_WORD2, 4, xive_tm_push_os_ctx, + NULL }, + { XIVE_TM_HV_PAGE, TM_QW3_HV_PHYS + TM_CPPR, 1, xive_tm_set_hv_cppr, + NULL }, + { XIVE_TM_HV_PAGE, TM_QW3_HV_PHYS + TM_WORD2, 1, xive_tm_vt_push, + NULL }, + { XIVE_TM_HV_PAGE, TM_QW3_HV_PHYS + TM_WORD2, 1, NULL, + xive_tm_vt_poll },/* 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 }, + { 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 }, }; static const XiveTmOp xive2_tm_operations[] = {
@@ -509,20 +521,32 @@ static const XiveTmOp xive2_tm_operations[] = {* MMIOs below 2K : raw values and special operations without side * effects */ - { XIVE_TM_OS_PAGE, TM_QW1_OS + TM_CPPR, 1, xive_tm_set_os_cppr, NULL }, - { XIVE_TM_HV_PAGE, TM_QW1_OS + TM_WORD2, 4, xive2_tm_push_os_ctx, NULL }, - { XIVE_TM_HV_PAGE, TM_QW3_HV_PHYS + TM_CPPR, 1, xive_tm_set_hv_cppr, NULL }, - { XIVE_TM_HV_PAGE, TM_QW3_HV_PHYS + TM_WORD2, 1, xive_tm_vt_push, NULL }, - { XIVE_TM_HV_PAGE, TM_QW3_HV_PHYS + TM_WORD2, 1, NULL, xive_tm_vt_poll }, + {XIVE_TM_OS_PAGE ,TM_QW1_OS +TM_CPPR ,1 , xive_tm_set_os_cppr, + NULL }, + { XIVE_TM_HV_PAGE, TM_QW1_OS + TM_WORD2, 4, xive2_tm_push_os_ctx, + NULL }, + { XIVE_TM_HV_PAGE, TM_QW3_HV_PHYS + TM_CPPR, 1, xive_tm_set_hv_cppr, + NULL }, + { XIVE_TM_HV_PAGE, TM_QW3_HV_PHYS + TM_WORD2, 1, xive_tm_vt_push, + NULL }, + { XIVE_TM_HV_PAGE, TM_QW3_HV_PHYS + TM_WORD2, 1, NULL, + xive_tm_vt_poll },/* 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, xive2_tm_pull_os_ctx }, - { XIVE_TM_HV_PAGE, TM_SPC_PULL_OS_CTX, 8, NULL, xive2_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 }, + { 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, + xive2_tm_pull_os_ctx }, + { XIVE_TM_HV_PAGE, TM_SPC_PULL_OS_CTX, 8, NULL, + xive2_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 }, }; static const XiveTmOp *xive_tm_find_op(XivePresenter *xptr, hwaddr offset,
include/hw/ppc/xive_regs.h +16 -16
@@ -114,23 +114,23 @@* Then we have all these "special" CI ops at these offset that trigger * all sorts of side effects: */ -#define TM_SPC_ACK_EBB 0x800/* Load8 ack EBB to reg*/ -#define TM_SPC_ACK_OS_REG 0x810/* Load16 ack OS irq to reg */ +#define TM_SPC_ACK_EBB 0x800/* Load8 ack EBB to reg */ +#define TM_SPC_ACK_OS_REG 0x810/* Load16 ack OS irq to reg */ #define TM_SPC_PUSH_USR_CTX 0x808/* Store32 Push/Validate user context */ -#define TM_SPC_PULL_USR_CTX 0x808/* Load32 Pull/Invalidate user -* context */ -#define TM_SPC_SET_OS_PENDING 0x812/* Store8 Set OS irq pending bit */ -#define TM_SPC_PULL_OS_CTX 0x818/* Load32/Load64 Pull/Invalidate OS -* context to reg */ -#define TM_SPC_PULL_POOL_CTX 0x828/* Load32/Load64 Pull/Invalidate Pool -* context to reg*/ -#define TM_SPC_ACK_HV_REG 0x830/* Load16 ack HV irq to reg */ -#define TM_SPC_PULL_USR_CTX_OL 0xc08/* Store8 Pull/Inval usr ctx to odd -* line */ -#define TM_SPC_ACK_OS_EL 0xc10/* Store8 ack OS irq to even line */ -#define TM_SPC_ACK_HV_POOL_EL 0xc20/* Store8 ack HV evt pool to even -* line */ -#define TM_SPC_ACK_HV_EL 0xc30/* Store8 ack HV irq to even line */ +#define TM_SPC_PULL_USR_CTX 0x808/* Load32 Pull/Invalidate user */ +/* context */ +#define TM_SPC_SET_OS_PENDING 0x812/* Store8 Set OS irq pending bit */ +#define TM_SPC_PULL_OS_CTX 0x818/* Load32/Load64 Pull/Invalidate OS */ +/* context to reg */ +#define TM_SPC_PULL_POOL_CTX 0x828/* Load32/Load64 Pull/Invalidate Pool */ +/* context to reg */ +#define TM_SPC_ACK_HV_REG 0x830/* Load16 ack HV irq to reg */ +#define TM_SPC_PULL_USR_CTX_OL 0xc08/* Store8 Pull/Inval usr ctx to odd */ +/* line */ +#define TM_SPC_ACK_OS_EL 0xc10/* Store8 ack OS irq to even line */ +#define TM_SPC_ACK_HV_POOL_EL 0xc20/* Store8 ack HV evt pool to even */ +/* line */ +#define TM_SPC_ACK_HV_EL 0xc30/* Store8 ack HV irq to even line */ /* XXX more... */ /* NSR fields for the various QW ack types */
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 61/67] pnv/xive2: TIMA CI ops using alternative offsets or byte lengths
In reply to Nicholas PigginFrom: Michael Kowal <[email protected]>
Some of the TIMA Special CI operations perform the same operation at alternative byte offsets and lengths. The following xive2_tm_opertions[] table entries are missing when they exist for other offsets/sizes and have been added:
- lwz@0x810 Pull/Invalidate O/S Context to register added lwz@0x818 exists ld @0x818 exists - lwz@0x820 Pull Pool Context to register added lwz@0x828 exists ld @0x828 exists - lwz@0x830 Pull Thread Context to register added lbz@0x838 exists
--- hw/intc/xive.c | 6 ++++++ include/hw/ppc/xive_regs.h | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-)
hw/intc/xive.c +6 -0
@@ -614,18 +614,24 @@ static const XiveTmOp xive2_tm_operations[] = { 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_G2, 4, NULL, + xive2_tm_pull_os_ctx }, { XIVE_TM_HV_PAGE, TM_SPC_PULL_OS_CTX, 4, NULL, xive2_tm_pull_os_ctx }, { XIVE_TM_HV_PAGE, TM_SPC_PULL_OS_CTX, 8, NULL, xive2_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_G2, 4, NULL, + xive_tm_pull_pool_ctx }, { 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 }, { XIVE_TM_HV_PAGE, TM_SPC_PULL_OS_CTX_OL, 1, xive2_tm_pull_os_ctx_ol, NULL }, + { XIVE_TM_HV_PAGE, TM_SPC_PULL_PHYS_CTX_G2, 4, NULL, + xive_tm_pull_phys_ctx }, { XIVE_TM_HV_PAGE, TM_SPC_PULL_PHYS_CTX, 1, NULL, xive_tm_pull_phys_ctx }, { XIVE_TM_HV_PAGE, TM_SPC_PULL_PHYS_CTX_OL, 1, xive2_tm_pull_phys_ctx_ol,
include/hw/ppc/xive_regs.h +6 -1
@@ -124,12 +124,17 @@#define TM_SPC_PULL_USR_CTX 0x808/* Load32 Pull/Invalidate user */ /* context */ #define TM_SPC_SET_OS_PENDING 0x812/* Store8 Set OS irq pending bit */ +#define TM_SPC_PULL_OS_CTX_G2 0x810/* Load32/Load64 Pull/Invalidate OS */ +/* context to reg */ #define TM_SPC_PULL_OS_CTX 0x818/* Load32/Load64 Pull/Invalidate OS */ /* context to reg */ +#define TM_SPC_PULL_POOL_CTX_G2 0x820/* Load32/Load64 Pull/Invalidate Pool */ +/* context to reg */ #define TM_SPC_PULL_POOL_CTX 0x828/* Load32/Load64 Pull/Invalidate Pool */ /* context to reg */ #define TM_SPC_ACK_HV_REG 0x830/* Load16 ack HV irq to reg */ -#define TM_SPC_PULL_PHYS_CTX 0x838/* Pull phys ctx to reg */ +#define TM_SPC_PULL_PHYS_CTX_G2 0x830/* Load32 Pull phys ctx to reg */ +#define TM_SPC_PULL_PHYS_CTX 0x838/* Load8 Pull phys ctx to reg */ #define TM_SPC_PULL_USR_CTX_OL 0xc08/* Store8 Pull/Inval usr ctx to odd */ /* line */ #define TM_SPC_ACK_OS_EL 0xc10/* Store8 ack OS irq to even line */
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 27/67] ppc/spapr: remove deprecated machine pseries-2.11
In reply to Nicholas PigginFrom: Harsh Prateek Bora <[email protected]>
Commit 1392617d3576 intended to tag pseries-2.1 - 2.11 machines as deprecated with reasons mentioned in its commit log. Removing pseries-2.11 specific code with this patch.
--- hw/ppc/spapr.c | 15 --------------- 1 file changed, 15 deletions(-)
hw/ppc/spapr.c +0 -15
@@ -5054,21 +5054,6 @@ static void spapr_machine_2_12_sxxm_class_options(MachineClass *mc)DEFINE_SPAPR_MACHINE_TAGGED (2 ,12 , sxxm); -/* -* pseries-2.11 -*/ - -static void spapr_machine_2_11_class_options (MachineClass *mc) -{ -SpaprMachineClass *smc =SPAPR_MACHINE_CLASS (mc); - -spapr_machine_2_12_class_options (mc); - smc->default_caps.caps[SPAPR_CAP_HTM ] =SPAPR_CAP_ON ; -compat_props_add (mc->compat_props, hw_compat_2_11, hw_compat_2_11_len); -} - -DEFINE_SPAPR_MACHINE (2 ,11 ); -static void spapr_machine_register_types (void ) {type_register_static (&spapr_machine_info);
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 40/67] target/ppc: optimize p7 exception handling routines
In reply to Nicholas PigginFrom: Harsh Prateek Bora <[email protected]>
Like p8 and p9, simplifying p7 exception handling rotuines to avoid un-necessary multiple indirect accesses to env->pending_interrupts and env->spr[SPR_LPCR].
--- target/ppc/excp_helper.c | 46 ++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 21 deletions(-)
target/ppc/excp_helper.c +25 -21
@@ -1683,51 +1683,54 @@ void ppc_cpu_do_interrupt(CPUState *cs) PPC_INTERRUPT_PIT | PPC_INTERRUPT_DOORBELL | PPC_INTERRUPT_HDOORBELL | \ PPC_INTERRUPT_THERM | PPC_INTERRUPT_EBB) -static int p7_interrupt_powersave (CPUPPCState *env) +static int p7_interrupt_powersave (uint32_t pending_interrupts, +target_ulong lpcr) { -if ((env->pending_interrupts &PPC_INTERRUPT_EXT ) && - (env->spr[SPR_LPCR ] &LPCR_P7_PECE0 )) { +if ((pending_interrupts &PPC_INTERRUPT_EXT ) && + (lpcr &LPCR_P7_PECE0 )) {return PPC_INTERRUPT_EXT ; } -if ((env->pending_interrupts &PPC_INTERRUPT_DECR ) && - (env->spr[SPR_LPCR ] &LPCR_P7_PECE1 )) { +if ((pending_interrupts &PPC_INTERRUPT_DECR ) && + (lpcr &LPCR_P7_PECE1 )) {return PPC_INTERRUPT_DECR ; } -if ((env->pending_interrupts &PPC_INTERRUPT_MCK ) && - (env->spr[SPR_LPCR ] &LPCR_P7_PECE2 )) { +if ((pending_interrupts &PPC_INTERRUPT_MCK ) && + (lpcr &LPCR_P7_PECE2 )) {return PPC_INTERRUPT_MCK ; } -if ((env->pending_interrupts &PPC_INTERRUPT_HMI ) && - (env->spr[SPR_LPCR ] &LPCR_P7_PECE2 )) { +if ((pending_interrupts &PPC_INTERRUPT_HMI ) && + (lpcr &LPCR_P7_PECE2 )) {return PPC_INTERRUPT_HMI ; } -if (env->pending_interrupts &PPC_INTERRUPT_RESET ) { +if (pending_interrupts &PPC_INTERRUPT_RESET ) {return PPC_INTERRUPT_RESET ; }return 0 ; } -static int p7_next_unmasked_interrupt (CPUPPCState *env) +static int p7_next_unmasked_interrupt (CPUPPCState *env, +uint32_t pending_interrupts, +target_ulong lpcr) {CPUState *cs =env_cpu (env);/* Ignore MSR[EE] when coming out of some power management states */ bool msr_ee =FIELD_EX64 (env->msr,MSR ,EE ) || env->resume_as_sreset; -assert ((env->pending_interrupts &P7_UNUSED_INTERRUPTS ) ==0 ); +assert ((pending_interrupts &P7_UNUSED_INTERRUPTS ) ==0 );if (cs->halted) {/* LPCR[PECE] controls which interrupts can exit power-saving mode */ -return p7_interrupt_powersave (env); +return p7_interrupt_powersave (pending_interrupts, lpcr); }/* Machine check exception */ -if (env->pending_interrupts &PPC_INTERRUPT_MCK ) { +if (pending_interrupts &PPC_INTERRUPT_MCK ) {return PPC_INTERRUPT_MCK ; }/* Hypervisor decrementer exception */ -if (env->pending_interrupts &PPC_INTERRUPT_HDECR ) { +if (pending_interrupts &PPC_INTERRUPT_HDECR ) {/* LPCR will be clear when not supported so this will work */ bool hdice = !!(env->spr[SPR_LPCR ] &LPCR_HDICE );if ((msr_ee || !FIELD_EX64_HV (env->msr)) && hdice) {
@@ -1737,9 +1740,9 @@ static int p7_next_unmasked_interrupt(CPUPPCState *env) }/* External interrupt can ignore MSR:EE under some circumstances */ -if (env->pending_interrupts &PPC_INTERRUPT_EXT ) { -bool lpes0 = !!(env->spr[SPR_LPCR ] &LPCR_LPES0 ); -bool heic = !!(env->spr[SPR_LPCR ] &LPCR_HEIC ); +if (pending_interrupts &PPC_INTERRUPT_EXT ) { +bool lpes0 = !!(lpcr &LPCR_LPES0 ); +bool heic = !!(lpcr &LPCR_HEIC );/* HEIC blocks delivery to the hypervisor */ if ((msr_ee && !(heic && FIELD_EX64_HV(env->msr) && !FIELD_EX64(env->msr, MSR, PR))) ||
@@ -1749,10 +1752,10 @@ static int p7_next_unmasked_interrupt(CPUPPCState *env) }if (msr_ee !=0 ) {/* Decrementer exception */ -if (env->pending_interrupts &PPC_INTERRUPT_DECR ) { +if (pending_interrupts &PPC_INTERRUPT_DECR ) {return PPC_INTERRUPT_DECR ; } -if (env->pending_interrupts &PPC_INTERRUPT_PERFM ) { +if (pending_interrupts &PPC_INTERRUPT_PERFM ) {return PPC_INTERRUPT_PERFM ; } }
@@ -2022,7 +2025,8 @@ static int ppc_next_unmasked_interrupt(CPUPPCState *env)#ifdef TARGET_PPC64 switch (env->excp_model) {case POWERPC_EXCP_POWER7 : -return p7_next_unmasked_interrupt (env); +return p7_next_unmasked_interrupt (env, env->pending_interrupts, + env->spr[SPR_LPCR ]);case POWERPC_EXCP_POWER8 :return p8_next_unmasked_interrupt (env, env->pending_interrupts, env->spr[SPR_LPCR ]);
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 45/67] spapr: nested: Add Power11 capability support for Nested PAPR guests in TCG L0
In reply to Nicholas PigginFrom: Amit Machhiwal <[email protected]>
The Power11 architected and raw mode support in Linux was merged via [1] and the corresponding support in QEMU is waiting to be added by [2] which in V6 currently.
Add the Power11 capabilities and the required handling in TCG L0 implementation of the "Nested PAPR API".
Note: This patch is based on [2].
[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/
--- hw/ppc/spapr_nested.c | 12 +++++++++++- include/hw/ppc/spapr_nested.h | 5 ++++- 2 files changed, 15 insertions(+), 2 deletions(-)
hw/ppc/spapr_nested.c +11 -1
@@ -771,6 +771,7 @@ static void copy_logical_pvr(void *a, void *b, bool set)if (*pvr_logical_ptr) {switch (*pvr_logical_ptr) { +case CPU_POWERPC_LOGICAL_3_10_P11 :case CPU_POWERPC_LOGICAL_3_10 : pcr =PCR_COMPAT_3_10 |PCR_COMPAT_3_00 ;break ;
@@ -1185,6 +1186,12 @@ static target_ulong h_guest_get_capabilities(PowerPCCPU *cpu,return H_PARAMETER ; } +/* P11 capabilities */ +if (ppc_check_compat (cpu,CPU_POWERPC_LOGICAL_3_10_P11 ,0 , + spapr->max_compat_pvr)) { + env->gpr[4 ] |=H_GUEST_CAPABILITIES_P11_MODE ; + } +/* P10 capabilities */ if (ppc_check_compat (cpu,CPU_POWERPC_LOGICAL_3_10 ,0 , spapr->max_compat_pvr)) {
@@ -1227,7 +1234,10 @@ static target_ulong h_guest_set_capabilities(PowerPCCPU *cpu, env->gpr[4 ] =1 ;/* set R5 to the first supported Power Processor Mode */ -if (ppc_check_compat (cpu,CPU_POWERPC_LOGICAL_3_10 ,0 , +if (ppc_check_compat (cpu,CPU_POWERPC_LOGICAL_3_10_P11 ,0 , + spapr->max_compat_pvr)) { + env->gpr[5 ] =H_GUEST_CAP_P11_MODE_BMAP ; + }else if (ppc_check_compat (cpu,CPU_POWERPC_LOGICAL_3_10 ,0 , spapr->max_compat_pvr)) { env->gpr[5 ] =H_GUEST_CAP_P10_MODE_BMAP ; } else if (ppc_check_compat(cpu, CPU_POWERPC_LOGICAL_3_00, 0,
include/hw/ppc/spapr_nested.h +4 -1
@@ -211,11 +211,14 @@ typedef struct SpaprMachineStateNestedGuest {#define H_GUEST_CAPABILITIES_COPY_MEM 0x8000000000000000#define H_GUEST_CAPABILITIES_P9_MODE 0x4000000000000000#define H_GUEST_CAPABILITIES_P10_MODE 0x2000000000000000 -#define H_GUEST_CAP_VALID_MASK (H_GUEST_CAPABILITIES_P10_MODE | \ +#define H_GUEST_CAPABILITIES_P11_MODE 0x1000000000000000 +#define H_GUEST_CAP_VALID_MASK (H_GUEST_CAPABILITIES_P11_MODE | \ + H_GUEST_CAPABILITIES_P10_MODE | \ H_GUEST_CAPABILITIES_P9_MODE)#define H_GUEST_CAP_COPY_MEM_BMAP 0#define H_GUEST_CAP_P9_MODE_BMAP 1#define H_GUEST_CAP_P10_MODE_BMAP 2 +#define H_GUEST_CAP_P11_MODE_BMAP 3#define PAPR_NESTED_GUEST_MAX 4096#define H_GUEST_DELETE_ALL_FLAG 0x8000000000000000ULL#define PAPR_NESTED_GUEST_VCPU_MAX 2048
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 52/67] ppc/xive2: Dump more NVP state with 'info pic'
In reply to Nicholas PigginFrom: Frederic Barrat <[email protected]>
The 'PGoFirst' field of a Notify Virtual Processor tells if the NVP belongs to a VP group.
Also, print the Reporting Cache Line address, if defined.
--- hw/intc/xive2.c | 10 ++++++++-- include/hw/ppc/xive2_regs.h | 1 + 2 files changed, 9 insertions(+), 2 deletions(-)
hw/intc/xive2.c +8 -2
@@ -161,14 +161,20 @@ void xive2_nvp_pic_print_info(Xive2Nvp *nvp, uint32_t nvp_idx, GString *buf) {uint8_t eq_blk =xive_get_field32 (NVP2_W5_VP_END_BLOCK , nvp->w5);uint32_t eq_idx =xive_get_field32 (NVP2_W5_VP_END_INDEX , nvp->w5); +uint64_t cache_line =xive2_nvp_reporting_addr (nvp);if (!xive2_nvp_is_valid (nvp)) {return ; } -g_string_append_printf (buf," %08x end:%02x/%04x IPB:%02x" , +g_string_append_printf (buf," %08x end:%02x/%04x IPB:%02x PGoFirst:%02x" , nvp_idx, eq_blk, eq_idx, -xive_get_field32 (NVP2_W2_IPB , nvp->w2)); +xive_get_field32 (NVP2_W2_IPB , nvp->w2), +xive_get_field32 (NVP2_W0_PGOFIRST , nvp->w0)); +if (cache_line) { +g_string_append_printf (buf," reporting CL:%016" PRIx64, cache_line); + } +/* * When the NVP is HW controlled, more fields are updated */
include/hw/ppc/xive2_regs.h +1 -0
@@ -151,6 +151,7 @@ typedef struct Xive2Nvp {#define NVP2_W0_VALID PPC_BIT32(0)#define NVP2_W0_HW PPC_BIT32(7)#define NVP2_W0_ESC_END PPC_BIT32(25)/* 'N' bit 0:ESB 1:END */ +#define NVP2_W0_PGOFIRST PPC_BITMASK32(26, 31)uint32_t w1;#define NVP2_W1_CO PPC_BIT32(13)#define NVP2_W1_CO_PRIV PPC_BITMASK32(14, 15)
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 59/67] pnv/xive: Update PIPR when updating CPPR
In reply to Nicholas PigginFrom: Glenn Miles <[email protected]>
Current code was updating the PIPR inside the xive_tctx_accept() function instead of the xive_tctx_set_cppr function, which is where the HW would have it updated.
Moved the update to the xive_tctx_set_cppr function which required additional support for pool interrupts.
--- hw/intc/xive.c | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-)
hw/intc/xive.c +32 -2
@@ -89,7 +89,6 @@ static uint64_t xive_tctx_accept(XiveTCTX *tctx, uint8_t ring)/* Reset the pending buffer bit */ alt_regs[TM_IPB ] &= ~xive_priority_to_ipb (cppr); - regs[TM_PIPR ] =ipb_to_pipr (alt_regs[TM_IPB ]);/* Drop Exception bit */ regs[TM_NSR ] &= ~mask;
@@ -143,6 +142,8 @@ void xive_tctx_reset_signal(XiveTCTX *tctx, uint8_t ring)static void xive_tctx_set_cppr (XiveTCTX *tctx,uint8_t ring,uint8_t cppr) {uint8_t *regs = &tctx->regs[ring]; +uint8_t pipr_min; +uint8_t ring_min; trace_xive_tctx_set_cppr(tctx->cs->cpu_index, ring, regs[TM_IPB], regs[TM_PIPR],
@@ -154,8 +155,37 @@ static void xive_tctx_set_cppr(XiveTCTX *tctx, uint8_t ring, uint8_t cppr) tctx->regs[ring +TM_CPPR ] = cppr; +/* +* Recompute the PIPR based on local pending interrupts. The PHYS +* ring must take the minimum of both the PHYS and POOL PIPR values. +*/ + pipr_min =ipb_to_pipr (regs[TM_IPB ]); + ring_min = ring; + +/* PHYS updates also depend on POOL values */ +if (ring ==TM_QW3_HV_PHYS ) { +uint8_t *pool_regs = &tctx->regs[TM_QW2_HV_POOL ]; + +/* POOL values only matter if POOL ctx is valid */ +if (pool_regs[TM_WORD2 ] &0x80 ) { + +uint8_t pool_pipr =ipb_to_pipr (pool_regs[TM_IPB ]); + +/* +* Determine highest priority interrupt and +* remember which ring has it. +*/ +if (pool_pipr < pipr_min) { + pipr_min = pool_pipr; + ring_min =TM_QW2_HV_POOL ; + } + } + } + + regs[TM_PIPR ] = pipr_min; +/* CPPR has changed, check if we need to raise a pending exception */ -xive_tctx_notify (tctx, ring); +xive_tctx_notify (tctx, ring_min); }void xive_tctx_ipb_update (XiveTCTX *tctx,uint8_t ring,uint8_t ipb)
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 37/67] target/ppc: optimize hreg_compute_pmu_hflags_value
In reply to Nicholas PigginFrom: Harsh Prateek Bora <[email protected]>
The second if-condition can be true only if the first one above is true. Enclose the latter into the former to avoid un-necessary check if first condition fails.
--- target/ppc/helper_regs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
target/ppc/helper_regs.c +3 -3
@@ -102,9 +102,9 @@ static uint32_t hreg_compute_pmu_hflags_value(CPUPPCState *env)#ifndef CONFIG_USER_ONLY if (env->pmc_ins_cnt) { hflags |=1 <<HFLAGS_INSN_CNT ; - } -if (env->pmc_ins_cnt &0x1e ) { - hflags |=1 <<HFLAGS_PMC_OTHER ; +if (env->pmc_ins_cnt &0x1e ) { + hflags |=1 <<HFLAGS_PMC_OTHER ; + } }#endif #endif
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 16/67] hw/ppc: fix decrementer with BookE timers
In reply to Nicholas PigginFrom: Clément Chigot <[email protected]>
The BookE decrementer stops at 0, meaning that it won't decremented towards "negative" values. However, the current logic is inverted: decr is updated solely when the resulting value would be negative.
--- hw/ppc/ppc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
hw/ppc/ppc.c +3 -1
@@ -728,7 +728,9 @@ static inline int64_t __cpu_ppc_load_decr(CPUPPCState *env, int64_t now,int64_t decr; n =ns_to_tb (tb_env->decr_freq, now); -if (next > n && tb_env->flags &PPC_TIMER_BOOKE ) { + +/* BookE timers stop when reaching 0. */ +if (next < n && tb_env->flags &PPC_TIMER_BOOKE ) { decr =0 ; }else { decr = next - n;
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 65/67] MAINTAINERS: Remove myself from the PowerNV machines
In reply to Nicholas PigginFrom: Cédric Le Goater <[email protected]>
It's been an amazing experience working on PowerNV systems all these years. Now it's time for IBM to take the lead on the QEMU machine and shape its future. I'm stepping back as the maintainer of PowerNV.
--- MAINTAINERS | 1 - 1 file changed, 1 deletion(-)
MAINTAINERS +0 -1
@@ -1495,7 +1495,6 @@ F: tests/functional/test_ppc64_hv.py F: tests/functional/test_ppc64_tuxrun.py PowerNV (Non-Virtualized) -M: Cédric Le Goater <[email protected]> M: Nicholas Piggin <[email protected]> R: Frédéric Barrat <[email protected]> L: [email protected]
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 36/67] target/ppc: optimize hreg_compute_pmu_hflags_value
In reply to Nicholas PigginFrom: Harsh Prateek Bora <[email protected]>
Cache env->spr[SPR_POWER_MMCR0] in a local variable as used in multiple conditions to avoid multiple indirect accesses.
--- target/ppc/helper_regs.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
target/ppc/helper_regs.c +5 -4
@@ -83,15 +83,16 @@ static bool hreg_check_bhrb_enable(CPUPPCState *env)static uint32_t hreg_compute_pmu_hflags_value (CPUPPCState *env) {uint32_t hflags =0 ; -#if defined(TARGET_PPC64 ) -if (env->spr[SPR_POWER_MMCR0 ] &MMCR0_PMCC0 ) { +target_ulong mmcr0 = env->spr[SPR_POWER_MMCR0 ]; + +if (mmcr0 &MMCR0_PMCC0 ) { hflags |=1 <<HFLAGS_PMCC0 ; } -if (env->spr[SPR_POWER_MMCR0 ] &MMCR0_PMCC1 ) { +if (mmcr0 &MMCR0_PMCC1 ) { hflags |=1 <<HFLAGS_PMCC1 ; } -if (env->spr[SPR_POWER_MMCR0 ] & MMCR0_PMCjCE) { +if (mmcr0 & MMCR0_PMCjCE) { hflags |=1 <<HFLAGS_PMCJCE ; }if (hreg_check_bhrb_enable (env)) {
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 50/67] ppc/xive2: Support TIMA "Pull OS Context to Odd Thread Reporting Line"
In reply to Nicholas PigginFrom: Frederic Barrat <[email protected]>
Adds support for single byte writes to offset 0xC18 of the TIMA address space. When this offset is written to, the hardware disables the OS context and copies the current state information to the odd cache line of the pair specified by the NVT structure indexed by the OS CAM entry.
--- hw/intc/xive.c | 2 + hw/intc/xive2.c | 160 ++++++++++++++++++++++++++++++------ include/hw/ppc/xive2.h | 2 + include/hw/ppc/xive2_regs.h | 2 + include/hw/ppc/xive_regs.h | 3 + 5 files changed, 142 insertions(+), 27 deletions(-)
hw/intc/xive.c +2 -0
@@ -547,6 +547,8 @@ static const XiveTmOp xive2_tm_operations[] = { xive_tm_pull_pool_ctx }, {XIVE_TM_HV_PAGE ,TM_SPC_PULL_POOL_CTX ,8 ,NULL , xive_tm_pull_pool_ctx }, + { XIVE_TM_HV_PAGE, TM_SPC_PULL_OS_CTX_OL, 1, xive2_tm_pull_os_ctx_ol, + NULL }, }; static const XiveTmOp *xive_tm_find_op(XivePresenter *xptr, hwaddr offset,
hw/intc/xive2.c +133 -27
184 lines not on this page · raw message
include/hw/ppc/xive2.h +2 -0
@@ -107,5 +107,7 @@ void xive2_tm_push_os_ctx(XivePresenter *xptr, XiveTCTX *tctx, hwaddr offset, uint64_t value, unsigned size);uint64_t xive2_tm_pull_os_ctx (XivePresenter *xptr,XiveTCTX *tctx,hwaddr offset,unsigned size); +void xive2_tm_pull_os_ctx_ol (XivePresenter *xptr,XiveTCTX *tctx, +hwaddr offset,uint64_t value,unsigned size);#endif /* PPC_XIVE2_H */
include/hw/ppc/xive2_regs.h +2 -0
@@ -171,7 +171,9 @@ typedef struct Xive2Nvp {#define NVP2_W5_VP_END_BLOCK PPC_BITMASK32(4, 7)#define NVP2_W5_VP_END_INDEX PPC_BITMASK32(8, 31)uint32_t w6; +#define NVP2_W6_REPORTING_LINE PPC_BITMASK32(4, 31)uint32_t w7; +#define NVP2_W7_REPORTING_LINE PPC_BITMASK32(0, 23) } Xive2Nvp;#define xive2_nvp_is_valid (nvp) (be32_to_cpu((nvp)->w0) & NVP2_W0_VALID)
include/hw/ppc/xive_regs.h +3 -0
@@ -77,6 +77,7 @@#define TM_LSMFB 0x3/* - + + + */ #define TM_ACK_CNT 0x4/* - + - - */ #define TM_INC 0x5/* - + - + */ +#define TM_LGS 0x5/* + + + + */ /* Rename P10 */ #define TM_AGE 0x6/* - + - + */ #define TM_PIPR 0x7/* - + - + */ #define TM_OGEN 0xF/* - + - - */ /* P10 only */
@@ -129,6 +130,8 @@#define TM_SPC_PULL_USR_CTX_OL 0xc08/* Store8 Pull/Inval usr ctx to odd */ /* line */ #define TM_SPC_ACK_OS_EL 0xc10/* Store8 ack OS irq to even line */ +#define TM_SPC_PULL_OS_CTX_OL 0xc18/* Pull/Invalidate OS context to */ +/* odd Thread reporting line */ #define TM_SPC_ACK_HV_POOL_EL 0xc20/* Store8 ack HV evt pool to even */ /* line */ #define TM_SPC_ACK_HV_EL 0xc30/* Store8 ack HV irq to even line */
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 54/67] ppc/xive2: Allow 1-byte write of Target field in TIMA
In reply to Nicholas PigginFrom: Glenn Miles <[email protected]>
When running PowerVM, the console is littered with XIVE traces regarding invalid writes to TIMA address 0x100b6 due to a lack of support for writes to the "TARGET" field which was added for XIVE GEN2. To fix this, we add special op support for 1-byte writes to this field.
--- hw/intc/xive.c | 2 ++ hw/intc/xive2.c | 13 +++++++++++++ include/hw/ppc/xive2.h | 2 ++ include/hw/ppc/xive_regs.h | 1 + 4 files changed, 18 insertions(+)
hw/intc/xive.c +2 -0
@@ -546,6 +546,8 @@ static const XiveTmOp xive2_tm_operations[] = { NULL }, {XIVE_TM_HV_PAGE ,TM_QW3_HV_PHYS +TM_WORD2 ,1 ,NULL , xive_tm_vt_poll }, + { XIVE_TM_HV_PAGE, TM_QW3_HV_PHYS + TM_T, 1, xive2_tm_set_hv_target, + NULL },/* MMIOs above 2K : special operations with side effects */ { XIVE_TM_OS_PAGE, TM_SPC_ACK_OS_REG, 2, NULL,
hw/intc/xive2.c +13 -0
@@ -585,6 +585,19 @@ void xive2_tm_push_os_ctx(XivePresenter *xptr, XiveTCTX *tctx, } } +static void xive2_tctx_set_target (XiveTCTX *tctx,uint8_t ring,uint8_t target) +{ +uint8_t *regs = &tctx->regs[ring]; + + regs[TM_T ] = target; +} + +void xive2_tm_set_hv_target (XivePresenter *xptr,XiveTCTX *tctx, +hwaddr offset,uint64_t value,unsigned size) +{ +xive2_tctx_set_target (tctx,TM_QW3_HV_PHYS , value &0xff ); +} +/* * XIVE Router (aka. Virtualization Controller or IVRE) */
include/hw/ppc/xive2.h +2 -0
@@ -121,5 +121,7 @@ uint64_t xive2_tm_pull_os_ctx(XivePresenter *xptr, XiveTCTX *tctx, hwaddr offset, unsigned size);void xive2_tm_pull_os_ctx_ol (XivePresenter *xptr,XiveTCTX *tctx,hwaddr offset,uint64_t value,unsigned size); +void xive2_tm_set_hv_target (XivePresenter *xptr,XiveTCTX *tctx, +hwaddr offset,uint64_t value,unsigned size);#endif /* PPC_XIVE2_H */
include/hw/ppc/xive_regs.h +1 -0
@@ -79,6 +79,7 @@#define TM_INC 0x5/* - + - + */ #define TM_LGS 0x5/* + + + + */ /* Rename P10 */ #define TM_AGE 0x6/* - + - + */ +#define TM_T 0x6/* - + - + */ /* Rename P10 */ #define TM_PIPR 0x7/* - + - + */ #define TM_OGEN 0xF/* - + - - */ /* P10 only */
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 46/67] hw/ppc: Implement -dtb support for PowerNV
In reply to Nicholas PigginFrom: Aditya Gupta <[email protected]>
Currently any device tree passed with -dtb option in QEMU, was ignored by the PowerNV code.
Read and pass the passed -dtb to the kernel, thus enabling easier debugging with custom DTBs.
The existing behaviour when -dtb is 'not' passed, is preserved as-is.
But when a '-dtb' is passed, it completely overrides any dtb nodes or changes QEMU might have done, such as '-append' arguments to the kernel (which are mentioned in /chosen/bootargs in the dtb), hence add warning when -dtb is being used
--- hw/ppc/pnv.c | 51 ++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 11 deletions(-)
hw/ppc/pnv.c +40 -11
@@ -736,21 +736,27 @@ static void pnv_reset(MachineState *machine, ResetType type) } } - fdt =pnv_dt_create (machine); - -/* Pack resulting tree */ -_FDT ((fdt_pack (fdt))); +if (machine->fdt) { + fdt = machine->fdt; + }else { + fdt =pnv_dt_create (machine); +/* Pack resulting tree */ +_FDT ((fdt_pack (fdt))); + }qemu_fdt_dumpdtb (fdt,fdt_totalsize (fdt));cpu_physical_memory_write (PNV_FDT_ADDR , fdt,fdt_totalsize (fdt)); -/* -* Set machine->fdt for 'dumpdtb' QMP/HMP command. Free -* the existing machine->fdt to avoid leaking it during -* a reset. -*/ -g_free (machine->fdt); - machine->fdt = fdt; +/* Update machine->fdt with latest fdt */ +if (machine->fdt != fdt) { +/* +* Set machine->fdt for 'dumpdtb' QMP/HMP command. Free +* the existing machine->fdt to avoid leaking it during +* a reset. +*/ +g_free (machine->fdt); + machine->fdt = fdt; + } }static ISABus *pnv_chip_power8_isa_create (PnvChip *chip,Error **errp)
@@ -952,6 +958,14 @@ static void pnv_init(MachineState *machine)g_free (sz);exit (EXIT_FAILURE ); } + +/* checks for invalid option combinations */ +if (machine->dtb && (strlen (machine->kernel_cmdline) !=0 )) { +error_report ("-append and -dtb cannot be used together, as passed" +" command line is ignored in case of custom dtb" ); +exit (EXIT_FAILURE ); + } +memory_region_add_subregion (get_system_memory (),0 , machine->ram);/*
@@ -1003,6 +1017,21 @@ static void pnv_init(MachineState *machine) } } +/* load dtb if passed */ +if (machine->dtb) { +int fdt_size; + +warn_report ("with manually passed dtb, some options like '-append'" +" will get ignored and the dtb passed will be used as-is" ); + +/* read the file 'machine->dtb', and load it into 'fdt' buffer */ + machine->fdt =load_device_tree (machine->dtb, &fdt_size); +if (!machine->fdt) { +error_report ("Could not load dtb '%s'" , machine->dtb); +exit (1 ); + } + } +/* MSIs are supported on this platform */ msi_nonbroken = true;
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 31/67] target/ppc: Introduce 'PowerPCCPUClass::spapr_logical_pvr'
In reply to Nicholas PigginFrom: Aditya Gupta <[email protected]>
Introduce 'PnvChipClass::spapr_logical_pvr' to know corresponding logical PVR of a PowerPC CPU.
This helps to have a one-to-one mapping between PVR and logical PVR for a CPU, and used in a later commit to handle cases where PCR of two generations of Power chip is same, which causes regressions with compat-mode.
--- target/ppc/cpu.h | 1 + target/ppc/cpu_init.c | 4 ++++ 2 files changed, 5 insertions(+)
target/ppc/cpu.h +1 -0
@@ -1473,6 +1473,7 @@ struct PowerPCCPUClass {void (*parent_parse_features)(const char *type,char *str,Error **errp);uint32_t pvr; +uint32_t spapr_logical_pvr;/* * If @best is false, match if pcc is in the family of pvr * Else match only if pcc is the best match for pvr in this family.
target/ppc/cpu_init.c +4 -0
@@ -6154,6 +6154,7 @@ POWERPC_FAMILY(POWER7)(ObjectClass *oc, void *data) dc->fw_name ="PowerPC,POWER7" ; dc->desc ="POWER7" ; + pcc->spapr_logical_pvr =CPU_POWERPC_LOGICAL_2_06_PLUS ; pcc->pvr_match = ppc_pvr_match_power7; pcc->pcr_mask =PCR_VEC_DIS |PCR_VSX_DIS |PCR_COMPAT_2_05 ; pcc->pcr_supported =PCR_COMPAT_2_06 |PCR_COMPAT_2_05 ;
@@ -6317,6 +6318,7 @@ POWERPC_FAMILY(POWER8)(ObjectClass *oc, void *data) dc->fw_name ="PowerPC,POWER8" ; dc->desc ="POWER8" ; + pcc->spapr_logical_pvr =CPU_POWERPC_LOGICAL_2_07 ; pcc->pvr_match = ppc_pvr_match_power8; pcc->pcr_mask =PCR_TM_DIS |PCR_COMPAT_2_06 |PCR_COMPAT_2_05 ; pcc->pcr_supported =PCR_COMPAT_2_07 |PCR_COMPAT_2_06 |PCR_COMPAT_2_05 ;
@@ -6510,6 +6512,7 @@ POWERPC_FAMILY(POWER9)(ObjectClass *oc, void *data) dc->fw_name ="PowerPC,POWER9" ; dc->desc ="POWER9" ; + pcc->spapr_logical_pvr =CPU_POWERPC_LOGICAL_3_00 ; pcc->pvr_match = ppc_pvr_match_power9; pcc->pcr_mask =PPC_PCR_MASK_POWER9 ; pcc->pcr_supported =PPC_PCR_SUPPORTED_POWER9 ;
@@ -6644,6 +6647,7 @@ POWERPC_FAMILY(POWER10)(ObjectClass *oc, void *data) dc->fw_name ="PowerPC,POWER10" ; dc->desc ="POWER10" ; + pcc->spapr_logical_pvr =CPU_POWERPC_LOGICAL_3_10 ; pcc->pvr_match = ppc_pvr_match_power10; pcc->pcr_mask =PPC_PCR_MASK_POWER10 ; pcc->pcr_supported =PPC_PCR_SUPPORTED_POWER10 ;
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 53/67] ppc/xive2: Dump the VP-group and crowd tables with 'info pic'
In reply to Nicholas PigginFrom: Frederic Barrat <[email protected]>
The 'info pic' HMP command dumps the state of the interrupt controller. Add the dump of the NVG and NVC tables to its output to ease debug.
--- hw/intc/pnv_xive2.c | 44 +++++++++++++++++++++++++++-- hw/intc/xive2.c | 55 +++++++++++++++++++++++++++++++++++++ include/hw/ppc/xive2.h | 12 ++++++++ include/hw/ppc/xive2_regs.h | 6 ++++ 4 files changed, 114 insertions(+), 3 deletions(-)
hw/intc/pnv_xive2.c +41 -3
@@ -490,6 +490,23 @@ static int pnv_xive2_write_nvp(Xive2Router *xrtr, uint8_t blk, uint32_t idx, word_number); } +static int pnv_xive2_get_nvgc (Xive2Router *xrtr,bool crowd, +uint8_t blk,uint32_t idx, +Xive2Nvgc *nvgc) +{ +return pnv_xive2_vst_read (PNV_XIVE2 (xrtr), crowd ?VST_NVC :VST_NVG , + blk, idx, nvgc); +} + +static int pnv_xive2_write_nvgc (Xive2Router *xrtr,bool crowd, +uint8_t blk,uint32_t idx, +Xive2Nvgc *nvgc) +{ +return pnv_xive2_vst_write (PNV_XIVE2 (xrtr), crowd ?VST_NVC :VST_NVG , + blk, idx, nvgc, +XIVE_VST_WORD_ALL ); +} +static int pnv_xive2_nxc_to_table_type (uint8_t nxc_type,uint32_t *table_type) {switch (nxc_type) {
@@ -2407,6 +2424,8 @@ static void pnv_xive2_class_init(ObjectClass *klass, void *data) xrc->write_end = pnv_xive2_write_end; xrc->get_nvp = pnv_xive2_get_nvp; xrc->write_nvp = pnv_xive2_write_nvp; + xrc->get_nvgc = pnv_xive2_get_nvgc; + xrc->write_nvgc = pnv_xive2_write_nvgc; xrc->get_config = pnv_xive2_get_config; xrc->get_block_id = pnv_xive2_get_block_id;
@@ -2497,8 +2516,9 @@ void pnv_xive2_pic_print_info(PnvXive2 *xive, GString *buf)Xive2Eas eas;Xive2End end;Xive2Nvp nvp; +Xive2Nvgc nvgc;int i; -uint64_t xive_nvp_per_subpage; +uint64_t entries_per_subpage;g_string_append_printf (buf,"XIVE[%x] Source %08x .. %08x\n" , blk, srcno0, srcno0 + nr_esbs -1 );
@@ -2530,10 +2550,28 @@ void pnv_xive2_pic_print_info(PnvXive2 *xive, GString *buf)g_string_append_printf (buf,"XIVE[%x] #%d NVPT %08x .. %08x\n" , chip_id, blk,0 ,XIVE2_NVP_COUNT -1 ); - xive_nvp_per_subpage =pnv_xive2_vst_per_subpage (xive,VST_NVP ); -for (i =0 ; i <XIVE2_NVP_COUNT ; i += xive_nvp_per_subpage) { + entries_per_subpage =pnv_xive2_vst_per_subpage (xive,VST_NVP ); +for (i =0 ; i <XIVE2_NVP_COUNT ; i += entries_per_subpage) {while (!xive2_router_get_nvp (xrtr, blk, i, &nvp)) {xive2_nvp_pic_print_info (&nvp, i++, buf); } } + +g_string_append_printf (buf,"XIVE[%x] #%d NVGT %08x .. %08x\n" , + chip_id, blk,0 ,XIVE2_NVP_COUNT -1 ); + entries_per_subpage =pnv_xive2_vst_per_subpage (xive,VST_NVG ); +for (i =0 ; i <XIVE2_NVP_COUNT ; i += entries_per_subpage) { +while (!xive2_router_get_nvgc (xrtr, false, blk, i, &nvgc)) { +xive2_nvgc_pic_print_info (&nvgc, i++, buf); + } + } + +g_string_append_printf (buf,"XIVE[%x] #%d NVCT %08x .. %08x\n" , + chip_id, blk,0 ,XIVE2_NVP_COUNT -1 ); + entries_per_subpage =pnv_xive2_vst_per_subpage (xive,VST_NVC ); +for (i =0 ; i <XIVE2_NVP_COUNT ; i += entries_per_subpage) { +while (!xive2_router_get_nvgc (xrtr, true, blk, i, &nvgc)) { +xive2_nvgc_pic_print_info (&nvgc, i++, buf); + } + } }
hw/intc/xive2.c +55 -0
73 lines not on this page · raw message
include/hw/ppc/xive2.h +12 -0
@@ -53,6 +53,12 @@ typedef struct Xive2RouterClass { Xive2Nvp *nvp);int (*write_nvp)(Xive2Router *xrtr,uint8_t nvp_blk,uint32_t nvp_idx,Xive2Nvp *nvp,uint8_t word_number); +int (*get_nvgc)(Xive2Router *xrtr,bool crowd, +uint8_t nvgc_blk,uint32_t nvgc_idx, +Xive2Nvgc *nvgc); +int (*write_nvgc)(Xive2Router *xrtr,bool crowd, +uint8_t nvgc_blk,uint32_t nvgc_idx, +Xive2Nvgc *nvgc);uint8_t (*get_block_id)(Xive2Router *xrtr);uint32_t (*get_config)(Xive2Router *xrtr); } Xive2RouterClass;
@@ -67,6 +73,12 @@ int xive2_router_get_nvp(Xive2Router *xrtr, uint8_t nvp_blk, uint32_t nvp_idx, Xive2Nvp *nvp);int xive2_router_write_nvp (Xive2Router *xrtr,uint8_t nvp_blk,uint32_t nvp_idx,Xive2Nvp *nvp,uint8_t word_number); +int xive2_router_get_nvgc (Xive2Router *xrtr,bool crowd, +uint8_t nvgc_blk,uint32_t nvgc_idx, +Xive2Nvgc *nvgc); +int xive2_router_write_nvgc (Xive2Router *xrtr,bool crowd, +uint8_t nvgc_blk,uint32_t nvgc_idx, +Xive2Nvgc *nvgc);uint32_t xive2_router_get_config (Xive2Router *xrtr);void xive2_router_notify (XiveNotifier *xn,uint32_t lisn,bool pq_checked);
include/hw/ppc/xive2_regs.h +6 -0
@@ -212,6 +212,7 @@ void xive2_nvp_pic_print_info(Xive2Nvp *nvp, uint32_t nvp_idx, GString *buf); typedef struct Xive2Nvgc { uint32_t w0; #define NVGC2_W0_VALID PPC_BIT32(0) +#define NVGC2_W0_PGONEXT PPC_BITMASK32(26, 31) uint32_t w1; uint32_t w2; uint32_t w3;
@@ -221,4 +222,9 @@ typedef struct Xive2Nvgc { uint32_t w7; } Xive2Nvgc; +#define xive2_nvgc_is_valid (nvgc) (be32_to_cpu((nvgc)->w0) & NVGC2_W0_VALID) + +void xive2_nvgc_pic_print_info (Xive2Nvgc *nvgc,uint32_t nvgc_idx, +GString *buf); +#endif /* PPC_XIVE2_REGS_H */
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 57/67] ppc/xive2: Support "Pull Thread Context to Odd Thread Reporting Line"
In reply to Nicholas PigginFrom: Glenn Miles <[email protected]>
Adds support for single byte writes to offset 0xC38 of the TIMA address space. When this offset is written to, the hardware disables the thread context and copies the current state information to the odd cache line of the pair specified by the NVT structure indexed by the THREAD CAM entry.
Note that this operation is almost identical to what we are already doing for the "Pull OS Context to Odd Thread Reporting Line" operation except that it also invalidates the Pool and Thread Contexts.
--- hw/intc/xive.c | 9 +++-- hw/intc/xive2.c | 73 ++++++++++++++++++++++++++----------- include/hw/ppc/xive2.h | 2 + include/hw/ppc/xive2_regs.h | 16 ++++---- include/hw/ppc/xive_regs.h | 1 + 5 files changed, 69 insertions(+), 32 deletions(-)
hw/intc/xive.c +5 -4
@@ -117,10 +117,9 @@ static void xive_tctx_notify(XiveTCTX *tctx, uint8_t ring)void xive_tctx_reset_signal (XiveTCTX *tctx,uint8_t ring) {/* -* Lower the External interrupt. Used when pulling an OS -* context. It is necessary to avoid catching it in the hypervisor -* context. It should be raised again when re-pushing the OS -* context. +* Lower the External interrupt. Used when pulling a context. It is +* necessary to avoid catching it in the higher privilege context. It +* should be raised again when re-pushing the lower privilege context. */ qemu_irq_lower (xive_tctx_output (tctx, ring)); }
@@ -581,6 +580,8 @@ static const XiveTmOp xive2_tm_operations[] = { NULL }, {XIVE_TM_HV_PAGE ,TM_SPC_PULL_PHYS_CTX ,1 ,NULL , xive_tm_pull_phys_ctx }, + { XIVE_TM_HV_PAGE, TM_SPC_PULL_PHYS_CTX_OL, 1, xive2_tm_pull_phys_ctx_ol, + NULL }, }; static const XiveTmOp *xive_tm_find_op(XivePresenter *xptr, hwaddr offset,
hw/intc/xive2.c +52 -21
115 lines not on this page · raw message
include/hw/ppc/xive2.h +2 -0
@@ -123,5 +123,7 @@ void xive2_tm_pull_os_ctx_ol(XivePresenter *xptr, XiveTCTX *tctx, hwaddr offset, uint64_t value, unsigned size);void xive2_tm_set_hv_target (XivePresenter *xptr,XiveTCTX *tctx,hwaddr offset,uint64_t value,unsigned size); +void xive2_tm_pull_phys_ctx_ol (XivePresenter *xptr,XiveTCTX *tctx, +hwaddr offset,uint64_t value,unsigned size);#endif /* PPC_XIVE2_H */
include/hw/ppc/xive2_regs.h +9 -7
@@ -19,16 +19,18 @@* mode (P10), the CAM line is slightly different as the VP space was * increased. */ -#define TM2_QW0W2_VU PPC_BIT32(0) +#define TM2_W2_VALID PPC_BIT32(0) +#define TM2_W2_HW PPC_BIT32(1) +#define TM2_QW0W2_VU TM2_W2_VALID#define TM2_QW0W2_LOGIC_SERV PPC_BITMASK32(4, 31) -#define TM2_QW1W2_VO PPC_BIT32(0) -#define TM2_QW1W2_HO PPC_BIT32(1) +#define TM2_QW1W2_VO TM2_W2_VALID +#define TM2_QW1W2_HO TM2_W2_HW#define TM2_QW1W2_OS_CAM PPC_BITMASK32(4, 31) -#define TM2_QW2W2_VP PPC_BIT32(0) -#define TM2_QW2W2_HP PPC_BIT32(1) +#define TM2_QW2W2_VP TM2_W2_VALID +#define TM2_QW2W2_HP TM2_W2_HW#define TM2_QW2W2_POOL_CAM PPC_BITMASK32(4, 31) -#define TM2_QW3W2_VT PPC_BIT32(0) -#define TM2_QW3W2_HT PPC_BIT32(1) +#define TM2_QW3W2_VT TM2_W2_VALID +#define TM2_QW3W2_HT TM2_W2_HW#define TM2_QW3W2_LP PPC_BIT32(6)#define TM2_QW3W2_LE PPC_BIT32(7)
include/hw/ppc/xive_regs.h +1 -0
@@ -138,6 +138,7 @@#define TM_SPC_ACK_HV_POOL_EL 0xc20/* Store8 ack HV evt pool to even */ /* line */ #define TM_SPC_ACK_HV_EL 0xc30/* Store8 ack HV irq to even line */ +#define TM_SPC_PULL_PHYS_CTX_OL 0xc38/* Pull phys ctx to odd cache line */ /* XXX more... */ /* NSR fields for the various QW ack types */
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 39/67] target/ppc: optimize p8 exception handling routines
In reply to Nicholas PigginFrom: Harsh Prateek Bora <[email protected]>
Most of the p8 exception handling accesses env->pending_interrupts and env->spr[SPR_LPCR] at multiple places. Passing it directly as local variables simplifies the code and avoids multiple indirect accesses.
--- target/ppc/excp_helper.c | 60 +++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 28 deletions(-)
target/ppc/excp_helper.c +32 -28
@@ -1765,39 +1765,42 @@ static int p7_next_unmasked_interrupt(CPUPPCState *env) PPC_INTERRUPT_CEXT | PPC_INTERRUPT_WDT | PPC_INTERRUPT_CDOORBELL | \ PPC_INTERRUPT_FIT | PPC_INTERRUPT_PIT | PPC_INTERRUPT_THERM) -static int p8_interrupt_powersave (CPUPPCState *env) +static int p8_interrupt_powersave (uint32_t pending_interrupts, +target_ulong lpcr) { -if ((env->pending_interrupts &PPC_INTERRUPT_EXT ) && - (env->spr[SPR_LPCR ] &LPCR_P8_PECE2 )) { +if ((pending_interrupts &PPC_INTERRUPT_EXT ) && + (lpcr &LPCR_P8_PECE2 )) {return PPC_INTERRUPT_EXT ; } -if ((env->pending_interrupts &PPC_INTERRUPT_DECR ) && - (env->spr[SPR_LPCR ] &LPCR_P8_PECE3 )) { +if ((pending_interrupts &PPC_INTERRUPT_DECR ) && + (lpcr &LPCR_P8_PECE3 )) {return PPC_INTERRUPT_DECR ; } -if ((env->pending_interrupts &PPC_INTERRUPT_MCK ) && - (env->spr[SPR_LPCR ] &LPCR_P8_PECE4 )) { +if ((pending_interrupts &PPC_INTERRUPT_MCK ) && + (lpcr &LPCR_P8_PECE4 )) {return PPC_INTERRUPT_MCK ; } -if ((env->pending_interrupts &PPC_INTERRUPT_HMI ) && - (env->spr[SPR_LPCR ] &LPCR_P8_PECE4 )) { +if ((pending_interrupts &PPC_INTERRUPT_HMI ) && + (lpcr &LPCR_P8_PECE4 )) {return PPC_INTERRUPT_HMI ; } -if ((env->pending_interrupts &PPC_INTERRUPT_DOORBELL ) && - (env->spr[SPR_LPCR ] &LPCR_P8_PECE0 )) { +if ((pending_interrupts &PPC_INTERRUPT_DOORBELL ) && + (lpcr &LPCR_P8_PECE0 )) {return PPC_INTERRUPT_DOORBELL ; } -if ((env->pending_interrupts &PPC_INTERRUPT_HDOORBELL ) && - (env->spr[SPR_LPCR ] &LPCR_P8_PECE1 )) { +if ((pending_interrupts &PPC_INTERRUPT_HDOORBELL ) && + (lpcr &LPCR_P8_PECE1 )) {return PPC_INTERRUPT_HDOORBELL ; } -if (env->pending_interrupts &PPC_INTERRUPT_RESET ) { +if (pending_interrupts &PPC_INTERRUPT_RESET ) {return PPC_INTERRUPT_RESET ; }return 0 ; } -static int p8_next_unmasked_interrupt (CPUPPCState *env) +static int p8_next_unmasked_interrupt (CPUPPCState *env, +uint32_t pending_interrupts, +target_ulong lpcr) {CPUState *cs =env_cpu (env);
@@ -1808,18 +1811,18 @@ static int p8_next_unmasked_interrupt(CPUPPCState *env)if (cs->halted) {/* LPCR[PECE] controls which interrupts can exit power-saving mode */ -return p8_interrupt_powersave (env); +return p8_interrupt_powersave (pending_interrupts, lpcr); }/* Machine check exception */ -if (env->pending_interrupts &PPC_INTERRUPT_MCK ) { +if (pending_interrupts &PPC_INTERRUPT_MCK ) {return PPC_INTERRUPT_MCK ; }/* Hypervisor decrementer exception */ -if (env->pending_interrupts &PPC_INTERRUPT_HDECR ) { +if (pending_interrupts &PPC_INTERRUPT_HDECR ) {/* LPCR will be clear when not supported so this will work */ -bool hdice = !!(env->spr[SPR_LPCR ] &LPCR_HDICE ); +bool hdice = !!(lpcr &LPCR_HDICE );if ((msr_ee || !FIELD_EX64_HV (env->msr)) && hdice) {/* HDEC clears on delivery */ return PPC_INTERRUPT_HDECR ;
@@ -1827,9 +1830,9 @@ static int p8_next_unmasked_interrupt(CPUPPCState *env) }/* External interrupt can ignore MSR:EE under some circumstances */ -if (env->pending_interrupts &PPC_INTERRUPT_EXT ) { -bool lpes0 = !!(env->spr[SPR_LPCR ] &LPCR_LPES0 ); -bool heic = !!(env->spr[SPR_LPCR ] &LPCR_HEIC ); +if (pending_interrupts &PPC_INTERRUPT_EXT ) { +bool lpes0 = !!(lpcr &LPCR_LPES0 ); +bool heic = !!(lpcr &LPCR_HEIC );/* HEIC blocks delivery to the hypervisor */ if ((msr_ee && !(heic && FIELD_EX64_HV(env->msr) && !FIELD_EX64(env->msr, MSR, PR))) ||
@@ -1839,20 +1842,20 @@ static int p8_next_unmasked_interrupt(CPUPPCState *env) }if (msr_ee !=0 ) {/* Decrementer exception */ -if (env->pending_interrupts &PPC_INTERRUPT_DECR ) { +if (pending_interrupts &PPC_INTERRUPT_DECR ) {return PPC_INTERRUPT_DECR ; } -if (env->pending_interrupts &PPC_INTERRUPT_DOORBELL ) { +if (pending_interrupts &PPC_INTERRUPT_DOORBELL ) {return PPC_INTERRUPT_DOORBELL ; } -if (env->pending_interrupts &PPC_INTERRUPT_HDOORBELL ) { +if (pending_interrupts &PPC_INTERRUPT_HDOORBELL ) {return PPC_INTERRUPT_HDOORBELL ; } -if (env->pending_interrupts &PPC_INTERRUPT_PERFM ) { +if (pending_interrupts &PPC_INTERRUPT_PERFM ) {return PPC_INTERRUPT_PERFM ; }/* EBB exception */ -if (env->pending_interrupts &PPC_INTERRUPT_EBB ) { +if (pending_interrupts &PPC_INTERRUPT_EBB ) {/* * EBB exception must be taken in problem state and * with BESCR_GE set.
@@ -2021,7 +2024,8 @@ static int ppc_next_unmasked_interrupt(CPUPPCState *env)case POWERPC_EXCP_POWER7 :return p7_next_unmasked_interrupt (env);case POWERPC_EXCP_POWER8 : -return p8_next_unmasked_interrupt (env); +return p8_next_unmasked_interrupt (env, env->pending_interrupts, + env->spr[SPR_LPCR ]);case POWERPC_EXCP_POWER9 :case POWERPC_EXCP_POWER10 :case POWERPC_EXCP_POWER11 :
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 49/67] pnv/xive2: Define OGEN field in the TIMA
In reply to Nicholas PigginFrom: Frederic Barrat <[email protected]>
The OGEN field at offset 0x1F is a new field for Gen2 TIMA. This patch defines it.
--- hw/intc/xive.c | 4 ++++ include/hw/ppc/xive_regs.h | 1 + 2 files changed, 5 insertions(+)
hw/intc/xive.c +4 -0
@@ -742,6 +742,10 @@ void xive_tctx_reset(XiveTCTX *tctx) tctx->regs[TM_QW1_OS +TM_LSMFB ] =0xFF ; tctx->regs[TM_QW1_OS +TM_ACK_CNT ] =0xFF ; tctx->regs[TM_QW1_OS +TM_AGE ] =0xFF ; +if (!(xive_presenter_get_config (tctx->xptr) & +XIVE_PRESENTER_GEN1_TIMA_OS )) { + tctx->regs[TM_QW1_OS +TM_OGEN ] =2 ; + }/* * Initialize PIPR to 0xFF to avoid phantom interrupts when the
include/hw/ppc/xive_regs.h +1 -0
@@ -79,6 +79,7 @@#define TM_INC 0x5/* - + - + */ #define TM_AGE 0x6/* - + - + */ #define TM_PIPR 0x7/* - + - + */ +#define TM_OGEN 0xF/* - + - - */ /* P10 only */ #define TM_WORD0 0x0#define TM_WORD1 0x4
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 26/67] ppc/spapr: remove deprecated machine pseries-2.10
In reply to Nicholas PigginFrom: Harsh Prateek Bora <[email protected]>
Commit 1392617d3576 intended to tag pseries-2.1 - 2.11 machines as deprecated with reasons mentioned in its commit log. Removing pseries-2.10 specific code with this patch for now.
--- hw/ppc/spapr.c | 12 ------------ 1 file changed, 12 deletions(-)
hw/ppc/spapr.c +0 -12
@@ -5069,18 +5069,6 @@ static void spapr_machine_2_11_class_options(MachineClass *mc)DEFINE_SPAPR_MACHINE (2 ,11 ); -/* -* pseries-2.10 -*/ - -static void spapr_machine_2_10_class_options (MachineClass *mc) -{ -spapr_machine_2_11_class_options (mc); -compat_props_add (mc->compat_props, hw_compat_2_10, hw_compat_2_10_len); -} - -DEFINE_SPAPR_MACHINE (2 ,10 ); -static void spapr_machine_register_types (void ) {type_register_static (&spapr_machine_info);
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 07/67] target/ppc: Fix doorbell delivery to threads in powersave
In reply to Nicholas PigginDoorbell exceptions are not not cleared when they cause a wake from powersave state, only when they take the corresponding interrupt. The sreset-on-wake logic must avoid clearing the interrupt in this case.
--- target/ppc/excp_helper.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
target/ppc/excp_helper.c +13 -4
@@ -2237,7 +2237,9 @@ static void p8_deliver_interrupt(CPUPPCState *env, int interrupt)powerpc_excp (cpu,POWERPC_EXCP_DECR );break ;case PPC_INTERRUPT_DOORBELL : - env->pending_interrupts &= ~PPC_INTERRUPT_DOORBELL ; +if (!env->resume_as_sreset) { + env->pending_interrupts &= ~PPC_INTERRUPT_DOORBELL ; + }if (is_book3s_arch2x (env)) {powerpc_excp (cpu,POWERPC_EXCP_SDOOR ); }else {
@@ -2245,7 +2247,9 @@ static void p8_deliver_interrupt(CPUPPCState *env, int interrupt) }break ;case PPC_INTERRUPT_HDOORBELL : - env->pending_interrupts &= ~PPC_INTERRUPT_HDOORBELL ; +if (!env->resume_as_sreset) { + env->pending_interrupts &= ~PPC_INTERRUPT_HDOORBELL ; + }powerpc_excp (cpu,POWERPC_EXCP_SDOOR_HV );break ;case PPC_INTERRUPT_PERFM :
@@ -2301,6 +2305,7 @@ static void p9_deliver_interrupt(CPUPPCState *env, int interrupt)case PPC_INTERRUPT_HDECR :/* Hypervisor decrementer exception */ /* HDEC clears on delivery */ +/* XXX: should not see an HDEC if resume_as_sreset. assert? */ env->pending_interrupts &= ~PPC_INTERRUPT_HDECR ;powerpc_excp (cpu,POWERPC_EXCP_HDECR );break ;
@@ -2320,11 +2325,15 @@ static void p9_deliver_interrupt(CPUPPCState *env, int interrupt)powerpc_excp (cpu,POWERPC_EXCP_DECR );break ;case PPC_INTERRUPT_DOORBELL : - env->pending_interrupts &= ~PPC_INTERRUPT_DOORBELL ; +if (!env->resume_as_sreset) { + env->pending_interrupts &= ~PPC_INTERRUPT_DOORBELL ; + }powerpc_excp (cpu,POWERPC_EXCP_SDOOR );break ;case PPC_INTERRUPT_HDOORBELL : - env->pending_interrupts &= ~PPC_INTERRUPT_HDOORBELL ; +if (!env->resume_as_sreset) { + env->pending_interrupts &= ~PPC_INTERRUPT_HDOORBELL ; + }powerpc_excp (cpu,POWERPC_EXCP_SDOOR_HV );break ;case PPC_INTERRUPT_PERFM :
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 47/67] ppc/xive: Fix ESB length overflow on 32-bit hosts
In reply to Nicholas PigginThe length of this region can be > 32-bits, which overflows size_t on 32-bit hosts. Change to uint64_t.
--- hw/intc/spapr_xive_kvm.c | 4 ++-- hw/intc/xive.c | 2 +- include/hw/ppc/xive.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
hw/intc/spapr_xive_kvm.c +2 -2
@@ -720,7 +720,7 @@ int kvmppc_xive_connect(SpaprInterruptController *intc, uint32_t nr_servers, {SpaprXive *xive =SPAPR_XIVE (intc);XiveSource *xsrc = &xive->source; -size_t esb_len =xive_source_esb_len (xsrc); +uint64_t esb_len =xive_source_esb_len (xsrc);size_t tima_len =4ull <<TM_SHIFT ;CPUState *cs;int fd;
@@ -824,7 +824,7 @@ void kvmppc_xive_disconnect(SpaprInterruptController *intc) {SpaprXive *xive =SPAPR_XIVE (intc);XiveSource *xsrc; -size_t esb_len; +uint64_t esb_len;assert (xive->fd !=-1 );
hw/intc/xive.c +1 -1
@@ -1242,7 +1242,7 @@ static void xive_source_reset(void *dev)static void xive_source_realize (DeviceState *dev,Error **errp) {XiveSource *xsrc =XIVE_SOURCE (dev); -size_t esb_len =xive_source_esb_len (xsrc); +uint64_t esb_len =xive_source_esb_len (xsrc);assert (xsrc->xive);
include/hw/ppc/xive.h +1 -1
@@ -218,7 +218,7 @@ static inline bool xive_source_esb_has_2page(XiveSource *xsrc) xsrc->esb_shift ==XIVE_ESB_4K_2PAGE ; } -static inline size_t xive_source_esb_len (XiveSource *xsrc) +static inline uint64_t xive_source_esb_len (XiveSource *xsrc) {return (1ull << xsrc->esb_shift) * xsrc->nr_irqs; }
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 43/67] target/ppc: reduce duplicate code between init_proc_POWER{9, 10}
In reply to Nicholas PigginFrom: Harsh Prateek Bora <[email protected]>
Historically, the registration of sprs have been inherited alongwith every new Power arch support being added leading to a lot of code duplication. It's time to do necessary cleanups now to avoid further duplication with newer arch support being added.
--- target/ppc/cpu_init.c | 58 +++++++++---------------------------------- 1 file changed, 12 insertions(+), 46 deletions(-)
target/ppc/cpu_init.c +12 -46
@@ -6410,7 +6410,7 @@ static struct ppc_radix_page_info POWER9_radix_page_info = {#endif /* CONFIG_USER_ONLY */ #define POWER9_BHRB_ENTRIES_LOG2 5 -static void init_proc_POWER9 (CPUPPCState *env) +static void register_power9_common_sprs (CPUPPCState *env) {/* Common Registers */ init_proc_book3s_common (env);
@@ -6429,7 +6429,6 @@ static void init_proc_POWER9(CPUPPCState *env)register_power5p_ear_sprs (env);register_power5p_tb_sprs (env);register_power6_common_sprs (env); -register_HEIR32_spr (env);register_power6_dbg_sprs (env);register_power7_common_sprs (env);register_power8_tce_address_control_sprs (env);
@@ -6447,16 +6446,21 @@ static void init_proc_POWER9(CPUPPCState *env)register_power8_rpr_sprs (env);register_power9_mmu_sprs (env); -/* POWER9 Specific registers */ -spr_register_kvm (env,SPR_TIDR ,"TIDR" ,NULL ,NULL , - spr_read_generic, spr_write_generic, -KVM_REG_PPC_TIDR ,0 ); -/* FIXME: Filter fields properly based on privilege level */ spr_register_kvm_hv (env,SPR_PSSCR ,"PSSCR" ,NULL ,NULL ,NULL ,NULL , spr_read_generic, spr_write_generic,KVM_REG_PPC_PSSCR ,0 ); +} + +static void init_proc_POWER9 (CPUPPCState *env) +{ +register_power9_common_sprs (env); +register_HEIR32_spr (env); +/* POWER9 Specific registers */ +spr_register_kvm (env,SPR_TIDR ,"TIDR" ,NULL ,NULL , + spr_read_generic, spr_write_generic, +KVM_REG_PPC_TIDR ,0 );/* env variables */ env->dcache_line_size =128 ; env->icache_line_size =128 ;
@@ -6562,50 +6566,12 @@ static struct ppc_radix_page_info POWER10_radix_page_info = {#define POWER10_BHRB_ENTRIES_LOG2 5static void init_proc_POWER10 (CPUPPCState *env) { -/* Common Registers */ -init_proc_book3s_common (env); -register_book3s_207_dbg_sprs (env); - -/* Common TCG PMU */ -init_tcg_pmu_power8 (env); - -/* POWER8 Specific Registers */ -register_book3s_ids_sprs (env); -register_amr_sprs (env); -register_iamr_sprs (env); -register_book3s_purr_sprs (env); -register_power5p_common_sprs (env); -register_power5p_lpar_sprs (env); -register_power5p_ear_sprs (env); -register_power5p_tb_sprs (env); -register_power6_common_sprs (env); +register_power9_common_sprs (env);register_HEIR64_spr (env); -register_power6_dbg_sprs (env); -register_power7_common_sprs (env); -register_power8_tce_address_control_sprs (env); -register_power8_ids_sprs (env); -register_power8_ebb_sprs (env); -register_power8_fscr_sprs (env); -register_power8_pmu_sup_sprs (env); -register_power8_pmu_user_sprs (env); -register_power8_tm_sprs (env); -register_power8_pspb_sprs (env); -register_power8_dpdes_sprs (env); -register_vtb_sprs (env); -register_power8_ic_sprs (env); -register_power9_book4_sprs (env); -register_power8_rpr_sprs (env); -register_power9_mmu_sprs (env);register_power10_hash_sprs (env);register_power10_dexcr_sprs (env);register_power10_pmu_sup_sprs (env);register_power10_pmu_user_sprs (env); - -/* FIXME: Filter fields properly based on privilege level */ -spr_register_kvm_hv (env,SPR_PSSCR ,"PSSCR" ,NULL ,NULL ,NULL ,NULL , - spr_read_generic, spr_write_generic, -KVM_REG_PPC_PSSCR ,0 ); -/* env variables */ env->dcache_line_size =128 ; env->icache_line_size =128 ;
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 66/67] MAINTAINERS: Remove myself from XIVE
In reply to Nicholas PigginFrom: Cédric Le Goater <[email protected]>
Working on XIVE has been one of the most complex and fascinating experiences for me. It's been a real journey, and now it's time for IBM to take over and guide its future. I'm stepping back as the maintainer of XIVE.
--- MAINTAINERS | 1 - 1 file changed, 1 deletion(-)
MAINTAINERS +0 -1
@@ -2618,7 +2618,6 @@ F: tests/qtest/fw_cfg-test.c T: git https://github.com/philmd/qemu.git fw_cfg-next XIVE -M: Cédric Le Goater <[email protected]> R: Frédéric Barrat <[email protected]> L: [email protected] S: Odd Fixes
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 67/67] MAINTAINERS: Remove myself as reviewer
In reply to Nicholas PigginFrom: David Gibson <[email protected]>
I've now well and truly moved on from ppc and qemu maintenance. I'm occupied with other things and am pretty much just ignoring mails on these topics I'm CCed on. Time to remove myself.
I'm still listed as a reviewer for Device Tree, I'll keep this for now, since I do have some interest and it's lower volume.
--- MAINTAINERS | 2 -- 1 file changed, 2 deletions(-)
MAINTAINERS +0 -2
@@ -1471,7 +1471,6 @@ F: tests/functional/test_ppc_40p.py sPAPR (pseries) M: Nicholas Piggin <[email protected]> R: Daniel Henrique Barboza <[email protected]> -R: David Gibson <[email protected]> R: Harsh Prateek Bora <[email protected]> L: [email protected] S: Odd Fixes
@@ -1562,7 +1561,6 @@ F: tests/functional/test_ppc_amiga.py Virtual Open Firmware (VOF) M: Alexey Kardashevskiy <[email protected]> -R: David Gibson <[email protected]> L: [email protected] S: Odd Fixes F: hw/ppc/spapr_vof*
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 33/67] target/ppc: Add Power11 DD2.0 processor
In reply to Nicholas PigginFrom: Aditya Gupta <[email protected]>
Add CPU target code to add support for new Power11 Processor.
Power11 core is same as Power10, hence reuse functions defined for Power10.
--- target/ppc/compat.c | 7 +++++ target/ppc/cpu-models.c | 3 ++ target/ppc/cpu-models.h | 3 ++ target/ppc/cpu.h | 2 ++ target/ppc/cpu_init.c | 60 ++++++++++++++++++++++++++++++++++++++++ target/ppc/cpu_init.h | 7 +++++ target/ppc/excp_helper.c | 4 +++ 7 files changed, 86 insertions(+)
target/ppc/compat.c +7 -0
@@ -100,6 +100,13 @@ static const CompatInfo compat_table[] = { .pcr_level = PCR_COMPAT_3_10, .max_vthreads = 8, }, + {/* POWER11, ISA3.10 */ + .name = "power11", + .pvr = CPU_POWERPC_LOGICAL_3_10_P11, + .pcr = PCR_COMPAT_3_10, + .pcr_level = PCR_COMPAT_3_10, + .max_vthreads = 8, + }, };static const CompatInfo *compat_by_pvr (uint32_t pvr)
target/ppc/cpu-models.c +3 -0
@@ -734,6 +734,8 @@ "POWER9 v2.2") POWERPC_DEF("power10_v2.0", CPU_POWERPC_POWER10_DD20, POWER10, "POWER10 v2.0") + POWERPC_DEF("power11_v2.0", CPU_POWERPC_POWER11_DD20, POWER11, + "POWER11_v2.0")#endif /* defined (TARGET_PPC64) */ /***************************************************************************/
@@ -909,6 +911,7 @@ PowerPCCPUAlias ppc_cpu_aliases[] = { { "power8nvl", "power8nvl_v1.0" }, { "power9", "power9_v2.2" }, { "power10", "power10_v2.0" }, + { "power11", "power11_v2.0" }, #endif /* Generic PowerPCs */
target/ppc/cpu-models.h +3 -0
@@ -354,6 +354,8 @@ enum {CPU_POWERPC_POWER10_BASE =0x00800000 ,CPU_POWERPC_POWER10_DD1 =0x00801100 ,CPU_POWERPC_POWER10_DD20 =0x00801200 , +CPU_POWERPC_POWER11_BASE =0x00820000 , +CPU_POWERPC_POWER11_DD20 =0x00821200 , CPU_POWERPC_970_v22 =0x00390202 , CPU_POWERPC_970FX_v10 =0x00391100 , CPU_POWERPC_970FX_v20 = 0x003C0200,
@@ -391,6 +393,7 @@ enum {CPU_POWERPC_LOGICAL_2_07 =0x0F000004 ,CPU_POWERPC_LOGICAL_3_00 =0x0F000005 ,CPU_POWERPC_LOGICAL_3_10 =0x0F000006 , + CPU_POWERPC_LOGICAL_3_10_P11 = 0x0F000007, };/* System version register (used on MPC 8xxx) */
target/ppc/cpu.h +2 -0
@@ -216,6 +216,8 @@ typedef enum powerpc_excp_t {POWERPC_EXCP_POWER9 ,/* POWER10 exception model */ POWERPC_EXCP_POWER10 , +/* POWER11 exception model */ +POWERPC_EXCP_POWER11 , } powerpc_excp_t;/*****************************************************************************/
target/ppc/cpu_init.c +60 -0
66 lines not on this page · raw message
target/ppc/cpu_init.h +7 -0
@@ -12,6 +12,7 @@ PPC_CILDST)#define PPC_INSNS_FLAGS_POWER10 PPC_INSNS_FLAGS_POWER9 +#define PPC_INSNS_FLAGS_POWER11 PPC_INSNS_FLAGS_POWER10#define PPC_INSNS_FLAGS2_POWER_COMMON \ (PPC2_VSX | PPC2_VSX207 | PPC2_DFP | PPC2_DBRX | \
@@ -25,6 +26,7 @@ (PPC_INSNS_FLAGS2_POWER_COMMON | PPC2_TM)#define PPC_INSNS_FLAGS2_POWER10 \ (PPC_INSNS_FLAGS2_POWER_COMMON | PPC2_ISA310) +#define PPC_INSNS_FLAGS2_POWER11 PPC_INSNS_FLAGS2_POWER10#define PPC_MSR_MASK_POWER_COMMON \ ((1ull << MSR_SF) | \
@@ -49,16 +51,19 @@ (PPC_MSR_MASK_POWER_COMMON | (1ull << MSR_TM))#define PPC_MSR_MASK_POWER10 \ PPC_MSR_MASK_POWER_COMMON +#define PPC_MSR_MASK_POWER11 PPC_MSR_MASK_POWER10#define PPC_PCR_MASK_POWER9 \ (PCR_COMPAT_2_05 | PCR_COMPAT_2_06 | PCR_COMPAT_2_07)#define PPC_PCR_MASK_POWER10 \ (PPC_PCR_MASK_POWER9 | PCR_COMPAT_3_00) +#define PPC_PCR_MASK_POWER11 PPC_PCR_MASK_POWER10#define PPC_PCR_SUPPORTED_POWER9 \ (PCR_COMPAT_3_00 | PCR_COMPAT_2_07 | PCR_COMPAT_2_06 | PCR_COMPAT_2_05)#define PPC_PCR_SUPPORTED_POWER10 \ (PPC_PCR_SUPPORTED_POWER9 | PCR_COMPAT_3_10) +#define PPC_PCR_SUPPORTED_POWER11 PPC_PCR_SUPPORTED_POWER10#define PPC_LPCR_MASK_POWER9 \ (LPCR_VPM1 | LPCR_ISL | LPCR_KBV | LPCR_DPFD | \
@@ -70,6 +75,7 @@/* DD2 adds an extra HAIL bit */ #define PPC_LPCR_MASK_POWER10 \ (PPC_LPCR_MASK_POWER9 | LPCR_HAIL) +#define PPC_LPCR_MASK_POWER11 PPC_LPCR_MASK_POWER10#define POWERPC_FLAGS_POWER_COMMON \ (POWERPC_FLAG_VRE | POWERPC_FLAG_SE | POWERPC_FLAG_BE | \
@@ -80,5 +86,6 @@ (POWERPC_FLAGS_POWER_COMMON | POWERPC_FLAG_TM)#define POWERPC_FLAGS_POWER10 \ (POWERPC_FLAGS_POWER_COMMON | POWERPC_FLAG_BHRB) +#define POWERPC_FLAGS_POWER11 POWERPC_FLAGS_POWER10#endif /* TARGET_PPC_CPU_INIT_H */
target/ppc/excp_helper.c +4 -0
@@ -1661,6 +1661,7 @@ static void powerpc_excp(PowerPCCPU *cpu, int excp)case POWERPC_EXCP_POWER8 :case POWERPC_EXCP_POWER9 :case POWERPC_EXCP_POWER10 : +case POWERPC_EXCP_POWER11 :powerpc_excp_books (cpu, excp);break ;default :
@@ -2018,6 +2019,7 @@ static int ppc_next_unmasked_interrupt(CPUPPCState *env)return p8_next_unmasked_interrupt (env);case POWERPC_EXCP_POWER9 :case POWERPC_EXCP_POWER10 : +case POWERPC_EXCP_POWER11 :return p9_next_unmasked_interrupt (env);default :break ;
@@ -2378,6 +2380,7 @@ static void ppc_deliver_interrupt(CPUPPCState *env, int interrupt)return p8_deliver_interrupt (env, interrupt);case POWERPC_EXCP_POWER9 :case POWERPC_EXCP_POWER10 : +case POWERPC_EXCP_POWER11 :return p9_deliver_interrupt (env, interrupt);default :break ;
@@ -3168,6 +3171,7 @@ void ppc_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr,case POWERPC_EXCP_POWER8 :case POWERPC_EXCP_POWER9 :case POWERPC_EXCP_POWER10 : +case POWERPC_EXCP_POWER11 :/* * Machine check codes can be found in processor User Manual or * Linux or skiboot source.
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 34/67] ppc/pseries: Add Power11 cpu type
In reply to Nicholas PigginFrom: Aditya Gupta <[email protected]>
Add sPAPR CPU Core definition for Power11
--- docs/system/ppc/pseries.rst | 17 +++++++++++++---- hw/ppc/spapr_cpu_core.c | 1 + 2 files changed, 14 insertions(+), 4 deletions(-)
docs/system/ppc/pseries.rst +13 -4
@@ -14,10 +14,19 @@ virtualization capabilities. Supported devices ================= - * Multi processor support for many Power processors generations: POWER7, - POWER7+, POWER8, POWER8NVL, POWER9, and Power10. Support for POWER5+ exists, - but its state is unknown. - * Interrupt Controller, XICS (POWER8) and XIVE (POWER9 and Power10) + * Multi processor support for many Power processors generations: + - POWER7, POWER7+ + - POWER8, POWER8NVL + - POWER9 + - Power10 + - Power11 + - Support for POWER5+ also exists, works with correct kernel/userspace + * Interrupt Controller + - XICS (POWER8) + - XIVE (Supported by below:) + - POWER9 + - Power10 + - Power11 * vPHB PCIe Host bridge. * vscsi and vnet devices, compatible with the same devices available on a PowerVM hypervisor with VIOS managing LPARs.
hw/ppc/spapr_cpu_core.c +1 -0
@@ -405,6 +405,7 @@ static const TypeInfo spapr_cpu_core_type_infos[] = {DEFINE_SPAPR_CPU_CORE_TYPE ("power9_v2.0" ),DEFINE_SPAPR_CPU_CORE_TYPE ("power9_v2.2" ),DEFINE_SPAPR_CPU_CORE_TYPE ("power10_v2.0" ), +DEFINE_SPAPR_CPU_CORE_TYPE ("power11_v2.0" ), #ifdef CONFIG_KVM DEFINE_SPAPR_CPU_CORE_TYPE("host"), #endif
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 17/67] ppc/spapr: remove deprecated machine pseries-2.1
In reply to Nicholas PigginFrom: Harsh Prateek Bora <[email protected]>
Commit 1392617d3576 intended to tag pseries-2.1 - 2.11 machines as deprecated with reasons mentioned in its commit log. Removing pseries-2.1 specific code with this patch for now.
--- hw/core/machine.c | 11 ----------- hw/ppc/spapr.c | 11 ----------- include/hw/boards.h | 3 --- 3 files changed, 25 deletions(-)
hw/core/machine.c +0 -11
@@ -297,17 +297,6 @@ const size_t hw_compat_2_3_len = G_N_ELEMENTS(hw_compat_2_3);GlobalProperty hw_compat_2_2[] = {};const size_t hw_compat_2_2_len =G_N_ELEMENTS (hw_compat_2_2); -GlobalProperty hw_compat_2_1[] = { - {"intel-hda" ,"old_msi_addr" ,"on" }, - {"VGA" ,"qemu-extended-regs" ,"off" }, - {"secondary-vga" ,"qemu-extended-regs" ,"off" }, - {"virtio-scsi-pci" ,"any_layout" ,"off" }, - {"usb-mouse" ,"usb_version" ,"1" }, - {"usb-kbd" ,"usb_version" ,"1" }, - {"virtio-pci" ,"virtio-pci-bus-master-bug-migration" ,"on" }, -}; -const size_t hw_compat_2_1_len =G_N_ELEMENTS (hw_compat_2_1); -MachineState *current_machine;static char *machine_get_kernel (Object *obj,Error **errp)
hw/ppc/spapr.c +0 -11
@@ -5381,17 +5381,6 @@ static void spapr_machine_2_2_class_options(MachineClass *mc) }DEFINE_SPAPR_MACHINE (2 ,2 ); -/* -* pseries-2.1 -*/ - -static void spapr_machine_2_1_class_options (MachineClass *mc) -{ -spapr_machine_2_2_class_options (mc); -compat_props_add (mc->compat_props, hw_compat_2_1, hw_compat_2_1_len); -} -DEFINE_SPAPR_MACHINE (2 ,1 ); -static void spapr_machine_register_types (void ) {type_register_static (&spapr_machine_info);
include/hw/boards.h +0 -3
@@ -828,7 +828,4 @@ extern const size_t hw_compat_2_3_len;extern GlobalProperty hw_compat_2_2[];extern const size_t hw_compat_2_2_len; -extern GlobalProperty hw_compat_2_1[]; -extern const size_t hw_compat_2_1_len; -#endif
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 64/67] hw/ppc: Consolidate ppc440 initial mapping creation functions
In reply to Nicholas PigginFrom: BALATON Zoltan <[email protected]>
Add a utility function and use it to replace very similar create_initial_mapping functions in 440 based machines.
--- hw/ppc/ppc440_bamboo.c | 28 +++----------------------- hw/ppc/ppc_booke.c | 10 ++++++++++ hw/ppc/sam460ex.c | 45 ++++++++++-------------------------------- hw/ppc/virtex_ml507.c | 28 +++----------------------- include/hw/ppc/ppc.h | 2 ++ 5 files changed, 28 insertions(+), 85 deletions(-)
hw/ppc/ppc440_bamboo.c +3 -25
@@ -110,29 +110,6 @@ static int bamboo_load_device_tree(MachineState *machine,return 0 ; } -/* Create reset TLB entries for BookE, spanning the 32bit addr space. */ -static void mmubooke_create_initial_mapping (CPUPPCState *env, -target_ulong va, -hwaddr pa) -{ -ppcemb_tlb_t *tlb = &env->tlb.tlbe[0 ]; - - tlb->attr =0 ; - tlb->prot =PAGE_VALID | ((PAGE_READ |PAGE_WRITE |PAGE_EXEC ) <<4 ); - tlb->size =1U <<31 ;/* up to 0x80000000 */ - tlb->EPN = va &TARGET_PAGE_MASK ; - tlb->RPN = pa &TARGET_PAGE_MASK ; - tlb->PID =0 ; - - tlb = &env->tlb.tlbe[1 ]; - tlb->attr =0 ; - tlb->prot =PAGE_VALID | ((PAGE_READ |PAGE_WRITE |PAGE_EXEC ) <<4 ); - tlb->size =1U <<31 ;/* up to 0xffffffff */ - tlb->EPN =0x80000000 &TARGET_PAGE_MASK ; - tlb->RPN =0x80000000 &TARGET_PAGE_MASK ; - tlb->PID =0 ; -} -static void main_cpu_reset (void *opaque) {PowerPCCPU *cpu = opaque;
@@ -143,8 +120,9 @@ static void main_cpu_reset(void *opaque) env->gpr[3 ] =FDT_ADDR ; env->nip = entry; -/* Create a mapping for the kernel. */ -mmubooke_create_initial_mapping (env,0 ,0 ); +/* Create a mapping spanning the 32bit addr space. */ +booke_set_tlb (&env->tlb.tlbe[0 ],0 ,0 ,1U <<31 ); +booke_set_tlb (&env->tlb.tlbe[1 ],0x80000000 ,0x80000000 ,1U <<31 ); }static void bamboo_init (MachineState *machine)
hw/ppc/ppc_booke.c +10 -0
@@ -31,6 +31,16 @@#include "hw/loader.h" #include "kvm_ppc.h" +void booke_set_tlb (ppcemb_tlb_t *tlb,target_ulong va,hwaddr pa, +target_ulong size) +{ + tlb->attr =0 ; + tlb->prot =PAGE_RWX <<4 |PAGE_VALID ; + tlb->size = size; + tlb->EPN = va &TARGET_PAGE_MASK ; + tlb->RPN = pa &TARGET_PAGE_MASK ; + tlb->PID =0 ; +}/* Timer Control Register */
hw/ppc/sam460ex.c +10 -35
68 lines not on this page · raw message
hw/ppc/virtex_ml507.c +3 -25
@@ -67,29 +67,6 @@ static struct boot_infovoid *vfdt; } boot_info; -/* Create reset TLB entries for BookE, spanning the 32bit addr space. */ -static void mmubooke_create_initial_mapping (CPUPPCState *env, -target_ulong va, -hwaddr pa) -{ -ppcemb_tlb_t *tlb = &env->tlb.tlbe[0 ]; - - tlb->attr =0 ; - tlb->prot =PAGE_VALID | ((PAGE_READ |PAGE_WRITE |PAGE_EXEC ) <<4 ); - tlb->size =1U <<31 ;/* up to 0x80000000 */ - tlb->EPN = va &TARGET_PAGE_MASK ; - tlb->RPN = pa &TARGET_PAGE_MASK ; - tlb->PID =0 ; - - tlb = &env->tlb.tlbe[1 ]; - tlb->attr =0 ; - tlb->prot =PAGE_VALID | ((PAGE_READ |PAGE_WRITE |PAGE_EXEC ) <<4 ); - tlb->size =1U <<31 ;/* up to 0xffffffff */ - tlb->EPN =0x80000000 &TARGET_PAGE_MASK ; - tlb->RPN =0x80000000 &TARGET_PAGE_MASK ; - tlb->PID =0 ; -} -static PowerPCCPU *ppc440_init_xilinx (const char *cpu_type,uint32_t sysclk) {PowerPCCPU *cpu;
@@ -139,8 +116,9 @@ static void main_cpu_reset(void *opaque) env->gpr[3 ] = bi->fdt; env->nip = bi->bootstrap_pc; -/* Create a mapping for the kernel. */ -mmubooke_create_initial_mapping (env,0 ,0 ); +/* Create a mapping spanning the 32bit addr space. */ +booke_set_tlb (&env->tlb.tlbe[0 ],0 ,0 ,1U <<31 ); +booke_set_tlb (&env->tlb.tlbe[1 ],0x80000000 ,0x80000000 ,1U <<31 ); env->gpr[6 ] =tswap32 (EPAPR_MAGIC ); env->gpr[7 ] = bi->ima_size; }
include/hw/ppc/ppc.h +2 -0
@@ -119,6 +119,8 @@ enum {#ifndef CONFIG_USER_ONLY void booke206_set_tlb (ppcmas_tlb_t *tlb,target_ulong va,hwaddr pa,hwaddr len); +void booke_set_tlb (ppcemb_tlb_t *tlb,target_ulong va,hwaddr pa, +target_ulong size);#endif /* ppc_booke.c */
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 56/67] ppc/xive2: Change context/ring specific functions to be generic
In reply to Nicholas PigginFrom: Michael Kowal <[email protected]>
Some the functions that have been created are specific to a ring or context. Some of these same functions are being changed to operate on any ring/context. This will simplify the next patch sets that are adding additional ring/context operations.
--- hw/intc/xive.c | 6 +++--- hw/intc/xive2.c | 20 ++++++++++---------- include/hw/ppc/xive.h | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-)
hw/intc/xive.c +3 -3
@@ -114,7 +114,7 @@ static void xive_tctx_notify(XiveTCTX *tctx, uint8_t ring) } } -void xive_tctx_reset_os_signal (XiveTCTX *tctx) +void xive_tctx_reset_signal (XiveTCTX *tctx,uint8_t ring) {/* * Lower the External interrupt. Used when pulling an OS
@@ -122,7 +122,7 @@ void xive_tctx_reset_os_signal(XiveTCTX *tctx)* context. It should be raised again when re-pushing the OS * context. */ -qemu_irq_lower (xive_tctx_output (tctx,TM_QW1_OS )); +qemu_irq_lower (xive_tctx_output (tctx, ring)); }static void xive_tctx_set_cppr (XiveTCTX *tctx,uint8_t ring,uint8_t cppr)
@@ -424,7 +424,7 @@ static uint64_t xive_tm_pull_os_ctx(XivePresenter *xptr, XiveTCTX *tctx, qw1w2_new =xive_set_field32 (TM_QW1W2_VO , qw1w2,0 );xive_tctx_set_os_cam (tctx, qw1w2_new); -xive_tctx_reset_os_signal (tctx); +xive_tctx_reset_signal (tctx,TM_QW1_OS );return qw1w2; }
hw/intc/xive2.c +10 -10
@@ -270,13 +270,14 @@ static void xive2_end_enqueue(Xive2End *end, uint32_t data)* the NVP by changing the H bit while the context is enabled */ -static void xive2_tctx_save_os_ctx (Xive2Router *xrtr,XiveTCTX *tctx, -uint8_t nvp_blk,uint32_t nvp_idx) +static void xive2_tctx_save_ctx (Xive2Router *xrtr,XiveTCTX *tctx, +uint8_t nvp_blk,uint32_t nvp_idx, +uint8_t ring) {CPUPPCState *env = &POWERPC_CPU (tctx->cs)->env;uint32_t pir = env->spr_cb[SPR_PIR ].default_value;Xive2Nvp nvp; -uint8_t *regs = &tctx->regs[TM_QW1_OS ]; +uint8_t *regs = &tctx->regs[ring];if (xive2_router_get_nvp (xrtr, nvp_blk, nvp_idx, &nvp)) { qemu_log_mask(LOG_GUEST_ERROR, "XIVE: No NVP %x/%x\n",
@@ -321,8 +322,8 @@ static void xive2_tctx_save_os_ctx(Xive2Router *xrtr, XiveTCTX *tctx,xive2_router_write_nvp (xrtr, nvp_blk, nvp_idx, &nvp,1 ); } -static void xive2_os_cam_decode (uint32_t cam,uint8_t *nvp_blk, -uint32_t *nvp_idx,bool *vo,bool *ho) +static void xive2_cam_decode (uint32_t cam,uint8_t *nvp_blk, +uint32_t *nvp_idx,bool *vo,bool *ho) { *nvp_blk =xive2_nvp_blk (cam); *nvp_idx =xive2_nvp_idx (cam);
@@ -330,7 +331,6 @@ static void xive2_os_cam_decode(uint32_t cam, uint8_t *nvp_blk, *ho = !!(cam &TM2_QW1W2_HO ); } -/* * Encode the HW CAM line with 7bit or 8bit thread id. The thread id * width and block id width is configurable at the IC level.
@@ -363,7 +363,7 @@ uint64_t xive2_tm_pull_os_ctx(XivePresenter *xptr, XiveTCTX *tctx,bool vo;bool do_save; -xive2_os_cam_decode (cam, &nvp_blk, &nvp_idx, &vo, &do_save); +xive2_cam_decode (cam, &nvp_blk, &nvp_idx, &vo, &do_save);if (!vo) { qemu_log_mask(LOG_GUEST_ERROR, "XIVE: pulling invalid NVP %x/%x !?\n",
@@ -375,10 +375,10 @@ uint64_t xive2_tm_pull_os_ctx(XivePresenter *xptr, XiveTCTX *tctx,memcpy (&tctx->regs[TM_QW1_OS +TM_WORD2 ], &qw1w2_new,4 );if (xive2_router_get_config (xrtr) &XIVE2_VP_SAVE_RESTORE && do_save) { -xive2_tctx_save_os_ctx (xrtr, tctx, nvp_blk, nvp_idx); +xive2_tctx_save_ctx (xrtr, tctx, nvp_blk, nvp_idx,TM_QW1_OS ); } -xive_tctx_reset_os_signal (tctx); +xive_tctx_reset_signal (tctx,TM_QW1_OS );return qw1w2; }
@@ -573,7 +573,7 @@ void xive2_tm_push_os_ctx(XivePresenter *xptr, XiveTCTX *tctx,bool vo;bool do_restore; -xive2_os_cam_decode (cam, &nvp_blk, &nvp_idx, &vo, &do_restore); +xive2_cam_decode (cam, &nvp_blk, &nvp_idx, &vo, &do_restore);/* First update the thead context */ memcpy (&tctx->regs[TM_QW1_OS +TM_WORD2 ], &qw1w2,4 );
include/hw/ppc/xive.h +1 -1
@@ -533,7 +533,7 @@ Object *xive_tctx_create(Object *cpu, XivePresenter *xptr, Error **errp);void xive_tctx_reset (XiveTCTX *tctx);void xive_tctx_destroy (XiveTCTX *tctx);void xive_tctx_ipb_update (XiveTCTX *tctx,uint8_t ring,uint8_t ipb); -void xive_tctx_reset_os_signal (XiveTCTX *tctx); +void xive_tctx_reset_signal (XiveTCTX *tctx,uint8_t ring);/* * KVM XIVE device helpers
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 12/67] hw/ssi/pnv_spi: Match _xfer_buffer_free() with _xfer_buffer_new()
In reply to Nicholas PigginFrom: Philippe Mathieu-Daudé <[email protected]>
pnv_spi_xfer_buffer_new() allocates %payload using g_malloc0(), and pnv_spi_xfer_buffer_write_ptr() allocates %payload->data using g_realloc(). Use the API equivalent g_free() to release the buffers.
--- hw/ssi/pnv_spi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/ssi/pnv_spi.c +2 -2
@@ -53,8 +53,8 @@ static PnvXferBuffer *pnv_spi_xfer_buffer_new(void)static void pnv_spi_xfer_buffer_free (PnvXferBuffer *payload) { -free (payload->data); -free (payload); +g_free (payload->data); +g_free (payload); } static uint8_t *pnv_spi_xfer_buffer_write_ptr(PnvXferBuffer *payload,
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 32/67] target/ppc: Fix regression due to Power10 and Power11 having same PCR
In reply to Nicholas PigginFrom: Aditya Gupta <[email protected]>
Power11 has the same PCR (Processor Compatibility Register) value, as Power10.
Due to this, QEMU considers Power11 as a valid compat-mode for Power10, ie. earlier it was possible to run QEMU with
'-M pseries,max-compat-mode=power11 --cpu power10'
Same PCR also introduced a regression where -M pseries --cpu power10 boots as Power11 (ie. logical PVR is of Power11, even though PVR is Power10). The regression was due to 'do_client_architecture_support' checking for valid compat modes and finding Power11 to be a valid compat mode for Power10 (it happens even without passing 'max-compat-mode' explicitly).
Fix compat-mode issue and regression, by ensuring a future Power processor (with a higher logical_pvr value, eg. P11) cannot be valid compat-mode for an older Power processor (eg. P10)
--- target/ppc/compat.c | 4 ++++ 1 file changed, 4 insertions(+)
target/ppc/compat.c +4 -0
@@ -132,6 +132,10 @@ static bool pcc_compat(PowerPCCPUClass *pcc, uint32_t compat_pvr,/* Outside specified range */ return false; } +if (compat->pvr > pcc->spapr_logical_pvr) { +/* Older CPU cannot support a newer processor's compat mode */ +return false; + }if (!(pcc->pcr_supported & compat->pcr_level)) {/* Not supported by this CPU */ return false;
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 58/67] pnv/xive: Add special handling for pool targets
In reply to Nicholas PigginFrom: Glenn Miles <[email protected]>
Hypervisor "pool" targets do not get their own interrupt line and instead must share an interrupt line with the hypervisor "physical" targets. This also means that the pool ring must use some of the registers from the physical ring in the TIMA. Specifically, the NSR, PIPR and CPPR registers:
NSR = Notification Source Register
PIPR = Post Interrupt Priority Register
CPPR = Current Processor Priority Register
The NSR specifies that there is an active interrupt. The CPPR specifies the priority of the context and the PIPR specifies the priority of the interrupt. For an interrupt to be presented to a context, the priority of the interrupt must be higher than the priority of the context it is interrupting (value must be lower).
The existing code was not aware of the sharing of these registers. This commit adds that support.
--- hw/intc/xive.c | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-)
hw/intc/xive.c +26 -10
@@ -74,33 +74,49 @@ static uint64_t xive_tctx_accept(XiveTCTX *tctx, uint8_t ring)if (regs[TM_NSR ] & mask) {uint8_t cppr = regs[TM_PIPR ]; +uint8_t alt_ring; +uint8_t *alt_regs; + +/* POOL interrupt uses IPB in QW2, POOL ring */ +if ((ring ==TM_QW3_HV_PHYS ) && (nsr & (TM_QW3_NSR_HE_POOL <<6 ))) { + alt_ring =TM_QW2_HV_POOL ; + }else { + alt_ring = ring; + } + alt_regs = &tctx->regs[alt_ring]; regs[TM_CPPR ] = cppr;/* Reset the pending buffer bit */ - regs[TM_IPB ] &= ~xive_priority_to_ipb (cppr); - regs[TM_PIPR ] =ipb_to_pipr (regs[TM_IPB ]); + alt_regs[TM_IPB ] &= ~xive_priority_to_ipb (cppr); + regs[TM_PIPR ] =ipb_to_pipr (alt_regs[TM_IPB ]);/* Drop Exception bit */ regs[TM_NSR ] &= ~mask; -trace_xive_tctx_accept (tctx->cs->cpu_index, ring, - regs[TM_IPB ], regs[TM_PIPR ], +trace_xive_tctx_accept (tctx->cs->cpu_index, alt_ring, + alt_regs[TM_IPB ], regs[TM_PIPR ], regs[TM_CPPR ], regs[TM_NSR ]); } -return (nsr <<8 ) | regs[TM_CPPR ]; +return ((uint64_t )nsr <<8 ) | regs[TM_CPPR ]; }static void xive_tctx_notify (XiveTCTX *tctx,uint8_t ring) { +/* HV_POOL ring uses HV_PHYS NSR, CPPR and PIPR registers */ +uint8_t alt_ring = (ring ==TM_QW2_HV_POOL ) ?TM_QW3_HV_PHYS : ring; +uint8_t *alt_regs = &tctx->regs[alt_ring];uint8_t *regs = &tctx->regs[ring]; -if (regs[TM_PIPR ] < regs[TM_CPPR ]) { +if (alt_regs[TM_PIPR ] < alt_regs[TM_CPPR ]) {switch (ring) {case TM_QW1_OS : regs[TM_NSR ] |=TM_QW1_NSR_EO ;break ; +case TM_QW2_HV_POOL : + alt_regs[TM_NSR ] = (TM_QW3_NSR_HE_POOL <<6 ); +break ;case TM_QW3_HV_PHYS : regs[TM_NSR ] |= (TM_QW3_NSR_HE_PHYS <<6 );break ;
@@ -108,8 +124,8 @@ static void xive_tctx_notify(XiveTCTX *tctx, uint8_t ring)g_assert_not_reached (); }trace_xive_tctx_notify (tctx->cs->cpu_index, ring, - regs[TM_IPB ], regs[TM_PIPR ], - regs[TM_CPPR ], regs[TM_NSR ]); + regs[TM_IPB ], alt_regs[TM_PIPR ], + alt_regs[TM_CPPR ], alt_regs[TM_NSR ]);qemu_irq_raise (xive_tctx_output (tctx, ring)); } }
@@ -217,14 +233,14 @@ static uint64_t xive_tm_vt_poll(XivePresenter *xptr, XiveTCTX *tctx,static const uint8_t xive_tm_hw_view[] = {3 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,3 ,3 ,3 ,3 ,0 ,0 ,0 ,0 ,/* QW-0 User */ 3 ,3 ,3 ,3 ,3 ,3 ,0 ,2 ,3 ,3 ,3 ,3 ,0 ,0 ,0 ,0 ,/* QW-1 OS */ -0 ,0 ,3 ,3 ,0 ,0 ,0 ,0 ,3 ,3 ,3 ,3 ,0 ,0 ,0 ,0 ,/* QW-2 POOL */ +0 ,0 ,3 ,3 ,0 ,3 ,3 ,0 ,3 ,3 ,3 ,3 ,0 ,0 ,0 ,0 ,/* QW-2 POOL */ 3 ,3 ,3 ,3 ,0 ,3 ,0 ,2 ,3 ,0 ,0 ,3 ,3 ,3 ,3 ,0 ,/* QW-3 PHYS */ };static const uint8_t xive_tm_hv_view[] = {3 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,3 ,3 ,3 ,3 ,0 ,0 ,0 ,0 ,/* QW-0 User */ 3 ,3 ,3 ,3 ,3 ,3 ,0 ,2 ,3 ,3 ,3 ,3 ,0 ,0 ,0 ,0 ,/* QW-1 OS */ -0 ,0 ,3 ,3 ,0 ,0 ,0 ,0 ,0 ,3 ,3 ,3 ,0 ,0 ,0 ,0 ,/* QW-2 POOL */ +0 ,0 ,3 ,3 ,0 ,3 ,3 ,0 ,0 ,3 ,3 ,3 ,0 ,0 ,0 ,0 ,/* QW-2 POOL */ 3 ,3 ,3 ,3 ,0 ,3 ,0 ,2 ,3 ,0 ,0 ,3 ,0 ,0 ,0 ,0 ,/* QW-3 PHYS */ };
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 60/67] pnv/xive2: TIMA support for 8-byte OS context push for PHYP
In reply to Nicholas PigginFrom: Glenn Miles <[email protected]>
PHYP uses 8-byte writes to the 2nd doubleword of the OS context line when dispatching an OS level virtual processor. This support was not used by OPAL/Linux and so was never added.
Without this support, the XIVE code doesn't notice that a new context is being pushed and fails to check for unpresented pending interrupts for that context.
--- hw/intc/xive.c | 2 ++ hw/intc/xive2.c | 24 +++++++++++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-)
hw/intc/xive.c +2 -0
@@ -596,6 +596,8 @@ static const XiveTmOp xive2_tm_operations[] = { NULL }, {XIVE_TM_HV_PAGE ,TM_QW1_OS +TM_WORD2 ,4 , xive2_tm_push_os_ctx, NULL }, + { XIVE_TM_HV_PAGE, TM_QW1_OS + TM_WORD2, 8, xive2_tm_push_os_ctx, + NULL }, { XIVE_TM_OS_PAGE, TM_QW1_OS + TM_LGS, 1, xive_tm_set_os_lgs, NULL }, { XIVE_TM_HV_PAGE, TM_QW3_HV_PHYS + TM_CPPR, 1, xive_tm_set_hv_cppr,
hw/intc/xive2.c +19 -5
@@ -597,17 +597,31 @@ static void xive2_tctx_need_resend(Xive2Router *xrtr, XiveTCTX *tctx,void xive2_tm_push_os_ctx (XivePresenter *xptr,XiveTCTX *tctx,hwaddr offset,uint64_t value,unsigned size) { -uint32_t cam = value; -uint32_t qw1w2 =cpu_to_be32 (cam); +uint32_t cam; +uint32_t qw1w2; +uint64_t qw1dw1;uint8_t nvp_blk;uint32_t nvp_idx;bool vo;bool do_restore; -xive2_cam_decode (cam, &nvp_blk, &nvp_idx, &vo, &do_restore); -/* First update the thead context */ -memcpy (&tctx->regs[TM_QW1_OS +TM_WORD2 ], &qw1w2,4 ); +switch (size) { +case 4 : + cam = value; + qw1w2 =cpu_to_be32 (cam); +memcpy (&tctx->regs[TM_QW1_OS +TM_WORD2 ], &qw1w2,4 ); +break ; +case 8 : + cam = value >>32 ; + qw1dw1 =cpu_to_be64 (value); +memcpy (&tctx->regs[TM_QW1_OS +TM_WORD2 ], &qw1dw1,8 ); +break ; +default : +g_assert_not_reached (); + } + +xive2_cam_decode (cam, &nvp_blk, &nvp_idx, &vo, &do_restore);/* Check the interrupt pending bits */ if (vo) {
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 42/67] target/ppc: combine multiple ail checks into one
In reply to Nicholas PigginFrom: Harsh Prateek Bora <[email protected]>
ppc_excp_apply_ail has multiple if-checks for ail which is un-necessary. Combine them as appropriate.
--- target/ppc/excp_helper.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
target/ppc/excp_helper.c +2 -8
@@ -324,10 +324,7 @@ static void ppc_excp_apply_ail(PowerPCCPU *cpu, int excp, target_ulong msr, } ail = (env->spr[SPR_LPCR ] &LPCR_AIL ) >>LPCR_AIL_SHIFT ; -if (ail ==0 ) { -return ; - } -if (ail ==1 ) { +if (ail ==0 || ail ==1 ) {/* AIL=1 is reserved, treat it like AIL=0 */ return ; }
@@ -351,10 +348,7 @@ static void ppc_excp_apply_ail(PowerPCCPU *cpu, int excp, target_ulong msr, }else { ail = (env->spr[SPR_LPCR ] &LPCR_AIL ) >>LPCR_AIL_SHIFT ; } -if (ail ==0 ) { -return ; - } -if (ail ==1 || ail ==2 ) { +if (ail ==0 || ail ==1 || ail ==2 ) {/* AIL=1 and AIL=2 are reserved, treat them like AIL=0 */ return ; }
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 44/67] spapr: nested: Add support for DPDES SPR in GSB for TCG L0
In reply to Nicholas PigginFrom: Amit Machhiwal <[email protected]>
The DPDES support for doorbell emulation and handling for KVM on PAPR guests was added in Linux via [1]. Subsequently, a new GSB (Guest State Buffer) element for DPDES was added in Linux; the same has been missing in TCG L0 implementation. Add support for DPDES register's APIv2 GSB element and required handling in spapr_nested.c.
Currently, booting a KVM guest inside a QEMU TCG guest fails with the following crash. The crash occurs while handling the GUEST_RUN_VCPU hcall made in TCG L0. In the hcall handling path, map_and_getset_state() calls getset_state(), which, in turn, calls guest_state_request_check() to validate the GSR (Guest State Request) elements. During this process, guest_state_request_check() iterates over the GSR elements and receives a NULL return code from guest_state_element_type_find() for the type variable corresponding to the DPDES register's elemetn ID (which was unknown to TCG L0). Subsequently, getset_state() returns H_P3, ultimately leading to the hcall failure and causing the KVM guest to crash.
KVM: unknown exit, hardware reason ffffffffffffffea [ ... KVM register dump ... ]
Fix this by adding the required support in TCG L0 implementation of APIv2.
[1] https://lore.kernel.org/all/[email protected]/
--- hw/ppc/spapr_nested.c | 1 + include/hw/ppc/spapr_nested.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-)
hw/ppc/spapr_nested.c +1 -0
@@ -982,6 +982,7 @@ struct guest_state_element_type guest_state_element_types[] = {GUEST_STATE_ELEMENT_ENV_DW (GSB_VCPU_SPR_FSCR , fscr),GUEST_STATE_ELEMENT_ENV_W (GSB_VCPU_SPR_PSPB , pspb),GUEST_STATE_ELEMENT_ENV_DW (GSB_VCPU_SPR_CTRL , ctrl), +GUEST_STATE_ELEMENT_ENV_DW (GSB_VCPU_SPR_DPDES , dpdes),GUEST_STATE_ELEMENT_ENV_W (GSB_VCPU_SPR_VRSAVE , vrsave),GUEST_STATE_ELEMENT_ENV_DW (GSB_VCPU_SPR_DAR , dar), GUEST_STATE_ELEMENT_ENV_W(GSB_VCPU_SPR_DSISR, dsisr),
include/hw/ppc/spapr_nested.h +2 -1
@@ -99,7 +99,8 @@#define GSB_VCPU_SPR_HASHKEYR 0x1050#define GSB_VCPU_SPR_HASHPKEYR 0x1051#define GSB_VCPU_SPR_CTRL 0x1052 -/* RESERVED 0x1053 - 0x1FFF */ +#define GSB_VCPU_SPR_DPDES 0x1053 +/* RESERVED 0x1054 - 0x1FFF */ #define GSB_VCPU_SPR_CR 0x2000#define GSB_VCPU_SPR_PIDR 0x2001#define GSB_VCPU_SPR_DSISR 0x2002
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 63/67] hw/ppc: Consolidate e500 initial mapping creation functions
In reply to Nicholas PigginFrom: BALATON Zoltan <[email protected]>
Add booke206_set_tlb() utility function and use it to replace very similar create_initial_mapping functions in e500 machines.
--- hw/ppc/e500.c | 41 +++++++++++++++++++---------------------- hw/ppc/e500.h | 2 -- hw/ppc/ppce500_spin.c | 30 +++++++++--------------------- include/hw/ppc/ppc.h | 5 +++++ 4 files changed, 33 insertions(+), 45 deletions(-)
hw/ppc/e500.c +19 -22
@@ -721,11 +721,21 @@ static int ppce500_prep_device_tree(PPCE500MachineState *machine, kernel_base, kernel_size, true); } -hwaddr booke206_page_size_to_tlb (uint64_t size) +static hwaddr booke206_page_size_to_tlb (uint64_t size) {return 63 -clz64 (size / KiB); } +void booke206_set_tlb (ppcmas_tlb_t *tlb,target_ulong va,hwaddr pa, +hwaddr len) +{ + tlb->mas1 =booke206_page_size_to_tlb (len) <<MAS1_TSIZE_SHIFT ; + tlb->mas1 |=MAS1_VALID ; + tlb->mas2 = va &TARGET_PAGE_MASK ; + tlb->mas7_3 = pa &TARGET_PAGE_MASK ; + tlb->mas7_3 |=MAS3_UR |MAS3_UW |MAS3_UX |MAS3_SR |MAS3_SW |MAS3_SX ; +} +static int booke206_initial_map_tsize (CPUPPCState *env) {struct boot_info *bi = env->load_info;
@@ -751,25 +761,6 @@ static uint64_t mmubooke_initial_mapsize(CPUPPCState *env)return (1ULL <<10 << tsize); } -/* Create -kernel TLB entries for BookE. */ -static void mmubooke_create_initial_mapping (CPUPPCState *env) -{ -ppcmas_tlb_t *tlb =booke206_get_tlbm (env,1 ,0 ,0 ); -hwaddr size; -int ps; - - ps =booke206_initial_map_tsize (env); - size = (ps <<MAS1_TSIZE_SHIFT ); - tlb->mas1 =MAS1_VALID | size; - tlb->mas2 =0 ; - tlb->mas7_3 =0 ; - tlb->mas7_3 |=MAS3_UR |MAS3_UW |MAS3_UX |MAS3_SR |MAS3_SW |MAS3_SX ; - -#ifdef CONFIG_KVM - env->tlb_dirty = true; -#endif -} -static void ppce500_cpu_reset_sec (void *opaque) {PowerPCCPU *cpu = opaque;
@@ -786,6 +777,8 @@ static void ppce500_cpu_reset(void *opaque)CPUState *cs =CPU (cpu);CPUPPCState *env = &cpu->env;struct boot_info *bi = env->load_info; +uint64_t map_size =mmubooke_initial_mapsize (env); +ppcmas_tlb_t *tlb =booke206_get_tlbm (env,1 ,0 ,0 );cpu_reset (cs);
@@ -796,11 +789,15 @@ static void ppce500_cpu_reset(void *opaque) env->gpr[4 ] =0 ; env->gpr[5 ] =0 ; env->gpr[6 ] =EPAPR_MAGIC ; - env->gpr[7 ] =mmubooke_initial_mapsize (env); + env->gpr[7 ] = map_size; env->gpr[8 ] =0 ; env->gpr[9 ] =0 ; env->nip = bi->entry; -mmubooke_create_initial_mapping (env); +/* create initial mapping */ +booke206_set_tlb (tlb,0 ,0 , map_size); +#ifdef CONFIG_KVM + env->tlb_dirty = true; +#endif } static DeviceState *ppce500_init_mpic_qemu(PPCE500MachineState *pms,
hw/ppc/e500.h +0 -2
@@ -41,8 +41,6 @@ struct PPCE500MachineClass {void ppce500_init (MachineState *machine); -hwaddr booke206_page_size_to_tlb (uint64_t size); -#define TYPE_PPCE500_MACHINE "ppce500-base-machine"OBJECT_DECLARE_TYPE (PPCE500MachineState, PPCE500MachineClass,PPCE500_MACHINE )
hw/ppc/ppce500_spin.c +9 -21
@@ -33,6 +33,7 @@#include "hw/hw.h" #include "hw/sysbus.h" #include "sysemu/hw_accel.h" +#include "hw/ppc/ppc.h" #include "e500.h" #include "qom/object.h"
@@ -70,30 +71,12 @@ static void spin_reset(DeviceState *dev) } } -static void mmubooke_create_initial_mapping (CPUPPCState *env, -target_ulong va, -hwaddr pa, -hwaddr len) -{ -ppcmas_tlb_t *tlb =booke206_get_tlbm (env,1 ,0 ,1 ); -hwaddr size; - - size = (booke206_page_size_to_tlb (len) <<MAS1_TSIZE_SHIFT ); - tlb->mas1 =MAS1_VALID | size; - tlb->mas2 = (va &TARGET_PAGE_MASK ) |MAS2_M ; - tlb->mas7_3 = pa &TARGET_PAGE_MASK ; - tlb->mas7_3 |=MAS3_UR |MAS3_UW |MAS3_UX |MAS3_SR |MAS3_SW |MAS3_SX ; -#ifdef CONFIG_KVM - env->tlb_dirty = true; -#endif -} -static void spin_kick (CPUState *cs,run_on_cpu_data data) {CPUPPCState *env =cpu_env (cs);SpinInfo *curspin = data.host_ptr; -hwaddr map_size =64 * MiB; -hwaddr map_start; +hwaddr map_start, map_size =64 * MiB; +ppcmas_tlb_t *tlb =booke206_get_tlbm (env,1 ,0 ,1 );cpu_synchronize_state (cs);stl_p (&curspin->pir, env->spr[SPR_BOOKE_PIR ]);
@@ -107,7 +90,12 @@ static void spin_kick(CPUState *cs, run_on_cpu_data data) env->gpr[9 ] =0 ; map_start =ldq_p (&curspin->addr) & ~(map_size -1 ); -mmubooke_create_initial_mapping (env,0 , map_start, map_size); +/* create initial mapping */ +booke206_set_tlb (tlb,0 , map_start, map_size); + tlb->mas2 |=MAS2_M ; +#ifdef CONFIG_KVM + env->tlb_dirty = true; +#endif cs->halted =0 ; cs->exception_index =-1 ;
include/hw/ppc/ppc.h +5 -0
@@ -116,6 +116,11 @@ enum {#define PPC_SERIAL_MM_BAUDBASE 399193 +#ifndef CONFIG_USER_ONLY +void booke206_set_tlb (ppcmas_tlb_t *tlb,target_ulong va,hwaddr pa, +hwaddr len); +#endif +/* ppc_booke.c */ void ppc_booke_timers_init (PowerPCCPU *cpu,uint32_t freq,uint32_t flags);#endif
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 15/67] tests/tcg: Replace -mpower8-vector with -mcpu=power8
In reply to Nicholas PigginFrom: Ilya Leoshkevich <[email protected]>
[1] deprecated -mpower8-vector, resulting in:
powerpc64-linux-gnu-gcc: warning: switch '-mpower8-vector' is no longer supported
qemu/tests/tcg/ppc64/vsx_f2i_nan.c:4:15: error: expected ';' before 'float'
4 | typedef vector float vsx_float32_vec_t;
| ^~~~~~Use -mcpu=power8 instead. In order to properly verify that this works, one needs a big-endian (the minimum supported CPU for 64-bit little-endian is power8 anyway) GCC configured with --enable-checking (see GCC commit e154242724b0 ("[RS6000] Don't pass -many to the assembler").
[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109987
--- tests/tcg/ppc64/Makefile.target | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
tests/tcg/ppc64/Makefile.target +5 -5
@@ -6,7 +6,7 @@ VPATH += $(SRC_PATH)/tests/tcg/ppc64 config-cc.mak: Makefile $(quiet-@)( \ - $(call cc-option,-mpower8-vector, CROSS_CC_HAS_POWER8_VECTOR); \ + $(call cc-option,-mcpu=power8, CROSS_CC_HAS_CPU_POWER8); \ $(call cc-option,-mpower10, CROSS_CC_HAS_POWER10)) 3> config-cc.mak -include config-cc.mak
@@ -23,15 +23,15 @@ run-threadcount: threadcount run-plugin-threadcount-with-%: $(call skip-test, $<, "BROKEN (flaky with clang) ") -ifneq ($(CROSS_CC_HAS_POWER8_VECTOR),) +ifneq ($(CROSS_CC_HAS_CPU_POWER8),) PPC64_TESTS=bcdsub non_signalling_xscv endif -$(PPC64_TESTS): CFLAGS += -mpower8-vector +$(PPC64_TESTS): CFLAGS += -mcpu=power8 -ifneq ($(CROSS_CC_HAS_POWER8_VECTOR),) +ifneq ($(CROSS_CC_HAS_CPU_POWER8),) PPC64_TESTS += vsx_f2i_nan endif -vsx_f2i_nan: CFLAGS += -mpower8-vector -I$(SRC_PATH)/include +vsx_f2i_nan: CFLAGS += -mcpu=power8 -I$(SRC_PATH)/include PPC64_TESTS += mtfsf PPC64_TESTS += mffsce
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 23/67] ppc/spapr: remove deprecated machine pseries-2.7
In reply to Nicholas PigginFrom: Harsh Prateek Bora <[email protected]>
Commit 1392617d3576 intended to tag pseries-2.1 - 2.11 machines as deprecated with reasons mentioned in its commit log. Removing pseries-2.7 specific code with this patch for now.
While at it, also remove pre-2.8-migration and pci/mmio hacks introduced for backward compatibility.
--- hw/ppc/spapr.c | 75 ------------------------------------- hw/ppc/spapr_pci.c | 57 ++++------------------------ include/hw/pci-host/spapr.h | 4 -- target/ppc/cpu.h | 5 --- target/ppc/cpu_init.c | 1 - target/ppc/machine.c | 52 ------------------------- 6 files changed, 7 insertions(+), 187 deletions(-)
hw/ppc/spapr.c +0 -75
@@ -5203,81 +5203,6 @@ static void spapr_machine_2_8_class_options(MachineClass *mc)DEFINE_SPAPR_MACHINE (2 ,8 ); -/* -* pseries-2.7 -*/ - -static bool phb_placement_2_7 (SpaprMachineState *spapr,uint32_t index, -uint64_t *buid,hwaddr *pio, -hwaddr *mmio32,hwaddr *mmio64, -unsigned n_dma,uint32_t *liobns,Error **errp) -{ -/* Legacy PHB placement for pseries-2.7 and earlier machine types */ -const uint64_t base_buid =0x800000020000000ULL ; -const hwaddr phb_spacing =0x1000000000ULL ;/* 64 GiB */ -const hwaddr mmio_offset =0xa0000000 ;/* 2 GiB + 512 MiB */ -const hwaddr pio_offset =0x80000000 ;/* 2 GiB */ -const uint32_t max_index =255 ; -const hwaddr phb0_alignment =0x10000000000ULL ;/* 1 TiB */ - -uint64_t ram_top =MACHINE (spapr)->ram_size; -hwaddr phb0_base, phb_base; -int i; - -/* Do we have device memory? */ -if (MACHINE (spapr)->device_memory) { -/* Can't just use maxram_size, because there may be an -* alignment gap between normal and device memory regions -*/ - ram_top =MACHINE (spapr)->device_memory->base + -memory_region_size (&MACHINE (spapr)->device_memory->mr); - } - - phb0_base =QEMU_ALIGN_UP (ram_top, phb0_alignment); - -if (index > max_index) { -error_setg (errp,"\"index\" for PAPR PHB is too large (max %u)" , - max_index); -return false; - } - - *buid = base_buid + index; -for (i =0 ; i < n_dma; ++i) { - liobns[i] =SPAPR_PCI_LIOBN (index, i); - } - - phb_base = phb0_base + index * phb_spacing; - *pio = phb_base + pio_offset; - *mmio32 = phb_base + mmio_offset; -/* -* We don't set the 64-bit MMIO window, relying on the PHB's -* fallback behaviour of automatically splitting a large "32-bit" -* window into contiguous 32-bit and 64-bit windows -*/ - -return true; -} - -static void spapr_machine_2_7_class_options (MachineClass *mc) -{ -SpaprMachineClass *smc =SPAPR_MACHINE_CLASS (mc); -static GlobalProperty compat[] = { - {TYPE_SPAPR_PCI_HOST_BRIDGE ,"mem_win_size" ,"0xf80000000" , }, - {TYPE_SPAPR_PCI_HOST_BRIDGE ,"mem64_win_size" ,"0" , }, - {TYPE_POWERPC_CPU ,"pre-2.8-migration" ,"on" , }, - {TYPE_SPAPR_PCI_HOST_BRIDGE ,"pre-2.8-migration" ,"on" , }, - }; - -spapr_machine_2_8_class_options (mc); - mc->default_cpu_type =POWERPC_CPU_TYPE_NAME ("power7_v2.3" ); - mc->default_machine_opts ="modern-hotplug-events=off" ; -compat_props_add (mc->compat_props, hw_compat_2_7, hw_compat_2_7_len); -compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); - smc->phb_placement = phb_placement_2_7; -} - -DEFINE_SPAPR_MACHINE (2 ,7 ); -static void spapr_machine_register_types (void ) {type_register_static (&spapr_machine_info);
hw/ppc/spapr_pci.c +7 -50
89 lines not on this page · raw message
include/hw/pci-host/spapr.h +0 -4
@@ -83,10 +83,6 @@ struct SpaprPhbState {bool pcie_ecs;/* Allow access to PCIe extended config space? */ /* Fields for migration compatibility hacks */ -bool pre_2_8_migration; -uint32_t mig_liobn; -hwaddr mig_mem_win_addr, mig_mem_win_size; -hwaddr mig_io_win_addr, mig_io_win_size;bool pre_5_1_assoc; };
target/ppc/cpu.h +0 -5
@@ -1457,11 +1457,6 @@ struct ArchCPU {opc_handler_t *opcodes[PPC_CPU_OPCODES_LEN ];/* Fields related to migration compatibility hacks */ -bool pre_2_8_migration; -target_ulong mig_msr_mask; -uint64_t mig_insns_flags; -uint64_t mig_insns_flags2; -uint32_t mig_nb_BATs;bool pre_2_10_migration;bool pre_3_0_migration;int32_t mig_slb_nr;
target/ppc/cpu_init.c +0 -1
@@ -7452,7 +7452,6 @@ static void ppc_disas_set_info(CPUState *cs, disassemble_info *info) }static Property ppc_cpu_properties[] = { -DEFINE_PROP_BOOL ("pre-2.8-migration" , PowerPCCPU, pre_2_8_migration, false),DEFINE_PROP_BOOL ("pre-2.10-migration" , PowerPCCPU, pre_2_10_migration, false), DEFINE_PROP_BOOL("pre-3.0-migration", PowerPCCPU, pre_3_0_migration,
target/ppc/machine.c +0 -52
76 lines not on this page · raw message
Signature · 1 line
2.45.2
Nicholas Piggin
reviewer[PULL 62/67] tests/qtest: Add XIVE tests for the powernv10 machine
In reply to Nicholas PigginFrom: Frederic Barrat <[email protected]>
These XIVE tests include:
- General interrupt IRQ tests that:
- enable and trigger an interrupt
- acknowledge the interrupt
- end of interrupt processing
- Test the Pull Thread Context to Odd Thread Reporting Line
- Test the different cache flush inject and queue sync inject operations
--- MAINTAINERS | 1 + tests/qtest/meson.build | 2 + tests/qtest/pnv-xive2-common.c | 190 ++++++++++++++++ tests/qtest/pnv-xive2-common.h | 111 ++++++++++ tests/qtest/pnv-xive2-flush-sync.c | 205 +++++++++++++++++ tests/qtest/pnv-xive2-test.c | 344 +++++++++++++++++++++++++++++ 6 files changed, 853 insertions(+) create mode 100644 tests/qtest/pnv-xive2-common.c create mode 100644 tests/qtest/pnv-xive2-common.h create mode 100644 tests/qtest/pnv-xive2-flush-sync.c create mode 100644 tests/qtest/pnv-xive2-test.c
MAINTAINERS +1 -0
@@ -2625,6 +2625,7 @@ L: [email protected] S: Odd Fixes F: hw/*/*xive* F: include/hw/*/*xive* +F: tests/qtest/*xive* F: docs/*/*xive* Renesas peripherals
tests/qtest/meson.build +2 -0
@@ -176,6 +176,7 @@ qtests_ppc64 = \ qtests_ppc + \ (config_all_devices.has_key('CONFIG_PSERIES') ? ['device-plug-test'] : []) + \ (config_all_devices.has_key('CONFIG_POWERNV') ? ['pnv-xscom-test'] : []) + \ + (config_all_devices.has_key('CONFIG_POWERNV') ? ['pnv-xive2-test'] : []) + \ (config_all_devices.has_key('CONFIG_POWERNV') ? ['pnv-spi-seeprom-test'] : []) + \ (config_all_devices.has_key('CONFIG_POWERNV') ? ['pnv-host-i2c-test'] : []) + \ (config_all_devices.has_key('CONFIG_PSERIES') ? ['numa-test'] : []) + \
@@ -344,6 +345,7 @@ qtests = { 'ivshmem-test': [rt, '../../contrib/ivshmem-server/ivshmem-server.c'], 'migration-test': migration_files, 'pxe-test': files('boot-sector.c'), + 'pnv-xive2-test': files('pnv-xive2-common.c', 'pnv-xive2-flush-sync.c'), 'qos-test': [chardev, io, qos_test_ss.apply({}).sources()], 'tpm-crb-swtpm-test': [io, tpmemu_files], 'tpm-crb-test': [io, tpmemu_files],
tests/qtest/pnv-xive2-common.c new file +190 -0
190 lines not on this page · raw message
tests/qtest/pnv-xive2-common.h new file +111 -0
111 lines not on this page · raw message
tests/qtest/pnv-xive2-flush-sync.c new file +205 -0
205 lines not on this page · raw message
tests/qtest/pnv-xive2-test.c new file +344 -0
344 lines not on this page · raw message
Signature · 1 line
2.45.2
Peter Maydell
AppliedQuoted 11 lines · Nicholas Piggin
The following changes since commit
92ec7805190313c9e628f8fc4eb4f932c15247bd:Merge tag 'pull-riscv-to-apply-20241031-1' of https://github.com/alistair23/qemu into staging (2024-10-31 16:34:25 +0000)
are available in the Git repository at:
https://gitlab.com/npiggin/qemu.git tags/pull-ppc-for-9.2-1-20241104
for you to fetch changes up to
bd4be4d9bd20a252e677239a18b6409ecee98f56:
Quoted 9 lines
MAINTAINERS: Remove myself as reviewer (2024-11-04 10:09:36 +1000)----------------------------------------------------------------
* Various bug fixes
* Big cleanup of deprecated machines
* Power11 support for spapr
* XIVE improvements
* Goodbye Cedric and David as ppc reviewers, thank you both o7
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/9.2
for any user-visible changes.
-- PMM
Re: [PULL 02/67] target/ppc: Make divd[u] handler method decodetree compatible
In reply to Nicholas PigginQuoted 4 lines · Nicholas Piggin
From: Ilya Leoshkevich <[email protected]>
This is like commit
86e6202a57b1("target/ppc: Make divw[u] handler method decodetree compatible."), but forgen_op_arith_divd().
86e6202a57b1 is v9.0.0-880-g86e6202a57b1, ie, it is in 9.1 only. So I wonder what should we do for older stable series (namely for 8.2 lts and 9.0), -- should we pick this one together with the mentioned 86e6202a57b1, or neither?
A separate question is whenever it makes sense to pick these for 7.2?
Thanks,
/mjt
Quoted 23 lines
Suggested-by Richard Henderson <[email protected]>Signed-off-by Ilya Leoshkevich <[email protected]>Reviewed-by Richard Henderson <[email protected]>Reviewed-by Philippe Mathieu-Daudé <[email protected]>Signed-off-by Nicholas Piggin <[email protected]>--- target/ppc/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/ppc/translate.c +1
-1@@ -1820,7 +1820,7 @@ static inline void gen_op_arith_divd(DisasContext *ctx, TCGv ret,tcg_gen_or_tl (cpu_so, cpu_so, cpu_ov); } -if (unlikely (Rc (ctx->opcode) !=0 )) { +if (unlikely (compute_rc0)) {gen_set_Rc0 (ctx, ret); } }
Signature · 4 lines
GPG Key transition (from rsa2048 to rsa4096) since 2024-04-24. New key: rsa4096/61AD3D98ECDF2C8E 9D8B E14E 3F2A 9DD7 9199 28F1 61AD 3D98 ECDF 2C8E Old key: rsa2048/457CE0A0804465C5 6EE1 95D1 886E 8FFB 810D 4324 457C E0A0 8044 65C5 Transition statement: http://www.corpit.ru/mjt/gpg-transition-2024.txt
Re: [PULL 08/67] target/ppc: Fix HFSCR facility checks
In reply to Nicholas PigginQuoted 15 lines · Nicholas Piggin
The HFSCR defines were being encoded as bit masks, but the users expect (and analogous FSCR defines are) bit numbers.
Reviewed-by Richard Henderson <[email protected]>Signed-off-by Nicholas Piggin <[email protected]>--- target/ppc/cpu.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)target/ppc/cpu.h +0
-0
target/ppc/cpu.h FIELD(MSR, LE, MSR_LE, 1) · line 639
Quoted 7 lines
target/ppc/cpu.h +2
-2@@ -635,8 +635,8 @@ FIELD(MSR, LE, MSR_LE, 1)#define PSSCR_EC PPC_BIT(43)/* Exit Criterion */ /* HFSCR bits */ -#define HFSCR_MSGP PPC_BIT(53)/* Privileged Message Send Facilities */ -#define HFSCR_BHRB PPC_BIT(59)/* BHRB Instructions */ +#define HFSCR_MSGP PPC_BIT_NR(53)/* Privileged Message Send Facilities */ +#define HFSCR_BHRB PPC_BIT_NR(59)/* BHRB Instructions */
v9.0.0-892-g6bfcf1dc23 "target/ppc: Add clrbhrb and mfbhrbe instructions" (ie v9.1.0 release) added the HFSCR_BHRB definition here. While HFSCR_MSGP has been there for a very long time, since v4.2.0-1172-g493028d8d7 (2020). Does it make sense to pick this change to older stable series (9.0 and before) keeping just the HFSCR_MSGP fix?
How happened this hasn't been noticed for so long time? Is it enough reason to not bother with older releases?
Thanks,
/mjt
Re: [PULL 02/67] target/ppc: Make divd[u] handler method decodetree compatible
In reply to Michael TokarevQuoted 11 lines · Michael Tokarev
Quoted 4 lines · Nicholas Piggin
From: Ilya Leoshkevich <[email protected]>
This is like commit
86e6202a57b1("target/ppc: Make divw[u] handler method decodetree compatible."), but forgen_op_arith_divd().
86e6202a57b1is v9.0.0-880-g86e6202a57b1, ie, it is in 9.1 only. So I wonder what should we do for older stable series (namely for 8.2 lts and 9.0), -- should we pick this one together with the mentioned86e6202a57b1, or neither?
Quoted 5 lines
A separate question is whenever it makes sense to pick these for 7.2?
Thanks,
/mjt
Come to think of it, I would recommend only the previous commit ("target/ppc: Set ctx->opcode for decode_insn32()") for stable. It solves the whole class of potential problems like this one, and it should apply to 7.2 as well.
The reason we also have this fix in the pull request is that long-term the ctx->opcode field will be removed.
[...]
Re: [PULL 02/67] target/ppc: Make divd[u] handler method decodetree compatible
Quoted 6 lines · Ilya Leoshkevich
Quoted 5 lines · Michael Tokarev
Quoted 4 lines · Nicholas Piggin
From: Ilya Leoshkevich <[email protected]>
This is like commit
86e6202a57b1("target/ppc: Make divw[u] handler method decodetree compatible."), but forgen_op_arith_divd().
...
Quoted 4 lines
Come to think of it, I would recommend only the previous commit ("target/ppc: Set
ctx->opcodefordecode_insn32()") for stable. It solves the whole class of potential problems like this one, and it should apply to 7.2 as well.
Yes, "Set ctx->opcode for decode_insn32()" applies and works for all older stable releases.
So I'm not picking up this commit ("Make divd[u] handler method decodetree compatible") for the stable releases (not even for 9.1), and do not pick "Make divw[u] handler" either.
The rest from this pull request which are marked for-stable, are picked up.
Quoted 2 lines
The reason we also have this fix in the pull request is that long-term the
ctx->opcodefield will be removed.
Thank you for the clarification!
/mjt
Nicholas Piggin
reviewerRe: [PULL 08/67] target/ppc: Fix HFSCR facility checks
In reply to Michael TokarevQuoted 30 lines · Michael Tokarev
Quoted 15 lines · Nicholas Piggin
The HFSCR defines were being encoded as bit masks, but the users expect (and analogous FSCR defines are) bit numbers.
Reviewed-by Richard Henderson <[email protected]>Signed-off-by Nicholas Piggin <[email protected]>--- target/ppc/cpu.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)target/ppc/cpu.h +0
-0target/ppc/cpu.h FIELD(MSR, LE, MSR_LE, 1) · line 639
Quoted 7 lines
target/ppc/cpu.h +2
-2@@ -635,8 +635,8 @@ FIELD(MSR, LE, MSR_LE, 1)#define PSSCR_EC PPC_BIT(43)/* Exit Criterion */ /* HFSCR bits */ -#define HFSCR_MSGP PPC_BIT(53)/* Privileged Message Send Facilities */ -#define HFSCR_BHRB PPC_BIT(59)/* BHRB Instructions */ +#define HFSCR_MSGP PPC_BIT_NR(53)/* Privileged Message Send Facilities */ +#define HFSCR_BHRB PPC_BIT_NR(59)/* BHRB Instructions */ v9.0.0-892-g6bfcf1dc23 "target/ppc: Add clrbhrb and mfbhrbe instructions" (ie v9.1.0 release) added the
HFSCR_BHRBdefinition here. WhileHFSCR_MSGPhas been there for a very long time, since v4.2.0-1172-g493028d8d7 (2020). Does it make sense to pick this change to older stable series (9.0 and before) keeping just theHFSCR_MSGPfix?
Quoted 2 lines
How happened this hasn't been noticed for so long time? Is it enough reason to not bother with older releases?
Mainly because KVM doesn't use the feature. PowerVM does, which is where we caught it recently. I'd probably not bother further backporting.
Thanks,
Nick