[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 45/50] ppc/xics: export the XICS init routines
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 45/50] ppc/xics: export the XICS init routines |
Date: |
Wed, 1 Mar 2017 15:44:00 +1100 |
From: Cédric Le Goater <address@hidden>
There is nothing left related to the XICS object in the realize
functions of the KVMXICSState and XICSState class. So adapt the
interfaces to call these routines directly from the sPAPR machine init
sequence.
Signed-off-by: Cédric Le Goater <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
hw/intc/xics_kvm.c | 13 +++----------
hw/intc/xics_spapr.c | 11 ++---------
hw/ppc/spapr.c | 4 +++-
include/hw/ppc/xics.h | 5 +++++
4 files changed, 13 insertions(+), 20 deletions(-)
diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c
index 07298b0..9983611 100644
--- a/hw/intc/xics_kvm.c
+++ b/hw/intc/xics_kvm.c
@@ -363,7 +363,7 @@ static void rtas_dummy(PowerPCCPU *cpu, sPAPRMachineState
*spapr,
__func__);
}
-static void xics_kvm_realize(DeviceState *dev, Error **errp)
+int xics_kvm_init(sPAPRMachineState *spapr, Error **errp)
{
int rc;
struct kvm_create_device xics_create_device = {
@@ -419,27 +419,20 @@ static void xics_kvm_realize(DeviceState *dev, Error
**errp)
kvm_msi_via_irqfd_allowed = true;
kvm_gsi_direct_mapping = true;
- return;
+ return rc;
fail:
kvmppc_define_rtas_kernel_token(0, "ibm,set-xive");
kvmppc_define_rtas_kernel_token(0, "ibm,get-xive");
kvmppc_define_rtas_kernel_token(0, "ibm,int-on");
kvmppc_define_rtas_kernel_token(0, "ibm,int-off");
-}
-
-static void xics_kvm_class_init(ObjectClass *oc, void *data)
-{
- DeviceClass *dc = DEVICE_CLASS(oc);
-
- dc->realize = xics_kvm_realize;
+ return -1;
}
static const TypeInfo xics_spapr_kvm_info = {
.name = TYPE_XICS_SPAPR_KVM,
.parent = TYPE_XICS_COMMON,
.instance_size = sizeof(KVMXICSState),
- .class_init = xics_kvm_class_init,
};
static void xics_kvm_register_types(void)
diff --git a/hw/intc/xics_spapr.c b/hw/intc/xics_spapr.c
index 35045a2..aaf6808 100644
--- a/hw/intc/xics_spapr.c
+++ b/hw/intc/xics_spapr.c
@@ -240,7 +240,7 @@ static void rtas_int_on(PowerPCCPU *cpu, sPAPRMachineState
*spapr,
rtas_st(rets, 0, RTAS_OUT_SUCCESS);
}
-static void xics_spapr_realize(DeviceState *dev, Error **errp)
+int xics_spapr_init(sPAPRMachineState *spapr, Error **errp)
{
/* Registration of global state belongs into realize */
spapr_rtas_register(RTAS_IBM_SET_XIVE, "ibm,set-xive", rtas_set_xive);
@@ -254,13 +254,7 @@ static void xics_spapr_realize(DeviceState *dev, Error
**errp)
spapr_register_hypercall(H_XIRR_X, h_xirr_x);
spapr_register_hypercall(H_EOI, h_eoi);
spapr_register_hypercall(H_IPOLL, h_ipoll);
-}
-
-static void xics_spapr_class_init(ObjectClass *oc, void *data)
-{
- DeviceClass *dc = DEVICE_CLASS(oc);
-
- dc->realize = xics_spapr_realize;
+ return 0;
}
static const TypeInfo xics_spapr_info = {
@@ -268,7 +262,6 @@ static const TypeInfo xics_spapr_info = {
.parent = TYPE_XICS_COMMON,
.instance_size = sizeof(XICSState),
.class_size = sizeof(XICSStateClass),
- .class_init = xics_spapr_class_init,
};
#define ICS_IRQ_FREE(ics, srcno) \
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 47eb503..b81c95b 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -161,7 +161,8 @@ static XICSState *xics_system_init(MachineState *machine,
if (kvm_enabled()) {
Error *err = NULL;
- if (machine_kernel_irqchip_allowed(machine)) {
+ 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);
@@ -175,6 +176,7 @@ static XICSState *xics_system_init(MachineState *machine,
}
if (!xics) {
+ xics_spapr_init(SPAPR_MACHINE(machine), errp);
xics = try_create_xics(SPAPR_MACHINE(machine),
TYPE_XICS_SPAPR, TYPE_ICS_SIMPLE,
TYPE_ICP, nr_servers, nr_irqs, errp);
diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h
index 50a5933..b0b01e2 100644
--- a/include/hw/ppc/xics.h
+++ b/include/hw/ppc/xics.h
@@ -224,4 +224,9 @@ void ics_set_irq_type(ICSState *ics, int srcno, bool lsi);
void ics_resend(ICSState *ics);
void icp_resend(ICPState *ss);
+typedef struct sPAPRMachineState sPAPRMachineState;
+
+int xics_kvm_init(sPAPRMachineState *spapr, Error **errp);
+int xics_spapr_init(sPAPRMachineState *spapr, Error **errp);
+
#endif /* XICS_H */
--
2.9.3
- [Qemu-ppc] [PULL 32/50] ppc/xics: use the QOM interface to get irqs, (continued)
- [Qemu-ppc] [PULL 32/50] ppc/xics: use the QOM interface to get irqs, David Gibson, 2017/02/28
- [Qemu-ppc] [PULL 31/50] ppc/xics: use the QOM interface under the sPAPR machine, David Gibson, 2017/02/28
- [Qemu-ppc] [PULL 29/50] ppc/xics: add an InterruptStatsProvider interface to ICS and ICP objects, David Gibson, 2017/02/28
- [Qemu-ppc] [PULL 28/50] ppc/xics: store the ICS object under the sPAPR machine, David Gibson, 2017/02/28
- [Qemu-ppc] [PULL 44/50] ppc/xics: move the ICP array under the sPAPR machine, David Gibson, 2017/02/28
- [Qemu-ppc] [PULL 38/50] ppc/xics: move kernel_xics_fd out of KVMXICSState, David Gibson, 2017/02/28
- [Qemu-ppc] [PULL 36/50] ppc/xics: remove the XICS list of ICS, David Gibson, 2017/02/28
- [Qemu-ppc] [PULL 40/50] ppc/xics: move the cpu_setup() handler under the ICPState class, David Gibson, 2017/02/28
- [Qemu-ppc] [PULL 48/50] ppc/xics: move InterruptStatsProvider to the sPAPR machine, David Gibson, 2017/02/28
- [Qemu-ppc] [PULL 13/50] target/ppc: Manage external HPT via virtual hypervisor, David Gibson, 2017/02/28
- [Qemu-ppc] [PULL 45/50] ppc/xics: export the XICS init routines,
David Gibson <=
- [Qemu-ppc] [PULL 26/50] ppc/xics: remove set_nr_irqs() handler from XICSStateClass, David Gibson, 2017/02/28
- [Qemu-ppc] [PULL 41/50] ppc/xics: use the QOM interface to grab an ICP, David Gibson, 2017/02/28
- [Qemu-ppc] [PULL 35/50] ppc/xics: register the reset handler of ICS objects, David Gibson, 2017/02/28
- [Qemu-ppc] [PULL 50/50] Add PowerPC 32-bit guest memory dump support, David Gibson, 2017/02/28
- [Qemu-ppc] [PULL 46/50] ppc/xics: remove the XICSState classes, David Gibson, 2017/02/28