diff options
Diffstat (limited to 'hw')
-rw-r--r-- | hw/intc/xics.c | 11 | ||||
-rw-r--r-- | hw/intc/xics_kvm.c | 13 | ||||
-rw-r--r-- | hw/intc/xics_spapr.c | 14 | ||||
-rw-r--r-- | hw/ppc/spapr.c | 45 |
4 files changed, 16 insertions, 67 deletions
diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 51e6c0c85f..159cd13142 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -135,16 +135,6 @@ static void ics_simple_pic_print_info(InterruptStatsProvider *obj, } /* - * XICS Common class - parent for emulated XICS and KVM-XICS - */ -static const TypeInfo xics_common_info = { - .name = TYPE_XICS_COMMON, - .parent = TYPE_DEVICE, - .instance_size = sizeof(XICSState), - .class_size = sizeof(XICSStateClass), -}; - -/* * ICP: Presentation layer */ @@ -752,7 +742,6 @@ void ics_set_irq_type(ICSState *ics, int srcno, bool lsi) static void xics_register_types(void) { - type_register_static(&xics_common_info); type_register_static(&ics_simple_info); type_register_static(&ics_base_info); type_register_static(&icp_info); diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c index 99836112cd..14de5d4bb8 100644 --- a/hw/intc/xics_kvm.c +++ b/hw/intc/xics_kvm.c @@ -42,12 +42,6 @@ static int kernel_xics_fd = -1; -typedef struct KVMXICSState { - XICSState parent_obj; - - int kernel_xics_fd; -} KVMXICSState; - /* * ICP-KVM */ @@ -429,15 +423,8 @@ fail: return -1; } -static const TypeInfo xics_spapr_kvm_info = { - .name = TYPE_XICS_SPAPR_KVM, - .parent = TYPE_XICS_COMMON, - .instance_size = sizeof(KVMXICSState), -}; - static void xics_kvm_register_types(void) { - type_register_static(&xics_spapr_kvm_info); type_register_static(&ics_kvm_info); type_register_static(&icp_kvm_info); } diff --git a/hw/intc/xics_spapr.c b/hw/intc/xics_spapr.c index aaf6808cd2..84d24b2837 100644 --- a/hw/intc/xics_spapr.c +++ b/hw/intc/xics_spapr.c @@ -257,13 +257,6 @@ int xics_spapr_init(sPAPRMachineState *spapr, Error **errp) return 0; } -static const TypeInfo xics_spapr_info = { - .name = TYPE_XICS_SPAPR, - .parent = TYPE_XICS_COMMON, - .instance_size = sizeof(XICSState), - .class_size = sizeof(XICSStateClass), -}; - #define ICS_IRQ_FREE(ics, srcno) \ (!((ics)->irqs[(srcno)].flags & (XICS_FLAGS_IRQ_MASK))) @@ -400,10 +393,3 @@ void spapr_dt_xics(int nr_servers, void *fdt, uint32_t phandle) _FDT(fdt_setprop_cell(fdt, node, "linux,phandle", phandle)); _FDT(fdt_setprop_cell(fdt, node, "phandle", phandle)); } - -static void xics_spapr_register_types(void) -{ - type_register_static(&xics_spapr_info); -} - -type_init(xics_spapr_register_types) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index b81c95b8b4..653926095e 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -95,24 +95,15 @@ #define HTAB_SIZE(spapr) (1ULL << ((spapr)->htab_shift)) -static XICSState *try_create_xics(sPAPRMachineState *spapr, - const char *type, const char *type_ics, - const char *type_icp, int nr_servers, - int nr_irqs, Error **errp) +static int try_create_xics(sPAPRMachineState *spapr, const char *type_ics, + const char *type_icp, int nr_servers, + int nr_irqs, Error **errp) { XICSFabric *xi = XICS_FABRIC(spapr); Error *err = NULL, *local_err = NULL; - XICSState *xics; ICSState *ics = NULL; int i; - xics = XICS_COMMON(object_new(type)); - qdev_set_parent_bus(DEVICE(xics), sysbus_get_default()); - object_property_set_bool(OBJECT(xics), true, "realized", &err); - if (err) { - goto error; - } - ics = ICS_SIMPLE(object_new(type_ics)); qdev_set_parent_bus(DEVICE(ics), sysbus_get_default()); object_property_add_child(OBJECT(spapr), "ics", OBJECT(ics), NULL); @@ -142,32 +133,30 @@ static XICSState *try_create_xics(sPAPRMachineState *spapr, } spapr->ics = ics; - return xics; + return 0; error: error_propagate(errp, err); if (ics) { object_unparent(OBJECT(ics)); } - object_unparent(OBJECT(xics)); - return NULL; + return -1; } -static XICSState *xics_system_init(MachineState *machine, - int nr_servers, int nr_irqs, Error **errp) +static int xics_system_init(MachineState *machine, + int nr_servers, int nr_irqs, Error **errp) { - XICSState *xics = NULL; + int rc = -1; if (kvm_enabled()) { Error *err = NULL; if (machine_kernel_irqchip_allowed(machine) && !xics_kvm_init(SPAPR_MACHINE(machine), errp)) { - xics = try_create_xics(SPAPR_MACHINE(machine), - TYPE_XICS_SPAPR_KVM, TYPE_ICS_KVM, - TYPE_KVM_ICP, nr_servers, nr_irqs, &err); + rc = try_create_xics(SPAPR_MACHINE(machine), TYPE_ICS_KVM, + TYPE_KVM_ICP, nr_servers, nr_irqs, &err); } - if (machine_kernel_irqchip_required(machine) && !xics) { + if (machine_kernel_irqchip_required(machine) && rc < 0) { error_reportf_err(err, "kernel_irqchip requested but unavailable: "); } else { @@ -175,14 +164,13 @@ static XICSState *xics_system_init(MachineState *machine, } } - if (!xics) { + if (rc < 0) { xics_spapr_init(SPAPR_MACHINE(machine), errp); - xics = try_create_xics(SPAPR_MACHINE(machine), - TYPE_XICS_SPAPR, TYPE_ICS_SIMPLE, + rc = try_create_xics(SPAPR_MACHINE(machine), TYPE_ICS_SIMPLE, TYPE_ICP, nr_servers, nr_irqs, errp); } - return xics; + return rc; } static int spapr_fixup_cpu_smt_dt(void *fdt, int offset, PowerPCCPU *cpu, @@ -2003,9 +1991,8 @@ static void ppc_spapr_init(MachineState *machine) load_limit = MIN(spapr->rma_size, RTAS_MAX_ADDR) - FW_OVERHEAD; /* Set up Interrupt Controller before we create the VCPUs */ - spapr->xics = xics_system_init(machine, - DIV_ROUND_UP(max_cpus * smt, smp_threads), - XICS_IRQS_SPAPR, &error_fatal); + xics_system_init(machine, DIV_ROUND_UP(max_cpus * smt, smp_threads), + XICS_IRQS_SPAPR, &error_fatal); /* Set up containers for ibm,client-set-architecture negotiated options */ spapr->ov5 = spapr_ovec_new(); |