From nobody Mon Feb 9 18:44:24 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1686147695; cv=none; d=zohomail.com; s=zohoarc; b=b3S6XKYHk1BIxWaGTrZclEciWv54x3T6CEaQzr/ugkCgYR7j4LxvgHTtuZXoqPxjMYiLacZLbHVYj0c7kAHfL4zRzjhAyxA6OA0CEZbvrq5tzSUlUgAUjsuQ+gw3gDE6nPWvsv83BmnmD3jrW+X9b9+O/5/TNKWhdPwD+JnxmnM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686147695; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=syvhc03R0/pEbyghClaj71+k039Qys5l/YiT0gSS6a8=; b=OqVt8B9b3exuGIL2UfAEPNSIDvdQ4EFMCea/7cFZW1ZuarnlBuQltGg9u+w9EuwRu2V6LHQawwRnc3pdeK94NDtwwuCINIsm1Ljo0VKZ/E6rzoH64NpODpeIbwebQ4YGrMh3vDVnHC1F1A2gezifL4lVePNZCX7sdkTpONPb03s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 168614769571584.39880176550366; Wed, 7 Jun 2023 07:21:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6u1G-0003Me-8t; Wed, 07 Jun 2023 10:20:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6u1E-0003Dx-Nk for qemu-devel@nongnu.org; Wed, 07 Jun 2023 10:20:12 -0400 Received: from esa3.hc3370-68.iphmx.com ([216.71.145.155]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6u1B-0003g5-Od for qemu-devel@nongnu.org; Wed, 07 Jun 2023 10:20:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1686147609; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FL0kczg1AEWFFnOGZrrfsv4UULDPFWhofp92N3+6x0s=; b=SDVICLXHMY2/pKOTpOWr2/0FPbb48+hnG+iMTHcrSYnpVgGsHbpHCp3g c9OGgLVOaQasIvYxQsqef+yWzXu1EJOMxbJ93OHigdQOsgVFbe1GmF5qU eQ/kkK7Y37QpvelgGm/BG3Pm9iigKmgY83MTSVdGXWGAIdNG+brzvlxG7 k=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 4.0 X-MesageID: 111938275 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.123 X-Policy: $RELAYED IronPort-Data: A9a23:xv6ixqDF3YpUfhVW/yjjw5YqxClBgxIJ4kV8jS/XYbTApGl3hTUCy TMdWW2AMqyKM2DzKIh2Ydm19UIDuJbXnNFkQQY4rX1jcSlH+JHPbTi7wuUcHAvJd5GeExg3h yk6QoOdRCzhZiaE/n9BCpC48T8nk/nOHuGmYAL9EngZbRd+Tys8gg5Ulec8g4p56fC0GArIs t7pyyHlEAbNNwVcbCRMs8pvl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SYeeAaWSSVPyKgjWFLw== X-Talos-CUID: 9a23:Dx0RwmF9wxrF4tQ2qmJf33wxBdg/VkTBlkrXenOqBnw4Fo+sHAo= X-Talos-MUID: 9a23:ADENMARPe3b4GfDmRXTqthZaDO415J2WDW9Xu7wCscOeLhFZbmI= X-IronPort-AV: E=Sophos;i="6.00,224,1681185600"; d="scan'208";a="111938275" To: CC: Bernhard Beschow , Anthony PERARD Subject: [PULL 08/12] hw/isa/piix3: Wire up Xen PCI IRQ handling outside of PIIX3 Date: Wed, 7 Jun 2023 15:18:35 +0100 Message-ID: <20230607141839.48422-9-anthony.perard@citrix.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230607141839.48422-1-anthony.perard@citrix.com> References: <20230607141839.48422-1-anthony.perard@citrix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.71.145.155; envelope-from=prvs=51561cf95=anthony.perard@citrix.com; helo=esa3.hc3370-68.iphmx.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Anthony PERARD From: Anthony PERARD via Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1686147697385100005 Content-Type: text/plain; charset="utf-8" From: Bernhard Beschow xen_intx_set_irq() doesn't depend on PIIX3State. In order to resolve TYPE_PIIX3_XEN_DEVICE and in order to make Xen agnostic about the precise south bridge being used, set up Xen's PCI IRQ handling of PIIX3 in the board. Signed-off-by: Bernhard Beschow Reviewed-by: Michael S. Tsirkin Reviewed-by: Anthony PERARD Tested-by: Chuck Zmudzinski Message-Id: <20230312120221.99183-4-shentey@gmail.com> Message-Id: <20230403074124.3925-5-shentey@gmail.com> Signed-off-by: Anthony PERARD --- hw/i386/pc_piix.c | 13 +++++++++++++ hw/isa/piix3.c | 24 +----------------------- 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index d5b0dcd1fe..11af191513 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -71,6 +71,7 @@ #include "kvm/kvm-cpu.h" =20 #define MAX_IDE_BUS 2 +#define XEN_IOAPIC_NUM_PIRQS 128ULL =20 #ifdef CONFIG_IDE_ISA static const int ide_iobase[MAX_IDE_BUS] =3D { 0x1f0, 0x170 }; @@ -238,6 +239,18 @@ static void pc_init1(MachineState *machine, pcms->bus =3D pci_bus; =20 pci_dev =3D pci_create_simple_multifunction(pci_bus, -1, true, typ= e); + + if (xen_enabled()) { + /* + * Xen supports additional interrupt routes from the PCI devic= es to + * the IOAPIC: the four pins of each PCI device on the bus are= also + * connected to the IOAPIC directly. + * These additional routes can be discovered through ACPI. + */ + pci_bus_irqs(pci_bus, xen_intx_set_irq, pci_dev, + XEN_IOAPIC_NUM_PIRQS); + } + piix3 =3D PIIX3_PCI_DEVICE(pci_dev); piix3->pic =3D x86ms->gsi; piix3_devfn =3D piix3->dev.devfn; diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c index 800b80f2bb..0b7e9ade0d 100644 --- a/hw/isa/piix3.c +++ b/hw/isa/piix3.c @@ -35,8 +35,6 @@ #include "migration/vmstate.h" #include "hw/acpi/acpi_aml_interface.h" =20 -#define XEN_IOAPIC_NUM_PIRQS 128ULL - static void piix3_set_irq_pic(PIIX3State *piix3, int pic_irq) { qemu_set_irq(piix3->pic[pic_irq], @@ -403,32 +401,12 @@ static const TypeInfo piix3_info =3D { .class_init =3D piix3_class_init, }; =20 -static void piix3_xen_realize(PCIDevice *dev, Error **errp) -{ - ERRP_GUARD(); - PIIX3State *piix3 =3D PIIX3_PCI_DEVICE(dev); - PCIBus *pci_bus =3D pci_get_bus(dev); - - piix3_realize(dev, errp); - if (*errp) { - return; - } - - /* - * Xen supports additional interrupt routes from the PCI devices to - * the IOAPIC: the four pins of each PCI device on the bus are also - * connected to the IOAPIC directly. - * These additional routes can be discovered through ACPI. - */ - pci_bus_irqs(pci_bus, xen_intx_set_irq, piix3, XEN_IOAPIC_NUM_PIRQS); -} - static void piix3_xen_class_init(ObjectClass *klass, void *data) { PCIDeviceClass *k =3D PCI_DEVICE_CLASS(klass); =20 k->config_write =3D piix3_write_config_xen; - k->realize =3D piix3_xen_realize; + k->realize =3D piix3_realize; } =20 static const TypeInfo piix3_xen_info =3D { --=20 Anthony PERARD