From patchwork Sun Mar 12 12:02:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 1755854 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=eyX7uzfQ; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PZJMq6Xfgz1yWs for ; Sun, 12 Mar 2023 23:03:17 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pbKPT-0003NL-5T; Sun, 12 Mar 2023 08:02:43 -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 1pbKPR-0003LO-Hc for qemu-devel@nongnu.org; Sun, 12 Mar 2023 08:02:41 -0400 Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pbKPP-0000Iw-Lh for qemu-devel@nongnu.org; Sun, 12 Mar 2023 08:02:41 -0400 Received: by mail-ed1-x52f.google.com with SMTP id cn21so7937491edb.0 for ; Sun, 12 Mar 2023 05:02:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678622554; 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=3I5DWtzKsLyM4cyrY32zr2tTmXgNaQXMmqiAK0JjXes=; b=eyX7uzfQRseoDcVLf1glqqsf8V35kfMg00j4z1ki81t0uYpETsmGE/JyBsRsTefz6q AHUFGhoGUFUTcVaT8mqmjmRCeoj/p/7/pyp3LB/F7DMF/D15vIyAl8oMj/AKN7170XSj onOHEkO1hm4jC31ph56IvBpykFg5+f1kQzXT7sHOM1oN29vs0zml/TH7+Lpg+2D7/k2c WCwSPMvT9V2op5nuqH4UbWa1SBLV/JuONy5Er5lGyb3xv8UomMqwt0tJMVEkkoRq9kyI 2gURa5BX3w1J5pQVnMJg64eDTuW2zXxtcAmTvs9O79XLKODNAh9GqFQLb/oEzFHj04yk +TTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678622554; 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=3I5DWtzKsLyM4cyrY32zr2tTmXgNaQXMmqiAK0JjXes=; b=zRunlJMh/fVL9JI/ItKPOWjnC9fR4vHhCfpbc52Yp/5utoyaNsqMcAn/siLp/F7IXg YTm2Xc4tztPW9jCjZBNpmH3je9WnCrf4Futr21yAYM/wJNImZDcp5T+jyYL6VwdBV0qq ndw+TpuzbLdblC69lCH+ns4wByFNhBOCS/okbelmEAJEuVzHeombP7TbXzHgaiLrPPPd EkkENqsqUNZCf3lzK9w8znoD3iTdg6QhkULwyI2YuRQJ8oFS74HeRuXa2PGEkbVtrLrx C27UbGcWGhyoV687MMdlaPV6t1uoF6Gd9IHfMlcwWW1Fl+2waO6MYheCDJhTLuacKjw3 xKcg== X-Gm-Message-State: AO0yUKVx5z6YoJUqazUMh9Z/gwfvo5h3AzOoTH15Cl+JF98hz+joiELO NsYhBrM8Paof+aUA0kbqBeOnqGuOAl8= X-Google-Smtp-Source: AK7set9hj4vE3HzWNVGymwkFNRWqJxqDthLXr5YsmajpSOkBnHKY5RdbUl7r8I2QIpYWaP2socctfw== X-Received: by 2002:aa7:cfcc:0:b0:4fb:da15:5bfd with SMTP id r12-20020aa7cfcc000000b004fbda155bfdmr1179361edy.4.1678622554052; Sun, 12 Mar 2023 05:02:34 -0700 (PDT) Received: from Provence.localdomain (dynamic-078-054-022-093.78.54.pool.telefonica.de. [78.54.22.93]) by smtp.gmail.com with ESMTPSA id xj9-20020a170906db0900b009231714b3d4sm1293745ejb.151.2023.03.12.05.02.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Mar 2023 05:02:33 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Marcel Apfelbaum , Paolo Bonzini , David Woodhouse , Anthony Perard , =?utf-8?q?Herv=C3=A9_Poussineau?= , Aurelien Jarno , Eduardo Habkost , Paul Durrant , xen-devel@lists.xenproject.org, "Michael S. Tsirkin" , Stefano Stabellini , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Chuck Zmudzinski , Bernhard Beschow Subject: [PATCH v3 1/6] include/hw/xen/xen: Rename xen_piix3_set_irq() to xen_intx_set_irq() Date: Sun, 12 Mar 2023 13:02:16 +0100 Message-Id: <20230312120221.99183-2-shentey@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230312120221.99183-1-shentey@gmail.com> References: <20230312120221.99183-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52f; envelope-from=shentey@gmail.com; helo=mail-ed1-x52f.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.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: Michael S. Tsirkin --- include/hw/xen/xen.h | 2 +- hw/i386/xen/xen-hvm.c | 2 +- hw/isa/piix3.c | 4 ++-- stubs/xen-hw-stub.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/hw/xen/xen.h b/include/hw/xen/xen.h index 2bd8ec742d..37ecc91fc3 100644 --- a/include/hw/xen/xen.h +++ b/include/hw/xen/xen.h @@ -39,7 +39,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/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c index 56641a550e..ab8f1b61ee 100644 --- a/hw/i386/xen/xen-hvm.c +++ b/hw/i386/xen/xen-hvm.c @@ -143,7 +143,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/piix3.c b/hw/isa/piix3.c index a9cb39bf21..1b3e23f0d7 100644 --- a/hw/isa/piix3.c +++ b/hw/isa/piix3.c @@ -34,7 +34,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 piix3_set_irq_pic(PIIX3State *piix3, int pic_irq) { @@ -405,7 +405,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/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 Sun Mar 12 12:02:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 1755858 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=CRFIKihi; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PZJNT5LTXz1yWt for ; Sun, 12 Mar 2023 23:03:53 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pbKPT-0003NW-CT; Sun, 12 Mar 2023 08:02:43 -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 1pbKPS-0003Mn-QN for qemu-devel@nongnu.org; Sun, 12 Mar 2023 08:02:42 -0400 Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pbKPP-0000J1-Mi for qemu-devel@nongnu.org; Sun, 12 Mar 2023 08:02:42 -0400 Received: by mail-ed1-x533.google.com with SMTP id cy23so38018821edb.12 for ; Sun, 12 Mar 2023 05:02:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678622555; 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=WWg4LuzaxWFvJH2Cc10WqoexJQmNb/n77OizqFG/hOg=; b=CRFIKihiG3gt5U7Bo9POrDRCvKcX7GhlR/4RrRquOq1v4D0aQQphgBlcVb+oKE619W Llu9/G1Ybdpw0CxHZULyucDFqERnJjlfCQ6QSuA1DH48U5evIEPeCz1tYTeXxEQicnHO IS83yQWd562FDvEzReKeF73BzrnwADN72svQtkzb/68v70DdxCeMuDCqdC1AogFwSo1U O7ZqtXNXZY0Lc9inLbJpjv1y5rww93LSySnMpjczQEdd+GZmmPxbYZ2Ncc95uROmaM2L e9pKi8P37Qdvbnfo7P80owlzihA6njd0jy1mHWVgE5ERWcrpXZ99qhFWb8leSlBPvvQ9 GlbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678622555; 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=WWg4LuzaxWFvJH2Cc10WqoexJQmNb/n77OizqFG/hOg=; b=au/wVctJ2TDLNEvCZKodvEzPlKYVJoLiH/16AAYdYg+nBcdO4lHA62Em4tp7CEgBBW Ca0yl1tGls8N8NLNvy0jaKftdK18Cb6RvrGfxfYYSM3QJe4nmWar0bsKNaUyVJWfaZgc jIIidzZ6UbFUbrFcHUbm1ORfnasu6nB4i8T6rBXhSGwAvaWtqu9uw65IeAQIwwLSKWZF HSTYaZQJKbsb5qCAQRtC6i8Ck/F1oUu7VWDGHKaBT9l+e0dv1XJRsrV1d9nic0aE/ifE SxUWhY/EqFocN9PZfutvev6iq6jhfdlSeKTFIoAOAfW/d64HaUZ1VHaiWiQreONhtmjx 4Wuw== X-Gm-Message-State: AO0yUKVvu0UlT507RyzDGMmJhc2RkVkkcamwmA8OO4bUTkv3vvAwskAr WPNYXvRDKuu21EBe48FXjMz1LQ+5nJM= X-Google-Smtp-Source: AK7set+8bU52UZ6EPZu8793oap+FG+WY4eM5GCpxYQgaKRcrzsOTsF85v6SrfshFWBQhYEm6N29wPQ== X-Received: by 2002:a17:907:1905:b0:8a6:e075:e364 with SMTP id ll5-20020a170907190500b008a6e075e364mr30020126ejc.26.1678622555342; Sun, 12 Mar 2023 05:02:35 -0700 (PDT) Received: from Provence.localdomain (dynamic-078-054-022-093.78.54.pool.telefonica.de. [78.54.22.93]) by smtp.gmail.com with ESMTPSA id xj9-20020a170906db0900b009231714b3d4sm1293745ejb.151.2023.03.12.05.02.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Mar 2023 05:02:34 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Marcel Apfelbaum , Paolo Bonzini , David Woodhouse , Anthony Perard , =?utf-8?q?Herv=C3=A9_Poussineau?= , Aurelien Jarno , Eduardo Habkost , Paul Durrant , xen-devel@lists.xenproject.org, "Michael S. Tsirkin" , Stefano Stabellini , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Chuck Zmudzinski , Bernhard Beschow Subject: [PATCH v3 2/6] hw/isa/piix3: Reuse piix3_realize() in piix3_xen_realize() Date: Sun, 12 Mar 2023 13:02:17 +0100 Message-Id: <20230312120221.99183-3-shentey@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230312120221.99183-1-shentey@gmail.com> References: <20230312120221.99183-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::533; envelope-from=shentey@gmail.com; helo=mail-ed1-x533.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.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 Reviewed-by: Michael S. Tsirkin --- hw/isa/piix3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c index 1b3e23f0d7..a86cd23ef4 100644 --- a/hw/isa/piix3.c +++ b/hw/isa/piix3.c @@ -394,7 +394,7 @@ static void piix3_xen_realize(PCIDevice *dev, Error **errp) PIIX3State *piix3 = PIIX3_PCI_DEVICE(dev); PCIBus *pci_bus = pci_get_bus(dev); - pci_piix3_realize(dev, errp); + piix3_realize(dev, errp); if (*errp) { return; } From patchwork Sun Mar 12 12:02:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 1755857 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=IA1JYJLJ; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PZJNT2pvGz1yWs for ; Sun, 12 Mar 2023 23:03:53 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pbKPY-0003Op-Gm; Sun, 12 Mar 2023 08:02:48 -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 1pbKPS-0003Mh-Nt for qemu-devel@nongnu.org; Sun, 12 Mar 2023 08:02:42 -0400 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pbKPP-0000J7-MV for qemu-devel@nongnu.org; Sun, 12 Mar 2023 08:02:42 -0400 Received: by mail-ed1-x529.google.com with SMTP id k10so38029268edk.13 for ; Sun, 12 Mar 2023 05:02:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678622556; 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=XntQLcfKBZ4bUALJ2KcKbFlzPaRdUkUn5f75iO8ImkQ=; b=IA1JYJLJIDXDZUXlU+gf06wttIV49eC8CDEPbQoPMi6TiveH2bC5JG+Q6UJenXeBlH OuqyVa2LJ8fbgwsD618aaUbMFhMSMFgpv6Yk3wUdJ3Iuz+vHUAPFqvXiz6XO3inbN+e3 PdiHw6HTaXQDTKmin5QqC1M1AX4HbZjPhrO2xmpgVPMNrsZNKuLaD8594qaIknpFQc/0 0r9ocRPyNvM+Cj15SU5hmeBYKtZ5MR/vsaLSsR3edIKqT2DjowYwrk0jq/5Ae26kjVPk 0V1izQDgiS7e3CT/UILMHQt9YLh+blcAvCXAcQb+d3iI4mZ1DJ1K9EfHARqbPOml5JjV rvRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678622556; 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=XntQLcfKBZ4bUALJ2KcKbFlzPaRdUkUn5f75iO8ImkQ=; b=wpb5bVuEeFI80ZX5M5OuozgWREx1/85fFlM2e0ZWeqqB+9ka2J94UtYCeUedlikhnr HFqV7ceTvrivx7sqsKxi7xvCn/bzsyOm+z4k6NDIivRFx1OCZ1Ku/6XHC58aaSMT6V/J CIDFienJvwSxvSeBEN4MUu7wNPXl0kO9ulJCU+scrs43Dz8hgrBP5zQYWhANamxOHwAu 0vIiGp3CIQ5rRtTG76LB2+nIr27NJaI2bjrS5XyKoBNkqoSBE12bNove/pjRYpcKPI8W bxNnpr1t7dSZuR6qjFBMlpm6SxBTZL3rZT22PhLUyIKTxKKhSGSiop8iC7L2FyNFlbmN C8cQ== X-Gm-Message-State: AO0yUKWL8hb6UyEXqKL1f1oaiXLoUF/DKGaroG1nkeX3JQlCDTiSPPpK /LKhbNtO9gF1LmC/2T35c36Ax20YZA8= X-Google-Smtp-Source: AK7set+m7cWOv1RHybMAfOCzPRvQaV62dLX58iGhA9SZT8R7OwbyLmc241NiKS/XtNsdB4vzT9A0oA== X-Received: by 2002:a05:6402:1256:b0:4fb:1fa8:da25 with SMTP id l22-20020a056402125600b004fb1fa8da25mr2725543edw.36.1678622556599; Sun, 12 Mar 2023 05:02:36 -0700 (PDT) Received: from Provence.localdomain (dynamic-078-054-022-093.78.54.pool.telefonica.de. [78.54.22.93]) by smtp.gmail.com with ESMTPSA id xj9-20020a170906db0900b009231714b3d4sm1293745ejb.151.2023.03.12.05.02.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Mar 2023 05:02:36 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Marcel Apfelbaum , Paolo Bonzini , David Woodhouse , Anthony Perard , =?utf-8?q?Herv=C3=A9_Poussineau?= , Aurelien Jarno , Eduardo Habkost , Paul Durrant , xen-devel@lists.xenproject.org, "Michael S. Tsirkin" , Stefano Stabellini , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Chuck Zmudzinski , Bernhard Beschow Subject: [PATCH v3 3/6] hw/isa/piix3: Wire up Xen PCI IRQ handling outside of PIIX3 Date: Sun, 12 Mar 2023 13:02:18 +0100 Message-Id: <20230312120221.99183-4-shentey@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230312120221.99183-1-shentey@gmail.com> References: <20230312120221.99183-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::529; envelope-from=shentey@gmail.com; helo=mail-ed1-x529.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- 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 30eedd62a3..99232701b1 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -69,6 +69,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 }; @@ -236,6 +237,18 @@ static void pc_init1(MachineState *machine, pcms->bus = pci_bus; pci_dev = pci_create_simple_multifunction(pci_bus, -1, true, type); + + 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); + } + piix3 = PIIX3_PCI_DEVICE(pci_dev); piix3->pic = x86ms->gsi; piix3_devfn = piix3->dev.devfn; diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c index a86cd23ef4..7a31caf2b6 100644 --- a/hw/isa/piix3.c +++ b/hw/isa/piix3.c @@ -34,8 +34,6 @@ #include "migration/vmstate.h" #include "hw/acpi/acpi_aml_interface.h" -#define XEN_IOAPIC_NUM_PIRQS 128ULL - static void piix3_set_irq_pic(PIIX3State *piix3, int pic_irq) { qemu_set_irq(piix3->pic[pic_irq], @@ -388,32 +386,12 @@ static const TypeInfo piix3_info = { .class_init = piix3_class_init, }; -static void piix3_xen_realize(PCIDevice *dev, Error **errp) -{ - ERRP_GUARD(); - PIIX3State *piix3 = PIIX3_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) { PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); k->config_write = piix3_write_config_xen; - k->realize = piix3_xen_realize; + k->realize = piix3_realize; } static const TypeInfo piix3_xen_info = { From patchwork Sun Mar 12 12:02:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 1755859 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=jEeVgDff; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PZJNy2Mylz1yWs for ; Sun, 12 Mar 2023 23:04:18 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pbKPZ-0003PV-Bv; Sun, 12 Mar 2023 08:02:49 -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 1pbKPS-0003N5-V0 for qemu-devel@nongnu.org; Sun, 12 Mar 2023 08:02:42 -0400 Received: from mail-ed1-x52a.google.com ([2a00:1450:4864:20::52a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pbKPP-0000JI-Ov for qemu-devel@nongnu.org; Sun, 12 Mar 2023 08:02:42 -0400 Received: by mail-ed1-x52a.google.com with SMTP id y4so8668881edo.2 for ; Sun, 12 Mar 2023 05:02:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678622558; 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=RBFe6isXemizys2ZScF1519YX/IBVf8Fe2lCN47Nhmw=; b=jEeVgDffRRyW968Swa7lqu7lroeT8xJYKJInXZP3t6A13twsb+EHBk2J/YoNSVQnPV gg0XRFr/CfWbHpZTNgw5YtoTRdtgeS4SAk4DskE8FHZbIJ+zzPwtuxyD7IyZBEjNPL36 g1kKmeSdT//9n4PhSFkymflDWigo/cvVUB5TnAmGZJoyP5QN5fre57djW8JEyZjhQR14 35nDcsxUL7/nYfKcgjpLPNatKtUyrz5hN3uPdVXbwuRSx6iZamt9RH0CTFTYzxZusmn2 IJf1k1Z91KCDjwtqecPITM6uD2u6UXMlE4hk1+lnizOEOuR9KnzyOwy/gfliqCG8oQBn BreA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678622558; 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=RBFe6isXemizys2ZScF1519YX/IBVf8Fe2lCN47Nhmw=; b=0iRB0r6u2Xksp6vNXAWFhY2do0KkgJ4TatF78mxtDLJ5YP0cSZmaOaSTRVaNgrAhk0 dDLrnsg57Fbg7lLC7DGKu0PF3Hf2tom6ABm9p0+ilBfIbcpMIg577Zx2Fz7J9J/nEoVz bkUS7feupPX4gHTkOdFY/vTTM1bEukxxK3VV6c6hzSWOGpMgyo7bM0YlyThSgUy8ligh yBDiaRc8HTT5Ci90yCpHse2pdmeK+kMyegjMTtswIIXdWSTuzb7ed2t07/v9RHJYKAZV eVu9K4nNkjqB9IGWTPUY6boRgmlzgfUVfvlI7EbB8IKQr81EAvfPqJMtERNiIpX+DoaG /00g== X-Gm-Message-State: AO0yUKUCqiwKkjihd5nwuEs5mWOh/zbexlQvbdPRw8uJAd+Ima+Oovf4 kNUuHRF5Gs52XRa4y/9rCUnB4CkjRGk= X-Google-Smtp-Source: AK7set8Wx7bgBz0LKNNdj30Zp9yG/FUuWGPNpNmPLTPHiXWpvjIuclL65Zb7jvEMxOZ/8BLXTnb6uA== X-Received: by 2002:aa7:c1c4:0:b0:4af:62af:460a with SMTP id d4-20020aa7c1c4000000b004af62af460amr32491333edp.8.1678622557959; Sun, 12 Mar 2023 05:02:37 -0700 (PDT) Received: from Provence.localdomain (dynamic-078-054-022-093.78.54.pool.telefonica.de. [78.54.22.93]) by smtp.gmail.com with ESMTPSA id xj9-20020a170906db0900b009231714b3d4sm1293745ejb.151.2023.03.12.05.02.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Mar 2023 05:02:37 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Marcel Apfelbaum , Paolo Bonzini , David Woodhouse , Anthony Perard , =?utf-8?q?Herv=C3=A9_Poussineau?= , Aurelien Jarno , Eduardo Habkost , Paul Durrant , xen-devel@lists.xenproject.org, "Michael S. Tsirkin" , Stefano Stabellini , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Chuck Zmudzinski , Bernhard Beschow Subject: [PATCH v3 4/6] hw/isa/piix3: Avoid Xen-specific variant of piix3_write_config() Date: Sun, 12 Mar 2023 13:02:19 +0100 Message-Id: <20230312120221.99183-5-shentey@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230312120221.99183-1-shentey@gmail.com> References: <20230312120221.99183-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52a; envelope-from=shentey@gmail.com; helo=mail-ed1-x52a.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Subscribe to pci_bus_fire_intx_routing_notifier() instead which allows for having a common piix3_write_config() for the PIIX3 device models. While at it, move the subscription into machine code to facilitate resolving 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 Reviewed-by: Michael S. Tsirkin --- hw/i386/pc_piix.c | 18 ++++++++++++++++++ hw/isa/piix3.c | 22 +--------------------- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 99232701b1..1b70470dcd 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -88,6 +88,21 @@ static int pc_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) @@ -239,6 +254,9 @@ static void pc_init1(MachineState *machine, pci_dev = pci_create_simple_multifunction(pci_bus, -1, true, type); 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/piix3.c b/hw/isa/piix3.c index 7a31caf2b6..737f5c6a5d 100644 --- a/hw/isa/piix3.c +++ b/hw/isa/piix3.c @@ -121,26 +121,6 @@ static void piix3_write_config(PCIDevice *dev, } } -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); - } - } - - piix3_write_config(dev, address, val, len); -} - static void piix3_reset(DeviceState *dev) { PIIX3State *d = PIIX3_PCI_DEVICE(dev); @@ -390,7 +370,7 @@ static void piix3_xen_class_init(ObjectClass *klass, void *data) { PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); - k->config_write = piix3_write_config_xen; + k->config_write = piix3_write_config; k->realize = piix3_realize; } From patchwork Sun Mar 12 12:02:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 1755853 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=qcpoFIQ+; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PZJMq73yZz2471 for ; Sun, 12 Mar 2023 23:03:17 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pbKPY-0003Oh-G2; Sun, 12 Mar 2023 08:02:48 -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 1pbKPS-0003Ml-Pu for qemu-devel@nongnu.org; Sun, 12 Mar 2023 08:02:42 -0400 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pbKPR-0000JN-0q for qemu-devel@nongnu.org; Sun, 12 Mar 2023 08:02:42 -0400 Received: by mail-ed1-x52e.google.com with SMTP id g10so9252711eda.1 for ; Sun, 12 Mar 2023 05:02:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678622559; 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=IeEvGg++lFeh8k7cLusk/ewqgWO+0IihMJjULI+D8m0=; b=qcpoFIQ+HklRYXLIh6GPxiw1QBLKylV/h/epwSeIgXeIYsgzhFld/1jrTl4ToJk8nj amsn4w4tAi/0k5NoN0R+S4Ad9xbPurvtz099V7SwD3T8zg8uJsgiM1cy6l3KYVnOh6l6 MZEreKMsK56ei5NEALPkXT0jKZG0b/eMDNSVgll5fU0uBn1z1UwHwdS+44xV2ylDDV7v rSHlYUEMLc75x8ezNSNwYDzIJyRuYg04bHSU//6HGu8TiIdi3mQ1uPri0dwvWBEaoi70 ccc2eKvSCLY8k+suJMkrbhaI7HDGtyt5eFrq62yDUW3cY0BNf+rMFfOivEsua/+1+ye0 YdPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678622559; 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=IeEvGg++lFeh8k7cLusk/ewqgWO+0IihMJjULI+D8m0=; b=GwTSsrYz/4J0rrljsg2Ro5XmgUYw4mbZO4eAgGPWIFmsZXs+ck48wc9SnQpqmX8iG6 /mFwv1RHM3xwlYVfR13RYbZJZI3Lghy5fwC4Hka6f6OpXm1y33zATbl1XnSNbGetvlP7 AcDrP2pGMOy6ZyPJl29nmbb8CeNeuXnioYKFQC0Bt/nDQZ1x/w+QnWo1Jg+JNLioWF/0 qJyDZnqAprWRC44kUJOhTPmNdA2W0ooU9K81OLelTyrf5RRDsNqvK/Oh/RzQSHWVcMPD ti143A6aV2kvb2q3FmYEWG+BfWF5OSTvs/qU/Q49pi+x5tqEjiXyzrxRZ1Md8hWfaOOG 9P9g== X-Gm-Message-State: AO0yUKUtl/F5k3PgLqgTWw4ydNhDMSJtb5V7H0jarDtQwjlW9tx1f2fz 3uxykkI2D8wssKw9NQrCzNjW2qhmzxY= X-Google-Smtp-Source: AK7set98iz+H2osc7xMl+ULgZZLU6IRoBeyuhWbYGxcktAEzZ9GIUquNW3UPb5oD9vNj3FFNI/TtYw== X-Received: by 2002:a17:907:608d:b0:88c:a43d:81bc with SMTP id ht13-20020a170907608d00b0088ca43d81bcmr37010919ejc.58.1678622559115; Sun, 12 Mar 2023 05:02:39 -0700 (PDT) Received: from Provence.localdomain (dynamic-078-054-022-093.78.54.pool.telefonica.de. [78.54.22.93]) by smtp.gmail.com with ESMTPSA id xj9-20020a170906db0900b009231714b3d4sm1293745ejb.151.2023.03.12.05.02.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Mar 2023 05:02:38 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Marcel Apfelbaum , Paolo Bonzini , David Woodhouse , Anthony Perard , =?utf-8?q?Herv=C3=A9_Poussineau?= , Aurelien Jarno , Eduardo Habkost , Paul Durrant , xen-devel@lists.xenproject.org, "Michael S. Tsirkin" , Stefano Stabellini , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Chuck Zmudzinski , Bernhard Beschow Subject: [PATCH v3 5/6] hw/isa/piix3: Resolve redundant k->config_write assignments Date: Sun, 12 Mar 2023 13:02:20 +0100 Message-Id: <20230312120221.99183-6-shentey@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230312120221.99183-1-shentey@gmail.com> References: <20230312120221.99183-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52e; envelope-from=shentey@gmail.com; helo=mail-ed1-x52e.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The previous patch unified handling of piix3_write_config() accross the PIIX3 device models which allows for assigning k->config_write once in the base class. Signed-off-by: Bernhard Beschow Reviewed-by: Michael S. Tsirkin --- hw/isa/piix3.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c index 737f5c6a5d..418940139d 100644 --- a/hw/isa/piix3.c +++ b/hw/isa/piix3.c @@ -308,6 +308,7 @@ static void pci_piix3_class_init(ObjectClass *klass, void *data) PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); AcpiDevAmlIfClass *adevc = ACPI_DEV_AML_IF_CLASS(klass); + k->config_write = piix3_write_config; dc->reset = piix3_reset; dc->desc = "ISA bridge"; dc->vmsd = &vmstate_piix3; @@ -356,7 +357,6 @@ static void piix3_class_init(ObjectClass *klass, void *data) { PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); - k->config_write = piix3_write_config; k->realize = piix3_realize; } @@ -370,7 +370,6 @@ static void piix3_xen_class_init(ObjectClass *klass, void *data) { PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); - k->config_write = piix3_write_config; k->realize = piix3_realize; } From patchwork Sun Mar 12 12:02:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 1755856 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=Bb3Kpzk2; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PZJNJ30Trz1yWs for ; Sun, 12 Mar 2023 23:03:43 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pbKPa-0003Pn-3b; Sun, 12 Mar 2023 08:02:50 -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 1pbKPU-0003Nd-3r for qemu-devel@nongnu.org; Sun, 12 Mar 2023 08:02:47 -0400 Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pbKPS-0000KI-12 for qemu-devel@nongnu.org; Sun, 12 Mar 2023 08:02:43 -0400 Received: by mail-ed1-x52f.google.com with SMTP id cn21so7938059edb.0 for ; Sun, 12 Mar 2023 05:02:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678622560; 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=rI8ZsjBtffxcL2MjNujcgsY63aeYdjHaEBqzmv9u0lo=; b=Bb3Kpzk2SxtKUqOKzwTifF1IA803ECM2pISHjBQ2M7dCXP/bjxvszlgJwciRFmpLlf wpbLHQ5FK99teDs8LawQjNEa6zlc5rgQg64kL5P0zKn+W+cxBBVTblF/mUJ5ZRb4Qu/j n9nPXQ/92Jh9tZN0O9DytfiFLFkJBo3sCHQDMNTgrfnYDShpasisGLrZClJe4jQSCSVG 1tokue7jyNcDFAhZMyA2O1cOi1h+dJR04uK43hD4hd25u2k4EIbibib2sj0BmmJOFaDn F+DM1dCZNoBvTPn9bY4nzRMaVkHh/tdyHv+MJkjSb4Eq+AczXyOLmt/MUH77b1i5Gj79 aFGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678622560; 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=rI8ZsjBtffxcL2MjNujcgsY63aeYdjHaEBqzmv9u0lo=; b=inlUTfjDPbOUi+rW2Z+xzgOdBtZVHzfolpQsgLJ2RAZxqLVHLIkzF2w14WKs3ZAoQM YeAIs6yl2Kr5Cg4ntbmv/YNzVTDagLjW0ElrqBgJLIsFelv1C/AS6QhaSaVHSx5/8ZKZ v2ty5B8DRFFhoPOLaIxgjF6TpClWBThs79G6mfpqkW1toh64aQkjMNxq/nQUiSC3lG8e MVZyde89N6tIum2JbUtaD66p0F11uKemB+SkgVXknDPaCip2NzgsHzEU6UoDj88fSr2l EPAzsL1yJCCqWxjw8IijGBPeCv0mS19JDJiJfgzwEWwXuO3IgpGsaE90eF8rKpH3WXyZ OyZg== X-Gm-Message-State: AO0yUKVhQUUWWY90bHypH4BM+clXv+nfmXq6S7C683UvDtO+UtzpMGop HoB056/3PwaS3asumST2bKQcQw0q1tY= X-Google-Smtp-Source: AK7set/AVzddu1+FdWEl/xC+HlzhM5PISCHhkaw6fcOuZgxBkpinOZysAximKBKKHBg8Pp5SPwa/xA== X-Received: by 2002:a17:906:5a6e:b0:926:e917:133c with SMTP id my46-20020a1709065a6e00b00926e917133cmr1303514ejc.47.1678622560375; Sun, 12 Mar 2023 05:02:40 -0700 (PDT) Received: from Provence.localdomain (dynamic-078-054-022-093.78.54.pool.telefonica.de. [78.54.22.93]) by smtp.gmail.com with ESMTPSA id xj9-20020a170906db0900b009231714b3d4sm1293745ejb.151.2023.03.12.05.02.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Mar 2023 05:02:39 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Marcel Apfelbaum , Paolo Bonzini , David Woodhouse , Anthony Perard , =?utf-8?q?Herv=C3=A9_Poussineau?= , Aurelien Jarno , Eduardo Habkost , Paul Durrant , xen-devel@lists.xenproject.org, "Michael S. Tsirkin" , Stefano Stabellini , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Chuck Zmudzinski , Bernhard Beschow Subject: [PATCH v3 6/6] hw/isa/piix3: Resolve redundant TYPE_PIIX3_XEN_DEVICE Date: Sun, 12 Mar 2023 13:02:21 +0100 Message-Id: <20230312120221.99183-7-shentey@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230312120221.99183-1-shentey@gmail.com> References: <20230312120221.99183-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52f; envelope-from=shentey@gmail.com; helo=mail-ed1-x52f.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.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 Reviewed-by: Michael S. Tsirkin --- include/hw/southbridge/piix.h | 1 - hw/i386/pc_piix.c | 5 ++--- hw/isa/piix3.c | 15 --------------- 3 files changed, 2 insertions(+), 19 deletions(-) diff --git a/include/hw/southbridge/piix.h b/include/hw/southbridge/piix.h index 0bf48e936d..51be04e984 100644 --- a/include/hw/southbridge/piix.h +++ b/include/hw/southbridge/piix.h @@ -64,7 +64,6 @@ DECLARE_INSTANCE_CHECKER(PIIX3State, PIIX3_PCI_DEVICE, TYPE_PIIX3_PCI_DEVICE) #define TYPE_PIIX3_DEVICE "PIIX3" -#define TYPE_PIIX3_XEN_DEVICE "PIIX3-xen" #define TYPE_PIIX4_PCI_DEVICE "piix4-isa" #endif diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 1b70470dcd..7ca0d6d14e 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -237,8 +237,6 @@ static void pc_init1(MachineState *machine, if (pcmc->pci_enabled) { PIIX3State *piix3; PCIDevice *pci_dev; - const char *type = xen_enabled() ? TYPE_PIIX3_XEN_DEVICE - : TYPE_PIIX3_DEVICE; pci_bus = i440fx_init(pci_type, i440fx_host, @@ -251,7 +249,8 @@ static void pc_init1(MachineState *machine, : pc_pci_slot_get_pirq); pcms->bus = pci_bus; - pci_dev = pci_create_simple_multifunction(pci_bus, -1, true, type); + pci_dev = pci_create_simple_multifunction(pci_bus, -1, true, + TYPE_PIIX3_DEVICE); if (xen_enabled()) { pci_device_set_intx_routing_notifier( diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c index 418940139d..0d6992af67 100644 --- a/hw/isa/piix3.c +++ b/hw/isa/piix3.c @@ -29,7 +29,6 @@ #include "hw/southbridge/piix.h" #include "hw/irq.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" @@ -366,24 +365,10 @@ static const TypeInfo piix3_info = { .class_init = piix3_class_init, }; -static void piix3_xen_class_init(ObjectClass *klass, void *data) -{ - PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); - - k->realize = piix3_realize; -} - -static const TypeInfo piix3_xen_info = { - .name = TYPE_PIIX3_XEN_DEVICE, - .parent = TYPE_PIIX3_PCI_DEVICE, - .class_init = piix3_xen_class_init, -}; - static void piix3_register_types(void) { type_register_static(&piix3_pci_type_info); type_register_static(&piix3_info); - type_register_static(&piix3_xen_info); } type_init(piix3_register_types)