sPAPRMachineState cleanups
v2 cover sPAPRMachineState cleanups
This series makes some cleanups to the structures tracking overall machine state for spapr (-machine pseries). First the old sPAPREnvironment structure (which predates the generic MachineState structure) is merged into a spapr specific subclass of MachineState. Then some obsolete fields are cleaned up.
If I receive a review or two, with nothing terribly wrong, I'll merge this into the spapr-next branch.
Changes since v1:
* Don't rename 'spapr' variables to 'sm' everywhere - it was needless churn
* Fix some small style errors
David Gibson (4):
spapr: Merge sPAPREnvironment into sPAPRMachineState
spapr: Remove obsolete ram_limit field from sPAPRMachineState
spapr: Remove obsolete entry_point field from sPAPRMachineState
spapr: Add sPAPRMachineClass
hw/char/spapr_vty.c | 6 +-- hw/intc/xics.c | 20 ++++----- hw/intc/xics_kvm.c | 2 +- hw/net/spapr_llan.c | 12 +++--- hw/nvram/spapr_nvram.c | 4 +- hw/ppc/spapr.c | 100 +++++++++++++++++++------------------------- hw/ppc/spapr_events.c | 13 ++++-- hw/ppc/spapr_hcall.c | 39 +++++++++-------- hw/ppc/spapr_iommu.c | 8 ++-- hw/ppc/spapr_pci.c | 37 ++++++++-------- hw/ppc/spapr_rtas.c | 38 ++++++++--------- hw/ppc/spapr_rtc.c | 4 +- hw/ppc/spapr_vio.c | 15 +++---- include/hw/pci-host/spapr.h | 10 +++-- include/hw/ppc/spapr.h | 51 +++++++++++++++++----- include/hw/ppc/spapr_vio.h | 4 +- 16 files changed, 199 insertions(+), 164 deletions(-)
Signature · 1 line
2.1.0
PATCH v2 1/4 spapr: Merge sPAPREnvironment into sPAPRMachineState
The code for -machine pseries maintains a global sPAPREnvironment structure which keeps track of general state information about the guest platform. This predates the existence of the MachineState structure, but performs basically the same function.
Now that we have the generic MachineState, fold sPAPREnvironment into sPAPRMachineState, the pseries specific subclass of MachineState.
This is mostly a matter of search and replace, although a few places which relied on the global spapr variable are changed to find the structure via qdev_get_machine().
--- hw/char/spapr_vty.c | 6 ++-- hw/intc/xics.c | 20 ++++++------- hw/intc/xics_kvm.c | 2 +- hw/net/spapr_llan.c | 12 ++++---- hw/nvram/spapr_nvram.c | 4 +-- hw/ppc/spapr.c | 73 +++++++++++++++++++-------------------------- hw/ppc/spapr_events.c | 13 +++++--- hw/ppc/spapr_hcall.c | 36 +++++++++++----------- hw/ppc/spapr_iommu.c | 8 ++--- hw/ppc/spapr_pci.c | 37 ++++++++++++----------- hw/ppc/spapr_rtas.c | 38 +++++++++++------------ hw/ppc/spapr_rtc.c | 4 +-- hw/ppc/spapr_vio.c | 15 +++++----- include/hw/pci-host/spapr.h | 10 ++++--- include/hw/ppc/spapr.h | 33 ++++++++++++++------ include/hw/ppc/spapr_vio.h | 4 ++- 16 files changed, 167 insertions(+), 148 deletions(-)
hw/char/spapr_vty.c +3 -3
@@ -74,7 +74,7 @@ static void spapr_vty_realize(VIOsPAPRDevice *sdev, Error **errp) }/* Forward declaration */ -static target_ulong h_put_term_char (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static target_ulong h_put_term_char (PowerPCCPU *cpu,sPAPRMachineState *spapr,target_ulong opcode,target_ulong *args) {target_ulong reg = args[0 ];
@@ -101,7 +101,7 @@ static target_ulong h_put_term_char(PowerPCCPU *cpu, sPAPREnvironment *spapr,return H_SUCCESS ; } -static target_ulong h_get_term_char (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static target_ulong h_get_term_char (PowerPCCPU *cpu,sPAPRMachineState *spapr,target_ulong opcode,target_ulong *args) {target_ulong reg = args[0 ];
@@ -214,7 +214,7 @@ VIOsPAPRDevice *spapr_vty_get_default(VIOsPAPRBus *bus)return selected; } -VIOsPAPRDevice *vty_lookup (sPAPREnvironment *spapr,target_ulong reg) +VIOsPAPRDevice *vty_lookup (sPAPRMachineState *spapr,target_ulong reg) {VIOsPAPRDevice *sdev;
hw/intc/xics.c +10 -10
@@ -806,7 +806,7 @@ void xics_free(XICSState *icp, int irq, int num)* Guest interfaces */ -static target_ulong h_cppr (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static target_ulong h_cppr (PowerPCCPU *cpu,sPAPRMachineState *spapr,target_ulong opcode,target_ulong *args) {CPUState *cs =CPU (cpu);
@@ -816,7 +816,7 @@ static target_ulong h_cppr(PowerPCCPU *cpu, sPAPREnvironment *spapr,return H_SUCCESS ; } -static target_ulong h_ipi (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static target_ulong h_ipi (PowerPCCPU *cpu,sPAPRMachineState *spapr,target_ulong opcode,target_ulong *args) {target_ulong server =get_cpu_index_by_dt_id (args[0 ]);
@@ -830,7 +830,7 @@ static target_ulong h_ipi(PowerPCCPU *cpu, sPAPREnvironment *spapr,return H_SUCCESS ; } -static target_ulong h_xirr (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static target_ulong h_xirr (PowerPCCPU *cpu,sPAPRMachineState *spapr,target_ulong opcode,target_ulong *args) {CPUState *cs =CPU (cpu);
@@ -840,7 +840,7 @@ static target_ulong h_xirr(PowerPCCPU *cpu, sPAPREnvironment *spapr,return H_SUCCESS ; } -static target_ulong h_xirr_x (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static target_ulong h_xirr_x (PowerPCCPU *cpu,sPAPRMachineState *spapr,target_ulong opcode,target_ulong *args) {CPUState *cs =CPU (cpu);
@@ -852,7 +852,7 @@ static target_ulong h_xirr_x(PowerPCCPU *cpu, sPAPREnvironment *spapr,return H_SUCCESS ; } -static target_ulong h_eoi (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static target_ulong h_eoi (PowerPCCPU *cpu,sPAPRMachineState *spapr,target_ulong opcode,target_ulong *args) {CPUState *cs =CPU (cpu);
@@ -862,7 +862,7 @@ static target_ulong h_eoi(PowerPCCPU *cpu, sPAPREnvironment *spapr,return H_SUCCESS ; } -static target_ulong h_ipoll (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static target_ulong h_ipoll (PowerPCCPU *cpu,sPAPRMachineState *spapr,target_ulong opcode,target_ulong *args) {CPUState *cs =CPU (cpu);
@@ -874,7 +874,7 @@ static target_ulong h_ipoll(PowerPCCPU *cpu, sPAPREnvironment *spapr,return H_SUCCESS ; } -static void rtas_set_xive (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static void rtas_set_xive (PowerPCCPU *cpu,sPAPRMachineState *spapr,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
@@ -902,7 +902,7 @@ static void rtas_set_xive(PowerPCCPU *cpu, sPAPREnvironment *spapr,rtas_st (rets,0 ,RTAS_OUT_SUCCESS ); } -static void rtas_get_xive (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static void rtas_get_xive (PowerPCCPU *cpu,sPAPRMachineState *spapr,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
@@ -927,7 +927,7 @@ static void rtas_get_xive(PowerPCCPU *cpu, sPAPREnvironment *spapr,rtas_st (rets,2 , ics->irqs[nr - ics->offset].priority); } -static void rtas_int_off (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static void rtas_int_off (PowerPCCPU *cpu,sPAPRMachineState *spapr,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
@@ -953,7 +953,7 @@ static void rtas_int_off(PowerPCCPU *cpu, sPAPREnvironment *spapr,rtas_st (rets,0 ,RTAS_OUT_SUCCESS ); } -static void rtas_int_on (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static void rtas_int_on (PowerPCCPU *cpu,sPAPRMachineState *spapr,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
hw/intc/xics_kvm.c +1 -1
@@ -368,7 +368,7 @@ static void xics_kvm_set_nr_servers(XICSState *icp, uint32_t nr_servers, } } -static void rtas_dummy (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static void rtas_dummy (PowerPCCPU *cpu,sPAPRMachineState *spapr,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
hw/net/spapr_llan.c +7 -5
@@ -284,7 +284,7 @@ static int check_bd(VIOsPAPRVLANDevice *dev, vlan_bd_t bd, }static target_ulong h_register_logical_lan (PowerPCCPU *cpu, -sPAPREnvironment *spapr, +sPAPRMachineState *spapr,target_ulong opcode,target_ulong *args) {
@@ -349,7 +349,8 @@ static target_ulong h_register_logical_lan(PowerPCCPU *cpu, } -static target_ulong h_free_logical_lan (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static target_ulong h_free_logical_lan (PowerPCCPU *cpu, +sPAPRMachineState *spapr,target_ulong opcode,target_ulong *args) {target_ulong reg = args[0 ];
@@ -371,7 +372,7 @@ static target_ulong h_free_logical_lan(PowerPCCPU *cpu, sPAPREnvironment *spapr, }static target_ulong h_add_logical_lan_buffer (PowerPCCPU *cpu, -sPAPREnvironment *spapr, +sPAPRMachineState *spapr,target_ulong opcode,target_ulong *args) {
@@ -421,7 +422,8 @@ static target_ulong h_add_logical_lan_buffer(PowerPCCPU *cpu,return H_SUCCESS ; } -static target_ulong h_send_logical_lan (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static target_ulong h_send_logical_lan (PowerPCCPU *cpu, +sPAPRMachineState *spapr,target_ulong opcode,target_ulong *args) {target_ulong reg = args[0 ];
@@ -490,7 +492,7 @@ static target_ulong h_send_logical_lan(PowerPCCPU *cpu, sPAPREnvironment *spapr,return H_SUCCESS ; } -static target_ulong h_multicast_ctrl (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static target_ulong h_multicast_ctrl (PowerPCCPU *cpu,sPAPRMachineState *spapr,target_ulong opcode,target_ulong *args) {target_ulong reg = args[0 ];
hw/nvram/spapr_nvram.c +2 -2
@@ -45,7 +45,7 @@ typedef struct sPAPRNVRAM {#define DEFAULT_NVRAM_SIZE 65536#define MAX_NVRAM_SIZE 1048576 -static void rtas_nvram_fetch (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static void rtas_nvram_fetch (PowerPCCPU *cpu,sPAPRMachineState *spapr,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
@@ -86,7 +86,7 @@ static void rtas_nvram_fetch(PowerPCCPU *cpu, sPAPREnvironment *spapr,rtas_st (rets,1 , len); } -static void rtas_nvram_store (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static void rtas_nvram_store (PowerPCCPU *cpu,sPAPRMachineState *spapr,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
hw/ppc/spapr.c +30 -43
222 lines not on this page · raw message
hw/ppc/spapr_events.c +9 -4
@@ -238,6 +238,7 @@ void spapr_events_fdt_skel(void *fdt, uint32_t check_exception_irq)static void rtas_event_log_queue (int log_type,void *data,bool exception) { +sPAPRMachineState *spapr =SPAPR_MACHINE (qdev_get_machine ());sPAPREventLogEntry *entry =g_new (sPAPREventLogEntry,1 );g_assert (data);
@@ -250,6 +251,7 @@ static void rtas_event_log_queue(int log_type, void *data, bool exception)static sPAPREventLogEntry *rtas_event_log_dequeue (uint32_t event_mask,bool exception) { +sPAPRMachineState *spapr =SPAPR_MACHINE (qdev_get_machine ());sPAPREventLogEntry *entry =NULL ;/* we only queue EPOW events atm. */
@@ -278,6 +280,7 @@ static sPAPREventLogEntry *rtas_event_log_dequeue(uint32_t event_mask,static bool rtas_event_log_contains (uint32_t event_mask,bool exception) { +sPAPRMachineState *spapr =SPAPR_MACHINE (qdev_get_machine ());sPAPREventLogEntry *entry =NULL ;/* we only queue EPOW events atm. */
@@ -314,6 +317,7 @@ static void spapr_init_v6hdr(struct rtas_event_log_v6 *v6hdr)static void spapr_init_maina (struct rtas_event_log_v6_maina *maina,int section_count) { +sPAPRMachineState *spapr =SPAPR_MACHINE (qdev_get_machine ());struct tm tm;int year;
@@ -336,7 +340,7 @@ static void spapr_init_maina(struct rtas_event_log_v6_maina *maina,static void spapr_powerdown_req (Notifier *n,void *opaque) { -sPAPREnvironment *spapr =container_of (n, sPAPREnvironment, epow_notifier); +sPAPRMachineState *spapr =SPAPR_MACHINE (qdev_get_machine ());struct rtas_error_log *hdr;struct rtas_event_log_v6 *v6hdr;struct rtas_event_log_v6_maina *maina;
@@ -384,6 +388,7 @@ static void spapr_powerdown_req(Notifier *n, void *opaque)static void spapr_hotplug_req_event (sPAPRDRConnector *drc,uint8_t hp_action) { +sPAPRMachineState *spapr =SPAPR_MACHINE (qdev_get_machine ());struct hp_log_full *new_hp;struct rtas_error_log *hdr;struct rtas_event_log_v6 *v6hdr;
@@ -453,7 +458,7 @@ void spapr_hotplug_req_remove_event(sPAPRDRConnector *drc)spapr_hotplug_req_event (drc,RTAS_LOG_V6_HP_ACTION_REMOVE ); } -static void check_exception (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static void check_exception (PowerPCCPU *cpu,sPAPRMachineState *spapr,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
@@ -508,7 +513,7 @@ out_no_events:rtas_st (rets,0 ,RTAS_OUT_NO_ERRORS_FOUND ); } -static void event_scan (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static void event_scan (PowerPCCPU *cpu,sPAPRMachineState *spapr,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
@@ -548,7 +553,7 @@ out_no_events:rtas_st (rets,0 ,RTAS_OUT_NO_ERRORS_FOUND ); } -void spapr_events_init (sPAPREnvironment *spapr) +void spapr_events_init (sPAPRMachineState *spapr) {QTAILQ_INIT (&spapr->pending_events); spapr->check_exception_irq =xics_alloc (spapr->icp,0 ,0 , false);
hw/ppc/spapr_hcall.c +19 -17
@@ -84,7 +84,7 @@ static inline bool valid_pte_index(CPUPPCState *env, target_ulong pte_index)return true; } -static target_ulong h_enter (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static target_ulong h_enter (PowerPCCPU *cpu,sPAPRMachineState *spapr,target_ulong opcode,target_ulong *args) {CPUPPCState *env = &cpu->env;
@@ -205,7 +205,7 @@ static RemoveResult remove_hpte(CPUPPCState *env, target_ulong ptex,return REMOVE_SUCCESS ; } -static target_ulong h_remove (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static target_ulong h_remove (PowerPCCPU *cpu,sPAPRMachineState *spapr,target_ulong opcode,target_ulong *args) {CPUPPCState *env = &cpu->env;
@@ -252,7 +252,7 @@ static target_ulong h_remove(PowerPCCPU *cpu, sPAPREnvironment *spapr,#define H_BULK_REMOVE_MAX_BATCH 4 -static target_ulong h_bulk_remove (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static target_ulong h_bulk_remove (PowerPCCPU *cpu,sPAPRMachineState *spapr,target_ulong opcode,target_ulong *args) {CPUPPCState *env = &cpu->env;
@@ -299,7 +299,7 @@ static target_ulong h_bulk_remove(PowerPCCPU *cpu, sPAPREnvironment *spapr,return H_SUCCESS ; } -static target_ulong h_protect (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static target_ulong h_protect (PowerPCCPU *cpu,sPAPRMachineState *spapr,target_ulong opcode,target_ulong *args) {CPUPPCState *env = &cpu->env;
@@ -337,7 +337,7 @@ static target_ulong h_protect(PowerPCCPU *cpu, sPAPREnvironment *spapr,return H_SUCCESS ; } -static target_ulong h_read (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static target_ulong h_read (PowerPCCPU *cpu,sPAPRMachineState *spapr,target_ulong opcode,target_ulong *args) {CPUPPCState *env = &cpu->env;
@@ -367,7 +367,7 @@ static target_ulong h_read(PowerPCCPU *cpu, sPAPREnvironment *spapr,return H_SUCCESS ; } -static target_ulong h_set_dabr (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static target_ulong h_set_dabr (PowerPCCPU *cpu,sPAPRMachineState *spapr,target_ulong opcode,target_ulong *args) {/* FIXME: actually implement this */
@@ -506,7 +506,7 @@ static target_ulong deregister_dtl(CPUPPCState *env, target_ulong addr)return H_SUCCESS ; } -static target_ulong h_register_vpa (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static target_ulong h_register_vpa (PowerPCCPU *cpu,sPAPRMachineState *spapr,target_ulong opcode,target_ulong *args) {target_ulong flags = args[0 ];
@@ -551,7 +551,7 @@ static target_ulong h_register_vpa(PowerPCCPU *cpu, sPAPREnvironment *spapr,return ret; } -static target_ulong h_cede (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static target_ulong h_cede (PowerPCCPU *cpu,sPAPRMachineState *spapr,target_ulong opcode,target_ulong *args) {CPUPPCState *env = &cpu->env;
@@ -567,7 +567,7 @@ static target_ulong h_cede(PowerPCCPU *cpu, sPAPREnvironment *spapr,return H_SUCCESS ; } -static target_ulong h_rtas (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static target_ulong h_rtas (PowerPCCPU *cpu,sPAPRMachineState *spapr,target_ulong opcode,target_ulong *args) {target_ulong rtas_r3 = args[0 ];
@@ -579,7 +579,7 @@ static target_ulong h_rtas(PowerPCCPU *cpu, sPAPREnvironment *spapr, nret, rtas_r3 + 12 + 4*nargs); } -static target_ulong h_logical_load (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static target_ulong h_logical_load (PowerPCCPU *cpu,sPAPRMachineState *spapr,target_ulong opcode,target_ulong *args) {CPUState *cs =CPU (cpu);
@@ -603,7 +603,7 @@ static target_ulong h_logical_load(PowerPCCPU *cpu, sPAPREnvironment *spapr,return H_PARAMETER ; } -static target_ulong h_logical_store (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static target_ulong h_logical_store (PowerPCCPU *cpu,sPAPRMachineState *spapr,target_ulong opcode,target_ulong *args) {CPUState *cs =CPU (cpu);
@@ -629,7 +629,7 @@ static target_ulong h_logical_store(PowerPCCPU *cpu, sPAPREnvironment *spapr,return H_PARAMETER ; } -static target_ulong h_logical_memop (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static target_ulong h_logical_memop (PowerPCCPU *cpu,sPAPRMachineState *spapr,target_ulong opcode,target_ulong *args) {CPUState *cs =CPU (cpu);
@@ -698,14 +698,14 @@ static target_ulong h_logical_memop(PowerPCCPU *cpu, sPAPREnvironment *spapr,return H_SUCCESS ; } -static target_ulong h_logical_icbi (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static target_ulong h_logical_icbi (PowerPCCPU *cpu,sPAPRMachineState *spapr,target_ulong opcode,target_ulong *args) {/* Nothing to do on emulation, KVM will trap this in the kernel */ return H_SUCCESS ; } -static target_ulong h_logical_dcbf (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static target_ulong h_logical_dcbf (PowerPCCPU *cpu,sPAPRMachineState *spapr,target_ulong opcode,target_ulong *args) {/* Nothing to do on emulation, KVM will trap this in the kernel */
@@ -788,7 +788,7 @@ static target_ulong h_set_mode_resource_addr_trans_mode(PowerPCCPU *cpu,return H_SUCCESS ; } -static target_ulong h_set_mode (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static target_ulong h_set_mode (PowerPCCPU *cpu,sPAPRMachineState *spapr,target_ulong opcode,target_ulong *args) {target_ulong resource = args[1 ];
@@ -828,7 +828,7 @@ static void do_set_compat(void *arg) ((cpuver) == CPU_POWERPC_LOGICAL_2_07) ? 2070 : 0)static target_ulong h_client_architecture_support (PowerPCCPU *cpu_, -sPAPREnvironment *spapr, +sPAPRMachineState *spapr,target_ulong opcode,target_ulong *args) {
@@ -921,7 +921,7 @@ static target_ulong h_client_architecture_support(PowerPCCPU *cpu_,return H_SUCCESS ; } -if (spapr_h_cas_compose_response (args[1 ], args[2 ])) { +if (spapr_h_cas_compose_response (spapr, args[1 ], args[2 ])) {qemu_system_reset_request (); }
@@ -952,6 +952,8 @@ void spapr_register_hypercall(target_ulong opcode, spapr_hcall_fn fn)target_ulong spapr_hypercall (PowerPCCPU *cpu,target_ulong opcode,target_ulong *args) { +sPAPRMachineState *spapr =SPAPR_MACHINE (qdev_get_machine ()); +if ((opcode <=MAX_HCALL_OPCODE ) && ((opcode &0x3 ) ==0 )) {spapr_hcall_fn fn = papr_hypercall_table[opcode /4 ];
hw/ppc/spapr_iommu.c +4 -4
@@ -240,7 +240,7 @@ static target_ulong put_tce_emu(sPAPRTCETable *tcet, target_ulong ioba, }static target_ulong h_put_tce_indirect (PowerPCCPU *cpu, -sPAPREnvironment *spapr, +sPAPRMachineState *spapr,target_ulong opcode,target_ulong *args) {int i;
@@ -287,7 +287,7 @@ static target_ulong h_put_tce_indirect(PowerPCCPU *cpu,return ret; } -static target_ulong h_stuff_tce (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static target_ulong h_stuff_tce (PowerPCCPU *cpu,sPAPRMachineState *spapr,target_ulong opcode,target_ulong *args) {int i;
@@ -326,7 +326,7 @@ static target_ulong h_stuff_tce(PowerPCCPU *cpu, sPAPREnvironment *spapr,return ret; } -static target_ulong h_put_tce (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static target_ulong h_put_tce (PowerPCCPU *cpu,sPAPRMachineState *spapr,target_ulong opcode,target_ulong *args) {target_ulong liobn = args[0 ];
@@ -367,7 +367,7 @@ static target_ulong get_tce_emu(sPAPRTCETable *tcet, target_ulong ioba,return H_SUCCESS ; } -static target_ulong h_get_tce (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static target_ulong h_get_tce (PowerPCCPU *cpu,sPAPRMachineState *spapr,target_ulong opcode,target_ulong *args) {target_ulong liobn = args[0 ];
hw/ppc/spapr_pci.c +20 -17
@@ -58,7 +58,7 @@ } \ }while (0 ) -sPAPRPHBState *spapr_pci_find_phb(sPAPREnvironment *spapr, uint64_t buid) +sPAPRPHBState *spapr_pci_find_phb(sPAPRMachineState *spapr, uint64_t buid) {sPAPRPHBState *sphb;
@@ -72,7 +72,7 @@ sPAPRPHBState *spapr_pci_find_phb(sPAPREnvironment *spapr, uint64_t buid)return NULL ; } -PCIDevice *spapr_pci_find_dev (sPAPREnvironment *spapr,uint64_t buid, +PCIDevice *spapr_pci_find_dev (sPAPRMachineState *spapr,uint64_t buid,uint32_t config_addr) {sPAPRPHBState *sphb =spapr_pci_find_phb (spapr, buid);
@@ -93,7 +93,7 @@ static uint32_t rtas_pci_cfgaddr(uint32_t arg)return ((arg >>20 ) &0xf00 ) | (arg &0xff ); } -static void finish_read_pci_config (sPAPREnvironment *spapr,uint64_t buid, +static void finish_read_pci_config (sPAPRMachineState *spapr,uint64_t buid,uint32_t addr,uint32_t size,target_ulong rets) {
@@ -123,7 +123,7 @@ static void finish_read_pci_config(sPAPREnvironment *spapr, uint64_t buid,rtas_st (rets,1 , val); } -static void rtas_ibm_read_pci_config (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static void rtas_ibm_read_pci_config (PowerPCCPU *cpu,sPAPRMachineState *spapr,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
@@ -143,7 +143,7 @@ static void rtas_ibm_read_pci_config(PowerPCCPU *cpu, sPAPREnvironment *spapr,finish_read_pci_config (spapr, buid, addr, size, rets); } -static void rtas_read_pci_config (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static void rtas_read_pci_config (PowerPCCPU *cpu,sPAPRMachineState *spapr,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
@@ -161,7 +161,7 @@ static void rtas_read_pci_config(PowerPCCPU *cpu, sPAPREnvironment *spapr,finish_read_pci_config (spapr,0 , addr, size, rets); } -static void finish_write_pci_config (sPAPREnvironment *spapr,uint64_t buid, +static void finish_write_pci_config (sPAPRMachineState *spapr,uint64_t buid,uint32_t addr,uint32_t size,uint32_t val,target_ulong rets) {
@@ -189,7 +189,7 @@ static void finish_write_pci_config(sPAPREnvironment *spapr, uint64_t buid,rtas_st (rets,0 ,RTAS_OUT_SUCCESS ); } -static void rtas_ibm_write_pci_config (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static void rtas_ibm_write_pci_config (PowerPCCPU *cpu,sPAPRMachineState *spapr,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
@@ -210,7 +210,7 @@ static void rtas_ibm_write_pci_config(PowerPCCPU *cpu, sPAPREnvironment *spapr,finish_write_pci_config (spapr, buid, addr, size, val, rets); } -static void rtas_write_pci_config (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static void rtas_write_pci_config (PowerPCCPU *cpu,sPAPRMachineState *spapr,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
@@ -259,7 +259,7 @@ static void spapr_msi_setmsg(PCIDevice *pdev, hwaddr addr, bool msix, } } -static void rtas_ibm_change_msi (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static void rtas_ibm_change_msi (PowerPCCPU *cpu,sPAPRMachineState *spapr,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
@@ -377,7 +377,7 @@ out: } static void rtas_ibm_query_interrupt_source_number(PowerPCCPU *cpu, - sPAPREnvironment *spapr, + sPAPRMachineState *spapr, uint32_t token, uint32_t nargs, target_ulong args,
@@ -418,7 +418,7 @@ static void rtas_ibm_query_interrupt_source_number(PowerPCCPU *cpu, }static void rtas_ibm_set_eeh_option (PowerPCCPU *cpu, -sPAPREnvironment *spapr, +sPAPRMachineState *spapr,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
@@ -456,7 +456,7 @@ param_error_exit: }static void rtas_ibm_get_config_addr_info2 (PowerPCCPU *cpu, -sPAPREnvironment *spapr, +sPAPRMachineState *spapr,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
@@ -512,7 +512,7 @@ param_error_exit: }static void rtas_ibm_read_slot_reset_state2 (PowerPCCPU *cpu, -sPAPREnvironment *spapr, +sPAPRMachineState *spapr,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
@@ -556,7 +556,7 @@ param_error_exit: }static void rtas_ibm_set_slot_reset (PowerPCCPU *cpu, -sPAPREnvironment *spapr, +sPAPRMachineState *spapr,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
@@ -592,7 +592,7 @@ param_error_exit: }static void rtas_ibm_configure_pe (PowerPCCPU *cpu, -sPAPREnvironment *spapr, +sPAPRMachineState *spapr,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
@@ -627,7 +627,7 @@ param_error_exit:/* To support it later */ static void rtas_ibm_slot_error_detail (PowerPCCPU *cpu, -sPAPREnvironment *spapr, +sPAPRMachineState *spapr,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
@@ -718,6 +718,7 @@ static PCIINTxRoute spapr_route_intx_pin_to_irq(void *opaque, int pin)static void spapr_msi_write (void *opaque,hwaddr addr,uint64_t data,unsigned size) { +sPAPRMachineState *spapr =SPAPR_MACHINE (qdev_get_machine ());uint32_t irq = data;trace_spapr_pci_msi_write (addr, data, irq);
@@ -1110,6 +1111,7 @@ static void spapr_phb_hot_unplug_child(HotplugHandler *plug_handler,static void spapr_phb_realize (DeviceState *dev,Error **errp) { +sPAPRMachineState *spapr =SPAPR_MACHINE (qdev_get_machine ());SysBusDevice *s =SYS_BUS_DEVICE (dev);sPAPRPHBState *sphb =SPAPR_PCI_HOST_BRIDGE (s);PCIHostState *phb =PCI_HOST_BRIDGE (s);
@@ -1464,7 +1466,7 @@ static const TypeInfo spapr_phb_info = { } }; -PCIHostState *spapr_create_phb (sPAPREnvironment *spapr,int index) +PCIHostState *spapr_create_phb (sPAPRMachineState *spapr,int index) {DeviceState *dev;
@@ -1631,6 +1633,7 @@ static int spapr_switch_one_vga(DeviceState *dev, void *opaque)void spapr_pci_switch_vga (bool big_endian) { +sPAPRMachineState *spapr =SPAPR_MACHINE (qdev_get_machine ());sPAPRPHBState *sphb;/*
hw/ppc/spapr_rtas.c +19 -19
@@ -47,7 +47,7 @@ do { } while (0)#endif -static sPAPRConfigureConnectorState *spapr_ccs_find (sPAPREnvironment *spapr, +static sPAPRConfigureConnectorState *spapr_ccs_find (sPAPRMachineState *spapr,uint32_t drc_index) {sPAPRConfigureConnectorState *ccs =NULL ;
@@ -61,14 +61,14 @@ static sPAPRConfigureConnectorState *spapr_ccs_find(sPAPREnvironment *spapr,return ccs; } -static void spapr_ccs_add (sPAPREnvironment *spapr, +static void spapr_ccs_add (sPAPRMachineState *spapr,sPAPRConfigureConnectorState *ccs) {g_assert (!spapr_ccs_find (spapr, ccs->drc_index));QTAILQ_INSERT_HEAD (&spapr->ccs_list, ccs, next); } -static void spapr_ccs_remove (sPAPREnvironment *spapr, +static void spapr_ccs_remove (sPAPRMachineState *spapr,sPAPRConfigureConnectorState *ccs) {QTAILQ_REMOVE (&spapr->ccs_list, ccs, next);
@@ -77,7 +77,7 @@ static void spapr_ccs_remove(sPAPREnvironment *spapr,void spapr_ccs_reset_hook (void *opaque) { -sPAPREnvironment *spapr = opaque; +sPAPRMachineState *spapr = opaque;sPAPRConfigureConnectorState *ccs, *ccs_tmp; QTAILQ_FOREACH_SAFE(ccs, &spapr->ccs_list, next, ccs_tmp) {
@@ -85,7 +85,7 @@ void spapr_ccs_reset_hook(void *opaque) } } -static void rtas_display_character (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static void rtas_display_character (PowerPCCPU *cpu,sPAPRMachineState *spapr,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
@@ -101,7 +101,7 @@ static void rtas_display_character(PowerPCCPU *cpu, sPAPREnvironment *spapr, } } -static void rtas_power_off (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static void rtas_power_off (PowerPCCPU *cpu,sPAPRMachineState *spapr,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets) {
@@ -113,7 +113,7 @@ static void rtas_power_off(PowerPCCPU *cpu, sPAPREnvironment *spapr,rtas_st (rets,0 ,RTAS_OUT_SUCCESS ); } -static void rtas_system_reboot (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static void rtas_system_reboot (PowerPCCPU *cpu,sPAPRMachineState *spapr,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
@@ -127,7 +127,7 @@ static void rtas_system_reboot(PowerPCCPU *cpu, sPAPREnvironment *spapr, }static void rtas_query_cpu_stopped_state (PowerPCCPU *cpu_, -sPAPREnvironment *spapr, +sPAPRMachineState *spapr,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
@@ -157,7 +157,7 @@ static void rtas_query_cpu_stopped_state(PowerPCCPU *cpu_,rtas_st (rets,0 ,RTAS_OUT_PARAM_ERROR ); } -static void rtas_start_cpu (PowerPCCPU *cpu_,sPAPREnvironment *spapr, +static void rtas_start_cpu (PowerPCCPU *cpu_,sPAPRMachineState *spapr,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
@@ -204,7 +204,7 @@ static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPREnvironment *spapr,rtas_st (rets,0 ,RTAS_OUT_PARAM_ERROR ); } -static void rtas_stop_self (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static void rtas_stop_self (PowerPCCPU *cpu,sPAPRMachineState *spapr,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
@@ -227,7 +227,7 @@ static void rtas_stop_self(PowerPCCPU *cpu, sPAPREnvironment *spapr, }static void rtas_ibm_get_system_parameter (PowerPCCPU *cpu, -sPAPREnvironment *spapr, +sPAPRMachineState *spapr,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
@@ -262,7 +262,7 @@ static void rtas_ibm_get_system_parameter(PowerPCCPU *cpu, }static void rtas_ibm_set_system_parameter (PowerPCCPU *cpu, -sPAPREnvironment *spapr, +sPAPRMachineState *spapr,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
@@ -282,7 +282,7 @@ static void rtas_ibm_set_system_parameter(PowerPCCPU *cpu, }static void rtas_ibm_os_term (PowerPCCPU *cpu, -sPAPREnvironment *spapr, +sPAPRMachineState *spapr,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
@@ -294,7 +294,7 @@ static void rtas_ibm_os_term(PowerPCCPU *cpu,rtas_st (rets,0 , ret); } -static void rtas_set_power_level (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static void rtas_set_power_level (PowerPCCPU *cpu,sPAPRMachineState *spapr,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
@@ -319,7 +319,7 @@ static void rtas_set_power_level(PowerPCCPU *cpu, sPAPREnvironment *spapr,rtas_st (rets,1 ,100 ); } -static void rtas_get_power_level (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static void rtas_get_power_level (PowerPCCPU *cpu,sPAPRMachineState *spapr,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
@@ -356,7 +356,7 @@ static bool sensor_type_is_dr(uint32_t sensor_type)return false; } -static void rtas_set_indicator (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static void rtas_set_indicator (PowerPCCPU *cpu,sPAPRMachineState *spapr,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
@@ -427,7 +427,7 @@ out_unimplemented:rtas_st (rets,0 ,RTAS_OUT_NOT_SUPPORTED ); } -static void rtas_get_sensor_state (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static void rtas_get_sensor_state (PowerPCCPU *cpu,sPAPRMachineState *spapr,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
@@ -481,7 +481,7 @@ static void rtas_get_sensor_state(PowerPCCPU *cpu, sPAPREnvironment *spapr,#define CC_WA_LEN 4096static void rtas_ibm_configure_connector (PowerPCCPU *cpu, -sPAPREnvironment *spapr, +sPAPRMachineState *spapr,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
@@ -601,7 +601,7 @@ static struct rtas_call {spapr_rtas_fn fn; } rtas_table[RTAS_TOKEN_MAX -RTAS_TOKEN_BASE ]; -target_ulong spapr_rtas_call (PowerPCCPU *cpu,sPAPREnvironment *spapr, +target_ulong spapr_rtas_call (PowerPCCPU *cpu,sPAPRMachineState *spapr,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets) {
hw/ppc/spapr_rtc.c +2 -2
@@ -77,7 +77,7 @@ int spapr_rtc_import_offset(DeviceState *dev, int64_t legacy_offset)return 0 ; } -static void rtas_get_time_of_day (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static void rtas_get_time_of_day (PowerPCCPU *cpu,sPAPRMachineState *spapr,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
@@ -107,7 +107,7 @@ static void rtas_get_time_of_day(PowerPCCPU *cpu, sPAPREnvironment *spapr,rtas_st (rets,7 , ns); } -static void rtas_set_time_of_day (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static void rtas_set_time_of_day (PowerPCCPU *cpu,sPAPRMachineState *spapr,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
hw/ppc/spapr_vio.c +8 -7
@@ -161,7 +161,7 @@ static int vio_make_devnode(VIOsPAPRDevice *dev,/* * CRQ handling */ -static target_ulong h_reg_crq (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static target_ulong h_reg_crq (PowerPCCPU *cpu,sPAPRMachineState *spapr,target_ulong opcode,target_ulong *args) {target_ulong reg = args[0 ];
@@ -219,7 +219,7 @@ static target_ulong free_crq(VIOsPAPRDevice *dev)return H_SUCCESS ; } -static target_ulong h_free_crq (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static target_ulong h_free_crq (PowerPCCPU *cpu,sPAPRMachineState *spapr,target_ulong opcode,target_ulong *args) {target_ulong reg = args[0 ];
@@ -233,7 +233,7 @@ static target_ulong h_free_crq(PowerPCCPU *cpu, sPAPREnvironment *spapr,return free_crq (dev); } -static target_ulong h_send_crq (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static target_ulong h_send_crq (PowerPCCPU *cpu,sPAPRMachineState *spapr,target_ulong opcode,target_ulong *args) {target_ulong reg = args[0 ];
@@ -256,7 +256,7 @@ static target_ulong h_send_crq(PowerPCCPU *cpu, sPAPREnvironment *spapr,return H_HARDWARE ; } -static target_ulong h_enable_crq (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static target_ulong h_enable_crq (PowerPCCPU *cpu,sPAPRMachineState *spapr,target_ulong opcode,target_ulong *args) {target_ulong reg = args[0 ];
@@ -334,7 +334,7 @@ void spapr_vio_set_bypass(VIOsPAPRDevice *dev, bool bypass) dev->tcet->bypass = bypass; } -static void rtas_set_tce_bypass (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static void rtas_set_tce_bypass (PowerPCCPU *cpu,sPAPRMachineState *spapr,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
@@ -365,7 +365,7 @@ static void rtas_set_tce_bypass(PowerPCCPU *cpu, sPAPREnvironment *spapr,rtas_st (rets,0 ,RTAS_OUT_SUCCESS ); } -static void rtas_quiesce (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static void rtas_quiesce (PowerPCCPU *cpu,sPAPRMachineState *spapr,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
@@ -427,6 +427,7 @@ static void spapr_vio_busdev_reset(DeviceState *qdev)static void spapr_vio_busdev_realize (DeviceState *qdev,Error **errp) { +sPAPRMachineState *spapr =SPAPR_MACHINE (qdev_get_machine ());VIOsPAPRDevice *dev = (VIOsPAPRDevice *)qdev;VIOsPAPRDeviceClass *pc =VIO_SPAPR_DEVICE_GET_CLASS (dev);char *id;
@@ -492,7 +493,7 @@ static void spapr_vio_busdev_realize(DeviceState *qdev, Error **errp) pc->realize (dev, errp); } -static target_ulong h_vio_signal (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static target_ulong h_vio_signal (PowerPCCPU *cpu,sPAPRMachineState *spapr,target_ulong opcode,target_ulong *args) {
include/hw/pci-host/spapr.h +6 -4
@@ -119,21 +119,23 @@ struct sPAPRPHBVFIOState {static inline qemu_irq spapr_phb_lsi_qirq (struct sPAPRPHBState *phb,int pin) { +sPAPRMachineState *spapr =SPAPR_MACHINE (qdev_get_machine ()); +return xics_get_qirq (spapr->icp, phb->lsi_table[pin].irq); } -PCIHostState *spapr_create_phb (sPAPREnvironment *spapr,int index); +PCIHostState *spapr_create_phb (sPAPRMachineState *spapr,int index);int spapr_populate_pci_dt (sPAPRPHBState *phb,uint32_t xics_phandle,void *fdt); -void spapr_pci_msi_init (sPAPREnvironment *spapr,hwaddr addr); +void spapr_pci_msi_init (sPAPRMachineState *spapr,hwaddr addr);void spapr_pci_rtas_init (void ); -sPAPRPHBState *spapr_pci_find_phb (sPAPREnvironment *spapr,uint64_t buid); -PCIDevice *spapr_pci_find_dev (sPAPREnvironment *spapr,uint64_t buid, +sPAPRPHBState *spapr_pci_find_phb (sPAPRMachineState *spapr,uint64_t buid); +PCIDevice *spapr_pci_find_dev (sPAPRMachineState *spapr,uint64_t buid,uint32_t config_addr);#endif /* __HW_SPAPR_PCI_H__ */
include/hw/ppc/spapr.h +24 -9
@@ -2,6 +2,7 @@#define __HW_SPAPR_H__#include "sysemu/dma.h" +#include "hw/boards.h" #include "hw/ppc/xics.h" #include "hw/ppc/spapr_drc.h"
@@ -13,7 +14,19 @@ typedef struct sPAPREventLogEntry sPAPREventLogEntry;#define HPTE64_V_HPTE_DIRTY 0x0000000000000040ULL -typedef struct sPAPREnvironment { +typedef struct sPAPRMachineState sPAPRMachineState ; + +#define TYPE_SPAPR_MACHINE "spapr-machine" +#define SPAPR_MACHINE (obj) \ + OBJECT_CHECK(sPAPRMachineState, (obj), TYPE_SPAPR_MACHINE) + +/** +* sPAPRMachineState: +*/ +struct sPAPRMachineState { +/*< private >*/ +MachineState parent_obj; +struct VIOsPAPRBus *vio_bus; QLIST_HEAD(, sPAPRPHBState) phbs;struct sPAPRNVRAM *nvram;
@@ -46,7 +59,10 @@ typedef struct sPAPREnvironment {/* RTAS state */ QTAILQ_HEAD(, sPAPRConfigureConnectorState) ccs_list; -} sPAPREnvironment; + +/*< public >*/ +char *kvm_type; +};#define H_SUCCESS 0#define H_BUSY 1/* Hardware busy -- retry later */
@@ -319,8 +335,6 @@ typedef struct sPAPREnvironment {#define KVMPPC_H_CAS (KVMPPC_HCALL_BASE + 0x2)#define KVMPPC_HCALL_MAX KVMPPC_H_CAS -extern sPAPREnvironment *spapr; -typedef struct sPAPRDeviceTreeUpdateHeader {uint32_t version_id; }sPAPRDeviceTreeUpdateHeader ;
@@ -335,7 +349,7 @@ typedef struct sPAPRDeviceTreeUpdateHeader { do { } while (0)#endif -typedef target_ulong (*spapr_hcall_fn )(PowerPCCPU *cpu,sPAPREnvironment *spapr, +typedef target_ulong (*spapr_hcall_fn )(PowerPCCPU *cpu,sPAPRMachineState *sm,target_ulong opcode,target_ulong *args);
@@ -490,12 +504,12 @@ static inline void rtas_st_buffer(target_ulong phys, target_ulong phys_len,rtas_st_buffer_direct (phys +2 , phys_len -2 , buffer, buffer_len); } -typedef void (*spapr_rtas_fn )(PowerPCCPU *cpu,sPAPREnvironment *spapr, +typedef void (*spapr_rtas_fn )(PowerPCCPU *cpu,sPAPRMachineState *sm,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets);void spapr_rtas_register (int token,const char *name,spapr_rtas_fn fn); -target_ulong spapr_rtas_call (PowerPCCPU *cpu,sPAPREnvironment *spapr, +target_ulong spapr_rtas_call (PowerPCCPU *cpu,sPAPRMachineState *sm,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets); int spapr_rtas_device_tree_setup(void *fdt, hwaddr rtas_addr,
@@ -546,9 +560,10 @@ struct sPAPREventLogEntry {QTAILQ_ENTRY (sPAPREventLogEntry) next; }; -void spapr_events_init (sPAPREnvironment *spapr); +void spapr_events_init (sPAPRMachineState *sm);void spapr_events_fdt_skel (void *fdt,uint32_t epow_irq); -int spapr_h_cas_compose_response (target_ulong addr,target_ulong size); +int spapr_h_cas_compose_response (sPAPRMachineState *sm, +target_ulong addr,target_ulong size); sPAPRTCETable *spapr_tce_new_table(DeviceState *owner, uint32_t liobn, uint64_t bus_offset, uint32_t page_shift,
include/hw/ppc/spapr_vio.h +3 -1
@@ -88,6 +88,8 @@ extern int spapr_vio_signal(VIOsPAPRDevice *dev, target_ulong mode);static inline qemu_irq spapr_vio_qirq (VIOsPAPRDevice *dev) { +sPAPRMachineState *spapr =SPAPR_MACHINE (qdev_get_machine ()); +return xics_get_qirq (spapr->icp, dev->irq); }
@@ -126,7 +128,7 @@ static inline int spapr_vio_dma_set(VIOsPAPRDevice *dev, uint64_t taddr,int spapr_vio_send_crq (VIOsPAPRDevice *dev,uint8_t *crq); -VIOsPAPRDevice *vty_lookup (sPAPREnvironment *spapr,target_ulong reg); +VIOsPAPRDevice *vty_lookup (sPAPRMachineState *spapr,target_ulong reg);void vty_putchars (VIOsPAPRDevice *sdev,uint8_t *buf,int len);void spapr_vty_create (VIOsPAPRBus *bus,CharDriverState *chardev);void spapr_vlan_create (VIOsPAPRBus *bus,NICInfo *nd);
Signature · 1 line
2.1.0
Re: [Qemu-devel] [PATCHv2 1/4] spapr: Merge sPAPREnvironment into sPAPRMachineState
Quoted 31 lines · On Tue, 26 May 2015 12:22:56 +1000 David Gibson <[email protected]>…
The code for -machine pseries maintains a global sPAPREnvironment structure which keeps track of general state information about the guest platform. This predates the existence of the MachineState structure, but performs basically the same function.
Now that we have the generic MachineState, fold sPAPREnvironment into sPAPRMachineState, the pseries specific subclass of MachineState.
This is mostly a matter of search and replace, although a few places which relied on the global spapr variable are changed to find the structure via
qdev_get_machine().Signed-off-by David Gibson <[email protected]>--- hw/char/spapr_vty.c | 6 ++-- hw/intc/xics.c | 20 ++++++------- hw/intc/xics_kvm.c | 2 +- hw/net/spapr_llan.c | 12 ++++---- hw/nvram/spapr_nvram.c | 4 +-- hw/ppc/spapr.c | 73 +++++++++++++++++++-------------------------- hw/ppc/spapr_events.c | 13 +++++--- hw/ppc/spapr_hcall.c | 36 +++++++++++----------- hw/ppc/spapr_iommu.c | 8 ++--- hw/ppc/spapr_pci.c | 37 ++++++++++++----------- hw/ppc/spapr_rtas.c | 38 +++++++++++------------ hw/ppc/spapr_rtc.c | 4 +-- hw/ppc/spapr_vio.c | 15 +++++----- include/hw/pci-host/spapr.h | 10 ++++--- include/hw/ppc/spapr.h | 33 ++++++++++++++------ include/hw/ppc/spapr_vio.h | 4 ++- 16 files changed, 167 insertions(+), 148 deletions(-)
[...]
Quoted 4 lines
hw/ppc/spapr.c +0
-0
[...]
Quoted 11 lines
hw/ppc/spapr.c +2
-2@@ -1756,17 +1743,17 @@ static char *spapr_get_fw_dev_path(FWPathProvider *p, BusState *bus,static char *spapr_get_kvm_type (Object *obj,Error **errp) { -sPAPRMachineState *sm =SPAPR_MACHINE (obj); +sPAPRMachineState *spapr =SPAPR_MACHINE (obj); -return g_strdup (sm->kvm_type); +return g_strdup (spapr->kvm_type); }
hw/ppc/spapr.c static char *spapr_get_fw_dev_path(FWPathProvider *p, BusState *bus, · line 1757
Quoted 10 lines
hw/ppc/spapr.c +3
-3static void spapr_set_kvm_type (Object *obj,const char *value,Error **errp) { -sPAPRMachineState *sm =SPAPR_MACHINE (obj); +sPAPRMachineState *spapr =SPAPR_MACHINE (obj); -g_free (sm->kvm_type); - sm->kvm_type =g_strdup (value); +g_free (spapr->kvm_type); + spapr->kvm_type =g_strdup (value); }
I think you could keep the "sm" variable name in these two functions.
Anyway, patch looks good to me now, so:
PATCH v2 2/4 spapr: Remove obsolete ram_limit field from sPAPRMachineState
In reply to David GibsonThe ram_limit field was imported from sPAPREnvironment where it predates the machine's ram size being available generically from machine->ram_size.
Worse, the existing code was inconsistent about where it got the ram size from. Sometimes it used spapr->ram_limit, sometimes the global 'ram_size' and sometimes a local 'ram_size' masking the global.
This cleans up the code to consistently use machine->ram_size, eliminating spapr->ram_limit in the process.
--- hw/ppc/spapr.c | 22 ++++++++++++---------- hw/ppc/spapr_hcall.c | 3 ++- include/hw/ppc/spapr.h | 1 - 3 files changed, 14 insertions(+), 12 deletions(-)
hw/ppc/spapr.c +12 -10
@@ -265,15 +265,18 @@ static size_t create_page_sizes_prop(CPUPPCState *env, uint32_t *prop,static hwaddr spapr_node0_size (void ) { +MachineState *machine =MACHINE (qdev_get_machine ()); +if (nb_numa_nodes) {int i;for (i =0 ; i < nb_numa_nodes; ++i) {if (numa_info[i].node_mem) { -return MIN (pow2floor (numa_info[i].node_mem), ram_size); +return MIN (pow2floor (numa_info[i].node_mem), + machine->ram_size); } } } -return ram_size; +return machine->ram_size; }#define _FDT (exp) \
@@ -649,6 +652,7 @@ static void spapr_populate_memory_node(void *fdt, int nodeid, hwaddr start,static int spapr_populate_memory (sPAPRMachineState *spapr,void *fdt) { +MachineState *machine = &spapr->parent_obj;hwaddr mem_start, node_size;int i, nb_nodes = nb_numa_nodes;NodeInfo *nodes = numa_info;
@@ -657,7 +661,7 @@ static int spapr_populate_memory(sPAPRMachineState *spapr, void *fdt)/* No NUMA nodes, assume there is just one node with whole RAM */ if (!nb_numa_nodes) { nb_nodes =1 ; - ramnode.node_mem = ram_size; + ramnode.node_mem = machine->ram_size; nodes = &ramnode; }
@@ -665,12 +669,12 @@ static int spapr_populate_memory(sPAPRMachineState *spapr, void *fdt)if (!nodes[i].node_mem) {continue ; } -if (mem_start >= ram_size) { +if (mem_start >= machine->ram_size) { node_size =0 ; }else { node_size = nodes[i].node_mem; -if (node_size > ram_size - mem_start) { - node_size = ram_size - mem_start; +if (node_size > machine->ram_size - mem_start) { + node_size = machine->ram_size - mem_start; } }if (!mem_start) {
@@ -1374,7 +1378,6 @@ static void spapr_boot_set(void *opaque, const char *boot_device,static void ppc_spapr_init (MachineState *machine) {sPAPRMachineState *spapr =SPAPR_MACHINE (machine); -ram_addr_t ram_size = machine->ram_size;const char *cpu_model = machine->cpu_model;const char *kernel_filename = machine->kernel_filename;const char *kernel_cmdline = machine->kernel_cmdline;
@@ -1443,7 +1446,7 @@ static void ppc_spapr_init(MachineState *machine)* more than needed for the Linux guests we support. */ spapr->htab_shift =18 ;/* Minimum architected size */ while (spapr->htab_shift <=46 ) { -if ((1ULL << (spapr->htab_shift +7 )) >= ram_size) { +if ((1ULL << (spapr->htab_shift +7 )) >= machine->ram_size) {break ; } spapr->htab_shift++;
@@ -1497,9 +1500,8 @@ static void ppc_spapr_init(MachineState *machine) }/* allocate RAM */ - spapr->ram_limit = ram_size;memory_region_allocate_system_memory (ram,NULL ,"ppc_spapr.ram" , - spapr->ram_limit); + machine->ram_size);memory_region_add_subregion (sysmem,0 , ram);if (rma_alloc_size && rma) {
hw/ppc/spapr_hcall.c +2 -1
@@ -87,6 +87,7 @@ static inline bool valid_pte_index(CPUPPCState *env, target_ulong pte_index)static target_ulong h_enter (PowerPCCPU *cpu,sPAPRMachineState *spapr,target_ulong opcode,target_ulong *args) { +MachineState *machine =MACHINE (spapr);CPUPPCState *env = &cpu->env;target_ulong flags = args[0 ];target_ulong pte_index = args[1 ];
@@ -118,7 +119,7 @@ static target_ulong h_enter(PowerPCCPU *cpu, sPAPRMachineState *spapr, raddr = (ptel &HPTE64_R_RPN ) & ~((1ULL << page_shift) -1 ); -if (raddr < spapr->ram_limit) { +if (raddr < machine->ram_size) {/* Regular RAM - should have WIMG=0010 */ if ((ptel &HPTE64_R_WIMG ) !=HPTE64_R_M ) {return H_PARAMETER ;
include/hw/ppc/spapr.h +0 -1
@@ -33,7 +33,6 @@ struct sPAPRMachineState {XICSState *icp;DeviceState *rtc; -hwaddr ram_limit;void *htab;uint32_t htab_shift;hwaddr rma_size;
Signature · 1 line
2.1.0
Re: [Qemu-devel] [PATCHv2 2/4] spapr: Remove obsolete ram_limit field from sPAPRMachineState
Quoted 21 lines · On Tue, 26 May 2015 12:22:57 +1000 David Gibson <[email protected]>…
The
ram_limitfield was imported from sPAPREnvironment where it predates the machine's ram size being available generically frommachine->ram_size.Worse, the existing code was inconsistent about where it got the ram size from. Sometimes it used
spapr->ram_limit, sometimes the global 'ram_size' and sometimes a local 'ram_size' masking the global.This cleans up the code to consistently use
machine->ram_size, eliminatingspapr->ram_limitin the process.Signed-off-by David Gibson <[email protected]>--- hw/ppc/spapr.c | 22 ++++++++++++---------- hw/ppc/spapr_hcall.c | 3 ++- include/hw/ppc/spapr.h | 1 - 3 files changed, 14 insertions(+), 12 deletions(-)hw/ppc/spapr.c +0
-0
[...]
hw/ppc/spapr.c static void spapr_populate_memory_node(void *fdt, int nodeid, hwaddr start, · line 655
Quoted 5 lines
hw/ppc/spapr.c +1
-0@@ -649,6 +652,7 @@ static void spapr_populate_memory_node(void *fdt, int nodeid, hwaddr start,static int spapr_populate_memory (sPAPRMachineState *spapr,void *fdt) { +MachineState *machine = &spapr->parent_obj;
Here you use &spapr->parent_obj ... below you use MACHINE(spapr) ... looks somewhat inconsequent ==> maybe also use MACHINE(spapr) here?
...
hw/ppc/spapr_hcall.c static inline bool valid_pte_index(CPUPPCState *env, target_ulong pte_index) · line 93
Quoted 12 lines
hw/ppc/spapr_hcall.c +1
-0@@ -87,6 +87,7 @@ static inline bool valid_pte_index(CPUPPCState *env, target_ulong pte_index)static target_ulong h_enter (PowerPCCPU *cpu,sPAPRMachineState *spapr,target_ulong opcode,target_ulong *args) { +MachineState *machine =MACHINE (spapr);CPUPPCState *env = &cpu->env;target_ulong flags = args[0 ];target_ulong pte_index = args[1 ];
Apart from the above nit, patch looks fine to me, so:
Another question out of curiosity: Do you know if the global "ram_size" variable is scheduled to be removed soon in the future?
Thomas
Re: [Qemu-devel] [PATCHv2 2/4] spapr: Remove obsolete ram_limit field from sPAPRMachineState
Quoted 25 lines · Thomas Huth
Quoted 21 lines · On Tue, 26 May 2015 12:22:57 +1000 David Gibson <[email protected]>…
The
ram_limitfield was imported from sPAPREnvironment where it predates the machine's ram size being available generically frommachine->ram_size.Worse, the existing code was inconsistent about where it got the ram size from. Sometimes it used
spapr->ram_limit, sometimes the global 'ram_size' and sometimes a local 'ram_size' masking the global.This cleans up the code to consistently use
machine->ram_size, eliminatingspapr->ram_limitin the process.Signed-off-by David Gibson <[email protected]>--- hw/ppc/spapr.c | 22 ++++++++++++---------- hw/ppc/spapr_hcall.c | 3 ++- include/hw/ppc/spapr.h | 1 - 3 files changed, 14 insertions(+), 12 deletions(-)hw/ppc/spapr.c +0
-0[...]
Quoted 8 lines
hw/ppc/spapr.c static void spapr_populate_memory_node(void *fdt, int nodeid, hwaddr start, · line 655
Quoted 5 lines
hw/ppc/spapr.c +1
-0@@ -649,6 +652,7 @@ static void spapr_populate_memory_node(void *fdt, int nodeid, hwaddr start,static int spapr_populate_memory (sPAPRMachineState *spapr,void *fdt) { +MachineState *machine = &spapr->parent_obj;Here you use
&spapr->parent_obj... below you use MACHINE(spapr) ... looks somewhat inconsequent ==> maybe also use MACHINE(spapr) here?
Ah, good catch. Clearly not quite back into QOM headspace.
Quoted 16 lines
...
hw/ppc/spapr_hcall.c static inline bool valid_pte_index(CPUPPCState *env, target_ulong pte_index) · line 93
Quoted 12 lines
hw/ppc/spapr_hcall.c +1
-0@@ -87,6 +87,7 @@ static inline bool valid_pte_index(CPUPPCState *env, target_ulong pte_index)static target_ulong h_enter (PowerPCCPU *cpu,sPAPRMachineState *spapr,target_ulong opcode,target_ulong *args) { +MachineState *machine =MACHINE (spapr);CPUPPCState *env = &cpu->env;target_ulong flags = args[0 ];target_ulong pte_index = args[1 ];Apart from the above nit, patch looks fine to me, so:
Quoted 4 lines
Reviewed-by Thomas Huth <[email protected]>Another question out of curiosity: Do you know if the global "
ram_size" variable is scheduled to be removed soon in the future?
I don't know, I'm afraid.
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
PATCH v2 3/4 spapr: Remove obsolete entry_point field from sPAPRMachineState
In reply to David GibsonThe sPAPRMachineState structure includes an entry_point field containing the initial PC value for starting the machine, even though this always has the value 0x100.
I think this is a hangover from very early versions which bypassed the firmware when using -kernel. In any case it has no function now, so remove it.
--- hw/ppc/spapr.c | 4 +--- include/hw/ppc/spapr.h | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-)
hw/ppc/spapr.c +1 -3
@@ -932,7 +932,7 @@ static void ppc_spapr_reset(void) first_ppc_cpu->env.gpr[3 ] = spapr->fdt_addr; first_ppc_cpu->env.gpr[5 ] =0 ; first_cpu->halted =0 ; - first_ppc_cpu->env.nip = spapr->entry_point; + first_ppc_cpu->env.nip =SPAPR_ENTRY_POINT ; }
@@ -1645,8 +1645,6 @@ static void ppc_spapr_init(MachineState *machine) }g_free (filename); - spapr->entry_point =0x100 ; -/* FIXME: Should register things through the MachineState's qdev * interface, this is a legacy from the sPAPREnvironment structure * which predated MachineState but had a similar function */
include/hw/ppc/spapr.h +1 -1
@@ -13,6 +13,7 @@ typedef struct sPAPRConfigureConnectorState sPAPRConfigureConnectorState;typedef struct sPAPREventLogEntry sPAPREventLogEntry ;#define HPTE64_V_HPTE_DIRTY 0x0000000000000040ULL +#define SPAPR_ENTRY_POINT 0x100typedef struct sPAPRMachineState sPAPRMachineState ;
@@ -41,7 +42,6 @@ struct sPAPRMachineState {ssize_t rtas_size;void *rtas_blob;void *fdt_skel; -target_ulong entry_point;uint64_t rtc_offset;/* Now used only during incoming migration */ struct PPCTimebase tb;bool has_graphics;
Signature · 1 line
2.1.0
Re: [Qemu-devel] [PATCHv2 3/4] spapr: Remove obsolete entry_point field from sPAPRMachineState
Quoted 49 lines · On Tue, 26 May 2015 12:22:58 +1000 David Gibson <[email protected]>…
The sPAPRMachineState structure includes an
entry_pointfield containing the initial PC value for starting the machine, even though this always has the value0x100.I think this is a hangover from very early versions which bypassed the firmware when using -kernel. In any case it has no function now, so remove it.
Signed-off-by David Gibson <[email protected]>--- hw/ppc/spapr.c | 4 +--- include/hw/ppc/spapr.h | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-)hw/ppc/spapr.c +1
-3@@ -932,7 +932,7 @@ static void ppc_spapr_reset(void) first_ppc_cpu->env.gpr[3 ] = spapr->fdt_addr; first_ppc_cpu->env.gpr[5 ] =0 ; first_cpu->halted =0 ; - first_ppc_cpu->env.nip = spapr->entry_point; + first_ppc_cpu->env.nip =SPAPR_ENTRY_POINT ; }@@ -1645,8 +1645,6 @@ static void ppc_spapr_init(MachineState *machine) }g_free (filename); - spapr->entry_point =0x100 ; -/* FIXME: Should register things through the MachineState's qdev * interface, this is a legacy from the sPAPREnvironment structure * which predated MachineState but had a similar function */ include/hw/ppc/spapr.h +1
-0@@ -13,6 +13,7 @@ typedef struct sPAPRConfigureConnectorState sPAPRConfigureConnectorState;typedef struct sPAPREventLogEntry sPAPREventLogEntry ;#define HPTE64_V_HPTE_DIRTY 0x0000000000000040ULL +#define SPAPR_ENTRY_POINT 0x100typedef struct sPAPRMachineState sPAPRMachineState ;
include/hw/ppc/spapr.h struct sPAPRMachineState { · line 47
Quoted 7 lines
include/hw/ppc/spapr.h +0
-1@@ -41,7 +42,6 @@ struct sPAPRMachineState {ssize_t rtas_size;void *rtas_blob;void *fdt_skel; -target_ulong entry_point;uint64_t rtc_offset;/* Now used only during incoming migration */ struct PPCTimebase tb;bool has_graphics;
PATCH v2 4/4 spapr: Add sPAPRMachineClass
In reply to David GibsonCurrently although we have an sPAPRMachineState descended from MachineState we don't have an sPAPRMAchineClass descended from MachineClass. So far it hasn't been needed, but several upcoming features are going to want it, so this patch creates a stub implementation.
--- hw/ppc/spapr.c | 1 + include/hw/ppc/spapr.h | 15 +++++++++++++++ 2 files changed, 16 insertions(+)
hw/ppc/spapr.c +1 -0
@@ -1808,6 +1808,7 @@ static const TypeInfo spapr_machine_info = { .abstract = true, .instance_size = sizeof(sPAPRMachineState), .instance_init = spapr_machine_initfn, + .class_size = sizeof(sPAPRMachineClass), .class_init = spapr_machine_class_init, .interfaces = (InterfaceInfo []) { {TYPE_FW_PATH_PROVIDER },
include/hw/ppc/spapr.h +15 -0
@@ -15,11 +15,26 @@ typedef struct sPAPREventLogEntry sPAPREventLogEntry;#define HPTE64_V_HPTE_DIRTY 0x0000000000000040ULL#define SPAPR_ENTRY_POINT 0x100 +typedef struct sPAPRMachineClass sPAPRMachineClass ;typedef struct sPAPRMachineState sPAPRMachineState ;#define TYPE_SPAPR_MACHINE "spapr-machine"#define SPAPR_MACHINE (obj) \ OBJECT_CHECK(sPAPRMachineState, (obj), TYPE_SPAPR_MACHINE) +#define SPAPR_MACHINE_GET_CLASS (obj) \ + OBJECT_GET_CLASS(sPAPRMachineClass, obj, TYPE_SPAPR_MACHINE) +#define SPAPR_MACHINE_CLASS (klass) \ + OBJECT_CLASS_CHECK(sPAPRMachineClass, klass, TYPE_SPAPR_MACHINE) + +/** +* sPAPRMachineClass: +*/ +struct sPAPRMachineClass { +/*< private >*/ +MachineClass parent_class; + +/*< public >*/ +};/** * sPAPRMachineState:
Signature · 1 line
2.1.0
Re: [Qemu-devel] [PATCHv2 4/4] spapr: Add sPAPRMachineClass
Quoted 46 lines · On Tue, 26 May 2015 12:22:59 +1000 David Gibson <[email protected]>…
Currently although we have an sPAPRMachineState descended from MachineState we don't have an sPAPRMAchineClass descended from MachineClass. So far it hasn't been needed, but several upcoming features are going to want it, so this patch creates a stub implementation.
Signed-off-by Michael Roth <[email protected]>Signed-off-by Bharata B Rao <[email protected]>Signed-off-by David Gibson <[email protected]>--- hw/ppc/spapr.c | 1 + include/hw/ppc/spapr.h | 15 +++++++++++++++ 2 files changed, 16 insertions(+)hw/ppc/spapr.c +1
-0@@ -1808,6 +1808,7 @@ static const TypeInfo spapr_machine_info = { .abstract = true, .instance_size = sizeof(sPAPRMachineState), .instance_init = spapr_machine_initfn, + .class_size = sizeof(sPAPRMachineClass), .class_init = spapr_machine_class_init, .interfaces = (InterfaceInfo []) { {TYPE_FW_PATH_PROVIDER },include/hw/ppc/spapr.h +8
-0@@ -15,11 +15,26 @@ typedef struct sPAPREventLogEntry sPAPREventLogEntry;#define HPTE64_V_HPTE_DIRTY 0x0000000000000040ULL#define SPAPR_ENTRY_POINT 0x100 +typedef struct sPAPRMachineClass sPAPRMachineClass ;typedef struct sPAPRMachineState sPAPRMachineState ;#define TYPE_SPAPR_MACHINE "spapr-machine"#define SPAPR_MACHINE (obj) \ OBJECT_CHECK(sPAPRMachineState, (obj), TYPE_SPAPR_MACHINE) +#define SPAPR_MACHINE_GET_CLASS (obj) \ + OBJECT_GET_CLASS(sPAPRMachineClass, obj, TYPE_SPAPR_MACHINE) +#define SPAPR_MACHINE_CLASS (klass) \ + OBJECT_CLASS_CHECK(sPAPRMachineClass, klass, TYPE_SPAPR_MACHINE) + +/** +* sPAPRMachineClass:
include/hw/ppc/spapr.h typedef struct sPAPREventLogEntry sPAPREventLogEntry; · line 40
Quoted 10 lines
include/hw/ppc/spapr.h +7
-0+*/ +struct sPAPRMachineClass { +/*< private >*/ +MachineClass parent_class; + +/*< public >*/ +};/** * sPAPRMachineState:
Re: [Qemu-devel] [PATCHv2 4/4] spapr: Add sPAPRMachineClass
Quoted 57 lines · Thomas Huth
Quoted 54 lines · On Tue, 26 May 2015 12:22:59 +1000 David Gibson <[email protected]>…
Currently although we have an sPAPRMachineState descended from MachineState we don't have an sPAPRMAchineClass descended from MachineClass. So far it hasn't been needed, but several upcoming features are going to want it, so this patch creates a stub implementation.
Signed-off-by Michael Roth <[email protected]>Signed-off-by Bharata B Rao <[email protected]>Signed-off-by David Gibson <[email protected]>--- hw/ppc/spapr.c | 1 + include/hw/ppc/spapr.h | 15 +++++++++++++++ 2 files changed, 16 insertions(+)hw/ppc/spapr.c +1
-0@@ -1808,6 +1808,7 @@ static const TypeInfo spapr_machine_info = { .abstract = true, .instance_size = sizeof(sPAPRMachineState), .instance_init = spapr_machine_initfn, + .class_size = sizeof(sPAPRMachineClass), .class_init = spapr_machine_class_init, .interfaces = (InterfaceInfo []) { {TYPE_FW_PATH_PROVIDER },include/hw/ppc/spapr.h +15
-0@@ -15,11 +15,26 @@ typedef struct sPAPREventLogEntry sPAPREventLogEntry;#define HPTE64_V_HPTE_DIRTY 0x0000000000000040ULL#define SPAPR_ENTRY_POINT 0x100 +typedef struct sPAPRMachineClass sPAPRMachineClass ;typedef struct sPAPRMachineState sPAPRMachineState ;#define TYPE_SPAPR_MACHINE "spapr-machine"#define SPAPR_MACHINE (obj) \ OBJECT_CHECK(sPAPRMachineState, (obj), TYPE_SPAPR_MACHINE) +#define SPAPR_MACHINE_GET_CLASS (obj) \ + OBJECT_GET_CLASS(sPAPRMachineClass, obj, TYPE_SPAPR_MACHINE) +#define SPAPR_MACHINE_CLASS (klass) \ + OBJECT_CLASS_CHECK(sPAPRMachineClass, klass, TYPE_SPAPR_MACHINE) + +/** +* sPAPRMachineClass: +*/ +struct sPAPRMachineClass { +/*< private >*/ +MachineClass parent_class; + +/*< public >*/ +};
Quoted 4 lines
include/hw/ppc/spapr.h typedef struct sPAPREventLogEntry sPAPREventLogEntry; · line 40
Quoted 2 lines
include/hw/ppc/spapr.h +0
-0/** * sPAPRMachineState: Reviewed-by Thomas Huth <[email protected]>
Thanks for the review. I've fixed the nit you pointer out in 2/4, and merged into spapr-next.
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson