From patchwork Wed Jan 4 14:44:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13088663 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1F0F4C46467 for ; Wed, 4 Jan 2023 14:46:04 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pD51U-0005H4-SB; Wed, 04 Jan 2023 09:45:44 -0500 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 1pD51D-0005F3-77 for qemu-devel@nongnu.org; Wed, 04 Jan 2023 09:45:30 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pD51B-0002oD-E2 for qemu-devel@nongnu.org; Wed, 04 Jan 2023 09:45:26 -0500 Received: by mail-wr1-x434.google.com with SMTP id h16so33152183wrz.12 for ; Wed, 04 Jan 2023 06:45:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qwwBmjkQ+lNHH0kKiW9e0yfr8jRksndzOx0yQHLnF3U=; b=Wch2+6IG0obcLWirCwO0uN2viNNRWGwjqAFhW/ZYw1fchDlIbgWmuB3c8dlern5JGN 4zUs9Y2GjuybCLMXzn2i3IB2HpMdnJ3HOfcR0Id/ZqbSM3D2zZU/HKa/camSQegFxTMw AHdCTPkE+aAGidOO551rDDq7D9WH+cxg/4sMPHQ+cM+9wzSWfesq1yH6xy47O9xTEoFd eZfdHHVnJEmwB7VwCBj9m9+mWDLchXhhkYcMqSmiWNviCG4U3NvQshROvXH0TUL+D83f 7bjrqMxVbRF0Ka56hPzfPNov9BdR1GZ9Rp8kUFHu/C6dGAo3y08PsXTkRemZcP/M5Y9L Ojww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qwwBmjkQ+lNHH0kKiW9e0yfr8jRksndzOx0yQHLnF3U=; b=3gCrnAxbos4W80hXKtPYkcqeEB/8wPuNh5GoBe+kRULvgAH6El+fQv7S15tiEuttow A3XIONDGy4oLgIJRMaW5S6ZigI5DJyrGOU3S9pK7UqpqvnXsozXSAoguyBbI1S4QSzH8 xmatolhAI0KwtSQJWHaVzNchSXK6XiRA+HussC59nRuQdrZ71s+vxV9gJPdEIdAEyMOL DHq6Dp8m8vPZWeDpEtzNopfAuaqH6+4NUf+YcAkiX8sim6ZNRP8txlEi2lpJXCF4E4G9 eiEcvhFFLljDMQ0ofY85NflX0Y0JF71zbU4Nn5HMTAzQzVNwILl3F9UX6hFtoDgQwkJK azYA== X-Gm-Message-State: AFqh2komsqzjNuAOA3a0JGI9+b+h1J3Nnv03+WmCjqRnpq8EFqfvX4/i VA9XugfLL98yp2eM1vm5Viw3T2tuINWhyA== X-Google-Smtp-Source: AMrXdXv1Bz9WYYfmdlxF76KLvJgFfsoIF1V0rIeHDad7Wu77HbMKWyWlh26v/oTTwkdlUrXJkWzplw== X-Received: by 2002:a05:6000:1d84:b0:273:6845:68ef with SMTP id bk4-20020a0560001d8400b00273684568efmr24329892wrb.60.1672843523618; Wed, 04 Jan 2023 06:45:23 -0800 (PST) Received: from osoxes.fritz.box (p200300faaf0bb2009c4947838afc41b6.dip0.t-ipconnect.de. [2003:fa:af0b:b200:9c49:4783:8afc:41b6]) by smtp.gmail.com with ESMTPSA id e10-20020a5d594a000000b0028663fc8f4csm21168241wri.30.2023.01.04.06.45.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 06:45:23 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Richard Henderson , Stefano Stabellini , xen-devel@lists.xenproject.org, =?utf-8?q?Herv=C3=A9_Poussineau?= , Aurelien Jarno , Paul Durrant , Marcel Apfelbaum , Anthony Perard , "Michael S. Tsirkin" , Paolo Bonzini , Eduardo Habkost , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Chuck Zmudzinski , Bernhard Beschow Subject: [PATCH v2 1/6] include/hw/xen/xen: Rename xen_piix3_set_irq() to xen_intx_set_irq() Date: Wed, 4 Jan 2023 15:44:32 +0100 Message-Id: <20230104144437.27479-2-shentey@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230104144437.27479-1-shentey@gmail.com> References: <20230104144437.27479-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=shentey@gmail.com; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org xen_piix3_set_irq() isn't PIIX specific: PIIX is a single PCI device while xen_piix3_set_irq() maps multiple PCI devices to their respective IRQs, which is board-specific. Rename xen_piix3_set_irq() to communicate this. Also rename XEN_PIIX_NUM_PIRQS to XEN_IOAPIC_NUM_PIRQS since the Xen's IOAPIC rather than PIIX has this many interrupt routes. Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daudé --- hw/i386/xen/xen-hvm.c | 2 +- hw/isa/piix.c | 4 ++-- include/hw/xen/xen.h | 2 +- stubs/xen-hw-stub.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c index e4293d6d66..558c43309e 100644 --- a/hw/i386/xen/xen-hvm.c +++ b/hw/i386/xen/xen-hvm.c @@ -142,7 +142,7 @@ int xen_pci_slot_get_pirq(PCIDevice *pci_dev, int irq_num) return irq_num + (PCI_SLOT(pci_dev->devfn) << 2); } -void xen_piix3_set_irq(void *opaque, int irq_num, int level) +void xen_intx_set_irq(void *opaque, int irq_num, int level) { xen_set_pci_intx_level(xen_domid, 0, 0, irq_num >> 2, irq_num & 3, level); diff --git a/hw/isa/piix.c b/hw/isa/piix.c index ae8a27c53c..a7a4eec206 100644 --- a/hw/isa/piix.c +++ b/hw/isa/piix.c @@ -38,7 +38,7 @@ #include "migration/vmstate.h" #include "hw/acpi/acpi_aml_interface.h" -#define XEN_PIIX_NUM_PIRQS 128ULL +#define XEN_IOAPIC_NUM_PIRQS 128ULL static void piix_set_irq_pic(PIIXState *piix, int pic_irq) { @@ -504,7 +504,7 @@ static void piix3_xen_realize(PCIDevice *dev, Error **errp) * connected to the IOAPIC directly. * These additional routes can be discovered through ACPI. */ - pci_bus_irqs(pci_bus, xen_piix3_set_irq, piix3, XEN_PIIX_NUM_PIRQS); + pci_bus_irqs(pci_bus, xen_intx_set_irq, piix3, XEN_IOAPIC_NUM_PIRQS); } static void piix3_xen_class_init(ObjectClass *klass, void *data) diff --git a/include/hw/xen/xen.h b/include/hw/xen/xen.h index afdf9c436a..7c83ecf6b9 100644 --- a/include/hw/xen/xen.h +++ b/include/hw/xen/xen.h @@ -22,7 +22,7 @@ extern bool xen_domid_restrict; int xen_pci_slot_get_pirq(PCIDevice *pci_dev, int irq_num); int xen_set_pci_link_route(uint8_t link, uint8_t irq); -void xen_piix3_set_irq(void *opaque, int irq_num, int level); +void xen_intx_set_irq(void *opaque, int irq_num, int level); void xen_hvm_inject_msi(uint64_t addr, uint32_t data); int xen_is_pirq_msi(uint32_t msi_data); diff --git a/stubs/xen-hw-stub.c b/stubs/xen-hw-stub.c index 34a22f2ad7..7d7ffe83a9 100644 --- a/stubs/xen-hw-stub.c +++ b/stubs/xen-hw-stub.c @@ -15,7 +15,7 @@ int xen_pci_slot_get_pirq(PCIDevice *pci_dev, int irq_num) return -1; } -void xen_piix3_set_irq(void *opaque, int irq_num, int level) +void xen_intx_set_irq(void *opaque, int irq_num, int level) { } From patchwork Wed Jan 4 14:44:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13088666 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 49E6AC46467 for ; Wed, 4 Jan 2023 14:46:53 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pD51W-0005Hh-Kd; Wed, 04 Jan 2023 09:45:46 -0500 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 1pD51D-0005F5-Lw for qemu-devel@nongnu.org; Wed, 04 Jan 2023 09:45:30 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pD51C-0002pA-3b for qemu-devel@nongnu.org; Wed, 04 Jan 2023 09:45:27 -0500 Received: by mail-wr1-x436.google.com with SMTP id w1so21082973wrt.8 for ; Wed, 04 Jan 2023 06:45:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=skngD2C07lkAR57VFiC9hSpSkRXE8QLpJkhdrtzHaoE=; b=fglIPWzWe7OF+ReYiVQjbIlqvtMvTu/HBo031zXX2Dmr6PoRqVzCCMudfgPYd4aGRi ZzXHYC+LUG8aYoxMQ2QopDZUsHWe8+I3MBPfz33YHbBlA0wpSiPunpMSxDNEQu3gic8o tjY9LXxtHVjsr5RFAPk3J091DyzHz40da+k0hi4YR2NRpwGdMpmrPobxn+rII4pfszR+ ABmHKixdWzp6dCP+vGUOG1X6vLOHELWO4oX1VeVkM5l0HNpdBbKdWd/OSHzgbTTCC2Ov ZZVVZUIoXft/7/vDq3sRETSoVxCTNiDIkVm5XL0QJYkZbABRQHyxfDTifj0y4vNNeuN2 dMvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=skngD2C07lkAR57VFiC9hSpSkRXE8QLpJkhdrtzHaoE=; b=tG2r3dr5xSadbfHkrAc1sE9z7zf4jotZyElyjHRSqRD4gDg9BZJadCT+PxlRY7XwzV kLr5HcUF2Bgtbm3qqSSCrZYCA2UZnld8lHHNe051Dltm63qZ+1/nNUr3685p1qhiQ9B0 En2zIcRsMmrHwR5K6ZkSWjVw7GkLgkRbn050m0DPTVRwn5/HSvhrShV6SHXNPlsN7x9m F7dhVvKOD5aiVa0eDnT/D7PQFBbFomFuzjNczeOTL9uxr2xILdh1gXRmTqE+0OZmhIZW TNwgysSiRbhlTVeEfdP+ENjbhs0FmYr7R3rh7YMXqLKMuGfzEA/mkk1Sd7bht+VPy68j LJVw== X-Gm-Message-State: AFqh2kqoFyg5xIDgqgycH2DnMM+q7e8w55H+VMBTcVF0T6zg3jjiRlG6 MrXlTKAuMk+tQKJU7AvuA5ngoOUhfgU9ig== X-Google-Smtp-Source: AMrXdXsN3egZuow7sNDCctPG+VunNJGlKj4E12ZlT9Um1FBGzDz97HrRjJAVFxuMN8+oPIQ6UyZajQ== X-Received: by 2002:adf:fa0f:0:b0:28f:b480:f4 with SMTP id m15-20020adffa0f000000b0028fb48000f4mr12954011wrr.12.1672843524496; Wed, 04 Jan 2023 06:45:24 -0800 (PST) Received: from osoxes.fritz.box (p200300faaf0bb2009c4947838afc41b6.dip0.t-ipconnect.de. [2003:fa:af0b:b200:9c49:4783:8afc:41b6]) by smtp.gmail.com with ESMTPSA id e10-20020a5d594a000000b0028663fc8f4csm21168241wri.30.2023.01.04.06.45.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 06:45:24 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Richard Henderson , Stefano Stabellini , xen-devel@lists.xenproject.org, =?utf-8?q?Herv=C3=A9_Poussineau?= , Aurelien Jarno , Paul Durrant , Marcel Apfelbaum , Anthony Perard , "Michael S. Tsirkin" , Paolo Bonzini , Eduardo Habkost , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Chuck Zmudzinski , Bernhard Beschow Subject: [PATCH v2 2/6] hw/isa/piix: Reuse piix3_realize() in piix3_xen_realize() Date: Wed, 4 Jan 2023 15:44:33 +0100 Message-Id: <20230104144437.27479-3-shentey@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230104144437.27479-1-shentey@gmail.com> References: <20230104144437.27479-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=shentey@gmail.com; helo=mail-wr1-x436.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org This is a preparational patch for the next one to make the following more obvious: First, pci_bus_irqs() is now called twice in case of Xen where the second call overrides the pci_set_irq_fn with the Xen variant. Second, pci_bus_set_route_irq_fn() is now also called in Xen mode. Signed-off-by: Bernhard Beschow --- hw/isa/piix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/isa/piix.c b/hw/isa/piix.c index a7a4eec206..25707479eb 100644 --- a/hw/isa/piix.c +++ b/hw/isa/piix.c @@ -493,7 +493,7 @@ static void piix3_xen_realize(PCIDevice *dev, Error **errp) PIIXState *piix3 = PIIX_PCI_DEVICE(dev); PCIBus *pci_bus = pci_get_bus(dev); - pci_piix_realize(dev, TYPE_PIIX3_USB_UHCI, errp); + piix3_realize(dev, errp); if (*errp) { return; } From patchwork Wed Jan 4 14:44:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13088662 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1F122C4708D for ; Wed, 4 Jan 2023 14:46:03 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pD51U-0005Gx-RN; Wed, 04 Jan 2023 09:45:44 -0500 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 1pD51F-0005F8-0r for qemu-devel@nongnu.org; Wed, 04 Jan 2023 09:45:30 -0500 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pD51D-0002po-Aa for qemu-devel@nongnu.org; Wed, 04 Jan 2023 09:45:28 -0500 Received: by mail-wr1-x42f.google.com with SMTP id bn26so13737728wrb.0 for ; Wed, 04 Jan 2023 06:45:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jWsSUpGWnwKoxzlBa2RTErBbFhPwkbaywyVJwsOJ9Nk=; b=YlPrLritShhHTaeSGbLlb++n9XqS9VBhEgsy2PwwgydtFFm8UrBGDJ7iUMy8EaMHeH 9SBO1n2DyEa7U5jCTGTOQDdlOVkvnVOt1hp8JY3uNc4BSSwglDnmGx2Ero35GpcLb5UZ lxDNlGzSW/OY/+wh4qjm3mF5gciV5251nu62u5qkggcU3PaBu3OtH7lvV3LzAIHUHPpY i/fR6+7MuwJBxH89wLn/4BkSrlZxnPIIZCNrMfecj4xhrjBhXyY2bE6HPVdgtcf6jPaJ iN/TGG+HuHA766ERLaC5giouVQ+KfyHIHRbdPCXS9JqqjfVfCA6wQA2G70I6E8iUvn/6 2/8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jWsSUpGWnwKoxzlBa2RTErBbFhPwkbaywyVJwsOJ9Nk=; b=RKaQBbXyspreX0bdd+pzGLJ55dXm37MYcZOw1p5f1AxGUrguvMI5/v4ZXECeu+6vCQ SyU+5I511F9GR53VPkt0PwUKD96kg4t5GgMHy8CHYzc/QRXXs/mSmaU+Mf6Tw20b75Ga 2PQvSrj6qJyKFaB/s0Wq9WsyJbGWM6Z/I7p+rNP267QGvpzVAfJLcG/vNqq5yrGx+ElS 9C0IVeYxA+BLG8B+hdY6lUWS/w1fscht2Hkbc/M/T8XsYpSj5py4yfNm9B1i+7XDP5qd TXnvcM8gNRYqnJ+2D46UglA0ZVbhyaGDRV65Rem6+vx+VloQBTfwhLO+WNE+ACXBiDrQ K6ww== X-Gm-Message-State: AFqh2kqfiNmfARaGNBDpZprJnlxYlo26/145buUEe/uWd3to7b5zJ9+4 ErZBh7UGDgnCoI6dnmvRLGdL1G2kVgQ2RA== X-Google-Smtp-Source: AMrXdXtdVz6/t/nUcG3XroMW/zOMXTIelUM5J1RHwOTKB+xhi7kJEMzBdrFkmDsmcHHUWZlTsIodDw== X-Received: by 2002:adf:f4c5:0:b0:291:3f93:b7d1 with SMTP id h5-20020adff4c5000000b002913f93b7d1mr11327512wrp.64.1672843525599; Wed, 04 Jan 2023 06:45:25 -0800 (PST) Received: from osoxes.fritz.box (p200300faaf0bb2009c4947838afc41b6.dip0.t-ipconnect.de. [2003:fa:af0b:b200:9c49:4783:8afc:41b6]) by smtp.gmail.com with ESMTPSA id e10-20020a5d594a000000b0028663fc8f4csm21168241wri.30.2023.01.04.06.45.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 06:45:25 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Richard Henderson , Stefano Stabellini , xen-devel@lists.xenproject.org, =?utf-8?q?Herv=C3=A9_Poussineau?= , Aurelien Jarno , Paul Durrant , Marcel Apfelbaum , Anthony Perard , "Michael S. Tsirkin" , Paolo Bonzini , Eduardo Habkost , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Chuck Zmudzinski , Bernhard Beschow Subject: [PATCH v2 3/6] hw/isa/piix: Wire up Xen PCI IRQ handling outside of PIIX3 Date: Wed, 4 Jan 2023 15:44:34 +0100 Message-Id: <20230104144437.27479-4-shentey@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230104144437.27479-1-shentey@gmail.com> References: <20230104144437.27479-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=shentey@gmail.com; helo=mail-wr1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org xen_intx_set_irq() doesn't depend on PIIX state. 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: Philippe Mathieu-Daudé --- hw/i386/pc_piix.c | 12 ++++++++++++ hw/isa/piix.c | 24 +----------------------- 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index aacdb72b7c..792dcd3ce8 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -67,6 +67,7 @@ #include "kvm/kvm-cpu.h" #define MAX_IDE_BUS 2 +#define XEN_IOAPIC_NUM_PIRQS 128ULL #ifdef CONFIG_IDE_ISA static const int ide_iobase[MAX_IDE_BUS] = { 0x1f0, 0x170 }; @@ -246,6 +247,17 @@ static void pc_init1(MachineState *machine, &error_abort); pci_realize_and_unref(pci_dev, pci_bus, &error_fatal); + if (xen_enabled()) { + /* + * 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, pci_dev, + XEN_IOAPIC_NUM_PIRQS); + } + dev = DEVICE(object_resolve_path_component(OBJECT(pci_dev), "pic")); for (i = 0; i < ISA_NUM_IRQS; i++) { qdev_connect_gpio_out(dev, i, x86ms->gsi[i]); diff --git a/hw/isa/piix.c b/hw/isa/piix.c index 25707479eb..ac04781f46 100644 --- a/hw/isa/piix.c +++ b/hw/isa/piix.c @@ -38,8 +38,6 @@ #include "migration/vmstate.h" #include "hw/acpi/acpi_aml_interface.h" -#define XEN_IOAPIC_NUM_PIRQS 128ULL - static void piix_set_irq_pic(PIIXState *piix, int pic_irq) { qemu_set_irq(piix->pic.in_irqs[pic_irq], @@ -487,33 +485,13 @@ static const TypeInfo piix3_info = { .class_init = piix3_class_init, }; -static void piix3_xen_realize(PCIDevice *dev, Error **errp) -{ - ERRP_GUARD(); - PIIXState *piix3 = PIIX_PCI_DEVICE(dev); - PCIBus *pci_bus = 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) { DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); k->config_write = piix3_write_config_xen; - k->realize = piix3_xen_realize; + k->realize = piix3_realize; /* 82371SB PIIX3 PCI-to-ISA bridge (Step A1) */ k->device_id = PCI_DEVICE_ID_INTEL_82371SB_0; dc->vmsd = &vmstate_piix3; From patchwork Wed Jan 4 14:44:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13088667 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ED66AC4708D for ; Wed, 4 Jan 2023 14:47:07 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pD51a-0005Ie-LD; Wed, 04 Jan 2023 09:45:50 -0500 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 1pD51H-0005Fh-Ql for qemu-devel@nongnu.org; Wed, 04 Jan 2023 09:45:40 -0500 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pD51E-0002qq-8E for qemu-devel@nongnu.org; Wed, 04 Jan 2023 09:45:30 -0500 Received: by mail-wr1-x435.google.com with SMTP id d9so4627680wrp.10 for ; Wed, 04 Jan 2023 06:45:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9kGVFT98W8E67AgEjIgODwyRdBIrAWSrE8+3kXPv+J8=; b=ZOgIvlh/yVYKniIe+nDfDmWng8AeG9tivYZ8qAp1ejGNIiF0OlcQxQQawaNqvp5kyI db6PpoClsgtQ24vN7b43iAIA4RkZZU2IuOOdMiKpghvD5UHV30I+MHCh5SnMLIlEqhWk mR+3nciHSn7my9PZJ/fxT/DQUm5quEOmOzKRJxhQXvCi1Tlkjaffx44yMQmtlg7jafz9 wOcea1XtCncOTtqIdlZLJeZYVgaPkId9KcpEWYWGMpMofvDc7L/iDozqI0Ael/BQ+wHL j+1XDUGTqoI9HCUs5EMZBaZj8RISPwyWc1chvQYyjR/soqxI4/ZON7/PcZZGAwU+arqe ymhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9kGVFT98W8E67AgEjIgODwyRdBIrAWSrE8+3kXPv+J8=; b=CMzJMxJM2w8dASd+6aCBnQlC8oPnfBSrD34LXC2j2nx8JIGpCB+DlcfAS6aI+tC1Vd tEg2dqS6VLT7Qk6Jwhac+AjYVmDNryCxLR3it1EXVmRh+3WAG7cQR2BNciVscPK8jDyX PQxeFYCJSDsRhay8L/eFYLjeLxfEEMlVf//ijqT19x3Lburg5ow2HJJ+/gPC+xk/+Uu2 bC/mr9oeFGq/qZEr+Gr8z5Qv5lP4/6qQG2LRNgs1j6LCu0EFUT8r92w2ZHAXdkW4UiM/ LEnrAx4RgV5gQ/EDiCNCQew0d8DOs/cWUP0dyOZHul6vnaOy3HyrMbqrRUS3kyJFoJEv b7Xg== X-Gm-Message-State: AFqh2kraOGPXLsD7vMO3XoaFqi46bpDRx+pMZnmOzCT1I50tPpHcvgD6 uYbXL0bGSMP08PkBo3eG72dtTGbUaOro/A== X-Google-Smtp-Source: AMrXdXu/V1VAakoVNA901K1DaXhCb0Z6edEmYwIKwkLsKHezEymfRbemWS6Mw7ngG0Tn4FnagiDi+A== X-Received: by 2002:a5d:5485:0:b0:294:50d6:86ad with SMTP id h5-20020a5d5485000000b0029450d686admr8741280wrv.2.1672843526555; Wed, 04 Jan 2023 06:45:26 -0800 (PST) Received: from osoxes.fritz.box (p200300faaf0bb2009c4947838afc41b6.dip0.t-ipconnect.de. [2003:fa:af0b:b200:9c49:4783:8afc:41b6]) by smtp.gmail.com with ESMTPSA id e10-20020a5d594a000000b0028663fc8f4csm21168241wri.30.2023.01.04.06.45.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 06:45:26 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Richard Henderson , Stefano Stabellini , xen-devel@lists.xenproject.org, =?utf-8?q?Herv=C3=A9_Poussineau?= , Aurelien Jarno , Paul Durrant , Marcel Apfelbaum , Anthony Perard , "Michael S. Tsirkin" , Paolo Bonzini , Eduardo Habkost , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Chuck Zmudzinski , Bernhard Beschow Subject: [PATCH v2 4/6] hw/isa/piix: Avoid Xen-specific variant of piix_write_config() Date: Wed, 4 Jan 2023 15:44:35 +0100 Message-Id: <20230104144437.27479-5-shentey@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230104144437.27479-1-shentey@gmail.com> References: <20230104144437.27479-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=shentey@gmail.com; helo=mail-wr1-x435.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Subscribe to pci_bus_fire_intx_routing_notifier() instead which allows for having a common piix_write_config() for all PIIX device models. While at it, move the subscription into machine code in order to resolve TYPE_PIIX3_XEN_DEVICE. In a possible future followup, pci_bus_fire_intx_routing_notifier() could be adjusted in such a way that subscribing to it doesn't require knowledge of the device firing it. Signed-off-by: Bernhard Beschow --- hw/i386/pc_piix.c | 18 ++++++++++++++++++ hw/isa/piix.c | 22 +--------------------- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 792dcd3ce8..5738d9cdca 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -86,6 +86,21 @@ static int pci_slot_get_pirq(PCIDevice *pci_dev, int pci_intx) return (pci_intx + slot_addend) & 3; } +static void piix_intx_routing_notifier_xen(PCIDevice *dev) +{ + int i; + + /* Scan for updates to PCI link routes (0x60-0x63). */ + for (i = 0; i < PIIX_NUM_PIRQS; i++) { + uint8_t v = dev->config_read(dev, PIIX_PIRQCA + i, 1); + if (v & 0x80) { + v = 0; + } + v &= 0xf; + xen_set_pci_link_route(i, v); + } +} + /* PC hardware initialisation */ static void pc_init1(MachineState *machine, const char *host_type, const char *pci_type) @@ -248,6 +263,9 @@ static void pc_init1(MachineState *machine, pci_realize_and_unref(pci_dev, pci_bus, &error_fatal); if (xen_enabled()) { + pci_device_set_intx_routing_notifier( + pci_dev, piix_intx_routing_notifier_xen); + /* * Xen supports additional interrupt routes from the PCI devices to * the IOAPIC: the four pins of each PCI device on the bus are also diff --git a/hw/isa/piix.c b/hw/isa/piix.c index ac04781f46..d4cdb3dadb 100644 --- a/hw/isa/piix.c +++ b/hw/isa/piix.c @@ -125,26 +125,6 @@ static void piix_write_config(PCIDevice *dev, uint32_t address, uint32_t val, } } -static void piix3_write_config_xen(PCIDevice *dev, - uint32_t address, uint32_t val, int len) -{ - int i; - - /* Scan for updates to PCI link routes (0x60-0x63). */ - for (i = 0; i < len; i++) { - uint8_t v = (val >> (8 * i)) & 0xff; - if (v & 0x80) { - v = 0; - } - v &= 0xf; - if (((address + i) >= PIIX_PIRQCA) && ((address + i) <= PIIX_PIRQCD)) { - xen_set_pci_link_route(address + i - PIIX_PIRQCA, v); - } - } - - piix_write_config(dev, address, val, len); -} - static void piix_reset(DeviceState *dev) { PIIXState *d = PIIX_PCI_DEVICE(dev); @@ -490,7 +470,7 @@ static void piix3_xen_class_init(ObjectClass *klass, void *data) DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); - k->config_write = piix3_write_config_xen; + k->config_write = piix_write_config; k->realize = piix3_realize; /* 82371SB PIIX3 PCI-to-ISA bridge (Step A1) */ k->device_id = PCI_DEVICE_ID_INTEL_82371SB_0; From patchwork Wed Jan 4 14:44:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13088668 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0F68FC4708D for ; Wed, 4 Jan 2023 14:47:39 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pD51a-0005If-Lg; Wed, 04 Jan 2023 09:45:50 -0500 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 1pD51H-0005Fi-SC for qemu-devel@nongnu.org; Wed, 04 Jan 2023 09:45:40 -0500 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pD51F-0002r7-Cv for qemu-devel@nongnu.org; Wed, 04 Jan 2023 09:45:30 -0500 Received: by mail-wr1-x42a.google.com with SMTP id bn26so13737867wrb.0 for ; Wed, 04 Jan 2023 06:45:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZTbz96Fg6rdZNkQF03buq3nvArFrt1X2bnXBL/QETy8=; b=W9Un76kfIXX71algBT3MUyLCUiN80OFK1EUd0YbCe6wUItAP0Luda8qEceYXzOUdFw jY1QLBi8eG0gW8dCgOjygcJ+fp4QbyzP8Ye4eARwBnC9y0DkgijILW6lYwfh0Jwvet2r 4qrOldpBtix87pTunJpR5Hzs+5mBOue2wekAGVrS5ABa97Ub9oHHVlIjCdGw8E/QrMWt uF7+vwGjO6ufN4oR16pm29afZxpgs19LCt554cFbOcBl4NTLEdn0+fh7sb0bkFYX/Qy3 /7j2qYCvOrtcFrstpMIW3NJQlCJzKvvJDPW6GJrhHDp8NV6E0rozu/tgN7PiVc9LxJ4d rJkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZTbz96Fg6rdZNkQF03buq3nvArFrt1X2bnXBL/QETy8=; b=qbCiUnMpsNAVYlIYor79DvWn60tabjGWS5c+zl5z6CWcTKGteXpYjvaUpf4T/TfM10 yFqweG5ff/RNiTTMyvkRkigtmkwj5/6u3bPMRQyIzznUJrbShqzjFlC63Qo+iwuCvkBS hh1vmiUrmWj8R6oaUXCeuTmLIwM5AilGgrJWQ7baIM9ERxls9Tpdiwf9o0XQle1VC6m5 c80wTn85BRdUk35QFaJYpfEbXvww9SZs03nvq02NrjcJP28oGFuLbShbK7xEOruYMZwK HMBqGPaTRM6ESNMjCp94vU126SaKTNzNK4yt2LABE/Q6UqPNZ6drOa2nSnHq2PMc/XRt LtaQ== X-Gm-Message-State: AFqh2koX6fLAAvYwxmyONDjpdQ9VaGwSmXXOPbAnfmiwlBp9Hlib0DaB gu2Nz79IieBxM0/ngn7hpAu5+KjiLimjZg== X-Google-Smtp-Source: AMrXdXuqwFIIXGumdoGoKi2S2o1kZi2sGwiXEGMwUaQU6kBeT44weD6z/UJouVJiTGdquTAHfyXG3g== X-Received: by 2002:a5d:640c:0:b0:2a3:1c13:2888 with SMTP id z12-20020a5d640c000000b002a31c132888mr2471851wru.60.1672843527498; Wed, 04 Jan 2023 06:45:27 -0800 (PST) Received: from osoxes.fritz.box (p200300faaf0bb2009c4947838afc41b6.dip0.t-ipconnect.de. [2003:fa:af0b:b200:9c49:4783:8afc:41b6]) by smtp.gmail.com with ESMTPSA id e10-20020a5d594a000000b0028663fc8f4csm21168241wri.30.2023.01.04.06.45.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 06:45:27 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Richard Henderson , Stefano Stabellini , xen-devel@lists.xenproject.org, =?utf-8?q?Herv=C3=A9_Poussineau?= , Aurelien Jarno , Paul Durrant , Marcel Apfelbaum , Anthony Perard , "Michael S. Tsirkin" , Paolo Bonzini , Eduardo Habkost , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Chuck Zmudzinski , Bernhard Beschow Subject: [PATCH v2 5/6] hw/isa/piix: Resolve redundant k->config_write assignments Date: Wed, 4 Jan 2023 15:44:36 +0100 Message-Id: <20230104144437.27479-6-shentey@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230104144437.27479-1-shentey@gmail.com> References: <20230104144437.27479-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=shentey@gmail.com; helo=mail-wr1-x42a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org The previous patch unified handling of piix_write_config() accross all PIIX device models which allows for assigning k->config_write once in the base class. Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daudé --- hw/isa/piix.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hw/isa/piix.c b/hw/isa/piix.c index d4cdb3dadb..98e9b12661 100644 --- a/hw/isa/piix.c +++ b/hw/isa/piix.c @@ -396,6 +396,7 @@ static void pci_piix_class_init(ObjectClass *klass, void *data) PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); AcpiDevAmlIfClass *adevc = ACPI_DEV_AML_IF_CLASS(klass); + k->config_write = piix_write_config; dc->reset = piix_reset; dc->desc = "ISA bridge"; dc->hotpluggable = false; @@ -451,7 +452,6 @@ static void piix3_class_init(ObjectClass *klass, void *data) DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); - k->config_write = piix_write_config; k->realize = piix3_realize; /* 82371SB PIIX3 PCI-to-ISA bridge (Step A1) */ k->device_id = PCI_DEVICE_ID_INTEL_82371SB_0; @@ -470,7 +470,6 @@ static void piix3_xen_class_init(ObjectClass *klass, void *data) DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); - k->config_write = piix_write_config; k->realize = piix3_realize; /* 82371SB PIIX3 PCI-to-ISA bridge (Step A1) */ k->device_id = PCI_DEVICE_ID_INTEL_82371SB_0; @@ -519,7 +518,6 @@ static void piix4_class_init(ObjectClass *klass, void *data) DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); - k->config_write = piix_write_config; k->realize = piix4_realize; k->device_id = PCI_DEVICE_ID_INTEL_82371AB_0; dc->vmsd = &vmstate_piix4; From patchwork Wed Jan 4 14:44:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13088664 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3244DC46467 for ; Wed, 4 Jan 2023 14:46:22 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pD51Y-0005IG-7W; Wed, 04 Jan 2023 09:45:48 -0500 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 1pD51J-0005Fn-9n for qemu-devel@nongnu.org; Wed, 04 Jan 2023 09:45:40 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pD51H-0002rl-Jb for qemu-devel@nongnu.org; Wed, 04 Jan 2023 09:45:33 -0500 Received: by mail-wm1-x330.google.com with SMTP id g10so11942566wmo.1 for ; Wed, 04 Jan 2023 06:45:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=E4FebSrd6qw4EtXuaelySJNjsiB1Oj70YbVnrwvN8/I=; b=lMKvYCGOWYmnaT84GaMb23/VAi195oDQudE1wLzcerQEkKvvtsHLGjOSg3Wp4GFafE XEtBgvv3xHIUWKKXmH1Ae9427VzyfEBA7cUKnYZSZvXPXSBefmryW+xa2Iv6VyKgWZfs r85U50UOY19i1THGPSpmLtkLrbogJ7ind85Uxcyqly4kLwW+iIYVU0SFYWcvUyE/B88b LnK2tJgHA8CffJ4VpAQZujNkJQGRaVtif+jOh2hKIW0Htmy+z0Ns9XHX5CwsqjO/ECtm 2O5VciXS7zNEcI+bZMOyLKHtdkcj+Ej/CLxWUUVLE1r7h5cOkCZL6K1xhBFqGNEijOdc pK5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=E4FebSrd6qw4EtXuaelySJNjsiB1Oj70YbVnrwvN8/I=; b=fNzF6O9+00nS0Q3RSCpoL8VK5CxQD3+8JtgVjceTU5bCt+CMjnjLvg5PU0FZk2rI+9 nbsS73xIBn6KjC14yAvQyM4z3cboNE3JeHJwG82bXG14fHbNUQhDrtbrCV1mXDIt40It N0NPaw/QfxBcDNqOJlv9fCItiBV7ApH9S/Yy+8rOWeWxLxK0yJxPRukEwUT551dtD94G YMOOMdbHVrDCKnq4KbU5bPvRbxILTgBBThhnKkYQKI8OPor5BfJAul5Zkj7Zx4nSdcWR FTXxtaCX8u/fPQ7n8/AtKG69H/IFIpk9Kf8SnNExE8tTvbrjkWZyRednKnOG6FPD8XHh 41Og== X-Gm-Message-State: AFqh2kpMPzfz7eiQqLVfuf4ItaE1CYcMV2mIm6b5Q0QQYrfLqPwX26r7 NpUtwGkWQvy0r5rT3PUFw/rpewYp/8SrSw== X-Google-Smtp-Source: AMrXdXsYGgxoZWnwVZ7yR7arNry46fXICAla5+IdicOq5hbJrnHe2MpsGju5mZBACJ42RwflZH2L8w== X-Received: by 2002:a05:600c:54cb:b0:3cf:d0be:1231 with SMTP id iw11-20020a05600c54cb00b003cfd0be1231mr41547624wmb.13.1672843529178; Wed, 04 Jan 2023 06:45:29 -0800 (PST) Received: from osoxes.fritz.box (p200300faaf0bb2009c4947838afc41b6.dip0.t-ipconnect.de. [2003:fa:af0b:b200:9c49:4783:8afc:41b6]) by smtp.gmail.com with ESMTPSA id e10-20020a5d594a000000b0028663fc8f4csm21168241wri.30.2023.01.04.06.45.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 06:45:28 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Richard Henderson , Stefano Stabellini , xen-devel@lists.xenproject.org, =?utf-8?q?Herv=C3=A9_Poussineau?= , Aurelien Jarno , Paul Durrant , Marcel Apfelbaum , Anthony Perard , "Michael S. Tsirkin" , Paolo Bonzini , Eduardo Habkost , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Chuck Zmudzinski , Bernhard Beschow Subject: [PATCH v2 6/6] hw/isa/piix: Resolve redundant TYPE_PIIX3_XEN_DEVICE Date: Wed, 4 Jan 2023 15:44:37 +0100 Message-Id: <20230104144437.27479-7-shentey@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230104144437.27479-1-shentey@gmail.com> References: <20230104144437.27479-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=shentey@gmail.com; helo=mail-wm1-x330.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org During the last patches, TYPE_PIIX3_XEN_DEVICE turned into a clone of TYPE_PIIX3_DEVICE. Remove this redundancy. Signed-off-by: Bernhard Beschow Tested-by: Chuck Zmudzinski --- hw/i386/pc_piix.c | 4 +--- hw/isa/piix.c | 20 -------------------- include/hw/southbridge/piix.h | 1 - 3 files changed, 1 insertion(+), 24 deletions(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 5738d9cdca..6b8de3d59d 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -235,8 +235,6 @@ static void pc_init1(MachineState *machine, if (pcmc->pci_enabled) { DeviceState *dev; PCIDevice *pci_dev; - const char *type = xen_enabled() ? TYPE_PIIX3_XEN_DEVICE - : TYPE_PIIX3_DEVICE; int i; pci_bus = i440fx_init(pci_type, @@ -250,7 +248,7 @@ static void pc_init1(MachineState *machine, : pci_slot_get_pirq); pcms->bus = pci_bus; - pci_dev = pci_new_multifunction(-1, true, type); + pci_dev = pci_new_multifunction(-1, true, TYPE_PIIX3_DEVICE); object_property_set_bool(OBJECT(pci_dev), "has-usb", machine_usb(machine), &error_abort); object_property_set_bool(OBJECT(pci_dev), "has-acpi", diff --git a/hw/isa/piix.c b/hw/isa/piix.c index 98e9b12661..e4587352c9 100644 --- a/hw/isa/piix.c +++ b/hw/isa/piix.c @@ -33,7 +33,6 @@ #include "hw/qdev-properties.h" #include "hw/ide/piix.h" #include "hw/isa/isa.h" -#include "hw/xen/xen.h" #include "sysemu/runstate.h" #include "migration/vmstate.h" #include "hw/acpi/acpi_aml_interface.h" @@ -465,24 +464,6 @@ static const TypeInfo piix3_info = { .class_init = piix3_class_init, }; -static void piix3_xen_class_init(ObjectClass *klass, void *data) -{ - DeviceClass *dc = DEVICE_CLASS(klass); - PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); - - k->realize = piix3_realize; - /* 82371SB PIIX3 PCI-to-ISA bridge (Step A1) */ - k->device_id = PCI_DEVICE_ID_INTEL_82371SB_0; - dc->vmsd = &vmstate_piix3; -} - -static const TypeInfo piix3_xen_info = { - .name = TYPE_PIIX3_XEN_DEVICE, - .parent = TYPE_PIIX_PCI_DEVICE, - .instance_init = piix3_init, - .class_init = piix3_xen_class_init, -}; - static void piix4_realize(PCIDevice *dev, Error **errp) { ERRP_GUARD(); @@ -534,7 +515,6 @@ static void piix3_register_types(void) { type_register_static(&piix_pci_type_info); type_register_static(&piix3_info); - type_register_static(&piix3_xen_info); type_register_static(&piix4_info); } diff --git a/include/hw/southbridge/piix.h b/include/hw/southbridge/piix.h index 65ad8569da..b1fc94a742 100644 --- a/include/hw/southbridge/piix.h +++ b/include/hw/southbridge/piix.h @@ -77,7 +77,6 @@ struct PIIXState { OBJECT_DECLARE_SIMPLE_TYPE(PIIXState, PIIX_PCI_DEVICE) #define TYPE_PIIX3_DEVICE "PIIX3" -#define TYPE_PIIX3_XEN_DEVICE "PIIX3-xen" #define TYPE_PIIX4_PCI_DEVICE "piix4-isa" #endif