From nobody Thu May 2 04:10:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487253017856845.3101417149287; Thu, 16 Feb 2017 05:50:17 -0800 (PST) Received: from localhost ([::1]:46735 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMRs-0002LO-Bw for importer@patchew.org; Thu, 16 Feb 2017 08:50:16 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38013) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMPt-0001Bo-M9 for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:48:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ceMPr-0004y6-L5 for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:48:13 -0500 Received: from mo173.mail-out.ovh.net ([178.32.228.173]:59200) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ceMPr-0004xU-CV for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:48:11 -0500 Received: from player791.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo173.mail-out.ovh.net (Postfix) with ESMTP id 4883323A73 for ; Thu, 16 Feb 2017 14:48:10 +0100 (CET) Received: from zorba.kaod.org.com (LFbn-1-10647-27.w90-89.abo.wanadoo.fr [90.89.233.27]) (Authenticated sender: clg@kaod.org) by player791.ha.ovh.net (Postfix) with ESMTPSA id B0E13420097; Thu, 16 Feb 2017 14:48:03 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Thu, 16 Feb 2017 14:47:24 +0100 Message-Id: <1487252865-12064-2-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487252865-12064-1-git-send-email-clg@kaod.org> References: <1487252865-12064-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 12509310917834476518 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrtdeggdehgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 178.32.228.173 Subject: [Qemu-devel] [PATCH v2 01/22] ppc/xics: remove set_nr_irqs() handler from XICSStateClass X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Today, the ICS (Interrupt Controller Source) object is created and realized by the init and realize routines of the XICS object, but some of the parameters are only known at the machine level. These parameters are passed from the sPAPR machine to the ICS object in a rather convoluted way using property handlers and a class handler of the XICS object. The number of irqs required to allocate the IRQ state objects in the ICS realize routine is one of them. Let's simplify the process by creating the ICS object along with the XICS object at the machine level and link the ICS into the XICS list of ICSs at this level also. In the sPAPR machine, there is only a single ICS but that will change with the PowerNV machine. Also, QOMify the creation of the objects and get rid of the superfluous code. Signed-off-by: C=C3=A9dric Le Goater --- Changes since v1: - added a XICS link to the ICS object hw/intc/xics.c | 51 ++++++++++++++++-------------------------------= -- hw/intc/xics_kvm.c | 44 ++++++++++-------------------------------- hw/intc/xics_spapr.c | 34 --------------------------------- hw/ppc/spapr.c | 53 +++++++++++++++++++++++++++++++++++------------= ---- include/hw/ppc/xics.h | 2 -- 5 files changed, 63 insertions(+), 121 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 372b8311fb8b..e70d3b8b1095 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -151,38 +151,6 @@ static void xics_common_reset(DeviceState *d) } } =20 -static void xics_prop_get_nr_irqs(Object *obj, Visitor *v, const char *nam= e, - void *opaque, Error **errp) -{ - XICSState *xics =3D XICS_COMMON(obj); - int64_t value =3D xics->nr_irqs; - - visit_type_int(v, name, &value, errp); -} - -static void xics_prop_set_nr_irqs(Object *obj, Visitor *v, const char *nam= e, - void *opaque, Error **errp) -{ - XICSState *xics =3D XICS_COMMON(obj); - XICSStateClass *info =3D XICS_COMMON_GET_CLASS(xics); - Error *error =3D NULL; - int64_t value; - - visit_type_int(v, name, &value, &error); - if (error) { - error_propagate(errp, error); - return; - } - if (xics->nr_irqs) { - error_setg(errp, "Number of interrupts is already set to %u", - xics->nr_irqs); - return; - } - - assert(info->set_nr_irqs); - info->set_nr_irqs(xics, value, errp); -} - void xics_set_nr_servers(XICSState *xics, uint32_t nr_servers, const char *typename, Error **errp) { @@ -241,9 +209,6 @@ static void xics_common_initfn(Object *obj) XICSState *xics =3D XICS_COMMON(obj); =20 QLIST_INIT(&xics->ics); - object_property_add(obj, "nr_irqs", "int", - xics_prop_get_nr_irqs, xics_prop_set_nr_irqs, - NULL, NULL, NULL); object_property_add(obj, "nr_servers", "int", xics_prop_get_nr_servers, xics_prop_set_nr_servers, NULL, NULL, NULL); @@ -737,6 +702,16 @@ static void ics_simple_initfn(Object *obj) static void ics_simple_realize(DeviceState *dev, Error **errp) { ICSState *ics =3D ICS_SIMPLE(dev); + Object *obj; + Error *err =3D NULL; + + obj =3D object_property_get_link(OBJECT(dev), "xics", &err); + if (!obj) { + error_setg(errp, "%s: required link 'xics' not found: %s", + __func__, error_get_pretty(err)); + return; + } + ics->xics =3D XICS_COMMON(obj); =20 if (!ics->nr_irqs) { error_setg(errp, "Number of interrupts needs to be greater 0"); @@ -746,12 +721,18 @@ static void ics_simple_realize(DeviceState *dev, Erro= r **errp) ics->qirqs =3D qemu_allocate_irqs(ics_simple_set_irq, ics, ics->nr_irq= s); } =20 +static Property ics_simple_properties[] =3D { + DEFINE_PROP_UINT32("nr-irqs", ICSState, nr_irqs, 0), + DEFINE_PROP_END_OF_LIST(), +}; + static void ics_simple_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); ICSStateClass *isc =3D ICS_BASE_CLASS(klass); =20 dc->realize =3D ics_simple_realize; + dc->props =3D ics_simple_properties; dc->vmsd =3D &vmstate_ics_simple; dc->reset =3D ics_simple_reset; isc->post_load =3D ics_simple_post_load; diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c index 17694eaa8709..4a6c0522feb6 100644 --- a/hw/intc/xics_kvm.c +++ b/hw/intc/xics_kvm.c @@ -294,6 +294,16 @@ static void ics_kvm_reset(DeviceState *dev) static void ics_kvm_realize(DeviceState *dev, Error **errp) { ICSState *ics =3D ICS_SIMPLE(dev); + Object *obj; + Error *err =3D NULL; + + obj =3D object_property_get_link(OBJECT(dev), "xics", &err); + if (!obj) { + error_setg(errp, "%s: required link 'xics' not found: %s", + __func__, error_get_pretty(err)); + return; + } + ics->xics =3D XICS_COMMON(obj); =20 if (!ics->nr_irqs) { error_setg(errp, "Number of interrupts needs to be greater 0"); @@ -358,18 +368,6 @@ static void xics_kvm_cpu_setup(XICSState *xics, PowerP= CCPU *cpu) ss->cap_irq_xics_enabled =3D true; } =20 -static void xics_kvm_set_nr_irqs(XICSState *xics, uint32_t nr_irqs, - Error **errp) -{ - ICSState *ics =3D QLIST_FIRST(&xics->ics); - - /* This needs to be deprecated ... */ - xics->nr_irqs =3D nr_irqs; - if (ics) { - ics->nr_irqs =3D nr_irqs; - } -} - static void xics_kvm_set_nr_servers(XICSState *xics, uint32_t nr_servers, Error **errp) { @@ -389,7 +387,6 @@ static void xics_kvm_realize(DeviceState *dev, Error **= errp) { KVMXICSState *xicskvm =3D XICS_SPAPR_KVM(dev); XICSState *xics =3D XICS_COMMON(dev); - ICSState *ics; int i, rc; Error *error =3D NULL; struct kvm_create_device xics_create_device =3D { @@ -441,14 +438,6 @@ static void xics_kvm_realize(DeviceState *dev, Error *= *errp) =20 xicskvm->kernel_xics_fd =3D xics_create_device.fd; =20 - QLIST_FOREACH(ics, &xics->ics, list) { - object_property_set_bool(OBJECT(ics), true, "realized", &error); - if (error) { - error_propagate(errp, error); - goto fail; - } - } - assert(xics->nr_servers); for (i =3D 0; i < xics->nr_servers; i++) { object_property_set_bool(OBJECT(&xics->ss[i]), true, "realized", @@ -472,17 +461,6 @@ fail: kvmppc_define_rtas_kernel_token(0, "ibm,int-off"); } =20 -static void xics_kvm_initfn(Object *obj) -{ - XICSState *xics =3D XICS_COMMON(obj); - ICSState *ics; - - ics =3D ICS_SIMPLE(object_new(TYPE_ICS_KVM)); - object_property_add_child(obj, "ics", OBJECT(ics), NULL); - ics->xics =3D xics; - QLIST_INSERT_HEAD(&xics->ics, ics, list); -} - static void xics_kvm_class_init(ObjectClass *oc, void *data) { DeviceClass *dc =3D DEVICE_CLASS(oc); @@ -490,7 +468,6 @@ static void xics_kvm_class_init(ObjectClass *oc, void *= data) =20 dc->realize =3D xics_kvm_realize; xsc->cpu_setup =3D xics_kvm_cpu_setup; - xsc->set_nr_irqs =3D xics_kvm_set_nr_irqs; xsc->set_nr_servers =3D xics_kvm_set_nr_servers; } =20 @@ -499,7 +476,6 @@ static const TypeInfo xics_spapr_kvm_info =3D { .parent =3D TYPE_XICS_COMMON, .instance_size =3D sizeof(KVMXICSState), .class_init =3D xics_kvm_class_init, - .instance_init =3D xics_kvm_initfn, }; =20 static void xics_kvm_register_types(void) diff --git a/hw/intc/xics_spapr.c b/hw/intc/xics_spapr.c index 2e3f1c5e95b2..03e42a866603 100644 --- a/hw/intc/xics_spapr.c +++ b/hw/intc/xics_spapr.c @@ -239,18 +239,6 @@ static void rtas_int_on(PowerPCCPU *cpu, sPAPRMachineS= tate *spapr, rtas_st(rets, 0, RTAS_OUT_SUCCESS); } =20 -static void xics_spapr_set_nr_irqs(XICSState *xics, uint32_t nr_irqs, - Error **errp) -{ - ICSState *ics =3D QLIST_FIRST(&xics->ics); - - /* This needs to be deprecated ... */ - xics->nr_irqs =3D nr_irqs; - if (ics) { - ics->nr_irqs =3D nr_irqs; - } -} - static void xics_spapr_set_nr_servers(XICSState *xics, uint32_t nr_servers, Error **errp) { @@ -260,7 +248,6 @@ static void xics_spapr_set_nr_servers(XICSState *xics, = uint32_t nr_servers, static void xics_spapr_realize(DeviceState *dev, Error **errp) { XICSState *xics =3D XICS_SPAPR(dev); - ICSState *ics; Error *error =3D NULL; int i; =20 @@ -282,14 +269,6 @@ static void xics_spapr_realize(DeviceState *dev, Error= **errp) spapr_register_hypercall(H_EOI, h_eoi); spapr_register_hypercall(H_IPOLL, h_ipoll); =20 - QLIST_FOREACH(ics, &xics->ics, list) { - object_property_set_bool(OBJECT(ics), true, "realized", &error); - if (error) { - error_propagate(errp, error); - return; - } - } - for (i =3D 0; i < xics->nr_servers; i++) { object_property_set_bool(OBJECT(&xics->ss[i]), true, "realized", &error); @@ -300,24 +279,12 @@ static void xics_spapr_realize(DeviceState *dev, Erro= r **errp) } } =20 -static void xics_spapr_initfn(Object *obj) -{ - XICSState *xics =3D XICS_SPAPR(obj); - ICSState *ics; - - ics =3D ICS_SIMPLE(object_new(TYPE_ICS_SIMPLE)); - object_property_add_child(obj, "ics", OBJECT(ics), NULL); - ics->xics =3D xics; - QLIST_INSERT_HEAD(&xics->ics, ics, list); -} - static void xics_spapr_class_init(ObjectClass *oc, void *data) { DeviceClass *dc =3D DEVICE_CLASS(oc); XICSStateClass *xsc =3D XICS_SPAPR_CLASS(oc); =20 dc->realize =3D xics_spapr_realize; - xsc->set_nr_irqs =3D xics_spapr_set_nr_irqs; xsc->set_nr_servers =3D xics_spapr_set_nr_servers; } =20 @@ -327,7 +294,6 @@ static const TypeInfo xics_spapr_info =3D { .instance_size =3D sizeof(XICSState), .class_size =3D sizeof(XICSStateClass), .class_init =3D xics_spapr_class_init, - .instance_init =3D xics_spapr_initfn, }; =20 #define ICS_IRQ_FREE(ics, srcno) \ diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 9b6ad0f2fd77..94b1e8e3227a 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -95,22 +95,42 @@ =20 #define HTAB_SIZE(spapr) (1ULL << ((spapr)->htab_shift)) =20 -static XICSState *try_create_xics(const char *type, int nr_servers, - int nr_irqs, Error **errp) -{ - Error *err =3D NULL; - DeviceState *dev; +static XICSState *try_create_xics(const char *type, const char *type_ics, + int nr_servers, int nr_irqs, Error **err= p) +{ + Error *err =3D NULL, *local_err =3D NULL; + XICSState *xics; + ICSState *ics =3D NULL; + + xics =3D XICS_COMMON(object_new(type)); + qdev_set_parent_bus(DEVICE(xics), sysbus_get_default()); + object_property_set_int(OBJECT(xics), nr_servers, "nr_servers", &err); + object_property_set_bool(OBJECT(xics), true, "realized", &local_err); + error_propagate(&err, local_err); + if (err) { + goto error; + } =20 - dev =3D DEVICE(object_new(type)); - qdev_prop_set_uint32(dev, "nr_servers", nr_servers); - qdev_prop_set_uint32(dev, "nr_irqs", nr_irqs); - object_property_set_bool(OBJECT(dev), true, "realized", &err); + ics =3D ICS_SIMPLE(object_new(type_ics)); + object_property_add_child(OBJECT(xics), "ics", OBJECT(ics), NULL); + object_property_set_int(OBJECT(ics), nr_irqs, "nr-irqs", &err); + object_property_add_const_link(OBJECT(ics), "xics", OBJECT(xics), NULL= ); + object_property_set_bool(OBJECT(ics), true, "realized", &local_err); + error_propagate(&err, local_err); if (err) { - error_propagate(errp, err); - object_unparent(OBJECT(dev)); - return NULL; + goto error; } - return XICS_COMMON(dev); + QLIST_INSERT_HEAD(&xics->ics, ics, list); + + return xics; + +error: + error_propagate(errp, err); + if (ics) { + object_unparent(OBJECT(ics)); + } + object_unparent(OBJECT(xics)); + return NULL; } =20 static XICSState *xics_system_init(MachineState *machine, @@ -122,8 +142,8 @@ static XICSState *xics_system_init(MachineState *machin= e, Error *err =3D NULL; =20 if (machine_kernel_irqchip_allowed(machine)) { - xics =3D try_create_xics(TYPE_XICS_SPAPR_KVM, nr_servers, nr_i= rqs, - &err); + xics =3D try_create_xics(TYPE_XICS_SPAPR_KVM, TYPE_ICS_KVM, + nr_servers, nr_irqs, &err); } if (machine_kernel_irqchip_required(machine) && !xics) { error_reportf_err(err, @@ -134,7 +154,8 @@ static XICSState *xics_system_init(MachineState *machin= e, } =20 if (!xics) { - xics =3D try_create_xics(TYPE_XICS_SPAPR, nr_servers, nr_irqs, err= p); + xics =3D try_create_xics(TYPE_XICS_SPAPR, TYPE_ICS_SIMPLE, nr_serv= ers, + nr_irqs, errp); } =20 return xics; diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index 3f0c31610aa4..8fe3c4d2ceab 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -74,7 +74,6 @@ struct XICSStateClass { DeviceClass parent_class; =20 void (*cpu_setup)(XICSState *icp, PowerPCCPU *cpu); - void (*set_nr_irqs)(XICSState *icp, uint32_t nr_irqs, Error **errp); void (*set_nr_servers)(XICSState *icp, uint32_t nr_servers, Error **er= rp); }; =20 @@ -83,7 +82,6 @@ struct XICSState { SysBusDevice parent_obj; /*< public >*/ uint32_t nr_servers; - uint32_t nr_irqs; ICPState *ss; QLIST_HEAD(, ICSState) ics; }; --=20 2.7.4 From nobody Thu May 2 04:10:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487253027965261.28259690664686; Thu, 16 Feb 2017 05:50:27 -0800 (PST) Received: from localhost ([::1]:46736 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMS1-0002Sx-DO for importer@patchew.org; Thu, 16 Feb 2017 08:50:25 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38044) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMQ2-0001IG-Lj for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:48:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ceMPz-000522-HB for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:48:22 -0500 Received: from 10.mo173.mail-out.ovh.net ([46.105.74.148]:56246) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ceMPz-00051C-8M for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:48:19 -0500 Received: from player791.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo173.mail-out.ovh.net (Postfix) with ESMTP id 970B923EB6 for ; Thu, 16 Feb 2017 14:48:17 +0100 (CET) Received: from zorba.kaod.org.com (LFbn-1-10647-27.w90-89.abo.wanadoo.fr [90.89.233.27]) (Authenticated sender: clg@kaod.org) by player791.ha.ovh.net (Postfix) with ESMTPSA id 489BE420087; Thu, 16 Feb 2017 14:48:10 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Thu, 16 Feb 2017 14:47:25 +0100 Message-Id: <1487252865-12064-3-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487252865-12064-1-git-send-email-clg@kaod.org> References: <1487252865-12064-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 12511281240116268006 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrtdeggdehgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 46.105.74.148 Subject: [Qemu-devel] [PATCH v2 02/22] ppc/xics: remove set_nr_servers() handler from XICSStateClass X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Today, the ICP (Interrupt Controller Presenter) objects are created by the 'nr_servers' property handler of the XICS object and a class handler. They are realized in the XICS object realize routine. Let's simplify the process by creating the ICP objects along with the XICS object at the machine level. Signed-off-by: C=C3=A9dric Le Goater Reviewed-by: David Gibson --- Changes since v1: - added a XICS link to the ICS object - removed xics_set_nr_servers() routine - removed set_nr_servers() class handler hw/intc/xics.c | 74 +++++++++++++----------------------------------= ---- hw/intc/xics_kvm.c | 21 +-------------- hw/intc/xics_spapr.c | 26 ------------------ hw/ppc/spapr.c | 30 ++++++++++++++++----- include/hw/ppc/xics.h | 3 --- 5 files changed, 42 insertions(+), 112 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index e70d3b8b1095..9f22814815c9 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -151,67 +151,11 @@ static void xics_common_reset(DeviceState *d) } } =20 -void xics_set_nr_servers(XICSState *xics, uint32_t nr_servers, - const char *typename, Error **errp) -{ - int i; - - xics->nr_servers =3D nr_servers; - - xics->ss =3D g_malloc0(xics->nr_servers * sizeof(ICPState)); - for (i =3D 0; i < xics->nr_servers; i++) { - char name[32]; - ICPState *icp =3D &xics->ss[i]; - - object_initialize(icp, sizeof(*icp), typename); - snprintf(name, sizeof(name), "icp[%d]", i); - object_property_add_child(OBJECT(xics), name, OBJECT(icp), errp); - icp->xics =3D xics; - } -} - -static void xics_prop_get_nr_servers(Object *obj, Visitor *v, - const char *name, void *opaque, - Error **errp) -{ - XICSState *xics =3D XICS_COMMON(obj); - int64_t value =3D xics->nr_servers; - - visit_type_int(v, name, &value, errp); -} - -static void xics_prop_set_nr_servers(Object *obj, Visitor *v, - const char *name, void *opaque, - Error **errp) -{ - XICSState *xics =3D XICS_COMMON(obj); - XICSStateClass *xsc =3D XICS_COMMON_GET_CLASS(xics); - Error *error =3D NULL; - int64_t value; - - visit_type_int(v, name, &value, &error); - if (error) { - error_propagate(errp, error); - return; - } - if (xics->nr_servers) { - error_setg(errp, "Number of servers is already set to %u", - xics->nr_servers); - return; - } - - assert(xsc->set_nr_servers); - xsc->set_nr_servers(xics, value, errp); -} - static void xics_common_initfn(Object *obj) { XICSState *xics =3D XICS_COMMON(obj); =20 QLIST_INIT(&xics->ics); - object_property_add(obj, "nr_servers", "int", - xics_prop_get_nr_servers, xics_prop_set_nr_servers, - NULL, NULL, NULL); } =20 static void xics_common_class_init(ObjectClass *oc, void *data) @@ -450,12 +394,30 @@ static void icp_reset(DeviceState *dev) qemu_set_irq(icp->output, 0); } =20 +static void icp_realize(DeviceState *dev, Error **errp) +{ + ICPState *icp =3D ICP(dev); + Object *obj; + Error *err =3D NULL; + + obj =3D object_property_get_link(OBJECT(dev), "xics", &err); + if (!obj) { + error_setg(errp, "%s: required link 'xics' not found: %s", + __func__, error_get_pretty(err)); + return; + } + + icp->xics =3D XICS_COMMON(obj); +} + + static void icp_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); =20 dc->reset =3D icp_reset; dc->vmsd =3D &vmstate_icp_server; + dc->realize =3D icp_realize; } =20 static const TypeInfo icp_info =3D { diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c index 4a6c0522feb6..6cabc11f6be1 100644 --- a/hw/intc/xics_kvm.c +++ b/hw/intc/xics_kvm.c @@ -368,12 +368,6 @@ static void xics_kvm_cpu_setup(XICSState *xics, PowerP= CCPU *cpu) ss->cap_irq_xics_enabled =3D true; } =20 -static void xics_kvm_set_nr_servers(XICSState *xics, uint32_t nr_servers, - Error **errp) -{ - xics_set_nr_servers(xics, nr_servers, TYPE_KVM_ICP, errp); -} - static void rtas_dummy(PowerPCCPU *cpu, sPAPRMachineState *spapr, uint32_t token, uint32_t nargs, target_ulong args, @@ -386,9 +380,7 @@ static void rtas_dummy(PowerPCCPU *cpu, sPAPRMachineSta= te *spapr, static void xics_kvm_realize(DeviceState *dev, Error **errp) { KVMXICSState *xicskvm =3D XICS_SPAPR_KVM(dev); - XICSState *xics =3D XICS_COMMON(dev); - int i, rc; - Error *error =3D NULL; + int rc; struct kvm_create_device xics_create_device =3D { .type =3D KVM_DEV_TYPE_XICS, .flags =3D 0, @@ -438,16 +430,6 @@ static void xics_kvm_realize(DeviceState *dev, Error *= *errp) =20 xicskvm->kernel_xics_fd =3D xics_create_device.fd; =20 - assert(xics->nr_servers); - for (i =3D 0; i < xics->nr_servers; i++) { - object_property_set_bool(OBJECT(&xics->ss[i]), true, "realized", - &error); - if (error) { - error_propagate(errp, error); - goto fail; - } - } - kvm_kernel_irqchip =3D true; kvm_msi_via_irqfd_allowed =3D true; kvm_gsi_direct_mapping =3D true; @@ -468,7 +450,6 @@ static void xics_kvm_class_init(ObjectClass *oc, void *= data) =20 dc->realize =3D xics_kvm_realize; xsc->cpu_setup =3D xics_kvm_cpu_setup; - xsc->set_nr_servers =3D xics_kvm_set_nr_servers; } =20 static const TypeInfo xics_spapr_kvm_info =3D { diff --git a/hw/intc/xics_spapr.c b/hw/intc/xics_spapr.c index 03e42a866603..859b5675e175 100644 --- a/hw/intc/xics_spapr.c +++ b/hw/intc/xics_spapr.c @@ -239,23 +239,8 @@ static void rtas_int_on(PowerPCCPU *cpu, sPAPRMachineS= tate *spapr, rtas_st(rets, 0, RTAS_OUT_SUCCESS); } =20 -static void xics_spapr_set_nr_servers(XICSState *xics, uint32_t nr_servers, - Error **errp) -{ - xics_set_nr_servers(xics, nr_servers, TYPE_ICP, errp); -} - static void xics_spapr_realize(DeviceState *dev, Error **errp) { - XICSState *xics =3D XICS_SPAPR(dev); - Error *error =3D NULL; - int i; - - if (!xics->nr_servers) { - error_setg(errp, "Number of servers needs to be greater 0"); - return; - } - /* Registration of global state belongs into realize */ spapr_rtas_register(RTAS_IBM_SET_XIVE, "ibm,set-xive", rtas_set_xive); spapr_rtas_register(RTAS_IBM_GET_XIVE, "ibm,get-xive", rtas_get_xive); @@ -268,24 +253,13 @@ static void xics_spapr_realize(DeviceState *dev, Erro= r **errp) spapr_register_hypercall(H_XIRR_X, h_xirr_x); spapr_register_hypercall(H_EOI, h_eoi); spapr_register_hypercall(H_IPOLL, h_ipoll); - - for (i =3D 0; i < xics->nr_servers; i++) { - object_property_set_bool(OBJECT(&xics->ss[i]), true, "realized", - &error); - if (error) { - error_propagate(errp, error); - return; - } - } } =20 static void xics_spapr_class_init(ObjectClass *oc, void *data) { DeviceClass *dc =3D DEVICE_CLASS(oc); - XICSStateClass *xsc =3D XICS_SPAPR_CLASS(oc); =20 dc->realize =3D xics_spapr_realize; - xsc->set_nr_servers =3D xics_spapr_set_nr_servers; } =20 static const TypeInfo xics_spapr_info =3D { diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 94b1e8e3227a..5d7c35de8cd9 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -96,17 +96,17 @@ #define HTAB_SIZE(spapr) (1ULL << ((spapr)->htab_shift)) =20 static XICSState *try_create_xics(const char *type, const char *type_ics, - int nr_servers, int nr_irqs, Error **err= p) + const char *type_icp, int nr_servers, + int nr_irqs, Error **errp) { Error *err =3D NULL, *local_err =3D NULL; XICSState *xics; ICSState *ics =3D NULL; + int i; =20 xics =3D XICS_COMMON(object_new(type)); qdev_set_parent_bus(DEVICE(xics), sysbus_get_default()); - object_property_set_int(OBJECT(xics), nr_servers, "nr_servers", &err); - object_property_set_bool(OBJECT(xics), true, "realized", &local_err); - error_propagate(&err, local_err); + object_property_set_bool(OBJECT(xics), true, "realized", &err); if (err) { goto error; } @@ -122,6 +122,22 @@ static XICSState *try_create_xics(const char *type, co= nst char *type_ics, } QLIST_INSERT_HEAD(&xics->ics, ics, list); =20 + xics->ss =3D g_malloc0(nr_servers * sizeof(ICPState)); + xics->nr_servers =3D nr_servers; + + for (i =3D 0; i < nr_servers; i++) { + ICPState *icp =3D &xics->ss[i]; + + object_initialize(icp, sizeof(*icp), type_icp); + object_property_add_child(OBJECT(xics), "icp[*]", OBJECT(icp), NUL= L); + object_property_add_const_link(OBJECT(icp), "xics", OBJECT(xics), = NULL); + object_property_set_bool(OBJECT(icp), true, "realized", &err); + if (err) { + goto error; + } + object_unref(OBJECT(icp)); + } + return xics; =20 error: @@ -143,7 +159,7 @@ static XICSState *xics_system_init(MachineState *machin= e, =20 if (machine_kernel_irqchip_allowed(machine)) { xics =3D try_create_xics(TYPE_XICS_SPAPR_KVM, TYPE_ICS_KVM, - nr_servers, nr_irqs, &err); + TYPE_KVM_ICP, nr_servers, nr_irqs, &err= ); } if (machine_kernel_irqchip_required(machine) && !xics) { error_reportf_err(err, @@ -154,8 +170,8 @@ static XICSState *xics_system_init(MachineState *machin= e, } =20 if (!xics) { - xics =3D try_create_xics(TYPE_XICS_SPAPR, TYPE_ICS_SIMPLE, nr_serv= ers, - nr_irqs, errp); + xics =3D try_create_xics(TYPE_XICS_SPAPR, TYPE_ICS_SIMPLE, TYPE_IC= P, + nr_servers, nr_irqs, errp); } =20 return xics; diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index 8fe3c4d2ceab..fc4abcd4e796 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -74,7 +74,6 @@ struct XICSStateClass { DeviceClass parent_class; =20 void (*cpu_setup)(XICSState *icp, PowerPCCPU *cpu); - void (*set_nr_servers)(XICSState *icp, uint32_t nr_servers, Error **er= rp); }; =20 struct XICSState { @@ -189,8 +188,6 @@ void spapr_dt_xics(XICSState *xics, void *fdt, uint32_t= phandle); =20 void xics_cpu_setup(XICSState *icp, PowerPCCPU *cpu); void xics_cpu_destroy(XICSState *icp, PowerPCCPU *cpu); -void xics_set_nr_servers(XICSState *xics, uint32_t nr_servers, - const char *typename, Error **errp); =20 /* Internal XICS interfaces */ int xics_get_cpu_index_by_dt_id(int cpu_dt_id); --=20 2.7.4 From nobody Thu May 2 04:10:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487253304859510.539415767522; Thu, 16 Feb 2017 05:55:04 -0800 (PST) Received: from localhost ([::1]:46764 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMWU-0007K7-Gb for importer@patchew.org; Thu, 16 Feb 2017 08:55:02 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38077) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMQB-0001Op-Kw for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:48:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ceMQ8-00053J-CE for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:48:31 -0500 Received: from 10.mo173.mail-out.ovh.net ([46.105.74.148]:39008) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ceMQ8-000539-2K for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:48:28 -0500 Received: from player791.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo173.mail-out.ovh.net (Postfix) with ESMTP id E72C624103 for ; Thu, 16 Feb 2017 14:48:26 +0100 (CET) Received: from zorba.kaod.org.com (LFbn-1-10647-27.w90-89.abo.wanadoo.fr [90.89.233.27]) (Authenticated sender: clg@kaod.org) by player791.ha.ovh.net (Postfix) with ESMTPSA id 9609542007C; Thu, 16 Feb 2017 14:48:17 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Thu, 16 Feb 2017 14:47:26 +0100 Message-Id: <1487252865-12064-4-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487252865-12064-1-git-send-email-clg@kaod.org> References: <1487252865-12064-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 12513814518705851366 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrtdeggdehgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 46.105.74.148 Subject: [Qemu-devel] [PATCH v2 03/22] ppc/xics: store the ICS object under the sPAPR machine X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" A list of ICS objects was introduced under the XICS object for the PowerNV machine, but, for the sPAPR machine, it brings extra complexity as there is only a single ICS. To simplify the code, let's add the ICS pointer under the sPAPR machine and try to reduce the use of this list where possible. Also, change the xics_spapr_*() routines to use an ICS object instead of an XICSState and change their name to reflect that these are specific to the sPAPR ICS object. Signed-off-by: C=C3=A9dric Le Goater --- hw/intc/xics_spapr.c | 22 +++++++++------------- hw/ppc/spapr.c | 29 ++++++++++++++++------------- hw/ppc/spapr_events.c | 4 ++-- hw/ppc/spapr_pci.c | 8 ++++---- hw/ppc/spapr_vio.c | 2 +- include/hw/ppc/spapr.h | 1 + include/hw/ppc/xics.h | 6 +++--- 7 files changed, 36 insertions(+), 36 deletions(-) diff --git a/hw/intc/xics_spapr.c b/hw/intc/xics_spapr.c index 859b5675e175..1501e796e5e0 100644 --- a/hw/intc/xics_spapr.c +++ b/hw/intc/xics_spapr.c @@ -118,7 +118,7 @@ static void rtas_set_xive(PowerPCCPU *cpu, sPAPRMachine= State *spapr, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) { - ICSState *ics =3D QLIST_FIRST(&spapr->xics->ics); + ICSState *ics =3D spapr->ics; uint32_t nr, srcno, server, priority; =20 if ((nargs !=3D 3) || (nret !=3D 1)) { @@ -151,7 +151,7 @@ static void rtas_get_xive(PowerPCCPU *cpu, sPAPRMachine= State *spapr, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) { - ICSState *ics =3D QLIST_FIRST(&spapr->xics->ics); + ICSState *ics =3D spapr->ics; uint32_t nr, srcno; =20 if ((nargs !=3D 1) || (nret !=3D 3)) { @@ -181,7 +181,7 @@ static void rtas_int_off(PowerPCCPU *cpu, sPAPRMachineS= tate *spapr, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) { - ICSState *ics =3D QLIST_FIRST(&spapr->xics->ics); + ICSState *ics =3D spapr->ics; uint32_t nr, srcno; =20 if ((nargs !=3D 1) || (nret !=3D 1)) { @@ -212,7 +212,7 @@ static void rtas_int_on(PowerPCCPU *cpu, sPAPRMachineSt= ate *spapr, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) { - ICSState *ics =3D QLIST_FIRST(&spapr->xics->ics); + ICSState *ics =3D spapr->ics; uint32_t nr, srcno; =20 if ((nargs !=3D 1) || (nret !=3D 1)) { @@ -294,9 +294,8 @@ static int ics_find_free_block(ICSState *ics, int num, = int alignnum) return -1; } =20 -int xics_spapr_alloc(XICSState *xics, int irq_hint, bool lsi, Error **errp) +int spapr_ics_alloc(ICSState *ics, int irq_hint, bool lsi, Error **errp) { - ICSState *ics =3D QLIST_FIRST(&xics->ics); int irq; =20 if (!ics) { @@ -327,10 +326,9 @@ int xics_spapr_alloc(XICSState *xics, int irq_hint, bo= ol lsi, Error **errp) * Allocate block of consecutive IRQs, and return the number of the first = IRQ in * the block. If align=3D=3Dtrue, aligns the first IRQ number to num. */ -int xics_spapr_alloc_block(XICSState *xics, int num, bool lsi, bool align, - Error **errp) +int spapr_ics_alloc_block(ICSState *ics, int num, bool lsi, + bool align, Error **errp) { - ICSState *ics =3D QLIST_FIRST(&xics->ics); int i, first =3D -1; =20 if (!ics) { @@ -380,11 +378,9 @@ static void ics_free(ICSState *ics, int srcno, int num) } } =20 -void xics_spapr_free(XICSState *xics, int irq, int num) +void spapr_ics_free(ICSState *ics, int irq, int num) { - ICSState *ics =3D xics_find_source(xics, irq); - - if (ics) { + if (ics_valid_irq(ics, irq)) { trace_xics_ics_free(0, irq, num); ics_free(ics, irq - ics->offset, num); } diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 5d7c35de8cd9..045f2323a4e9 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -95,13 +95,13 @@ =20 #define HTAB_SIZE(spapr) (1ULL << ((spapr)->htab_shift)) =20 -static XICSState *try_create_xics(const char *type, const char *type_ics, +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) { Error *err =3D NULL, *local_err =3D NULL; XICSState *xics; - ICSState *ics =3D NULL; int i; =20 xics =3D XICS_COMMON(object_new(type)); @@ -111,16 +111,17 @@ static XICSState *try_create_xics(const char *type, c= onst char *type_ics, goto error; } =20 - ics =3D ICS_SIMPLE(object_new(type_ics)); - object_property_add_child(OBJECT(xics), "ics", OBJECT(ics), NULL); - object_property_set_int(OBJECT(ics), nr_irqs, "nr-irqs", &err); - object_property_add_const_link(OBJECT(ics), "xics", OBJECT(xics), NULL= ); - object_property_set_bool(OBJECT(ics), true, "realized", &local_err); + spapr->ics =3D ICS_SIMPLE(object_new(type_ics)); + object_property_add_child(OBJECT(spapr), "ics", OBJECT(spapr->ics), NU= LL); + object_property_set_int(OBJECT(spapr->ics), nr_irqs, "nr-irqs", &err); + object_property_add_const_link(OBJECT(spapr->ics), "xics", OBJECT(xics= ), + NULL); + object_property_set_bool(OBJECT(spapr->ics), true, "realized", &local_= err); error_propagate(&err, local_err); if (err) { goto error; } - QLIST_INSERT_HEAD(&xics->ics, ics, list); + QLIST_INSERT_HEAD(&xics->ics, spapr->ics, list); =20 xics->ss =3D g_malloc0(nr_servers * sizeof(ICPState)); xics->nr_servers =3D nr_servers; @@ -142,8 +143,8 @@ static XICSState *try_create_xics(const char *type, con= st char *type_ics, =20 error: error_propagate(errp, err); - if (ics) { - object_unparent(OBJECT(ics)); + if (spapr->ics) { + object_unparent(OBJECT(spapr->ics)); } object_unparent(OBJECT(xics)); return NULL; @@ -158,7 +159,8 @@ static XICSState *xics_system_init(MachineState *machin= e, Error *err =3D NULL; =20 if (machine_kernel_irqchip_allowed(machine)) { - xics =3D try_create_xics(TYPE_XICS_SPAPR_KVM, TYPE_ICS_KVM, + xics =3D try_create_xics(SPAPR_MACHINE(machine), + TYPE_XICS_SPAPR_KVM, TYPE_ICS_KVM, TYPE_KVM_ICP, nr_servers, nr_irqs, &err= ); } if (machine_kernel_irqchip_required(machine) && !xics) { @@ -170,8 +172,9 @@ static XICSState *xics_system_init(MachineState *machin= e, } =20 if (!xics) { - xics =3D try_create_xics(TYPE_XICS_SPAPR, TYPE_ICS_SIMPLE, TYPE_IC= P, - nr_servers, nr_irqs, errp); + xics =3D try_create_xics(SPAPR_MACHINE(machine), + TYPE_XICS_SPAPR, TYPE_ICS_SIMPLE, + TYPE_ICP, nr_servers, nr_irqs, errp); } =20 return xics; diff --git a/hw/ppc/spapr_events.c b/hw/ppc/spapr_events.c index f85a9c32a7fc..38b4258a9be7 100644 --- a/hw/ppc/spapr_events.c +++ b/hw/ppc/spapr_events.c @@ -752,7 +752,7 @@ void spapr_events_init(sPAPRMachineState *spapr) spapr->event_sources =3D spapr_event_sources_new(); =20 spapr_event_sources_register(spapr->event_sources, EVENT_CLASS_EPOW, - xics_spapr_alloc(spapr->xics, 0, false, + spapr_ics_alloc(spapr->ics, 0, false, &error_fatal)); =20 /* NOTE: if machine supports modern/dedicated hotplug event source, @@ -765,7 +765,7 @@ void spapr_events_init(sPAPRMachineState *spapr) */ if (spapr->use_hotplug_event_source) { spapr_event_sources_register(spapr->event_sources, EVENT_CLASS_HOT= _PLUG, - xics_spapr_alloc(spapr->xics, 0, fals= e, + spapr_ics_alloc(spapr->ics, 0, false, &error_fatal)); } =20 diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index fd6fc1d95344..01d5c92425ed 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -325,7 +325,7 @@ static void rtas_ibm_change_msi(PowerPCCPU *cpu, sPAPRM= achineState *spapr, return; } =20 - xics_spapr_free(spapr->xics, msi->first_irq, msi->num); + spapr_ics_free(spapr->ics, msi->first_irq, msi->num); if (msi_present(pdev)) { spapr_msi_setmsg(pdev, 0, false, 0, 0); } @@ -363,7 +363,7 @@ static void rtas_ibm_change_msi(PowerPCCPU *cpu, sPAPRM= achineState *spapr, } =20 /* Allocate MSIs */ - irq =3D xics_spapr_alloc_block(spapr->xics, req_num, false, + irq =3D spapr_ics_alloc_block(spapr->ics, req_num, false, ret_intr_type =3D=3D RTAS_TYPE_MSI, &err); if (err) { error_reportf_err(err, "Can't allocate MSIs for device %x: ", @@ -374,7 +374,7 @@ static void rtas_ibm_change_msi(PowerPCCPU *cpu, sPAPRM= achineState *spapr, =20 /* Release previous MSIs */ if (msi) { - xics_spapr_free(spapr->xics, msi->first_irq, msi->num); + spapr_ics_free(spapr->ics, msi->first_irq, msi->num); g_hash_table_remove(phb->msi, &config_addr); } =20 @@ -1485,7 +1485,7 @@ static void spapr_phb_realize(DeviceState *dev, Error= **errp) uint32_t irq; Error *local_err =3D NULL; =20 - irq =3D xics_spapr_alloc_block(spapr->xics, 1, true, false, &local= _err); + irq =3D spapr_ics_alloc_block(spapr->ics, 1, true, false, &local_e= rr); if (local_err) { error_propagate(errp, local_err); error_prepend(errp, "can't allocate LSIs: "); diff --git a/hw/ppc/spapr_vio.c b/hw/ppc/spapr_vio.c index 8bfc5f971f8e..a0ee4fd26586 100644 --- a/hw/ppc/spapr_vio.c +++ b/hw/ppc/spapr_vio.c @@ -454,7 +454,7 @@ static void spapr_vio_busdev_realize(DeviceState *qdev,= Error **errp) dev->qdev.id =3D id; } =20 - dev->irq =3D xics_spapr_alloc(spapr->xics, dev->irq, false, &local_err= ); + dev->irq =3D spapr_ics_alloc(spapr->ics, dev->irq, false, &local_err); if (local_err) { error_propagate(errp, local_err); return; diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index f9b17d860a75..21e506b13cfa 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -59,6 +59,7 @@ struct sPAPRMachineState { QLIST_HEAD(, sPAPRPHBState) phbs; struct sPAPRNVRAM *nvram; XICSState *xics; + ICSState *ics; DeviceState *rtc; =20 void *htab; diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index fc4abcd4e796..6d443ce09dba 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -180,10 +180,10 @@ struct ICSIRQState { #define XICS_IRQS_SPAPR 1024 =20 qemu_irq xics_get_qirq(XICSState *icp, int irq); -int xics_spapr_alloc(XICSState *icp, int irq_hint, bool lsi, Error **errp); -int xics_spapr_alloc_block(XICSState *icp, int num, bool lsi, bool align, +int spapr_ics_alloc(ICSState *ics, int irq_hint, bool lsi, Error **errp); +int spapr_ics_alloc_block(ICSState *ics, int num, bool lsi, bool align, Error **errp); -void xics_spapr_free(XICSState *icp, int irq, int num); +void spapr_ics_free(ICSState *ics, int irq, int num); void spapr_dt_xics(XICSState *xics, void *fdt, uint32_t phandle); =20 void xics_cpu_setup(XICSState *icp, PowerPCCPU *cpu); --=20 2.7.4 From nobody Thu May 2 04:10:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487253327406676.3993394988634; Thu, 16 Feb 2017 05:55:27 -0800 (PST) Received: from localhost ([::1]:46766 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMWq-0007aW-Mz for importer@patchew.org; Thu, 16 Feb 2017 08:55:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38176) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMQJ-0001Va-AU for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:48:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ceMQG-00056e-33 for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:48:39 -0500 Received: from 6.mo173.mail-out.ovh.net ([46.105.43.93]:58704) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ceMQF-00055a-QY for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:48:36 -0500 Received: from player791.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo173.mail-out.ovh.net (Postfix) with ESMTP id 1EEBB24154 for ; Thu, 16 Feb 2017 14:48:34 +0100 (CET) Received: from zorba.kaod.org.com (LFbn-1-10647-27.w90-89.abo.wanadoo.fr [90.89.233.27]) (Authenticated sender: clg@kaod.org) by player791.ha.ovh.net (Postfix) with ESMTPSA id D3F4F420082; Thu, 16 Feb 2017 14:48:26 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Thu, 16 Feb 2017 14:47:27 +0100 Message-Id: <1487252865-12064-5-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487252865-12064-1-git-send-email-clg@kaod.org> References: <1487252865-12064-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 12516066318011173862 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrtdeggdehgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 46.105.43.93 Subject: [Qemu-devel] [PATCH v2 04/22] ppc/xics: add an InterruptStatsProvider interface to ICS and ICP objects X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This is, again, to reduce the use of the list of ICS objects. Let's make each individual ICS and ICP object an InterruptStatsProvider and remove this same interface from XICSState. Signed-off-by: C=C3=A9dric Le Goater --- hw/intc/xics.c | 76 +++++++++++++++++++++++++++++++-----------------------= ---- 1 file changed, 41 insertions(+), 35 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 9f22814815c9..b1294417a0ae 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -92,44 +92,44 @@ void xics_cpu_setup(XICSState *xics, PowerPCCPU *cpu) } } =20 -static void xics_common_pic_print_info(InterruptStatsProvider *obj, - Monitor *mon) +static void icp_pic_print_info(InterruptStatsProvider *obj, + Monitor *mon) { - XICSState *xics =3D XICS_COMMON(obj); - ICSState *ics; + ICPState *icp =3D ICP(obj); + int cpu_index =3D icp->cs ? icp->cs->cpu_index : -1; + + if (!icp->output) { + return; + } + monitor_printf(mon, "CPU %d XIRR=3D%08x (%p) PP=3D%02x MFRR=3D%02x\n", + cpu_index, icp->xirr, icp->xirr_owner, + icp->pending_priority, icp->mfrr); +} + +static void ics_simple_pic_print_info(InterruptStatsProvider *obj, + Monitor *mon) +{ + ICSState *ics =3D ICS_SIMPLE(obj); uint32_t i; =20 - for (i =3D 0; i < xics->nr_servers; i++) { - ICPState *icp =3D &xics->ss[i]; + monitor_printf(mon, "ICS %4x..%4x %p\n", + ics->offset, ics->offset + ics->nr_irqs - 1, ics); =20 - if (!icp->output) { - continue; - } - monitor_printf(mon, "CPU %d XIRR=3D%08x (%p) PP=3D%02x MFRR=3D%02x= \n", - i, icp->xirr, icp->xirr_owner, - icp->pending_priority, icp->mfrr); + if (!ics->irqs) { + return; } =20 - QLIST_FOREACH(ics, &xics->ics, list) { - monitor_printf(mon, "ICS %4x..%4x %p\n", - ics->offset, ics->offset + ics->nr_irqs - 1, ics); + for (i =3D 0; i < ics->nr_irqs; i++) { + ICSIRQState *irq =3D ics->irqs + i; =20 - if (!ics->irqs) { + if (!(irq->flags & XICS_FLAGS_IRQ_MASK)) { continue; } - - for (i =3D 0; i < ics->nr_irqs; i++) { - ICSIRQState *irq =3D ics->irqs + i; - - if (!(irq->flags & XICS_FLAGS_IRQ_MASK)) { - continue; - } - monitor_printf(mon, " %4x %s %02x %02x\n", - ics->offset + i, - (irq->flags & XICS_FLAGS_IRQ_LSI) ? - "LSI" : "MSI", - irq->priority, irq->status); - } + monitor_printf(mon, " %4x %s %02x %02x\n", + ics->offset + i, + (irq->flags & XICS_FLAGS_IRQ_LSI) ? + "LSI" : "MSI", + irq->priority, irq->status); } } =20 @@ -161,10 +161,8 @@ static void xics_common_initfn(Object *obj) static void xics_common_class_init(ObjectClass *oc, void *data) { DeviceClass *dc =3D DEVICE_CLASS(oc); - InterruptStatsProviderClass *ic =3D INTERRUPT_STATS_PROVIDER_CLASS(oc); =20 dc->reset =3D xics_common_reset; - ic->print_info =3D xics_common_pic_print_info; } =20 static const TypeInfo xics_common_info =3D { @@ -174,10 +172,6 @@ static const TypeInfo xics_common_info =3D { .class_size =3D sizeof(XICSStateClass), .instance_init =3D xics_common_initfn, .class_init =3D xics_common_class_init, - .interfaces =3D (InterfaceInfo[]) { - { TYPE_INTERRUPT_STATS_PROVIDER }, - { } - }, }; =20 /* @@ -414,10 +408,12 @@ static void icp_realize(DeviceState *dev, Error **err= p) static void icp_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); + InterruptStatsProviderClass *ic =3D INTERRUPT_STATS_PROVIDER_CLASS(kla= ss); =20 dc->reset =3D icp_reset; dc->vmsd =3D &vmstate_icp_server; dc->realize =3D icp_realize; + ic->print_info =3D icp_pic_print_info; } =20 static const TypeInfo icp_info =3D { @@ -426,6 +422,10 @@ static const TypeInfo icp_info =3D { .instance_size =3D sizeof(ICPState), .class_init =3D icp_class_init, .class_size =3D sizeof(ICPStateClass), + .interfaces =3D (InterfaceInfo[]) { + { TYPE_INTERRUPT_STATS_PROVIDER }, + { } + }, }; =20 /* @@ -692,6 +692,7 @@ static void ics_simple_class_init(ObjectClass *klass, v= oid *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); ICSStateClass *isc =3D ICS_BASE_CLASS(klass); + InterruptStatsProviderClass *ic =3D INTERRUPT_STATS_PROVIDER_CLASS(kla= ss); =20 dc->realize =3D ics_simple_realize; dc->props =3D ics_simple_properties; @@ -701,6 +702,7 @@ static void ics_simple_class_init(ObjectClass *klass, v= oid *data) isc->reject =3D ics_simple_reject; isc->resend =3D ics_simple_resend; isc->eoi =3D ics_simple_eoi; + ic->print_info =3D ics_simple_pic_print_info; } =20 static const TypeInfo ics_simple_info =3D { @@ -710,6 +712,10 @@ static const TypeInfo ics_simple_info =3D { .class_init =3D ics_simple_class_init, .class_size =3D sizeof(ICSStateClass), .instance_init =3D ics_simple_initfn, + .interfaces =3D (InterfaceInfo[]) { + { TYPE_INTERRUPT_STATS_PROVIDER }, + { } + }, }; =20 static const TypeInfo ics_base_info =3D { --=20 2.7.4 From nobody Thu May 2 04:10:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487253115899184.44818785338828; Thu, 16 Feb 2017 05:51:55 -0800 (PST) Received: from localhost ([::1]:46747 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMTS-0003jx-89 for importer@patchew.org; Thu, 16 Feb 2017 08:51:54 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38217) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMQM-0001ZD-PV for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:48:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ceMQL-00059h-UD for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:48:42 -0500 Received: from 6.mo173.mail-out.ovh.net ([46.105.43.93]:53237) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ceMQL-00059G-Nl for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:48:41 -0500 Received: from player791.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo173.mail-out.ovh.net (Postfix) with ESMTP id 931B224154 for ; Thu, 16 Feb 2017 14:48:40 +0100 (CET) Received: from zorba.kaod.org.com (LFbn-1-10647-27.w90-89.abo.wanadoo.fr [90.89.233.27]) (Authenticated sender: clg@kaod.org) by player791.ha.ovh.net (Postfix) with ESMTPSA id 2A61E420072; Thu, 16 Feb 2017 14:48:34 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Thu, 16 Feb 2017 14:47:28 +0100 Message-Id: <1487252865-12064-6-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487252865-12064-1-git-send-email-clg@kaod.org> References: <1487252865-12064-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 12517755167185996774 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrtdeggdehgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 46.105.43.93 Subject: [Qemu-devel] [PATCH v2 05/22] ppc/xics: introduce a QOM interface to handle ICSs X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This QOM interface provides two simple handlers. One is to get an ICS object from an irq number and a second to resend the irqs when needed. Signed-off-by: C=C3=A9dric Le Goater Reviewed-by: David Gibson --- hw/intc/xics.c | 7 +++++++ include/hw/ppc/xics.h | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index b1294417a0ae..3e80d2d0f0d9 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -726,6 +726,12 @@ static const TypeInfo ics_base_info =3D { .class_size =3D sizeof(ICSStateClass), }; =20 +static const TypeInfo xics_interface_info =3D { + .name =3D TYPE_XICS_INTERFACE, + .parent =3D TYPE_INTERFACE, + .class_size =3D sizeof(XICSInterfaceClass), +}; + /* * Exported functions */ @@ -766,6 +772,7 @@ static void xics_register_types(void) type_register_static(&ics_simple_info); type_register_static(&ics_base_info); type_register_static(&icp_info); + type_register_static(&xics_interface_info); } =20 type_init(xics_register_types) diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index 6d443ce09dba..fe2bb5c8ef54 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -177,6 +177,24 @@ struct ICSIRQState { uint8_t flags; }; =20 +typedef struct XICSInterface { + Object parent; +} XICSInterface; + +#define TYPE_XICS_INTERFACE "xics-interface" +#define XICS_INTERFACE(obj) \ + OBJECT_CHECK(XICSInterface, (obj), TYPE_XICS_INTERFACE) +#define XICS_INTERFACE_CLASS(klass) \ + OBJECT_CLASS_CHECK(XICSInterfaceClass, (klass), TYPE_XICS_INTERFACE) +#define XICS_INTERFACE_GET_CLASS(obj) \ + OBJECT_GET_CLASS(XICSInterfaceClass, (obj), TYPE_XICS_INTERFACE) + +typedef struct XICSInterfaceClass { + InterfaceClass parent; + ICSState *(*ics_get)(XICSInterface *xi, int irq); + void (*ics_resend)(XICSInterface *xi); +} XICSInterfaceClass; + #define XICS_IRQS_SPAPR 1024 =20 qemu_irq xics_get_qirq(XICSState *icp, int irq); --=20 2.7.4 From nobody Thu May 2 04:10:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 14872533342396.888614193340118; Thu, 16 Feb 2017 05:55:34 -0800 (PST) Received: from localhost ([::1]:46767 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMWw-0007h6-U1 for importer@patchew.org; Thu, 16 Feb 2017 08:55:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38281) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMQW-0001gN-2Q for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:48:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ceMQT-0005E6-0n for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:48:52 -0500 Received: from mo173.mail-out.ovh.net ([178.32.228.173]:40055) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ceMQS-0005DZ-Q2 for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:48:48 -0500 Received: from player791.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo173.mail-out.ovh.net (Postfix) with ESMTP id A892124167 for ; Thu, 16 Feb 2017 14:48:47 +0100 (CET) Received: from zorba.kaod.org.com (LFbn-1-10647-27.w90-89.abo.wanadoo.fr [90.89.233.27]) (Authenticated sender: clg@kaod.org) by player791.ha.ovh.net (Postfix) with ESMTPSA id 83D69420097; Thu, 16 Feb 2017 14:48:40 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Thu, 16 Feb 2017 14:47:29 +0100 Message-Id: <1487252865-12064-7-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487252865-12064-1-git-send-email-clg@kaod.org> References: <1487252865-12064-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 12519725489127132134 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrtdeggdehgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 178.32.228.173 Subject: [Qemu-devel] [PATCH v2 06/22] ppc/xics: use the QOM interface under the sPAPR machine X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add 'ics_get' and 'ics_resend' handlers to the sPAPR machine. These are relatively simple for a single ICS. Signed-off-by: C=C3=A9dric Le Goater Reviewed-by: David Gibson --- hw/intc/xics.c | 2 +- hw/ppc/spapr.c | 18 ++++++++++++++++++ include/hw/ppc/xics.h | 1 + 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 3e80d2d0f0d9..39c442f70116 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -193,7 +193,7 @@ static void ics_reject(ICSState *ics, uint32_t nr) } } =20 -static void ics_resend(ICSState *ics) +void ics_resend(ICSState *ics) { ICSStateClass *k =3D ICS_BASE_GET_CLASS(ics); =20 diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 045f2323a4e9..85a973cce7ae 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2901,6 +2901,20 @@ static void spapr_phb_placement(sPAPRMachineState *s= papr, uint32_t index, *mmio64 =3D SPAPR_PCI_BASE + (index + 1) * SPAPR_PCI_MEM64_WIN_SIZE; } =20 +static ICSState *spapr_ics_get(XICSInterface *dev, int irq) +{ + sPAPRMachineState *spapr =3D SPAPR_MACHINE(dev); + + return ics_valid_irq(spapr->ics, irq) ? spapr->ics : NULL; +} + +static void spapr_ics_resend(XICSInterface *dev) +{ + sPAPRMachineState *spapr =3D SPAPR_MACHINE(dev); + + ics_resend(spapr->ics); +} + static void spapr_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc =3D MACHINE_CLASS(oc); @@ -2909,6 +2923,7 @@ static void spapr_machine_class_init(ObjectClass *oc,= void *data) NMIClass *nc =3D NMI_CLASS(oc); HotplugHandlerClass *hc =3D HOTPLUG_HANDLER_CLASS(oc); PPCVirtualHypervisorClass *vhc =3D PPC_VIRTUAL_HYPERVISOR_CLASS(oc); + XICSInterfaceClass *xic =3D XICS_INTERFACE_CLASS(oc); =20 mc->desc =3D "pSeries Logical Partition (PAPR compliant)"; =20 @@ -2942,6 +2957,8 @@ static void spapr_machine_class_init(ObjectClass *oc,= void *data) nc->nmi_monitor_handler =3D spapr_nmi; smc->phb_placement =3D spapr_phb_placement; vhc->hypercall =3D emulate_spapr_hypercall; + xic->ics_get =3D spapr_ics_get; + xic->ics_resend =3D spapr_ics_resend; } =20 static const TypeInfo spapr_machine_info =3D { @@ -2958,6 +2975,7 @@ static const TypeInfo spapr_machine_info =3D { { TYPE_NMI }, { TYPE_HOTPLUG_HANDLER }, { TYPE_PPC_VIRTUAL_HYPERVISOR }, + { TYPE_XICS_INTERFACE }, { } }, }; diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index fe2bb5c8ef54..640603b3d76d 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -222,5 +222,6 @@ void ics_simple_write_xive(ICSState *ics, int nr, int s= erver, void ics_set_irq_type(ICSState *ics, int srcno, bool lsi); =20 ICSState *xics_find_source(XICSState *icp, int irq); +void ics_resend(ICSState *ics); =20 #endif /* XICS_H */ --=20 2.7.4 From nobody Thu May 2 04:10:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487253401805356.5553679662429; Thu, 16 Feb 2017 05:56:41 -0800 (PST) Received: from localhost ([::1]:46774 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMY4-0000HG-IE for importer@patchew.org; Thu, 16 Feb 2017 08:56:40 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38319) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMQc-0001lN-GY for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:49:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ceMQZ-0005GJ-E6 for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:48:58 -0500 Received: from 6.mo173.mail-out.ovh.net ([46.105.43.93]:39880) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ceMQZ-0005G1-7t for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:48:55 -0500 Received: from player791.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo173.mail-out.ovh.net (Postfix) with ESMTP id DA0702405F for ; Thu, 16 Feb 2017 14:48:53 +0100 (CET) Received: from zorba.kaod.org.com (LFbn-1-10647-27.w90-89.abo.wanadoo.fr [90.89.233.27]) (Authenticated sender: clg@kaod.org) by player791.ha.ovh.net (Postfix) with ESMTPSA id 9485E42008D; Thu, 16 Feb 2017 14:48:47 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Thu, 16 Feb 2017 14:47:30 +0100 Message-Id: <1487252865-12064-8-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487252865-12064-1-git-send-email-clg@kaod.org> References: <1487252865-12064-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 12521414339767602150 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrtdeggdehgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 46.105.43.93 Subject: [Qemu-devel] [PATCH v2 07/22] ppc/xics: use the QOM interface to get irqs X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: C=C3=A9dric Le Goater Reviewed-by: David Gibson --- hw/intc/xics.c | 5 +++-- hw/ppc/spapr_events.c | 6 +++--- hw/ppc/spapr_pci.c | 2 +- include/hw/pci-host/spapr.h | 2 +- include/hw/ppc/spapr_vio.h | 2 +- include/hw/ppc/xics.h | 3 ++- 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 39c442f70116..0ffdf09c5304 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -747,9 +747,10 @@ ICSState *xics_find_source(XICSState *xics, int irq) return NULL; } =20 -qemu_irq xics_get_qirq(XICSState *xics, int irq) +qemu_irq xics_get_qirq(XICSInterface *xi, int irq) { - ICSState *ics =3D xics_find_source(xics, irq); + XICSInterfaceClass *xic =3D XICS_INTERFACE_GET_CLASS(xi); + ICSState *ics =3D xic->ics_get(xi, irq); =20 if (ics) { return ics->qirqs[irq - ics->offset]; diff --git a/hw/ppc/spapr_events.c b/hw/ppc/spapr_events.c index 38b4258a9be7..aa627dc13008 100644 --- a/hw/ppc/spapr_events.c +++ b/hw/ppc/spapr_events.c @@ -481,7 +481,7 @@ static void spapr_powerdown_req(Notifier *n, void *opaq= ue) =20 rtas_event_log_queue(RTAS_LOG_TYPE_EPOW, new_epow, true); =20 - qemu_irq_pulse(xics_get_qirq(spapr->xics, + qemu_irq_pulse(xics_get_qirq(XICS_INTERFACE(spapr), rtas_event_log_to_irq(spapr, RTAS_LOG_TYPE_EPOW)= )); } @@ -574,7 +574,7 @@ static void spapr_hotplug_req_event(uint8_t hp_id, uint= 8_t hp_action, =20 rtas_event_log_queue(RTAS_LOG_TYPE_HOTPLUG, new_hp, true); =20 - qemu_irq_pulse(xics_get_qirq(spapr->xics, + qemu_irq_pulse(xics_get_qirq(XICS_INTERFACE(spapr), rtas_event_log_to_irq(spapr, RTAS_LOG_TYPE_HOTPL= UG))); } @@ -695,7 +695,7 @@ static void check_exception(PowerPCCPU *cpu, sPAPRMachi= neState *spapr, spapr_event_sources_get_source(spapr->event_sources, i); =20 g_assert(source->enabled); - qemu_irq_pulse(xics_get_qirq(spapr->xics, source->irq)); + qemu_irq_pulse(xics_get_qirq(XICS_INTERFACE(spapr), source->ir= q)); } } =20 diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index 01d5c92425ed..e52d6e993c9e 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -736,7 +736,7 @@ static void spapr_msi_write(void *opaque, hwaddr addr, =20 trace_spapr_pci_msi_write(addr, data, irq); =20 - qemu_irq_pulse(xics_get_qirq(spapr->xics, irq)); + qemu_irq_pulse(xics_get_qirq(XICS_INTERFACE(spapr), irq)); } =20 static const MemoryRegionOps spapr_msi_ops =3D { diff --git a/include/hw/pci-host/spapr.h b/include/hw/pci-host/spapr.h index 092294ed5a65..bfd307be30ca 100644 --- a/include/hw/pci-host/spapr.h +++ b/include/hw/pci-host/spapr.h @@ -106,7 +106,7 @@ static inline qemu_irq spapr_phb_lsi_qirq(struct sPAPRP= HBState *phb, int pin) { sPAPRMachineState *spapr =3D SPAPR_MACHINE(qdev_get_machine()); =20 - return xics_get_qirq(spapr->xics, phb->lsi_table[pin].irq); + return xics_get_qirq(XICS_INTERFACE(spapr), phb->lsi_table[pin].irq); } =20 PCIHostState *spapr_create_phb(sPAPRMachineState *spapr, int index); diff --git a/include/hw/ppc/spapr_vio.h b/include/hw/ppc/spapr_vio.h index fc6f673ea086..1b04523b683d 100644 --- a/include/hw/ppc/spapr_vio.h +++ b/include/hw/ppc/spapr_vio.h @@ -87,7 +87,7 @@ static inline qemu_irq spapr_vio_qirq(VIOsPAPRDevice *dev) { sPAPRMachineState *spapr =3D SPAPR_MACHINE(qdev_get_machine()); =20 - return xics_get_qirq(spapr->xics, dev->irq); + return xics_get_qirq(XICS_INTERFACE(spapr), dev->irq); } =20 static inline bool spapr_vio_dma_valid(VIOsPAPRDevice *dev, uint64_t taddr, diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index 640603b3d76d..896fa5d87c1c 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -197,7 +197,8 @@ typedef struct XICSInterfaceClass { =20 #define XICS_IRQS_SPAPR 1024 =20 -qemu_irq xics_get_qirq(XICSState *icp, int irq); +qemu_irq xics_get_qirq(XICSInterface *xi, int irq); + int spapr_ics_alloc(ICSState *ics, int irq_hint, bool lsi, Error **errp); int spapr_ics_alloc_block(ICSState *ics, int num, bool lsi, bool align, Error **errp); --=20 2.7.4 From nobody Thu May 2 04:10:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487253607490999.9350801086583; Thu, 16 Feb 2017 06:00:07 -0800 (PST) Received: from localhost ([::1]:46797 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMbN-0004BC-75 for importer@patchew.org; Thu, 16 Feb 2017 09:00:05 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38460) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMQi-0001qq-Tu for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:49:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ceMQf-0005JT-2W for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:49:04 -0500 Received: from mo173.mail-out.ovh.net ([178.32.228.173]:45102) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ceMQe-0005IO-Sk for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:49:01 -0500 Received: from player791.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo173.mail-out.ovh.net (Postfix) with ESMTP id B760823A73 for ; Thu, 16 Feb 2017 14:48:59 +0100 (CET) Received: from zorba.kaod.org.com (LFbn-1-10647-27.w90-89.abo.wanadoo.fr [90.89.233.27]) (Authenticated sender: clg@kaod.org) by player791.ha.ovh.net (Postfix) with ESMTPSA id 930B942009B; Thu, 16 Feb 2017 14:48:53 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Thu, 16 Feb 2017 14:47:31 +0100 Message-Id: <1487252865-12064-9-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487252865-12064-1-git-send-email-clg@kaod.org> References: <1487252865-12064-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 12523103192651959270 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrtdeggdehgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 178.32.228.173 Subject: [Qemu-devel] [PATCH v2 08/22] ppc/xics: use the QOM interface to resend irqs X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: C=C3=A9dric Le Goater --- hw/intc/xics.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 0ffdf09c5304..2decb921e4e3 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -229,16 +229,15 @@ static void icp_check_ipi(ICPState *ss) qemu_irq_raise(ss->output); } =20 -static void icp_resend(ICPState *ss) +static void icp_resend(XICSInterface *xi, ICPState *ss) { - ICSState *ics; + XICSInterfaceClass *xic =3D XICS_INTERFACE_GET_CLASS(xi); =20 if (ss->mfrr < CPPR(ss)) { icp_check_ipi(ss); } - QLIST_FOREACH(ics, &ss->xics->ics, list) { - ics_resend(ics); - } + + xic->ics_resend(xi); } =20 void icp_set_cppr(ICPState *ss, uint8_t cppr) @@ -262,7 +261,7 @@ void icp_set_cppr(ICPState *ss, uint8_t cppr) } } else { if (!XISR(ss)) { - icp_resend(ss); + icp_resend(XICS_INTERFACE(qdev_get_machine()), ss); } } } @@ -299,6 +298,8 @@ uint32_t icp_ipoll(ICPState *ss, uint32_t *mfrr) =20 void icp_eoi(ICPState *ss, uint32_t xirr) { + XICSInterface *xi =3D XICS_INTERFACE(qdev_get_machine()); + XICSInterfaceClass *xic =3D XICS_INTERFACE_GET_CLASS(xi); ICSState *ics; uint32_t irq; =20 @@ -306,13 +307,13 @@ void icp_eoi(ICPState *ss, uint32_t xirr) ss->xirr =3D (ss->xirr & ~CPPR_MASK) | (xirr & CPPR_MASK); trace_xics_icp_eoi(ss->cs->cpu_index, xirr, ss->xirr); irq =3D xirr & XISR_MASK; - QLIST_FOREACH(ics, &ss->xics->ics, list) { - if (ics_valid_irq(ics, irq)) { - ics_eoi(ics, irq); - } + + ics =3D xic->ics_get(xi, irq); + if (ics) { + ics_eoi(ics, irq); } if (!XISR(ss)) { - icp_resend(ss); + icp_resend(xi, ss); } } =20 @@ -592,10 +593,11 @@ static void ics_simple_reset(DeviceState *dev) =20 static int ics_simple_post_load(ICSState *ics, int version_id) { + XICSInterface *xi =3D XICS_INTERFACE(qdev_get_machine()); int i; =20 for (i =3D 0; i < ics->xics->nr_servers; i++) { - icp_resend(&ics->xics->ss[i]); + icp_resend(xi, &ics->xics->ss[i]); } =20 return 0; --=20 2.7.4 From nobody Thu May 2 04:10:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 148725391512085.66167488837164; Thu, 16 Feb 2017 06:05:15 -0800 (PST) Received: from localhost ([::1]:46825 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMgI-0000kj-RT for importer@patchew.org; Thu, 16 Feb 2017 09:05:10 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38659) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMQr-0001yn-2U for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:49:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ceMQm-0005RT-5w for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:49:13 -0500 Received: from 5.mo173.mail-out.ovh.net ([46.105.40.148]:33140) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ceMQl-0005QE-Vo for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:49:08 -0500 Received: from player791.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo173.mail-out.ovh.net (Postfix) with ESMTP id 7A4F023549 for ; Thu, 16 Feb 2017 14:49:06 +0100 (CET) Received: from zorba.kaod.org.com (LFbn-1-10647-27.w90-89.abo.wanadoo.fr [90.89.233.27]) (Authenticated sender: clg@kaod.org) by player791.ha.ovh.net (Postfix) with ESMTPSA id BEBEB42008D; Thu, 16 Feb 2017 14:48:59 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Thu, 16 Feb 2017 14:47:32 +0100 Message-Id: <1487252865-12064-10-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487252865-12064-1-git-send-email-clg@kaod.org> References: <1487252865-12064-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 12524792039277366246 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrtdeggdehgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 46.105.40.148 Subject: [Qemu-devel] [PATCH v2 09/22] ppc/xics: remove xics_find_source() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" It is not used anymore now that we have the QOM interface for XICS. Signed-off-by: C=C3=A9dric Le Goater Reviewed-by: David Gibson --- hw/intc/xics.c | 12 ------------ include/hw/ppc/xics.h | 1 - 2 files changed, 13 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 2decb921e4e3..bfd3a539561a 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -737,18 +737,6 @@ static const TypeInfo xics_interface_info =3D { /* * Exported functions */ -ICSState *xics_find_source(XICSState *xics, int irq) -{ - ICSState *ics; - - QLIST_FOREACH(ics, &xics->ics, list) { - if (ics_valid_irq(ics, irq)) { - return ics; - } - } - return NULL; -} - qemu_irq xics_get_qirq(XICSInterface *xi, int irq) { XICSInterfaceClass *xic =3D XICS_INTERFACE_GET_CLASS(xi); diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index 896fa5d87c1c..e10426e98e31 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -222,7 +222,6 @@ void ics_simple_write_xive(ICSState *ics, int nr, int s= erver, =20 void ics_set_irq_type(ICSState *ics, int srcno, bool lsi); =20 -ICSState *xics_find_source(XICSState *icp, int irq); void ics_resend(ICSState *ics); =20 #endif /* XICS_H */ --=20 2.7.4 From nobody Thu May 2 04:10:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487253688113514.2611006621296; Thu, 16 Feb 2017 06:01:28 -0800 (PST) Received: from localhost ([::1]:46805 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMce-0005EP-2d for importer@patchew.org; Thu, 16 Feb 2017 09:01:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38749) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMQw-00023X-KN for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:49:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ceMQs-0005Vw-7M for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:49:18 -0500 Received: from 8.mo173.mail-out.ovh.net ([46.105.46.122]:46966) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ceMQs-0005UZ-1e for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:49:14 -0500 Received: from player791.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo173.mail-out.ovh.net (Postfix) with ESMTP id EF4772403D for ; Thu, 16 Feb 2017 14:49:12 +0100 (CET) Received: from zorba.kaod.org.com (LFbn-1-10647-27.w90-89.abo.wanadoo.fr [90.89.233.27]) (Authenticated sender: clg@kaod.org) by player791.ha.ovh.net (Postfix) with ESMTPSA id B921542008D; Thu, 16 Feb 2017 14:49:05 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Thu, 16 Feb 2017 14:47:33 +0100 Message-Id: <1487252865-12064-11-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487252865-12064-1-git-send-email-clg@kaod.org> References: <1487252865-12064-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 12526480891207715814 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrtdeggdehgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 46.105.46.122 Subject: [Qemu-devel] [PATCH v2 10/22] ppc/xics: register the reset handler of ICS objects X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The reset of the ICS objects is currently handled by XICS but this can be done for each individual ICS. This also reduces the use of the XICS list of ICS. Signed-off-by: C=C3=A9dric Le Goater Reviewed-by: David Gibson --- hw/intc/xics.c | 5 ----- hw/ppc/spapr.c | 1 + 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index bfd3a539561a..d679313cd49f 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -139,16 +139,11 @@ static void ics_simple_pic_print_info(InterruptStatsP= rovider *obj, static void xics_common_reset(DeviceState *d) { XICSState *xics =3D XICS_COMMON(d); - ICSState *ics; int i; =20 for (i =3D 0; i < xics->nr_servers; i++) { device_reset(DEVICE(&xics->ss[i])); } - - QLIST_FOREACH(ics, &xics->ics, list) { - device_reset(DEVICE(ics)); - } } =20 static void xics_common_initfn(Object *obj) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 85a973cce7ae..a2a64d7de41d 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -112,6 +112,7 @@ static XICSState *try_create_xics(sPAPRMachineState *sp= apr, } =20 spapr->ics =3D ICS_SIMPLE(object_new(type_ics)); + qdev_set_parent_bus(DEVICE(spapr->ics), sysbus_get_default()); object_property_add_child(OBJECT(spapr), "ics", OBJECT(spapr->ics), NU= LL); object_property_set_int(OBJECT(spapr->ics), nr_irqs, "nr-irqs", &err); object_property_add_const_link(OBJECT(spapr->ics), "xics", OBJECT(xics= ), --=20 2.7.4 From nobody Thu May 2 04:10:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487254041741389.20884920442177; Thu, 16 Feb 2017 06:07:21 -0800 (PST) Received: from localhost ([::1]:46839 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMiM-0002Sw-A2 for importer@patchew.org; Thu, 16 Feb 2017 09:07:18 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38929) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMR1-000286-1J for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:49:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ceMQw-0005Zs-J6 for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:49:23 -0500 Received: from 3.mo173.mail-out.ovh.net ([46.105.34.1]:46952) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ceMQw-0005Ye-CN for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:49:18 -0500 Received: from player791.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo173.mail-out.ovh.net (Postfix) with ESMTP id DA8A6241B2 for ; Thu, 16 Feb 2017 14:49:16 +0100 (CET) Received: from zorba.kaod.org.com (LFbn-1-10647-27.w90-89.abo.wanadoo.fr [90.89.233.27]) (Authenticated sender: clg@kaod.org) by player791.ha.ovh.net (Postfix) with ESMTPSA id A8B2C42006F; Thu, 16 Feb 2017 14:49:11 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Thu, 16 Feb 2017 14:47:34 +0100 Message-Id: <1487252865-12064-12-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487252865-12064-1-git-send-email-clg@kaod.org> References: <1487252865-12064-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 12527888266097363942 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrtdeggdehgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 46.105.34.1 Subject: [Qemu-devel] [PATCH v2 11/22] ppc/xics: remove the XICS list of ICS X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This is not used anymore. Signed-off-by: C=C3=A9dric Le Goater Reviewed-by: David Gibson --- hw/intc/xics.c | 8 -------- hw/ppc/spapr.c | 1 - include/hw/ppc/xics.h | 2 -- 3 files changed, 11 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index d679313cd49f..5131587ce088 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -146,13 +146,6 @@ static void xics_common_reset(DeviceState *d) } } =20 -static void xics_common_initfn(Object *obj) -{ - XICSState *xics =3D XICS_COMMON(obj); - - QLIST_INIT(&xics->ics); -} - static void xics_common_class_init(ObjectClass *oc, void *data) { DeviceClass *dc =3D DEVICE_CLASS(oc); @@ -165,7 +158,6 @@ static const TypeInfo xics_common_info =3D { .parent =3D TYPE_DEVICE, .instance_size =3D sizeof(XICSState), .class_size =3D sizeof(XICSStateClass), - .instance_init =3D xics_common_initfn, .class_init =3D xics_common_class_init, }; =20 diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index a2a64d7de41d..d1946ebcac69 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -122,7 +122,6 @@ static XICSState *try_create_xics(sPAPRMachineState *sp= apr, if (err) { goto error; } - QLIST_INSERT_HEAD(&xics->ics, spapr->ics, list); =20 xics->ss =3D g_malloc0(nr_servers * sizeof(ICPState)); xics->nr_servers =3D nr_servers; diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index e10426e98e31..c15d8e2a8ae6 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -82,7 +82,6 @@ struct XICSState { /*< public >*/ uint32_t nr_servers; ICPState *ss; - QLIST_HEAD(, ICSState) ics; }; =20 #define TYPE_ICP "icp" @@ -152,7 +151,6 @@ struct ICSState { qemu_irq *qirqs; ICSIRQState *irqs; XICSState *xics; - QLIST_ENTRY(ICSState) list; }; =20 static inline bool ics_valid_irq(ICSState *ics, uint32_t nr) --=20 2.7.4 From nobody Thu May 2 04:10:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487253645160257.97525666048637; Thu, 16 Feb 2017 06:00:45 -0800 (PST) Received: from localhost ([::1]:46799 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMbz-0004ez-Jw for importer@patchew.org; Thu, 16 Feb 2017 09:00:43 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39044) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMR6-0002DY-W3 for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:49:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ceMR2-0005gX-K9 for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:49:29 -0500 Received: from 2.mo173.mail-out.ovh.net ([178.33.251.49]:45070) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ceMR2-0005fZ-DW for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:49:24 -0500 Received: from player791.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo173.mail-out.ovh.net (Postfix) with ESMTP id C9746241B5 for ; Thu, 16 Feb 2017 14:49:22 +0100 (CET) Received: from zorba.kaod.org.com (LFbn-1-10647-27.w90-89.abo.wanadoo.fr [90.89.233.27]) (Authenticated sender: clg@kaod.org) by player791.ha.ovh.net (Postfix) with ESMTPSA id C6E1C42009B; Thu, 16 Feb 2017 14:49:16 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Thu, 16 Feb 2017 14:47:35 +0100 Message-Id: <1487252865-12064-13-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487252865-12064-1-git-send-email-clg@kaod.org> References: <1487252865-12064-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 12529577116007304166 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrtdeggdehgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 178.33.251.49 Subject: [Qemu-devel] [PATCH v2 12/22] ppc/xics: extend the QOM interface to handle ICPs X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Let's add two new handlers for ICPs. One is to get an ICP object from a server number and a second is to resend the irqs when needed. Signed-off-by: C=C3=A9dric Le Goater --- hw/intc/xics.c | 2 +- hw/ppc/spapr.c | 20 ++++++++++++++++++++ include/hw/ppc/xics.h | 3 +++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 5131587ce088..7168c2cfd8a1 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -216,7 +216,7 @@ static void icp_check_ipi(ICPState *ss) qemu_irq_raise(ss->output); } =20 -static void icp_resend(XICSInterface *xi, ICPState *ss) +void icp_resend(XICSInterface *xi, ICPState *ss) { XICSInterfaceClass *xic =3D XICS_INTERFACE_GET_CLASS(xi); =20 diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index d1946ebcac69..eb7da32296d8 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2915,6 +2915,24 @@ static void spapr_ics_resend(XICSInterface *dev) ics_resend(spapr->ics); } =20 +static ICPState *spapr_icp_get(XICSInterface *xi, int server) +{ + sPAPRMachineState *spapr =3D SPAPR_MACHINE(xi); + + return (server < spapr->xics->nr_servers) ? &spapr->xics->ss[server] : + NULL; +} + +static void spapr_icp_resend(XICSInterface *xi) +{ + sPAPRMachineState *spapr =3D SPAPR_MACHINE(xi); + int i; + + for (i =3D 0; i < spapr->xics->nr_servers; i++) { + icp_resend(xi, &spapr->xics->ss[i]); + } +} + static void spapr_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc =3D MACHINE_CLASS(oc); @@ -2959,6 +2977,8 @@ static void spapr_machine_class_init(ObjectClass *oc,= void *data) vhc->hypercall =3D emulate_spapr_hypercall; xic->ics_get =3D spapr_ics_get; xic->ics_resend =3D spapr_ics_resend; + xic->icp_get =3D spapr_icp_get; + xic->icp_resend =3D spapr_icp_resend; } =20 static const TypeInfo spapr_machine_info =3D { diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index c15d8e2a8ae6..7004c851e250 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -191,6 +191,8 @@ typedef struct XICSInterfaceClass { InterfaceClass parent; ICSState *(*ics_get)(XICSInterface *xi, int irq); void (*ics_resend)(XICSInterface *xi); + ICPState *(*icp_get)(XICSInterface *xi, int server); + void (*icp_resend)(XICSInterface *xi); } XICSInterfaceClass; =20 #define XICS_IRQS_SPAPR 1024 @@ -221,5 +223,6 @@ void ics_simple_write_xive(ICSState *ics, int nr, int s= erver, void ics_set_irq_type(ICSState *ics, int srcno, bool lsi); =20 void ics_resend(ICSState *ics); +void icp_resend(XICSInterface *xi, ICPState *ss); =20 #endif /* XICS_H */ --=20 2.7.4 From nobody Thu May 2 04:10:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487253937344748.304994303383; Thu, 16 Feb 2017 06:05:37 -0800 (PST) Received: from localhost ([::1]:46827 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMgd-0000zs-VG for importer@patchew.org; Thu, 16 Feb 2017 09:05:32 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39087) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMRH-0002NM-9L for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:49:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ceMRC-0005i2-EC for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:49:39 -0500 Received: from 5.mo173.mail-out.ovh.net ([46.105.40.148]:44431) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ceMRC-0005hq-6m for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:49:34 -0500 Received: from player791.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo173.mail-out.ovh.net (Postfix) with ESMTP id 03766241CE for ; Thu, 16 Feb 2017 14:49:32 +0100 (CET) Received: from zorba.kaod.org.com (LFbn-1-10647-27.w90-89.abo.wanadoo.fr [90.89.233.27]) (Authenticated sender: clg@kaod.org) by player791.ha.ovh.net (Postfix) with ESMTPSA id B87CA42006F; Thu, 16 Feb 2017 14:49:22 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Thu, 16 Feb 2017 14:47:36 +0100 Message-Id: <1487252865-12064-14-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487252865-12064-1-git-send-email-clg@kaod.org> References: <1487252865-12064-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 12531547440837528550 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrtdeggdehgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 46.105.40.148 Subject: [Qemu-devel] [PATCH v2 13/22] ppc/xics: simplify the cpu_setup() handler X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The cpu_setup() handler currently takes a 'XICSState *' argument to grab the kernel ICP file descriptor. This interface can be simplified by using the 'xics' backlink of the ICP object. This change is also required by subsequent patches which makes use of the QOM interface for XICS. Signed-off-by: C=C3=A9dric Le Goater --- hw/intc/xics.c | 5 +++-- hw/intc/xics_kvm.c | 11 +++-------- include/hw/ppc/xics.h | 2 +- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 7168c2cfd8a1..c14797fb1964 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -66,14 +66,15 @@ void xics_cpu_setup(XICSState *xics, PowerPCCPU *cpu) CPUState *cs =3D CPU(cpu); CPUPPCState *env =3D &cpu->env; ICPState *ss =3D &xics->ss[cs->cpu_index]; - XICSStateClass *info =3D XICS_COMMON_GET_CLASS(xics); + XICSStateClass *info; =20 assert(cs->cpu_index < xics->nr_servers); =20 ss->cs =3D cs; =20 + info =3D XICS_COMMON_GET_CLASS(ss->xics); if (info->cpu_setup) { - info->cpu_setup(xics, cpu); + info->cpu_setup(ss, cpu); } =20 switch (PPC_INPUT(env)) { diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c index 6cabc11f6be1..3941f31c5b3f 100644 --- a/hw/intc/xics_kvm.c +++ b/hw/intc/xics_kvm.c @@ -334,17 +334,12 @@ static const TypeInfo ics_kvm_info =3D { /* * XICS-KVM */ -static void xics_kvm_cpu_setup(XICSState *xics, PowerPCCPU *cpu) +static void xics_kvm_cpu_setup(ICPState *ss, PowerPCCPU *cpu) { - CPUState *cs; - ICPState *ss; - KVMXICSState *xicskvm =3D XICS_SPAPR_KVM(xics); + CPUState *cs =3D CPU(cpu); + KVMXICSState *xicskvm =3D XICS_SPAPR_KVM(ss->xics); int ret; =20 - cs =3D CPU(cpu); - ss =3D &xics->ss[cs->cpu_index]; - - assert(cs->cpu_index < xics->nr_servers); if (xicskvm->kernel_xics_fd =3D=3D -1) { abort(); } diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index 7004c851e250..0375d7d481ef 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -73,7 +73,7 @@ typedef struct ICSIRQState ICSIRQState; struct XICSStateClass { DeviceClass parent_class; =20 - void (*cpu_setup)(XICSState *icp, PowerPCCPU *cpu); + void (*cpu_setup)(ICPState *icp, PowerPCCPU *cpu); }; =20 struct XICSState { --=20 2.7.4 From nobody Thu May 2 04:10:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487254209845121.56657788400389; Thu, 16 Feb 2017 06:10:09 -0800 (PST) Received: from localhost ([::1]:46852 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMl4-0005Qy-JP for importer@patchew.org; Thu, 16 Feb 2017 09:10:06 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39127) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMRM-0002SS-HM for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:49:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ceMRI-0005in-1m for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:49:44 -0500 Received: from 10.mo173.mail-out.ovh.net ([46.105.74.148]:41053) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ceMRH-0005iU-OS for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:49:39 -0500 Received: from player791.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo173.mail-out.ovh.net (Postfix) with ESMTP id A4A5824167 for ; Thu, 16 Feb 2017 14:49:37 +0100 (CET) Received: from zorba.kaod.org.com (LFbn-1-10647-27.w90-89.abo.wanadoo.fr [90.89.233.27]) (Authenticated sender: clg@kaod.org) by player791.ha.ovh.net (Postfix) with ESMTPSA id AF963420086; Thu, 16 Feb 2017 14:49:29 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Thu, 16 Feb 2017 14:47:37 +0100 Message-Id: <1487252865-12064-15-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487252865-12064-1-git-send-email-clg@kaod.org> References: <1487252865-12064-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 12533799240797490150 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrtdeggdehgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 46.105.74.148 Subject: [Qemu-devel] [PATCH v2 14/22] ppc/xics: use the QOM interface to grab an ICP X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Also introduce a xics_icp_get() helper to simplify the changes. Signed-off-by: C=C3=A9dric Le Goater --- hw/intc/xics.c | 31 ++++++++++++++++++------------- hw/intc/xics_spapr.c | 17 +++++++++-------- hw/ppc/spapr_cpu_core.c | 4 ++-- include/hw/ppc/xics.h | 8 ++++---- 4 files changed, 33 insertions(+), 27 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index c14797fb1964..dd41340d41a5 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -49,26 +49,26 @@ int xics_get_cpu_index_by_dt_id(int cpu_dt_id) return -1; } =20 -void xics_cpu_destroy(XICSState *xics, PowerPCCPU *cpu) +void xics_cpu_destroy(XICSInterface *xi, PowerPCCPU *cpu) { CPUState *cs =3D CPU(cpu); - ICPState *ss =3D &xics->ss[cs->cpu_index]; + ICPState *ss =3D xics_icp_get(xi, cs->cpu_index); =20 - assert(cs->cpu_index < xics->nr_servers); + assert(ss); assert(cs =3D=3D ss->cs); =20 ss->output =3D NULL; ss->cs =3D NULL; } =20 -void xics_cpu_setup(XICSState *xics, PowerPCCPU *cpu) +void xics_cpu_setup(XICSInterface *xi, PowerPCCPU *cpu) { CPUState *cs =3D CPU(cpu); CPUPPCState *env =3D &cpu->env; - ICPState *ss =3D &xics->ss[cs->cpu_index]; + ICPState *ss =3D xics_icp_get(xi, cs->cpu_index); XICSStateClass *info; =20 - assert(cs->cpu_index < xics->nr_servers); + assert(ss); =20 ss->cs =3D cs; =20 @@ -307,8 +307,9 @@ void icp_eoi(ICPState *ss, uint32_t xirr) =20 static void icp_irq(ICSState *ics, int server, int nr, uint8_t priority) { - XICSState *xics =3D ics->xics; - ICPState *ss =3D xics->ss + server; + XICSInterface *xi =3D XICS_INTERFACE(qdev_get_machine()); + XICSInterfaceClass *xic =3D XICS_INTERFACE_GET_CLASS(xi); + ICPState *ss =3D xic->icp_get(xi, server); =20 trace_xics_icp_irq(server, nr, priority); =20 @@ -582,12 +583,9 @@ static void ics_simple_reset(DeviceState *dev) static int ics_simple_post_load(ICSState *ics, int version_id) { XICSInterface *xi =3D XICS_INTERFACE(qdev_get_machine()); - int i; - - for (i =3D 0; i < ics->xics->nr_servers; i++) { - icp_resend(xi, &ics->xics->ss[i]); - } + XICSInterfaceClass *xic =3D XICS_INTERFACE_GET_CLASS(xi); =20 + xic->icp_resend(xi); return 0; } =20 @@ -737,6 +735,13 @@ qemu_irq xics_get_qirq(XICSInterface *xi, int irq) return NULL; } =20 +ICPState *xics_icp_get(XICSInterface *xi, int server) +{ + XICSInterfaceClass *xic =3D XICS_INTERFACE_GET_CLASS(xi); + + return xic->icp_get(xi, server); +} + void ics_set_irq_type(ICSState *ics, int srcno, bool lsi) { assert(!(ics->irqs[srcno].flags & XICS_FLAGS_IRQ_MASK)); diff --git a/hw/intc/xics_spapr.c b/hw/intc/xics_spapr.c index 1501e796e5e0..a837ca655f87 100644 --- a/hw/intc/xics_spapr.c +++ b/hw/intc/xics_spapr.c @@ -44,7 +44,7 @@ static target_ulong h_cppr(PowerPCCPU *cpu, sPAPRMachineS= tate *spapr, target_ulong opcode, target_ulong *args) { CPUState *cs =3D CPU(cpu); - ICPState *icp =3D &spapr->xics->ss[cs->cpu_index]; + ICPState *icp =3D xics_icp_get(XICS_INTERFACE(spapr), cs->cpu_index); target_ulong cppr =3D args[0]; =20 icp_set_cppr(icp, cppr); @@ -56,12 +56,13 @@ static target_ulong h_ipi(PowerPCCPU *cpu, sPAPRMachine= State *spapr, { target_ulong server =3D xics_get_cpu_index_by_dt_id(args[0]); target_ulong mfrr =3D args[1]; + ICPState *icp =3D xics_icp_get(XICS_INTERFACE(spapr), server); =20 - if (server >=3D spapr->xics->nr_servers) { + if (!icp) { return H_PARAMETER; } =20 - icp_set_mfrr(spapr->xics->ss + server, mfrr); + icp_set_mfrr(icp, mfrr); return H_SUCCESS; } =20 @@ -69,7 +70,7 @@ static target_ulong h_xirr(PowerPCCPU *cpu, sPAPRMachineS= tate *spapr, target_ulong opcode, target_ulong *args) { CPUState *cs =3D CPU(cpu); - ICPState *icp =3D &spapr->xics->ss[cs->cpu_index]; + ICPState *icp =3D xics_icp_get(XICS_INTERFACE(spapr), cs->cpu_index); uint32_t xirr =3D icp_accept(icp); =20 args[0] =3D xirr; @@ -80,7 +81,7 @@ static target_ulong h_xirr_x(PowerPCCPU *cpu, sPAPRMachin= eState *spapr, target_ulong opcode, target_ulong *args) { CPUState *cs =3D CPU(cpu); - ICPState *icp =3D &spapr->xics->ss[cs->cpu_index]; + ICPState *icp =3D xics_icp_get(XICS_INTERFACE(spapr), cs->cpu_index); uint32_t xirr =3D icp_accept(icp); =20 args[0] =3D xirr; @@ -92,7 +93,7 @@ static target_ulong h_eoi(PowerPCCPU *cpu, sPAPRMachineSt= ate *spapr, target_ulong opcode, target_ulong *args) { CPUState *cs =3D CPU(cpu); - ICPState *icp =3D &spapr->xics->ss[cs->cpu_index]; + ICPState *icp =3D xics_icp_get(XICS_INTERFACE(spapr), cs->cpu_index); target_ulong xirr =3D args[0]; =20 icp_eoi(icp, xirr); @@ -103,7 +104,7 @@ static target_ulong h_ipoll(PowerPCCPU *cpu, sPAPRMachi= neState *spapr, target_ulong opcode, target_ulong *args) { CPUState *cs =3D CPU(cpu); - ICPState *icp =3D &spapr->xics->ss[cs->cpu_index]; + ICPState *icp =3D xics_icp_get(XICS_INTERFACE(spapr), cs->cpu_index); uint32_t mfrr; uint32_t xirr =3D icp_ipoll(icp, &mfrr); =20 @@ -134,7 +135,7 @@ static void rtas_set_xive(PowerPCCPU *cpu, sPAPRMachine= State *spapr, server =3D xics_get_cpu_index_by_dt_id(rtas_ld(args, 1)); priority =3D rtas_ld(args, 2); =20 - if (!ics_valid_irq(ics, nr) || (server >=3D ics->xics->nr_servers) + if (!ics_valid_irq(ics, nr) || !xics_icp_get(XICS_INTERFACE(spapr), se= rver) || (priority > 0xff)) { rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR); return; diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c index 55cd0456ebe8..2c289a6c72e2 100644 --- a/hw/ppc/spapr_cpu_core.c +++ b/hw/ppc/spapr_cpu_core.c @@ -42,7 +42,7 @@ static void spapr_cpu_destroy(PowerPCCPU *cpu) { sPAPRMachineState *spapr =3D SPAPR_MACHINE(qdev_get_machine()); =20 - xics_cpu_destroy(spapr->xics, cpu); + xics_cpu_destroy(XICS_INTERFACE(spapr), cpu); qemu_unregister_reset(spapr_cpu_reset, cpu); } =20 @@ -76,7 +76,7 @@ static void spapr_cpu_init(sPAPRMachineState *spapr, Powe= rPCCPU *cpu, cs->numa_node =3D i; } =20 - xics_cpu_setup(spapr->xics, cpu); + xics_cpu_setup(XICS_INTERFACE(spapr), cpu); =20 qemu_register_reset(spapr_cpu_reset, cpu); spapr_cpu_reset(cpu); diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index 0375d7d481ef..498f187c0dd2 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -197,16 +197,16 @@ typedef struct XICSInterfaceClass { =20 #define XICS_IRQS_SPAPR 1024 =20 -qemu_irq xics_get_qirq(XICSInterface *xi, int irq); - int spapr_ics_alloc(ICSState *ics, int irq_hint, bool lsi, Error **errp); int spapr_ics_alloc_block(ICSState *ics, int num, bool lsi, bool align, Error **errp); void spapr_ics_free(ICSState *ics, int irq, int num); void spapr_dt_xics(XICSState *xics, void *fdt, uint32_t phandle); =20 -void xics_cpu_setup(XICSState *icp, PowerPCCPU *cpu); -void xics_cpu_destroy(XICSState *icp, PowerPCCPU *cpu); +qemu_irq xics_get_qirq(XICSInterface *xi, int irq); +ICPState *xics_icp_get(XICSInterface *xi, int server); +void xics_cpu_setup(XICSInterface *xi, PowerPCCPU *cpu); +void xics_cpu_destroy(XICSInterface *xi, PowerPCCPU *cpu); =20 /* Internal XICS interfaces */ int xics_get_cpu_index_by_dt_id(int cpu_dt_id); --=20 2.7.4 From nobody Thu May 2 04:10:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 14872542091221017.5924919183587; Thu, 16 Feb 2017 06:10:09 -0800 (PST) Received: from localhost ([::1]:46851 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMl2-0005QH-Ry for importer@patchew.org; Thu, 16 Feb 2017 09:10:04 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39199) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMRU-0002ZK-15 for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:49:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ceMRP-0005l2-6L for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:49:52 -0500 Received: from mo173.mail-out.ovh.net ([178.32.228.173]:45164) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ceMRO-0005kO-VI for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:49:47 -0500 Received: from player791.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo173.mail-out.ovh.net (Postfix) with ESMTP id BD08824167 for ; Thu, 16 Feb 2017 14:49:45 +0100 (CET) Received: from zorba.kaod.org.com (LFbn-1-10647-27.w90-89.abo.wanadoo.fr [90.89.233.27]) (Authenticated sender: clg@kaod.org) by player791.ha.ovh.net (Postfix) with ESMTPSA id 5C803420086; Thu, 16 Feb 2017 14:49:37 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Thu, 16 Feb 2017 14:47:38 +0100 Message-Id: <1487252865-12064-16-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487252865-12064-1-git-send-email-clg@kaod.org> References: <1487252865-12064-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 12536051041422576614 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrtdeggdehgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 178.32.228.173 Subject: [Qemu-devel] [PATCH v2 15/22] ppc/xics: simplify spapr_dt_xics() interface X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" spapr_dt_xics() only needs the number of servers to build the device tree nodes. Let's change the routine interface to reflect that. Signed-off-by: C=C3=A9dric Le Goater --- hw/intc/xics_spapr.c | 4 ++-- hw/ppc/spapr.c | 2 +- include/hw/ppc/xics.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/intc/xics_spapr.c b/hw/intc/xics_spapr.c index a837ca655f87..cb6325ee64fd 100644 --- a/hw/intc/xics_spapr.c +++ b/hw/intc/xics_spapr.c @@ -387,10 +387,10 @@ void spapr_ics_free(ICSState *ics, int irq, int num) } } =20 -void spapr_dt_xics(XICSState *xics, void *fdt, uint32_t phandle) +void spapr_dt_xics(int nr_servers, void *fdt, uint32_t phandle) { uint32_t interrupt_server_ranges_prop[] =3D { - 0, cpu_to_be32(xics->nr_servers), + 0, cpu_to_be32(nr_servers), }; int node; =20 diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index eb7da32296d8..9c1772f93155 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -964,7 +964,7 @@ static void *spapr_build_fdt(sPAPRMachineState *spapr, _FDT(fdt_setprop_cell(fdt, 0, "#size-cells", 2)); =20 /* /interrupt controller */ - spapr_dt_xics(spapr->xics, fdt, PHANDLE_XICP); + spapr_dt_xics(spapr->xics->nr_servers, fdt, PHANDLE_XICP); =20 ret =3D spapr_populate_memory(spapr, fdt); if (ret < 0) { diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index 498f187c0dd2..e320a4c91bb1 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -201,7 +201,7 @@ int spapr_ics_alloc(ICSState *ics, int irq_hint, bool l= si, Error **errp); int spapr_ics_alloc_block(ICSState *ics, int num, bool lsi, bool align, Error **errp); void spapr_ics_free(ICSState *ics, int irq, int num); -void spapr_dt_xics(XICSState *xics, void *fdt, uint32_t phandle); +void spapr_dt_xics(int nr_servers, void *fdt, uint32_t phandle); =20 qemu_irq xics_get_qirq(XICSInterface *xi, int irq); ICPState *xics_icp_get(XICSInterface *xi, int server); --=20 2.7.4 From nobody Thu May 2 04:10:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487254463347649.1425239788515; Thu, 16 Feb 2017 06:14:23 -0800 (PST) Received: from localhost ([::1]:46887 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMpA-0001zr-4d for importer@patchew.org; Thu, 16 Feb 2017 09:14:20 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39485) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMRa-0002eG-U4 for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:50:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ceMRY-0005wN-H7 for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:49:58 -0500 Received: from 1.mo173.mail-out.ovh.net ([178.33.111.180]:60062) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ceMRY-0005tg-5o for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:49:56 -0500 Received: from player791.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo173.mail-out.ovh.net (Postfix) with ESMTP id F2D3F241ED for ; Thu, 16 Feb 2017 14:49:54 +0100 (CET) Received: from zorba.kaod.org.com (LFbn-1-10647-27.w90-89.abo.wanadoo.fr [90.89.233.27]) (Authenticated sender: clg@kaod.org) by player791.ha.ovh.net (Postfix) with ESMTPSA id A959942006F; Thu, 16 Feb 2017 14:49:45 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Thu, 16 Feb 2017 14:47:39 +0100 Message-Id: <1487252865-12064-17-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487252865-12064-1-git-send-email-clg@kaod.org> References: <1487252865-12064-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 12538584315578387430 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrtdeggdehgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 178.33.111.180 Subject: [Qemu-devel] [PATCH v2 16/22] ppc/xics: register the reset handler of ICP objects X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The reset of the ICP objects is currently handled by XICS but this can be done for each individual ICP. Signed-off-by: C=C3=A9dric Le Goater --- hw/intc/xics.c | 18 ------------------ hw/ppc/spapr.c | 1 + 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index dd41340d41a5..3ad7e8cf8ec4 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -137,29 +137,11 @@ static void ics_simple_pic_print_info(InterruptStatsP= rovider *obj, /* * XICS Common class - parent for emulated XICS and KVM-XICS */ -static void xics_common_reset(DeviceState *d) -{ - XICSState *xics =3D XICS_COMMON(d); - int i; - - for (i =3D 0; i < xics->nr_servers; i++) { - device_reset(DEVICE(&xics->ss[i])); - } -} - -static void xics_common_class_init(ObjectClass *oc, void *data) -{ - DeviceClass *dc =3D DEVICE_CLASS(oc); - - dc->reset =3D xics_common_reset; -} - static const TypeInfo xics_common_info =3D { .name =3D TYPE_XICS_COMMON, .parent =3D TYPE_DEVICE, .instance_size =3D sizeof(XICSState), .class_size =3D sizeof(XICSStateClass), - .class_init =3D xics_common_class_init, }; =20 /* diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 9c1772f93155..445d9a6ddad4 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -130,6 +130,7 @@ static XICSState *try_create_xics(sPAPRMachineState *sp= apr, ICPState *icp =3D &xics->ss[i]; =20 object_initialize(icp, sizeof(*icp), type_icp); + qdev_set_parent_bus(DEVICE(icp), sysbus_get_default()); object_property_add_child(OBJECT(xics), "icp[*]", OBJECT(icp), NUL= L); object_property_add_const_link(OBJECT(icp), "xics", OBJECT(xics), = NULL); object_property_set_bool(OBJECT(icp), true, "realized", &err); --=20 2.7.4 From nobody Thu May 2 04:10:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487254765446574.2822650684734; Thu, 16 Feb 2017 06:19:25 -0800 (PST) Received: from localhost ([::1]:46923 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMu0-0006D4-Ro for importer@patchew.org; Thu, 16 Feb 2017 09:19:20 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39858) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMRl-0002pR-0R for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:50:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ceMRf-00063N-5Z for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:50:09 -0500 Received: from 2.mo173.mail-out.ovh.net ([178.33.251.49]:44025) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ceMRe-00062z-Uw for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:50:03 -0500 Received: from player791.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo173.mail-out.ovh.net (Postfix) with ESMTP id BFCDD241FB for ; Thu, 16 Feb 2017 14:50:01 +0100 (CET) Received: from zorba.kaod.org.com (LFbn-1-10647-27.w90-89.abo.wanadoo.fr [90.89.233.27]) (Authenticated sender: clg@kaod.org) by player791.ha.ovh.net (Postfix) with ESMTPSA id AC65542006F; Thu, 16 Feb 2017 14:49:54 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Thu, 16 Feb 2017 14:47:40 +0100 Message-Id: <1487252865-12064-18-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487252865-12064-1-git-send-email-clg@kaod.org> References: <1487252865-12064-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 12540554637997149158 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrtdeggdehgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 178.33.251.49 Subject: [Qemu-devel] [PATCH v2 17/22] ppc/xics: move the ICP array under the sPAPR machine X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: C=C3=A9dric Le Goater --- hw/ppc/spapr.c | 17 ++++++++--------- include/hw/ppc/spapr.h | 3 +++ include/hw/ppc/xics.h | 2 -- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 445d9a6ddad4..6b35b48f818a 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -123,15 +123,15 @@ static XICSState *try_create_xics(sPAPRMachineState *= spapr, goto error; } =20 - xics->ss =3D g_malloc0(nr_servers * sizeof(ICPState)); - xics->nr_servers =3D nr_servers; + spapr->icps =3D g_malloc0(nr_servers * sizeof(ICPState)); + spapr->nr_servers =3D nr_servers; =20 for (i =3D 0; i < nr_servers; i++) { - ICPState *icp =3D &xics->ss[i]; + ICPState *icp =3D &spapr->icps[i]; =20 object_initialize(icp, sizeof(*icp), type_icp); qdev_set_parent_bus(DEVICE(icp), sysbus_get_default()); - object_property_add_child(OBJECT(xics), "icp[*]", OBJECT(icp), NUL= L); + object_property_add_child(OBJECT(spapr), "icp[*]", OBJECT(icp), NU= LL); object_property_add_const_link(OBJECT(icp), "xics", OBJECT(xics), = NULL); object_property_set_bool(OBJECT(icp), true, "realized", &err); if (err) { @@ -965,7 +965,7 @@ static void *spapr_build_fdt(sPAPRMachineState *spapr, _FDT(fdt_setprop_cell(fdt, 0, "#size-cells", 2)); =20 /* /interrupt controller */ - spapr_dt_xics(spapr->xics->nr_servers, fdt, PHANDLE_XICP); + spapr_dt_xics(spapr->nr_servers, fdt, PHANDLE_XICP); =20 ret =3D spapr_populate_memory(spapr, fdt); if (ret < 0) { @@ -2920,8 +2920,7 @@ static ICPState *spapr_icp_get(XICSInterface *xi, int= server) { sPAPRMachineState *spapr =3D SPAPR_MACHINE(xi); =20 - return (server < spapr->xics->nr_servers) ? &spapr->xics->ss[server] : - NULL; + return (server < spapr->nr_servers) ? &spapr->icps[server] : NULL; } =20 static void spapr_icp_resend(XICSInterface *xi) @@ -2929,8 +2928,8 @@ static void spapr_icp_resend(XICSInterface *xi) sPAPRMachineState *spapr =3D SPAPR_MACHINE(xi); int i; =20 - for (i =3D 0; i < spapr->xics->nr_servers; i++) { - icp_resend(xi, &spapr->xics->ss[i]); + for (i =3D 0; i < spapr->nr_servers; i++) { + icp_resend(xi, &spapr->icps[i]); } } =20 diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index 21e506b13cfa..f5bbb040f941 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -95,6 +95,9 @@ struct sPAPRMachineState { /*< public >*/ char *kvm_type; MemoryHotplugState hotplug_memory; + + uint32_t nr_servers; + ICPState *icps; }; =20 #define H_SUCCESS 0 diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index e320a4c91bb1..726492c948db 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -80,8 +80,6 @@ struct XICSState { /*< private >*/ SysBusDevice parent_obj; /*< public >*/ - uint32_t nr_servers; - ICPState *ss; }; =20 #define TYPE_ICP "icp" --=20 2.7.4 From nobody Thu May 2 04:10:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487253991606864.7883667967249; Thu, 16 Feb 2017 06:06:31 -0800 (PST) Received: from localhost ([::1]:46835 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMhX-0001nO-O7 for importer@patchew.org; Thu, 16 Feb 2017 09:06:27 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39932) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMRr-0002wY-5i for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:50:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ceMRm-0006B9-OT for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:50:15 -0500 Received: from 4.mo173.mail-out.ovh.net ([46.105.34.219]:51068) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ceMRm-0006AW-Ik for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:50:10 -0500 Received: from player791.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo173.mail-out.ovh.net (Postfix) with ESMTP id 2EBDB24207 for ; Thu, 16 Feb 2017 14:50:08 +0100 (CET) Received: from zorba.kaod.org.com (LFbn-1-10647-27.w90-89.abo.wanadoo.fr [90.89.233.27]) (Authenticated sender: clg@kaod.org) by player791.ha.ovh.net (Postfix) with ESMTPSA id ABB6A42006F; Thu, 16 Feb 2017 14:50:01 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Thu, 16 Feb 2017 14:47:41 +0100 Message-Id: <1487252865-12064-19-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487252865-12064-1-git-send-email-clg@kaod.org> References: <1487252865-12064-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 12542243490322811878 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrtdeggdehgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 46.105.34.219 Subject: [Qemu-devel] [PATCH v2 18/22] ppc/xics: move kernel_xics_fd out of KVMXICSState X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The kernel ICP file descriptor is the only reason behind the KVMXICSState class and it's in the way of more cleanups. Let's make it a static for the moment and move forward. If this is problem, we could use an attribute under the sPAPR machine later on. Signed-off-by: C=C3=A9dric Le Goater --- hw/intc/xics_kvm.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c index 3941f31c5b3f..19c55fa74412 100644 --- a/hw/intc/xics_kvm.c +++ b/hw/intc/xics_kvm.c @@ -40,6 +40,8 @@ =20 #include =20 +static int kernel_xics_fd =3D -1; + typedef struct KVMXICSState { XICSState parent_obj; =20 @@ -145,7 +147,6 @@ static const TypeInfo icp_kvm_info =3D { */ static void ics_get_kvm_state(ICSState *ics) { - KVMXICSState *xicskvm =3D XICS_SPAPR_KVM(ics->xics); uint64_t state; struct kvm_device_attr attr =3D { .flags =3D 0, @@ -160,7 +161,7 @@ static void ics_get_kvm_state(ICSState *ics) =20 attr.attr =3D i + ics->offset; =20 - ret =3D ioctl(xicskvm->kernel_xics_fd, KVM_GET_DEVICE_ATTR, &attr); + ret =3D ioctl(kernel_xics_fd, KVM_GET_DEVICE_ATTR, &attr); if (ret !=3D 0) { error_report("Unable to retrieve KVM interrupt controller stat= e" " for IRQ %d: %s", i + ics->offset, strerror(errno)); @@ -204,7 +205,6 @@ static void ics_get_kvm_state(ICSState *ics) =20 static int ics_set_kvm_state(ICSState *ics, int version_id) { - KVMXICSState *xicskvm =3D XICS_SPAPR_KVM(ics->xics); uint64_t state; struct kvm_device_attr attr =3D { .flags =3D 0, @@ -238,7 +238,7 @@ static int ics_set_kvm_state(ICSState *ics, int version= _id) } } =20 - ret =3D ioctl(xicskvm->kernel_xics_fd, KVM_SET_DEVICE_ATTR, &attr); + ret =3D ioctl(kernel_xics_fd, KVM_SET_DEVICE_ATTR, &attr); if (ret !=3D 0) { error_report("Unable to restore KVM interrupt controller state" " for IRQs %d: %s", i + ics->offset, strerror(errno)); @@ -337,10 +337,9 @@ static const TypeInfo ics_kvm_info =3D { static void xics_kvm_cpu_setup(ICPState *ss, PowerPCCPU *cpu) { CPUState *cs =3D CPU(cpu); - KVMXICSState *xicskvm =3D XICS_SPAPR_KVM(ss->xics); int ret; =20 - if (xicskvm->kernel_xics_fd =3D=3D -1) { + if (kernel_xics_fd =3D=3D -1) { abort(); } =20 @@ -353,7 +352,7 @@ static void xics_kvm_cpu_setup(ICPState *ss, PowerPCCPU= *cpu) return; } =20 - ret =3D kvm_vcpu_enable_cap(cs, KVM_CAP_IRQ_XICS, 0, xicskvm->kernel_x= ics_fd, + ret =3D kvm_vcpu_enable_cap(cs, KVM_CAP_IRQ_XICS, 0, kernel_xics_fd, kvm_arch_vcpu_id(cs)); if (ret < 0) { error_report("Unable to connect CPU%ld to kernel XICS: %s", @@ -374,7 +373,6 @@ static void rtas_dummy(PowerPCCPU *cpu, sPAPRMachineSta= te *spapr, =20 static void xics_kvm_realize(DeviceState *dev, Error **errp) { - KVMXICSState *xicskvm =3D XICS_SPAPR_KVM(dev); int rc; struct kvm_create_device xics_create_device =3D { .type =3D KVM_DEV_TYPE_XICS, @@ -423,7 +421,7 @@ static void xics_kvm_realize(DeviceState *dev, Error **= errp) goto fail; } =20 - xicskvm->kernel_xics_fd =3D xics_create_device.fd; + kernel_xics_fd =3D xics_create_device.fd; =20 kvm_kernel_irqchip =3D true; kvm_msi_via_irqfd_allowed =3D true; --=20 2.7.4 From nobody Thu May 2 04:10:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487254489054583.2190138415774; Thu, 16 Feb 2017 06:14:49 -0800 (PST) Received: from localhost ([::1]:46890 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMpa-0002M9-KO for importer@patchew.org; Thu, 16 Feb 2017 09:14:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39977) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMRu-00030P-DM for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:50:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ceMRt-0006Dy-8x for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:50:18 -0500 Received: from 9.mo173.mail-out.ovh.net ([46.105.72.44]:34849) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ceMRt-0006DO-2D for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:50:17 -0500 Received: from player791.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo173.mail-out.ovh.net (Postfix) with ESMTP id D75EE241B8 for ; Thu, 16 Feb 2017 14:50:15 +0100 (CET) Received: from zorba.kaod.org.com (LFbn-1-10647-27.w90-89.abo.wanadoo.fr [90.89.233.27]) (Authenticated sender: clg@kaod.org) by player791.ha.ovh.net (Postfix) with ESMTPSA id DA24F420086; Thu, 16 Feb 2017 14:50:07 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Thu, 16 Feb 2017 14:47:42 +0100 Message-Id: <1487252865-12064-20-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487252865-12064-1-git-send-email-clg@kaod.org> References: <1487252865-12064-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 12544495288200170470 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrtdeggdehgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 46.105.72.44 Subject: [Qemu-devel] [PATCH v2 19/22] ppc/xics: move the cpu_setup() handler under the ICPState class X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The cpu_setup() handler is currenlty under the XICSState class but it really belongs under ICPState as it is setting up a vCPU. It makes use of the kernel ICP file descriptor which could be a problem. Signed-off-by: C=C3=A9dric Le Goater --- hw/intc/xics.c | 8 +++---- hw/intc/xics_kvm.c | 58 +++++++++++++++++++++++++----------------------= ---- include/hw/ppc/xics.h | 3 +-- 3 files changed, 34 insertions(+), 35 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 3ad7e8cf8ec4..78e08e23e3d6 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -66,15 +66,15 @@ void xics_cpu_setup(XICSInterface *xi, PowerPCCPU *cpu) CPUState *cs =3D CPU(cpu); CPUPPCState *env =3D &cpu->env; ICPState *ss =3D xics_icp_get(xi, cs->cpu_index); - XICSStateClass *info; + ICPStateClass *icpc; =20 assert(ss); =20 ss->cs =3D cs; =20 - info =3D XICS_COMMON_GET_CLASS(ss->xics); - if (info->cpu_setup) { - info->cpu_setup(ss, cpu); + icpc =3D ICP_GET_CLASS(ss); + if (icpc->cpu_setup) { + icpc->cpu_setup(ss, cpu); } =20 switch (PPC_INPUT(env)) { diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c index 19c55fa74412..850777eab913 100644 --- a/hw/intc/xics_kvm.c +++ b/hw/intc/xics_kvm.c @@ -124,6 +124,34 @@ static void icp_kvm_reset(DeviceState *dev) icp_set_kvm_state(icp, 1); } =20 +static void icp_kvm_cpu_setup(ICPState *ss, PowerPCCPU *cpu) +{ + CPUState *cs =3D CPU(cpu); + int ret; + + if (kernel_xics_fd =3D=3D -1) { + abort(); + } + + /* + * If we are reusing a parked vCPU fd corresponding to the CPU + * which was hot-removed earlier we don't have to renable + * KVM_CAP_IRQ_XICS capability again. + */ + if (ss->cap_irq_xics_enabled) { + return; + } + + ret =3D kvm_vcpu_enable_cap(cs, KVM_CAP_IRQ_XICS, 0, kernel_xics_fd, + kvm_arch_vcpu_id(cs)); + if (ret < 0) { + error_report("Unable to connect CPU%ld to kernel XICS: %s", + kvm_arch_vcpu_id(cs), strerror(errno)); + exit(1); + } + ss->cap_irq_xics_enabled =3D true; +} + static void icp_kvm_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); @@ -132,6 +160,7 @@ static void icp_kvm_class_init(ObjectClass *klass, void= *data) dc->reset =3D icp_kvm_reset; icpc->pre_save =3D icp_get_kvm_state; icpc->post_load =3D icp_set_kvm_state; + icpc->cpu_setup =3D icp_kvm_cpu_setup; } =20 static const TypeInfo icp_kvm_info =3D { @@ -334,33 +363,6 @@ static const TypeInfo ics_kvm_info =3D { /* * XICS-KVM */ -static void xics_kvm_cpu_setup(ICPState *ss, PowerPCCPU *cpu) -{ - CPUState *cs =3D CPU(cpu); - int ret; - - if (kernel_xics_fd =3D=3D -1) { - abort(); - } - - /* - * If we are reusing a parked vCPU fd corresponding to the CPU - * which was hot-removed earlier we don't have to renable - * KVM_CAP_IRQ_XICS capability again. - */ - if (ss->cap_irq_xics_enabled) { - return; - } - - ret =3D kvm_vcpu_enable_cap(cs, KVM_CAP_IRQ_XICS, 0, kernel_xics_fd, - kvm_arch_vcpu_id(cs)); - if (ret < 0) { - error_report("Unable to connect CPU%ld to kernel XICS: %s", - kvm_arch_vcpu_id(cs), strerror(errno)); - exit(1); - } - ss->cap_irq_xics_enabled =3D true; -} =20 static void rtas_dummy(PowerPCCPU *cpu, sPAPRMachineState *spapr, uint32_t token, @@ -439,10 +441,8 @@ fail: static void xics_kvm_class_init(ObjectClass *oc, void *data) { DeviceClass *dc =3D DEVICE_CLASS(oc); - XICSStateClass *xsc =3D XICS_COMMON_CLASS(oc); =20 dc->realize =3D xics_kvm_realize; - xsc->cpu_setup =3D xics_kvm_cpu_setup; } =20 static const TypeInfo xics_spapr_kvm_info =3D { diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index 726492c948db..f7f89c1d18d7 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -72,8 +72,6 @@ typedef struct ICSIRQState ICSIRQState; =20 struct XICSStateClass { DeviceClass parent_class; - - void (*cpu_setup)(ICPState *icp, PowerPCCPU *cpu); }; =20 struct XICSState { @@ -98,6 +96,7 @@ struct ICPStateClass { =20 void (*pre_save)(ICPState *s); int (*post_load)(ICPState *s, int version_id); + void (*cpu_setup)(ICPState *icp, PowerPCCPU *cpu); }; =20 struct ICPState { --=20 2.7.4 From nobody Thu May 2 04:10:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487255056998883.5035786568512; Thu, 16 Feb 2017 06:24:16 -0800 (PST) Received: from localhost ([::1]:46970 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMyk-0003Yj-GT for importer@patchew.org; Thu, 16 Feb 2017 09:24:14 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40021) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMS4-00039D-R2 for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:50:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ceMRz-0006Fj-VM for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:50:28 -0500 Received: from mo173.mail-out.ovh.net ([178.32.228.173]:34155) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ceMRz-0006Fa-Pa for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:50:23 -0500 Received: from player791.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo173.mail-out.ovh.net (Postfix) with ESMTP id 9CD0D241B8 for ; Thu, 16 Feb 2017 14:50:22 +0100 (CET) Received: from zorba.kaod.org.com (LFbn-1-10647-27.w90-89.abo.wanadoo.fr [90.89.233.27]) (Authenticated sender: clg@kaod.org) by player791.ha.ovh.net (Postfix) with ESMTPSA id D2F52420092; Thu, 16 Feb 2017 14:50:15 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Thu, 16 Feb 2017 14:47:43 +0100 Message-Id: <1487252865-12064-21-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487252865-12064-1-git-send-email-clg@kaod.org> References: <1487252865-12064-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 12546465614580911078 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrtdeggdehgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 178.32.228.173 Subject: [Qemu-devel] [PATCH v2 20/22] ppc/xics: remove the 'xics' backlinks X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" These are not used anymore. Do the cleanups Signed-off-by: C=C3=A9dric Le Goater --- hw/intc/xics.c | 28 ---------------------------- hw/intc/xics_kvm.c | 10 ---------- hw/ppc/spapr.c | 3 --- include/hw/ppc/xics.h | 3 --- 4 files changed, 44 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 78e08e23e3d6..eb1a9f12fd3a 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -360,23 +360,6 @@ static void icp_reset(DeviceState *dev) qemu_set_irq(icp->output, 0); } =20 -static void icp_realize(DeviceState *dev, Error **errp) -{ - ICPState *icp =3D ICP(dev); - Object *obj; - Error *err =3D NULL; - - obj =3D object_property_get_link(OBJECT(dev), "xics", &err); - if (!obj) { - error_setg(errp, "%s: required link 'xics' not found: %s", - __func__, error_get_pretty(err)); - return; - } - - icp->xics =3D XICS_COMMON(obj); -} - - static void icp_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); @@ -384,7 +367,6 @@ static void icp_class_init(ObjectClass *klass, void *da= ta) =20 dc->reset =3D icp_reset; dc->vmsd =3D &vmstate_icp_server; - dc->realize =3D icp_realize; ic->print_info =3D icp_pic_print_info; } =20 @@ -634,16 +616,6 @@ static void ics_simple_initfn(Object *obj) static void ics_simple_realize(DeviceState *dev, Error **errp) { ICSState *ics =3D ICS_SIMPLE(dev); - Object *obj; - Error *err =3D NULL; - - obj =3D object_property_get_link(OBJECT(dev), "xics", &err); - if (!obj) { - error_setg(errp, "%s: required link 'xics' not found: %s", - __func__, error_get_pretty(err)); - return; - } - ics->xics =3D XICS_COMMON(obj); =20 if (!ics->nr_irqs) { error_setg(errp, "Number of interrupts needs to be greater 0"); diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c index 850777eab913..7c1809873c29 100644 --- a/hw/intc/xics_kvm.c +++ b/hw/intc/xics_kvm.c @@ -323,16 +323,6 @@ static void ics_kvm_reset(DeviceState *dev) static void ics_kvm_realize(DeviceState *dev, Error **errp) { ICSState *ics =3D ICS_SIMPLE(dev); - Object *obj; - Error *err =3D NULL; - - obj =3D object_property_get_link(OBJECT(dev), "xics", &err); - if (!obj) { - error_setg(errp, "%s: required link 'xics' not found: %s", - __func__, error_get_pretty(err)); - return; - } - ics->xics =3D XICS_COMMON(obj); =20 if (!ics->nr_irqs) { error_setg(errp, "Number of interrupts needs to be greater 0"); diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 6b35b48f818a..059408a81b8a 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -115,8 +115,6 @@ static XICSState *try_create_xics(sPAPRMachineState *sp= apr, qdev_set_parent_bus(DEVICE(spapr->ics), sysbus_get_default()); object_property_add_child(OBJECT(spapr), "ics", OBJECT(spapr->ics), NU= LL); object_property_set_int(OBJECT(spapr->ics), nr_irqs, "nr-irqs", &err); - object_property_add_const_link(OBJECT(spapr->ics), "xics", OBJECT(xics= ), - NULL); object_property_set_bool(OBJECT(spapr->ics), true, "realized", &local_= err); error_propagate(&err, local_err); if (err) { @@ -132,7 +130,6 @@ static XICSState *try_create_xics(sPAPRMachineState *sp= apr, object_initialize(icp, sizeof(*icp), type_icp); qdev_set_parent_bus(DEVICE(icp), sysbus_get_default()); object_property_add_child(OBJECT(spapr), "icp[*]", OBJECT(icp), NU= LL); - object_property_add_const_link(OBJECT(icp), "xics", OBJECT(xics), = NULL); object_property_set_bool(OBJECT(icp), true, "realized", &err); if (err) { goto error; diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index f7f89c1d18d7..20c792fccfc3 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -110,8 +110,6 @@ struct ICPState { uint8_t mfrr; qemu_irq output; bool cap_irq_xics_enabled; - - XICSState *xics; }; =20 #define TYPE_ICS_BASE "ics-base" @@ -147,7 +145,6 @@ struct ICSState { uint32_t offset; qemu_irq *qirqs; ICSIRQState *irqs; - XICSState *xics; }; =20 static inline bool ics_valid_irq(ICSState *ics, uint32_t nr) --=20 2.7.4 From nobody Thu May 2 04:10:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487255325103893.222539859188; Thu, 16 Feb 2017 06:28:45 -0800 (PST) Received: from localhost ([::1]:46998 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceN33-00009T-S1 for importer@patchew.org; Thu, 16 Feb 2017 09:28:41 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40063) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMSB-0003FE-JZ for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:50:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ceMS7-0006H1-5m for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:50:35 -0500 Received: from 7.mo173.mail-out.ovh.net ([46.105.44.159]:60593) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ceMS6-0006GJ-VD for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:50:31 -0500 Received: from player791.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo173.mail-out.ovh.net (Postfix) with ESMTP id AA86F241C0 for ; Thu, 16 Feb 2017 14:50:29 +0100 (CET) Received: from zorba.kaod.org.com (LFbn-1-10647-27.w90-89.abo.wanadoo.fr [90.89.233.27]) (Authenticated sender: clg@kaod.org) by player791.ha.ovh.net (Postfix) with ESMTPSA id 8898A420086; Thu, 16 Feb 2017 14:50:22 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Thu, 16 Feb 2017 14:47:44 +0100 Message-Id: <1487252865-12064-22-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487252865-12064-1-git-send-email-clg@kaod.org> References: <1487252865-12064-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 12548435940390177766 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrtdeggdehgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 46.105.44.159 Subject: [Qemu-devel] [PATCH v2 21/22] ppc/xics: export the XICS init routines X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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=C3=A9dric Le Goater --- 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 7c1809873c29..4ea34ea6dac5 100644 --- a/hw/intc/xics_kvm.c +++ b/hw/intc/xics_kvm.c @@ -363,7 +363,7 @@ static void rtas_dummy(PowerPCCPU *cpu, sPAPRMachineSta= te *spapr, __func__); } =20 -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 =3D { @@ -419,27 +419,20 @@ static void xics_kvm_realize(DeviceState *dev, Error = **errp) kvm_msi_via_irqfd_allowed =3D true; kvm_gsi_direct_mapping =3D true; =20 - return; + return rc; =20 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 =3D DEVICE_CLASS(oc); - - dc->realize =3D xics_kvm_realize; + return -1; } =20 static const TypeInfo xics_spapr_kvm_info =3D { .name =3D TYPE_XICS_SPAPR_KVM, .parent =3D TYPE_XICS_COMMON, .instance_size =3D sizeof(KVMXICSState), - .class_init =3D xics_kvm_class_init, }; =20 static void xics_kvm_register_types(void) diff --git a/hw/intc/xics_spapr.c b/hw/intc/xics_spapr.c index cb6325ee64fd..5c1ddee1e8e9 100644 --- a/hw/intc/xics_spapr.c +++ b/hw/intc/xics_spapr.c @@ -240,7 +240,7 @@ static void rtas_int_on(PowerPCCPU *cpu, sPAPRMachineSt= ate *spapr, rtas_st(rets, 0, RTAS_OUT_SUCCESS); } =20 -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 =3D DEVICE_CLASS(oc); - - dc->realize =3D xics_spapr_realize; + return 0; } =20 static const TypeInfo xics_spapr_info =3D { @@ -268,7 +262,6 @@ static const TypeInfo xics_spapr_info =3D { .parent =3D TYPE_XICS_COMMON, .instance_size =3D sizeof(XICSState), .class_size =3D sizeof(XICSStateClass), - .class_init =3D xics_spapr_class_init, }; =20 #define ICS_IRQ_FREE(ics, srcno) \ diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 059408a81b8a..2f1b45200813 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -156,7 +156,8 @@ static XICSState *xics_system_init(MachineState *machin= e, if (kvm_enabled()) { Error *err =3D NULL; =20 - if (machine_kernel_irqchip_allowed(machine)) { + if (machine_kernel_irqchip_allowed(machine) && + !xics_kvm_init(SPAPR_MACHINE(machine), errp)) { xics =3D try_create_xics(SPAPR_MACHINE(machine), TYPE_XICS_SPAPR_KVM, TYPE_ICS_KVM, TYPE_KVM_ICP, nr_servers, nr_irqs, &err= ); @@ -170,6 +171,7 @@ static XICSState *xics_system_init(MachineState *machin= e, } =20 if (!xics) { + xics_spapr_init(SPAPR_MACHINE(machine), errp); xics =3D 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 20c792fccfc3..bfbc59ad2a05 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -219,4 +219,9 @@ void ics_set_irq_type(ICSState *ics, int srcno, bool ls= i); void ics_resend(ICSState *ics); void icp_resend(XICSInterface *xi, ICPState *ss); =20 +typedef struct sPAPRMachineState sPAPRMachineState; + +int xics_kvm_init(sPAPRMachineState *spapr, Error **errp); +int xics_spapr_init(sPAPRMachineState *spapr, Error **errp); + #endif /* XICS_H */ --=20 2.7.4 From nobody Thu May 2 04:10:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487254380363974.4803854994419; Thu, 16 Feb 2017 06:13:00 -0800 (PST) Received: from localhost ([::1]:46880 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMnp-00086V-Bs for importer@patchew.org; Thu, 16 Feb 2017 09:12:57 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40092) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceMSG-0003JJ-HF for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:50:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ceMSE-0006IQ-Eb for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:50:40 -0500 Received: from 7.mo173.mail-out.ovh.net ([46.105.44.159]:55350) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ceMSE-0006Ht-2z for qemu-devel@nongnu.org; Thu, 16 Feb 2017 08:50:38 -0500 Received: from player791.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo173.mail-out.ovh.net (Postfix) with ESMTP id C3683241B2 for ; Thu, 16 Feb 2017 14:50:36 +0100 (CET) Received: from zorba.kaod.org.com (LFbn-1-10647-27.w90-89.abo.wanadoo.fr [90.89.233.27]) (Authenticated sender: clg@kaod.org) by player791.ha.ovh.net (Postfix) with ESMTPSA id 95F5C420090; Thu, 16 Feb 2017 14:50:29 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Thu, 16 Feb 2017 14:47:45 +0100 Message-Id: <1487252865-12064-23-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487252865-12064-1-git-send-email-clg@kaod.org> References: <1487252865-12064-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 12550406263047490534 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrtdeggdehgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 46.105.44.159 Subject: [Qemu-devel] [PATCH v2 22/22] ppc/xics: remove the XICSState classes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" These classed are not used anymore. They have been deprecated by the QOM interface. Do the cleanups. Signed-off-by: C=C3=A9dric Le Goater --- hw/intc/xics.c | 11 ----------- hw/intc/xics_kvm.c | 13 ------------- hw/intc/xics_spapr.c | 14 -------------- hw/ppc/spapr.c | 41 +++++++++++++++-------------------------- include/hw/ppc/spapr.h | 1 - include/hw/ppc/xics.h | 35 ----------------------------------- 6 files changed, 15 insertions(+), 100 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index eb1a9f12fd3a..f3acd06eb6a1 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -135,16 +135,6 @@ static void ics_simple_pic_print_info(InterruptStatsPr= ovider *obj, } =20 /* - * XICS Common class - parent for emulated XICS and KVM-XICS - */ -static const TypeInfo xics_common_info =3D { - .name =3D TYPE_XICS_COMMON, - .parent =3D TYPE_DEVICE, - .instance_size =3D sizeof(XICSState), - .class_size =3D sizeof(XICSStateClass), -}; - -/* * ICP: Presentation layer */ =20 @@ -706,7 +696,6 @@ void ics_set_irq_type(ICSState *ics, int srcno, bool ls= i) =20 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 4ea34ea6dac5..15e3e338f39c 100644 --- a/hw/intc/xics_kvm.c +++ b/hw/intc/xics_kvm.c @@ -42,12 +42,6 @@ =20 static int kernel_xics_fd =3D -1; =20 -typedef struct KVMXICSState { - XICSState parent_obj; - - int kernel_xics_fd; -} KVMXICSState; - /* * ICP-KVM */ @@ -429,15 +423,8 @@ fail: return -1; } =20 -static const TypeInfo xics_spapr_kvm_info =3D { - .name =3D TYPE_XICS_SPAPR_KVM, - .parent =3D TYPE_XICS_COMMON, - .instance_size =3D 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 5c1ddee1e8e9..4868755ab7bf 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; } =20 -static const TypeInfo xics_spapr_info =3D { - .name =3D TYPE_XICS_SPAPR, - .parent =3D TYPE_XICS_COMMON, - .instance_size =3D sizeof(XICSState), - .class_size =3D sizeof(XICSStateClass), -}; - #define ICS_IRQ_FREE(ics, srcno) \ (!((ics)->irqs[(srcno)].flags & (XICS_FLAGS_IRQ_MASK))) =20 @@ -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 2f1b45200813..6d1f3f756292 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -95,22 +95,13 @@ =20 #define HTAB_SIZE(spapr) (1ULL << ((spapr)->htab_shift)) =20 -static XICSState *try_create_xics(sPAPRMachineState *spapr, - const char *type, const char *type_ics, +static int try_create_xics(sPAPRMachineState *spapr, const char *type_ics, const char *type_icp, int nr_servers, int nr_irqs, Error **errp) { Error *err =3D NULL, *local_err =3D NULL; - XICSState *xics; int i; =20 - xics =3D 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; - } - spapr->ics =3D ICS_SIMPLE(object_new(type_ics)); qdev_set_parent_bus(DEVICE(spapr->ics), sysbus_get_default()); object_property_add_child(OBJECT(spapr), "ics", OBJECT(spapr->ics), NU= LL); @@ -137,32 +128,31 @@ static XICSState *try_create_xics(sPAPRMachineState *= spapr, object_unref(OBJECT(icp)); } =20 - return xics; + return 0; =20 error: error_propagate(errp, err); if (spapr->ics) { object_unparent(OBJECT(spapr->ics)); } - object_unparent(OBJECT(xics)); - return NULL; + return -1; } =20 -static XICSState *xics_system_init(MachineState *machine, - int nr_servers, int nr_irqs, Error **er= rp) +static int xics_system_init(MachineState *machine, + int nr_servers, int nr_irqs, Error **errp) { - XICSState *xics =3D NULL; + int rc =3D -1; =20 if (kvm_enabled()) { Error *err =3D NULL; =20 if (machine_kernel_irqchip_allowed(machine) && !xics_kvm_init(SPAPR_MACHINE(machine), errp)) { - xics =3D try_create_xics(SPAPR_MACHINE(machine), - TYPE_XICS_SPAPR_KVM, TYPE_ICS_KVM, + rc =3D 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 { @@ -170,14 +160,14 @@ static XICSState *xics_system_init(MachineState *mach= ine, } } =20 - if (!xics) { + if (rc < 0) { xics_spapr_init(SPAPR_MACHINE(machine), errp); - xics =3D try_create_xics(SPAPR_MACHINE(machine), - TYPE_XICS_SPAPR, TYPE_ICS_SIMPLE, + rc =3D try_create_xics(SPAPR_MACHINE(machine), + TYPE_ICS_SIMPLE, TYPE_ICP, nr_servers, nr_irqs, errp); } =20 - return xics; + return rc; } =20 static int spapr_fixup_cpu_smt_dt(void *fdt, int offset, PowerPCCPU *cpu, @@ -1939,9 +1929,8 @@ static void ppc_spapr_init(MachineState *machine) load_limit =3D MIN(spapr->rma_size, RTAS_MAX_ADDR) - FW_OVERHEAD; =20 /* Set up Interrupt Controller before we create the VCPUs */ - spapr->xics =3D xics_system_init(machine, - DIV_ROUND_UP(max_cpus * smt, smp_thread= s), - XICS_IRQS_SPAPR, &error_fatal); + xics_system_init(machine, DIV_ROUND_UP(max_cpus * smt, smp_threads), + XICS_IRQS_SPAPR, &error_fatal); =20 /* Set up containers for ibm,client-set-architecture negotiated option= s */ spapr->ov5 =3D spapr_ovec_new(); diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index f5bbb040f941..cfd271129dd0 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -58,7 +58,6 @@ struct sPAPRMachineState { struct VIOsPAPRBus *vio_bus; QLIST_HEAD(, sPAPRPHBState) phbs; struct sPAPRNVRAM *nvram; - XICSState *xics; ICSState *ics; DeviceState *rtc; =20 diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index bfbc59ad2a05..4060fcfe84ba 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -30,29 +30,6 @@ =20 #include "hw/sysbus.h" =20 -#define TYPE_XICS_COMMON "xics-common" -#define XICS_COMMON(obj) OBJECT_CHECK(XICSState, (obj), TYPE_XICS_COMMON) - -/* - * Retain xics as the type name to be compatible for migration. Rest all t= he - * functions, class and variables are renamed as xics_spapr. - */ -#define TYPE_XICS_SPAPR "xics" -#define XICS_SPAPR(obj) OBJECT_CHECK(XICSState, (obj), TYPE_XICS_SPAPR) - -#define TYPE_XICS_SPAPR_KVM "xics-spapr-kvm" -#define XICS_SPAPR_KVM(obj) \ - OBJECT_CHECK(KVMXICSState, (obj), TYPE_XICS_SPAPR_KVM) - -#define XICS_COMMON_CLASS(klass) \ - OBJECT_CLASS_CHECK(XICSStateClass, (klass), TYPE_XICS_COMMON) -#define XICS_SPAPR_CLASS(klass) \ - OBJECT_CLASS_CHECK(XICSStateClass, (klass), TYPE_XICS_SPAPR) -#define XICS_COMMON_GET_CLASS(obj) \ - OBJECT_GET_CLASS(XICSStateClass, (obj), TYPE_XICS_COMMON) -#define XICS_SPAPR_GET_CLASS(obj) \ - OBJECT_GET_CLASS(XICSStateClass, (obj), TYPE_XICS_SPAPR) - #define XICS_IPI 0x2 #define XICS_BUID 0x1 #define XICS_IRQ_BASE (XICS_BUID << 12) @@ -62,24 +39,12 @@ * (the kernel implementation supports more but we don't exploit * that yet) */ -typedef struct XICSStateClass XICSStateClass; -typedef struct XICSState XICSState; typedef struct ICPStateClass ICPStateClass; typedef struct ICPState ICPState; typedef struct ICSStateClass ICSStateClass; typedef struct ICSState ICSState; typedef struct ICSIRQState ICSIRQState; =20 -struct XICSStateClass { - DeviceClass parent_class; -}; - -struct XICSState { - /*< private >*/ - SysBusDevice parent_obj; - /*< public >*/ -}; - #define TYPE_ICP "icp" #define ICP(obj) OBJECT_CHECK(ICPState, (obj), TYPE_ICP) =20 --=20 2.7.4