sPAPRMachineState cleanups
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.
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 | 14 +- hw/intc/xics.c | 42 +++--- hw/intc/xics_kvm.c | 2 +- hw/net/spapr_llan.c | 20 +-- hw/nvram/spapr_nvram.c | 8 +- hw/ppc/spapr.c | 339 +++++++++++++++++++++----------------------- hw/ppc/spapr_events.c | 37 ++--- hw/ppc/spapr_hcall.c | 45 +++--- hw/ppc/spapr_iommu.c | 8 +- hw/ppc/spapr_pci.c | 91 ++++++------ hw/ppc/spapr_rtas.c | 66 ++++----- hw/ppc/spapr_rtc.c | 12 +- hw/ppc/spapr_vio.c | 31 ++-- include/hw/pci-host/spapr.h | 12 +- include/hw/ppc/spapr.h | 51 +++++-- include/hw/ppc/spapr_vio.h | 6 +- 16 files changed, 407 insertions(+), 377 deletions(-)
Signature · 1 line
2.1.0
PATCH 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 | 14 +- hw/intc/xics.c | 42 +++--- hw/intc/xics_kvm.c | 2 +- hw/net/spapr_llan.c | 20 +-- hw/nvram/spapr_nvram.c | 8 +- hw/ppc/spapr.c | 339 +++++++++++++++++++++----------------------- hw/ppc/spapr_events.c | 37 ++--- hw/ppc/spapr_hcall.c | 44 +++--- hw/ppc/spapr_iommu.c | 8 +- hw/ppc/spapr_pci.c | 91 ++++++------ hw/ppc/spapr_rtas.c | 66 ++++----- hw/ppc/spapr_rtc.c | 12 +- hw/ppc/spapr_vio.c | 31 ++-- include/hw/pci-host/spapr.h | 12 +- include/hw/ppc/spapr.h | 33 +++-- include/hw/ppc/spapr_vio.h | 6 +- 16 files changed, 391 insertions(+), 374 deletions(-)
hw/char/spapr_vty.c +7 -7
@@ -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 *sm,target_ulong opcode,target_ulong *args) {target_ulong reg = args[0 ];
@@ -84,7 +84,7 @@ static target_ulong h_put_term_char(PowerPCCPU *cpu, sPAPREnvironment *spapr,VIOsPAPRDevice *sdev;uint8_t buf[16 ]; - sdev =vty_lookup (spapr, reg); + sdev =vty_lookup (sm, reg);if (!sdev) {return H_PARAMETER ; }
@@ -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 *sm,target_ulong opcode,target_ulong *args) {target_ulong reg = args[0 ];
@@ -111,7 +111,7 @@ static target_ulong h_get_term_char(PowerPCCPU *cpu, sPAPREnvironment *spapr,VIOsPAPRDevice *sdev;uint8_t buf[16 ]; - sdev =vty_lookup (spapr, reg); + sdev =vty_lookup (sm, reg);if (!sdev) {return H_PARAMETER ; }
@@ -214,18 +214,18 @@ VIOsPAPRDevice *spapr_vty_get_default(VIOsPAPRBus *bus)return selected; } -VIOsPAPRDevice *vty_lookup (sPAPREnvironment *spapr,target_ulong reg) +VIOsPAPRDevice *vty_lookup (sPAPRMachineState *sm,target_ulong reg) {VIOsPAPRDevice *sdev; - sdev =spapr_vio_find_by_reg (spapr->vio_bus, reg); + sdev =spapr_vio_find_by_reg (sm->vio_bus, reg);if (!sdev && reg ==0 ) {/* Hack for kernel early debug, which always specifies reg==0. * We search all VIO devices, and grab the vty with the lowest * reg. This attempts to mimic existing PowerVM behaviour * (early debug does work there, despite having no vty with * reg==0. */ -return spapr_vty_get_default (spapr->vio_bus); +return spapr_vty_get_default (sm->vio_bus); }return sdev;
hw/intc/xics.c +21 -21
135 lines not on this page · raw message
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 *sm,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
hw/net/spapr_llan.c +10 -10
@@ -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 *sm,target_ulong opcode,target_ulong *args) {
@@ -292,7 +292,7 @@ static target_ulong h_register_logical_lan(PowerPCCPU *cpu,target_ulong buf_list = args[1 ];target_ulong rec_queue = args[2 ];target_ulong filter_list = args[3 ]; -VIOsPAPRDevice *sdev =spapr_vio_find_by_reg (spapr->vio_bus, reg); +VIOsPAPRDevice *sdev =spapr_vio_find_by_reg (sm->vio_bus, reg);VIOsPAPRVLANDevice *dev =VIO_SPAPR_VLAN_DEVICE (sdev);vlan_bd_t filter_list_bd;
@@ -349,11 +349,11 @@ 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 *sm,target_ulong opcode,target_ulong *args) {target_ulong reg = args[0 ]; -VIOsPAPRDevice *sdev =spapr_vio_find_by_reg (spapr->vio_bus, reg); +VIOsPAPRDevice *sdev =spapr_vio_find_by_reg (sm->vio_bus, reg);VIOsPAPRVLANDevice *dev =VIO_SPAPR_VLAN_DEVICE (sdev);if (!dev) {
@@ -371,13 +371,13 @@ static target_ulong h_free_logical_lan(PowerPCCPU *cpu, sPAPREnvironment *spapr, }static target_ulong h_add_logical_lan_buffer (PowerPCCPU *cpu, -sPAPREnvironment *spapr, +sPAPRMachineState *sm,target_ulong opcode,target_ulong *args) {target_ulong reg = args[0 ];target_ulong buf = args[1 ]; -VIOsPAPRDevice *sdev =spapr_vio_find_by_reg (spapr->vio_bus, reg); +VIOsPAPRDevice *sdev =spapr_vio_find_by_reg (sm->vio_bus, reg);VIOsPAPRVLANDevice *dev =VIO_SPAPR_VLAN_DEVICE (sdev);vlan_bd_t bd;
@@ -421,13 +421,13 @@ 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 *sm,target_ulong opcode,target_ulong *args) {target_ulong reg = args[0 ];target_ulong *bufs = args +1 ;target_ulong continue_token = args[7 ]; -VIOsPAPRDevice *sdev =spapr_vio_find_by_reg (spapr->vio_bus, reg); +VIOsPAPRDevice *sdev =spapr_vio_find_by_reg (sm->vio_bus, reg);VIOsPAPRVLANDevice *dev =VIO_SPAPR_VLAN_DEVICE (sdev);unsigned total_len;uint8_t *lbuf, *p;
@@ -490,11 +490,11 @@ 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 *sm,target_ulong opcode,target_ulong *args) {target_ulong reg = args[0 ]; -VIOsPAPRDevice *dev =spapr_vio_find_by_reg (spapr->vio_bus, reg); +VIOsPAPRDevice *dev =spapr_vio_find_by_reg (sm->vio_bus, reg);if (!dev) {return H_PARAMETER ;
hw/nvram/spapr_nvram.c +4 -4
@@ -45,12 +45,12 @@ 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 *sm,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets) { -sPAPRNVRAM *nvram = spapr->nvram; +sPAPRNVRAM *nvram = sm->nvram;hwaddr offset, buffer, len;void *membuf;
@@ -86,12 +86,12 @@ 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 *sm,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets) { -sPAPRNVRAM *nvram = spapr->nvram; +sPAPRNVRAM *nvram = sm->nvram;hwaddr offset, buffer, len;int alen;void *membuf;
hw/ppc/spapr.c +163 -176
837 lines not on this page · raw message
hw/ppc/spapr_events.c +21 -16
@@ -238,18 +238,20 @@ 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 *sm =SPAPR_MACHINE (qdev_get_machine ());sPAPREventLogEntry *entry =g_new (sPAPREventLogEntry,1 );g_assert (data); entry->log_type = log_type; entry->exception = exception; entry->data = data; -QTAILQ_INSERT_TAIL (&spapr->pending_events, entry, next); +QTAILQ_INSERT_TAIL (&sm->pending_events, entry, next); }static sPAPREventLogEntry *rtas_event_log_dequeue (uint32_t event_mask,bool exception) { +sPAPRMachineState *sm =SPAPR_MACHINE (qdev_get_machine ());sPAPREventLogEntry *entry =NULL ;/* we only queue EPOW events atm. */
@@ -257,7 +259,7 @@ static sPAPREventLogEntry *rtas_event_log_dequeue(uint32_t event_mask,return NULL ; } - QTAILQ_FOREACH(entry, &spapr->pending_events, next) { + QTAILQ_FOREACH(entry, &sm->pending_events, next) {if (entry->exception != exception) {continue ; }
@@ -270,7 +272,7 @@ static sPAPREventLogEntry *rtas_event_log_dequeue(uint32_t event_mask, }if (entry) { -QTAILQ_REMOVE (&spapr->pending_events, entry, next); +QTAILQ_REMOVE (&sm->pending_events, entry, next); }return entry;
@@ -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 *sm =SPAPR_MACHINE (qdev_get_machine ());sPAPREventLogEntry *entry =NULL ;/* we only queue EPOW events atm. */
@@ -285,7 +288,7 @@ static bool rtas_event_log_contains(uint32_t event_mask, bool exception)return false; } - QTAILQ_FOREACH(entry, &spapr->pending_events, next) { + QTAILQ_FOREACH(entry, &sm->pending_events, next) {if (entry->exception != exception) {continue ; }
@@ -314,13 +317,14 @@ 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 *sm =SPAPR_MACHINE (qdev_get_machine ());struct tm tm;int year; maina->hdr.section_id =cpu_to_be16 (RTAS_LOG_V6_SECTION_ID_MAINA ); maina->hdr.section_length =cpu_to_be16 (sizeof (*maina));/* FIXME: section version, subtype and creator id? */ -spapr_rtc_read (spapr->rtc, &tm,NULL ); +spapr_rtc_read (sm->rtc, &tm,NULL ); year = tm.tm_year +1900 ; maina->creation_date =cpu_to_be32 ((to_bcd (year /100 ) <<24 ) | (to_bcd(year % 100) << 16)
@@ -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 *sm =container_of (n, sPAPRMachineState, epow_notifier);struct rtas_error_log *hdr;struct rtas_event_log_v6 *v6hdr;struct rtas_event_log_v6_maina *maina;
@@ -379,11 +383,12 @@ static void spapr_powerdown_req(Notifier *n, void *opaque)rtas_event_log_queue (RTAS_LOG_TYPE_EPOW , new_epow, true); -qemu_irq_pulse (xics_get_qirq (spapr->icp, spapr->check_exception_irq)); +qemu_irq_pulse (xics_get_qirq (sm->icp, sm->check_exception_irq)); }static void spapr_hotplug_req_event (sPAPRDRConnector *drc,uint8_t hp_action) { +sPAPRMachineState *sm =SPAPR_MACHINE (qdev_get_machine ());struct hp_log_full *new_hp;struct rtas_error_log *hdr;struct rtas_event_log_v6 *v6hdr;
@@ -440,7 +445,7 @@ static void spapr_hotplug_req_event(sPAPRDRConnector *drc, uint8_t hp_action)rtas_event_log_queue (RTAS_LOG_TYPE_HOTPLUG , new_hp, true); -qemu_irq_pulse (xics_get_qirq (spapr->icp, spapr->check_exception_irq)); +qemu_irq_pulse (xics_get_qirq (sm->icp, sm->check_exception_irq)); }void spapr_hotplug_req_add_event (sPAPRDRConnector *drc)
@@ -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 *sm,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
@@ -499,7 +504,7 @@ static void check_exception(PowerPCCPU *cpu, sPAPREnvironment *spapr,* interrupts. */ if (rtas_event_log_contains (mask, true)) { -qemu_irq_pulse (xics_get_qirq (spapr->icp, spapr->check_exception_irq)); +qemu_irq_pulse (xics_get_qirq (sm->icp, sm->check_exception_irq)); }return ;
@@ -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 *sm,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
@@ -548,12 +553,12 @@ out_no_events:rtas_st (rets,0 ,RTAS_OUT_NO_ERRORS_FOUND ); } -void spapr_events_init (sPAPREnvironment *spapr) +void spapr_events_init (sPAPRMachineState *sm) { -QTAILQ_INIT (&spapr->pending_events); - spapr->check_exception_irq =xics_alloc (spapr->icp,0 ,0 , false); - spapr->epow_notifier.notify = spapr_powerdown_req; -qemu_register_powerdown_notifier (&spapr->epow_notifier); +QTAILQ_INIT (&sm->pending_events); + sm->check_exception_irq =xics_alloc (sm->icp,0 ,0 , false); + sm->epow_notifier.notify = spapr_powerdown_req; +qemu_register_powerdown_notifier (&sm->epow_notifier);spapr_rtas_register (RTAS_CHECK_EXCEPTION ,"check-exception" , check_exception);spapr_rtas_register (RTAS_EVENT_SCAN ,"event-scan" , event_scan);
hw/ppc/spapr_hcall.c +23 -21
172 lines not on this page · raw message
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 *sm,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 *sm,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 *sm,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 *sm,target_ulong opcode,target_ulong *args) {target_ulong liobn = args[0 ];
hw/ppc/spapr_pci.c +47 -44
341 lines not on this page · raw message
hw/ppc/spapr_rtas.c +33 -33
223 lines not on this page · raw message
hw/ppc/spapr_rtc.c +6 -6
@@ -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 *sm,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
@@ -90,12 +90,12 @@ static void rtas_get_time_of_day(PowerPCCPU *cpu, sPAPREnvironment *spapr,return ; } -if (!spapr->rtc) { +if (!sm->rtc) {rtas_st (rets,0 ,RTAS_OUT_HW_ERROR );return ; } -spapr_rtc_read (spapr->rtc, &tm, &ns); +spapr_rtc_read (sm->rtc, &tm, &ns);rtas_st (rets,0 ,RTAS_OUT_SUCCESS );rtas_st (rets,1 , tm.tm_year +1900 );
@@ -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 *sm,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets)
@@ -122,7 +122,7 @@ static void rtas_set_time_of_day(PowerPCCPU *cpu, sPAPREnvironment *spapr,return ; } -if (!spapr->rtc) { +if (!sm->rtc) {rtas_st (rets,0 ,RTAS_OUT_HW_ERROR );return ; }
@@ -143,7 +143,7 @@ static void rtas_set_time_of_day(PowerPCCPU *cpu, sPAPREnvironment *spapr,/* Generate a monitor event for the change */ qapi_event_send_rtc_change (qemu_timedate_diff (&tm), &error_abort); - rtc =SPAPR_RTC (spapr->rtc); + rtc =SPAPR_RTC (sm->rtc); host_ns =qemu_clock_get_ns (rtc_clock);
hw/ppc/spapr_vio.c +16 -15
@@ -161,13 +161,13 @@ 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 *sm,target_ulong opcode,target_ulong *args) {target_ulong reg = args[0 ];target_ulong queue_addr = args[1 ];target_ulong queue_len = args[2 ]; -VIOsPAPRDevice *dev =spapr_vio_find_by_reg (spapr->vio_bus, reg); +VIOsPAPRDevice *dev =spapr_vio_find_by_reg (sm->vio_bus, reg);if (!dev) {hcall_dprintf ("Unit 0x" TARGET_FMT_lx" does not exist\n" , reg);
@@ -219,11 +219,11 @@ 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 *sm,target_ulong opcode,target_ulong *args) {target_ulong reg = args[0 ]; -VIOsPAPRDevice *dev =spapr_vio_find_by_reg (spapr->vio_bus, reg); +VIOsPAPRDevice *dev =spapr_vio_find_by_reg (sm->vio_bus, reg);if (!dev) {hcall_dprintf ("Unit 0x" TARGET_FMT_lx" does not exist\n" , reg);
@@ -233,13 +233,13 @@ 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 *sm,target_ulong opcode,target_ulong *args) {target_ulong reg = args[0 ];target_ulong msg_hi = args[1 ];target_ulong msg_lo = args[2 ]; -VIOsPAPRDevice *dev =spapr_vio_find_by_reg (spapr->vio_bus, reg); +VIOsPAPRDevice *dev =spapr_vio_find_by_reg (sm->vio_bus, reg);uint64_t crq_mangle[2 ];if (!dev) {
@@ -256,11 +256,11 @@ 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 *sm,target_ulong opcode,target_ulong *args) {target_ulong reg = args[0 ]; -VIOsPAPRDevice *dev =spapr_vio_find_by_reg (spapr->vio_bus, reg); +VIOsPAPRDevice *dev =spapr_vio_find_by_reg (sm->vio_bus, reg);if (!dev) {hcall_dprintf ("Unit 0x" TARGET_FMT_lx" does not exist\n" , reg);
@@ -334,12 +334,12 @@ 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 *sm,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets) { -VIOsPAPRBus *bus = spapr->vio_bus; +VIOsPAPRBus *bus = sm->vio_bus;VIOsPAPRDevice *dev;uint32_t unit, enable;
@@ -365,12 +365,12 @@ 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 *sm,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets) { -VIOsPAPRBus *bus = spapr->vio_bus; +VIOsPAPRBus *bus = sm->vio_bus;BusChild *kid;VIOsPAPRDevice *dev =NULL ;
@@ -427,6 +427,7 @@ static void spapr_vio_busdev_reset(DeviceState *qdev)static void spapr_vio_busdev_realize (DeviceState *qdev,Error **errp) { +sPAPRMachineState *sm =SPAPR_MACHINE (qdev_get_machine ());VIOsPAPRDevice *dev = (VIOsPAPRDevice *)qdev;VIOsPAPRDeviceClass *pc =VIO_SPAPR_DEVICE_GET_CLASS (dev);char *id;
@@ -462,7 +463,7 @@ static void spapr_vio_busdev_realize(DeviceState *qdev, Error **errp) dev->qdev.id = id; } - dev->irq =xics_alloc (spapr->icp,0 , dev->irq, false); + dev->irq =xics_alloc (sm->icp,0 , dev->irq, false);if (!dev->irq) {error_setg (errp,"can't allocate IRQ" );return ;
@@ -492,13 +493,13 @@ 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 *sm,target_ulong opcode,target_ulong *args) {target_ulong reg = args[0 ];target_ulong mode = args[1 ]; -VIOsPAPRDevice *dev =spapr_vio_find_by_reg (spapr->vio_bus, reg); +VIOsPAPRDevice *dev =spapr_vio_find_by_reg (sm->vio_bus, reg);VIOsPAPRDeviceClass *pc;if (!dev) {
include/hw/pci-host/spapr.h +7 -5
@@ -119,21 +119,23 @@ struct sPAPRPHBVFIOState {static inline qemu_irq spapr_phb_lsi_qirq (struct sPAPRPHBState *phb,int pin) { -return xics_get_qirq (spapr->icp, phb->lsi_table[pin].irq); +sPAPRMachineState *sm =SPAPR_MACHINE (qdev_get_machine ()); + +return xics_get_qirq (sm->icp, phb->lsi_table[pin].irq); } -PCIHostState *spapr_create_phb (sPAPREnvironment *spapr,int index); +PCIHostState *spapr_create_phb (sPAPRMachineState *sm,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 *sm,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 *sm,uint64_t buid); +PCIDevice *spapr_pci_find_dev (sPAPRMachineState *sm,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 +4 -2
@@ -88,7 +88,9 @@ extern int spapr_vio_signal(VIOsPAPRDevice *dev, target_ulong mode);static inline qemu_irq spapr_vio_qirq (VIOsPAPRDevice *dev) { -return xics_get_qirq (spapr->icp, dev->irq); +sPAPRMachineState *sm =SPAPR_MACHINE (qdev_get_machine ()); + +return xics_get_qirq (sm->icp, dev->irq); } static inline bool spapr_vio_dma_valid(VIOsPAPRDevice *dev, uint64_t taddr,
@@ -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 *sm,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] [PATCH 1/4] spapr: Merge sPAPREnvironment into sPAPRMachineState
Quoted 37 lines · On Thu, 7 May 2015 13:57:01 +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 | 14 +- hw/intc/xics.c | 42 +++--- hw/intc/xics_kvm.c | 2 +- hw/net/spapr_llan.c | 20 +-- hw/nvram/spapr_nvram.c | 8 +- hw/ppc/spapr.c | 339 +++++++++++++++++++++----------------------- hw/ppc/spapr_events.c | 37 ++--- hw/ppc/spapr_hcall.c | 44 +++--- hw/ppc/spapr_iommu.c | 8 +- hw/ppc/spapr_pci.c | 91 ++++++------ hw/ppc/spapr_rtas.c | 66 ++++----- hw/ppc/spapr_rtc.c | 12 +- hw/ppc/spapr_vio.c | 31 ++-- include/hw/pci-host/spapr.h | 12 +- include/hw/ppc/spapr.h | 33 +++-- include/hw/ppc/spapr_vio.h | 6 +- 16 files changed, 391 insertions(+), 374 deletions(-)hw/char/spapr_vty.c +0
-0
hw/char/spapr_vty.c static void spapr_vty_realize(VIOsPAPRDevice *sdev, Error **errp) · line 78
Quoted 6 lines
hw/char/spapr_vty.c +1
-1@@ -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 *sm,target_ulong opcode,target_ulong *args)
Phew, this patch is really hugh, ... mainly just because of the renaming. Could you maybe keep the "spapr" as parameter name everywhere instead of "sm"? (i.e. use "sPAPRMachineState *spapr" as parameter?) That should IMHO be fine, too, and it would decrease the size of the patch drastically. (And it likely does not break other patches so badly which are currently pending)
Thomas
Re: [Qemu-devel] [PATCH 1/4] spapr: Merge sPAPREnvironment into sPAPRMachineState
Quoted 42 lines · Thomas Huth
Quoted 39 lines · On Thu, 7 May 2015 13:57:01 +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 | 14 +- hw/intc/xics.c | 42 +++--- hw/intc/xics_kvm.c | 2 +- hw/net/spapr_llan.c | 20 +-- hw/nvram/spapr_nvram.c | 8 +- hw/ppc/spapr.c | 339 +++++++++++++++++++++----------------------- hw/ppc/spapr_events.c | 37 ++--- hw/ppc/spapr_hcall.c | 44 +++--- hw/ppc/spapr_iommu.c | 8 +- hw/ppc/spapr_pci.c | 91 ++++++------ hw/ppc/spapr_rtas.c | 66 ++++----- hw/ppc/spapr_rtc.c | 12 +- hw/ppc/spapr_vio.c | 31 ++-- include/hw/pci-host/spapr.h | 12 +- include/hw/ppc/spapr.h | 33 +++-- include/hw/ppc/spapr_vio.h | 6 +- 16 files changed, 391 insertions(+), 374 deletions(-)hw/char/spapr_vty.c +0
-0@@ -74,7 +74,7 @@ static void spapr_vty_realize(VIOsPAPRDevice *sdev, Error **errp) }
Quoted 11 lines
hw/char/spapr_vty.c static void spapr_vty_realize(VIOsPAPRDevice *sdev, Error **errp) · line 78
Quoted 4 lines
hw/char/spapr_vty.c +1
-1/* Forward declaration */ -static target_ulong h_put_term_char (PowerPCCPU *cpu,sPAPREnvironment *spapr, +static target_ulong h_put_term_char (PowerPCCPU *cpu,sPAPRMachineState *sm,target_ulong opcode,target_ulong *args)Phew, this patch is really hugh, ... mainly just because of the renaming. Could you maybe keep the "spapr" as parameter name everywhere instead of "sm"? (i.e. use "sPAPRMachineState *spapr" as parameter?) That should IMHO be fine, too, and it would decrease the size of the patch drastically. (And it likely does not break other patches so badly which are currently pending)
Good call. I'll respin without the extraneous renames.
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 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.
--- hw/ppc/spapr.c | 3 +-- hw/ppc/spapr_hcall.c | 3 ++- include/hw/ppc/spapr.h | 1 - 3 files changed, 3 insertions(+), 4 deletions(-)
hw/ppc/spapr.c +1 -2
@@ -1496,9 +1496,8 @@ static void ppc_spapr_init(MachineState *machine) }/* allocate RAM */ - sm->ram_limit = ram_size;memory_region_allocate_system_memory (ram,NULL ,"ppc_spapr.ram" , - sm->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 *sm,target_ulong opcode,target_ulong *args) { +MachineState *machine =MACHINE (sm);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 *sm, raddr = (ptel &HPTE64_R_RPN ) & ~((1ULL << page_shift) -1 ); -if (raddr < sm->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] [PATCH 2/4] spapr: Remove obsolete ram_limit field from sPAPRMachineState
Quoted 15 lines · David Gibson
The
ram_limitfield was imported from sPAPREnvironment where it predates the machine's ram size being available generically frommachine->ram_size.Signed-off-by David Gibson <[email protected]>--- hw/ppc/spapr.c | 3 +-- hw/ppc/spapr_hcall.c | 3 ++- include/hw/ppc/spapr.h | 1 - 3 files changed, 3 insertions(+), 4 deletions(-)hw/ppc/spapr.c +0
-0
hw/ppc/spapr.c static void ppc_spapr_init(MachineState *machine) · line 1499
Quoted 4 lines
hw/ppc/spapr.c +0
-1@@ -1496,9 +1496,8 @@ static void ppc_spapr_init(MachineState *machine) }/* allocate RAM */ - sm->ram_limit = ram_size;
I had to look at the code to realize that ram_size is local and it can actually be removed.
Quoted 40 lines
hw/ppc/spapr.c +1
-1memory_region_allocate_system_memory (ram,NULL ,"ppc_spapr.ram" , - sm->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 *sm,target_ulong opcode,target_ulong *args) { +MachineState *machine =MACHINE (sm);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 *sm, raddr = (ptel &HPTE64_R_RPN ) & ~((1ULL << page_shift) -1 ); -if (raddr < sm->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
Alexey
Re: [Qemu-devel] [PATCH 2/4] spapr: Remove obsolete ram_limit field from sPAPRMachineState
Quoted 18 lines · Alexey Kardashevskiy
Quoted 17 lines · David Gibson
The
ram_limitfield was imported from sPAPREnvironment where it predates the machine's ram size being available generically frommachine->ram_size.Signed-off-by David Gibson <[email protected]>--- hw/ppc/spapr.c | 3 +-- hw/ppc/spapr_hcall.c | 3 ++- include/hw/ppc/spapr.h | 1 - 3 files changed, 3 insertions(+), 4 deletions(-)hw/ppc/spapr.c +0
-0@@ -1496,9 +1496,8 @@ static void ppc_spapr_init(MachineState *machine) }
Quoted 7 lines
hw/ppc/spapr.c static void ppc_spapr_init(MachineState *machine) · line 1499
Quoted 2 lines
hw/ppc/spapr.c +0
-1/* allocate RAM */ - sm->ram_limit = ram_size;I had to look at the code to realize that
ram_sizeis local and it can actually be removed.
Urgh.. it's actually worse than that. There's a global that's shadowed by the local. ppc_spapr_init() uses the local, spapr_populate_memory() uses the global.
Quoted 45 lines
Quoted 43 lines
hw/ppc/spapr.c +1
-1memory_region_allocate_system_memory (ram,NULL ,"ppc_spapr.ram" , - sm->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 *sm,target_ulong opcode,target_ulong *args) { +MachineState *machine =MACHINE (sm);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 *sm, raddr = (ptel &HPTE64_R_RPN ) & ~((1ULL << page_shift) -1 ); -if (raddr < sm->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 · 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
Re: [Qemu-devel] [PATCH 2/4] spapr: Remove obsolete ram_limit field from sPAPRMachineState
In reply to Alexey KardashevskiyQuoted 18 lines · Alexey Kardashevskiy
Quoted 17 lines · David Gibson
The
ram_limitfield was imported from sPAPREnvironment where it predates the machine's ram size being available generically frommachine->ram_size.Signed-off-by David Gibson <[email protected]>--- hw/ppc/spapr.c | 3 +-- hw/ppc/spapr_hcall.c | 3 ++- include/hw/ppc/spapr.h | 1 - 3 files changed, 3 insertions(+), 4 deletions(-)hw/ppc/spapr.c +0
-0@@ -1496,9 +1496,8 @@ static void ppc_spapr_init(MachineState *machine) }
Quoted 7 lines
hw/ppc/spapr.c static void ppc_spapr_init(MachineState *machine) · line 1499
Quoted 2 lines
hw/ppc/spapr.c +0
-1/* allocate RAM */ - sm->ram_limit = ram_size;I had to look at the code to realize that
ram_sizeis local and it can actually be removed.
Actually.. it's worse than that. There's both a global and this local which was masking it. Luckily the local had the same value, but it's still nasty.
Respin will clean this up better.
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 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
@@ -928,7 +928,7 @@ static void ppc_spapr_reset(void) first_ppc_cpu->env.gpr[3 ] = sm->fdt_addr; first_ppc_cpu->env.gpr[5 ] =0 ; first_cpu->halted =0 ; - first_ppc_cpu->env.nip = sm->entry_point; + first_ppc_cpu->env.nip =SPAPR_ENTRY_POINT ; }
@@ -1641,8 +1641,6 @@ static void ppc_spapr_init(MachineState *machine) }g_free (filename); - sm->entry_point =0x100 ; -/* FIXME: Should register thigs 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] [PATCH 3/4] spapr: Remove obsolete entry_point field from sPAPRMachineState
Quoted 41 lines · David Gibson
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@@ -928,7 +928,7 @@ static void ppc_spapr_reset(void) first_ppc_cpu->env.gpr[3 ] = sm->fdt_addr; first_ppc_cpu->env.gpr[5 ] =0 ; first_cpu->halted =0 ; - first_ppc_cpu->env.nip = sm->entry_point; + first_ppc_cpu->env.nip =SPAPR_ENTRY_POINT ; }@@ -1641,8 +1641,6 @@ static void ppc_spapr_init(MachineState *machine) }g_free (filename); - sm->entry_point =0x100 ; -/* FIXME: Should register thigs 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 +0
-0
include/hw/ppc/spapr.h typedef struct sPAPRConfigureConnectorState sPAPRConfigureConnectorState; · line 16
Quoted 4 lines
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 0x100
checkpatch.pl complains about the use of tab here.
Other than that I did a quick compile and VM boot test, things look ok.
Regards,
Bharata.
Re: [Qemu-devel] [PATCH 3/4] spapr: Remove obsolete entry_point field from sPAPRMachineState
Quoted 44 lines · Bharata B Rao
Quoted 43 lines · David Gibson
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@@ -928,7 +928,7 @@ static void ppc_spapr_reset(void) first_ppc_cpu->env.gpr[3 ] = sm->fdt_addr; first_ppc_cpu->env.gpr[5 ] =0 ; first_cpu->halted =0 ; - first_ppc_cpu->env.nip = sm->entry_point; + first_ppc_cpu->env.nip =SPAPR_ENTRY_POINT ; }@@ -1641,8 +1641,6 @@ static void ppc_spapr_init(MachineState *machine) }g_free (filename); - sm->entry_point =0x100 ; -/* FIXME: Should register thigs 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 +0
-0@@ -13,6 +13,7 @@ typedef struct sPAPRConfigureConnectorState sPAPRConfigureConnectorState;typedef struct sPAPREventLogEntry sPAPREventLogEntry ;
Quoted 4 lines
include/hw/ppc/spapr.h typedef struct sPAPRConfigureConnectorState sPAPRConfigureConnectorState; · line 16
Quoted 2 lines
include/hw/ppc/spapr.h +1
-0#define HPTE64_V_HPTE_DIRTY 0x0000000000000040ULL +#define SPAPR_ENTRY_POINT 0x100checkpatch.pl complains about the use of tab here.
Thanks, fixed.
Quoted 5 lines
Other than that I did a quick compile and VM boot test, things look ok.
Regards,
Bharata.
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 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
@@ -1804,6 +1804,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