From patchwork Sun Oct 22 09:25:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1853184 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=T7yR/Qbv; dkim-atps=neutral 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=patchwork.ozlabs.org) 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 4SCtKQ0P7vz202k for ; Sun, 22 Oct 2023 20:28:10 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1quUiP-00075h-E4; Sun, 22 Oct 2023 05:25:45 -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 1quUiN-00074o-UV for qemu-devel@nongnu.org; Sun, 22 Oct 2023 05:25:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quUiM-0000tS-Fl for qemu-devel@nongnu.org; Sun, 22 Oct 2023 05:25:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697966741; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=XEKbyD70yRR+QPK/g+c3Uv20C9zzfiDuTxSKNieues8=; b=T7yR/QbvPWZn3VJ8uJScS+hLTnBE4JXwVqWwgplnaZR5+2CpfHLUXghAzsut3Y/+Qdm3up sTluKabyPTnX9NGezeMesvhWoh4EKSDiV5sb9bHdlLFk+eg8GYQZpDt7MbraceyW7ZDjIJ B7i8Q1iKQWR0cGTCtdSG8qmpOXgFTr0= Received: from mail-lj1-f200.google.com (mail-lj1-f200.google.com [209.85.208.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-282-ssul3wYyN1GVafeVvN-XRw-1; Sun, 22 Oct 2023 05:25:24 -0400 X-MC-Unique: ssul3wYyN1GVafeVvN-XRw-1 Received: by mail-lj1-f200.google.com with SMTP id 38308e7fff4ca-2c51a7df557so18864361fa.0 for ; Sun, 22 Oct 2023 02:25:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697966722; x=1698571522; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=XEKbyD70yRR+QPK/g+c3Uv20C9zzfiDuTxSKNieues8=; b=r2mpR//69FE3s9xYWWU8+jHiHF8Oybk/WVHqP6Kgk58e469c4Ya9Jz3j+0IGdocmhl ikhL53ThAUXaswfLypKXcgwlBnpiRzjyFiwsRKDIjLUuOqSfoaYSYCH0Yp1l2QlmO/mP e9ipEzpcM3YJSmdjj2s939SjnQlL5V1ZweTAa/fHhrlVURwpRlvX+5yICQRNMruKPtMp LeaoSCQ0sDBlhLTgC9ANBLCJbjPwIhcbLlIxCePA5ZthM9bfbDxvsPf7VrWDoI5d0N0L CRgrWSARHLeWfMWaTWNpovlVX7CVlyWDQlb41qcIdI0zb2xHWUFd2t+6g79SBVwJQrcS nEjA== X-Gm-Message-State: AOJu0YzXWRGi/1wrFq8ifGWc9YlhCs/jeDiAWQO8j8cnCIqXWd0mS3RF t0GviJXXQdtiNvLxkqQiXeU8Fpaa9bz+DuQElYh2NLmkuq6PiZCtIm01dxqAEyUM5RfFLIzigtq 57hi4LrydCiTjFcyWDk2qCi1LXLjV5niHDAOksWVrpnTc1s+ujFd/Zm+HpnP+AkAtuMRJ X-Received: by 2002:a05:651c:b09:b0:2c5:82c:73d3 with SMTP id b9-20020a05651c0b0900b002c5082c73d3mr3783194ljr.40.1697966722284; Sun, 22 Oct 2023 02:25:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE/Ey6bFpr41sOGY8fBoKgT86UNuKxQdUBlw991KC78F5bZIYEy7EjkxSjBuJ0TcuD2MI5UQA== X-Received: by 2002:a05:651c:b09:b0:2c5:82c:73d3 with SMTP id b9-20020a05651c0b0900b002c5082c73d3mr3783179ljr.40.1697966721984; Sun, 22 Oct 2023 02:25:21 -0700 (PDT) Received: from redhat.com ([2.52.1.53]) by smtp.gmail.com with ESMTPSA id r4-20020a05600c458400b00405391f485fsm6419369wmo.41.2023.10.22.02.25.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Oct 2023 02:25:21 -0700 (PDT) Date: Sun, 22 Oct 2023 05:25:15 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , =?utf-8?b?SGVydsOp?= Poussineau , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= , Aurelien Jarno , Marcel Apfelbaum Subject: [PULL v3 48/62] hw/isa/piix: Resolve duplicate code regarding PCI interrupt wiring Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.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, 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_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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 From: Bernhard Beschow Now that both PIIX3 and PIIX4 use piix_set_irq() to trigger PCI IRQs the wiring in the respective realize methods can be shared, too. Signed-off-by: Bernhard Beschow Reviewed-by: Michael S. Tsirkin Message-Id: <20231007123843.127151-28-shentey@gmail.com> Signed-off-by: Michael S. Tsirkin --- hw/isa/piix.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/hw/isa/piix.c b/hw/isa/piix.c index 17677c2126..cba2098ca2 100644 --- a/hw/isa/piix.c +++ b/hw/isa/piix.c @@ -372,6 +372,8 @@ static void pci_piix_realize(PCIDevice *dev, const char *uhci_type, } qdev_connect_gpio_out(DEVICE(&d->pm), 0, d->isa_irqs_in[9]); } + + pci_bus_irqs(pci_bus, piix_set_pci_irq, d, PIIX_NUM_PIRQS); } static void build_pci_isa_aml(AcpiDevAmlIf *adev, Aml *scope) @@ -453,7 +455,6 @@ static const TypeInfo piix_pci_type_info = { static void piix3_realize(PCIDevice *dev, Error **errp) { ERRP_GUARD(); - PIIXState *piix3 = PIIX_PCI_DEVICE(dev); PCIBus *pci_bus = pci_get_bus(dev); pci_piix_realize(dev, TYPE_PIIX3_USB_UHCI, errp); @@ -461,7 +462,6 @@ static void piix3_realize(PCIDevice *dev, Error **errp) return; } - pci_bus_irqs(pci_bus, piix_set_pci_irq, piix3, PIIX_NUM_PIRQS); pci_bus_set_route_irq_fn(pci_bus, piix_route_intx_pin_to_irq); } @@ -492,16 +492,7 @@ static const TypeInfo piix3_info = { static void piix4_realize(PCIDevice *dev, Error **errp) { - ERRP_GUARD(); - PIIXState *s = PIIX_PCI_DEVICE(dev); - PCIBus *pci_bus = pci_get_bus(dev); - pci_piix_realize(dev, TYPE_PIIX4_USB_UHCI, errp); - if (*errp) { - return; - } - - pci_bus_irqs(pci_bus, piix_set_pci_irq, s, PIIX_NUM_PIRQS); } static void piix4_init(Object *obj)