aboutsummaryrefslogtreecommitdiff
path: root/hw/intc
diff options
context:
space:
mode:
authorGreg Kurz <groug@kaod.org>2019-02-15 12:40:18 +0100
committerDavid Gibson <david@gibson.dropbear.id.au>2019-02-18 10:39:24 +1100
commitd80b2ccfa741dd689634ce6c2b2a703d7d449319 (patch)
treee48e255ec6602d2ca7ea2da63bf276cbad3dedf7 /hw/intc
parent8c1ced677dd0d7ebe96abb634d7398cd64236b11 (diff)
xics: Explicitely call KVM ICS methods from the common code
The pre_save(), post_load() and synchronize_state() methods of the ICSStateClass type are really KVM only things. Make that obvious by dropping the indirections and directly calling the KVM functions instead. Signed-off-by: Greg Kurz <groug@kaod.org> Message-Id: <155023081817.1011724.14078777320394028836.stgit@bahia.lan> Reviewed-by: Cédric Le Goater <clg@kaod.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/intc')
-rw-r--r--hw/intc/xics.c23
-rw-r--r--hw/intc/xics_kvm.c12
2 files changed, 14 insertions, 21 deletions
diff --git a/hw/intc/xics.c b/hw/intc/xics.c
index acd63ab5e0..ae5d5ea135 100644
--- a/hw/intc/xics.c
+++ b/hw/intc/xics.c
@@ -58,7 +58,6 @@ void icp_pic_print_info(ICPState *icp, Monitor *mon)
void ics_pic_print_info(ICSState *ics, Monitor *mon)
{
- ICSStateClass *icsc = ICS_BASE_GET_CLASS(ics);
uint32_t i;
monitor_printf(mon, "ICS %4x..%4x %p\n",
@@ -68,8 +67,8 @@ void ics_pic_print_info(ICSState *ics, Monitor *mon)
return;
}
- if (icsc->synchronize_state) {
- icsc->synchronize_state(ics);
+ if (kvm_irqchip_in_kernel()) {
+ ics_synchronize_state(ics);
}
for (i = 0; i < ics->nr_irqs; i++) {
@@ -647,25 +646,23 @@ static void ics_base_instance_init(Object *obj)
ics->offset = XICS_IRQ_BASE;
}
-static int ics_base_dispatch_pre_save(void *opaque)
+static int ics_base_pre_save(void *opaque)
{
ICSState *ics = opaque;
- ICSStateClass *info = ICS_BASE_GET_CLASS(ics);
- if (info->pre_save) {
- info->pre_save(ics);
+ if (kvm_irqchip_in_kernel()) {
+ ics_get_kvm_state(ics);
}
return 0;
}
-static int ics_base_dispatch_post_load(void *opaque, int version_id)
+static int ics_base_post_load(void *opaque, int version_id)
{
ICSState *ics = opaque;
- ICSStateClass *info = ICS_BASE_GET_CLASS(ics);
- if (info->post_load) {
- return info->post_load(ics, version_id);
+ if (kvm_irqchip_in_kernel()) {
+ return ics_set_kvm_state(ics);
}
return 0;
@@ -689,8 +686,8 @@ static const VMStateDescription vmstate_ics_base = {
.name = "ics",
.version_id = 1,
.minimum_version_id = 1,
- .pre_save = ics_base_dispatch_pre_save,
- .post_load = ics_base_dispatch_post_load,
+ .pre_save = ics_base_pre_save,
+ .post_load = ics_base_post_load,
.fields = (VMStateField[]) {
/* Sanity check */
VMSTATE_UINT32_EQUAL(nr_irqs, ICSState, NULL),
diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c
index fae4ac431f..642351e579 100644
--- a/hw/intc/xics_kvm.c
+++ b/hw/intc/xics_kvm.c
@@ -155,7 +155,7 @@ void icp_kvm_realize(DeviceState *dev, Error **errp)
/*
* ICS-KVM
*/
-static void ics_get_kvm_state(ICSState *ics)
+void ics_get_kvm_state(ICSState *ics)
{
uint64_t state;
int i;
@@ -208,12 +208,12 @@ static void ics_get_kvm_state(ICSState *ics)
}
}
-static void ics_synchronize_state(ICSState *ics)
+void ics_synchronize_state(ICSState *ics)
{
ics_get_kvm_state(ics);
}
-static int ics_set_kvm_state(ICSState *ics, int version_id)
+int ics_set_kvm_state(ICSState *ics)
{
uint64_t state;
int i;
@@ -286,7 +286,7 @@ static void ics_kvm_reset(DeviceState *dev)
icsc->parent_reset(dev);
- ics_set_kvm_state(ICS_KVM(dev), 1);
+ ics_set_kvm_state(ICS_KVM(dev));
}
static void ics_kvm_reset_handler(void *dev)
@@ -318,10 +318,6 @@ static void ics_kvm_class_init(ObjectClass *klass, void *data)
&icsc->parent_realize);
device_class_set_parent_reset(dc, ics_kvm_reset,
&icsc->parent_reset);
-
- icsc->pre_save = ics_get_kvm_state;
- icsc->post_load = ics_set_kvm_state;
- icsc->synchronize_state = ics_synchronize_state;
}
static const TypeInfo ics_kvm_info = {