From nobody Tue Nov 26 08:42:43 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1709023468; cv=none; d=zohomail.com; s=zohoarc; b=CY6px4uOqHwL6LHtW35eUyE3qmfIKjjM5dIwHnVS/9SPFlujaKbUvozte/x0HK07zjbfBZEwdwU00dGvhBifbdp245WGSAx8i9JhKXDiW5MjZvLRscpur2E2CcfX2+cATMTXYJY6VBQUK70bJ2QE2dJAc51jNeSBeUlHnJB7kFk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1709023468; h=Content-Type:Content-Transfer-Encoding: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=6n+lSFzDNPiqC0LaZPK+z4bhN6r8eJn5HjneFPDs130=; b=f4YFoBlHKXXCxvGyn8MzlwMXc0HUtXZo381XiSm+Z3CyKptM3NBiR+/wijcV7wY8ln0SnhU/aL9rYJQ+8lA3hMg9SlvGJ8OHcQvzpIU50pSupemyOW9voHDkwRwEOsEFtYW+V4rAqLCLKSJQB/DBTUC9V+OoybzCFWOt3iOCx0U= 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 1709023468207599.4539900582164; Tue, 27 Feb 2024 00:44:28 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ret2w-0004cv-6G; Tue, 27 Feb 2024 03:42:42 -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 1ret2t-0004Nj-Ot for qemu-devel@nongnu.org; Tue, 27 Feb 2024 03:42:39 -0500 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ret2k-0008PC-UO for qemu-devel@nongnu.org; Tue, 27 Feb 2024 03:42:39 -0500 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-3392b045e0aso3338656f8f.2 for ; Tue, 27 Feb 2024 00:42:30 -0800 (PST) Received: from m1x-phil.lan (mic92-h03-176-184-33-214.dsl.sta.abo.bbox.fr. [176.184.33.214]) by smtp.gmail.com with ESMTPSA id h4-20020a5d4304000000b0033d6c928a95sm10651527wrq.63.2024.02.27.00.42.27 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 27 Feb 2024 00:42:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709023349; x=1709628149; darn=nongnu.org; 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=6n+lSFzDNPiqC0LaZPK+z4bhN6r8eJn5HjneFPDs130=; b=QItaDzK+d0e9PPr5rCmQlWI3GceZIPTQBLHcHoV7bWDEZfC7j6FlO4qNL/pSQ/h5y8 ++kPyC/Xg65wDdcLOzNxCIrtJ89I7HZV/0zWRu6mqQi9Eiu1SxBm93k5BuA2j7QPNE7c Rm1cI+er66wOSGDmlc/JinhH+OZF5QqLTvh3RcD1ZTd70qlqG0F1g9v075hVxdEcBfST lW3T/raLlXmLyrYmncKo4wTAXKiedARS9H5OgqQ7xGXL+Y0oZefmm4hPNSRkLgnc/12C ZzZX/QD/+snYCXxjHfF73w35jSj2l0RFIv7o8r+czZhZC2yNBUmYAeOhCDXubQGkHMyX Cimw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709023349; x=1709628149; 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=6n+lSFzDNPiqC0LaZPK+z4bhN6r8eJn5HjneFPDs130=; b=XSxwjHB5CnLHoQuMrumZ64E422/eMKGGMfENjS1mN0laZhpYU91nUVcCqYhE17w1zp REhLEzPmXxyUe2bUwIUa+NEsjb1P5AFhlOhAfYjwhRm+4HuSXwXthZm56NxPc6R2TBNt VhHlumETig5oMqq4HZXZ4dLDBeU8xIlOM2kP8N4hmQjAiWUmdSpyKRScMedPvyf8DARH rsevHWW0vLPkZJMvx+XKIYznCMq+2W70mt1kb2zMkNQbT0Qw0oX1s9Wcn/HcuGLjDqeV gFlHtHm12gFW2cwGNXdnxmRI/IU6og3+dHXmBSigQibmHOzs2YnT5zQdl7Lo2KI6d8Iv TTyA== X-Gm-Message-State: AOJu0Yy8gF8qTL29K39v2mDG4+UETHpcQ1fQ1z3OH26Zg5Zs9GS9FSpM HylgkW0KLyKG5iLgw9atd+xtC9z/Pn/S7Qy2otrSlg+tQR121QPEnv7lSAAAnq/VuiP4LLl1L1g 0 X-Google-Smtp-Source: AGHT+IF8q8gfAJHOTCX7PEWFh8PpuCnCY4f2YHr5+0f74w9LfA9EVmTiqht62H8BY2KN7xZMpzI4Xg== X-Received: by 2002:adf:ea81:0:b0:33d:74f2:820e with SMTP id s1-20020adfea81000000b0033d74f2820emr7496378wrm.30.1709023349088; Tue, 27 Feb 2024 00:42:29 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-block@nongnu.org, qemu-arm@nongnu.org, Bernhard Beschow , "Michael S . Tsirkin" , Zhao Liu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum Subject: [PULL 25/30] hw/i386/pc_{piix, q35}: Eliminate local pci_bus/pci_host variables Date: Tue, 27 Feb 2024 09:39:41 +0100 Message-ID: <20240227083948.5427-26-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240227083948.5427-1-philmd@linaro.org> References: <20240227083948.5427-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=philmd@linaro.org; helo=mail-wr1-x429.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1709023470335100003 From: Bernhard Beschow There is no advantage in having these local variables which 1/ needlessly h= ave different identifiers in both machines and 2/ which are redundant to pcms->= bus which is almost as short. Signed-off-by: Bernhard Beschow Reviewed-by: Michael S. Tsirkin Reviewed-by: Zhao Liu Message-ID: <20240224135851.100361-4-shentey@gmail.com> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/pc_piix.c | 14 ++++++-------- hw/i386/pc_q35.c | 16 +++++++--------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 3393b93007..814d24326d 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -108,7 +108,6 @@ static void pc_init1(MachineState *machine, MemoryRegion *system_memory =3D get_system_memory(); MemoryRegion *system_io =3D get_system_io(); Object *phb =3D NULL; - PCIBus *pci_bus =3D NULL; ISABus *isa_bus; Object *piix4_pm =3D NULL; qemu_irq smi_irq; @@ -212,11 +211,10 @@ static void pc_init1(MachineState *machine, &error_fatal); sysbus_realize_and_unref(SYS_BUS_DEVICE(phb), &error_fatal); =20 - pci_bus =3D PCI_BUS(qdev_get_child_bus(DEVICE(phb), "pci.0")); - pci_bus_map_irqs(pci_bus, + pcms->pcibus =3D PCI_BUS(qdev_get_child_bus(DEVICE(phb), "pci.0")); + pci_bus_map_irqs(pcms->pcibus, xen_enabled() ? xen_pci_slot_get_pirq : pc_pci_slot_get_pirq); - pcms->pcibus =3D pci_bus; =20 hole64_size =3D object_property_get_uint(phb, PCI_HOST_PROP_PCI_HOLE64_SI= ZE, @@ -261,7 +259,7 @@ static void pc_init1(MachineState *machine, 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); + pci_realize_and_unref(pci_dev, pcms->pcibus, &error_fatal); =20 if (xen_enabled()) { pci_device_set_intx_routing_notifier( @@ -273,7 +271,7 @@ static void pc_init1(MachineState *machine, * connected to the IOAPIC directly. * These additional routes can be discovered through ACPI. */ - pci_bus_irqs(pci_bus, xen_intx_set_irq, pci_dev, + pci_bus_irqs(pcms->pcibus, xen_intx_set_irq, pci_dev, XEN_IOAPIC_NUM_PIRQS); } =20 @@ -310,7 +308,7 @@ static void pc_init1(MachineState *machine, x86_register_ferr_irq(x86ms->gsi[13]); } =20 - pc_vga_init(isa_bus, pcmc->pci_enabled ? pci_bus : NULL); + pc_vga_init(isa_bus, pcmc->pci_enabled ? pcms->pcibus : NULL); =20 assert(pcms->vmport !=3D ON_OFF_AUTO__MAX); if (pcms->vmport =3D=3D ON_OFF_AUTO_AUTO) { @@ -321,7 +319,7 @@ static void pc_init1(MachineState *machine, pc_basic_device_init(pcms, isa_bus, x86ms->gsi, rtc_state, true, 0x4); =20 - pc_nic_init(pcmc, isa_bus, pci_bus); + pc_nic_init(pcmc, isa_bus, pcms->pcibus); =20 #ifdef CONFIG_IDE_ISA if (!pcmc->pci_enabled) { diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 549c0bc041..9e4b8f79c2 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -123,7 +123,6 @@ static void pc_q35_init(MachineState *machine) PCMachineClass *pcmc =3D PC_MACHINE_GET_CLASS(pcms); X86MachineState *x86ms =3D X86_MACHINE(machine); Object *phb; - PCIBus *host_bus; PCIDevice *lpc; DeviceState *lpc_dev; ISADevice *rtc_state; @@ -217,8 +216,7 @@ static void pc_q35_init(MachineState *machine) sysbus_realize_and_unref(SYS_BUS_DEVICE(phb), &error_fatal); =20 /* pci */ - host_bus =3D PCI_BUS(qdev_get_child_bus(DEVICE(phb), "pcie.0")); - pcms->pcibus =3D host_bus; + pcms->pcibus =3D PCI_BUS(qdev_get_child_bus(DEVICE(phb), "pcie.0")); =20 /* irq lines */ gsi_state =3D pc_gsi_create(&x86ms->gsi, true); @@ -232,7 +230,7 @@ static void pc_q35_init(MachineState *machine) for (i =3D 0; i < IOAPIC_NUM_PINS; i++) { qdev_connect_gpio_out_named(lpc_dev, ICH9_GPIO_GSI, i, x86ms->gsi[= i]); } - pci_realize_and_unref(lpc, host_bus, &error_fatal); + pci_realize_and_unref(lpc, pcms->pcibus, &error_fatal); =20 rtc_state =3D ISA_DEVICE(object_resolve_path_component(OBJECT(lpc), "r= tc")); =20 @@ -284,7 +282,7 @@ static void pc_q35_init(MachineState *machine) AHCIPCIState *ich9; =20 /* ahci and SATA device, for q35 1 ahci controller is built-in */ - pdev =3D pci_create_simple_multifunction(host_bus, + pdev =3D pci_create_simple_multifunction(pcms->pcibus, PCI_DEVFN(ICH9_SATA1_DEV, ICH9_SATA1_FUNC), "ich9-ahci"); @@ -298,14 +296,14 @@ static void pc_q35_init(MachineState *machine) =20 if (machine_usb(machine)) { /* Should we create 6 UHCI according to ich9 spec? */ - ehci_create_ich9_with_companions(host_bus, 0x1d); + ehci_create_ich9_with_companions(pcms->pcibus, 0x1d); } =20 if (pcms->smbus_enabled) { PCIDevice *smb; =20 /* TODO: Populate SPD eeprom data. */ - smb =3D pci_create_simple_multifunction(host_bus, + smb =3D pci_create_simple_multifunction(pcms->pcibus, PCI_DEVFN(ICH9_SMB_DEV, ICH9_SMB_FUNC), TYPE_ICH9_SMB_DEVICE); @@ -317,8 +315,8 @@ static void pc_q35_init(MachineState *machine) pc_cmos_init(pcms, rtc_state); =20 /* the rest devices to which pci devfn is automatically assigned */ - pc_vga_init(isa_bus, host_bus); - pc_nic_init(pcmc, isa_bus, host_bus); + pc_vga_init(isa_bus, pcms->pcibus); + pc_nic_init(pcmc, isa_bus, pcms->pcibus); =20 if (machine->nvdimms_state->is_enabled) { nvdimm_init_acpi_state(machine->nvdimms_state, system_io, --=20 2.41.0