From nobody Fri May 17 06:53:57 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 1488206723647596.0869528259698; Mon, 27 Feb 2017 06:45:23 -0800 (PST) Received: from localhost ([::1]:53333 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMYE-0004pT-Bx for importer@patchew.org; Mon, 27 Feb 2017 09:45:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37588) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMJI-0000PO-FA for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:29:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciMJE-00074v-GC for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:29:56 -0500 Received: from 20.mo6.mail-out.ovh.net ([178.32.124.17]:39718) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ciMJE-00074D-Ad for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:29:52 -0500 Received: from player761.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo6.mail-out.ovh.net (Postfix) with ESMTP id E0F49B3A58 for ; Mon, 27 Feb 2017 15:29:50 +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 player761.ha.ovh.net (Postfix) with ESMTPSA id 6C7474800A4; Mon, 27 Feb 2017 15:29:46 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Mon, 27 Feb 2017 15:29:08 +0100 Message-Id: <1488205773-30436-2-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488205773-30436-1-git-send-email-clg@kaod.org> References: <1488205773-30436-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 4025655118512163814 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrvdeigdeihecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd 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.124.17 Subject: [Qemu-devel] [PATCH v4 01/26] xics: XICS should not be a SysBusDevice 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" From: David Gibson Currently xics - the component of the IBM POWER interrupt controller representing the overall interrupt fabric / architecture is represented as a descendent of SysBusDevice. However, this is not really correct - the xics presents nothing in MMIO space so it should be an "unattached" device in the current QOM model. Since this device will always be created by the machine type, not created specifically from the command line, and because it has no migrated state it should be safe to move it around the device composition tree. Therefore this patch changes it to a descendent of TYPE_DEVICE, and makes it an unattached device. Signed-off-by: David Gibson Reviewed-by: C=C3=A9dric Le Goater Signed-off-by: C=C3=A9dric Le Goater --- hw/intc/xics.c | 2 +- hw/ppc/spapr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 095c16a30082..372b8311fb8b 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -260,7 +260,7 @@ static void xics_common_class_init(ObjectClass *oc, voi= d *data) =20 static const TypeInfo xics_common_info =3D { .name =3D TYPE_XICS_COMMON, - .parent =3D TYPE_SYS_BUS_DEVICE, + .parent =3D TYPE_DEVICE, .instance_size =3D sizeof(XICSState), .class_size =3D sizeof(XICSStateClass), .instance_init =3D xics_common_initfn, diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 0b57aade3f83..ceefbb57d0ac 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -101,7 +101,7 @@ static XICSState *try_create_xics(const char *type, int= nr_servers, Error *err =3D NULL; DeviceState *dev; =20 - dev =3D qdev_create(NULL, type); + 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); --=20 2.7.4 From nobody Fri May 17 06:53:57 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 1488205940199648.253008323184; Mon, 27 Feb 2017 06:32:20 -0800 (PST) Received: from localhost ([::1]:53228 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMLY-0001xM-Sa for importer@patchew.org; Mon, 27 Feb 2017 09:32:16 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37635) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMJM-0000SS-Df for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:30:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciMJI-00077L-Fc for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:30:00 -0500 Received: from 13.mo6.mail-out.ovh.net ([188.165.56.124]:51691) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ciMJI-00076e-9y for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:29:56 -0500 Received: from player761.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo6.mail-out.ovh.net (Postfix) with ESMTP id C5B88B0611 for ; Mon, 27 Feb 2017 15:29: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 player761.ha.ovh.net (Postfix) with ESMTPSA id 98E104800A4; Mon, 27 Feb 2017 15:29:50 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Mon, 27 Feb 2017 15:29:09 +0100 Message-Id: <1488205773-30436-3-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488205773-30436-1-git-send-email-clg@kaod.org> References: <1488205773-30436-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 4026781019158776806 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrvdeigdeihecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd 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: 188.165.56.124 Subject: [Qemu-devel] [PATCH v4 02/26] ppc/xics: fix ICP and ICS reset 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" commit 5b17c7207938 ("xics: XICS should not be a SysBusDevice") changed the nature of the XICS object to be a descendent of TYPE_DEVICE. By doing so, the object is not on a bus and its reset handler is not called anymore. The direct consequence is that the ICP and ICS objects are not correctly initialized and so the IRQ subsystem is broken in the guest. Signed-off-by: C=C3=A9dric Le Goater --- hw/ppc/spapr.c | 1 + include/hw/ppc/xics.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index ceefbb57d0ac..3c79068075e4 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -104,6 +104,7 @@ static XICSState *try_create_xics(const char *type, int= nr_servers, dev =3D DEVICE(object_new(type)); qdev_prop_set_uint32(dev, "nr_servers", nr_servers); qdev_prop_set_uint32(dev, "nr_irqs", nr_irqs); + qdev_set_parent_bus(dev, sysbus_get_default()); object_property_set_bool(OBJECT(dev), true, "realized", &err); if (err) { error_propagate(errp, err); diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index 3f0c31610aa4..1aefd3d52257 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -80,7 +80,7 @@ struct XICSStateClass { =20 struct XICSState { /*< private >*/ - SysBusDevice parent_obj; + DeviceState parent_obj; /*< public >*/ uint32_t nr_servers; uint32_t nr_irqs; --=20 2.7.4 From nobody Fri May 17 06:53:57 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 1488208630640763.8798565472987; Mon, 27 Feb 2017 07:17:10 -0800 (PST) Received: from localhost ([::1]:53534 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciN2y-0007JF-7C for importer@patchew.org; Mon, 27 Feb 2017 10:17:08 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37755) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMJR-0000XK-K7 for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:30:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciMJN-0007Aj-JE for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:30:05 -0500 Received: from 17.mo6.mail-out.ovh.net ([46.105.36.150]:54736) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ciMJN-00079d-9q for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:30:01 -0500 Received: from player761.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo6.mail-out.ovh.net (Postfix) with ESMTP id C4090B3A7A for ; Mon, 27 Feb 2017 15:29: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 player761.ha.ovh.net (Postfix) with ESMTPSA id BE5B74800A1; Mon, 27 Feb 2017 15:29:54 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Mon, 27 Feb 2017 15:29:10 +0100 Message-Id: <1488205773-30436-4-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488205773-30436-1-git-send-email-clg@kaod.org> References: <1488205773-30436-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 4028188392641760230 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrvdeigdeihecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd 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.36.150 Subject: [Qemu-devel] [PATCH v4 03/26] 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 v3: - moved the retrieval link at ICS_BASE level=20 - added a realize() handler to the ICSStateClass and updated the descendent classes accordingly Changes since v1: - added a XICS link to the ICS object hw/intc/xics.c | 72 +++++++++++++++++++++++++----------------------= ---- hw/intc/xics_kvm.c | 36 +------------------------- hw/intc/xics_spapr.c | 34 ------------------------ hw/ppc/spapr.c | 54 ++++++++++++++++++++++++++------------ include/hw/ppc/xics.h | 3 +-- 5 files changed, 75 insertions(+), 124 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 372b8311fb8b..f00b77ae15f4 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); @@ -746,12 +711,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; + isc->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; @@ -769,11 +740,40 @@ static const TypeInfo ics_simple_info =3D { .instance_init =3D ics_simple_initfn, }; =20 +static void ics_base_realize(DeviceState *dev, Error **errp) +{ + ICSStateClass *icsc =3D ICS_BASE_GET_CLASS(dev); + ICSState *ics =3D ICS_BASE(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); + + + if (icsc->realize) { + icsc->realize(dev, errp); + } +} + +static void ics_base_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + + dc->realize =3D ics_base_realize; +} + static const TypeInfo ics_base_info =3D { .name =3D TYPE_ICS_BASE, .parent =3D TYPE_DEVICE, .abstract =3D true, .instance_size =3D sizeof(ICSState), + .class_init =3D ics_base_class_init, .class_size =3D sizeof(ICSStateClass), }; =20 diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c index 17694eaa8709..e5ab00b22361 100644 --- a/hw/intc/xics_kvm.c +++ b/hw/intc/xics_kvm.c @@ -308,7 +308,7 @@ static void ics_kvm_class_init(ObjectClass *klass, void= *data) DeviceClass *dc =3D DEVICE_CLASS(klass); ICSStateClass *icsc =3D ICS_BASE_CLASS(klass); =20 - dc->realize =3D ics_kvm_realize; + icsc->realize =3D ics_kvm_realize; dc->reset =3D ics_kvm_reset; icsc->pre_save =3D ics_get_kvm_state; icsc->post_load =3D ics_set_kvm_state; @@ -358,18 +358,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 +377,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 +428,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 +451,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 +458,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 +466,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 3c79068075e4..398ce5a9cc1e 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -95,23 +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); - qdev_set_parent_bus(dev, sysbus_get_default()); - 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, @@ -123,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, @@ -135,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 1aefd3d52257..a1d12d39c898 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 { DeviceState parent_obj; /*< public >*/ uint32_t nr_servers; - uint32_t nr_irqs; ICPState *ss; QLIST_HEAD(, ICSState) ics; }; @@ -139,6 +137,7 @@ struct ICPState { struct ICSStateClass { DeviceClass parent_class; =20 + void (*realize)(DeviceState *dev, Error **errp); void (*pre_save)(ICSState *s); int (*post_load)(ICSState *s, int version_id); void (*reject)(ICSState *s, uint32_t irq); --=20 2.7.4 From nobody Fri May 17 06:53:57 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 1488206254645537.3110893189555; Mon, 27 Feb 2017 06:37:34 -0800 (PST) Received: from localhost ([::1]:53272 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMQf-0006Ki-5t for importer@patchew.org; Mon, 27 Feb 2017 09:37:33 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37818) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMJW-0000ei-I4 for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:30:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciMJS-0007GB-Hs for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:30:10 -0500 Received: from 2.mo6.mail-out.ovh.net ([46.105.76.65]:35487) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ciMJS-0007F8-8R for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:30:06 -0500 Received: from player761.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo6.mail-out.ovh.net (Postfix) with ESMTP id 925CDB3A85 for ; Mon, 27 Feb 2017 15:30:04 +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 player761.ha.ovh.net (Postfix) with ESMTPSA id C27254800A1; Mon, 27 Feb 2017 15:29:59 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Mon, 27 Feb 2017 15:29:11 +0100 Message-Id: <1488205773-30436-5-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488205773-30436-1-git-send-email-clg@kaod.org> References: <1488205773-30436-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 4029314293341785062 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrvdeigdeihecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd 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.76.65 Subject: [Qemu-devel] [PATCH v4 04/26] 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 f00b77ae15f4..d2a417f73fd5 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 e5ab00b22361..2d08c4071d3f 100644 --- a/hw/intc/xics_kvm.c +++ b/hw/intc/xics_kvm.c @@ -358,12 +358,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, @@ -376,9 +370,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, @@ -428,16 +420,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; @@ -458,7 +440,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 398ce5a9cc1e..f1b690e8983e 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 a1d12d39c898..e79a70748e4c 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 { @@ -190,8 +189,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 Fri May 17 06:53:57 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 14882069997471011.1575333437428; Mon, 27 Feb 2017 06:49:59 -0800 (PST) Received: from localhost ([::1]:53358 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMcf-0000JH-JZ for importer@patchew.org; Mon, 27 Feb 2017 09:49:57 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37859) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMJb-0000lK-7y for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:30:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciMJX-0007ML-7w for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:30:15 -0500 Received: from 10.mo6.mail-out.ovh.net ([87.98.157.236]:41272) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ciMJW-0007LD-W1 for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:30:11 -0500 Received: from player761.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo6.mail-out.ovh.net (Postfix) with ESMTP id 745F2B3AAD for ; Mon, 27 Feb 2017 15:30:09 +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 player761.ha.ovh.net (Postfix) with ESMTPSA id EA1404800A7; Mon, 27 Feb 2017 15:30:03 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Mon, 27 Feb 2017 15:29:12 +0100 Message-Id: <1488205773-30436-6-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488205773-30436-1-git-send-email-clg@kaod.org> References: <1488205773-30436-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 4030721670788254694 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrvdeigdeihecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd 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: 87.98.157.236 Subject: [Qemu-devel] [PATCH v4 05/26] 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 --- Changes since v3: - assigned spapr->ics at the end of try_create_xics() hw/intc/xics_spapr.c | 22 +++++++++------------- hw/ppc/spapr.c | 14 +++++++++----- 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, 29 insertions(+), 28 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 f1b690e8983e..130bfdc0055c 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -95,7 +95,8 @@ =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) { @@ -112,7 +113,7 @@ static XICSState *try_create_xics(const char *type, con= st char *type_ics, } =20 ics =3D ICS_SIMPLE(object_new(type_ics)); - object_property_add_child(OBJECT(xics), "ics", OBJECT(ics), NULL); + object_property_add_child(OBJECT(spapr), "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); @@ -138,6 +139,7 @@ static XICSState *try_create_xics(const char *type, con= st char *type_ics, object_unref(OBJECT(icp)); } =20 + spapr->ics =3D ics; return xics; =20 error: @@ -158,7 +160,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 +173,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 1c4fa8b0f606..3f580a68be8e 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -326,7 +326,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); } @@ -364,7 +364,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: ", @@ -375,7 +375,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 @@ -1747,7 +1747,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 e79a70748e4c..37d4d9ce3f81 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -181,10 +181,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 Fri May 17 06:53:57 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 1488206584790363.38761260350293; Mon, 27 Feb 2017 06:43:04 -0800 (PST) Received: from localhost ([::1]:53321 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMVy-0002qK-Fp for importer@patchew.org; Mon, 27 Feb 2017 09:43:02 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37911) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMJk-0000tx-Mw for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:30:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciMJg-0007Qw-NN for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:30:24 -0500 Received: from 13.mo6.mail-out.ovh.net ([188.165.56.124]:48980) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ciMJg-0007QC-DM for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:30:20 -0500 Received: from player761.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo6.mail-out.ovh.net (Postfix) with ESMTP id 567BEB3ABE for ; Mon, 27 Feb 2017 15:30:19 +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 player761.ha.ovh.net (Postfix) with ESMTPSA id E9FFB480095; Mon, 27 Feb 2017 15:30:08 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Mon, 27 Feb 2017 15:29:13 +0100 Message-Id: <1488205773-30436-7-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488205773-30436-1-git-send-email-clg@kaod.org> References: <1488205773-30436-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 4032129043464948710 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrvdeigdeihecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd 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: 188.165.56.124 Subject: [Qemu-devel] [PATCH v4 06/26] 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. The InterruptStatsProvider will be moved at the machine level after the XICS cleanups are completed. 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 d2a417f73fd5..c7c9bd600790 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 /* @@ -682,6 +682,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 isc->realize =3D ics_simple_realize; dc->props =3D ics_simple_properties; @@ -691,6 +692,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 { @@ -700,6 +702,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 void ics_base_realize(DeviceState *dev, Error **errp) --=20 2.7.4 From nobody Fri May 17 06:53:57 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 1488208953991582.1289041001068; Mon, 27 Feb 2017 07:22:33 -0800 (PST) Received: from localhost ([::1]:53569 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciN8A-0003rT-MF for importer@patchew.org; Mon, 27 Feb 2017 10:22:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37998) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMJt-00012d-5S for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:30:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciMJp-0007WC-6n for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:30:33 -0500 Received: from 5.mo6.mail-out.ovh.net ([46.105.54.31]:41776) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ciMJp-0007VY-1E for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:30:29 -0500 Received: from player761.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo6.mail-out.ovh.net (Postfix) with ESMTP id 0764FB3ABE for ; Mon, 27 Feb 2017 15:30:24 +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 player761.ha.ovh.net (Postfix) with ESMTPSA id 1E5BF48008F; Mon, 27 Feb 2017 15:30:13 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Mon, 27 Feb 2017 15:29:14 +0100 Message-Id: <1488205773-30436-8-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488205773-30436-1-git-send-email-clg@kaod.org> References: <1488205773-30436-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 4033254945267485670 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrvdeigdeihecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd 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.54.31 Subject: [Qemu-devel] [PATCH v4 07/26] ppc/xics: introduce a XICSFabric 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 interface provides two simple handlers. One is to get an ICS (Interrupt Source Controller) 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 --- Changes since v2: - renamed QOM Interface to XICSFabric 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 c7c9bd600790..433869a696c4 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -745,6 +745,12 @@ static const TypeInfo ics_base_info =3D { .class_size =3D sizeof(ICSStateClass), }; =20 +static const TypeInfo xics_fabric_info =3D { + .name =3D TYPE_XICS_FABRIC, + .parent =3D TYPE_INTERFACE, + .class_size =3D sizeof(XICSFabricClass), +}; + /* * Exported functions */ @@ -785,6 +791,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_fabric_info); } =20 type_init(xics_register_types) diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index 37d4d9ce3f81..1c43305a0456 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -178,6 +178,24 @@ struct ICSIRQState { uint8_t flags; }; =20 +typedef struct XICSFabric { + Object parent; +} XICSFabric; + +#define TYPE_XICS_FABRIC "xics-fabric" +#define XICS_FABRIC(obj) \ + OBJECT_CHECK(XICSFabric, (obj), TYPE_XICS_FABRIC) +#define XICS_FABRIC_CLASS(klass) \ + OBJECT_CLASS_CHECK(XICSFabricClass, (klass), TYPE_XICS_FABRIC) +#define XICS_FABRIC_GET_CLASS(obj) \ + OBJECT_GET_CLASS(XICSFabricClass, (obj), TYPE_XICS_FABRIC) + +typedef struct XICSFabricClass { + InterfaceClass parent; + ICSState *(*ics_get)(XICSFabric *xi, int irq); + void (*ics_resend)(XICSFabric *xi); +} XICSFabricClass; + #define XICS_IRQS_SPAPR 1024 =20 qemu_irq xics_get_qirq(XICSState *icp, int irq); --=20 2.7.4 From nobody Fri May 17 06:53:57 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 148820920477445.372171931257185; Mon, 27 Feb 2017 07:26:44 -0800 (PST) Received: from localhost ([::1]:53599 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciNCD-0007lJ-2m for importer@patchew.org; Mon, 27 Feb 2017 10:26:41 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38080) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMJw-00015h-K0 for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:30:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciMJq-0007YX-TN for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:30:36 -0500 Received: from 10.mo6.mail-out.ovh.net ([87.98.157.236]:57153) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ciMJq-0007Wo-Mw for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:30:30 -0500 Received: from player761.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo6.mail-out.ovh.net (Postfix) with ESMTP id 5680DB3AD6 for ; Mon, 27 Feb 2017 15:30:24 +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 player761.ha.ovh.net (Postfix) with ESMTPSA id 4420C4800A6; Mon, 27 Feb 2017 15:30:17 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Mon, 27 Feb 2017 15:29:15 +0100 Message-Id: <1488205773-30436-9-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488205773-30436-1-git-send-email-clg@kaod.org> References: <1488205773-30436-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 4034380841645149158 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrvdeigdeihecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd 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: 87.98.157.236 Subject: [Qemu-devel] [PATCH v4 08/26] 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 433869a696c4..c6bfb610fd32 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 130bfdc0055c..ad41aba44b49 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2913,6 +2913,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(XICSFabric *dev, int irq) +{ + sPAPRMachineState *spapr =3D SPAPR_MACHINE(dev); + + return ics_valid_irq(spapr->ics, irq) ? spapr->ics : NULL; +} + +static void spapr_ics_resend(XICSFabric *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); @@ -2921,6 +2935,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); + XICSFabricClass *xic =3D XICS_FABRIC_CLASS(oc); =20 mc->desc =3D "pSeries Logical Partition (PAPR compliant)"; =20 @@ -2954,6 +2969,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 { @@ -2970,6 +2987,7 @@ static const TypeInfo spapr_machine_info =3D { { TYPE_NMI }, { TYPE_HOTPLUG_HANDLER }, { TYPE_PPC_VIRTUAL_HYPERVISOR }, + { TYPE_XICS_FABRIC }, { } }, }; diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index 1c43305a0456..1161d5487b4f 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -223,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 ICSState *xics_find_source(XICSState *icp, int irq); +void ics_resend(ICSState *ics); =20 #endif /* XICS_H */ --=20 2.7.4 From nobody Fri May 17 06:53:57 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 1488207303554598.6298923788628; Mon, 27 Feb 2017 06:55:03 -0800 (PST) Received: from localhost ([::1]:53389 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMha-0004ZX-A6 for importer@patchew.org; Mon, 27 Feb 2017 09:55:02 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38086) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMJx-00016A-2R for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:30:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciMJs-0007aL-S1 for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:30:37 -0500 Received: from 17.mo6.mail-out.ovh.net ([46.105.36.150]:59105) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ciMJs-0007ZX-L9 for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:30:32 -0500 Received: from player761.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo6.mail-out.ovh.net (Postfix) with ESMTP id 60140B3AA6 for ; Mon, 27 Feb 2017 15:30:28 +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 player761.ha.ovh.net (Postfix) with ESMTPSA id 072684800B1; Mon, 27 Feb 2017 15:30:22 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Mon, 27 Feb 2017 15:29:16 +0100 Message-Id: <1488205773-30436-10-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488205773-30436-1-git-send-email-clg@kaod.org> References: <1488205773-30436-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 4035788217290427366 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrvdeigdeihecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd 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.36.150 Subject: [Qemu-devel] [PATCH v4 09/26] 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 c6bfb610fd32..e3dbe63fc021 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -766,9 +766,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(XICSFabric *xi, int irq) { - ICSState *ics =3D xics_find_source(xics, irq); + XICSFabricClass *xic =3D XICS_FABRIC_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..24a5758e6243 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_FABRIC(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_FABRIC(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_FABRIC(spapr), source->irq)); } } =20 diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index 3f580a68be8e..701eb3fec94e 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -737,7 +737,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_FABRIC(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..dfa76143f305 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_FABRIC(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..2e9685a5d900 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_FABRIC(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 1161d5487b4f..094756dd75a0 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -198,7 +198,8 @@ typedef struct XICSFabricClass { =20 #define XICS_IRQS_SPAPR 1024 =20 -qemu_irq xics_get_qirq(XICSState *icp, int irq); +qemu_irq xics_get_qirq(XICSFabric *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 Fri May 17 06:53:57 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 1488207563060500.5176090484272; Mon, 27 Feb 2017 06:59:23 -0800 (PST) Received: from localhost ([::1]:53416 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMll-0000Im-Uc for importer@patchew.org; Mon, 27 Feb 2017 09:59:21 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38128) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMK1-00019u-BG for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:30:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciMJx-0007fk-CH for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:30:41 -0500 Received: from 6.mo6.mail-out.ovh.net ([87.98.177.69]:59315) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ciMJx-0007el-6I for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:30:37 -0500 Received: from player761.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo6.mail-out.ovh.net (Postfix) with ESMTP id 2FB6BB3AAD for ; Mon, 27 Feb 2017 15:30: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 player761.ha.ovh.net (Postfix) with ESMTPSA id 595EE4800AB; Mon, 27 Feb 2017 15:30:26 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Mon, 27 Feb 2017 15:29:17 +0100 Message-Id: <1488205773-30436-11-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488205773-30436-1-git-send-email-clg@kaod.org> References: <1488205773-30436-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 4036914116099410918 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrvdeigdeihecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd 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: 87.98.177.69 Subject: [Qemu-devel] [PATCH v4 10/26] 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" Also change the ICPState 'xics' backlink to be a XICSFabric, this removes the need of using qdev_get_machine() to get the QOM interface in some of the routines. Signed-off-by: C=C3=A9dric Le Goater --- Changes since v3: - changed ICPState 'xics' backlink to be a XICSFabric. hw/intc/xics.c | 20 +++++++++++--------- hw/ppc/spapr.c | 3 ++- include/hw/ppc/xics.h | 3 ++- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index e3dbe63fc021..23e45a87d47a 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -231,14 +231,14 @@ static void icp_check_ipi(ICPState *ss) =20 static void icp_resend(ICPState *ss) { - ICSState *ics; + XICSFabric *xi =3D ss->xics; + XICSFabricClass *xic =3D XICS_FABRIC_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) @@ -299,6 +299,8 @@ uint32_t icp_ipoll(ICPState *ss, uint32_t *mfrr) =20 void icp_eoi(ICPState *ss, uint32_t xirr) { + XICSFabric *xi =3D ss->xics; + XICSFabricClass *xic =3D XICS_FABRIC_GET_CLASS(xi); ICSState *ics; uint32_t irq; =20 @@ -306,10 +308,10 @@ 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); @@ -401,7 +403,7 @@ static void icp_realize(DeviceState *dev, Error **errp) return; } =20 - icp->xics =3D XICS_COMMON(obj); + icp->xics =3D XICS_FABRIC(obj); } =20 =20 diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index ad41aba44b49..669a3a621b56 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -100,6 +100,7 @@ static XICSState *try_create_xics(sPAPRMachineState *sp= apr, const char *type_icp, int nr_servers, int nr_irqs, Error **errp) { + XICSFabric *xi =3D XICS_FABRIC(spapr); Error *err =3D NULL, *local_err =3D NULL; XICSState *xics; ICSState *ics =3D NULL; @@ -131,7 +132,7 @@ static XICSState *try_create_xics(sPAPRMachineState *sp= apr, =20 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_add_const_link(OBJECT(icp), "xics", OBJECT(xi), NU= LL); 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 094756dd75a0..b88071529d5b 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -69,6 +69,7 @@ typedef struct ICPState ICPState; typedef struct ICSStateClass ICSStateClass; typedef struct ICSState ICSState; typedef struct ICSIRQState ICSIRQState; +typedef struct XICSFabric XICSFabric; =20 struct XICSStateClass { DeviceClass parent_class; @@ -115,7 +116,7 @@ struct ICPState { qemu_irq output; bool cap_irq_xics_enabled; =20 - XICSState *xics; + XICSFabric *xics; }; =20 #define TYPE_ICS_BASE "ics-base" --=20 2.7.4 From nobody Fri May 17 06:53:57 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 1488209454415999.5065695724006; Mon, 27 Feb 2017 07:30:54 -0800 (PST) Received: from localhost ([::1]:53653 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciNGF-00034L-Ai for importer@patchew.org; Mon, 27 Feb 2017 10:30:51 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38182) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMK5-0001Di-8I for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:30:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciMK1-0007j6-9w for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:30:45 -0500 Received: from 1.mo6.mail-out.ovh.net ([46.105.56.136]:51744) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ciMK1-0007iP-2p for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:30:41 -0500 Received: from player761.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo6.mail-out.ovh.net (Postfix) with ESMTP id AEF50B3A92 for ; Mon, 27 Feb 2017 15:30:39 +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 player761.ha.ovh.net (Postfix) with ESMTPSA id AAC744800A2; Mon, 27 Feb 2017 15:30:30 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Mon, 27 Feb 2017 15:29:18 +0100 Message-Id: <1488205773-30436-12-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488205773-30436-1-git-send-email-clg@kaod.org> References: <1488205773-30436-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 4038321491379850214 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrvdeigdeihecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd 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.56.136 Subject: [Qemu-devel] [PATCH v4 11/26] 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 23e45a87d47a..a71d3858b13f 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -756,18 +756,6 @@ static const TypeInfo xics_fabric_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(XICSFabric *xi, int irq) { XICSFabricClass *xic =3D XICS_FABRIC_GET_CLASS(xi); diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index b88071529d5b..db2bb04de831 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -224,7 +224,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 Fri May 17 06:53:57 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 1488209753539588.113883867659; Mon, 27 Feb 2017 07:35:53 -0800 (PST) Received: from localhost ([::1]:53687 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciNL4-0007Fw-4J for importer@patchew.org; Mon, 27 Feb 2017 10:35:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38246) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMKD-0001LA-H3 for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:30:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciMK9-0007oB-Hh for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:30:53 -0500 Received: from 6.mo6.mail-out.ovh.net ([87.98.177.69]:49095) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ciMK9-0007nk-BL for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:30:49 -0500 Received: from player761.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo6.mail-out.ovh.net (Postfix) with ESMTP id 9143AB3ABA for ; Mon, 27 Feb 2017 15:30:46 +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 player761.ha.ovh.net (Postfix) with ESMTPSA id 6D01B4800B1; Mon, 27 Feb 2017 15:30:35 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Mon, 27 Feb 2017 15:29:19 +0100 Message-Id: <1488205773-30436-13-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488205773-30436-1-git-send-email-clg@kaod.org> References: <1488205773-30436-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 4039447392400280550 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrvdeigdeihecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd 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: 87.98.177.69 Subject: [Qemu-devel] [PATCH v4 12/26] 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 a71d3858b13f..97775c2b61e5 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 669a3a621b56..1706d52adec1 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -114,6 +114,7 @@ static XICSState *try_create_xics(sPAPRMachineState *sp= apr, } =20 ics =3D ICS_SIMPLE(object_new(type_ics)); + qdev_set_parent_bus(DEVICE(ics), sysbus_get_default()); object_property_add_child(OBJECT(spapr), "ics", OBJECT(ics), NULL); object_property_set_int(OBJECT(ics), nr_irqs, "nr-irqs", &err); object_property_add_const_link(OBJECT(ics), "xics", OBJECT(xics), NULL= ); --=20 2.7.4 From nobody Fri May 17 06:53:57 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 1488207853400533.2705101536727; Mon, 27 Feb 2017 07:04:13 -0800 (PST) Received: from localhost ([::1]:53445 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMqO-0004Um-2m for importer@patchew.org; Mon, 27 Feb 2017 10:04:08 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38271) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMKI-0001PP-1G for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:30:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciMKE-0007q4-1a for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:30:58 -0500 Received: from 13.mo6.mail-out.ovh.net ([188.165.56.124]:42472) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ciMKD-0007po-Pa for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:30:53 -0500 Received: from player761.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo6.mail-out.ovh.net (Postfix) with ESMTP id 9B83688909 for ; Mon, 27 Feb 2017 15:30:51 +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 player761.ha.ovh.net (Postfix) with ESMTPSA id A54304800A2; Mon, 27 Feb 2017 15:30:39 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Mon, 27 Feb 2017 15:29:20 +0100 Message-Id: <1488205773-30436-14-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488205773-30436-1-git-send-email-clg@kaod.org> References: <1488205773-30436-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 4040573291153492966 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrvdeigdeihecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd 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: 188.165.56.124 Subject: [Qemu-devel] [PATCH v4 13/26] 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 97775c2b61e5..76b50dc7722a 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 1706d52adec1..70b9618309fc 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -123,7 +123,6 @@ static XICSState *try_create_xics(sPAPRMachineState *sp= apr, if (err) { goto error; } - QLIST_INSERT_HEAD(&xics->ics, 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 db2bb04de831..15c52f9d9eda 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -83,7 +83,6 @@ struct XICSState { /*< public >*/ uint32_t nr_servers; ICPState *ss; - QLIST_HEAD(, ICSState) ics; }; =20 #define TYPE_ICP "icp" @@ -154,7 +153,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 Fri May 17 06:53:57 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 1488210039272761.1272722562597; Mon, 27 Feb 2017 07:40:39 -0800 (PST) Received: from localhost ([::1]:53733 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciNPg-00038f-UF for importer@patchew.org; Mon, 27 Feb 2017 10:40:37 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38384) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMKe-0001gY-AC for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:31:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciMKa-0007uh-Bs for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:31:20 -0500 Received: from 12.mo6.mail-out.ovh.net ([178.32.125.228]:59304) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ciMKa-0007ub-5P for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:31:16 -0500 Received: from player761.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo6.mail-out.ovh.net (Postfix) with ESMTP id B9A0CAE5F1 for ; Mon, 27 Feb 2017 15:31:14 +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 player761.ha.ovh.net (Postfix) with ESMTPSA id CCDC44800B7; Mon, 27 Feb 2017 15:30:43 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Mon, 27 Feb 2017 15:29:21 +0100 Message-Id: <1488205773-30436-15-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488205773-30436-1-git-send-email-clg@kaod.org> References: <1488205773-30436-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 4041980667115310054 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrvdeigdeihecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd 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.125.228 Subject: [Qemu-devel] [PATCH v4 14/26] 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. The icp_resend() handler is a temporary workaround needed by the ics-simple post_load() handler. It will be removed when the post_load portion can be done at the machine level. 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 76b50dc7722a..f828bcb07026 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(ICPState *ss) +void icp_resend(ICPState *ss) { XICSFabric *xi =3D ss->xics; XICSFabricClass *xic =3D XICS_FABRIC_GET_CLASS(xi); diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 70b9618309fc..7273157ad50e 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2928,6 +2928,24 @@ static void spapr_ics_resend(XICSFabric *dev) ics_resend(spapr->ics); } =20 +static ICPState *spapr_icp_get(XICSFabric *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(XICSFabric *xi) +{ + sPAPRMachineState *spapr =3D SPAPR_MACHINE(xi); + int i; + + for (i =3D 0; i < spapr->xics->nr_servers; i++) { + icp_resend(&spapr->xics->ss[i]); + } +} + static void spapr_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc =3D MACHINE_CLASS(oc); @@ -2972,6 +2990,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 15c52f9d9eda..01ca5e2dab50 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -193,6 +193,8 @@ typedef struct XICSFabricClass { InterfaceClass parent; ICSState *(*ics_get)(XICSFabric *xi, int irq); void (*ics_resend)(XICSFabric *xi); + ICPState *(*icp_get)(XICSFabric *xi, int server); + void (*icp_resend)(XICSFabric *xi); } XICSFabricClass; =20 #define XICS_IRQS_SPAPR 1024 @@ -223,5 +225,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(ICPState *ss); =20 #endif /* XICS_H */ --=20 2.7.4 From nobody Fri May 17 06:53:57 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 1488208140273516.7902532447793; Mon, 27 Feb 2017 07:09:00 -0800 (PST) Received: from localhost ([::1]:53471 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMv4-00005N-To for importer@patchew.org; Mon, 27 Feb 2017 10:08:58 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38459) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMKp-0001rB-JN for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:31:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciMKl-0007xj-LO for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:31:31 -0500 Received: from 20.mo6.mail-out.ovh.net ([178.32.124.17]:39657) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ciMKl-0007xS-F1 for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:31:27 -0500 Received: from player761.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo6.mail-out.ovh.net (Postfix) with ESMTP id 6BEA39BE0A for ; Mon, 27 Feb 2017 15:31: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 player761.ha.ovh.net (Postfix) with ESMTPSA id D9CA54800A6; Mon, 27 Feb 2017 15:30:48 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Mon, 27 Feb 2017 15:29:22 +0100 Message-Id: <1488205773-30436-16-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488205773-30436-1-git-send-email-clg@kaod.org> References: <1488205773-30436-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 4043388044165680102 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrvdeigdeihecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd 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.124.17 Subject: [Qemu-devel] [PATCH v4 15/26] 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 2d08c4071d3f..86ddf470e546 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)); @@ -328,14 +328,13 @@ static void xics_kvm_cpu_setup(XICSState *xics, Power= PCCPU *cpu) { CPUState *cs; ICPState *ss; - KVMXICSState *xicskvm =3D XICS_SPAPR_KVM(xics); int ret; =20 cs =3D CPU(cpu); ss =3D &xics->ss[cs->cpu_index]; =20 assert(cs->cpu_index < xics->nr_servers); - if (xicskvm->kernel_xics_fd =3D=3D -1) { + if (kernel_xics_fd =3D=3D -1) { abort(); } =20 @@ -348,7 +347,7 @@ static void xics_kvm_cpu_setup(XICSState *xics, PowerPC= CPU *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", @@ -369,7 +368,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, @@ -418,7 +416,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 Fri May 17 06:53:57 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 1488208079259348.8741419384986; Mon, 27 Feb 2017 07:07:59 -0800 (PST) Received: from localhost ([::1]:53468 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMu3-0007gq-R2 for importer@patchew.org; Mon, 27 Feb 2017 10:07:55 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38539) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciML0-00020g-Pk for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:31:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciMKw-00081J-Rl for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:31:42 -0500 Received: from 9.mo6.mail-out.ovh.net ([87.98.171.146]:39543) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ciMKw-000812-Mb for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:31:38 -0500 Received: from player761.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo6.mail-out.ovh.net (Postfix) with ESMTP id 73B8AA528F for ; Mon, 27 Feb 2017 15:31: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 player761.ha.ovh.net (Postfix) with ESMTPSA id 852AE4800BB; Mon, 27 Feb 2017 15:30:53 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Mon, 27 Feb 2017 15:29:23 +0100 Message-Id: <1488205773-30436-17-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488205773-30436-1-git-send-email-clg@kaod.org> References: <1488205773-30436-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 4044795417520540646 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrvdeigdeihecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd 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: 87.98.171.146 Subject: [Qemu-devel] [PATCH v4 16/26] 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 | 9 ++------- include/hw/ppc/xics.h | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index f828bcb07026..a5be0d83cf36 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(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 86ddf470e546..7588280b5d69 100644 --- a/hw/intc/xics_kvm.c +++ b/hw/intc/xics_kvm.c @@ -324,16 +324,11 @@ 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; + CPUState *cs =3D CPU(cpu); int ret; =20 - cs =3D CPU(cpu); - ss =3D &xics->ss[cs->cpu_index]; - - assert(cs->cpu_index < xics->nr_servers); if (kernel_xics_fd =3D=3D -1) { abort(); } diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index 01ca5e2dab50..8325dbdaf104 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -74,7 +74,7 @@ typedef struct XICSFabric XICSFabric; 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 Fri May 17 06:53:57 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 1488207407495468.8400564573319; Mon, 27 Feb 2017 06:56:47 -0800 (PST) Received: from localhost ([::1]:53402 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMjG-00068F-7B for importer@patchew.org; Mon, 27 Feb 2017 09:56:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38702) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMLS-0002aZ-N5 for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:32:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciMLO-00088z-OE for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:32:10 -0500 Received: from 12.mo6.mail-out.ovh.net ([178.32.125.228]:50646) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ciMLO-00088X-HM for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:32:06 -0500 Received: from player761.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo6.mail-out.ovh.net (Postfix) with ESMTP id 44AB8B31FC for ; Mon, 27 Feb 2017 15:32:05 +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 player761.ha.ovh.net (Postfix) with ESMTPSA id 1ABAE4800CB; Mon, 27 Feb 2017 15:30:58 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Mon, 27 Feb 2017 15:29:24 +0100 Message-Id: <1488205773-30436-18-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488205773-30436-1-git-send-email-clg@kaod.org> References: <1488205773-30436-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 4045921317311974374 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrvdeigdeihecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd 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.125.228 Subject: [Qemu-devel] [PATCH v4 17/26] 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 currently under the XICSState class but it really belongs under ICPState as it is setting up an individual vCPU. 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 a5be0d83cf36..674ac4c91b77 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -66,15 +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; + ICPStateClass *icpc; =20 assert(cs->cpu_index < xics->nr_servers); =20 ss->cs =3D cs; =20 - info =3D XICS_COMMON_GET_CLASS(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 7588280b5d69..07298b09712d 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 { @@ -324,33 +353,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, @@ -429,10 +431,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 8325dbdaf104..d17f62c5cc82 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -73,8 +73,6 @@ typedef struct XICSFabric XICSFabric; =20 struct XICSStateClass { DeviceClass parent_class; - - void (*cpu_setup)(ICPState *icp, PowerPCCPU *cpu); }; =20 struct XICSState { @@ -101,6 +99,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 Fri May 17 06:53:57 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 1488208353038133.80937633027304; Mon, 27 Feb 2017 07:12:33 -0800 (PST) Received: from localhost ([::1]:53500 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMyV-0003NM-Fl for importer@patchew.org; Mon, 27 Feb 2017 10:12:31 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38805) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMLm-0002rZ-0d for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:32:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciMLi-0008D1-0V for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:32:30 -0500 Received: from 19.mo6.mail-out.ovh.net ([188.165.56.177]:58928) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ciMLh-0008CU-Nl for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:32:25 -0500 Received: from player761.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo6.mail-out.ovh.net (Postfix) with ESMTP id BC294A7B9D for ; Mon, 27 Feb 2017 15:32:21 +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 player761.ha.ovh.net (Postfix) with ESMTPSA id 46E1648008F; Mon, 27 Feb 2017 15:31:02 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Mon, 27 Feb 2017 15:29:25 +0100 Message-Id: <1488205773-30436-19-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488205773-30436-1-git-send-email-clg@kaod.org> References: <1488205773-30436-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 4047047216755018726 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrvdeigdeihecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd 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: 188.165.56.177 Subject: [Qemu-devel] [PATCH v4 18/26] 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 --- Changes since v3: - changed ICSState 'xics' backlink to be a XICSFabric. hw/intc/xics.c | 32 ++++++++++++++++++-------------- hw/intc/xics_spapr.c | 17 +++++++++-------- hw/ppc/spapr.c | 2 +- hw/ppc/spapr_cpu_core.c | 4 ++-- include/hw/ppc/xics.h | 10 +++++----- 5 files changed, 35 insertions(+), 30 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 674ac4c91b77..ddb0a6f48b5c 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(XICSFabric *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(XICSFabric *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); ICPStateClass *icpc; =20 - assert(cs->cpu_index < xics->nr_servers); + assert(ss); =20 ss->cs =3D cs; =20 @@ -308,8 +308,7 @@ 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; + ICPState *ss =3D xics_icp_get(ics->xics, server); =20 trace_xics_icp_irq(server, nr, priority); =20 @@ -582,12 +581,10 @@ static void ics_simple_reset(DeviceState *dev) =20 static int ics_simple_post_load(ICSState *ics, int version_id) { - int i; - - for (i =3D 0; i < ics->xics->nr_servers; i++) { - icp_resend(&ics->xics->ss[i]); - } + XICSFabric *xi =3D ics->xics; + XICSFabricClass *xic =3D XICS_FABRIC_GET_CLASS(xi); =20 + xic->icp_resend(xi); return 0; } =20 @@ -711,7 +708,7 @@ static void ics_base_realize(DeviceState *dev, Error **= errp) __func__, error_get_pretty(err)); return; } - ics->xics =3D XICS_COMMON(obj); + ics->xics =3D XICS_FABRIC(obj); =20 =20 if (icsc->realize) { @@ -756,6 +753,13 @@ qemu_irq xics_get_qirq(XICSFabric *xi, int irq) return NULL; } =20 +ICPState *xics_icp_get(XICSFabric *xi, int server) +{ + XICSFabricClass *xic =3D XICS_FABRIC_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..bc62b0ccc254 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_FABRIC(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_FABRIC(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_FABRIC(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_FABRIC(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_FABRIC(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_FABRIC(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_FABRIC(spapr), serve= r) || (priority > 0xff)) { rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR); return; diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 7273157ad50e..309b9ff91563 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -117,7 +117,7 @@ static XICSState *try_create_xics(sPAPRMachineState *sp= apr, qdev_set_parent_bus(DEVICE(ics), sysbus_get_default()); object_property_add_child(OBJECT(spapr), "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_add_const_link(OBJECT(ics), "xics", OBJECT(xi), NULL); object_property_set_bool(OBJECT(ics), true, "realized", &local_err); error_propagate(&err, local_err); if (err) { diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c index 55cd0456ebe8..befe53a65863 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_FABRIC(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_FABRIC(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 d17f62c5cc82..c57e80e4187b 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -151,7 +151,7 @@ struct ICSState { uint32_t offset; qemu_irq *qirqs; ICSIRQState *irqs; - XICSState *xics; + XICSFabric *xics; }; =20 static inline bool ics_valid_irq(ICSState *ics, uint32_t nr) @@ -198,16 +198,16 @@ typedef struct XICSFabricClass { =20 #define XICS_IRQS_SPAPR 1024 =20 -qemu_irq xics_get_qirq(XICSFabric *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(XICSFabric *xi, int irq); +ICPState *xics_icp_get(XICSFabric *xi, int server); +void xics_cpu_setup(XICSFabric *xi, PowerPCCPU *cpu); +void xics_cpu_destroy(XICSFabric *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 Fri May 17 06:53:57 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 148820861269082.03649867335776; Mon, 27 Feb 2017 07:16:52 -0800 (PST) Received: from localhost ([::1]:53532 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciN2g-00073q-BN for importer@patchew.org; Mon, 27 Feb 2017 10:16:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38829) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMLn-0002u9-QR for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:32:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciMLj-0008Dr-Le for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:32:31 -0500 Received: from 16.mo6.mail-out.ovh.net ([87.98.139.208]:35897) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ciMLj-0008D6-GQ for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:32:27 -0500 Received: from player761.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo6.mail-out.ovh.net (Postfix) with ESMTP id 1C79EB34AD for ; Mon, 27 Feb 2017 15:32: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 player761.ha.ovh.net (Postfix) with ESMTPSA id 707EB4800A9; Mon, 27 Feb 2017 15:31:06 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Mon, 27 Feb 2017 15:29:26 +0100 Message-Id: <1488205773-30436-20-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488205773-30436-1-git-send-email-clg@kaod.org> References: <1488205773-30436-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 4048454593175587814 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrvdeigdeihecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd 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: 87.98.139.208 Subject: [Qemu-devel] [PATCH v4 19/26] 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 bc62b0ccc254..35045a20b860 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 309b9ff91563..aa62292c8c90 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -966,7 +966,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 c57e80e4187b..f618848009cf 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -202,7 +202,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(XICSFabric *xi, int irq); ICPState *xics_icp_get(XICSFabric *xi, int server); --=20 2.7.4 From nobody Fri May 17 06:53:57 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 1488207654243345.6398787311665; Mon, 27 Feb 2017 07:00:54 -0800 (PST) Received: from localhost ([::1]:53429 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMnC-0001at-UM for importer@patchew.org; Mon, 27 Feb 2017 10:00:51 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38841) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMLp-0002vP-BN for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:32:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciMLl-0008ER-CX for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:32:33 -0500 Received: from 5.mo6.mail-out.ovh.net ([46.105.54.31]:56011) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ciMLl-0008EA-5z for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:32:29 -0500 Received: from player761.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo6.mail-out.ovh.net (Postfix) with ESMTP id D90D2B319A for ; Mon, 27 Feb 2017 15:32:27 +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 player761.ha.ovh.net (Postfix) with ESMTPSA id 66EBA4800E7; Mon, 27 Feb 2017 15:31:11 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Mon, 27 Feb 2017 15:29:27 +0100 Message-Id: <1488205773-30436-21-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488205773-30436-1-git-send-email-clg@kaod.org> References: <1488205773-30436-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 4049580490699082726 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrvdeigdeihecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd 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.54.31 Subject: [Qemu-devel] [PATCH v4 20/26] 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 ddb0a6f48b5c..51e6c0c85fca 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 aa62292c8c90..88539557abd3 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -131,6 +131,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(xi), NU= LL); object_property_set_bool(OBJECT(icp), true, "realized", &err); --=20 2.7.4 From nobody Fri May 17 06:53:57 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 148820839576646.756431172008774; Mon, 27 Feb 2017 07:13:15 -0800 (PST) Received: from localhost ([::1]:53503 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMzA-0003xU-5j for importer@patchew.org; Mon, 27 Feb 2017 10:13:12 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38891) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMLt-0002xd-56 for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:32:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciMLp-0008GZ-5p for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:32:37 -0500 Received: from 1.mo6.mail-out.ovh.net ([46.105.56.136]:35072) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ciMLo-0008GP-W7 for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:32:33 -0500 Received: from player761.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo6.mail-out.ovh.net (Postfix) with ESMTP id D3313B34FD for ; Mon, 27 Feb 2017 15:32:31 +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 player761.ha.ovh.net (Postfix) with ESMTPSA id 8BD0D4800B3; Mon, 27 Feb 2017 15:31:15 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Mon, 27 Feb 2017 15:29:28 +0100 Message-Id: <1488205773-30436-22-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488205773-30436-1-git-send-email-clg@kaod.org> References: <1488205773-30436-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 4050706393971330022 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrvdeigdeihecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd 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.56.136 Subject: [Qemu-devel] [PATCH v4 21/26] 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" This is the last step to remove the XICSState abstraction and have the machine hold all the objects related to interrupts : ICSs and ICPs. 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 88539557abd3..358bdec7d2ad 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -124,15 +124,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(xi), NU= LL); object_property_set_bool(OBJECT(icp), true, "realized", &err); if (err) { @@ -967,7 +967,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) { @@ -2933,8 +2933,7 @@ static ICPState *spapr_icp_get(XICSFabric *xi, int se= rver) { 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(XICSFabric *xi) @@ -2942,8 +2941,8 @@ static void spapr_icp_resend(XICSFabric *xi) sPAPRMachineState *spapr =3D SPAPR_MACHINE(xi); int i; =20 - for (i =3D 0; i < spapr->xics->nr_servers; i++) { - icp_resend(&spapr->xics->ss[i]); + for (i =3D 0; i < spapr->nr_servers; i++) { + icp_resend(&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 f618848009cf..50a5933df535 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -79,8 +79,6 @@ struct XICSState { /*< private >*/ DeviceState parent_obj; /*< public >*/ - uint32_t nr_servers; - ICPState *ss; }; =20 #define TYPE_ICP "icp" --=20 2.7.4 From nobody Fri May 17 06:53:57 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 1488207926558944.876296118615; Mon, 27 Feb 2017 07:05:26 -0800 (PST) Received: from localhost ([::1]:53449 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMrc-0005Tn-3O for importer@patchew.org; Mon, 27 Feb 2017 10:05:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38941) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMLv-0002y5-D9 for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:32:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciMLr-0008HW-ES for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:32:39 -0500 Received: from 2.mo6.mail-out.ovh.net ([46.105.76.65]:41934) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ciMLr-0008H7-7P for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:32:35 -0500 Received: from player761.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo6.mail-out.ovh.net (Postfix) with ESMTP id 32A82B35F2 for ; Mon, 27 Feb 2017 15:32: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 player761.ha.ovh.net (Postfix) with ESMTPSA id B3B044800F1; Mon, 27 Feb 2017 15:31:19 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Mon, 27 Feb 2017 15:29:29 +0100 Message-Id: <1488205773-30436-23-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488205773-30436-1-git-send-email-clg@kaod.org> References: <1488205773-30436-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 4051832291063466982 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrvdeigdeihecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd 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.76.65 Subject: [Qemu-devel] [PATCH v4 22/26] 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 07298b09712d..99836112cd12 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 35045a20b860..aaf6808cd220 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 358bdec7d2ad..3caef0c7e683 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -161,7 +161,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= ); @@ -175,6 +176,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 50a5933df535..b0b01e2975df 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -224,4 +224,9 @@ void ics_set_irq_type(ICSState *ics, int srcno, bool ls= i); void ics_resend(ICSState *ics); void icp_resend(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 Fri May 17 06:53:57 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 1488208195675552.1940226968711; Mon, 27 Feb 2017 07:09:55 -0800 (PST) Received: from localhost ([::1]:53481 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMvv-0000rN-8b for importer@patchew.org; Mon, 27 Feb 2017 10:09:51 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39018) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMLz-00032P-S9 for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:32:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciMLv-0008Jb-Ru for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:32:43 -0500 Received: from 17.mo6.mail-out.ovh.net ([46.105.36.150]:58180) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ciMLv-0008Iw-Iu for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:32:39 -0500 Received: from player761.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo6.mail-out.ovh.net (Postfix) with ESMTP id 5950CB35D7 for ; Mon, 27 Feb 2017 15:32: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 player761.ha.ovh.net (Postfix) with ESMTPSA id DA6CC4800FE; Mon, 27 Feb 2017 15:31:23 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Mon, 27 Feb 2017 15:29:30 +0100 Message-Id: <1488205773-30436-24-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488205773-30436-1-git-send-email-clg@kaod.org> References: <1488205773-30436-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 4053521139854576614 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrvdeigdeihecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd 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.36.150 Subject: [Qemu-devel] [PATCH v4 23/26] 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" The XICSState classes are not used anymore. They have now been fully deprecated by the XICSFabric 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 | 45 ++++++++++++++++----------------------------- include/hw/ppc/spapr.h | 1 - include/hw/ppc/xics.h | 35 ----------------------------------- 6 files changed, 16 insertions(+), 103 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 51e6c0c85fca..159cd131420a 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 @@ -752,7 +742,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 99836112cd12..14de5d4bb8cc 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 aaf6808cd220..84d24b2837a7 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 3caef0c7e683..1d0daef5ad3e 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -95,24 +95,15 @@ =20 #define HTAB_SIZE(spapr) (1ULL << ((spapr)->htab_shift)) =20 -static XICSState *try_create_xics(sPAPRMachineState *spapr, - const char *type, const char *type_ics, - const char *type_icp, int nr_servers, - int nr_irqs, Error **errp) +static int try_create_xics(sPAPRMachineState *spapr, const char *type_ics, + const char *type_icp, int nr_servers, + int nr_irqs, Error **errp) { XICSFabric *xi =3D XICS_FABRIC(spapr); 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_bool(OBJECT(xics), true, "realized", &err); - if (err) { - goto error; - } - ics =3D ICS_SIMPLE(object_new(type_ics)); qdev_set_parent_bus(DEVICE(ics), sysbus_get_default()); object_property_add_child(OBJECT(spapr), "ics", OBJECT(ics), NULL); @@ -142,32 +133,30 @@ static XICSState *try_create_xics(sPAPRMachineState *= spapr, } =20 spapr->ics =3D ics; - return xics; + return 0; =20 error: error_propagate(errp, err); if (ics) { object_unparent(OBJECT(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, - TYPE_KVM_ICP, nr_servers, nr_irqs, &err= ); + 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 { @@ -175,14 +164,13 @@ 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, @@ -1947,9 +1935,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 b0b01e2975df..2514cfd86ea9 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,8 +39,6 @@ * (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; @@ -71,16 +46,6 @@ typedef struct ICSState ICSState; typedef struct ICSIRQState ICSIRQState; typedef struct XICSFabric XICSFabric; =20 -struct XICSStateClass { - DeviceClass parent_class; -}; - -struct XICSState { - /*< private >*/ - DeviceState parent_obj; - /*< public >*/ -}; - #define TYPE_ICP "icp" #define ICP(obj) OBJECT_CHECK(ICPState, (obj), TYPE_ICP) =20 --=20 2.7.4 From nobody Fri May 17 06:53:57 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 1488208971282621.8157134060806; Mon, 27 Feb 2017 07:22:51 -0800 (PST) Received: from localhost ([::1]:53571 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciN8T-0004B7-12 for importer@patchew.org; Mon, 27 Feb 2017 10:22:49 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39024) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMM0-00032w-FV for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:32:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciMLw-0008K1-RO for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:32:44 -0500 Received: from 9.mo6.mail-out.ovh.net ([87.98.171.146]:57243) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ciMLw-0008Jf-Kb for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:32:40 -0500 Received: from player761.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo6.mail-out.ovh.net (Postfix) with ESMTP id 87392B33D4 for ; Mon, 27 Feb 2017 15:32:39 +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 player761.ha.ovh.net (Postfix) with ESMTPSA id 1E5E94800C7; Mon, 27 Feb 2017 15:31:29 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Mon, 27 Feb 2017 15:29:31 +0100 Message-Id: <1488205773-30436-25-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488205773-30436-1-git-send-email-clg@kaod.org> References: <1488205773-30436-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 4054647041003785190 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrvdeigdeihecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd 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: 87.98.171.146 Subject: [Qemu-devel] [PATCH v4 24/26] ppc/xics: move ics-simple post_load under the 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" The ICS object uses a post_load() handler which is implicitly relying on the fact that the internal state of the ICS and ICP objects has been restored but this is not guaranteed. So, let's move the code under the post_load() handler of the machine where we know the objects have been fully restored. The icp_resend() handler of the XICSFabric QOM interface is also removed as it is now obsolete. Signed-off-by: C=C3=A9dric Le Goater --- hw/intc/xics.c | 10 ---------- hw/ppc/spapr.c | 18 +++++++----------- include/hw/ppc/xics.h | 1 - 3 files changed, 7 insertions(+), 22 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 159cd131420a..ce6e8d75b891 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -551,15 +551,6 @@ static void ics_simple_reset(DeviceState *dev) } } =20 -static int ics_simple_post_load(ICSState *ics, int version_id) -{ - XICSFabric *xi =3D ics->xics; - XICSFabricClass *xic =3D XICS_FABRIC_GET_CLASS(xi); - - xic->icp_resend(xi); - return 0; -} - static void ics_simple_dispatch_pre_save(void *opaque) { ICSState *ics =3D opaque; @@ -647,7 +638,6 @@ static void ics_simple_class_init(ObjectClass *klass, v= oid *data) 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; isc->reject =3D ics_simple_reject; isc->resend =3D ics_simple_resend; isc->eoi =3D ics_simple_eoi; diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 1d0daef5ad3e..e097ff8de1a4 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1285,6 +1285,13 @@ static int spapr_post_load(void *opaque, int version= _id) sPAPRMachineState *spapr =3D (sPAPRMachineState *)opaque; int err =3D 0; =20 + if (!object_dynamic_cast(OBJECT(spapr->ics), TYPE_ICS_KVM)) { + int i; + for (i =3D 0; i < spapr->nr_servers; i++) { + icp_resend(&spapr->icps[i]); + } + } + /* In earlier versions, there was no separate qdev for the PAPR * RTC, so the RTC offset was stored directly in sPAPREnvironment. * So when migrating from those versions, poke the incoming offset @@ -2925,16 +2932,6 @@ static ICPState *spapr_icp_get(XICSFabric *xi, int s= erver) return (server < spapr->nr_servers) ? &spapr->icps[server] : NULL; } =20 -static void spapr_icp_resend(XICSFabric *xi) -{ - sPAPRMachineState *spapr =3D SPAPR_MACHINE(xi); - int i; - - for (i =3D 0; i < spapr->nr_servers; i++) { - icp_resend(&spapr->icps[i]); - } -} - static void spapr_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc =3D MACHINE_CLASS(oc); @@ -2980,7 +2977,6 @@ static void spapr_machine_class_init(ObjectClass *oc,= void *data) 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 2514cfd86ea9..007ee2f16d16 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -156,7 +156,6 @@ typedef struct XICSFabricClass { ICSState *(*ics_get)(XICSFabric *xi, int irq); void (*ics_resend)(XICSFabric *xi); ICPState *(*icp_get)(XICSFabric *xi, int server); - void (*icp_resend)(XICSFabric *xi); } XICSFabricClass; =20 #define XICS_IRQS_SPAPR 1024 --=20 2.7.4 From nobody Fri May 17 06:53:57 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 1488208711643425.99986084373654; Mon, 27 Feb 2017 07:18:31 -0800 (PST) Received: from localhost ([::1]:53542 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciN4F-0000HD-Od for importer@patchew.org; Mon, 27 Feb 2017 10:18:27 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39068) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMM2-00033H-D5 for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:32:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciMLy-0008Kr-DM for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:32:46 -0500 Received: from 20.mo6.mail-out.ovh.net ([178.32.124.17]:49959) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ciMLy-0008KK-3C for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:32:42 -0500 Received: from player761.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo6.mail-out.ovh.net (Postfix) with ESMTP id E9B13B34FD for ; Mon, 27 Feb 2017 15:32: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 player761.ha.ovh.net (Postfix) with ESMTPSA id 08F134800A6; Mon, 27 Feb 2017 15:31:34 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Mon, 27 Feb 2017 15:29:32 +0100 Message-Id: <1488205773-30436-26-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488205773-30436-1-git-send-email-clg@kaod.org> References: <1488205773-30436-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 4056054417291774950 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrvdeigdeihecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd 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.124.17 Subject: [Qemu-devel] [PATCH v4 25/26] ppc/xics: move InterruptStatsProvider to 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" It provides a better monitor output of the ICP and ICS objects, else the objects are printed out of order. Signed-off-by: C=C3=A9dric Le Goater --- hw/intc/xics.c | 20 ++------------------ hw/ppc/spapr.c | 17 +++++++++++++++++ include/hw/ppc/xics.h | 2 ++ 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index ce6e8d75b891..5bcb9550abb5 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -93,10 +93,8 @@ void xics_cpu_setup(XICSFabric *xi, PowerPCCPU *cpu) } } =20 -static void icp_pic_print_info(InterruptStatsProvider *obj, - Monitor *mon) +void icp_pic_print_info(ICPState *icp, Monitor *mon) { - ICPState *icp =3D ICP(obj); int cpu_index =3D icp->cs ? icp->cs->cpu_index : -1; =20 if (!icp->output) { @@ -107,10 +105,8 @@ static void icp_pic_print_info(InterruptStatsProvider = *obj, icp->pending_priority, icp->mfrr); } =20 -static void ics_simple_pic_print_info(InterruptStatsProvider *obj, - Monitor *mon) +void ics_pic_print_info(ICSState *ics, Monitor *mon) { - ICSState *ics =3D ICS_SIMPLE(obj); uint32_t i; =20 monitor_printf(mon, "ICS %4x..%4x %p\n", @@ -369,12 +365,10 @@ 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 { @@ -383,10 +377,6 @@ 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 /* @@ -632,7 +622,6 @@ 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 isc->realize =3D ics_simple_realize; dc->props =3D ics_simple_properties; @@ -641,7 +630,6 @@ 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 { @@ -651,10 +639,6 @@ 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 void ics_base_realize(DeviceState *dev, Error **errp) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index e097ff8de1a4..69a6bed09fef 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -63,6 +63,7 @@ #include "qemu/error-report.h" #include "trace.h" #include "hw/nmi.h" +#include "hw/intc/intc.h" =20 #include "hw/compat.h" #include "qemu/cutils.h" @@ -2932,6 +2933,19 @@ static ICPState *spapr_icp_get(XICSFabric *xi, int s= erver) return (server < spapr->nr_servers) ? &spapr->icps[server] : NULL; } =20 +static void spapr_pic_print_info(InterruptStatsProvider *obj, + Monitor *mon) +{ + sPAPRMachineState *spapr =3D SPAPR_MACHINE(obj); + int i; + + for (i =3D 0; i < spapr->nr_servers; i++) { + icp_pic_print_info(&spapr->icps[i], mon); + } + + ics_pic_print_info(spapr->ics, mon); +} + static void spapr_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc =3D MACHINE_CLASS(oc); @@ -2941,6 +2955,7 @@ static void spapr_machine_class_init(ObjectClass *oc,= void *data) HotplugHandlerClass *hc =3D HOTPLUG_HANDLER_CLASS(oc); PPCVirtualHypervisorClass *vhc =3D PPC_VIRTUAL_HYPERVISOR_CLASS(oc); XICSFabricClass *xic =3D XICS_FABRIC_CLASS(oc); + InterruptStatsProviderClass *ispc =3D INTERRUPT_STATS_PROVIDER_CLASS(o= c); =20 mc->desc =3D "pSeries Logical Partition (PAPR compliant)"; =20 @@ -2977,6 +2992,7 @@ static void spapr_machine_class_init(ObjectClass *oc,= void *data) xic->ics_get =3D spapr_ics_get; xic->ics_resend =3D spapr_ics_resend; xic->icp_get =3D spapr_icp_get; + ispc->print_info =3D spapr_pic_print_info; } =20 static const TypeInfo spapr_machine_info =3D { @@ -2994,6 +3010,7 @@ static const TypeInfo spapr_machine_info =3D { { TYPE_HOTPLUG_HANDLER }, { TYPE_PPC_VIRTUAL_HYPERVISOR }, { TYPE_XICS_FABRIC }, + { TYPE_INTERRUPT_STATS_PROVIDER }, { } }, }; diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index 007ee2f16d16..1945913bf1c9 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -184,6 +184,8 @@ void ics_simple_write_xive(ICSState *ics, int nr, int s= erver, uint8_t priority, uint8_t saved_priority); =20 void ics_set_irq_type(ICSState *ics, int srcno, bool lsi); +void icp_pic_print_info(ICPState *icp, Monitor *mon); +void ics_pic_print_info(ICSState *ics, Monitor *mon); =20 void ics_resend(ICSState *ics); void icp_resend(ICPState *ss); --=20 2.7.4 From nobody Fri May 17 06:53:57 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 1488208951257315.9996031044907; Mon, 27 Feb 2017 07:22:31 -0800 (PST) Received: from localhost ([::1]:53568 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciN89-0003oO-Ni for importer@patchew.org; Mon, 27 Feb 2017 10:22:29 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39075) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciMM3-00033O-Jx for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:32:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciMLz-0008LQ-Ii for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:32:47 -0500 Received: from 13.mo6.mail-out.ovh.net ([188.165.56.124]:44047) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ciMLz-0008Ky-9W for qemu-devel@nongnu.org; Mon, 27 Feb 2017 09:32:43 -0500 Received: from player761.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo6.mail-out.ovh.net (Postfix) with ESMTP id 018D3B38EF for ; Mon, 27 Feb 2017 15:32:41 +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 player761.ha.ovh.net (Postfix) with ESMTPSA id 38F774800BF; Mon, 27 Feb 2017 15:31:38 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Mon, 27 Feb 2017 15:29:33 +0100 Message-Id: <1488205773-30436-27-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488205773-30436-1-git-send-email-clg@kaod.org> References: <1488205773-30436-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 4057461790551935974 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrvdeigdeihecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd 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: 188.165.56.124 Subject: [Qemu-devel] [PATCH v4 26/26] ppc/xics: rename 'ICPState *' variables to '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" 'ICPState *' variables are currently named 'ss'. This is confusing, so let's give them an appropriate name: 'icp'. Signed-off-by: C=C3=A9dric Le Goater --- hw/intc/xics.c | 154 ++++++++++++++++++++++++++-----------------------= ---- hw/intc/xics_kvm.c | 34 ++++++------ 2 files changed, 94 insertions(+), 94 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 5bcb9550abb5..ffc0747c7fa2 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -52,38 +52,38 @@ int xics_get_cpu_index_by_dt_id(int cpu_dt_id) void xics_cpu_destroy(XICSFabric *xi, PowerPCCPU *cpu) { CPUState *cs =3D CPU(cpu); - ICPState *ss =3D xics_icp_get(xi, cs->cpu_index); + ICPState *icp =3D xics_icp_get(xi, cs->cpu_index); =20 - assert(ss); - assert(cs =3D=3D ss->cs); + assert(icp); + assert(cs =3D=3D icp->cs); =20 - ss->output =3D NULL; - ss->cs =3D NULL; + icp->output =3D NULL; + icp->cs =3D NULL; } =20 void xics_cpu_setup(XICSFabric *xi, PowerPCCPU *cpu) { CPUState *cs =3D CPU(cpu); CPUPPCState *env =3D &cpu->env; - ICPState *ss =3D xics_icp_get(xi, cs->cpu_index); + ICPState *icp =3D xics_icp_get(xi, cs->cpu_index); ICPStateClass *icpc; =20 - assert(ss); + assert(icp); =20 - ss->cs =3D cs; + icp->cs =3D cs; =20 - icpc =3D ICP_GET_CLASS(ss); + icpc =3D ICP_GET_CLASS(icp); if (icpc->cpu_setup) { - icpc->cpu_setup(ss, cpu); + icpc->cpu_setup(icp, cpu); } =20 switch (PPC_INPUT(env)) { case PPC_FLAGS_INPUT_POWER7: - ss->output =3D env->irq_inputs[POWER7_INPUT_INT]; + icp->output =3D env->irq_inputs[POWER7_INPUT_INT]; break; =20 case PPC_FLAGS_INPUT_970: - ss->output =3D env->irq_inputs[PPC970_INPUT_INT]; + icp->output =3D env->irq_inputs[PPC970_INPUT_INT]; break; =20 default: @@ -137,8 +137,8 @@ void ics_pic_print_info(ICSState *ics, Monitor *mon) #define XISR_MASK 0x00ffffff #define CPPR_MASK 0xff000000 =20 -#define XISR(ss) (((ss)->xirr) & XISR_MASK) -#define CPPR(ss) (((ss)->xirr) >> 24) +#define XISR(icp) (((icp)->xirr) & XISR_MASK) +#define CPPR(icp) (((icp)->xirr) >> 24) =20 static void ics_reject(ICSState *ics, uint32_t nr) { @@ -167,152 +167,152 @@ static void ics_eoi(ICSState *ics, int nr) } } =20 -static void icp_check_ipi(ICPState *ss) +static void icp_check_ipi(ICPState *icp) { - if (XISR(ss) && (ss->pending_priority <=3D ss->mfrr)) { + if (XISR(icp) && (icp->pending_priority <=3D icp->mfrr)) { return; } =20 - trace_xics_icp_check_ipi(ss->cs->cpu_index, ss->mfrr); + trace_xics_icp_check_ipi(icp->cs->cpu_index, icp->mfrr); =20 - if (XISR(ss) && ss->xirr_owner) { - ics_reject(ss->xirr_owner, XISR(ss)); + if (XISR(icp) && icp->xirr_owner) { + ics_reject(icp->xirr_owner, XISR(icp)); } =20 - ss->xirr =3D (ss->xirr & ~XISR_MASK) | XICS_IPI; - ss->pending_priority =3D ss->mfrr; - ss->xirr_owner =3D NULL; - qemu_irq_raise(ss->output); + icp->xirr =3D (icp->xirr & ~XISR_MASK) | XICS_IPI; + icp->pending_priority =3D icp->mfrr; + icp->xirr_owner =3D NULL; + qemu_irq_raise(icp->output); } =20 -void icp_resend(ICPState *ss) +void icp_resend(ICPState *icp) { - XICSFabric *xi =3D ss->xics; + XICSFabric *xi =3D icp->xics; XICSFabricClass *xic =3D XICS_FABRIC_GET_CLASS(xi); =20 - if (ss->mfrr < CPPR(ss)) { - icp_check_ipi(ss); + if (icp->mfrr < CPPR(icp)) { + icp_check_ipi(icp); } =20 xic->ics_resend(xi); } =20 -void icp_set_cppr(ICPState *ss, uint8_t cppr) +void icp_set_cppr(ICPState *icp, uint8_t cppr) { uint8_t old_cppr; uint32_t old_xisr; =20 - old_cppr =3D CPPR(ss); - ss->xirr =3D (ss->xirr & ~CPPR_MASK) | (cppr << 24); + old_cppr =3D CPPR(icp); + icp->xirr =3D (icp->xirr & ~CPPR_MASK) | (cppr << 24); =20 if (cppr < old_cppr) { - if (XISR(ss) && (cppr <=3D ss->pending_priority)) { - old_xisr =3D XISR(ss); - ss->xirr &=3D ~XISR_MASK; /* Clear XISR */ - ss->pending_priority =3D 0xff; - qemu_irq_lower(ss->output); - if (ss->xirr_owner) { - ics_reject(ss->xirr_owner, old_xisr); - ss->xirr_owner =3D NULL; + if (XISR(icp) && (cppr <=3D icp->pending_priority)) { + old_xisr =3D XISR(icp); + icp->xirr &=3D ~XISR_MASK; /* Clear XISR */ + icp->pending_priority =3D 0xff; + qemu_irq_lower(icp->output); + if (icp->xirr_owner) { + ics_reject(icp->xirr_owner, old_xisr); + icp->xirr_owner =3D NULL; } } } else { - if (!XISR(ss)) { - icp_resend(ss); + if (!XISR(icp)) { + icp_resend(icp); } } } =20 -void icp_set_mfrr(ICPState *ss, uint8_t mfrr) +void icp_set_mfrr(ICPState *icp, uint8_t mfrr) { - ss->mfrr =3D mfrr; - if (mfrr < CPPR(ss)) { - icp_check_ipi(ss); + icp->mfrr =3D mfrr; + if (mfrr < CPPR(icp)) { + icp_check_ipi(icp); } } =20 -uint32_t icp_accept(ICPState *ss) +uint32_t icp_accept(ICPState *icp) { - uint32_t xirr =3D ss->xirr; + uint32_t xirr =3D icp->xirr; =20 - qemu_irq_lower(ss->output); - ss->xirr =3D ss->pending_priority << 24; - ss->pending_priority =3D 0xff; - ss->xirr_owner =3D NULL; + qemu_irq_lower(icp->output); + icp->xirr =3D icp->pending_priority << 24; + icp->pending_priority =3D 0xff; + icp->xirr_owner =3D NULL; =20 - trace_xics_icp_accept(xirr, ss->xirr); + trace_xics_icp_accept(xirr, icp->xirr); =20 return xirr; } =20 -uint32_t icp_ipoll(ICPState *ss, uint32_t *mfrr) +uint32_t icp_ipoll(ICPState *icp, uint32_t *mfrr) { if (mfrr) { - *mfrr =3D ss->mfrr; + *mfrr =3D icp->mfrr; } - return ss->xirr; + return icp->xirr; } =20 -void icp_eoi(ICPState *ss, uint32_t xirr) +void icp_eoi(ICPState *icp, uint32_t xirr) { - XICSFabric *xi =3D ss->xics; + XICSFabric *xi =3D icp->xics; XICSFabricClass *xic =3D XICS_FABRIC_GET_CLASS(xi); ICSState *ics; uint32_t irq; =20 /* Send EOI -> ICS */ - ss->xirr =3D (ss->xirr & ~CPPR_MASK) | (xirr & CPPR_MASK); - trace_xics_icp_eoi(ss->cs->cpu_index, xirr, ss->xirr); + icp->xirr =3D (icp->xirr & ~CPPR_MASK) | (xirr & CPPR_MASK); + trace_xics_icp_eoi(icp->cs->cpu_index, xirr, icp->xirr); irq =3D xirr & XISR_MASK; =20 ics =3D xic->ics_get(xi, irq); if (ics) { ics_eoi(ics, irq); } - if (!XISR(ss)) { - icp_resend(ss); + if (!XISR(icp)) { + icp_resend(icp); } } =20 static void icp_irq(ICSState *ics, int server, int nr, uint8_t priority) { - ICPState *ss =3D xics_icp_get(ics->xics, server); + ICPState *icp =3D xics_icp_get(ics->xics, server); =20 trace_xics_icp_irq(server, nr, priority); =20 - if ((priority >=3D CPPR(ss)) - || (XISR(ss) && (ss->pending_priority <=3D priority))) { + if ((priority >=3D CPPR(icp)) + || (XISR(icp) && (icp->pending_priority <=3D priority))) { ics_reject(ics, nr); } else { - if (XISR(ss) && ss->xirr_owner) { - ics_reject(ss->xirr_owner, XISR(ss)); - ss->xirr_owner =3D NULL; + if (XISR(icp) && icp->xirr_owner) { + ics_reject(icp->xirr_owner, XISR(icp)); + icp->xirr_owner =3D NULL; } - ss->xirr =3D (ss->xirr & ~XISR_MASK) | (nr & XISR_MASK); - ss->xirr_owner =3D ics; - ss->pending_priority =3D priority; - trace_xics_icp_raise(ss->xirr, ss->pending_priority); - qemu_irq_raise(ss->output); + icp->xirr =3D (icp->xirr & ~XISR_MASK) | (nr & XISR_MASK); + icp->xirr_owner =3D ics; + icp->pending_priority =3D priority; + trace_xics_icp_raise(icp->xirr, icp->pending_priority); + qemu_irq_raise(icp->output); } } =20 static void icp_dispatch_pre_save(void *opaque) { - ICPState *ss =3D opaque; - ICPStateClass *info =3D ICP_GET_CLASS(ss); + ICPState *icp =3D opaque; + ICPStateClass *info =3D ICP_GET_CLASS(icp); =20 if (info->pre_save) { - info->pre_save(ss); + info->pre_save(icp); } } =20 static int icp_dispatch_post_load(void *opaque, int version_id) { - ICPState *ss =3D opaque; - ICPStateClass *info =3D ICP_GET_CLASS(ss); + ICPState *icp =3D opaque; + ICPStateClass *info =3D ICP_GET_CLASS(icp); =20 if (info->post_load) { - return info->post_load(ss, version_id); + return info->post_load(icp, version_id); } =20 return 0; diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c index 14de5d4bb8cc..0a3daca3bb5a 100644 --- a/hw/intc/xics_kvm.c +++ b/hw/intc/xics_kvm.c @@ -45,7 +45,7 @@ static int kernel_xics_fd =3D -1; /* * ICP-KVM */ -static void icp_get_kvm_state(ICPState *ss) +static void icp_get_kvm_state(ICPState *icp) { uint64_t state; struct kvm_one_reg reg =3D { @@ -55,25 +55,25 @@ static void icp_get_kvm_state(ICPState *ss) int ret; =20 /* ICP for this CPU thread is not in use, exiting */ - if (!ss->cs) { + if (!icp->cs) { return; } =20 - ret =3D kvm_vcpu_ioctl(ss->cs, KVM_GET_ONE_REG, ®); + ret =3D kvm_vcpu_ioctl(icp->cs, KVM_GET_ONE_REG, ®); if (ret !=3D 0) { error_report("Unable to retrieve KVM interrupt controller state" - " for CPU %ld: %s", kvm_arch_vcpu_id(ss->cs), strerror(err= no)); + " for CPU %ld: %s", kvm_arch_vcpu_id(icp->cs), strerror(er= rno)); exit(1); } =20 - ss->xirr =3D state >> KVM_REG_PPC_ICP_XISR_SHIFT; - ss->mfrr =3D (state >> KVM_REG_PPC_ICP_MFRR_SHIFT) + icp->xirr =3D state >> KVM_REG_PPC_ICP_XISR_SHIFT; + icp->mfrr =3D (state >> KVM_REG_PPC_ICP_MFRR_SHIFT) & KVM_REG_PPC_ICP_MFRR_MASK; - ss->pending_priority =3D (state >> KVM_REG_PPC_ICP_PPRI_SHIFT) + icp->pending_priority =3D (state >> KVM_REG_PPC_ICP_PPRI_SHIFT) & KVM_REG_PPC_ICP_PPRI_MASK; } =20 -static int icp_set_kvm_state(ICPState *ss, int version_id) +static int icp_set_kvm_state(ICPState *icp, int version_id) { uint64_t state; struct kvm_one_reg reg =3D { @@ -83,18 +83,18 @@ static int icp_set_kvm_state(ICPState *ss, int version_= id) int ret; =20 /* ICP for this CPU thread is not in use, exiting */ - if (!ss->cs) { + if (!icp->cs) { return 0; } =20 - state =3D ((uint64_t)ss->xirr << KVM_REG_PPC_ICP_XISR_SHIFT) - | ((uint64_t)ss->mfrr << KVM_REG_PPC_ICP_MFRR_SHIFT) - | ((uint64_t)ss->pending_priority << KVM_REG_PPC_ICP_PPRI_SHIFT); + state =3D ((uint64_t)icp->xirr << KVM_REG_PPC_ICP_XISR_SHIFT) + | ((uint64_t)icp->mfrr << KVM_REG_PPC_ICP_MFRR_SHIFT) + | ((uint64_t)icp->pending_priority << KVM_REG_PPC_ICP_PPRI_SHIFT); =20 - ret =3D kvm_vcpu_ioctl(ss->cs, KVM_SET_ONE_REG, ®); + ret =3D kvm_vcpu_ioctl(icp->cs, KVM_SET_ONE_REG, ®); if (ret !=3D 0) { error_report("Unable to restore KVM interrupt controller state (0x= %" - PRIx64 ") for CPU %ld: %s", state, kvm_arch_vcpu_id(ss->cs= ), + PRIx64 ") for CPU %ld: %s", state, kvm_arch_vcpu_id(icp->c= s), strerror(errno)); return ret; } @@ -118,7 +118,7 @@ static void icp_kvm_reset(DeviceState *dev) icp_set_kvm_state(icp, 1); } =20 -static void icp_kvm_cpu_setup(ICPState *ss, PowerPCCPU *cpu) +static void icp_kvm_cpu_setup(ICPState *icp, PowerPCCPU *cpu) { CPUState *cs =3D CPU(cpu); int ret; @@ -132,7 +132,7 @@ static void icp_kvm_cpu_setup(ICPState *ss, PowerPCCPU = *cpu) * which was hot-removed earlier we don't have to renable * KVM_CAP_IRQ_XICS capability again. */ - if (ss->cap_irq_xics_enabled) { + if (icp->cap_irq_xics_enabled) { return; } =20 @@ -143,7 +143,7 @@ static void icp_kvm_cpu_setup(ICPState *ss, PowerPCCPU = *cpu) kvm_arch_vcpu_id(cs), strerror(errno)); exit(1); } - ss->cap_irq_xics_enabled =3D true; + icp->cap_irq_xics_enabled =3D true; } =20 static void icp_kvm_class_init(ObjectClass *klass, void *data) --=20 2.7.4