From patchwork Sat Feb 24 13:58:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 1903833 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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=20230601 header.b=dtRxF/gM; 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 4ThpSV0rJtz23q3 for ; Sun, 25 Feb 2024 01:00:56 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdsYc-0004AJ-8f; Sat, 24 Feb 2024 08:59:14 -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 1rdsYV-000487-M9 for qemu-devel@nongnu.org; Sat, 24 Feb 2024 08:59:07 -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 1rdsYT-0002jw-G7 for qemu-devel@nongnu.org; Sat, 24 Feb 2024 08:59:07 -0500 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-33d066f8239so1095633f8f.1 for ; Sat, 24 Feb 2024 05:59:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708783143; x=1709387943; 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=iYU20oh+ltvSrpa869kLXAb6cEq3qERtoyld+C9r5WM=; b=dtRxF/gMCEhPFbUL9qjp6vX5jfSQq0dTUx4Z/3gQsIyjIAx9yRzzxG/Dhk3/29OuMf Gnu7GCWkElq6MVp1UMyuB06O1hdToZdyIyzwuMpg2d/G9vjpho6/CE1XEzXyDySySy+t /Q1GMhLNIA4ky12mZRgzR7457IiQsRD4KwICNT0YiiMbUs8TjXHMK4cApfgmnN+j3vR2 VQzNyjTorHuT7BlSp+/pqBVAbrXB7FrcP5QuFuRBIxsYRNFJBtAdl3H1PgcIMjDZqT6W 1FKLUYz0gbNz0CUxoDHdrHEkRDIJvgWmz3qIOR28i/8ALeWx73Y59iX6P6op1UhCrVg/ AUZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708783143; x=1709387943; 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=iYU20oh+ltvSrpa869kLXAb6cEq3qERtoyld+C9r5WM=; b=e+L62jxrxVbiv4icCnjqAdK0t7DKvUJIa6wEYOoDv6mUeuVBFzUWAHJxauqclAVYzV 6k1ZftICCV3a3Y7J3or4n07QiaH4bJyR1ygf/s8yGCsxrIuYMb8qV7m9LA0W6AVpj7tB XpwRZ4+8gUvxdEcFdKcRARbErZtBV8d5wJLDBHWjSjz3X9xl3i8pSmCJZcbqObxhgh4c J9F81g5MFHGoMeZb06//xccSCrZF3JCv1J8voe/ErEWPa0pURdgprgMvc8g/w8yDBKEO LjsdoIY4xOoRxvopNE+LktocGFiVfzkRTxGx+FmtK/J5y9NJn2AdjfMP7K/q0DX6pH93 8kfA== X-Gm-Message-State: AOJu0YwBGFFyoudsSDaRVYdI3lkPavTL2qoGVQuZPIf8oZo68hOYQfTm G6JwckDntdSansh/+W7AXE5LKJ7QuH8Q9TNwJmGgdktixhygjMKJ46OODRXI X-Google-Smtp-Source: AGHT+IE5NLZR9/s6xnEAzSZGRypHlrxeMjCw8Lj9wckiyxYodtvOMWWfL84OFjn3PyDNLi9FFzTgWg== X-Received: by 2002:adf:e3ca:0:b0:33d:1d57:6eb1 with SMTP id k10-20020adfe3ca000000b0033d1d576eb1mr1528491wrm.32.1708783142627; Sat, 24 Feb 2024 05:59:02 -0800 (PST) Received: from archlinux.. (dynamic-089-012-138-060.89.12.pool.telefonica.de. [89.12.138.60]) by smtp.gmail.com with ESMTPSA id n8-20020a056000170800b0033d817eddd3sm2285542wrc.13.2024.02.24.05.59.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 05:59:01 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Ani Sinha , "Michael S. Tsirkin" , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost , Marcel Apfelbaum , Richard Henderson , Paolo Bonzini , Paul Durrant , Igor Mammedov , Jason Wang , David Woodhouse , Sergio Lopez , Bernhard Beschow Subject: [PATCH v2 1/6] hw/i386/x86: Let ioapic_init_gsi() take parent as pointer Date: Sat, 24 Feb 2024 14:58:46 +0100 Message-ID: <20240224135851.100361-2-shentey@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240224135851.100361-1-shentey@gmail.com> References: <20240224135851.100361-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=shentey@gmail.com; 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, FREEMAIL_FROM=0.001, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Rather than taking a QOM name which has to be resolved, let's pass the parent directly as pointer. This simplifies the code. Signed-off-by: Bernhard Beschow Reviewed-by: Michael S. Tsirkin Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Zhao Liu --- include/hw/i386/x86.h | 2 +- hw/i386/microvm.c | 2 +- hw/i386/pc_piix.c | 7 +++---- hw/i386/pc_q35.c | 2 +- hw/i386/x86.c | 7 +++---- 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h index 8e306db7bb..4dc30dcb4d 100644 --- a/include/hw/i386/x86.h +++ b/include/hw/i386/x86.h @@ -139,7 +139,7 @@ typedef struct GSIState { qemu_irq x86_allocate_cpu_irq(void); void gsi_handler(void *opaque, int n, int level); -void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name); +void ioapic_init_gsi(GSIState *gsi_state, Object *parent); DeviceState *ioapic_init_secondary(GSIState *gsi_state); /* pc_sysfw.c */ diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c index ca55aecc3b..61a772dfe6 100644 --- a/hw/i386/microvm.c +++ b/hw/i386/microvm.c @@ -175,7 +175,7 @@ static void microvm_devices_init(MicrovmMachineState *mms) &error_abort); isa_bus_register_input_irqs(isa_bus, x86ms->gsi); - ioapic_init_gsi(gsi_state, "machine"); + ioapic_init_gsi(gsi_state, OBJECT(mms)); if (ioapics > 1) { x86ms->ioapic2 = ioapic_init_secondary(gsi_state); } diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index ec7c07b362..7724396ead 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -107,6 +107,7 @@ static void pc_init1(MachineState *machine, X86MachineState *x86ms = X86_MACHINE(machine); MemoryRegion *system_memory = get_system_memory(); MemoryRegion *system_io = get_system_io(); + Object *phb = NULL; PCIBus *pci_bus = NULL; ISABus *isa_bus; Object *piix4_pm = NULL; @@ -189,8 +190,6 @@ static void pc_init1(MachineState *machine, } if (pcmc->pci_enabled) { - Object *phb; - pci_memory = g_new(MemoryRegion, 1); memory_region_init(pci_memory, NULL, "pci", UINT64_MAX); rom_memory = pci_memory; @@ -303,8 +302,8 @@ static void pc_init1(MachineState *machine, pc_i8259_create(isa_bus, gsi_state->i8259_irq); } - if (pcmc->pci_enabled) { - ioapic_init_gsi(gsi_state, "i440fx"); + if (phb) { + ioapic_init_gsi(gsi_state, phb); } if (tcg_enabled()) { diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 53fb3db26d..c89ff63579 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -263,7 +263,7 @@ static void pc_q35_init(MachineState *machine) pc_i8259_create(isa_bus, gsi_state->i8259_irq); } - ioapic_init_gsi(gsi_state, "q35"); + ioapic_init_gsi(gsi_state, OBJECT(phb)); if (tcg_enabled()) { x86_register_ferr_irq(x86ms->gsi[13]); diff --git a/hw/i386/x86.c b/hw/i386/x86.c index 684dce90e9..807e09bcdb 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -640,20 +640,19 @@ void gsi_handler(void *opaque, int n, int level) } } -void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name) +void ioapic_init_gsi(GSIState *gsi_state, Object *parent) { DeviceState *dev; SysBusDevice *d; unsigned int i; - assert(parent_name); + assert(parent); if (kvm_ioapic_in_kernel()) { dev = qdev_new(TYPE_KVM_IOAPIC); } else { dev = qdev_new(TYPE_IOAPIC); } - object_property_add_child(object_resolve_path(parent_name, NULL), - "ioapic", OBJECT(dev)); + object_property_add_child(parent, "ioapic", OBJECT(dev)); d = SYS_BUS_DEVICE(dev); sysbus_realize_and_unref(d, &error_fatal); sysbus_mmio_map(d, 0, IO_APIC_DEFAULT_ADDRESS); From patchwork Sat Feb 24 13:58:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 1903834 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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=20230601 header.b=DLcexBO5; 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 4ThpSh5n5Wz23q3 for ; Sun, 25 Feb 2024 01:01:08 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdsYe-0004Ap-Fe; Sat, 24 Feb 2024 08:59:17 -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 1rdsYY-00049P-HC for qemu-devel@nongnu.org; Sat, 24 Feb 2024 08:59:12 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rdsYW-0002kP-Bq for qemu-devel@nongnu.org; Sat, 24 Feb 2024 08:59:10 -0500 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-412a0399829so304635e9.3 for ; Sat, 24 Feb 2024 05:59:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708783144; x=1709387944; 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=/kjtZPvBFR1ZWBir9LDe+qfiRtYBvkJUMkSF+tvA/h0=; b=DLcexBO5HOay+uaKjaVnEgpXCC1t0AZooVzImmhCgEWjnnntSwztR0qguZYkyiE+lp pM2lbviGUJ9SCrzG15jAt55ZR/EQWAKmEo6gfVCFSriqbiRc+lfqYpklY5nMH0ufyk6V G07ploW1lnzFiVy5qrOkLsPvE3u3fn+vkDKy2K2oeL+lXYRlaHdScoKcrhxe8xSulpm6 ip5tew2hdBnACxG6/xc6SkwXx0koYqWsT+1iDN6tsItGlL8READMWVVc+602PzTAU/L4 DOuPA1rIbjLv8L0jOEeclR0c3fkdGM9G3eEQCQ2CbhvwG8RakPj6laEQIBEPzMP2MG6r 6gEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708783144; x=1709387944; 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=/kjtZPvBFR1ZWBir9LDe+qfiRtYBvkJUMkSF+tvA/h0=; b=KeJpSxBl9Mev5h9/9tmDk/NpJTd5CMPaR08JEjYjjPvhSA4pq+GmMOi7D34ytuyDNI Pi6sH6CINHL6HTTT4Gls5iwOm/Xlb+Er2+hV/MTLdO6scQWpp6zDkpC+el/r7x49OTtP OzSic9UusXQjphZ1kBUFeUVuWfLWuH2Uk4jOjRrpMkVzPm0AsFtjnes7KZGFX4lWXwhx MaY4xNyNL4bwNee6HHj8uztvrPeTEOEf5B8XNJn3bQPleC68a+rFqroWrs+AUNfNOKAQ CTLfXIbua4aOufJhtkB9HBhN7IFby3nqCO+/ntHszNCg3rPJ7amfc05SXpXKulkdw8Ey SqNw== X-Gm-Message-State: AOJu0YzqRXhZH4NcJMtQ+NAhCszvFtVLpbr4Hnf6Tnx86C1PCJAYGnku 4GsmMlcqitcHiqu8gbh3X5YnBJudNfDNMzVaP4uDqCCRttIcwMU0+7nSeMzv X-Google-Smtp-Source: AGHT+IEY4eI+bBXGgUNkbclA35TvX4sMN7kmobRUdVJmoywpkqPhC6HWJ2jSW21Uvt6P+WQhzMm48g== X-Received: by 2002:a7b:cd99:0:b0:412:9804:d225 with SMTP id y25-20020a7bcd99000000b004129804d225mr2255307wmj.21.1708783144437; Sat, 24 Feb 2024 05:59:04 -0800 (PST) Received: from archlinux.. (dynamic-089-012-138-060.89.12.pool.telefonica.de. [89.12.138.60]) by smtp.gmail.com with ESMTPSA id n8-20020a056000170800b0033d817eddd3sm2285542wrc.13.2024.02.24.05.59.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 05:59:03 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Ani Sinha , "Michael S. Tsirkin" , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost , Marcel Apfelbaum , Richard Henderson , Paolo Bonzini , Paul Durrant , Igor Mammedov , Jason Wang , David Woodhouse , Sergio Lopez , Bernhard Beschow Subject: [PATCH v2 2/6] hw/i386/pc: Rename "bus" attribute to "pcibus" Date: Sat, 24 Feb 2024 14:58:47 +0100 Message-ID: <20240224135851.100361-3-shentey@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240224135851.100361-1-shentey@gmail.com> References: <20240224135851.100361-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=shentey@gmail.com; helo=mail-wm1-x334.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, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The attribute is of type PCIBus; reflect that in the name. It will also make the next change more intuitive. Suggested-by: Philippe Mathieu-Daudé Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Zhao Liu --- include/hw/i386/pc.h | 2 +- hw/i386/acpi-build.c | 2 +- hw/i386/amd_iommu.c | 2 +- hw/i386/intel_iommu.c | 2 +- hw/i386/kvm/xen_evtchn.c | 2 +- hw/i386/pc.c | 8 ++++---- hw/i386/pc_piix.c | 6 +++--- hw/i386/pc_q35.c | 2 +- hw/i386/x86-iommu.c | 2 +- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index e88468131a..27834043c3 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -31,7 +31,7 @@ typedef struct PCMachineState { Notifier machine_done; /* Pointers to devices and objects: */ - PCIBus *bus; + PCIBus *pcibus; I2CBus *smbus; PFlashCFI01 *flash[2]; ISADevice *pcspk; diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index d3ce96dd9f..cd3f2d0148 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1556,7 +1556,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, } crs_range_set_init(&crs_range_set); - bus = PC_MACHINE(machine)->bus; + bus = PC_MACHINE(machine)->pcibus; if (bus) { QLIST_FOREACH(bus, &bus->child, sibling) { uint8_t bus_num = pci_bus_num(bus); diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c index 7329553ad3..6d4fde72f9 100644 --- a/hw/i386/amd_iommu.c +++ b/hw/i386/amd_iommu.c @@ -1584,7 +1584,7 @@ static void amdvi_sysbus_realize(DeviceState *dev, Error **errp) MachineState *ms = MACHINE(qdev_get_machine()); PCMachineState *pcms = PC_MACHINE(ms); X86MachineState *x86ms = X86_MACHINE(ms); - PCIBus *bus = pcms->bus; + PCIBus *bus = pcms->pcibus; s->iotlb = g_hash_table_new_full(amdvi_uint64_hash, amdvi_uint64_equal, g_free, g_free); diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index cf933189d3..cc8e59674e 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -4183,7 +4183,7 @@ static void vtd_realize(DeviceState *dev, Error **errp) MachineState *ms = MACHINE(qdev_get_machine()); PCMachineState *pcms = PC_MACHINE(ms); X86MachineState *x86ms = X86_MACHINE(ms); - PCIBus *bus = pcms->bus; + PCIBus *bus = pcms->pcibus; IntelIOMMUState *s = INTEL_IOMMU_DEVICE(dev); X86IOMMUState *x86_iommu = X86_IOMMU_DEVICE(s); diff --git a/hw/i386/kvm/xen_evtchn.c b/hw/i386/kvm/xen_evtchn.c index 0171ef6d59..a5052c0ea3 100644 --- a/hw/i386/kvm/xen_evtchn.c +++ b/hw/i386/kvm/xen_evtchn.c @@ -371,7 +371,7 @@ static int set_callback_pci_intx(XenEvtchnState *s, uint64_t param) return 0; } - pdev = pci_find_device(pcms->bus, bus, devfn); + pdev = pci_find_device(pcms->pcibus, bus, devfn); if (!pdev) { return 0; } diff --git a/hw/i386/pc.c b/hw/i386/pc.c index f8eb684a49..353edeb2ea 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -675,7 +675,7 @@ void pc_machine_done(Notifier *notifier, void *data) PCMachineState, machine_done); X86MachineState *x86ms = X86_MACHINE(pcms); - cxl_hook_up_pxb_registers(pcms->bus, &pcms->cxl_devices_state, + cxl_hook_up_pxb_registers(pcms->pcibus, &pcms->cxl_devices_state, &error_fatal); if (pcms->cxl_devices_state.is_enabled) { @@ -685,7 +685,7 @@ void pc_machine_done(Notifier *notifier, void *data) /* set the number of CPUs */ x86_rtc_set_cpus_count(x86ms->rtc, x86ms->boot_cpus); - fw_cfg_add_extra_pci_roots(pcms->bus, x86ms->fw_cfg); + fw_cfg_add_extra_pci_roots(pcms->pcibus, x86ms->fw_cfg); acpi_setup(); if (x86ms->fw_cfg) { @@ -1250,8 +1250,8 @@ void pc_basic_device_init(struct PCMachineState *pcms, xen_evtchn_create(IOAPIC_NUM_PINS, gsi); xen_gnttab_create(); xen_xenstore_create(); - if (pcms->bus) { - pci_create_simple(pcms->bus, -1, "xen-platform"); + if (pcms->pcibus) { + pci_create_simple(pcms->pcibus, -1, "xen-platform"); } xen_bus_init(); xen_be_init(); diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 7724396ead..3393b93007 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -216,7 +216,7 @@ static void pc_init1(MachineState *machine, pci_bus_map_irqs(pci_bus, xen_enabled() ? xen_pci_slot_get_pirq : pc_pci_slot_get_pirq); - pcms->bus = pci_bus; + pcms->pcibus = pci_bus; hole64_size = object_property_get_uint(phb, PCI_HOST_PROP_PCI_HOLE64_SIZE, @@ -480,8 +480,8 @@ static void pc_xen_hvm_init(MachineState *machine) } pc_xen_hvm_init_pci(machine); - xen_igd_reserve_slot(pcms->bus); - pci_create_simple(pcms->bus, -1, "xen-platform"); + xen_igd_reserve_slot(pcms->pcibus); + pci_create_simple(pcms->pcibus, -1, "xen-platform"); } #endif diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index c89ff63579..734d9bedb2 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -217,7 +217,7 @@ static void pc_q35_init(MachineState *machine) /* pci */ host_bus = PCI_BUS(qdev_get_child_bus(DEVICE(phb), "pcie.0")); - pcms->bus = host_bus; + pcms->pcibus = host_bus; /* irq lines */ gsi_state = pc_gsi_create(&x86ms->gsi, true); diff --git a/hw/i386/x86-iommu.c b/hw/i386/x86-iommu.c index 726e9e1d16..60af896225 100644 --- a/hw/i386/x86-iommu.c +++ b/hw/i386/x86-iommu.c @@ -101,7 +101,7 @@ static void x86_iommu_realize(DeviceState *dev, Error **errp) QLIST_INIT(&x86_iommu->iec_notifiers); bool irq_all_kernel = kvm_irqchip_in_kernel() && !kvm_irqchip_is_split(); - if (!pcms || !pcms->bus) { + if (!pcms || !pcms->pcibus) { error_setg(errp, "Machine-type '%s' not supported by IOMMU", mc->name); return; From patchwork Sat Feb 24 13:58:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 1903845 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=ZD2Do/Dw; 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 4ThpV41PKtz23q3 for ; Sun, 25 Feb 2024 01:02:20 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdsYd-0004Aw-Ca; Sat, 24 Feb 2024 08:59:15 -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 1rdsYb-0004AE-TF for qemu-devel@nongnu.org; Sat, 24 Feb 2024 08:59:13 -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 1rdsYW-0002kt-Rv for qemu-devel@nongnu.org; Sat, 24 Feb 2024 08:59:13 -0500 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-33d8739ddd4so1349883f8f.2 for ; Sat, 24 Feb 2024 05:59:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708783146; x=1709387946; 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=pT/MkfQa9G3Yr0W27b1GDZClhFKJrUo8tVDx3DPvdI8=; b=ZD2Do/Dwg7smw5D3e+NYzDf9H9V+BKAipNSEcFe4lrhvCw5BpqHb0kwQlveMD7THXA trtzFp9fOE3tzvCA//VjMLWZJRrKcqVqt1+Fn41g+yKJ49QE7bJtOxdAIPqo0Yp7rVec 0w+QUM67NpQ4FFkMttJLeJqe3a8N5SnyN0AzMLWnYJqot9s5vB3ioYjweVTM8Uw5eKcj qras+IE//5vsFbJnObwzfKQSTGwagSuPV7uJkjAMNPPoMddTEH5MyZQ0T2ZqD8vZWEhY pSa27XdqwQCH1lz1UjAAPiOmBkmrbVPwRnRzh/rE2uWhaVMYGqjr60+lVCyVXTbt+oG6 Jx3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708783146; x=1709387946; 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=pT/MkfQa9G3Yr0W27b1GDZClhFKJrUo8tVDx3DPvdI8=; b=nT1BiMknsrKCyesTUft+NyXIFw5Uf73Efvc0ndXdek2ByzI0GLKcEZSjPAjaD25+t1 mUIPAUh9rbELPeEq6cFRiKFYDUlG/gbMpDH9wIQIzpqCqlzWDtys43NCAJqrO+nPVj/l 38HHPfOaCxNMGDysJGPe0j/BVyT+p2g3anLhzcuM0IuC8C9tJVljZfWkrzZffpc6PL/g fOA3Xilqc42j97JQlCPz3SDrOqPLwu/wae7olGGDEFfXfVVEvEegk6eGPSEhoNO7alpl ikuq9NCljp2HWDKJ6RwGrdfArzuMz11gdATk9BJPH7UkgDrrFZqno1BhxdSYdxU3P0ON Qu8g== X-Gm-Message-State: AOJu0Yx/7yZgv0kBUxbQDFVL3+YxFbOXEestTBeDd1OWyT0Ev+UQAhbs KcRqW/f6ybSjE8RQqga3wGFkyGuqUh4ThD/TsZjRhJqI2mDRVmZnV4fBnWeo X-Google-Smtp-Source: AGHT+IH/WCJrz+aCPc1Ovg9uPe8zFxNqkORGTvqlZUln24Q2C9pU7U4jcCJttq5foRJn4EXJf4QrPg== X-Received: by 2002:a5d:6d8b:0:b0:33d:c3db:d4ae with SMTP id l11-20020a5d6d8b000000b0033dc3dbd4aemr731887wrs.25.1708783146000; Sat, 24 Feb 2024 05:59:06 -0800 (PST) Received: from archlinux.. (dynamic-089-012-138-060.89.12.pool.telefonica.de. [89.12.138.60]) by smtp.gmail.com with ESMTPSA id n8-20020a056000170800b0033d817eddd3sm2285542wrc.13.2024.02.24.05.59.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 05:59:05 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Ani Sinha , "Michael S. Tsirkin" , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost , Marcel Apfelbaum , Richard Henderson , Paolo Bonzini , Paul Durrant , Igor Mammedov , Jason Wang , David Woodhouse , Sergio Lopez , Bernhard Beschow Subject: [PATCH v2 3/6] hw/i386/pc_{piix, q35}: Eliminate local pci_bus/pci_host variables Date: Sat, 24 Feb 2024 14:58:48 +0100 Message-ID: <20240224135851.100361-4-shentey@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240224135851.100361-1-shentey@gmail.com> References: <20240224135851.100361-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, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org There is no advantage in having these local variables which 1/ needlessly have 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 --- 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 = get_system_memory(); MemoryRegion *system_io = get_system_io(); Object *phb = NULL; - PCIBus *pci_bus = NULL; ISABus *isa_bus; Object *piix4_pm = 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); - pci_bus = PCI_BUS(qdev_get_child_bus(DEVICE(phb), "pci.0")); - pci_bus_map_irqs(pci_bus, + pcms->pcibus = 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 = pci_bus; hole64_size = object_property_get_uint(phb, PCI_HOST_PROP_PCI_HOLE64_SIZE, @@ -261,7 +259,7 @@ static void pc_init1(MachineState *machine, for (i = 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); 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); } @@ -310,7 +308,7 @@ static void pc_init1(MachineState *machine, x86_register_ferr_irq(x86ms->gsi[13]); } - pc_vga_init(isa_bus, pcmc->pci_enabled ? pci_bus : NULL); + pc_vga_init(isa_bus, pcmc->pci_enabled ? pcms->pcibus : NULL); assert(pcms->vmport != ON_OFF_AUTO__MAX); if (pcms->vmport == 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); - pc_nic_init(pcmc, isa_bus, pci_bus); + pc_nic_init(pcmc, isa_bus, pcms->pcibus); #ifdef CONFIG_IDE_ISA if (!pcmc->pci_enabled) { diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 734d9bedb2..2fa4efb52f 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -122,7 +122,6 @@ static void pc_q35_init(MachineState *machine) PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms); X86MachineState *x86ms = X86_MACHINE(machine); Object *phb; - PCIBus *host_bus; PCIDevice *lpc; DeviceState *lpc_dev; ISADevice *rtc_state; @@ -216,8 +215,7 @@ static void pc_q35_init(MachineState *machine) sysbus_realize_and_unref(SYS_BUS_DEVICE(phb), &error_fatal); /* pci */ - host_bus = PCI_BUS(qdev_get_child_bus(DEVICE(phb), "pcie.0")); - pcms->pcibus = host_bus; + pcms->pcibus = PCI_BUS(qdev_get_child_bus(DEVICE(phb), "pcie.0")); /* irq lines */ gsi_state = pc_gsi_create(&x86ms->gsi, true); @@ -231,7 +229,7 @@ static void pc_q35_init(MachineState *machine) for (i = 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); rtc_state = ISA_DEVICE(object_resolve_path_component(OBJECT(lpc), "rtc")); @@ -283,7 +281,7 @@ static void pc_q35_init(MachineState *machine) AHCIPCIState *ich9; /* ahci and SATA device, for q35 1 ahci controller is built-in */ - pdev = pci_create_simple_multifunction(host_bus, + pdev = pci_create_simple_multifunction(pcms->pcibus, PCI_DEVFN(ICH9_SATA1_DEV, ICH9_SATA1_FUNC), "ich9-ahci"); @@ -297,14 +295,14 @@ static void pc_q35_init(MachineState *machine) 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); } if (pcms->smbus_enabled) { PCIDevice *smb; /* TODO: Populate SPD eeprom data. */ - smb = pci_create_simple_multifunction(host_bus, + smb = pci_create_simple_multifunction(pcms->pcibus, PCI_DEVFN(ICH9_SMB_DEV, ICH9_SMB_FUNC), TYPE_ICH9_SMB_DEVICE); @@ -316,8 +314,8 @@ static void pc_q35_init(MachineState *machine) pc_cmos_init(pcms, rtc_state); /* 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); if (machine->nvdimms_state->is_enabled) { nvdimm_init_acpi_state(machine->nvdimms_state, system_io, From patchwork Sat Feb 24 13:58:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 1903844 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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=20230601 header.b=iTza3Tc4; 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 4ThpTG60ZVz23q3 for ; Sun, 25 Feb 2024 01:01:38 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdsYd-0004Al-2e; Sat, 24 Feb 2024 08:59:16 -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 1rdsYb-00049m-9Y for qemu-devel@nongnu.org; Sat, 24 Feb 2024 08:59:13 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rdsYX-0002kz-Jp for qemu-devel@nongnu.org; Sat, 24 Feb 2024 08:59:11 -0500 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-4129f33d2e8so1467745e9.1 for ; Sat, 24 Feb 2024 05:59:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708783147; x=1709387947; 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=lg93a47qvzmza3RMrC5PuS5WPquGN42j8mbqdeYWlPQ=; b=iTza3Tc4bHSX50uvRqJKzmjgS2+0WSemkzTVyJfaxHvTFYSMeugDTvW4zc0HvvWDeM +qGxs1cY6c3dn5Z3qgTBkFNgJE+FZuoeW+uC5lcAvFxb8IFbfiKEAh2OeITqxr6lc7rk wpAP9vCqmNBfNamXEJfQqjrZZVuCYThj0NseX9CN3oeCafs2cWN42k2T07Qykatu2Bfm WI+67sGByjC2TbxRwaKh0PVRxe0bYdSfKij2JhlY3/NsUDRUAqQ55X9T415XSC2NU+1y M3dz+6cRXzVPThaa9++Tub+0cfWanKVUY1Y+4g8D2BPMahOXtXm2pz1XHdTDzoR9i+Lu pIPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708783147; x=1709387947; 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=lg93a47qvzmza3RMrC5PuS5WPquGN42j8mbqdeYWlPQ=; b=gn/oxG3NmSH853zNYLXwgt/j++759y20Z+9M7lXprHRs4JXggDRRxNcwFCzqB9ts4a lI8cYoeHqhsm33cjpT0l923i3Av3ImIi99LxdzHBZFyBUAgQUTiaQ/C7wkuz3AYNZyN/ 8VWTHQOI7naMGfGCGvYJLtRCaXPWBKglzlhK3ftsVZ165jQ2VIMSoyBjKzF5a08zVIyL ndkVi89DzrLxCMUxFfvCtieEYcQQxu2ojJ/ur4P0J0GaLcsWr7QNYwYe6x+L600oXi/G JJsYR/yDMj4SG0klKCHO5EJZtELdrfErw5vlhFbd8n0Ec+1k3w5kKz1vAjKgUNe92JuE SqfQ== X-Gm-Message-State: AOJu0YyzXMNFF96HcycoQ4Q4IS9Sgsi/+coyjUmS+OgP18yQjgvR1Gxi qnc0E43P0qupxWMZ8LDag565AuR0iz2hphXhjxTLLU6D88jT7u9e6P0U60NH X-Google-Smtp-Source: AGHT+IFq8qTmtZ6r89tRRd2U2f68ZvjcHUrgYrSs1y7kHdJCDE6c2TILEOR76eaSaEwt1f71dlj6Qw== X-Received: by 2002:a5d:51d0:0:b0:33d:a1c4:9c63 with SMTP id n16-20020a5d51d0000000b0033da1c49c63mr1788939wrv.49.1708783147714; Sat, 24 Feb 2024 05:59:07 -0800 (PST) Received: from archlinux.. (dynamic-089-012-138-060.89.12.pool.telefonica.de. [89.12.138.60]) by smtp.gmail.com with ESMTPSA id n8-20020a056000170800b0033d817eddd3sm2285542wrc.13.2024.02.24.05.59.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 05:59:06 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Ani Sinha , "Michael S. Tsirkin" , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost , Marcel Apfelbaum , Richard Henderson , Paolo Bonzini , Paul Durrant , Igor Mammedov , Jason Wang , David Woodhouse , Sergio Lopez , Bernhard Beschow , Thomas Huth Subject: [PATCH v2 4/6] hw/i386/pc: Remove unneeded class attribute "kvmclock_enabled" Date: Sat, 24 Feb 2024 14:58:49 +0100 Message-ID: <20240224135851.100361-5-shentey@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240224135851.100361-1-shentey@gmail.com> References: <20240224135851.100361-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=shentey@gmail.com; helo=mail-wm1-x331.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, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org PCMachineClass introduces the attribute into the class hierarchy and sets it to true. There is no sub class overriding the attribute. Commit 30d2a17b46e9 "hw/i386: Remove the deprecated machines 0.12 up to 0.15" removed the last overrides of this attribute. The attribute is now unneeded and can be removed. Fixes: 30d2a17b46e9 "hw/i386: Remove the deprecated machines 0.12 up to 0.15" Cc: Thomas Huth Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth Reviewed-by: Zhao Liu --- include/hw/i386/pc.h | 1 - hw/i386/pc.c | 1 - hw/i386/pc_piix.c | 2 +- 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 27834043c3..4bb1899602 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -92,7 +92,6 @@ struct PCMachineClass { /* Device configuration: */ bool pci_enabled; - bool kvmclock_enabled; const char *default_south_bridge; /* Compat options: */ diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 353edeb2ea..a80f809b83 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1799,7 +1799,6 @@ static void pc_machine_class_init(ObjectClass *oc, void *data) pcmc->smbios_uuid_encoded = true; pcmc->gigabyte_align = true; pcmc->has_reserved_memory = true; - pcmc->kvmclock_enabled = true; pcmc->enforce_aligned_dimm = true; pcmc->enforce_amd_1tb_hole = true; /* BIOS ACPI tables: 128K. Other BIOS datastructures: less than 4K reported diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 814d24326d..49d5d48db9 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -184,7 +184,7 @@ static void pc_init1(MachineState *machine, pc_machine_init_sgx_epc(pcms); x86_cpus_init(x86ms, pcmc->default_cpu_version); - if (kvm_enabled() && pcmc->kvmclock_enabled) { + if (kvm_enabled()) { kvmclock_create(pcmc->kvmclock_create_always); } From patchwork Sat Feb 24 13:58:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 1903841 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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=20230601 header.b=ccFSBSQQ; 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 4ThpSl6mvvz23qB for ; Sun, 25 Feb 2024 01:01:11 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdsYl-0004Ed-4p; Sat, 24 Feb 2024 08:59:23 -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 1rdsYd-0004Aj-0d for qemu-devel@nongnu.org; Sat, 24 Feb 2024 08:59:15 -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 1rdsYb-0002lP-09 for qemu-devel@nongnu.org; Sat, 24 Feb 2024 08:59:14 -0500 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-33d754746c3so1119819f8f.1 for ; Sat, 24 Feb 2024 05:59:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708783149; x=1709387949; 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=VTdkrGOWau5O1oWIpKtyS7r/bUo0AcrbvBTNN+p9aWY=; b=ccFSBSQQhACfMwGil5eNc5qmsO7t+xoBqbpA4MWRoRmwHtg4x+O7gLBwJq2ny3FRjM D1uAPutgrptN9VlApbgDjbXxdlYoUG0ssUyyC2WkdIaoltddUE2GhiqmWUOGqx3pH2W9 c2k8/AW5J2KMS1zJuyasqD+6aoW/I73ceifJmDk6bPl4u1NsvoaUNf50QlxjeTLED3R/ WxLZeG3zThDnP+/0FQeyuhoc+AbbY1mInQGUSLI9bdM4mrw9TidcpufaJaOx7vdvSXPV 3zVGBmbOzE+aJP7HyFJF/R5dFlbvHxsZkeI8eweKA77Wo9QMS4ZTDaVi+U/CmNcKijD0 iuDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708783149; x=1709387949; 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=VTdkrGOWau5O1oWIpKtyS7r/bUo0AcrbvBTNN+p9aWY=; b=gxU3eUWOYxDxfZQItImHSqFt/Ga8oDxBzJhvdwhUspaP7Ky7bLaxyFvFzIaw78fIy5 SuGsBdT+k96kozjxT2GWa10eOt3QxDZu+tZR6HK2wO4ogB64UOC4SS39/mR2UtifkHEg MLUPVcNiXvJ9aN65z1SfthWGo7fHv9Q+L7oldh9QmqftDZCzC/vsMMuJS37ilUybxe2j n9lBY4hxGhhyDrB5pATvECV8DyaID7F4sPPYGJKpl9ZlD8yZ295iRjZqirViSqs/CMsa QVCZT4fDC1XKUFitvR25JboG8FWT0A+wp/X4F03m9xyMN5OQ3oVfHy+irEz5L/KpZur3 aP8Q== X-Gm-Message-State: AOJu0YzQRlv+Gzc+uSW4ijL5OrcHN8wzIFDAnp8q7E/JcJBlNA++Vkf3 RJJzY9yhbewTXkYIwaKY90uWP85fX/kdpCRZoXr3iFbfLfV63Ka25tQ+5JRK X-Google-Smtp-Source: AGHT+IHWG6GVhsAavmdPOpNxd/LDQlwv7DZoSQKkU5mcq7WCe8ODfHGGS7V7oq/cbihATq/Nk7KglQ== X-Received: by 2002:a5d:56cb:0:b0:33d:6186:3ca0 with SMTP id m11-20020a5d56cb000000b0033d61863ca0mr1588880wrw.19.1708783148865; Sat, 24 Feb 2024 05:59:08 -0800 (PST) Received: from archlinux.. (dynamic-089-012-138-060.89.12.pool.telefonica.de. [89.12.138.60]) by smtp.gmail.com with ESMTPSA id n8-20020a056000170800b0033d817eddd3sm2285542wrc.13.2024.02.24.05.59.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 05:59:08 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Ani Sinha , "Michael S. Tsirkin" , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost , Marcel Apfelbaum , Richard Henderson , Paolo Bonzini , Paul Durrant , Igor Mammedov , Jason Wang , David Woodhouse , Sergio Lopez , Bernhard Beschow Subject: [PATCH v2 5/6] hw/i386/pc: Populate RTC attribute directly Date: Sat, 24 Feb 2024 14:58:50 +0100 Message-ID: <20240224135851.100361-6-shentey@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240224135851.100361-1-shentey@gmail.com> References: <20240224135851.100361-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, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Both the piix and the q35 machines introduce an rtc_state variable and defer the initialization of the X86MachineState::rtc attribute to pc_cmos_init(). Resolve this complication which makes pc_cmos_init() do what it says on the tin. Signed-off-by: Bernhard Beschow Reviewed-by: Michael S. Tsirkin Reviewed-by: Zhao Liu --- hw/i386/pc.c | 8 -------- hw/i386/pc_piix.c | 15 +++++++-------- hw/i386/pc_q35.c | 7 +++---- 3 files changed, 10 insertions(+), 20 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index a80f809b83..880e95de26 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -611,14 +611,6 @@ void pc_cmos_init(PCMachineState *pcms, mc146818rtc_set_cmos_data(s, 0x5c, val >> 8); mc146818rtc_set_cmos_data(s, 0x5d, val >> 16); - object_property_add_link(OBJECT(pcms), "rtc_state", - TYPE_ISA_DEVICE, - (Object **)&x86ms->rtc, - object_property_allow_set_link, - OBJ_PROP_LINK_STRONG); - object_property_set_link(OBJECT(pcms), "rtc_state", OBJECT(s), - &error_abort); - set_boot_dev(s, MACHINE(pcms)->boot_config.order, &error_fatal); val = 0; diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 49d5d48db9..ce6aad758d 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -112,7 +112,6 @@ static void pc_init1(MachineState *machine, Object *piix4_pm = NULL; qemu_irq smi_irq; GSIState *gsi_state; - ISADevice *rtc_state; MemoryRegion *ram_memory; MemoryRegion *pci_memory = NULL; MemoryRegion *rom_memory = system_memory; @@ -276,8 +275,8 @@ static void pc_init1(MachineState *machine, } isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(pci_dev), "isa.0")); - rtc_state = ISA_DEVICE(object_resolve_path_component(OBJECT(pci_dev), - "rtc")); + x86ms->rtc = ISA_DEVICE(object_resolve_path_component(OBJECT(pci_dev), + "rtc")); piix4_pm = object_resolve_path_component(OBJECT(pci_dev), "pm"); dev = DEVICE(object_resolve_path_component(OBJECT(pci_dev), "ide")); pci_ide_create_devs(PCI_DEVICE(dev)); @@ -288,9 +287,9 @@ static void pc_init1(MachineState *machine, &error_abort); isa_bus_register_input_irqs(isa_bus, x86ms->gsi); - rtc_state = isa_new(TYPE_MC146818_RTC); - qdev_prop_set_int32(DEVICE(rtc_state), "base_year", 2000); - isa_realize_and_unref(rtc_state, isa_bus, &error_fatal); + x86ms->rtc = isa_new(TYPE_MC146818_RTC); + qdev_prop_set_int32(DEVICE(x86ms->rtc), "base_year", 2000); + isa_realize_and_unref(x86ms->rtc, isa_bus, &error_fatal); i8257_dma_init(OBJECT(machine), isa_bus, 0); pcms->hpet_enabled = false; @@ -316,7 +315,7 @@ static void pc_init1(MachineState *machine, } /* init basic PC hardware */ - pc_basic_device_init(pcms, isa_bus, x86ms->gsi, rtc_state, true, + pc_basic_device_init(pcms, isa_bus, x86ms->gsi, x86ms->rtc, true, 0x4); pc_nic_init(pcmc, isa_bus, pcms->pcibus); @@ -343,7 +342,7 @@ static void pc_init1(MachineState *machine, } #endif - pc_cmos_init(pcms, rtc_state); + pc_cmos_init(pcms, x86ms->rtc); if (piix4_pm) { smi_irq = qemu_allocate_irq(pc_acpi_smi_interrupt, first_cpu, 0); diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 2fa4efb52f..e0b3f55a02 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -124,7 +124,6 @@ static void pc_q35_init(MachineState *machine) Object *phb; PCIDevice *lpc; DeviceState *lpc_dev; - ISADevice *rtc_state; MemoryRegion *system_memory = get_system_memory(); MemoryRegion *system_io = get_system_io(); MemoryRegion *pci_memory = g_new(MemoryRegion, 1); @@ -231,7 +230,7 @@ static void pc_q35_init(MachineState *machine) } pci_realize_and_unref(lpc, pcms->pcibus, &error_fatal); - rtc_state = ISA_DEVICE(object_resolve_path_component(OBJECT(lpc), "rtc")); + x86ms->rtc = ISA_DEVICE(object_resolve_path_component(OBJECT(lpc), "rtc")); object_property_add_link(OBJECT(machine), PC_MACHINE_ACPI_DEVICE_PROP, TYPE_HOTPLUG_HANDLER, @@ -273,7 +272,7 @@ static void pc_q35_init(MachineState *machine) } /* init basic PC hardware */ - pc_basic_device_init(pcms, isa_bus, x86ms->gsi, rtc_state, !mc->no_floppy, + pc_basic_device_init(pcms, isa_bus, x86ms->gsi, x86ms->rtc, !mc->no_floppy, 0xff0104); if (pcms->sata_enabled) { @@ -311,7 +310,7 @@ static void pc_q35_init(MachineState *machine) smbus_eeprom_init(pcms->smbus, 8, NULL, 0); } - pc_cmos_init(pcms, rtc_state); + pc_cmos_init(pcms, x86ms->rtc); /* the rest devices to which pci devfn is automatically assigned */ pc_vga_init(isa_bus, pcms->pcibus); From patchwork Sat Feb 24 13:58:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 1903842 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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=20230601 header.b=CHvu3BXf; 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 4ThpT26F5Mz23q3 for ; Sun, 25 Feb 2024 01:01:26 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdsYj-0004EC-GL; Sat, 24 Feb 2024 08:59:21 -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 1rdsYc-0004Ah-To for qemu-devel@nongnu.org; Sat, 24 Feb 2024 08:59:14 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rdsYb-0002m0-13 for qemu-devel@nongnu.org; Sat, 24 Feb 2024 08:59:14 -0500 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-3392b045e0aso1314160f8f.2 for ; Sat, 24 Feb 2024 05:59:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708783150; x=1709387950; 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=eSTZZKZJd9onOmZuoGSDc/R40/Oc/o39d6sBD3S+k2A=; b=CHvu3BXfpqhjcQLQTbwVgi4PFE2MjqMymbfnfNPZtjXlGa3cUtzn10B9nhp6WS3Bou TRBuUi0hL5rarL6wCjPzV1uhRNSTeWyHCSao0OF2YaVP5TbhdI6/9kxkv+BhvcruGOyW J6VACOnLRsQZrasrkXAJqlQR64ZxalsDcBdwg5VHvtHqHvcanWLIkj7AwRb/842/KKkc cslfi9Ch8ngvSKI/s1VCAzt1xO+cr3jIxZobx4a23miLpoHZY3ceebdP9La3Xh0j6vhI UmCMYdtdCSC0RS6eO5wvxivBXnMa5oE5QKBuTSvvqtDkBBGQaKobUYZXtqFAj/tN64dA QOdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708783150; x=1709387950; 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=eSTZZKZJd9onOmZuoGSDc/R40/Oc/o39d6sBD3S+k2A=; b=hOQ4e/UbWF3QpKEUZMy+6D3YGBuoRUEeADbLAS2I2KnT5eH0n8LcHSwZYfow7+8CVY HOfwa8OBSrKD/OgvWXUmxY3bzkQ5c1fSsV1fKwDfZSV8j/vLoklWgHoVvcBnubT4nXnW CPQeTe/QrbIDtL33iH4cDUkqsNlWN3efHSyu+5favxDbbcJ6N5LOnsCxDk2/wnLHSBJo QvGrNS0d8jjkl3IAyYfguHsHR62m3NANloCOX2HRIkDyyEbVgdxfx+XWf2RDPGL4ZX/E +0tmpivMfM60fI+GskJPP15Kxby9MkRIphVM4TnD9yn6oMHSjDiiAt6YxmFZ7ngnk0rw SOpA== X-Gm-Message-State: AOJu0Yy9i1HkLpP8kPWKNFFFjjS03beuGXhxCe958+HpC3AVRDSD2oTc Zguv+bZoJCrkVLzRqq331xT8PmbHRIJUWhOlk5fw/wUeXUgMSkWmaydOoPGf X-Google-Smtp-Source: AGHT+IEDelizaLxsH9REnnjXKRVT9AC2w8qLDghH4sPV9ZmjXoSfpnCJTRYYrXhArVbpLG1ofC0UCw== X-Received: by 2002:a5d:6743:0:b0:33c:f9d6:fb20 with SMTP id l3-20020a5d6743000000b0033cf9d6fb20mr1849577wrw.45.1708783150577; Sat, 24 Feb 2024 05:59:10 -0800 (PST) Received: from archlinux.. (dynamic-089-012-138-060.89.12.pool.telefonica.de. [89.12.138.60]) by smtp.gmail.com with ESMTPSA id n8-20020a056000170800b0033d817eddd3sm2285542wrc.13.2024.02.24.05.59.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 05:59:09 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Ani Sinha , "Michael S. Tsirkin" , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost , Marcel Apfelbaum , Richard Henderson , Paolo Bonzini , Paul Durrant , Igor Mammedov , Jason Wang , David Woodhouse , Sergio Lopez , Bernhard Beschow Subject: [PATCH v2 6/6] hw/i386/pc: Inline pc_cmos_init() into pc_cmos_init_late() and remove it Date: Sat, 24 Feb 2024 14:58:51 +0100 Message-ID: <20240224135851.100361-7-shentey@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240224135851.100361-1-shentey@gmail.com> References: <20240224135851.100361-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=shentey@gmail.com; helo=mail-wr1-x433.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, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Now that pc_cmos_init() doesn't populate the X86MachineState::rtc attribute any longer, its duties can be merged into pc_cmos_init_late() which is called within machine_done notifier. This frees pc_piix and pc_q35 from explicit CMOS initialization. Signed-off-by: Bernhard Beschow --- include/hw/i386/pc.h | 2 -- hw/i386/pc.c | 10 ---------- hw/i386/pc_piix.c | 2 -- hw/i386/pc_q35.c | 2 -- 4 files changed, 16 deletions(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 4bb1899602..2b7c53d619 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -178,8 +178,6 @@ void pc_basic_device_init(struct PCMachineState *pcms, ISADevice *rtc_state, bool create_fdctrl, uint32_t hpet_irqs); -void pc_cmos_init(PCMachineState *pcms, - ISADevice *s); void pc_nic_init(PCMachineClass *pcmc, ISABus *isa_bus, PCIBus *pci_bus); void pc_i8259_create(ISABus *isa_bus, qemu_irq *i8259_irqs); diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 880e95de26..fad4c54512 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -567,14 +567,6 @@ static void pc_cmos_init_late(PCMachineState *pcms) mc146818rtc_set_cmos_data(s, 0x39, val); pc_cmos_init_floppy(s, pc_find_fdc0()); -} - -void pc_cmos_init(PCMachineState *pcms, - ISADevice *rtc) -{ - int val; - X86MachineState *x86ms = X86_MACHINE(pcms); - MC146818RtcState *s = MC146818_RTC(rtc); /* various important CMOS locations needed by PC/Bochs bios */ @@ -617,8 +609,6 @@ void pc_cmos_init(PCMachineState *pcms, val |= 0x02; /* FPU is there */ val |= 0x04; /* PS/2 mouse installed */ mc146818rtc_set_cmos_data(s, REG_EQUIPMENT_BYTE, val); - - /* hard drives and FDC are handled by pc_cmos_init_late() */ } static void handle_a20_line_change(void *opaque, int irq, int level) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index ce6aad758d..637f4d38be 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -342,8 +342,6 @@ static void pc_init1(MachineState *machine, } #endif - pc_cmos_init(pcms, x86ms->rtc); - if (piix4_pm) { smi_irq = qemu_allocate_irq(pc_acpi_smi_interrupt, first_cpu, 0); diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index e0b3f55a02..df0a5f934c 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -310,8 +310,6 @@ static void pc_q35_init(MachineState *machine) smbus_eeprom_init(pcms->smbus, 8, NULL, 0); } - pc_cmos_init(pcms, x86ms->rtc); - /* the rest devices to which pci devfn is automatically assigned */ pc_vga_init(isa_bus, pcms->pcibus); pc_nic_init(pcmc, isa_bus, pcms->pcibus);