From nobody Tue Feb 10 20:28:52 2026 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.zohomail.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 1524144174387133.84763317495992; Thu, 19 Apr 2018 06:22:54 -0700 (PDT) Received: from localhost ([::1]:46028 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f99WT-0005sE-Lz for importer@patchew.org; Thu, 19 Apr 2018 09:22:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58396) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f98xM-0001Ve-MH for qemu-devel@nongnu.org; Thu, 19 Apr 2018 08:46:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f98xI-00018g-Od for qemu-devel@nongnu.org; Thu, 19 Apr 2018 08:46:32 -0400 Received: from 20.mo7.mail-out.ovh.net ([46.105.49.208]:45266) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f98xI-000181-GR for qemu-devel@nongnu.org; Thu, 19 Apr 2018 08:46:28 -0400 Received: from player792.ha.ovh.net (unknown [10.109.108.85]) by mo7.mail-out.ovh.net (Postfix) with ESMTP id 1343BA28FB for ; Thu, 19 Apr 2018 14:46:26 +0200 (CEST) Received: from zorba.kaod.org.com (LFbn-REN-1-664-241.w81-53.abo.wanadoo.fr [81.53.234.241]) (Authenticated sender: clg@kaod.org) by player792.ha.ovh.net (Postfix) with ESMTPSA id ACC61A0087; Thu, 19 Apr 2018 14:46:20 +0200 (CEST) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-ppc@nongnu.org, qemu-devel@nongnu.org Date: Thu, 19 Apr 2018 14:43:24 +0200 Message-Id: <20180419124331.3915-29-clg@kaod.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180419124331.3915-1-clg@kaod.org> References: <20180419124331.3915-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 10349834896336522067 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedtgedrjeehgdehjecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd 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.49.208 Subject: [Qemu-devel] [PATCH v3 28/35] intc: introduce a CPUIntc 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: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , David Gibson 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" which we will use in the sPAPR machine to reset the interrupt controller of each CPU at the KVM level. Signed-off-by: C=C3=A9dric Le Goater --- hw/intc/intc.c | 26 ++++++++++++++++++++++++++ include/hw/intc/intc.h | 21 +++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/hw/intc/intc.c b/hw/intc/intc.c index 2e1e29e753a1..bb08ff51596a 100644 --- a/hw/intc/intc.c +++ b/hw/intc/intc.c @@ -32,10 +32,36 @@ static const TypeInfo intctrl_info =3D { .class_size =3D sizeof(InterruptStatsProviderClass), }; =20 +static const TypeInfo cpu_intc_info =3D { + .name =3D TYPE_CPU_INTC, + .parent =3D TYPE_INTERFACE, + .class_size =3D sizeof(CPUIntcClass), +}; + static void intc_register_types(void) { + type_register_static(&cpu_intc_info); type_register_static(&intctrl_info); } =20 type_init(intc_register_types) =20 +void cpu_intc_disconnect(CPUIntc *intc, Error **errp) +{ + CPUIntcClass *cic; + + cic =3D CPU_INTC_GET_CLASS(intc); + if (cic->disconnect) { + cic->disconnect(intc, errp); + } +} + +void cpu_intc_connect(CPUIntc *intc, Error **errp) +{ + CPUIntcClass *cic; + + cic =3D CPU_INTC_GET_CLASS(intc); + if (cic->connect) { + cic->connect(intc, errp); + } +} diff --git a/include/hw/intc/intc.h b/include/hw/intc/intc.h index 27d9828943ae..3536e7d57ffd 100644 --- a/include/hw/intc/intc.h +++ b/include/hw/intc/intc.h @@ -30,4 +30,25 @@ typedef struct InterruptStatsProviderClass { void (*print_info)(InterruptStatsProvider *obj, Monitor *mon); } InterruptStatsProviderClass; =20 +#define TYPE_CPU_INTC "cpu-intc" +#define CPU_INTC(obj) \ + OBJECT_CHECK(CPUIntc, (obj), TYPE_CPU_INTC) +#define CPU_INTC_CLASS(klass) \ + OBJECT_CLASS_CHECK(CPUIntcClass, (klass), TYPE_CPU_INTC) +#define CPU_INTC_GET_CLASS(obj) \ + OBJECT_GET_CLASS(CPUIntcClass, (obj), TYPE_CPU_INTC) + +typedef struct CPUIntc { + Object parent; +} CPUIntc; + +typedef struct CPUIntcClass { + InterfaceClass parent; + void (*connect)(CPUIntc *icp, Error **errp); + void (*disconnect)(CPUIntc *icp, Error **errp); +} CPUIntcClass; + +void cpu_intc_disconnect(CPUIntc *intc, Error **errp); +void cpu_intc_connect(CPUIntc *intc, Error **errp); + #endif --=20 2.13.6