ppc patch queue 2013-10-25
[Qemu-devel] [PULL 02/29] pseries: Fix loading of little endian kernels
In reply to Alexander GrafFrom: Benjamin Herrenschmidt <[email protected]>
Try loading the kernel as little endian if it fails big endian.
--- hw/ppc/spapr.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
hw/ppc/spapr.c +12 -1
@@ -273,6 +273,7 @@ static void *spapr_create_fdt_skel(const char *cpu_model,hwaddr initrd_base, hwaddr initrd_size, hwaddr kernel_size, + bool little_endian, const char *boot_device, const char *kernel_cmdline, uint32_t epow_irq)
@@ -326,6 +327,9 @@ static void *spapr_create_fdt_skel(const char *cpu_model, cpu_to_be64(kernel_size) };_FDT ((fdt_property (fdt,"qemu,boot-kernel" , &kprop,sizeof (kprop)))); +if (little_endian) { +_FDT ((fdt_property (fdt,"qemu,boot-kernel-le" ,NULL ,0 ))); + } }if (boot_device) {_FDT ((fdt_property_string (fdt,"qemu,boot-device" , boot_device)));
@@ -1102,6 +1106,7 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args)uint32_t initrd_base =0 ;long kernel_size =0 , initrd_size =0 ;long load_limit, rtas_limit, fw_size; +bool kernel_le = false;char *filename; msi_supported = true;
@@ -1282,6 +1287,12 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args) kernel_size =load_elf (kernel_filename, translate_kernel_address,NULL ,NULL , &lowaddr,NULL ,1 ,ELF_MACHINE ,0 );if (kernel_size <0 ) { + kernel_size =load_elf (kernel_filename, + translate_kernel_address,NULL , +NULL , &lowaddr,NULL ,0 ,ELF_MACHINE ,0 ); + kernel_le = kernel_size >0 ; + } +if (kernel_size <0 ) { kernel_size =load_image_targphys (kernel_filename,KERNEL_LOAD_ADDR , load_limit -KERNEL_LOAD_ADDR );
@@ -1331,7 +1342,7 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args)/* Prepare the device tree */ spapr->fdt_skel =spapr_create_fdt_skel (cpu_model, initrd_base, initrd_size, - kernel_size, + kernel_size, kernel_le, boot_device, kernel_cmdline, spapr->epow_irq);assert (spapr->fdt_skel !=NULL );
Signature · 1 line
1.8.1.4
Hi Blue / Aurelien / Anthony,
This is my current patch queue for ppc. Please pull.
Alex
The following changes since commit fc8ead74674b7129e8f31c2595c76658e5622197:
Merge remote-tracking branch 'qemu-kvm/uq/master' into staging (2013-10-18 10:03:24 -0700)
are available in the git repository at:
git://github.com/agraf/qemu.git ppc-for-upstream
for you to fetch changes up to 3bbf37f2692652cc9d48030a9e7f34e2207429f6:
spapr: Use DeviceClass::fw_name for device tree CPU node (2013-10-25 23:25:48 +0200)
----------------------------------------------------------------
Alexander Graf (1):
PPC: Fix L2CR write accesses
Alexey Kardashevskiy (14):
pseries: Update SLOF firmware image
spapr: increase temporary fdt buffer size
spapr: Add ibm, purr property on power7 and newer
spapr-rtas: fix h_rtas parameters reading
xics: move reset and cpu_setup
spapr: move cpu_setup after kvmppc_set_papr
xics: replace fprintf with error_report
xics: add pre_save/post_load dispatchers
xics: convert init() to realize()
xics: add missing const specifiers to TypeInfo
xics: split to xics and xics-common
xics: add cpu_setup callback
xics-kvm: enable irqfd for MSI
spapr-pci: enable irqfd for INTx
Andreas Färber (2):
target-ppc: Fill in OpenFirmware names for some PowerPCCPU families
spapr: Use DeviceClass::fw_name for device tree CPU node
Aneesh Kumar K.V (5):
target-ppc: Update slb array with correct index values.
target-ppc: Check for error on address translation in memsave command
target-ppc: Use #define for max slb entries
dump-guest-memory: Check for the correct return value
target-ppc: dump-guest-memory support
Benjamin Herrenschmidt (3):
pseries: Fix loading of little endian kernels
xics: Implement H_IPOLL
xics: Implement H_XIRR_X
David Gibson (2):
target-ppc: Add helper for KVM_PPC_RTAS_DEFINE_TOKEN
xics-kvm: Support for in-kernel XICS interrupt controller
Tom Musta (2):
ppc: Add CFAR, DAR and DSISR to the dictionary of printable registers
target-ppc: Little Endian Correction to Load/Store Vector Element
cpus.c | 5 +- default-configs/ppc64-softmmu.mak | 1 + dump.c | 4 +- hw/intc/Makefile.objs | 1 + hw/intc/xics.c | 327 ++++++++++++++++++++----- hw/intc/xics_kvm.c | 494 ++++++++++++++++++++++++++++++++++++++ hw/ppc/spapr.c | 72 ++++-- hw/ppc/spapr_hcall.c | 6 +- hw/ppc/spapr_pci.c | 13 + include/elf.h | 3 + include/hw/ppc/spapr.h | 11 +- include/hw/ppc/xics.h | 57 +++++ monitor.c | 3 + pc-bios/README | 2 +- pc-bios/slof.bin | Bin 909720 -> 875424 bytes roms/SLOF | 2 +- target-ppc/Makefile.objs | 2 +- target-ppc/arch_dump.c | 253 +++++++++++++++++++ target-ppc/cpu-qom.h | 5 +- target-ppc/cpu.h | 3 +- target-ppc/kvm.c | 35 ++- target-ppc/kvm_ppc.h | 7 + target-ppc/machine.c | 2 +- target-ppc/mem_helper.c | 2 + target-ppc/translate_init.c | 38 ++- 25 files changed, 1235 insertions(+), 113 deletions(-) create mode 100644 hw/intc/xics_kvm.c create mode 100644 target-ppc/arch_dump.c
[Qemu-devel] [PULL 07/29] spapr: Add ibm, purr property on power7 and newer
From: Alexey Kardashevskiy <[email protected]>
PAPR+ says that no "ibm,purr" tells the guest that H_PURR is not supported. However some guests still try calling H_PURR on POWER7 unless the property is present and equal to 0. This adds the property for CPUs supporting the PURR special register.
--- hw/ppc/spapr.c | 4 ++++ 1 file changed, 4 insertions(+)
hw/ppc/spapr.c +4 -0
@@ -422,6 +422,10 @@ static void *spapr_create_fdt_skel(const char *cpu_model,_FDT ((fdt_property (fdt,"ibm,ppc-interrupt-gserver#s" , gservers_prop,sizeof (gservers_prop)))); +if (env->spr_cb[SPR_PURR ].oea_read) { +_FDT ((fdt_property (fdt,"ibm,purr" ,NULL ,0 ))); + } +if (env->mmu_model &POWERPC_MMU_1TSEG ) {_FDT ((fdt_property (fdt,"ibm,processor-segment-sizes" , segs,sizeof (segs))));
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 03/29] ppc: Add CFAR, DAR and DSISR to the dictionary of printable registers
In reply to Alexander GrafFrom: Tom Musta <[email protected]>
The CFAR, DAR and DSISR registers are currently missing from the dictionary of registers that may be printed in the QEMU console. These are interesting registers when debugging. With this patch, the following commands work properly:
(qemu) print $cfar
(qemu) print $dar
(qemu) print $dsisr
--- monitor.c | 3 +++ 1 file changed, 3 insertions(+)
monitor.c +3 -0
@@ -3186,6 +3186,9 @@ static const MonitorDef monitor_defs[] = { { "srr0", offsetof(CPUPPCState, spr[SPR_SRR0]) }, { "srr1", offsetof(CPUPPCState, spr[SPR_SRR1]) }, + { "dar", offsetof(CPUPPCState, spr[SPR_DAR]) }, + { "dsisr", offsetof(CPUPPCState, spr[SPR_DSISR]) }, + { "cfar", offsetof(CPUPPCState, spr[SPR_CFAR]) }, { "sprg0", offsetof(CPUPPCState, spr[SPR_SPRG0]) }, { "sprg1", offsetof(CPUPPCState, spr[SPR_SPRG1]) }, { "sprg2", offsetof(CPUPPCState, spr[SPR_SPRG2]) },
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 04/29] target-ppc: Little Endian Correction to Load/Store Vector Element
In reply to Alexander GrafFrom: Tom Musta <[email protected]>
The Load Vector Element (lve*x) and Store Vector Element (stve*x) instructions not only byte-swap in Little Endian mode, they also invert the element that is accessed. For example, the RTL for lvehx contains this:
eb <-- EA[60:63]
if Big-Endian byte ordering then
VRT[8*eb:8*eb+15] <-- MEM(EA,2)
else
VRT[112-(8*eb):127-(8*eb)] <-- MEM(EA,2)This patch adds the element inversion, as described in the last line of the RTL.
--- target-ppc/mem_helper.c | 2 ++ 1 file changed, 2 insertions(+)
target-ppc/mem_helper.c +2 -0
@@ -212,6 +212,7 @@ target_ulong helper_lscbx(CPUPPCState *env, target_ulong addr, uint32_t reg,int index = (addr &0xf ) >> sh; \ \if (msr_le) { \ + index = n_elems - index -1 ; \ r->element[LO_IDX ? index : (adjust - index)] = \swap (access (env, addr)); \ }else { \
@@ -236,6 +237,7 @@ LVE(lvewx, cpu_ldl_data, bswap32, u32)int index = (addr &0xf ) >> sh; \ \if (msr_le) { \ + index = n_elems - index -1 ; \access (env, addr,swap (r->element[LO_IDX ? index : \ (adjust - index)])); \ }else { \
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 11/29] spapr: move cpu_setup after kvmppc_set_papr
In reply to Alexander GrafFrom: Alexey Kardashevskiy <[email protected]>
This moves the xics_cpu_setup() call after kvmppc_set_papr() in order to get VCPUs initialized as this is required by upcoming XICS-KVM.
--- hw/ppc/spapr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/ppc/spapr.c +2 -2
@@ -1184,8 +1184,6 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args) } env = &cpu->env; -xics_cpu_setup (spapr->icp, cpu); -/* Set time-base frequency to 512 MHz */ cpu_ppc_tb_init (env,TIMEBASE_FREQ );
@@ -1199,6 +1197,8 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args)kvmppc_set_papr (cpu); } +xics_cpu_setup (spapr->icp, cpu); +qemu_register_reset (spapr_cpu_reset, cpu); }
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 19/29] xics: Implement H_IPOLL
In reply to Alexander GrafFrom: Benjamin Herrenschmidt <[email protected]>
This adds support for the H_IPOLL hypercall which the guest uses to poll for a pending interrupt. This hypercall is mandatory for PAPR+ and there is no way for the guest to detect whether it is supported or not so just add it.
--- hw/intc/xics.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
hw/intc/xics.c +13 -0
@@ -689,6 +689,18 @@ static target_ulong h_eoi(PowerPCCPU *cpu, sPAPREnvironment *spapr,return H_SUCCESS ; } +static target_ulong h_ipoll (PowerPCCPU *cpu,sPAPREnvironment *spapr, +target_ulong opcode,target_ulong *args) +{ +CPUState *cs =CPU (cpu); +ICPState *ss = &spapr->icp->ss[cs->cpu_index]; + + args[0 ] = ss->xirr; + args[1 ] = ss->mfrr; + +return H_SUCCESS ; +} + static void rtas_set_xive(PowerPCCPU *cpu, sPAPREnvironment *spapr, uint32_t token, uint32_t nargs, target_ulong args,
@@ -842,6 +854,7 @@ static void xics_realize(DeviceState *dev, Error **errp)spapr_register_hypercall (H_IPI , h_ipi);spapr_register_hypercall (H_XIRR , h_xirr);spapr_register_hypercall (H_EOI , h_eoi); +spapr_register_hypercall (H_IPOLL , h_ipoll);object_property_set_bool (OBJECT (icp->ics), true,"realized" , &error);if (error) {
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 20/29] xics: Implement H_XIRR_X
In reply to Alexander GrafFrom: Benjamin Herrenschmidt <[email protected]>
This implements H_XIRR_X hypercall in addition to H_XIRR as it is mandatory for PAPR+ and there is no way for the guest to detect whether it is supported or not so just add it.
As the Partition Adjunct Option is not supported at the moment, the CPPR parameter of the hypercall is ignored.
--- hw/intc/xics.c | 14 ++++++++++++++ include/hw/ppc/spapr.h | 1 + 2 files changed, 15 insertions(+)
hw/intc/xics.c +14 -0
@@ -27,6 +27,7 @@#include "hw/hw.h" #include "trace.h" +#include "qemu/timer.h" #include "hw/ppc/spapr.h" #include "hw/ppc/xics.h" #include "qemu/error-report.h"
@@ -679,6 +680,18 @@ static target_ulong h_xirr(PowerPCCPU *cpu, sPAPREnvironment *spapr,return H_SUCCESS ; } +static target_ulong h_xirr_x (PowerPCCPU *cpu,sPAPREnvironment *spapr, +target_ulong opcode,target_ulong *args) +{ +CPUState *cs =CPU (cpu); +ICPState *ss = &spapr->icp->ss[cs->cpu_index]; +uint32_t xirr =icp_accept (ss); + + args[0 ] = xirr; + args[1 ] =cpu_get_real_ticks (); +return H_SUCCESS ; +} +static target_ulong h_eoi (PowerPCCPU *cpu,sPAPREnvironment *spapr,target_ulong opcode,target_ulong *args) {
@@ -853,6 +866,7 @@ static void xics_realize(DeviceState *dev, Error **errp)spapr_register_hypercall (H_CPPR , h_cppr);spapr_register_hypercall (H_IPI , h_ipi);spapr_register_hypercall (H_XIRR , h_xirr); +spapr_register_hypercall (H_XIRR_X , h_xirr_x);spapr_register_hypercall (H_EOI , h_eoi);spapr_register_hypercall (H_IPOLL , h_ipoll);
include/hw/ppc/spapr.h +1 -0
@@ -283,6 +283,7 @@ typedef struct sPAPREnvironment {#define H_GET_EM_PARMS 0x2B8#define H_SET_MPP 0x2D0#define H_GET_MPP 0x2D4 +#define H_XIRR_X 0x2FC#define H_SET_MODE 0x31C#define MAX_HCALL_OPCODE H_SET_MODE
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 05/29] PPC: Fix L2CR write accesses
In reply to Alexander GrafCommit 2345f1c01 was supposed to render L2CR writes into noops. Instead, it made them illegal instruction traps which apparently didn't confuse XNU, but can easily confuse other OSs.
Fix it up by actually doing nothing when we write to L2CR.
--- target-ppc/translate_init.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-)
target-ppc/translate_init.c +17 -12
@@ -108,6 +108,11 @@ static void spr_write_clear (void *opaque, int sprn, int gprn)tcg_temp_free (t0); tcg_temp_free(t1); } + +static void spr_access_nop (void *opaque,int sprn,int gprn) +{ +} +#endif /* SPR common to all PowerPC */
@@ -1382,7 +1387,7 @@ static void gen_spr_74xx (CPUPPCState *env)/* XXX : not implemented */ spr_register (env,SPR_L2CR ,"L2CR" ,SPR_NOACCESS ,SPR_NOACCESS , - &spr_read_generic,NULL , + &spr_read_generic, spr_access_nop,0x00000000 );/* Not strictly an SPR */ vscr_init (env,0x00010000 );
@@ -5170,7 +5175,7 @@ static void init_proc_750 (CPUPPCState *env)/* XXX : not implemented */ spr_register (env,SPR_L2CR ,"L2CR" ,SPR_NOACCESS ,SPR_NOACCESS , - &spr_read_generic,NULL , + &spr_read_generic, spr_access_nop,0x00000000 );/* Time base */ gen_tbl (env);
@@ -5233,7 +5238,7 @@ static void init_proc_750cl (CPUPPCState *env)/* XXX : not implemented */ spr_register (env,SPR_L2CR ,"L2CR" ,SPR_NOACCESS ,SPR_NOACCESS , - &spr_read_generic,NULL , + &spr_read_generic, spr_access_nop,0x00000000 );/* Time base */ gen_tbl (env);
@@ -5419,7 +5424,7 @@ static void init_proc_750cx (CPUPPCState *env)/* XXX : not implemented */ spr_register (env,SPR_L2CR ,"L2CR" ,SPR_NOACCESS ,SPR_NOACCESS , - &spr_read_generic,NULL , + &spr_read_generic, spr_access_nop,0x00000000 );/* Time base */ gen_tbl (env);
@@ -5486,7 +5491,7 @@ static void init_proc_750fx (CPUPPCState *env)/* XXX : not implemented */ spr_register (env,SPR_L2CR ,"L2CR" ,SPR_NOACCESS ,SPR_NOACCESS , - &spr_read_generic,NULL , + &spr_read_generic, spr_access_nop,0x00000000 );/* Time base */ gen_tbl (env);
@@ -5558,7 +5563,7 @@ static void init_proc_750gx (CPUPPCState *env)/* XXX : not implemented (XXX: different from 750fx) */ spr_register (env,SPR_L2CR ,"L2CR" ,SPR_NOACCESS ,SPR_NOACCESS , - &spr_read_generic,NULL , + &spr_read_generic, spr_access_nop,0x00000000 );/* Time base */ gen_tbl (env);
@@ -5694,7 +5699,7 @@ static void init_proc_755 (CPUPPCState *env)/* XXX : not implemented */ spr_register (env,SPR_L2CR ,"L2CR" ,SPR_NOACCESS ,SPR_NOACCESS , - &spr_read_generic,NULL , + &spr_read_generic, spr_access_nop,0x00000000 );/* XXX : not implemented */ spr_register(env, SPR_L2PMCR, "L2PMCR",
@@ -6650,7 +6655,7 @@ static void init_proc_970 (CPUPPCState *env)/* XXX : not implemented */ spr_register (env,SPR_L2CR ,"L2CR" ,SPR_NOACCESS ,SPR_NOACCESS , - &spr_read_generic,NULL , + &spr_read_generic, spr_access_nop,0x00000000 );/* Memory management */ /* XXX: not correct */
@@ -6750,7 +6755,7 @@ static void init_proc_970FX (CPUPPCState *env)/* XXX : not implemented */ spr_register (env,SPR_L2CR ,"L2CR" ,SPR_NOACCESS ,SPR_NOACCESS , - &spr_read_generic,NULL , + &spr_read_generic, spr_access_nop,0x00000000 );/* Memory management */ /* XXX: not correct */
@@ -6862,7 +6867,7 @@ static void init_proc_970GX (CPUPPCState *env)/* XXX : not implemented */ spr_register (env,SPR_L2CR ,"L2CR" ,SPR_NOACCESS ,SPR_NOACCESS , - &spr_read_generic,NULL , + &spr_read_generic, spr_access_nop,0x00000000 );/* Memory management */ /* XXX: not correct */
@@ -6962,7 +6967,7 @@ static void init_proc_970MP (CPUPPCState *env)/* XXX : not implemented */ spr_register (env,SPR_L2CR ,"L2CR" ,SPR_NOACCESS ,SPR_NOACCESS , - &spr_read_generic,NULL , + &spr_read_generic, spr_access_nop,0x00000000 );/* Memory management */ /* XXX: not correct */
@@ -7054,7 +7059,7 @@ static void init_proc_power5plus(CPUPPCState *env)/* XXX : not implemented */ spr_register (env,SPR_L2CR ,"L2CR" ,SPR_NOACCESS ,SPR_NOACCESS , - &spr_read_generic,NULL , + &spr_read_generic, spr_access_nop,0x00000000 );/* Memory management */ /* XXX: not correct */
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 10/29] xics: move reset and cpu_setup
In reply to Alexander GrafFrom: Alexey Kardashevskiy <[email protected]>
This simple change makes following patches nicer.
--- hw/intc/xics.c | 72 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 36 insertions(+), 36 deletions(-)
hw/intc/xics.c +36 -36
@@ -30,6 +30,42 @@#include "hw/ppc/spapr.h" #include "hw/ppc/xics.h" +void xics_cpu_setup (XICSState *icp,PowerPCCPU *cpu) +{ +CPUState *cs =CPU (cpu); +CPUPPCState *env = &cpu->env; +ICPState *ss = &icp->ss[cs->cpu_index]; + +assert (cs->cpu_index < icp->nr_servers); + +switch (PPC_INPUT (env)) { +case PPC_FLAGS_INPUT_POWER7 : + ss->output = env->irq_inputs[POWER7_INPUT_INT ]; +break ; + +case PPC_FLAGS_INPUT_970 : + ss->output = env->irq_inputs[PPC970_INPUT_INT ]; +break ; + +default : +fprintf (stderr,"XICS interrupt controller does not support this CPU " +"bus model\n" ); +abort (); + } +} + +static void xics_reset (DeviceState *d) +{ +XICSState *icp =XICS (d); +int i; + +for (i =0 ; i < icp->nr_servers; i++) { +device_reset (DEVICE (&icp->ss[i])); + } + +device_reset (DEVICE (icp->ics)); +} +/* * ICP: Presentation layer */
@@ -600,42 +636,6 @@ static void rtas_int_on(PowerPCCPU *cpu, sPAPREnvironment *spapr,* XICS */ -static void xics_reset (DeviceState *d) -{ -XICSState *icp =XICS (d); -int i; - -for (i =0 ; i < icp->nr_servers; i++) { -device_reset (DEVICE (&icp->ss[i])); - } - -device_reset (DEVICE (icp->ics)); -} - -void xics_cpu_setup (XICSState *icp,PowerPCCPU *cpu) -{ -CPUState *cs =CPU (cpu); -CPUPPCState *env = &cpu->env; -ICPState *ss = &icp->ss[cs->cpu_index]; - -assert (cs->cpu_index < icp->nr_servers); - -switch (PPC_INPUT (env)) { -case PPC_FLAGS_INPUT_POWER7 : - ss->output = env->irq_inputs[POWER7_INPUT_INT ]; -break ; - -case PPC_FLAGS_INPUT_970 : - ss->output = env->irq_inputs[PPC970_INPUT_INT ]; -break ; - -default : -fprintf (stderr,"XICS interrupt controller does not support this CPU " -"bus model\n" ); -abort (); - } -} -static void xics_realize (DeviceState *dev,Error **errp) {XICSState *icp =XICS (dev);
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 15/29] xics: add missing const specifiers to TypeInfo
In reply to Alexander GrafFrom: Alexey Kardashevskiy <[email protected]>
This adds missing const specifiers to ICS and ICP TypeInfo's.
--- hw/intc/xics.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/intc/xics.c +2 -2
@@ -248,7 +248,7 @@ static void icp_class_init(ObjectClass *klass, void *data) dc->vmsd = &vmstate_icp_server; } -static TypeInfo icp_info = { +static const TypeInfo icp_info = { .name =TYPE_ICP , .parent =TYPE_DEVICE , .instance_size =sizeof (ICPState),
@@ -503,7 +503,7 @@ static void ics_class_init(ObjectClass *klass, void *data) isc->post_load = ics_post_load; } -static TypeInfo ics_info = { +static const TypeInfo ics_info = { .name =TYPE_ICS , .parent =TYPE_DEVICE , .instance_size =sizeof (ICSState),
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 08/29] spapr-rtas: fix h_rtas parameters reading
In reply to Alexander GrafFrom: Alexey Kardashevskiy <[email protected]>
On the real hardware, RTAS is called in real mode and therefore top 4 bits of the address passed in the call are ignored. So does the patch.
This converts h_rtas() to use existing rtas_ld() handlers.
This fixed rtas_ld()/rtas_st() to ignore top 4 bits.
--- hw/ppc/spapr_hcall.c | 6 +++--- include/hw/ppc/spapr.h | 9 +++++++-- 2 files changed, 10 insertions(+), 5 deletions(-)
hw/ppc/spapr_hcall.c +3 -3
@@ -521,9 +521,9 @@ static target_ulong h_rtas(PowerPCCPU *cpu, sPAPREnvironment *spapr, target_ulong opcode, target_ulong *args) { target_ulong rtas_r3 = args[0]; -uint32_t token =ldl_be_phys (rtas_r3); -uint32_t nargs =ldl_be_phys (rtas_r3 +4 ); -uint32_t nret =ldl_be_phys (rtas_r3 +8 ); +uint32_t token =rtas_ld (rtas_r3,0 ); +uint32_t nargs =rtas_ld (rtas_r3,1 ); +uint32_t nret =rtas_ld (rtas_r3,2 );return spapr_rtas_call (cpu, spapr, token, nargs, rtas_r3 +12 , nret, rtas_r3 +12 +4 *nargs);
include/hw/ppc/spapr.h +7 -2
@@ -332,14 +332,19 @@ static inline int spapr_allocate_lsi(int hint)return spapr_allocate_irq (hint, true); } +static inline uint64_t ppc64_phys_to_real (uint64_t addr) +{ +return addr & ~0xF000000000000000ULL ; +} +static inline uint32_t rtas_ld (target_ulong phys,int n) { -return ldl_be_phys (phys +4 *n); +return ldl_be_phys (ppc64_phys_to_real (phys +4 *n)); }static inline void rtas_st (target_ulong phys,int n,uint32_t val) { -stl_be_phys (phys +4 *n, val); +stl_be_phys (ppc64_phys_to_real (phys +4 *n), val); } typedef void (*spapr_rtas_fn)(PowerPCCPU *cpu, sPAPREnvironment *spapr,
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 12/29] xics: replace fprintf with error_report
In reply to Alexander GrafFrom: Alexey Kardashevskiy <[email protected]>
This replaces old-style fprintf with new style error_report.
--- hw/intc/xics.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
hw/intc/xics.c +3 -2
@@ -29,6 +29,7 @@#include "trace.h" #include "hw/ppc/spapr.h" #include "hw/ppc/xics.h" +#include "qemu/error-report.h" void xics_cpu_setup (XICSState *icp,PowerPCCPU *cpu) {
@@ -48,8 +49,8 @@ void xics_cpu_setup(XICSState *icp, PowerPCCPU *cpu)break ;default : -fprintf (stderr,"XICS interrupt controller does not support this CPU " -"bus model\n" ); +error_report ("XICS interrupt controller does not support this CPU " +"bus model" );abort (); } }
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 13/29] xics: add pre_save/post_load dispatchers
In reply to Alexander GrafFrom: Alexey Kardashevskiy <[email protected]>
The upcoming support of in-kernel XICS will redefine migration callbacks for both ICS and ICP so classes and callback pointers are added.
--- hw/intc/xics.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++--- include/hw/ppc/xics.h | 26 ++++++++++++++++++++++++ 2 files changed, 79 insertions(+), 3 deletions(-)
hw/intc/xics.c +53 -3
@@ -190,11 +190,35 @@ static void icp_irq(XICSState *icp, int server, int nr, uint8_t priority) } } +static void icp_dispatch_pre_save (void *opaque) +{ +ICPState *ss = opaque; +ICPStateClass *info =ICP_GET_CLASS (ss); + +if (info->pre_save) { + info->pre_save (ss); + } +} + +static int icp_dispatch_post_load (void *opaque,int version_id) +{ +ICPState *ss = opaque; +ICPStateClass *info =ICP_GET_CLASS (ss); + +if (info->post_load) { +return info->post_load (ss, version_id); + } + +return 0 ; +} +static const VMStateDescription vmstate_icp_server = { .name ="icp/server" , .version_id =1 , .minimum_version_id =1 , .minimum_version_id_old =1 , + .pre_save = icp_dispatch_pre_save, + .post_load = icp_dispatch_post_load, .fields = (VMStateField []) {/* Sanity check */ VMSTATE_UINT32 (xirr, ICPState),
@@ -229,6 +253,7 @@ static TypeInfo icp_info = { .parent = TYPE_DEVICE, .instance_size = sizeof(ICPState), .class_init = icp_class_init, + .class_size = sizeof(ICPStateClass), };/*
@@ -390,10 +415,9 @@ static void ics_reset(DeviceState *dev) } } -static int ics_post_load (void *opaque,int version_id) +static int ics_post_load (ICSState *ics,int version_id) {int i; -ICSState *ics = opaque;for (i =0 ; i < ics->icp->nr_servers; i++) {icp_resend (ics->icp, i);
@@ -402,6 +426,28 @@ static int ics_post_load(void *opaque, int version_id)return 0 ; } +static void ics_dispatch_pre_save (void *opaque) +{ +ICSState *ics = opaque; +ICSStateClass *info =ICS_GET_CLASS (ics); + +if (info->pre_save) { + info->pre_save (ics); + } +} + +static int ics_dispatch_post_load (void *opaque,int version_id) +{ +ICSState *ics = opaque; +ICSStateClass *info =ICS_GET_CLASS (ics); + +if (info->post_load) { +return info->post_load (ics, version_id); + } + +return 0 ; +} +static const VMStateDescription vmstate_ics_irq = { .name ="ics/irq" , .version_id =1 ,
@@ -421,7 +467,8 @@ static const VMStateDescription vmstate_ics = { .version_id = 1, .minimum_version_id = 1, .minimum_version_id_old = 1, - .post_load = ics_post_load, + .pre_save = ics_dispatch_pre_save, + .post_load = ics_dispatch_post_load, .fields = (VMStateField []) {/* Sanity check */ VMSTATE_UINT32_EQUAL (nr_irqs, ICSState),
@@ -446,10 +493,12 @@ static int ics_realize(DeviceState *dev)static void ics_class_init (ObjectClass *klass,void *data) {DeviceClass *dc =DEVICE_CLASS (klass); +ICSStateClass *isc =ICS_CLASS (klass); dc->init = ics_realize; dc->vmsd = &vmstate_ics; dc->reset = ics_reset; + isc->post_load = ics_post_load; }static TypeInfo ics_info = {
@@ -457,6 +506,7 @@ static TypeInfo ics_info = { .parent = TYPE_DEVICE, .instance_size = sizeof(ICSState), .class_init = ics_class_init, + .class_size = sizeof(ICSStateClass), };/*
include/hw/ppc/xics.h +26 -0
@@ -42,7 +42,9 @@* that yet) */ typedef struct XICSState XICSState ; +typedef struct ICPStateClass ICPStateClass ;typedef struct ICPState ICPState ; +typedef struct ICSStateClass ICSStateClass ;typedef struct ICSState ICSState ;typedef struct ICSIRQState ICSIRQState ;
@@ -59,6 +61,18 @@ struct XICSState {#define TYPE_ICP "icp"#define ICP (obj) OBJECT_CHECK(ICPState, (obj), TYPE_ICP) +#define ICP_CLASS (klass) \ + OBJECT_CLASS_CHECK(ICPStateClass, (klass), TYPE_ICP) +#define ICP_GET_CLASS (obj) \ + OBJECT_GET_CLASS(ICPStateClass, (obj), TYPE_ICP) + +struct ICPStateClass { +DeviceClass parent_class; + +void (*pre_save)(ICPState *s); +int (*post_load)(ICPState *s,int version_id); +}; +struct ICPState {/*< private >*/ DeviceState parent_obj;
@@ -72,6 +86,18 @@ struct ICPState {#define TYPE_ICS "ics"#define ICS (obj) OBJECT_CHECK(ICSState, (obj), TYPE_ICS) +#define ICS_CLASS (klass) \ + OBJECT_CLASS_CHECK(ICSStateClass, (klass), TYPE_ICS) +#define ICS_GET_CLASS (obj) \ + OBJECT_GET_CLASS(ICSStateClass, (obj), TYPE_ICS) + +struct ICSStateClass { +DeviceClass parent_class; + +void (*pre_save)(ICSState *s); +int (*post_load)(ICSState *s,int version_id); +}; +struct ICSState {/*< private >*/ DeviceState parent_obj;
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 14/29] xics: convert init() to realize()
In reply to Alexander GrafFrom: Alexey Kardashevskiy <[email protected]>
This fixes XICS according new QOM rules.
This converts ICS's init() callbacks to realize().
This converts legacy qdev_init_nofail() to property_set(realized).
--- hw/intc/xics.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-)
hw/intc/xics.c +22 -6
@@ -479,15 +479,17 @@ static const VMStateDescription vmstate_ics = { }, }; -static int ics_realize (DeviceState *dev) +static void ics_realize (DeviceState *dev,Error **errp) {ICSState *ics =ICS (dev); +if (!ics->nr_irqs) { +error_setg (errp,"Number of interrupts needs to be greater 0" ); +return ; + } ics->irqs =g_malloc0 (ics->nr_irqs *sizeof (ICSIRQState)); ics->islsi =g_malloc0 (ics->nr_irqs *sizeof (bool )); ics->qirqs =qemu_allocate_irqs (ics_set_irq, ics, ics->nr_irqs); - -return 0 ; }static void ics_class_init (ObjectClass *klass,void *data)
@@ -495,7 +497,7 @@ static void ics_class_init(ObjectClass *klass, void *data)DeviceClass *dc =DEVICE_CLASS (klass);ICSStateClass *isc =ICS_CLASS (klass); - dc->init = ics_realize; + dc->realize = ics_realize; dc->vmsd = &vmstate_ics; dc->reset = ics_reset; isc->post_load = ics_post_load;
@@ -691,8 +693,14 @@ static void xics_realize(DeviceState *dev, Error **errp) {XICSState *icp =XICS (dev);ICSState *ics = icp->ics; +Error *error =NULL ;int i; +if (!icp->nr_servers) { +error_setg (errp,"Number of servers needs to be greater 0" ); +return ; + } +/* Registration of global state belongs into realize */ spapr_rtas_register ("ibm,set-xive" , rtas_set_xive);spapr_rtas_register ("ibm,get-xive" , rtas_get_xive);
@@ -707,7 +715,11 @@ static void xics_realize(DeviceState *dev, Error **errp) ics->nr_irqs = icp->nr_irqs; ics->offset =XICS_IRQ_BASE ; ics->icp = icp; -qdev_init_nofail (DEVICE (ics)); +object_property_set_bool (OBJECT (icp->ics), true,"realized" , &error); +if (error) { +error_propagate (errp, error); +return ; + } icp->ss =g_malloc0 (icp->nr_servers*sizeof (ICPState));for (i =0 ; i < icp->nr_servers; i++) {
@@ -715,7 +727,11 @@ static void xics_realize(DeviceState *dev, Error **errp)object_initialize (&icp->ss[i],sizeof (icp->ss[i]),TYPE_ICP );snprintf (buffer,sizeof (buffer),"icp[%d]" , i);object_property_add_child (OBJECT (icp), buffer,OBJECT (&icp->ss[i]),NULL ); -qdev_init_nofail (DEVICE (&icp->ss[i])); +object_property_set_bool (OBJECT (&icp->ss[i]), true,"realized" , &error); +if (error) { +error_propagate (errp, error); +return ; + } } }
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 17/29] xics: add cpu_setup callback
In reply to Alexander GrafFrom: Alexey Kardashevskiy <[email protected]>
This adds a cpu_setup callback to the XICS device class (as XICS-KVM will do it different), xics_cpu_setup() will call it if it is set.
--- hw/intc/xics.c | 5 +++++ include/hw/ppc/xics.h | 1 + 2 files changed, 6 insertions(+)
hw/intc/xics.c +5 -0
@@ -37,9 +37,14 @@ void xics_cpu_setup(XICSState *icp, PowerPCCPU *cpu)CPUState *cs =CPU (cpu);CPUPPCState *env = &cpu->env;ICPState *ss = &icp->ss[cs->cpu_index]; +XICSStateClass *info =XICS_COMMON_GET_CLASS (icp);assert (cs->cpu_index < icp->nr_servers); +if (info->cpu_setup) { + info->cpu_setup (icp, cpu); + } +switch (PPC_INPUT (env)) {case PPC_FLAGS_INPUT_POWER7 : ss->output = env->irq_inputs[POWER7_INPUT_INT ];
include/hw/ppc/xics.h +1 -0
@@ -64,6 +64,7 @@ typedef struct ICSIRQState ICSIRQState;struct XICSStateClass {DeviceClass parent_class; +void (*cpu_setup)(XICSState *icp,PowerPCCPU *cpu);void (*set_nr_irqs)(XICSState *icp,uint32_t nr_irqs,Error **errp);void (*set_nr_servers)(XICSState *icp,uint32_t nr_servers,Error **errp); };
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 21/29] xics-kvm: enable irqfd for MSI
In reply to Alexander GrafFrom: Alexey Kardashevskiy <[email protected]>
This enables IRQFD support for sPAPR. The feature decreases the latency of interrupt handling.
To enable IRQFD for MSI, this sets kvm_gsi_direct_mapping to true which enables direct MSI mapping.
To enable IRQFD for LSI (level triggered INTx interrupts), a PCI host bus callback is required. The patch for that is coming next.
--- hw/intc/xics_kvm.c | 6 ++++++ 1 file changed, 6 insertions(+)
hw/intc/xics_kvm.c +6 -0
@@ -441,6 +441,12 @@ static void xics_kvm_realize(DeviceState *dev, Error **errp) goto fail; } } + + kvm_kernel_irqchip = true; + kvm_irqfds_allowed = true; + kvm_msi_via_irqfd_allowed = true; + kvm_gsi_direct_mapping = true; +return ; fail:
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 22/29] spapr-pci: enable irqfd for INTx
In reply to Alexander GrafFrom: Alexey Kardashevskiy <[email protected]>
This enables IRQFD for LSI (level triggered INTx interrupts) by adding a spapr_route_intx_pin_to_irq() callback to the sPAPR PCI host bus. This callback is called to know the global interrupt number to link resampling fd with IRQFD's fd in KVM.
--- hw/ppc/spapr_pci.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
hw/ppc/spapr_pci.c +13 -0
@@ -432,6 +432,17 @@ static void pci_spapr_set_irq(void *opaque, int irq_num, int level)qemu_set_irq (spapr_phb_lsi_qirq (phb, irq_num), level); } +static PCIINTxRoute spapr_route_intx_pin_to_irq (void *opaque,int pin) +{ +sPAPRPHBState *sphb =SPAPR_PCI_HOST_BRIDGE (opaque); +PCIINTxRoute route; + + route.mode =PCI_INTX_ENABLED ; + route.irq = sphb->lsi_table[pin].irq; + +return route; +} +/* * MSI/MSIX memory region implementation. * The handler handles both MSI and MSIX.
@@ -610,6 +621,8 @@ static int spapr_phb_init(SysBusDevice *s)pci_setup_iommu (bus, spapr_pci_dma_iommu, sphb); +pci_bus_set_route_irq_fn (bus, spapr_route_intx_pin_to_irq); +QLIST_INSERT_HEAD (&spapr->phbs, sphb, list);/* Initialize the LSI table */
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 16/29] xics: split to xics and xics-common
In reply to Alexander GrafFrom: Alexey Kardashevskiy <[email protected]>
The upcoming XICS-KVM support will use bits of emulated XICS code. So this introduces new level of hierarchy - "xics-common" class. Both emulated XICS and XICS-KVM will inherit from it and override class callbacks when required.
The new "xics-common" class implements:
1. replaces static "nr_irqs" and "nr_servers" properties with the dynamic ones and adds callbacks to be executed when properties are set.
2. xics_cpu_setup() callback renamed to xics_common_cpu_setup() as it is a common part for both XICS'es
3. xics_reset() renamed to xics_common_reset() for the same reason.
The emulated XICS changes:
1. the part of xics_realize() which creates ICPs is moved to the "nr_servers" property callback as realize() is too late to create/initialize devices and instance_init() is too early to create devices as the number of child devices comes via the "nr_servers" property.
2. added ics_initfn() which does a little part of what xics_realize() did.
--- hw/intc/xics.c | 156 +++++++++++++++++++++++++++++++++++++++++++------- hw/ppc/spapr.c | 2 +- include/hw/ppc/xics.h | 20 +++++++ 3 files changed, 157 insertions(+), 21 deletions(-)
hw/intc/xics.c +136 -20
@@ -30,6 +30,7 @@#include "hw/ppc/spapr.h" #include "hw/ppc/xics.h" #include "qemu/error-report.h" +#include "qapi/visitor.h" void xics_cpu_setup (XICSState *icp,PowerPCCPU *cpu) {
@@ -55,9 +56,12 @@ void xics_cpu_setup(XICSState *icp, PowerPCCPU *cpu) } } -static void xics_reset (DeviceState *d) +/* +* XICS Common class - parent for emulated XICS and KVM-XICS +*/ +static void xics_common_reset (DeviceState *d) { -XICSState *icp =XICS (d); +XICSState *icp =XICS_COMMON (d);int i;for (i =0 ; i < icp->nr_servers; i++) {
@@ -67,6 +71,99 @@ static void xics_reset(DeviceState *d)device_reset (DEVICE (icp->ics)); } +static void xics_prop_get_nr_irqs (Object *obj,Visitor *v, +void *opaque,const char *name,Error **errp) +{ +XICSState *icp =XICS_COMMON (obj); +int64_t value = icp->nr_irqs; + +visit_type_int (v, &value, name, errp); +} + +static void xics_prop_set_nr_irqs (Object *obj,Visitor *v, +void *opaque,const char *name,Error **errp) +{ +XICSState *icp =XICS_COMMON (obj); +XICSStateClass *info =XICS_COMMON_GET_CLASS (icp); +Error *error =NULL ; +int64_t value; + +visit_type_int (v, &value, name, &error); +if (error) { +error_propagate (errp, error); +return ; + } +if (icp->nr_irqs) { +error_setg (errp,"Number of interrupts is already set to %u" , + icp->nr_irqs); +return ; + } + +assert (info->set_nr_irqs); +assert (icp->ics); + info->set_nr_irqs (icp, value, errp); +} + +static void xics_prop_get_nr_servers (Object *obj,Visitor *v, +void *opaque,const char *name, +Error **errp) +{ +XICSState *icp =XICS_COMMON (obj); +int64_t value = icp->nr_servers; + +visit_type_int (v, &value, name, errp); +} + +static void xics_prop_set_nr_servers (Object *obj,Visitor *v, +void *opaque,const char *name, +Error **errp) +{ +XICSState *icp =XICS_COMMON (obj); +XICSStateClass *info =XICS_COMMON_GET_CLASS (icp); +Error *error =NULL ; +int64_t value; + +visit_type_int (v, &value, name, &error); +if (error) { +error_propagate (errp, error); +return ; + } +if (icp->nr_servers) { +error_setg (errp,"Number of servers is already set to %u" , + icp->nr_servers); +return ; + } + +assert (info->set_nr_servers); + info->set_nr_servers (icp, value, errp); +} + +static void xics_common_initfn (Object *obj) +{ +object_property_add (obj,"nr_irqs" ,"int" , + xics_prop_get_nr_irqs, xics_prop_set_nr_irqs, +NULL ,NULL ,NULL ); +object_property_add (obj,"nr_servers" ,"int" , + xics_prop_get_nr_servers, xics_prop_set_nr_servers, +NULL ,NULL ,NULL ); +} + +static void xics_common_class_init (ObjectClass *oc,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (oc); + + dc->reset = xics_common_reset; +} + +static const TypeInfo xics_common_info = { + .name =TYPE_XICS_COMMON , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (XICSState), + .class_size =sizeof (XICSStateClass), + .instance_init = xics_common_initfn, + .class_init = xics_common_class_init, +}; +/* * ICP: Presentation layer */
@@ -479,6 +576,13 @@ static const VMStateDescription vmstate_ics = { }, }; +static void ics_initfn (Object *obj) +{ +ICSState *ics =ICS (obj); + + ics->offset =XICS_IRQ_BASE ; +} +static void ics_realize (DeviceState *dev,Error **errp) {ICSState *ics =ICS (dev);
@@ -509,6 +613,7 @@ static const TypeInfo ics_info = { .instance_size = sizeof(ICSState), .class_init = ics_class_init, .class_size = sizeof(ICSStateClass), + .instance_init = ics_initfn, };/*
@@ -689,10 +794,31 @@ static void rtas_int_on(PowerPCCPU *cpu, sPAPREnvironment *spapr,* XICS */ +static void xics_set_nr_irqs (XICSState *icp,uint32_t nr_irqs,Error **errp) +{ + icp->nr_irqs = icp->ics->nr_irqs = nr_irqs; +} + +static void xics_set_nr_servers (XICSState *icp,uint32_t nr_servers, +Error **errp) +{ +int i; + + icp->nr_servers = nr_servers; + + icp->ss =g_malloc0 (icp->nr_servers*sizeof (ICPState)); +for (i =0 ; i < icp->nr_servers; i++) { +char buffer[32 ]; +object_initialize (&icp->ss[i],sizeof (icp->ss[i]),TYPE_ICP ); +snprintf (buffer,sizeof (buffer),"icp[%d]" , i); +object_property_add_child (OBJECT (icp), buffer,OBJECT (&icp->ss[i]), + errp); + } +} +static void xics_realize (DeviceState *dev,Error **errp) {XICSState *icp =XICS (dev); -ICSState *ics = icp->ics;Error *error =NULL ;int i;
@@ -712,21 +838,13 @@ static void xics_realize(DeviceState *dev, Error **errp)spapr_register_hypercall (H_XIRR , h_xirr);spapr_register_hypercall (H_EOI , h_eoi); - ics->nr_irqs = icp->nr_irqs; - ics->offset =XICS_IRQ_BASE ; - ics->icp = icp;object_property_set_bool (OBJECT (icp->ics), true,"realized" , &error);if (error) {error_propagate (errp, error);return ; } - icp->ss =g_malloc0 (icp->nr_servers*sizeof (ICPState));for (i =0 ; i < icp->nr_servers; i++) { -char buffer[32 ]; -object_initialize (&icp->ss[i],sizeof (icp->ss[i]),TYPE_ICP ); -snprintf (buffer,sizeof (buffer),"icp[%d]" , i); -object_property_add_child (OBJECT (icp), buffer,OBJECT (&icp->ss[i]),NULL );object_property_set_bool (OBJECT (&icp->ss[i]), true,"realized" , &error);if (error) {error_propagate (errp, error);
@@ -741,33 +859,31 @@ static void xics_initfn(Object *obj) xics->ics =ICS (object_new (TYPE_ICS ));object_property_add_child (obj,"ics" ,OBJECT (xics->ics),NULL ); + xics->ics->icp = xics; } -static Property xics_properties[] = { -DEFINE_PROP_UINT32 ("nr_servers" , XICSState, nr_servers,-1 ), -DEFINE_PROP_UINT32 ("nr_irqs" , XICSState, nr_irqs,-1 ), -DEFINE_PROP_END_OF_LIST (), -}; -static void xics_class_init (ObjectClass *oc,void *data) {DeviceClass *dc =DEVICE_CLASS (oc); +XICSStateClass *xsc =XICS_CLASS (oc); dc->realize = xics_realize; - dc->props = xics_properties; - dc->reset = xics_reset; + xsc->set_nr_irqs = xics_set_nr_irqs; + xsc->set_nr_servers = xics_set_nr_servers; }static const TypeInfo xics_info = { .name =TYPE_XICS , - .parent =TYPE_SYS_BUS_DEVICE , + .parent =TYPE_XICS_COMMON , .instance_size =sizeof (XICSState), + .class_size =sizeof (XICSStateClass), .class_init = xics_class_init, .instance_init = xics_initfn, };static void xics_register_types (void ) { +type_register_static (&xics_common_info);type_register_static (&xics_info);type_register_static (&ics_info);type_register_static (&icp_info);
hw/ppc/spapr.c +1 -1
@@ -161,7 +161,7 @@ static XICSState *try_create_xics(const char *type, int nr_servers,return NULL ; } -return XICS (dev); +return XICS_COMMON (dev); }static XICSState *xics_system_init (int nr_servers,int nr_irqs)
include/hw/ppc/xics.h +20 -0
@@ -29,9 +29,21 @@#include "hw/sysbus.h" +#define TYPE_XICS_COMMON "xics-common" +#define XICS_COMMON (obj) OBJECT_CHECK(XICSState, (obj), TYPE_XICS_COMMON) +#define TYPE_XICS "xics"#define XICS (obj) OBJECT_CHECK(XICSState, (obj), TYPE_XICS) +#define XICS_COMMON_CLASS (klass) \ + OBJECT_CLASS_CHECK(XICSStateClass, (klass), TYPE_XICS_COMMON) +#define XICS_CLASS (klass) \ + OBJECT_CLASS_CHECK(XICSStateClass, (klass), TYPE_XICS) +#define XICS_COMMON_GET_CLASS (obj) \ + OBJECT_GET_CLASS(XICSStateClass, (obj), TYPE_XICS_COMMON) +#define XICS_GET_CLASS (obj) \ + OBJECT_GET_CLASS(XICSStateClass, (obj), TYPE_XICS) +#define XICS_IPI 0x2#define XICS_BUID 0x1#define XICS_IRQ_BASE (XICS_BUID << 12)
@@ -41,6 +53,7 @@* (the kernel implementation supports more but we don't exploit * that yet) */ +typedef struct XICSStateClass XICSStateClass ;typedef struct XICSState XICSState ;typedef struct ICPStateClass ICPStateClass ;typedef struct ICPState ICPState ;
@@ -48,6 +61,13 @@ typedef struct ICSStateClass ICSStateClass;typedef struct ICSState ICSState ;typedef struct ICSIRQState ICSIRQState ; +struct XICSStateClass { +DeviceClass parent_class; + +void (*set_nr_irqs)(XICSState *icp,uint32_t nr_irqs,Error **errp); +void (*set_nr_servers)(XICSState *icp,uint32_t nr_servers,Error **errp); +}; +struct XICSState {/*< private >*/ SysBusDevice parent_obj;
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 06/29] spapr: increase temporary fdt buffer size
In reply to Alexander GrafFrom: Alexey Kardashevskiy <[email protected]>
At the moment the size of the buffer is set to 64K which is enough for approximately 150 VCPUs which is not the limit.
This increases the buffer up to 256K which allows having a tree for approximately 600 VCPUs which is way beyond the real number we need.
As only the real size of the tree is copied to the guest, there will be no impact on existing configurations.
--- hw/ppc/spapr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/spapr.c +1 -1
@@ -62,7 +62,7 @@* * We load our kernel at 4M, leaving space for SLOF initial image */ -#define FDT_MAX_SIZE 0x10000 +#define FDT_MAX_SIZE 0x40000#define RTAS_MAX_SIZE 0x10000#define FW_MAX_SIZE 0x400000#define FW_FILE_NAME "slof.bin"
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 09/29] target-ppc: Add helper for KVM_PPC_RTAS_DEFINE_TOKEN
In reply to Alexander GrafFrom: David Gibson <[email protected]>
Recent PowerKVM allows the kernel to intercept some RTAS calls from the guest directly. This is used to implement the more efficient in-kernel XICS for example. qemu is still responsible for assigning the RTAS token numbers however, and needs to tell the kernel which RTAS function name is assigned to a given token value. This patch adds a convenience wrapper for the KVM_PPC_RTAS_DEFINE_TOKEN ioctl() which is used for this purpose.
--- target-ppc/kvm.c | 14 ++++++++++++++ target-ppc/kvm_ppc.h | 7 +++++++ 2 files changed, 21 insertions(+)
target-ppc/kvm.c +14 -0
@@ -1789,6 +1789,20 @@ static int kvm_ppc_register_host_cpu_type(void)return 0 ; } +int kvmppc_define_rtas_kernel_token (uint32_t token,const char *function) +{ +struct kvm_rtas_token_args args = { + .token = token, + }; + +if (!kvm_check_extension (kvm_state,KVM_CAP_PPC_RTAS )) { +return -ENOENT ; + } + +strncpy (args.name, function,sizeof (args.name)); + +return kvm_vm_ioctl (kvm_state,KVM_PPC_RTAS_DEFINE_TOKEN , &args); +}int kvmppc_get_htab_fd (bool write) {
target-ppc/kvm_ppc.h +7 -0
@@ -38,6 +38,7 @@ uint64_t kvmppc_rma_size(uint64_t current_size, unsigned int hash_shift);#endif /* !CONFIG_USER_ONLY */ int kvmppc_fixup_cpu (PowerPCCPU *cpu);bool kvmppc_has_cap_epr (void ); +int kvmppc_define_rtas_kernel_token (uint32_t token,const char *function);int kvmppc_get_htab_fd (bool write);int kvmppc_save_htab (QEMUFile *f,int fd,size_t bufsize,int64_t max_ns); int kvmppc_load_htab_chunk(QEMUFile *f, int fd, uint32_t index,
@@ -164,6 +165,12 @@ static inline bool kvmppc_has_cap_epr(void)return false; } +static inline int kvmppc_define_rtas_kernel_token (uint32_t token, +const char *function) +{ +return -1 ; +} +static inline int kvmppc_get_htab_fd (bool write) {return -1 ;
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 18/29] xics-kvm: Support for in-kernel XICS interrupt controller
In reply to Alexander GrafFrom: David Gibson <[email protected]>
Recent (host) kernels support emulating the PAPR defined "XICS" interrupt controller system within KVM. This patch allows qemu to initialize and configure the in-kernel XICS, and keep its state in sync with qemu's XICS state as necessary.
This should give considerable performance improvements. e.g. on a simple IPI ping-pong test between hardware threads, using qemu XICS gives us around 5,000 irqs/second, whereas the in-kernel XICS gives us around 70,000 irqs/s on the same hardware configuration.
--- default-configs/ppc64-softmmu.mak | 1 + hw/intc/Makefile.objs | 1 + hw/intc/xics_kvm.c | 488 ++++++++++++++++++++++++++++++++++++++ hw/ppc/spapr.c | 21 +- include/hw/ppc/xics.h | 10 + 5 files changed, 520 insertions(+), 1 deletion(-) create mode 100644 hw/intc/xics_kvm.c
default-configs/ppc64-softmmu.mak +1 -0
@@ -46,6 +46,7 @@ CONFIG_E500=y CONFIG_OPENPIC_KVM=$(and $(CONFIG_E500),$(CONFIG_KVM)) # For pSeries CONFIG_XICS=$(CONFIG_PSERIES) +CONFIG_XICS_KVM=$(and $(CONFIG_PSERIES),$(CONFIG_KVM)) # For PReP CONFIG_I82378=y CONFIG_I8259=y
hw/intc/Makefile.objs +1 -0
@@ -23,3 +23,4 @@ obj-$(CONFIG_OMAP) += omap_intc.o obj-$(CONFIG_OPENPIC_KVM) += openpic_kvm.o obj-$(CONFIG_SH4) += sh_intc.o obj-$(CONFIG_XICS) += xics.o +obj-$(CONFIG_XICS_KVM) += xics_kvm.o
hw/intc/xics_kvm.c new file +488 -0
488 lines not on this page · raw message
hw/ppc/spapr.c +20 -1
@@ -168,7 +168,26 @@ static XICSState *xics_system_init(int nr_servers, int nr_irqs) {XICSState *icp =NULL ; - icp =try_create_xics (TYPE_XICS , nr_servers, nr_irqs); +if (kvm_enabled ()) { +QemuOpts *machine_opts =qemu_get_machine_opts (); +bool irqchip_allowed =qemu_opt_get_bool (machine_opts, +"kernel_irqchip" , true); +bool irqchip_required =qemu_opt_get_bool (machine_opts, +"kernel_irqchip" , false); +if (irqchip_allowed) { + icp =try_create_xics (TYPE_KVM_XICS , nr_servers, nr_irqs); + } + +if (irqchip_required && !icp) { +perror ("Failed to create in-kernel XICS\n" ); +abort (); + } + } + +if (!icp) { + icp =try_create_xics (TYPE_XICS , nr_servers, nr_irqs); + } +if (!icp) {perror ("Failed to create XICS\n" );abort ();
include/hw/ppc/xics.h +10 -0
@@ -35,6 +35,9 @@#define TYPE_XICS "xics"#define XICS (obj) OBJECT_CHECK(XICSState, (obj), TYPE_XICS) +#define TYPE_KVM_XICS "xics-kvm" +#define KVM_XICS (obj) OBJECT_CHECK(KVMXICSState, (obj), TYPE_KVM_XICS) +#define XICS_COMMON_CLASS (klass) \ OBJECT_CLASS_CHECK(XICSStateClass, (klass), TYPE_XICS_COMMON)#define XICS_CLASS (klass) \
@@ -82,6 +85,9 @@ struct XICSState {#define TYPE_ICP "icp"#define ICP (obj) OBJECT_CHECK(ICPState, (obj), TYPE_ICP) +#define TYPE_KVM_ICP "icp-kvm" +#define KVM_ICP (obj) OBJECT_CHECK(ICPState, (obj), TYPE_KVM_ICP) +#define ICP_CLASS (klass) \ OBJECT_CLASS_CHECK(ICPStateClass, (klass), TYPE_ICP)#define ICP_GET_CLASS (obj) \
@@ -98,6 +104,7 @@ struct ICPState {/*< private >*/ DeviceState parent_obj;/*< public >*/ +CPUState *cs;uint32_t xirr;uint8_t pending_priority;uint8_t mfrr;
@@ -107,6 +114,9 @@ struct ICPState {#define TYPE_ICS "ics"#define ICS (obj) OBJECT_CHECK(ICSState, (obj), TYPE_ICS) +#define TYPE_KVM_ICS "icskvm" +#define KVM_ICS (obj) OBJECT_CHECK(ICSState, (obj), TYPE_KVM_ICS) +#define ICS_CLASS (klass) \ OBJECT_CLASS_CHECK(ICSStateClass, (klass), TYPE_ICS)#define ICS_GET_CLASS (obj) \
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 23/29] target-ppc: Update slb array with correct index values.
In reply to Alexander GrafFrom: "Aneesh Kumar K.V" <[email protected]>
Without this, a value of rb=0 and rs=0 results in replacing the 0th index. This can be observed when using gdb remote debugging support.
(gdb) x/10i do_fork
0xc000000000085330 <do_fork>: Cannot access memory at address 0xc000000000085330
(gdb)
This is because when we do the slb sync via kvm_cpu_synchronize_state, we overwrite the slb entry (0th entry) for 0xc000000000085330
--- target-ppc/kvm.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
target-ppc/kvm.c +15 -2
@@ -1033,9 +1033,22 @@ int kvm_arch_get_registers(CPUState *cs)/* Sync SLB */ #ifdef TARGET_PPC64 +/* +* The packed SLB array we get from KVM_GET_SREGS only contains +* information about valid entries. So we flush our internal +* copy to get rid of stale ones, then put all valid SLB entries +* back in. +*/ +memset (env->slb,0 ,sizeof (env->slb));for (i =0 ; i <64 ; i++) { -ppc_store_slb (env, sregs.u.s.ppc64.slb[i].slbe, - sregs.u.s.ppc64.slb[i].slbv); +target_ulong rb = sregs.u.s.ppc64.slb[i].slbe; +target_ulong rs = sregs.u.s.ppc64.slb[i].slbv; +/* +* Only restore valid entries +*/ +if (rb &SLB_ESID_V ) { +ppc_store_slb (env, rb, rs); + } }#endif
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 26/29] dump-guest-memory: Check for the correct return value
In reply to Alexander GrafFrom: "Aneesh Kumar K.V" <[email protected]>
We should check for error with s->note_size
--- dump.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
dump.c +2 -2
@@ -66,7 +66,7 @@ typedef struct DumpState {uint32_t sh_info;bool have_section;bool resume; -size_t note_size; +ssize_t note_size;hwaddr memory_offset;int fd;
@@ -765,7 +765,7 @@ static int dump_init(DumpState *s, int fd, bool paging, bool has_filter, s->note_size =cpu_get_note_size (s->dump_info.d_class, s->dump_info.d_machine, nr_cpus); -if (ret <0 ) { +if (s->note_size <0 ) {error_set (errp,QERR_UNSUPPORTED ); goto cleanup; }
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 24/29] target-ppc: Check for error on address translation in memsave command
In reply to Alexander GrafFrom: "Aneesh Kumar K.V" <[email protected]>
When we translate the virtual address to physical check for error.
--- cpus.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
cpus.c +4 -1
@@ -1403,7 +1403,10 @@ void qmp_memsave(int64_t addr, int64_t size, const char *filename, l =sizeof (buf);if (l > size) l = size; -cpu_memory_rw_debug (cpu, addr, buf, l,0 ); +if (cpu_memory_rw_debug (cpu, addr, buf, l,0 ) !=0 ) { +error_setg (errp,"Invalid addr 0x%016" PRIx64"specified" , addr); + goto exit; + }if (fwrite (buf,1 , l, f) != l) {error_set (errp,QERR_IO_ERROR ); goto exit;
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 25/29] target-ppc: Use #define for max slb entries
In reply to Alexander GrafFrom: "Aneesh Kumar K.V" <[email protected]>
Instead of opencoding 64 use MAX_SLB_ENTRIES. We don't update the kernel header here.
--- target-ppc/cpu.h | 3 ++- target-ppc/kvm.c | 4 ++-- target-ppc/machine.c | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-)
target-ppc/cpu.h +2 -1
@@ -405,6 +405,7 @@ struct ppc_slb_t {uint64_t vsid; }; +#define MAX_SLB_ENTRIES 64#define SEGMENT_SHIFT_256M 28#define SEGMENT_MASK_256M (~((1ULL << SEGMENT_SHIFT_256M) - 1))
@@ -949,7 +950,7 @@ struct CPUPPCState {#if !defined(CONFIG_USER_ONLY )#if defined(TARGET_PPC64 )/* PowerPC 64 SLB area */ -ppc_slb_t slb[64 ]; +ppc_slb_t slb[MAX_SLB_ENTRIES ];int32_t slb_nr;#endif /* segment registers */
target-ppc/kvm.c +2 -2
@@ -818,7 +818,7 @@ int kvm_arch_put_registers(CPUState *cs, int level)/* Sync SLB */ #ifdef TARGET_PPC64 -for (i =0 ; i <64 ; i++) { +for (i =0 ; i <ARRAY_SIZE (env->slb); i++) { sregs.u.s.ppc64.slb[i].slbe = env->slb[i].esid; sregs.u.s.ppc64.slb[i].slbv = env->slb[i].vsid; }
@@ -1040,7 +1040,7 @@ int kvm_arch_get_registers(CPUState *cs)* back in. */ memset (env->slb,0 ,sizeof (env->slb)); -for (i =0 ; i <64 ; i++) { +for (i =0 ; i <ARRAY_SIZE (env->slb); i++) {target_ulong rb = sregs.u.s.ppc64.slb[i].slbe;target_ulong rs = sregs.u.s.ppc64.slb[i].slbv;/*
target-ppc/machine.c +1 -1
@@ -312,7 +312,7 @@ static const VMStateDescription vmstate_slb = { .minimum_version_id_old = 1, .fields = (VMStateField []) {VMSTATE_INT32_EQUAL (env.slb_nr, PowerPCCPU), -VMSTATE_SLB_ARRAY (env.slb, PowerPCCPU,64 ), +VMSTATE_SLB_ARRAY (env.slb, PowerPCCPU,MAX_SLB_ENTRIES ),VMSTATE_END_OF_LIST () } };
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 29/29] spapr: Use DeviceClass::fw_name for device tree CPU node
In reply to Alexander GrafFrom: Andreas Färber <[email protected]>
Instead of relying on cpu_model, obtain the device tree node label per CPU. Use DeviceClass::fw_name as source.
Whenever DeviceClass::fw_name is unknown, default to "PowerPC,UNKNOWN".
As a consequence, spapr_fixup_cpu_dt() can operate on each CPU's fw_name, obsoleting sPAPREnvironment::cpu_model, and spapr_create_fdt_skel() can drop its cpu_model argument.
--- hw/ppc/spapr.c | 26 ++++++-------------------- include/hw/ppc/spapr.h | 1 - target-ppc/translate_init.c | 2 ++ 3 files changed, 8 insertions(+), 21 deletions(-)
hw/ppc/spapr.c +6 -20
@@ -204,9 +204,8 @@ static int spapr_fixup_cpu_dt(void *fdt, sPAPREnvironment *spapr)int smt =kvmppc_smt_threads ();uint32_t pft_size_prop[] = {0 ,cpu_to_be32 (spapr->htab_shift)}; -assert (spapr->cpu_model); -CPU_FOREACH (cpu) { +DeviceClass *dc =DEVICE_GET_CLASS (cpu);uint32_t associativity[] = {cpu_to_be32 (0x5 ),cpu_to_be32 (0x0 ),cpu_to_be32 (0x0 ),
@@ -218,7 +217,7 @@ static int spapr_fixup_cpu_dt(void *fdt, sPAPREnvironment *spapr)continue ; } -snprintf (cpu_model,32 ,"/cpus/%s@%x" , spapr->cpu_model, +snprintf (cpu_model,32 ,"/cpus/%s@%x" , dc->fw_name, cpu->cpu_index); offset =fdt_path_offset (fdt, cpu_model);
@@ -288,8 +287,7 @@ static size_t create_page_sizes_prop(CPUPPCState *env, uint32_t *prop, }while (0 ) -static void *spapr_create_fdt_skel(const char *cpu_model, - hwaddr initrd_base, +static void *spapr_create_fdt_skel(hwaddr initrd_base, hwaddr initrd_size, hwaddr kernel_size, bool little_endian,
@@ -306,7 +304,6 @@ static void *spapr_create_fdt_skel(const char *cpu_model,char qemu_hypertas_prop[] ="hcall-memop1" ;uint32_t refpoints[] = {cpu_to_be32 (0x4 ),cpu_to_be32 (0x4 )};uint32_t interrupt_server_ranges_prop[] = {0 ,cpu_to_be32 (smp_cpus)}; -char *modelname;int i, smt =kvmppc_smt_threads ();unsigned char vec5[] = {0x0 ,0x0 ,0x0 ,0x0 ,0x0 ,0x80 };
@@ -365,18 +362,10 @@ static void *spapr_create_fdt_skel(const char *cpu_model,_FDT ((fdt_property_cell (fdt,"#address-cells" ,0x1 )));_FDT ((fdt_property_cell (fdt,"#size-cells" ,0x0 ))); - modelname =g_strdup (cpu_model); - -for (i =0 ; i <strlen (modelname); i++) { - modelname[i] =toupper (modelname[i]); - } - -/* This is needed during FDT finalization */ - spapr->cpu_model =g_strdup (modelname); -CPU_FOREACH (cs) {PowerPCCPU *cpu =POWERPC_CPU (cs);CPUPPCState *env = &cpu->env; +DeviceClass *dc =DEVICE_GET_CLASS (cs);PowerPCCPUClass *pcc =POWERPC_CPU_GET_CLASS (cs);int index = cs->cpu_index;uint32_t servers_prop[smp_threads];
@@ -393,7 +382,7 @@ static void *spapr_create_fdt_skel(const char *cpu_model,continue ; } - nodename =g_strdup_printf ("%s@%x" , modelname, index); + nodename =g_strdup_printf ("%s@%x" , dc->fw_name, index);_FDT ((fdt_begin_node (fdt, nodename)));
@@ -477,8 +466,6 @@ static void *spapr_create_fdt_skel(const char *cpu_model,_FDT ((fdt_end_node (fdt))); } -g_free (modelname); -_FDT ((fdt_end_node (fdt)));/* RTAS */
@@ -1363,8 +1350,7 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args) &savevm_htab_handlers, spapr);/* Prepare the device tree */ - spapr->fdt_skel =spapr_create_fdt_skel (cpu_model, - initrd_base, initrd_size, + spapr->fdt_skel =spapr_create_fdt_skel (initrd_base, initrd_size, kernel_size, kernel_le, boot_device, kernel_cmdline, spapr->epow_irq);
include/hw/ppc/spapr.h +0 -1
@@ -29,7 +29,6 @@ typedef struct sPAPREnvironment {target_ulong entry_point;uint32_t next_irq;uint64_t rtc_offset; -char *cpu_model;bool has_graphics;uint32_t epow_irq;
target-ppc/translate_init.c +2 -0
@@ -8587,6 +8587,8 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)#else cc->gdb_core_xml_file ="power-core.xml" ;#endif + + dc->fw_name ="PowerPC,UNKNOWN" ; }static const TypeInfo ppc_cpu_type_info = {
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 27/29] target-ppc: dump-guest-memory support
In reply to Alexander GrafFrom: "Aneesh Kumar K.V" <[email protected]>
This patch add support for dumping guest memory using dump-guest-memory monitor command.
Before patch:
(qemu) dump-guest-memory testcrash
this feature or command is not currently supported (qemu)
After patch:
(qemu) dump-guest-memory testcrash
(qemu)
crash was able to read the file
crash> bt
PID: 0 TASK: c000000000c0d0d0 CPU: 0 COMMAND: "swapper/0"
R0: 0000000028000084 R1: c000000000cafa50 R2: c000000000cb05b0 R3: 0000000000000000 R4: c000000000bc4cb0 R5: 0000000000000000 R6: 001efe93b8000000 R7: 0000000000000000 R8: 0000000000000000 R9: b000000000001032 R10: 0000000000000001 R11: 0001eb2117e00d55
....
...
NOTE: Currently crash tools doesn't look at ELF notes in the dump on ppc64.
--- include/elf.h | 3 + target-ppc/Makefile.objs | 2 +- target-ppc/arch_dump.c | 253 ++++++++++++++++++++++++++++++++++++++++++++ target-ppc/cpu-qom.h | 5 +- target-ppc/translate_init.c | 4 + 5 files changed, 265 insertions(+), 2 deletions(-) create mode 100644 target-ppc/arch_dump.c
include/elf.h +3 -0
@@ -1359,6 +1359,9 @@ typedef struct elf64_shdr {#define NT_S390_TODPREG 0x303/* s390 TOD programmable register */ #define NT_S390_TODCMP 0x302/* s390 TOD clock comparator register */ #define NT_S390_TIMER 0x301/* s390 timer register */ +#define NT_PPC_VMX 0x100/* PowerPC Altivec/VMX registers */ +#define NT_PPC_SPE 0x101/* PowerPC SPE/EVR registers */ +#define NT_PPC_VSX 0x102/* PowerPC VSX registers */ /* Note header in a PT_NOTE section */
target-ppc/Makefile.objs +1 -1
@@ -2,7 +2,7 @@ obj-y += cpu-models.o obj-y += translate.o ifeq ($(CONFIG_SOFTMMU),y) obj-y += machine.o mmu_helper.o mmu-hash32.o -obj-$(TARGET_PPC64) += mmu-hash64.o +obj-$(TARGET_PPC64) += mmu-hash64.o arch_dump.o endif obj-$(CONFIG_KVM) += kvm.o kvm_ppc.o obj-$(call lnot,$(CONFIG_KVM)) += kvm-stub.o
target-ppc/arch_dump.c new file +253 -0
253 lines not on this page · raw message
target-ppc/cpu-qom.h +4 -1
@@ -108,7 +108,10 @@ void ppc_cpu_dump_statistics(CPUState *cpu, FILE *f,hwaddr ppc_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr);int ppc_cpu_gdb_read_register (CPUState *cpu,uint8_t *buf,int reg);int ppc_cpu_gdb_write_register (CPUState *cpu,uint8_t *buf,int reg); - +int ppc64_cpu_write_elf64_qemunote (WriteCoreDumpFunction f, +CPUState *cpu,void *opaque); +int ppc64_cpu_write_elf64_note (WriteCoreDumpFunction f,CPUState *cs, +int cpuid,void *opaque);#ifndef CONFIG_USER_ONLY extern const struct VMStateDescription vmstate_ppc_cpu;#endif
target-ppc/translate_init.c +4 -0
@@ -8572,6 +8572,10 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)#ifndef CONFIG_USER_ONLY cc->get_phys_page_debug = ppc_cpu_get_phys_page_debug; cc->vmsd = &vmstate_ppc_cpu; +#if defined(TARGET_PPC64 ) + cc->write_elf64_note = ppc64_cpu_write_elf64_note; + cc->write_elf64_qemunote = ppc64_cpu_write_elf64_qemunote; +#endif #endif cc->gdb_num_core_regs =71 ;
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 28/29] target-ppc: Fill in OpenFirmware names for some PowerPCCPU families
In reply to Alexander GrafFrom: Andreas Färber <[email protected]>
Set the expected values for POWER7, POWER7+, POWER8 and POWER5+. Note that POWER5+ and POWER7+ are intentionally lacking the '+', so the lack of a POWER7P family constitutes no problem.
--- target-ppc/translate_init.c | 3 +++ 1 file changed, 3 insertions(+)
target-ppc/translate_init.c +3 -0
@@ -7108,6 +7108,7 @@ POWERPC_FAMILY(POWER5P)(ObjectClass *oc, void *data)DeviceClass *dc =DEVICE_CLASS (oc);PowerPCCPUClass *pcc =POWERPC_CPU_CLASS (oc); + dc->fw_name ="PowerPC,POWER5" ; dc->desc ="POWER5+" ; pcc->init_proc = init_proc_power5plus; pcc->check_pow = check_pow_970FX;
@@ -7218,6 +7219,7 @@ POWERPC_FAMILY(POWER7)(ObjectClass *oc, void *data)DeviceClass *dc =DEVICE_CLASS (oc);PowerPCCPUClass *pcc =POWERPC_CPU_CLASS (oc); + dc->fw_name ="PowerPC,POWER7" ; dc->desc ="POWER7" ; pcc->init_proc = init_proc_POWER7; pcc->check_pow = check_pow_nocheck;
@@ -7252,6 +7254,7 @@ POWERPC_FAMILY(POWER8)(ObjectClass *oc, void *data)DeviceClass *dc =DEVICE_CLASS (oc);PowerPCCPUClass *pcc =POWERPC_CPU_CLASS (oc); + dc->fw_name ="PowerPC,POWER8" ; dc->desc ="POWER8" ; pcc->init_proc = init_proc_POWER7; pcc->check_pow = check_pow_nocheck;
Signature · 1 line
1.8.1.4
[Qemu-devel] [PULL 01/29] pseries: Update SLOF firmware image
In reply to Alexander GrafFrom: Alexey Kardashevskiy <[email protected]>
This has reworked USB OHCI and adds support of USB EHCI, VIRTIO-SCSI and various fixes (IBM VSCSI, VGA and more).
The full list of fixes is:
* usb-ohci: Convert td-phys every time to td-virt
* usb-storage: Fix cbwflags field
* Add -fno-strict-aliasing in global CFLAGS
* usb: fix various issues found with js2x
* Move hex64-{decode,encode}-unit to node.fs
* usb: Use separate in-memory endian swap
* usb-ohci: collect TDs from done list
* js2x: more fixes
* js2x: Fix build of takeover image
* js2x: use new usb stack
* usb-ohci: Use proper memory barriers always
* usb: Fix a couple of warnings
* Fix $cat-instance-unit
* Cache phandle of /chosen
* Use root.fs on qemu as well
* usb-ehci: Add ehci handshake
* usb: add mb for write accessors
* usb-ohci: add missing memory barriers
* usb-ohci: suspend the controller in exit code path
* usb-ohci: Add a reset when closing the OHCI
* usb: Use proper accessors for MMIO and separate in-memory endian swap
* Use a global definition of sync() and mb()
* net-snk: Remove exception handling
* usb: unmap buffers
* slof: call quiesce on closing of stdin
* usb-kbd: accept "s" to drop to OF prompt
* USB storage driver
* usb-ohci: add Bulk transfer support
* usb-ehci: Add bulk support
* usb-core: add usb bulk support
* USB generic hub device driver
* usb-ehci: setup new device
* usb-ehci: Check ehci ports
* usb-ehci: initialize controller
* USB keyboard driver
* usb-core: setup new device
* usb-core: create dev pool allocation
* usb-ohci: implement ohci send control
* usb-core: usb send control
* usb-core: implement usb_{get,put}_pipe routines
* usb-ohci: allocate pipe pool
* usb-ohci: reset, init and check-ports
* Add standard header stdbool.h
* usb-slof: forth support routines for C
* usb-ehci: Add USB EHCI skeleton
* usb-core: Add register accessor functions
* Use __builtin_bswap routines for endianness swapping
* usb-core: hcd registration and query routines
* usb-core: adding generic dev-hci.fs
* usb-core: registration and makefiles
* Add new USB code
* Remove old usb code
* vga: fix hcall-invert-screen and hcall-blink-screen
* Enumerate disk/cdrom aliases for multiple disks or cdroms
* scsi: unify scsi probing code
* vscsi: generalizing probe code
* virtio-scsi: iterate through targets
* scsi: unify and use make-disk-alias
* nvram: remove unnecessary prints
* Add hack to client interface finddevice of "/memory"
* scsi: Fix cdrom boot crash when no medium present
* Look for /memory@0, not just /memory
* Fix instance>qname crashing when displaying instance arguments
* Fix js2x build
* scsi-disk: Bound check read-blocks
* Fix off by one error in scsi-disk get-capacity
* scsi: fix report-luns handling
* SLOF: virtio-scsi block driver code
* scsi: Move bits of vio-vscsi.fs to a common helpers file
* scsi: Move scsi-disk.fs to a generic place
* SLOF: virtio-scsi helper routines
* SLOF: virtio-scsi - add pci device file
* iso9660: Don't constantly reallocate the read buffer
* vscsi: Sanitize interface between scsi-disk.fs and vio-vscsi.fs
* vio-vscsi: Rework vio-vscsi support
* virtio: Add a virtio-set-qaddr helper
* disk-label: Allocate 4096 bytes for 4k block devices
* disk-label: Increase the max size of the PReP boot partition
* Make load-base a real environment variable
* vio-vscsi: Switch to using a wildcard "disk" node and make scsi-disk generic
* Fix disk-label package to use proper instance path
* Increase size of catpad
* Fix instance>path to contain unit address for wildcard nodes
* Fix handling of wildcard nodes in open-dev
* vio-vscsi: Get CRQ on open and release on close--- pc-bios/README | 2 +- pc-bios/slof.bin | Bin 909720 -> 875424 bytes roms/SLOF | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-)
pc-bios/README +1 -1
@@ -17,7 +17,7 @@ - SLOF (Slimline Open Firmware) is a free IEEE 1275 Open Firmware implementation for certain IBM POWER hardware. The sources are at https://github.com/aik/SLOF, and the image currently in qemu is - built from git tag qemu-slof-20130430. + built from git tag qemu-slof-20130827. - sgabios (the Serial Graphics Adapter option ROM) provides a means for legacy x86 software to communicate with an attached serial console as
pc-bios/slof.bin binary +0 -0
roms/SLOF +1 -1
@@ -1 +1 @@ -Subproject commit 8cfdfc43f4c4c8c8dfa4b7cf16f7c19c84eee812 +Subproject commit a523d1b0cd6e96cf5e393f0a10f897e8ed639fdc
Signature · 1 line
1.8.1.4
Quoted 5 lines · Alexander Graf
Hi Blue / Aurelien / Anthony,
This is my current patch queue for ppc. Please pull.
Alex
Hi Alex,
Did you get my repost of the PPC PCI configuration space patch to qemu-devel here: http://lists.gnu.org/archive/html/qemu-devel/2013-10/msg01491.html? Or should that go via someone else's tree?
ATB,
Mark.
Hey Mark,
Am 25.10.2013 um 23:59 schrieb Mark Cave-Ayland <[email protected]>:
Quoted 11 lines · Alexander Graf
Quoted 6 lines
Hi Blue / Aurelien / Anthony,
This is my current patch queue for ppc. Please pull.
Alex
Hi Alex,
Did you get my repost of the PPC PCI configuration space patch to qemu-devel here: http://lists.gnu.org/archive/html/qemu-devel/2013-10/msg01491.html? Or should that go via someone else's tree?
Thanks a lot for the reminder. There is absolutely nothibg wrong with the patch, but I wanted to make sure that I have a fully autotested tree synced out before the hard freeze. I'll send this together with the next SLOF update as soon as the SLOF git tree is synchronized.
Since this is a genuine bugfix, we can always get it into QEMU after the hard freeze deadline.
Alex
Quoted 5 lines · Alexander Graf
Quoted 1 line
Did you get my repost of the PPC PCI configuration space patch to qemu-devel here: http://lists.gnu.org/archive/html/qemu-devel/2013-10/msg01491.html? Or should that go via someone else's tree?
Thanks a lot for the reminder. There is absolutely nothibg wrong with the patch, but I wanted to make sure that I have a fully autotested tree synced out before the hard freeze. I'll send this together with the next SLOF update as soon as the SLOF git tree is synchronized.
Since this is a genuine bugfix, we can always get it into QEMU after the hard freeze deadline.
Great - thanks Alex!
ATB,
Mark.