From nobody Wed Nov 27 19:27:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1697645318; cv=none; d=zohomail.com; s=zohoarc; b=ke/C7ww7OkV0+WNwqPBhmPFSvxDowWUBXzlxn4eKZjGAB+Yjl4D7i9NIzCPVDCzjSPPnuLSZKsRiIcpvo1ZBupDJonjd5p6rFqSnKFN8QXgoykGIQaFk/tvNZ6sgRy8ebBI7NIp51nArI5FqRWNfu7s5WReKs7SN2Pyci+4TXMI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697645318; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=o+ER8U4zTaPMQSzbJAzk8GehGsCBqp1JYIJr1D7ENQ0=; b=AvCY2FfFFsJx5jo3oqrD4bRyj39dCkvyp2sbbAJVaS8zOXa0Xa4QbYwGe9hEq0S9sJBsIYTS/hUQwo+uM8ZHlhNYOgEvjUFIW6SXinDWfilRCUq4o9rMeXJtsRTDSWrWxGG2sl2P9QKFP2eI5fqDK2dFj07iaHgeI1dOD7buRgI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697645318081290.44943112851456; Wed, 18 Oct 2023 09:08:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8wj-0001G5-9H; Wed, 18 Oct 2023 11:58:57 -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 1qt8v3-0004YV-MG for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:57:17 -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 1qt8uz-0007DM-LR for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:57:12 -0400 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-216-naKvYCdJPj6HGLThrM2dBg-1; Wed, 18 Oct 2023 11:57:01 -0400 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4084001846eso3580815e9.1 for ; Wed, 18 Oct 2023 08:57:01 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id b3-20020adff243000000b003258934a4bcsm2401664wrp.42.2023.10.18.08.56.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:56:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644628; 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=o+ER8U4zTaPMQSzbJAzk8GehGsCBqp1JYIJr1D7ENQ0=; b=URqiGQBQtfrp1wOPWiEIfyhtx8W9Ng/5Jgq1VzNVnCK/IyJpARPfQy3GOnHuFYyXqHr8Rl flBOtowsyIOPcnyQjbBDwwVE8iqa65q0IaNM1wVV+6EVHws8iCEB5gSkizrszyXotSYoEM K4mV2BIDxyJG7mQzCbH2jMVMV0FETPk= X-MC-Unique: naKvYCdJPj6HGLThrM2dBg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644620; x=1698249420; 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=o+ER8U4zTaPMQSzbJAzk8GehGsCBqp1JYIJr1D7ENQ0=; b=S8cNKgufEPFBcnHYlMMnR5x7b5ITnkkUB4xXHuOtwhjTFvog4WBIExnQg4950VbtZu fDp5X34m/J7+zHjbibqGT1gQmIsz7I/o99wTY3FwELAAd0tIJskupHopHC2Z3WhFUU1K tJjaImNXYHcqIGEGVkk4Gy7Ri7l2pZJtUVwlVVKxIFp2A90pqP9uSU0volkrphXn1dSH YftH+TC0V2Nkd+cSUB8lnlW1+PTHqcpPunLLR+E1uZQK40e7oZWZWiWO1DnC4gUr/g6q 5H3ru4RR2ycrzDj5NayqmySkdvlKJmsaWbulNB0EWK0H+IYTihzJyUCoqUVuPRBX5j0L CefA== X-Gm-Message-State: AOJu0YwCqxwMgWWKtt/HZwamnWIUcIt6Nl8hae9RYSWASN5mW9KETImx 0wYzIgjlMv3mrA1nLZ3XhXjPtXF1XiW9ysPDTF5Hb3Iz05Y+hEYYFeIdprz1EGCxqmKBt09Gbrp PkxWPm6da0acx1ZorpGHETRvr6dwyCzgfcZhBqmGr7KHufk5u32V1zEAK0MvGhL6kAcrGU9Q= X-Received: by 2002:a5d:6308:0:b0:32d:a6f5:a511 with SMTP id i8-20020a5d6308000000b0032da6f5a511mr4208135wru.13.1697644620158; Wed, 18 Oct 2023 08:57:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFbKurOWUKoDT/MGxEF9R3whiG8pe13SZgkGotCctbNjS+W67QN9JQoZ7M8zk6ntZUnyRhrNw== X-Received: by 2002:a5d:6308:0:b0:32d:a6f5:a511 with SMTP id i8-20020a5d6308000000b0032da6f5a511mr4208117wru.13.1697644619716; Wed, 18 Oct 2023 08:56:59 -0700 (PDT) Date: Wed, 18 Oct 2023 11:56:54 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost , =?utf-8?B?SGVydsOp?= Poussineau , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Aurelien Jarno Subject: [PULL 47/83] hw/i386/pc_piix: Wire PIIX3's ISA interrupts by new "isa-irqs" property 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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1697645319142100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Bernhard Beschow Avoid assigning the private member of struct PIIX3State from outside which = goes against best QOM practices. Instead, implement best QOM practice by adding = an "isa-irqs" array property to TYPE_PIIX3_DEVICE and assign it in board code,= i.e. from outside. Signed-off-by: Bernhard Beschow Message-Id: <20231007123843.127151-6-shentey@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/southbridge/piix.h | 2 +- hw/i386/pc_piix.c | 7 ++++++- hw/isa/piix3.c | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/hw/southbridge/piix.h b/include/hw/southbridge/piix.h index 2317bb7974..bb898c6c88 100644 --- a/include/hw/southbridge/piix.h +++ b/include/hw/southbridge/piix.h @@ -46,7 +46,7 @@ struct PIIXState { #endif uint64_t pic_levels; =20 - qemu_irq *pic; + qemu_irq pic[ISA_NUM_IRQS]; =20 /* This member isn't used. Just for save/load compatibility */ int32_t pci_irq_levels_vmstate[PIIX_NUM_PIRQS]; diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index a003923788..4dc7298c15 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -263,10 +263,15 @@ static void pc_init1(MachineState *machine, if (pcmc->pci_enabled) { PIIX3State *piix3; PCIDevice *pci_dev; + DeviceState *dev; + size_t i; =20 pci_dev =3D pci_new_multifunction(-1, TYPE_PIIX3_DEVICE); piix3 =3D PIIX3_PCI_DEVICE(pci_dev); - piix3->pic =3D x86ms->gsi; + dev =3D DEVICE(pci_dev); + for (i =3D 0; i < ISA_NUM_IRQS; i++) { + qdev_connect_gpio_out_named(dev, "isa-irqs", i, x86ms->gsi[i]); + } pci_realize_and_unref(pci_dev, pci_bus, &error_fatal); =20 if (xen_enabled()) { diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c index 7240c91440..c17547a2c0 100644 --- a/hw/isa/piix3.c +++ b/hw/isa/piix3.c @@ -312,6 +312,8 @@ static void pci_piix3_init(Object *obj) { PIIX3State *d =3D PIIX3_PCI_DEVICE(obj); =20 + qdev_init_gpio_out_named(DEVICE(obj), d->pic, "isa-irqs", ISA_NUM_IRQS= ); + object_initialize_child(obj, "rtc", &d->rtc, TYPE_MC146818_RTC); } =20 --=20 MST