From patchwork Thu Mar 28 15:54:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13608813 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 965F0CD128E for ; Thu, 28 Mar 2024 15:55:45 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps5m-00016w-5N; Thu, 28 Mar 2024 11:55:02 -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 1rps5e-00012h-0W for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:54:54 -0400 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps5a-0001pX-Rw for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:54:53 -0400 Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-a44f2d894b7so140389066b.1 for ; Thu, 28 Mar 2024 08:54:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641289; x=1712246089; 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=8xoyjiIw561YlGIaQRdLbxciG2dWfen0yY52crHbWn0=; b=hycLjgOdmSGADLUg7E1++Oeuk4Vs98GbuyXacIb1L+UIUXU89jYl56hdG8XsG9rTdf NJpM4rDqoJMjOOB0PBNXf39Ol5iH0THFjjO7y7FU5Ft9qqTbbE/UUU5fHjTl9vbdzF0h FxhNx3rKGkbahyu9rmI3XO76tyrNoBuoTSbZK/OkUOqDGn+d/syYxFMW6OQgjPp18Zvt GRYLUhU4sohr6EW2MnTty+QUFVt8cVLRjZr8yNgjaoTggQriyUhPn6Q5Tf3RjMAbTKbW DMbJd2UiyDLbz28AU6LeKJsDuh9BCFHj3jo3FIzF3u05cnQhk5mtGWM0HHvjIQc1G1wG OMsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641289; x=1712246089; 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=8xoyjiIw561YlGIaQRdLbxciG2dWfen0yY52crHbWn0=; b=erjzWY+wHzkN3VGCKSLM9DhWFT3qpGepkaroWIT6glo7ZN/e3wpmTp1JkJ4fpzgYD1 ikbdh7B8zLASFQsK7ytGZUgwIzyqKZ2xJIbeHdT6CPLEVXG2ABl7GVOpwuSQHDeWCoqv y4uGDI4z1qqODxWz7L5jyleUwr/bsx8hDfjZrmmRdFmTYpvNG/gTDUpi6BrUOedKMNo5 rotdDKCe+4tfMISnpeGn6YT2i+Xxve8iWsnfy9teJE1MZQ2NsyKc1DgjM2v3Shm7TTYB nyigCvwXj2jxT7YcaalfNu8UcZpyWarKD6sO4Tu26uI8l63tu/3SRLKxcwo1BfxGQnKs 5RzA== X-Gm-Message-State: AOJu0YzbQV4FkJwyMMxs12xym+ktLfldIwxSgIhGFar9F5HQW+ehHOMb 84oNwMQyFlU1K/tFfKlilsf3HOsTecg3N3qNDUMOJO77S2roDxcTbtNAwmTzEMmjt1RSwJplzZy Q X-Google-Smtp-Source: AGHT+IF5nPNNk6iWv9K9gmp+zF28jumHMVCID22KWO3BYQCYDbLztVinN6sDOrMp2q9Gec/eNpwGrA== X-Received: by 2002:a17:906:4892:b0:a47:3664:1b98 with SMTP id v18-20020a170906489200b00a4736641b98mr2095599ejq.7.1711641288815; Thu, 28 Mar 2024 08:54:48 -0700 (PDT) Received: from m1x-phil.lan (pas38-h02-176-184-5-52.dsl.sta.abo.bbox.fr. [176.184.5.52]) by smtp.gmail.com with ESMTPSA id f13-20020a1709062c4d00b00a4df82aa6a7sm882455ejh.219.2024.03.28.08.54.47 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 28 Mar 2024 08:54:48 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eduardo Habkost , Stefano Stabellini , xen-devel@lists.xenproject.org, Bernhard Beschow , Thomas Huth , Marcel Apfelbaum , "Michael S. Tsirkin" , Paolo Bonzini , Igor Mammedov , Anthony Perard , Ani Sinha , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [RFC PATCH-for-9.1 01/29] hw/i386/pc: Declare CPU QOM types using DEFINE_TYPES() macro Date: Thu, 28 Mar 2024 16:54:09 +0100 Message-ID: <20240328155439.58719-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240328155439.58719-1-philmd@linaro.org> References: <20240328155439.58719-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::631; envelope-from=philmd@linaro.org; helo=mail-ej1-x631.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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org When multiple QOM types are registered in the same file, it is simpler to use the the DEFINE_TYPES() macro. In particular because type array declared with such macro are easier to review. In few commits we are going to add more types, so replace the type_register_static() to ease further reviews. Signed-off-by: Philippe Mathieu-Daudé --- hw/i386/pc.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 0be8f08c47..2c41b08478 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1810,23 +1810,20 @@ static void pc_machine_class_init(ObjectClass *oc, void *data) pc_machine_set_fd_bootchk); } -static const TypeInfo pc_machine_info = { - .name = TYPE_PC_MACHINE, - .parent = TYPE_X86_MACHINE, - .abstract = true, - .instance_size = sizeof(PCMachineState), - .instance_init = pc_machine_initfn, - .class_size = sizeof(PCMachineClass), - .class_init = pc_machine_class_init, - .interfaces = (InterfaceInfo[]) { - { TYPE_HOTPLUG_HANDLER }, - { } +static const TypeInfo pc_machine_types[] = { + { + .name = TYPE_PC_MACHINE, + .parent = TYPE_X86_MACHINE, + .abstract = true, + .instance_size = sizeof(PCMachineState), + .instance_init = pc_machine_initfn, + .class_size = sizeof(PCMachineClass), + .class_init = pc_machine_class_init, + .interfaces = (InterfaceInfo[]) { + { TYPE_HOTPLUG_HANDLER }, + { } + }, }, }; -static void pc_machine_register_types(void) -{ - type_register_static(&pc_machine_info); -} - -type_init(pc_machine_register_types) +DEFINE_TYPES(pc_machine_types) From patchwork Thu Mar 28 15:54:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13608864 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1C522CD1284 for ; Thu, 28 Mar 2024 15:57:33 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps61-0001GL-03; Thu, 28 Mar 2024 11:55:17 -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 1rps5i-000179-WA for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:55:01 -0400 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps5h-0001pu-7P for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:54:58 -0400 Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-56bc5a3aeb9so1463066a12.3 for ; Thu, 28 Mar 2024 08:54:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641295; x=1712246095; 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=djs4Th+kjoxzBDQIObaEvmf5VGdYfcKG9Is4pj2rcJA=; b=Tz2/lS2gh+gTzG10G/+ARrz8nNZ9sW6JENFRXc0N++KHYnRln5cXL4aBMULEkid4ot 9SsC/TDxS2GIdQJNBp6+R42IokgwmoEF6+w0Wih7qfQoNYZucRjKSEepzglhUZG0wvby fiPhzoTWxSGvg1dbkgwRywZyRPuOLjhZDMfJrLVWAqUr2ypGqVX2rluTPp8ai4O3YTtY NYbKhnDfO4BaAkbcMbwFWPUZ9y61JUza0QiuEeUqv2p7mkp7wMVyToZS3PFd+auXxqQC L+gh1xdqGMPawuJKcpsUk8BhIgnf5881sX7ZdbSMylC6eM34gzRI83tFR4zuy7DApruZ ZqeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641295; x=1712246095; 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=djs4Th+kjoxzBDQIObaEvmf5VGdYfcKG9Is4pj2rcJA=; b=Zl9KITNdXXqHdtH58fbChjNtWNR3whSl/fYnskSicw3/XyvlamiBeb7WGCA+ezy/8y Y2Sft6KAWW9LMlUVvPWCtqhWydk1bZU3HV56BmezplJt5ADATK4u85TbnsuiyeO3d6Q8 fc/zQpM9rF6zYaKMYG9MJNP2aUb4yt/1CQRwjMDWo3viouszl8glbspvC9LSMq3KCnv3 h8kjUFDqDyicvhdjskHnsrLcBH+gL32mnkUbO1g8GBVexe0AQTB5yAwOiX8xl6XWJxuN qI2gudvPyL3+siYxClXEwH4sugQGztmrjOA8ZUOF+eX1jWYswtvFAEdgHk+NLs5suC5q EHkQ== X-Gm-Message-State: AOJu0Yx/6GJP04snQJhoZcXBoOSpsy13SmlyEgfWciHF9cqTdVbaNy0H fAboW3Jf3YbME77qZ7spi5t+d+c432tpRFxqvtRO6yUGhSA3wmGxsyEtNam32QHrzNT3uTQp2RE W X-Google-Smtp-Source: AGHT+IEDfKWv0Uve3VOXzzLi06hxTo6fvyAau83kjSqRi6VaUabzP1VqK7SGL6r5ov939b9QS2ny5A== X-Received: by 2002:a50:d6d8:0:b0:568:ae7:bc0 with SMTP id l24-20020a50d6d8000000b005680ae70bc0mr2299951edj.34.1711641295199; Thu, 28 Mar 2024 08:54:55 -0700 (PDT) Received: from m1x-phil.lan (pas38-h02-176-184-5-52.dsl.sta.abo.bbox.fr. [176.184.5.52]) by smtp.gmail.com with ESMTPSA id q4-20020aa7d444000000b00568d6a20717sm991251edr.52.2024.03.28.08.54.53 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 28 Mar 2024 08:54:54 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eduardo Habkost , Stefano Stabellini , xen-devel@lists.xenproject.org, Bernhard Beschow , Thomas Huth , Marcel Apfelbaum , "Michael S. Tsirkin" , Paolo Bonzini , Igor Mammedov , Anthony Perard , Ani Sinha , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [RFC PATCH-for-9.1 02/29] hw/i386/pc: Extract pc_machine_is_pci_enabled() helper Date: Thu, 28 Mar 2024 16:54:10 +0100 Message-ID: <20240328155439.58719-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240328155439.58719-1-philmd@linaro.org> References: <20240328155439.58719-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::536; envelope-from=philmd@linaro.org; helo=mail-ed1-x536.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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Introduce the pc_machine_is_pci_enabled() helper to be able to alter PCMachineClass fields later. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/i386/pc.h | 2 ++ hw/i386/pc.c | 11 +++++++++-- hw/i386/pc_piix.c | 11 ++++++----- hw/i386/pc_q35.c | 2 +- hw/i386/pc_sysfw.c | 11 ++++------- 5 files changed, 22 insertions(+), 15 deletions(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 0ad971782c..6b885424bb 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -129,6 +129,8 @@ struct PCMachineClass { #define TYPE_PC_MACHINE "generic-pc-machine" OBJECT_DECLARE_TYPE(PCMachineState, PCMachineClass, PC_MACHINE) +bool pc_machine_is_pci_enabled(PCMachineState *pcms); + /* ioapic.c */ GSIState *pc_gsi_create(qemu_irq **irqs, bool pci_enabled); diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 2c41b08478..7065f11e97 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -814,6 +814,7 @@ void pc_memory_init(PCMachineState *pcms, hwaddr maxphysaddr, maxusedaddr; hwaddr cxl_base, cxl_resv_end = 0; X86CPU *cpu = X86_CPU(first_cpu); + bool pci_enabled = pc_machine_is_pci_enabled(pcms); assert(machine->ram_size == x86ms->below_4g_mem_size + x86ms->above_4g_mem_size); @@ -949,7 +950,7 @@ void pc_memory_init(PCMachineState *pcms, option_rom_mr = g_malloc(sizeof(*option_rom_mr)); memory_region_init_ram(option_rom_mr, NULL, "pc.rom", PC_ROM_SIZE, &error_fatal); - if (pcmc->pci_enabled) { + if (pci_enabled) { memory_region_set_readonly(option_rom_mr, true); } memory_region_add_subregion_overlap(rom_memory, @@ -1642,6 +1643,7 @@ static void pc_machine_initfn(Object *obj) { PCMachineState *pcms = PC_MACHINE(obj); PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms); + bool pci_enabled = pc_machine_is_pci_enabled(pcms); #ifdef CONFIG_VMPORT pcms->vmport = ON_OFF_AUTO_AUTO; @@ -1668,7 +1670,7 @@ static void pc_machine_initfn(Object *obj) pcms->pcspk = isa_new(TYPE_PC_SPEAKER); object_property_add_alias(OBJECT(pcms), "pcspk-audiodev", OBJECT(pcms->pcspk), "audiodev"); - if (pcmc->pci_enabled) { + if (pci_enabled) { cxl_machine_init(obj, &pcms->cxl_devices_state); } @@ -1810,6 +1812,11 @@ static void pc_machine_class_init(ObjectClass *oc, void *data) pc_machine_set_fd_bootchk); } +bool pc_machine_is_pci_enabled(PCMachineState *pcms) +{ + return PC_MACHINE_GET_CLASS(pcms)->pci_enabled; +} + static const TypeInfo pc_machine_types[] = { { .name = TYPE_PC_MACHINE, diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index c00d2a66a6..1be1e050c7 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -117,6 +117,7 @@ static void pc_init1(MachineState *machine, const char *pci_type) MemoryRegion *rom_memory = system_memory; ram_addr_t lowmem; uint64_t hole64_size = 0; + bool pci_enabled = pc_machine_is_pci_enabled(pcms); /* * Calculate ram split, for memory below and above 4G. It's a bit @@ -187,7 +188,7 @@ static void pc_init1(MachineState *machine, const char *pci_type) kvmclock_create(pcmc->kvmclock_create_always); } - if (pcmc->pci_enabled) { + if (pci_enabled) { pci_memory = g_new(MemoryRegion, 1); memory_region_init(pci_memory, NULL, "pci", UINT64_MAX); rom_memory = pci_memory; @@ -234,9 +235,9 @@ static void pc_init1(MachineState *machine, const char *pci_type) } } - gsi_state = pc_gsi_create(&x86ms->gsi, pcmc->pci_enabled); + gsi_state = pc_gsi_create(&x86ms->gsi, pci_enabled); - if (pcmc->pci_enabled) { + if (pci_enabled) { PCIDevice *pci_dev; DeviceState *dev; size_t i; @@ -308,7 +309,7 @@ static void pc_init1(MachineState *machine, const char *pci_type) x86_register_ferr_irq(x86ms->gsi[13]); } - pc_vga_init(isa_bus, pcmc->pci_enabled ? pcms->pcibus : NULL); + pc_vga_init(isa_bus, pci_enabled ? pcms->pcibus : NULL); assert(pcms->vmport != ON_OFF_AUTO__MAX); if (pcms->vmport == ON_OFF_AUTO_AUTO) { @@ -322,7 +323,7 @@ static void pc_init1(MachineState *machine, const char *pci_type) pc_nic_init(pcmc, isa_bus, pcms->pcibus); #ifdef CONFIG_IDE_ISA - if (!pcmc->pci_enabled) { + if (!pci_enabled) { DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; int i; diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index b5922b44af..43ee1e595c 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -145,7 +145,7 @@ static void pc_q35_init(MachineState *machine) bool keep_pci_slot_hpc; uint64_t pci_hole64_size = 0; - assert(pcmc->pci_enabled); + assert(pc_machine_is_pci_enabled(pcms)); /* Check whether RAM fits below 4G (leaving 1/2 GByte for IO memory * and 256 Mbytes for PCI Express Enhanced Configuration Access Mapping diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c index 3efabbbab2..862a082b0a 100644 --- a/hw/i386/pc_sysfw.c +++ b/hw/i386/pc_sysfw.c @@ -93,9 +93,7 @@ static PFlashCFI01 *pc_pflash_create(PCMachineState *pcms, void pc_system_flash_create(PCMachineState *pcms) { - PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms); - - if (pcmc->pci_enabled) { + if (pc_machine_is_pci_enabled(pcms)) { pcms->flash[0] = pc_pflash_create(pcms, "system.flash0", "pflash0"); pcms->flash[1] = pc_pflash_create(pcms, "system.flash1", @@ -108,7 +106,7 @@ void pc_system_flash_cleanup_unused(PCMachineState *pcms) char *prop_name; int i; - assert(PC_MACHINE_GET_CLASS(pcms)->pci_enabled); + assert(pc_machine_is_pci_enabled(pcms)); for (i = 0; i < ARRAY_SIZE(pcms->flash); i++) { if (!qdev_is_realized(DEVICE(pcms->flash[i]))) { @@ -146,7 +144,7 @@ static void pc_system_flash_map(PCMachineState *pcms, void *flash_ptr; int flash_size; - assert(PC_MACHINE_GET_CLASS(pcms)->pci_enabled); + assert(pc_machine_is_pci_enabled(pcms)); for (i = 0; i < ARRAY_SIZE(pcms->flash); i++) { system_flash = pcms->flash[i]; @@ -201,11 +199,10 @@ static void pc_system_flash_map(PCMachineState *pcms, void pc_system_firmware_init(PCMachineState *pcms, MemoryRegion *rom_memory) { - PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms); int i; BlockBackend *pflash_blk[ARRAY_SIZE(pcms->flash)]; - if (!pcmc->pci_enabled) { + if (!pc_machine_is_pci_enabled(pcms)) { x86_bios_rom_init(MACHINE(pcms), "bios.bin", rom_memory, true); return; } From patchwork Thu Mar 28 15:54:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13608810 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 82943CD1288 for ; Thu, 28 Mar 2024 15:55:44 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps5z-0001Cv-K2; Thu, 28 Mar 2024 11:55:16 -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 1rps5q-00018b-C0 for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:55:09 -0400 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps5n-0001ui-Jk for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:55:04 -0400 Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-56bc5a3aeb9so1463203a12.3 for ; Thu, 28 Mar 2024 08:55:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641301; x=1712246101; 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=2NXhpW96pCgkEoWuYwRT5cvChay+RSkHkEuAn7B/Dd0=; b=x97DBHoVgI4tYR7nRGTtRe/rqwAZEQT4s8WcHD8FNi45RLtCA841e9dNZVjVuUEBrK xyy2HqgA1WLdiDTKCunkHxVG9arRnn0bmWvtpTVpOW8qQYH4EVeRT/VIcPkWNEIg4092 PTCabCwwP/LqbojA6VaJZPijzutJfqq8efhb7GGJLO7blUIN2v4XKEAzRw5UpZHAcU/2 IQoqGs+S0CXflPD2IRMpc/57QNfuDnKdNHfc0sbIJXLHOQn2MmgmR0yDg23V2qqxI2xf vyUCkKfrNCg6azBT20W2x/AWYrLn+KGNPRfar+HYHLAjKN+cIyMIw8zf69pq1libRluc bgTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641301; x=1712246101; 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=2NXhpW96pCgkEoWuYwRT5cvChay+RSkHkEuAn7B/Dd0=; b=Lnc5cBwR7qKcWNam/86Je92EVYkBXjy0c2T10xNAcJ7+KVBgU5lD/BTAc4Xs/xV5ay ZiSlFUrnofMUdbk318MREqSojXSN3oay9KDuBf+TRshK1v2C6NoA1dZvA+iIQkY/IQYk peJ0bw6zQGMuaG9dBTKCm5qPwKEueXkhmhTUw01Hry6MGacfCwdmDetN8v1ufI8rRe7e hmc6fSMpZKJyjh9zNWjrLzLKeMpWB0SIa/CWcZc9NEKPq3DanimDBwHUHobiQGF01xPE RWl3PkVGvBZTrpZAceYykVs4rBHzt9ySJgxKSLDcF09guGyZsi/u/RjQnipfosltcRjS HpXQ== X-Gm-Message-State: AOJu0YynJiPX9ZzXkAaZX0vFsHYuK9fQDzP79Us+Qq1f4ze9FWP6c4HM TERZPrGqNO7EUtsB5jkbVmOLjNnWvriwuaW+b5v8W8t6cKdZjk6gliJxYfuCRAzG72PhNo4BOkv 7 X-Google-Smtp-Source: AGHT+IF6f1YMBvOfsUocaggEtYJ9a+Kecpnx8/ab4gXfJ3RdBR3huqwiywmto+50jVUBk5TY6jKE5g== X-Received: by 2002:a50:a412:0:b0:566:f81:41a1 with SMTP id u18-20020a50a412000000b005660f8141a1mr2402222edb.22.1711641301544; Thu, 28 Mar 2024 08:55:01 -0700 (PDT) Received: from m1x-phil.lan (pas38-h02-176-184-5-52.dsl.sta.abo.bbox.fr. [176.184.5.52]) by smtp.gmail.com with ESMTPSA id d15-20020a056402400f00b0056c5395e581sm753171eda.70.2024.03.28.08.54.59 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 28 Mar 2024 08:55:01 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eduardo Habkost , Stefano Stabellini , xen-devel@lists.xenproject.org, Bernhard Beschow , Thomas Huth , Marcel Apfelbaum , "Michael S. Tsirkin" , Paolo Bonzini , Igor Mammedov , Anthony Perard , Ani Sinha , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [RFC PATCH-for-9.1 03/29] hw/i386/pc: Pass base machine type as argument to DEFINE_PC_MACHINE() Date: Thu, 28 Mar 2024 16:54:11 +0100 Message-ID: <20240328155439.58719-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240328155439.58719-1-philmd@linaro.org> References: <20240328155439.58719-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52d; envelope-from=philmd@linaro.org; helo=mail-ed1-x52d.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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Currently PC machines are based on TYPE_PC_MACHINE. In preparation of being based on different types, pass the current type as argument. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/i386/pc.h | 4 ++-- hw/i386/pc_piix.c | 9 +++++---- hw/i386/pc_q35.c | 3 ++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 6b885424bb..33023ebbbe 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -268,7 +268,7 @@ extern const size_t pc_compat_2_4_len; extern GlobalProperty pc_compat_2_3[]; extern const size_t pc_compat_2_3_len; -#define DEFINE_PC_MACHINE(suffix, namestr, initfn, optsfn) \ +#define DEFINE_PC_MACHINE(suffix, namestr, initfn, optsfn, parent_class) \ static void pc_machine_##suffix##_class_init(ObjectClass *oc, void *data) \ { \ MachineClass *mc = MACHINE_CLASS(oc); \ @@ -277,7 +277,7 @@ extern const size_t pc_compat_2_3_len; } \ static const TypeInfo pc_machine_type_##suffix = { \ .name = namestr TYPE_MACHINE_SUFFIX, \ - .parent = TYPE_PC_MACHINE, \ + .parent = parent_class, \ .class_init = pc_machine_##suffix##_class_init, \ }; \ static void pc_machine_init_##suffix(void) \ diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 1be1e050c7..b9f85148e3 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -462,7 +462,8 @@ static void pc_xen_hvm_init(MachineState *machine) } \ pc_init1(machine, TYPE_I440FX_PCI_DEVICE); \ } \ - DEFINE_PC_MACHINE(suffix, name, pc_init_##suffix, optionfn) + DEFINE_PC_MACHINE(suffix, name, pc_init_##suffix, optionfn, \ + TYPE_PC_MACHINE) static void pc_i440fx_machine_options(MachineClass *m) { @@ -824,7 +825,7 @@ static void isapc_machine_options(MachineClass *m) } DEFINE_PC_MACHINE(isapc, "isapc", pc_init_isa, - isapc_machine_options); + isapc_machine_options, TYPE_PC_MACHINE); #endif #ifdef CONFIG_XEN @@ -837,7 +838,7 @@ static void xenfv_4_2_machine_options(MachineClass *m) } DEFINE_PC_MACHINE(xenfv_4_2, "xenfv-4.2", pc_xen_hvm_init, - xenfv_4_2_machine_options); + xenfv_4_2_machine_options, TYPE_PC_MACHINE); static void xenfv_3_1_machine_options(MachineClass *m) { @@ -849,5 +850,5 @@ static void xenfv_3_1_machine_options(MachineClass *m) } DEFINE_PC_MACHINE(xenfv, "xenfv-3.1", pc_xen_hvm_init, - xenfv_3_1_machine_options); + xenfv_3_1_machine_options, TYPE_PC_MACHINE); #endif diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 43ee1e595c..7dbee38f03 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -338,7 +338,8 @@ static void pc_q35_init(MachineState *machine) } \ pc_q35_init(machine); \ } \ - DEFINE_PC_MACHINE(suffix, name, pc_init_##suffix, optionfn) + DEFINE_PC_MACHINE(suffix, name, pc_init_##suffix, optionfn, \ + TYPE_PC_MACHINE) static void pc_q35_machine_options(MachineClass *m) From patchwork Thu Mar 28 15:54:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13608812 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B6A46CD128C for ; Thu, 28 Mar 2024 15:55:44 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps65-0001SK-Cq; Thu, 28 Mar 2024 11:55:23 -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 1rps5z-0001GN-7W for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:55:16 -0400 Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps5v-00023G-6T for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:55:14 -0400 Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-a2f22bfb4e6so154897166b.0 for ; Thu, 28 Mar 2024 08:55:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641308; x=1712246108; 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=sfY93X5jZfIbOGpoyV/9aTUl+UEfpsvUbOU4aZU0Anc=; b=KcDehLZUQFLKH1qMQyQfd7qkVzkHxH1kJCPkbPOwv5fq3LkHOCbg7ydwNNQvMVZ0vh 7iTm43HX5ZO3RBPh/ikhoBgoQQjFtpMInpQpu39B3lycRIEq8XQ/zI/tAS3Pzv2fhTTi bu8y4BaDrcpgVUC8p+NPktKkTDbdhBRUIW8N7zezmz9CkGrz6YiDKi/H3zydbT+vK7jx FpDeN8V7wlUoHOaKKRbEjoub6FcDm335XzO/Terj9+Iy+ZQywBfq7G4EubyGXunw0CdZ rsTSnRdOTVE5ANSEE8E/q8UsGRytQvKraupCTSoNePUgZHyobP+0f9hE95NHt3vo7P9S h14A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641308; x=1712246108; 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=sfY93X5jZfIbOGpoyV/9aTUl+UEfpsvUbOU4aZU0Anc=; b=K5bADfnC6gQLkGdHqYJg1f1GWU70JpDPnQVhABNXhfb5CXlzRJntH0qVYeDEIhqxq5 i12pz9nfScxdZqRYK+QPlqigMh+4MTVUUgJGMU0Hqg2VgXd7xOFAsiK8MGbpQDLaEEQj dZbrEI/84P/eHHBleRyx6CJlsYHRiuE/Lz1M/UtP/68OWjKmAK+R7y1s05WAOJOPQKWb gUvqly/qxVeiz2y77G0dgg6pjz8W8UaUklRpafWzXV58ykoGT92JAUBS1xNlo/i0ugx/ AVzXxB782lt5NWsHvE6xUhEqJ0zbPMXfiskereeQCcBfAbS94KGSwiKATZN0Upl6XOsO KTCQ== X-Gm-Message-State: AOJu0YwO+zJlTJqq3ciNWMol5TykU4Uq0v1/vSXv/F2riAxwJr/RhsJ/ bGI+3mAaL0xhb0gktooHaoKcNuTSPU9gd84RhYbkXEIaVnk+M64BU4Wy2iAO11XnDHMto8nx0RB 0 X-Google-Smtp-Source: AGHT+IFlVuycGv39RKoJmMuDSzpYHIv5NkuYfdH5v63bTElq/w8DazJwyMi8sNCnbLq/4DH71CZp5g== X-Received: by 2002:a17:906:2dce:b0:a4e:299f:7f4f with SMTP id h14-20020a1709062dce00b00a4e299f7f4fmr690299eji.48.1711641307840; Thu, 28 Mar 2024 08:55:07 -0700 (PDT) Received: from m1x-phil.lan (pas38-h02-176-184-5-52.dsl.sta.abo.bbox.fr. [176.184.5.52]) by smtp.gmail.com with ESMTPSA id x15-20020a170906710f00b00a46cc48ab13sm898792ejj.62.2024.03.28.08.55.06 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 28 Mar 2024 08:55:07 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eduardo Habkost , Stefano Stabellini , xen-devel@lists.xenproject.org, Bernhard Beschow , Thomas Huth , Marcel Apfelbaum , "Michael S. Tsirkin" , Paolo Bonzini , Igor Mammedov , Anthony Perard , Ani Sinha , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [RFC PATCH-for-9.1 04/29] hw/i386/pc: Introduce PC_PCI_MACHINE QOM type Date: Thu, 28 Mar 2024 16:54:12 +0100 Message-ID: <20240328155439.58719-5-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240328155439.58719-1-philmd@linaro.org> References: <20240328155439.58719-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::632; envelope-from=philmd@linaro.org; helo=mail-ej1-x632.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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Introduce TYPE_PC_PCI_MACHINE for machines where PCI is expected (as opposition to the ISA-only PC machine). This type inherits from the well known TYPE_PC_MACHINE. Convert I440FX/PIIX and Q35 machines to use it. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/i386/pc.h | 25 ++++++++++++++++--------- hw/i386/pc.c | 25 +++++++++++++++++++++++++ hw/i386/pc_piix.c | 6 +++--- hw/i386/pc_q35.c | 2 +- 4 files changed, 45 insertions(+), 13 deletions(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 33023ebbbe..1a4a61148a 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -22,11 +22,8 @@ * @boot_cpus: number of present VCPUs */ typedef struct PCMachineState { - /*< private >*/ X86MachineState parent_obj; - /* */ - /* State for other subsystems/APIs: */ Notifier machine_done; @@ -60,6 +57,12 @@ typedef struct PCMachineState { CXLState cxl_devices_state; } PCMachineState; +typedef struct PcPciMachineState { + PCMachineState parent_obj; + + Notifier machine_done; +} PcPciMachineState; + #define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device" #define PC_MACHINE_MAX_RAM_BELOW_4G "max-ram-below-4g" #define PC_MACHINE_VMPORT "vmport" @@ -80,12 +83,9 @@ typedef struct PCMachineState { * way we can use 1GByte pages in the host. * */ -struct PCMachineClass { - /*< private >*/ +typedef struct PCMachineClass { X86MachineClass parent_class; - /*< public >*/ - /* Device configuration: */ bool pci_enabled; const char *default_south_bridge; @@ -124,13 +124,20 @@ struct PCMachineClass { * check for memory. */ bool broken_32bit_mem_addr_check; -}; +} PCMachineClass; -#define TYPE_PC_MACHINE "generic-pc-machine" +typedef struct PcPciMachineClass { + PCMachineClass parent_class; +} PcPciMachineClass; + +#define TYPE_PC_MACHINE "common-pc-machine" OBJECT_DECLARE_TYPE(PCMachineState, PCMachineClass, PC_MACHINE) bool pc_machine_is_pci_enabled(PCMachineState *pcms); +#define TYPE_PC_PCI_MACHINE "pci-pc-machine" +OBJECT_DECLARE_TYPE(PcPciMachineState, PcPciMachineClass, PC_PCI_MACHINE) + /* ioapic.c */ GSIState *pc_gsi_create(qemu_irq **irqs, bool pci_enabled); diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 7065f11e97..eafd521489 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -621,6 +621,10 @@ void pc_machine_done(Notifier *notifier, void *data) pc_cmos_init_late(pcms); } +static void pc_pci_machine_done(Notifier *notifier, void *data) +{ +} + /* setup pci memory address space mapping into system address space */ void pc_pci_as_mapping_init(MemoryRegion *system_memory, MemoryRegion *pci_address_space) @@ -1678,6 +1682,14 @@ static void pc_machine_initfn(Object *obj) qemu_add_machine_init_done_notifier(&pcms->machine_done); } +static void pc_pci_machine_initfn(Object *obj) +{ + PcPciMachineState *ppms = PC_PCI_MACHINE(obj); + + ppms->machine_done.notify = pc_pci_machine_done; + qemu_add_machine_init_done_notifier(&ppms->machine_done); +} + static void pc_machine_reset(MachineState *machine, ShutdownCause reason) { CPUState *cs; @@ -1812,6 +1824,10 @@ static void pc_machine_class_init(ObjectClass *oc, void *data) pc_machine_set_fd_bootchk); } +static void pc_pci_machine_class_init(ObjectClass *oc, void *data) +{ +} + bool pc_machine_is_pci_enabled(PCMachineState *pcms) { return PC_MACHINE_GET_CLASS(pcms)->pci_enabled; @@ -1831,6 +1847,15 @@ static const TypeInfo pc_machine_types[] = { { } }, }, + { + .name = TYPE_PC_PCI_MACHINE, + .parent = TYPE_PC_MACHINE, + .abstract = true, + .instance_size = sizeof(PcPciMachineState), + .instance_init = pc_pci_machine_initfn, + .class_size = sizeof(PcPciMachineClass), + .class_init = pc_pci_machine_class_init, + }, }; DEFINE_TYPES(pc_machine_types) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index b9f85148e3..7ada452f91 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -463,7 +463,7 @@ static void pc_xen_hvm_init(MachineState *machine) pc_init1(machine, TYPE_I440FX_PCI_DEVICE); \ } \ DEFINE_PC_MACHINE(suffix, name, pc_init_##suffix, optionfn, \ - TYPE_PC_MACHINE) + TYPE_PC_PCI_MACHINE) static void pc_i440fx_machine_options(MachineClass *m) { @@ -838,7 +838,7 @@ static void xenfv_4_2_machine_options(MachineClass *m) } DEFINE_PC_MACHINE(xenfv_4_2, "xenfv-4.2", pc_xen_hvm_init, - xenfv_4_2_machine_options, TYPE_PC_MACHINE); + xenfv_4_2_machine_options, TYPE_PC_PCI_MACHINE); static void xenfv_3_1_machine_options(MachineClass *m) { @@ -850,5 +850,5 @@ static void xenfv_3_1_machine_options(MachineClass *m) } DEFINE_PC_MACHINE(xenfv, "xenfv-3.1", pc_xen_hvm_init, - xenfv_3_1_machine_options, TYPE_PC_MACHINE); + xenfv_3_1_machine_options, TYPE_PC_PCI_MACHINE); #endif diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 7dbee38f03..c3b0467ef3 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -339,7 +339,7 @@ static void pc_q35_init(MachineState *machine) pc_q35_init(machine); \ } \ DEFINE_PC_MACHINE(suffix, name, pc_init_##suffix, optionfn, \ - TYPE_PC_MACHINE) + TYPE_PC_PCI_MACHINE) static void pc_q35_machine_options(MachineClass *m) From patchwork Thu Mar 28 15:54:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13608814 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8AE55CD1283 for ; Thu, 28 Mar 2024 15:55:57 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps6D-0001bY-W8; Thu, 28 Mar 2024 11:55:31 -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 1rps64-0001TQ-IN for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:55:21 -0400 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps5z-00023o-VL for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:55:17 -0400 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-56c12c73ed8so1455202a12.2 for ; Thu, 28 Mar 2024 08:55:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641314; x=1712246114; 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=tfLLKG41I2ogYG1kIbKxMmfGPQoeoLD1UnfKcWEnm1Y=; b=mvt5cp4szbiwSIAxlAz/tZh/2B2lO9Q85L4uA69QlgVmkp6HuoYfeNLmDtsAmkzIt6 KHSbmUup4N9x3CR1ksLJiOIhkjdUQb58cPagpEqGR1iLMoBR9sij8qZYw0aZ4RuqOfTh 9tcAvt2LmFmYu7iI00I9G1j5/oRJxp/OIjPSaqLdC7BDE2r4nFWdvNpT8mo6KiK3wzli fnNd5qz1ZGKx/Qp5k2Ed1mSSj4zINffAnk1MEzDdMp+IwwCowqIFYKCkSdET5Pnlhg8C ou1pPX0LWgqULPz//NrmW0D+dOcnaq1+gSrKIt58zp7g1XzuNHf/3QgentUjTKTHprAu 10cQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641314; x=1712246114; 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=tfLLKG41I2ogYG1kIbKxMmfGPQoeoLD1UnfKcWEnm1Y=; b=m5QmfiSkYruv3p0yqgYr/Dl1UTfXgcRbgA7ZIWch3A+aD/VA8oX8dG+LutdS0narWE oFrVvv8VJKZUEgt1ctVCZm/XbQiGUFVhp2UOSOtf9mrzewZIkYIcVj4XBgpcAqO3glL8 vwTeorPnrc/WEIrcgJeOaBqeaOpO9pMi5Kcdrfzp+j3dZhNp2qJMetY8kcZr3Jzmi6vd CGKDQu8IH1ktHOtHCga7s81CKsB0CC3vJsDiiMgvK7L9+yd9R2Zcoit3Uw0agQg8glg9 asUA5Arb4w30ohOS3UzeF6s/1wsG3EgDZSQX/c75JgQO87q4eESHVZk6p2fbOZx2uVrK d5xA== X-Gm-Message-State: AOJu0YzP9KPuPN6/0M7Op+hbEN5Ap95pBaH5Dp+C5zsSr1YHPM6DK9U+ Dbe3QSXDCzSQ6ERp6EIXehLFwSc7lPflFVdeUqxWMSied7M+8CPekUgRdBs1yAYArQrXIFw0y0d N X-Google-Smtp-Source: AGHT+IHgYPcqLucwrXXanAHQ1HQbxbpMZQm6yL1cnX0JqCYBkEci+AP5aBFgq++VGYS+wx15kRnpQw== X-Received: by 2002:a50:ccd1:0:b0:56a:e8e4:9aef with SMTP id b17-20020a50ccd1000000b0056ae8e49aefmr2604908edj.7.1711641314036; Thu, 28 Mar 2024 08:55:14 -0700 (PDT) Received: from m1x-phil.lan (pas38-h02-176-184-5-52.dsl.sta.abo.bbox.fr. [176.184.5.52]) by smtp.gmail.com with ESMTPSA id ig3-20020a056402458300b0056c0a668316sm970627edb.3.2024.03.28.08.55.12 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 28 Mar 2024 08:55:13 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eduardo Habkost , Stefano Stabellini , xen-devel@lists.xenproject.org, Bernhard Beschow , Thomas Huth , Marcel Apfelbaum , "Michael S. Tsirkin" , Paolo Bonzini , Igor Mammedov , Anthony Perard , Ani Sinha , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [RFC PATCH-for-9.1 05/29] hw/i386/pc: Remove PCMachineClass::pci_enabled field Date: Thu, 28 Mar 2024 16:54:13 +0100 Message-ID: <20240328155439.58719-6-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240328155439.58719-1-philmd@linaro.org> References: <20240328155439.58719-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::530; envelope-from=philmd@linaro.org; helo=mail-ed1-x530.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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org All TYPE_PC_PCI_MACHINE-based machines have pci_enabled set to %true. By checking a TYPE_PC_MACHINE inherits the TYPE_PC_PCI_MACHINE base class, we don't need this field anymore. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/i386/pc.h | 1 - hw/i386/pc.c | 3 +-- hw/i386/pc_piix.c | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 1a4a61148a..0b23e5ec7b 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -87,7 +87,6 @@ typedef struct PCMachineClass { X86MachineClass parent_class; /* Device configuration: */ - bool pci_enabled; const char *default_south_bridge; /* Compat options: */ diff --git a/hw/i386/pc.c b/hw/i386/pc.c index eafd521489..a16bb1554c 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1740,7 +1740,6 @@ static void pc_machine_class_init(ObjectClass *oc, void *data) PCMachineClass *pcmc = PC_MACHINE_CLASS(oc); HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc); - pcmc->pci_enabled = true; pcmc->has_acpi_build = true; pcmc->smbios_defaults = true; pcmc->gigabyte_align = true; @@ -1830,7 +1829,7 @@ static void pc_pci_machine_class_init(ObjectClass *oc, void *data) bool pc_machine_is_pci_enabled(PCMachineState *pcms) { - return PC_MACHINE_GET_CLASS(pcms)->pci_enabled; + return !!object_dynamic_cast(OBJECT(pcms), TYPE_PC_PCI_MACHINE); } static const TypeInfo pc_machine_types[] = { diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 7ada452f91..776d02db73 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -813,7 +813,6 @@ static void isapc_machine_options(MachineClass *m) m->max_cpus = 1; m->option_rom_has_mr = true; m->rom_file_has_mr = false; - pcmc->pci_enabled = false; pcmc->has_acpi_build = false; pcmc->smbios_defaults = false; pcmc->gigabyte_align = false; From patchwork Thu Mar 28 15:54:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13608815 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 22FB2CD128C for ; Thu, 28 Mar 2024 15:56:03 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps6H-0001n7-NI; Thu, 28 Mar 2024 11:55:33 -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 1rps68-0001Xv-GX for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:55:26 -0400 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps66-00024h-Fd for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:55:24 -0400 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-56c2c41cbdaso648823a12.2 for ; Thu, 28 Mar 2024 08:55:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641320; x=1712246120; 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=Qqj3zRF0zkE64TiaxdKa2OyadNVq3wsX7i8167PhhDk=; b=fpFpEreOmtqPkGN8wZCLxiaQDUL02smlviXnSG1rTHWvb/HCrx5b4grPSWcsNQXRpn tZdjG4EDK2g9P7UVasve5CEBL+ydTAaYLbQJgswM0+v+704FhNUSsxUeTXzY1V9n8RO4 OdBb47UI2Z9f2gQ/8ZszJRdebX1G5UkLYocS2FZ405krHs45dpjkrPoiEkcLd7sjoWz+ +cYNrApJhKkeoZGPZqWL93aMVqdkcX7YCEvMN9ber2fpA5HjCuiE7Uh8xJjpdinF3hZp 1iZ8jIWQvwNkDOVULNMungitVCfgJypewuFUKiYNAoQrnpB3nd8kra7Z9s8nDAx9kIeU Xhcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641320; x=1712246120; 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=Qqj3zRF0zkE64TiaxdKa2OyadNVq3wsX7i8167PhhDk=; b=X5YK9aM/Fbb9wWMjwPA/gsTssU4ihRunn1alTYeUT3hwzAvddQT2FoHEz4njWCJ4PR k1tS22M47G0Mq43OjQZbPbJTQgmHE0DjN4tBsorZ9lqzPjGdC0OlJROSJRh7eei5r8Qc PBgl83bS4q+D59HYYcvZiEez2Dqvpd3PCAQbQC+vPs1DkL0qbH6DU/E4txkDEZj0Sapt WUdXdzHD+gk5mNpli2Z3Fd9MGBoDxfbtonhAAWfG+CbLRR5wsu1yf6i1c1QhVTcmQweg 711TlzTujrjNgz4p0bPOpiw+GW4hRsZPFGHVdJv5UXkDeczwjnxlapqgeoNJmrziRPR2 jtGw== X-Gm-Message-State: AOJu0YxsvvRYtLCTu78+vui0a1fHaAudJejz9vVyXQoZ5bdw99Gb1Jth nl5/xyUAAhwpGCz7iuxVWQRmEcW2akuxXD1E+mHzsezXzlb3FDmMfQ6f+wuWXmuuNnTzMpkopfR + X-Google-Smtp-Source: AGHT+IHK7QxU7AgeWAocSeLH4R3SrP+9YZVhIuiOSStSg8CKPyXF7V4Tf4M9BXjp5dsE6yThozBjEA== X-Received: by 2002:a50:8d08:0:b0:566:ecce:9d3c with SMTP id s8-20020a508d08000000b00566ecce9d3cmr2991678eds.26.1711641320462; Thu, 28 Mar 2024 08:55:20 -0700 (PDT) Received: from m1x-phil.lan (pas38-h02-176-184-5-52.dsl.sta.abo.bbox.fr. [176.184.5.52]) by smtp.gmail.com with ESMTPSA id ef15-20020a05640228cf00b0056c1380a972sm963818edb.74.2024.03.28.08.55.18 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 28 Mar 2024 08:55:20 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eduardo Habkost , Stefano Stabellini , xen-devel@lists.xenproject.org, Bernhard Beschow , Thomas Huth , Marcel Apfelbaum , "Michael S. Tsirkin" , Paolo Bonzini , Igor Mammedov , Anthony Perard , Ani Sinha , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [RFC PATCH-for-9.1 06/29] hw/i386/pc: Move pci_root_uid field to PcPciMachineClass Date: Thu, 28 Mar 2024 16:54:14 +0100 Message-ID: <20240328155439.58719-7-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240328155439.58719-1-philmd@linaro.org> References: <20240328155439.58719-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::530; envelope-from=philmd@linaro.org; helo=mail-ed1-x530.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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org The 'pci_root_uid' field is irrelevant for non-PCI machines, restrict it to the PcPciMachineClass. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/i386/pc.h | 4 +++- hw/i386/acpi-build.c | 9 +++++++-- hw/i386/pc_piix.c | 7 +++++-- hw/i386/pc_q35.c | 7 +++++-- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 0b23e5ec7b..24c8e17e62 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -96,7 +96,6 @@ typedef struct PCMachineClass { /* ACPI compat: */ bool has_acpi_build; - int pci_root_uid; /* SMBIOS compat: */ bool smbios_defaults; @@ -127,6 +126,9 @@ typedef struct PCMachineClass { typedef struct PcPciMachineClass { PCMachineClass parent_class; + + /* ACPI compat: */ + int pci_root_uid; } PcPciMachineClass; #define TYPE_PC_MACHINE "common-pc-machine" diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 6f9925d176..b9890886f6 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1426,6 +1426,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, CrsRangeSet crs_range_set; PCMachineState *pcms = PC_MACHINE(machine); PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(machine); + PcPciMachineClass *ppmc; X86MachineState *x86ms = X86_MACHINE(machine); AcpiMcfgInfo mcfg; bool mcfg_valid = !!acpi_get_mcfg(&mcfg); @@ -1448,10 +1449,12 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, build_dbg_aml(dsdt); if (i440fx) { + ppmc = PC_PCI_MACHINE_GET_CLASS(machine); + sb_scope = aml_scope("_SB"); dev = aml_device("PCI0"); aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A03"))); - aml_append(dev, aml_name_decl("_UID", aml_int(pcmc->pci_root_uid))); + aml_append(dev, aml_name_decl("_UID", aml_int(ppmc->pci_root_uid))); aml_append(dev, aml_pci_edsm()); aml_append(sb_scope, dev); aml_append(dsdt, sb_scope); @@ -1461,11 +1464,13 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, } build_piix4_pci0_int(dsdt); } else if (q35) { + ppmc = PC_PCI_MACHINE_GET_CLASS(machine); + sb_scope = aml_scope("_SB"); dev = aml_device("PCI0"); aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A08"))); aml_append(dev, aml_name_decl("_CID", aml_eisaid("PNP0A03"))); - aml_append(dev, aml_name_decl("_UID", aml_int(pcmc->pci_root_uid))); + aml_append(dev, aml_name_decl("_UID", aml_int(ppmc->pci_root_uid))); aml_append(dev, build_q35_osc_method(!pm->pcihp_bridge_en)); aml_append(dev, aml_pci_edsm()); aml_append(sb_scope, dev); diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 776d02db73..c42dd46e59 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -468,9 +468,11 @@ static void pc_xen_hvm_init(MachineState *machine) static void pc_i440fx_machine_options(MachineClass *m) { PCMachineClass *pcmc = PC_MACHINE_CLASS(m); + PcPciMachineClass *ppmc = PC_PCI_MACHINE_CLASS(m); ObjectClass *oc = OBJECT_CLASS(m); + pcmc->default_south_bridge = TYPE_PIIX3_DEVICE; - pcmc->pci_root_uid = 0; + ppmc->pci_root_uid = 0; pcmc->default_cpu_version = 1; m->family = "pc_piix"; @@ -622,12 +624,13 @@ DEFINE_I440FX_MACHINE(v5_2, "pc-i440fx-5.2", NULL, static void pc_i440fx_5_1_machine_options(MachineClass *m) { PCMachineClass *pcmc = PC_MACHINE_CLASS(m); + PcPciMachineClass *ppmc = PC_PCI_MACHINE_CLASS(m); pc_i440fx_5_2_machine_options(m); compat_props_add(m->compat_props, hw_compat_5_1, hw_compat_5_1_len); compat_props_add(m->compat_props, pc_compat_5_1, pc_compat_5_1_len); pcmc->kvmclock_create_always = false; - pcmc->pci_root_uid = 1; + ppmc->pci_root_uid = 1; } DEFINE_I440FX_MACHINE(v5_1, "pc-i440fx-5.1", NULL, diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index c3b0467ef3..dc0bf85464 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -345,7 +345,9 @@ static void pc_q35_init(MachineState *machine) static void pc_q35_machine_options(MachineClass *m) { PCMachineClass *pcmc = PC_MACHINE_CLASS(m); - pcmc->pci_root_uid = 0; + PcPciMachineClass *ppmc = PC_PCI_MACHINE_CLASS(m); + + ppmc->pci_root_uid = 0; pcmc->default_cpu_version = 1; m->family = "pc_q35"; @@ -495,12 +497,13 @@ DEFINE_Q35_MACHINE(v5_2, "pc-q35-5.2", NULL, static void pc_q35_5_1_machine_options(MachineClass *m) { PCMachineClass *pcmc = PC_MACHINE_CLASS(m); + PcPciMachineClass *ppmc = PC_PCI_MACHINE_CLASS(m); pc_q35_5_2_machine_options(m); compat_props_add(m->compat_props, hw_compat_5_1, hw_compat_5_1_len); compat_props_add(m->compat_props, pc_compat_5_1, pc_compat_5_1_len); pcmc->kvmclock_create_always = false; - pcmc->pci_root_uid = 1; + ppmc->pci_root_uid = 1; } DEFINE_Q35_MACHINE(v5_1, "pc-q35-5.1", NULL, From patchwork Thu Mar 28 15:54:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13608878 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C57C9CD1284 for ; Thu, 28 Mar 2024 16:01:16 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps6I-0001uL-Lx; Thu, 28 Mar 2024 11:55:34 -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 1rps6E-0001dE-4H for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:55:31 -0400 Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps6C-00028G-K1 for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:55:29 -0400 Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-5688eaf1165so1560004a12.1 for ; Thu, 28 Mar 2024 08:55:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641327; x=1712246127; 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=6t/11DBdsC4+Se7Vaykag7BJymn7PIzchj3B9U9dVz4=; b=m1TOQnBCfg32QxJAem8LWUqmGFVed53ttCwNU1MG3lXrPgjFijU57C7dxp5AO24MPy OAxDYF0nFs9xDWYUwbcTYXNZF88NTPkqlO2K/7TV5N28NGHjxw9hZZ1BeA+3uQZ4HtKP KG9FdQEgXPJeJC4OH7wxjhGfVHSY6dPfoYeTX1zK/hYsYf3rguD5oQ84mFOFmgHdg6tF kWkHN/1cUFV8E4GgoOsQckBiZkn9QDyVzFr3aEyLRlmN351PeSNs9Zj4tl2OuhGPsPo+ t4nUfZoiaFLxMl1XAKKuvcWIO+1YZIqRexOUsrbeqPk5QonTnW5jKEf9MxcNzk5cAX9e vXvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641327; x=1712246127; 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=6t/11DBdsC4+Se7Vaykag7BJymn7PIzchj3B9U9dVz4=; b=HIlNYUjQ36I95g4jjqWbhAGIEumG/v1YqBVKgTOCR+FAj91laUL5KbCH5XlOe6drkv Dd1uylpjw6rDZOx1xKwN13txVlJo64bWXYk1JTN6bNICkRNi0rpLRMY+WCWQW1Gkq3r0 GtswEpu7y0tejGoXudjq4y7Vag4cUWA/CrLKqQPHr+dUBhiHNd3C54gVUHiXqsmH8p+K UMnMyymX1BqIy+6awMWD/Gu3yiM1Qk/ozO7ST2yVC6DZrBLnsIEtzquYCuHCNUg06Nqp aMJUfSc7tIxGen78CQDwtK/adEB+WWCCySId4YG21Kf1C9mzAzZwTa93tJLveEn/MCyz McWw== X-Gm-Message-State: AOJu0Yxa6OkD5KqDTdR/eUF0lZ61o1pLhLomz+gs6X75g2JxESDWH/Dm H6PsGV9795aiFWG/jyE82/nu+bamu5EI2MHN3grr9Tjh5xEIJtULfxD+kDkN1D4olViyyeMNQYB e X-Google-Smtp-Source: AGHT+IGa5cOf+IgzGIenKqeTpz5Pqe+oCRGklHarD29ZvICujPU9lddIF/mJjLz/l0UjTGpZalGbwQ== X-Received: by 2002:a50:9e64:0:b0:56b:900b:a2e with SMTP id z91-20020a509e64000000b0056b900b0a2emr2672032ede.32.1711641326922; Thu, 28 Mar 2024 08:55:26 -0700 (PDT) Received: from m1x-phil.lan (pas38-h02-176-184-5-52.dsl.sta.abo.bbox.fr. [176.184.5.52]) by smtp.gmail.com with ESMTPSA id k7-20020aa7c047000000b0056c443ce781sm968470edo.85.2024.03.28.08.55.25 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 28 Mar 2024 08:55:26 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eduardo Habkost , Stefano Stabellini , xen-devel@lists.xenproject.org, Bernhard Beschow , Thomas Huth , Marcel Apfelbaum , "Michael S. Tsirkin" , Paolo Bonzini , Igor Mammedov , Anthony Perard , Ani Sinha , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [RFC PATCH-for-9.1 07/29] hw/i386/pc: Call fw_cfg_add_extra_pci_roots() in pc_pci_machine_done() Date: Thu, 28 Mar 2024 16:54:15 +0100 Message-ID: <20240328155439.58719-8-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240328155439.58719-1-philmd@linaro.org> References: <20240328155439.58719-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::531; envelope-from=philmd@linaro.org; helo=mail-ed1-x531.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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org fw_cfg_add_extra_pci_roots() expects a PCI bus, which only PCI-based machines have. No need to call it on the ISA-only machine. Move it to the PCI-specific machine_done handler. Signed-off-by: Philippe Mathieu-Daudé --- hw/i386/pc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index a16bb1554c..f9226f7115 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -608,8 +608,6 @@ 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->pcibus, x86ms->fw_cfg); - acpi_setup(); if (x86ms->fw_cfg) { fw_cfg_build_smbios(pcms, x86ms->fw_cfg, pcms->smbios_entry_point_type); @@ -623,6 +621,12 @@ void pc_machine_done(Notifier *notifier, void *data) static void pc_pci_machine_done(Notifier *notifier, void *data) { + PcPciMachineState *ppms = container_of(notifier, + PcPciMachineState, machine_done); + PCMachineState *pcms = PC_MACHINE(ppms); + X86MachineState *x86ms = X86_MACHINE(pcms); + + fw_cfg_add_extra_pci_roots(pcms->pcibus, x86ms->fw_cfg); } /* setup pci memory address space mapping into system address space */ From patchwork Thu Mar 28 15:54:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13608879 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CFE3BCD11DD for ; Thu, 28 Mar 2024 16:02:17 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps6M-0002C7-LX; Thu, 28 Mar 2024 11:55:38 -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 1rps6L-00028N-6a for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:55:37 -0400 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps6J-0002D6-7B for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:55:36 -0400 Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-56c3260a714so1462276a12.3 for ; Thu, 28 Mar 2024 08:55:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641333; x=1712246133; 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=SSkLCR/UlhKFiQpvqkRVhG8wkTGDHk2a+aqlC/uZCjk=; b=YqXg9vfed/c7VsRnGQ29acL2L9LVHngDw91mev4dHUdKjvmWfvaksjXQwGHqXzQRje 3xx1PFbmJuj4cZftN4eE3D2+n5QgO1XNMkMyWZkSSsuo349/7Onq+HqqCWj0Dmy29GSy NzTCKR0wpWDQX3XNgfYTOBUZ9wAu5Ah2yWPbmHnkk2Luxh7vR+7+VIb164tOgA5qcbxF uTtfii3z7z/e/PcxqG8PFdCD0gj1oAX2G15FlPdYUPkaBYwVhkTauGx547CfsyVwADxJ LAsq27K1R61XpDKGPJ0pc1v324e916DKZB0BKRNBcxIaZcfV24ZcORmChDQN5NtVoU3b MAWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641333; x=1712246133; 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=SSkLCR/UlhKFiQpvqkRVhG8wkTGDHk2a+aqlC/uZCjk=; b=NC35pZtSizBPUo1V4SM9JB1cL++lqjHYO7UhKpmG0eaGYx8ytyI0I84/1UOAFamYpP yOQcPU2xtSyMYY4oKku35/b+2qOBahiBgz07qqJ/rbzG7gLGh49Fw2Bie+7qQj+fhonw bn/pn0ddMTpNMp3Y/PHdKUS7gBk23ntFdAq8qnb/YGNhmxoY8VISsYnwZ4hwu/jrjFcn f+FsqRkKUt0BfvHYdZb8TjdtXR4stZwdgMXYRIgRNnsaDmeO+0yBwwYoM+AmRAWnxHRg HRHVmC/tsMHvNL+vG6vrxiX2nb6fn6YZ1Vg1kec21uMe/JqM/YwSjfOR0ijIEgGf/QXr fU7Q== X-Gm-Message-State: AOJu0YzvAsFpw3yWNt4Gsfy9E0hlqXzgObGITRlQaau98lYsuLF7A6eV xZI1TvLxjyqO+D+m95Q0xRqjqg6OqfJGHo/BgJ8jDA54o0/26zJ7OmLMew+wTMak13uoC7l3/d8 6 X-Google-Smtp-Source: AGHT+IF/0mLdvRWo13tehO3NuCCV1getL+XsL801v0qQfgvFLMYq6AAaEiOV3hBAVWA55LBbGiFx8w== X-Received: by 2002:a17:906:ef05:b0:a4e:207e:b71 with SMTP id f5-20020a170906ef0500b00a4e207e0b71mr2083747ejs.6.1711641333084; Thu, 28 Mar 2024 08:55:33 -0700 (PDT) Received: from m1x-phil.lan (pas38-h02-176-184-5-52.dsl.sta.abo.bbox.fr. [176.184.5.52]) by smtp.gmail.com with ESMTPSA id bj9-20020a17090736c900b00a4e28cacbddsm393913ejc.57.2024.03.28.08.55.31 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 28 Mar 2024 08:55:32 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eduardo Habkost , Stefano Stabellini , xen-devel@lists.xenproject.org, Bernhard Beschow , Thomas Huth , Marcel Apfelbaum , "Michael S. Tsirkin" , Paolo Bonzini , Igor Mammedov , Anthony Perard , Ani Sinha , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [RFC PATCH-for-9.1 08/29] hw/i386/pc: Move CXLState to PcPciMachineState Date: Thu, 28 Mar 2024 16:54:16 +0100 Message-ID: <20240328155439.58719-9-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240328155439.58719-1-philmd@linaro.org> References: <20240328155439.58719-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52b; envelope-from=philmd@linaro.org; helo=mail-ed1-x52b.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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org CXL depends on PCIe, which isn't available on non-PCI machines such the ISA-only PC one. Move CXLState to PcPciMachineState, and move the CXL specific calls to pc_pci_machine_initfn() and pc_pci_machine_done(). Signed-off-by: Philippe Mathieu-Daudé Acked-by: Jonathan Cameron --- include/hw/i386/pc.h | 3 ++- hw/i386/acpi-build.c | 14 +++++++++++--- hw/i386/pc.c | 39 ++++++++++++++++++++------------------- 3 files changed, 33 insertions(+), 23 deletions(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 24c8e17e62..a97493d29d 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -54,13 +54,14 @@ typedef struct PCMachineState { hwaddr memhp_io_base; SGXEPCState sgx_epc; - CXLState cxl_devices_state; } PCMachineState; typedef struct PcPciMachineState { PCMachineState parent_obj; Notifier machine_done; + + CXLState cxl_devices_state; } PcPciMachineState; #define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device" diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index b9890886f6..6e8e32e5d2 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1554,6 +1554,11 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, crs_range_set_init(&crs_range_set); bus = PC_MACHINE(machine)->pcibus; if (bus) { + PcPciMachineState *ppms; + + assert(pc_machine_is_pci_enabled(pcms)); + ppms = PC_PCI_MACHINE(machine); + QLIST_FOREACH(bus, &bus->child, sibling) { uint8_t bus_num = pci_bus_num(bus); uint8_t numa_node = pci_bus_numa_node(bus); @@ -1607,7 +1612,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, /* Handle the ranges for the PXB expanders */ if (pci_bus_is_cxl(bus)) { - MemoryRegion *mr = &pcms->cxl_devices_state.host_mr; + MemoryRegion *mr = &ppms->cxl_devices_state.host_mr; uint64_t base = mr->addr; cxl_present = true; @@ -2513,6 +2518,8 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine) Object *vmgenid_dev; char *oem_id; char *oem_table_id; + bool pci_enabled = pc_machine_is_pci_enabled(pcms); + PcPciMachineState *ppms = pci_enabled ? PC_PCI_MACHINE(pcms) : NULL; acpi_get_pm_info(machine, &pm); acpi_get_misc_info(&misc); @@ -2640,9 +2647,10 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine) machine->nvdimms_state, machine->ram_slots, x86ms->oem_id, x86ms->oem_table_id); } - if (pcms->cxl_devices_state.is_enabled) { + if (ppms && ppms->cxl_devices_state.is_enabled) { cxl_build_cedt(table_offsets, tables_blob, tables->linker, - x86ms->oem_id, x86ms->oem_table_id, &pcms->cxl_devices_state); + x86ms->oem_id, x86ms->oem_table_id, + &ppms->cxl_devices_state); } acpi_add_table(table_offsets, tables_blob); diff --git a/hw/i386/pc.c b/hw/i386/pc.c index f9226f7115..6d87d1d4c2 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -598,13 +598,6 @@ void pc_machine_done(Notifier *notifier, void *data) PCMachineState, machine_done); X86MachineState *x86ms = X86_MACHINE(pcms); - cxl_hook_up_pxb_registers(pcms->pcibus, &pcms->cxl_devices_state, - &error_fatal); - - if (pcms->cxl_devices_state.is_enabled) { - cxl_fmws_link_targets(&pcms->cxl_devices_state, &error_fatal); - } - /* set the number of CPUs */ x86_rtc_set_cpus_count(x86ms->rtc, x86ms->boot_cpus); @@ -626,6 +619,13 @@ static void pc_pci_machine_done(Notifier *notifier, void *data) PCMachineState *pcms = PC_MACHINE(ppms); X86MachineState *x86ms = X86_MACHINE(pcms); + cxl_hook_up_pxb_registers(pcms->pcibus, &ppms->cxl_devices_state, + &error_fatal); + + if (ppms->cxl_devices_state.is_enabled) { + cxl_fmws_link_targets(&ppms->cxl_devices_state, &error_fatal); + } + fw_cfg_add_extra_pci_roots(pcms->pcibus, x86ms->fw_cfg); } @@ -719,13 +719,14 @@ static uint64_t pc_get_cxl_range_start(PCMachineState *pcms) static uint64_t pc_get_cxl_range_end(PCMachineState *pcms) { + PcPciMachineState *ppms = PC_PCI_MACHINE(pcms); uint64_t start = pc_get_cxl_range_start(pcms) + MiB; - if (pcms->cxl_devices_state.fixed_windows) { + if (ppms->cxl_devices_state.fixed_windows) { GList *it; start = ROUND_UP(start, 256 * MiB); - for (it = pcms->cxl_devices_state.fixed_windows; it; it = it->next) { + for (it = ppms->cxl_devices_state.fixed_windows; it; it = it->next) { CXLFixedWindow *fw = it->data; start += fw->size; } @@ -823,6 +824,7 @@ void pc_memory_init(PCMachineState *pcms, hwaddr cxl_base, cxl_resv_end = 0; X86CPU *cpu = X86_CPU(first_cpu); bool pci_enabled = pc_machine_is_pci_enabled(pcms); + PcPciMachineState *ppms = pci_enabled ? PC_PCI_MACHINE(pcms) : NULL; assert(machine->ram_size == x86ms->below_4g_mem_size + x86ms->above_4g_mem_size); @@ -926,20 +928,20 @@ void pc_memory_init(PCMachineState *pcms, machine_memory_devices_init(machine, device_mem_base, device_mem_size); } - if (pcms->cxl_devices_state.is_enabled) { - MemoryRegion *mr = &pcms->cxl_devices_state.host_mr; + if (ppms && ppms->cxl_devices_state.is_enabled) { + MemoryRegion *mr = &ppms->cxl_devices_state.host_mr; hwaddr cxl_size = MiB; cxl_base = pc_get_cxl_range_start(pcms); memory_region_init(mr, OBJECT(machine), "cxl_host_reg", cxl_size); memory_region_add_subregion(system_memory, cxl_base, mr); cxl_resv_end = cxl_base + cxl_size; - if (pcms->cxl_devices_state.fixed_windows) { + if (ppms->cxl_devices_state.fixed_windows) { hwaddr cxl_fmw_base; GList *it; cxl_fmw_base = ROUND_UP(cxl_base + cxl_size, 256 * MiB); - for (it = pcms->cxl_devices_state.fixed_windows; it; it = it->next) { + for (it = ppms->cxl_devices_state.fixed_windows; it; it = it->next) { CXLFixedWindow *fw = it->data; fw->base = cxl_fmw_base; @@ -979,7 +981,7 @@ void pc_memory_init(PCMachineState *pcms, res_mem_end += memory_region_size(&machine->device_memory->mr); } - if (pcms->cxl_devices_state.is_enabled) { + if (ppms->cxl_devices_state.is_enabled) { res_mem_end = cxl_resv_end; } *val = cpu_to_le64(ROUND_UP(res_mem_end, 1 * GiB)); @@ -1010,11 +1012,12 @@ uint64_t pc_pci_hole64_start(void) { PCMachineState *pcms = PC_MACHINE(qdev_get_machine()); PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms); + PcPciMachineState *ppms = PC_PCI_MACHINE(pcms); MachineState *ms = MACHINE(pcms); uint64_t hole64_start = 0; ram_addr_t size = 0; - if (pcms->cxl_devices_state.is_enabled) { + if (ppms->cxl_devices_state.is_enabled) { hole64_start = pc_get_cxl_range_end(pcms); } else if (pcmc->has_reserved_memory && (ms->ram_size < ms->maxram_size)) { pc_get_device_memory_range(pcms, &hole64_start, &size); @@ -1651,7 +1654,6 @@ static void pc_machine_initfn(Object *obj) { PCMachineState *pcms = PC_MACHINE(obj); PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms); - bool pci_enabled = pc_machine_is_pci_enabled(pcms); #ifdef CONFIG_VMPORT pcms->vmport = ON_OFF_AUTO_AUTO; @@ -1678,9 +1680,6 @@ static void pc_machine_initfn(Object *obj) pcms->pcspk = isa_new(TYPE_PC_SPEAKER); object_property_add_alias(OBJECT(pcms), "pcspk-audiodev", OBJECT(pcms->pcspk), "audiodev"); - if (pci_enabled) { - cxl_machine_init(obj, &pcms->cxl_devices_state); - } pcms->machine_done.notify = pc_machine_done; qemu_add_machine_init_done_notifier(&pcms->machine_done); @@ -1690,6 +1689,8 @@ static void pc_pci_machine_initfn(Object *obj) { PcPciMachineState *ppms = PC_PCI_MACHINE(obj); + cxl_machine_init(obj, &ppms->cxl_devices_state); + ppms->machine_done.notify = pc_pci_machine_done; qemu_add_machine_init_done_notifier(&ppms->machine_done); } From patchwork Thu Mar 28 15:54:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13608817 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 44EFECD11DD for ; Thu, 28 Mar 2024 15:56:48 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps6R-0002Xx-Fc; Thu, 28 Mar 2024 11:55: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 1rps6Q-0002RP-I3 for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:55: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 1rps6O-0002GM-VP for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:55:42 -0400 Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-56845954ffeso1750088a12.2 for ; Thu, 28 Mar 2024 08:55:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641339; x=1712246139; 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=ckSqN94Ak/AVFv4C8DP1wel6lx7UDcBC5ZVn+IWQ+zI=; b=qUWjQLo8W+8Iepc3M0ub/a013BFffUS/zAYZt/PbK1FR3GskA+3/XlDJEa2Ahy1J16 2KchJ4Bug1C/uS/J2dIXrnmm0um6EzmMtU32hJpGsXezEWVDP4JioyMTsN+Quceqt27E A0IlTGfIAGsBMu/u+Rq2hQxYk5vhEeTUcmM+gSFJ47FnZThZAkHh7TQbwIwKqS52Z87l KEJm5jo7eX0kloZPs9QU5Y39+ZUBfz/D11pk2G7y9zzkx+8quq4F8F3MuRqpDZSmWOZ8 KWp6bMvnOyUvsFBAYN7YAazF02CwDFGevdwY3vjcvu8nj2gHtTq2lYhPcUuAmVNN+bje nTVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641339; x=1712246139; 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=ckSqN94Ak/AVFv4C8DP1wel6lx7UDcBC5ZVn+IWQ+zI=; b=VQnwhSiazY66jk2ccAAndoVg55fkmKM7UIAfNjkAVFXx9i0yMj3SiQ6h100VDBX23W L9BnhGqmHRjthPXk+lDcP/QYUbINtwkqk+AKzD7e1uDrDxOuDtfm0YzmmF/p9uvFCj9V 4BtZdGNd7NltuhB/RxjaM/picDgiYUKWY9XtgISYXyeIpscPiQlRCqUVmFLKQKWLAQae iCVz73uBGlhkW1LSCju436FzYwFrcWwcroigZxQ+28rfIFcPUD+hhQN1J9K7rXaIVwaN 0Gps2lp2F+X6+vhXRfFicC7481LbTuLZq4L9FjgiNAi9zgFdaIhkrcreMrkJ7W+TxpMx x7Nw== X-Gm-Message-State: AOJu0YzXJ7uTfb9ExHbFCH8d77Om1bGvjn3+4Dlgfh2lZTVpTqaZACrK E9+7T9HsjVeJmOdLaxmsVUFV+qIYqKfxtFkohT8kOqTZ0Db83kzdpVdear/nkRkkVMzcaEOa4VF s X-Google-Smtp-Source: AGHT+IGwP6p/08zu3mCMRpeAkzfHcigXM/JR3t5dmiNwQCcEIbh+pOnBScYA897DxMkDTYP+GJc42Q== X-Received: by 2002:a17:906:494f:b0:a47:4fed:514a with SMTP id f15-20020a170906494f00b00a474fed514amr1839620ejt.52.1711641339277; Thu, 28 Mar 2024 08:55:39 -0700 (PDT) Received: from m1x-phil.lan (pas38-h02-176-184-5-52.dsl.sta.abo.bbox.fr. [176.184.5.52]) by smtp.gmail.com with ESMTPSA id j15-20020a170906254f00b00a473362062fsm894249ejb.220.2024.03.28.08.55.37 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 28 Mar 2024 08:55:38 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eduardo Habkost , Stefano Stabellini , xen-devel@lists.xenproject.org, Bernhard Beschow , Thomas Huth , Marcel Apfelbaum , "Michael S. Tsirkin" , Paolo Bonzini , Igor Mammedov , Anthony Perard , Ani Sinha , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [RFC PATCH-for-9.1 09/29] hw/i386/pc: Pass PCMachineState argument to acpi_setup() Date: Thu, 28 Mar 2024 16:54:17 +0100 Message-ID: <20240328155439.58719-10-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240328155439.58719-1-philmd@linaro.org> References: <20240328155439.58719-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52e; envelope-from=philmd@linaro.org; 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, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org acpi_setup() caller knows about the machine state, so pass it as argument to avoid a qdev_get_machine() call. We already resolved X86_MACHINE(pcms) as 'x86ms' so use the latter. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Bernhard Beschow --- hw/i386/acpi-build.h | 3 ++- hw/i386/acpi-build.c | 5 ++--- hw/i386/pc.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/i386/acpi-build.h b/hw/i386/acpi-build.h index 0dce155c8c..31de5bddbd 100644 --- a/hw/i386/acpi-build.h +++ b/hw/i386/acpi-build.h @@ -2,6 +2,7 @@ #ifndef HW_I386_ACPI_BUILD_H #define HW_I386_ACPI_BUILD_H #include "hw/acpi/acpi-defs.h" +#include "hw/i386/pc.h" extern const struct AcpiGenericAddress x86_nvdimm_acpi_dsmio; @@ -9,7 +10,7 @@ extern const struct AcpiGenericAddress x86_nvdimm_acpi_dsmio; #define ACPI_PCIHP_SEJ_BASE 0x8 #define ACPI_PCIHP_BNMR_BASE 0x10 -void acpi_setup(void); +void acpi_setup(PCMachineState *pcms); Object *acpi_get_i386_pci_host(void); #endif diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 6e8e32e5d2..e702d5e9d2 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -2749,9 +2749,8 @@ static const VMStateDescription vmstate_acpi_build = { }, }; -void acpi_setup(void) +void acpi_setup(PCMachineState *pcms) { - PCMachineState *pcms = PC_MACHINE(qdev_get_machine()); X86MachineState *x86ms = X86_MACHINE(pcms); AcpiBuildTables tables; AcpiBuildState *build_state; @@ -2771,7 +2770,7 @@ void acpi_setup(void) return; } - if (!x86_machine_is_acpi_enabled(X86_MACHINE(pcms))) { + if (!x86_machine_is_acpi_enabled(x86ms)) { ACPI_BUILD_DPRINTF("ACPI disabled. Bailing out.\n"); return; } diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 6d87d1d4c2..dfc0247bb6 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -601,7 +601,7 @@ void pc_machine_done(Notifier *notifier, void *data) /* set the number of CPUs */ x86_rtc_set_cpus_count(x86ms->rtc, x86ms->boot_cpus); - acpi_setup(); + acpi_setup(pcms); if (x86ms->fw_cfg) { fw_cfg_build_smbios(pcms, x86ms->fw_cfg, pcms->smbios_entry_point_type); fw_cfg_build_feature_control(MACHINE(pcms), x86ms->fw_cfg); From patchwork Thu Mar 28 15:54:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13608816 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A459DCD1283 for ; Thu, 28 Mar 2024 15:56:22 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps6Y-0002yP-Cl; Thu, 28 Mar 2024 11:55: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 1rps6W-0002wX-RF for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:55:48 -0400 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps6V-0002H1-8I for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:55:48 -0400 Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-56c2b4850d2so1407111a12.2 for ; Thu, 28 Mar 2024 08:55:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641345; x=1712246145; 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=HtUfcj3aTDn2mvaMR/QsDVngwC1CAz/OBQXAMI7WNPQ=; b=FRsHW38GuPBKsFou3iXDlS5O3B5KwEUBWDQYdStUG6bXGjWeFjzBwpaPSyrJ7p6TLE SLywyxjdnH/nBL1ii00peLLRjQLBljD1F/+cf/+GjZp3QsVtM5Wpe1MvnXUSVfrBxsSr kIaMSsNXBnuV3O0Ay1nER6CEecDHcn/IEtNTIknLlBVJ4C8b/ZvYKeM6RMSevtOe0Umz qJ9iqqmwUoKbBkuSHAEOKAkjvdLZxNrS9dRfo01BMYisxQcuVCYaPD/HTDoQGcrKtp0I qTuZpfBvzeqbWev8BMZCI+aJ16LpDFLndOBCr65I1AflXpNQ8awlcAxEGx39ihUC7w15 kcuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641345; x=1712246145; 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=HtUfcj3aTDn2mvaMR/QsDVngwC1CAz/OBQXAMI7WNPQ=; b=poE5GnXyJWP4gtDZVc6ohAo8hmOYMxWMQW7TjOeRWLnfWnd2PDUyzWtofLB6pDDHME 6siD3WkHBLsoEQF3FZfAwLqFjtwGajnb4UTb1MROKykh5KdOzv6OcWuMn9arN2Vs64ep M9VZ7RliOEJHQA7/RLIsRlXVo3bYrL4UW+eGDcwUnquNAaf7rCNFrl8gDorYGwKaTy/L mm+P8wD1meAFzryAndC8EQyyRSzSo7RoFP934hDymEBkSOM4CbN310xiQO8YSUvJWI4Q if9e2C8m0qpb3/aLI9Kka9X/y2yrohDYCA6lRs+DkWmTv9QYqkVn4HfiyJP3ATOt8mKJ bjyw== X-Gm-Message-State: AOJu0YwkufLJkq5ht31T6MgcxloZHMJaA59v5zYuovMbhcR9+GqOKd6Y VewONXSoGXJcFDIrG7yGXTRoOiQyzUfOleKQiF7s69A6VesajCP2ZQlsxRblRSCerryaz1txroH l X-Google-Smtp-Source: AGHT+IE4H2j7DvpBr0ZgGTO3mYeCN1DwhGLVSa7xknb/dNXvpG290SVF6AQSzPcOp/lNCIhUZoP8Cw== X-Received: by 2002:a17:906:4697:b0:a4e:ebd:254a with SMTP id a23-20020a170906469700b00a4e0ebd254amr2129554ejr.9.1711641345640; Thu, 28 Mar 2024 08:55:45 -0700 (PDT) Received: from m1x-phil.lan (pas38-h02-176-184-5-52.dsl.sta.abo.bbox.fr. [176.184.5.52]) by smtp.gmail.com with ESMTPSA id r18-20020a170906c29200b00a4e2a1146f8sm298044ejz.48.2024.03.28.08.55.43 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 28 Mar 2024 08:55:45 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eduardo Habkost , Stefano Stabellini , xen-devel@lists.xenproject.org, Bernhard Beschow , Thomas Huth , Marcel Apfelbaum , "Michael S. Tsirkin" , Paolo Bonzini , Igor Mammedov , Anthony Perard , Ani Sinha , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [RFC PATCH-for-9.1 10/29] hw/i386/pc: Remove PCMachineClass::has_acpi_build field Date: Thu, 28 Mar 2024 16:54:18 +0100 Message-ID: <20240328155439.58719-11-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240328155439.58719-1-philmd@linaro.org> References: <20240328155439.58719-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::536; envelope-from=philmd@linaro.org; helo=mail-ed1-x536.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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org PCMachineClass::has_acpi_build is always %true for PCI based machines. Remove it, setting the 'acpi_build_enabled' field once in pc_pci_machine_initfn(). Signed-off-by: Philippe Mathieu-Daudé --- include/hw/i386/pc.h | 3 --- hw/i386/pc.c | 6 +++--- hw/i386/pc_piix.c | 1 - 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index a97493d29d..dd5ee448ef 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -95,9 +95,6 @@ typedef struct PCMachineClass { /* Default CPU model version. See x86_cpu_set_default_version(). */ int default_cpu_version; - /* ACPI compat: */ - bool has_acpi_build; - /* SMBIOS compat: */ bool smbios_defaults; bool smbios_legacy_mode; diff --git a/hw/i386/pc.c b/hw/i386/pc.c index dfc0247bb6..f0dc04e2fc 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1664,8 +1664,6 @@ static void pc_machine_initfn(Object *obj) pcms->smbios_entry_point_type = pcmc->default_smbios_ep_type; pcms->south_bridge = pcmc->default_south_bridge; - /* acpi build is enabled by default if machine supports it */ - pcms->acpi_build_enabled = pcmc->has_acpi_build; pcms->smbus_enabled = true; pcms->sata_enabled = true; pcms->i8042_enabled = true; @@ -1688,6 +1686,9 @@ static void pc_machine_initfn(Object *obj) static void pc_pci_machine_initfn(Object *obj) { PcPciMachineState *ppms = PC_PCI_MACHINE(obj); + PCMachineState *pcms = PC_MACHINE(obj); + + pcms->acpi_build_enabled = true; cxl_machine_init(obj, &ppms->cxl_devices_state); @@ -1745,7 +1746,6 @@ static void pc_machine_class_init(ObjectClass *oc, void *data) PCMachineClass *pcmc = PC_MACHINE_CLASS(oc); HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc); - pcmc->has_acpi_build = true; pcmc->smbios_defaults = true; pcmc->gigabyte_align = true; pcmc->has_reserved_memory = true; diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index c42dd46e59..7aa2598e10 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -816,7 +816,6 @@ static void isapc_machine_options(MachineClass *m) m->max_cpus = 1; m->option_rom_has_mr = true; m->rom_file_has_mr = false; - pcmc->has_acpi_build = false; pcmc->smbios_defaults = false; pcmc->gigabyte_align = false; pcmc->smbios_legacy_mode = true; From patchwork Thu Mar 28 15:54:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13608867 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D4B67CD128D for ; Thu, 28 Mar 2024 15:59:11 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps6e-0002zs-BF; Thu, 28 Mar 2024 11:55:56 -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 1rps6d-0002zH-Bk for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:55:55 -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 1rps6b-0002HX-RJ for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:55:55 -0400 Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-568c714a9c7so1312492a12.2 for ; Thu, 28 Mar 2024 08:55:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641352; x=1712246152; 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=ZJ3NIU3pO9930vwNFx0mYgma5e7GvztHkS/rmyU15RU=; b=g5kDrfi6D4PPgQey6KAAPOIxbj5tQTxWmFhyio+RChkZVTxMAynTp7lD7FmmobGKyy GbnE5kxDWImzGZgXLNZeBTxIB/PPbGCingoGu8kja3p0GomhcnNzRDqcrnn7baH1q8jr otCzfjr6l5XmXzF//SzKFpZ/cLEoBrxFzZnHYdqEZNmm2uqCssIXyVR/gzrHOHa0Zg1w apzn/XvnzPqRejoFPbPG6bOQf7WcYOqq0oLASzWFSXDg9smnNCNPExL2qK0qz2ztLHzd Q7dknxJZO0Sslcy1uTACB1ufqgBnCWOEK4lK0d0TVRwmDTY2X878gqN2cXRrfjP940FC krLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641352; x=1712246152; 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=ZJ3NIU3pO9930vwNFx0mYgma5e7GvztHkS/rmyU15RU=; b=OdSevUxWIpjBIkxJxfxIEBx+sXrhP1Sn1Bs9uOa3ei3OL+5Gm40GRFxLdh+bHvDHvF 1GkLO6lHPKjXrewQj1T/XnbyD1joivzGYUvZphsP9Vc2hjJpIqm03ecFynAlff4OY4EI Hg8UAX492j8rYODZR70TSYxrN8mSw66ac1wgWgE6Jc73Gzd3O9Wi8LdKVmSVGGYR04u+ AmX8ZNyf7Kz2Uz6IYllHvR4L8gWnDcuj1k36g1eLx3U6UCV0UWyWfhLhDBzcRNez2Sri PdbenzNPtEwy/qXQn0OurnS3Qn9oZgdhjoEGtdzN0RE5O+JdURAZ1XptCA0sWtFMVfAS 0XKg== X-Gm-Message-State: AOJu0YzJRL02/n+JdwlDGnBzmdyUakz4+sByJYUuBm/iuKOOzIVxlel/ T2yNwgqVssAEcgpU2LYkm2WnkWwtBvjO6ap7HeSFamECNtPEpYksiotCnZYmmwWdX/JKDfpoA9Q B X-Google-Smtp-Source: AGHT+IH3/f3B+fppMfqmjp05mNuhqqUlRQgmruUJACUpH3wuIu7IVWjtNOwP7TTyrIw4MimWKbfy0Q== X-Received: by 2002:a50:d6d8:0:b0:568:ae7:bc0 with SMTP id l24-20020a50d6d8000000b005680ae70bc0mr2301236edj.34.1711641351948; Thu, 28 Mar 2024 08:55:51 -0700 (PDT) Received: from m1x-phil.lan (pas38-h02-176-184-5-52.dsl.sta.abo.bbox.fr. [176.184.5.52]) by smtp.gmail.com with ESMTPSA id u23-20020aa7d897000000b0056ba017ca7fsm953482edq.87.2024.03.28.08.55.50 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 28 Mar 2024 08:55:51 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eduardo Habkost , Stefano Stabellini , xen-devel@lists.xenproject.org, Bernhard Beschow , Thomas Huth , Marcel Apfelbaum , "Michael S. Tsirkin" , Paolo Bonzini , Igor Mammedov , Anthony Perard , Ani Sinha , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [RFC PATCH-for-9.1 11/29] hw/i386/pc: Move acpi_setup() call to pc_pci_machine_done() Date: Thu, 28 Mar 2024 16:54:19 +0100 Message-ID: <20240328155439.58719-12-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240328155439.58719-1-philmd@linaro.org> References: <20240328155439.58719-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::529; envelope-from=philmd@linaro.org; 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, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org acpi_setup() returns early if acpi_build_enabled is not set: 2752 void acpi_setup(PCMachineState *pcms) 2753 { ... 2768 if (!pcms->acpi_build_enabled) { 2769 ACPI_BUILD_DPRINTF("ACPI build disabled. Bailing out.\n"); 2770 return; 2771 } acpi_build_enabled is only set on PCI-based machines, so it is pointless to call acpi_setup() from non-PCI like the ISA-only machine, move the call to pc_pci_machine_done(). Signed-off-by: Philippe Mathieu-Daudé --- hw/i386/pc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index f0dc04e2fc..47fe3a7c02 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -601,7 +601,6 @@ void pc_machine_done(Notifier *notifier, void *data) /* set the number of CPUs */ x86_rtc_set_cpus_count(x86ms->rtc, x86ms->boot_cpus); - acpi_setup(pcms); if (x86ms->fw_cfg) { fw_cfg_build_smbios(pcms, x86ms->fw_cfg, pcms->smbios_entry_point_type); fw_cfg_build_feature_control(MACHINE(pcms), x86ms->fw_cfg); @@ -627,6 +626,8 @@ static void pc_pci_machine_done(Notifier *notifier, void *data) } fw_cfg_add_extra_pci_roots(pcms->pcibus, x86ms->fw_cfg); + + acpi_setup(pcms); } /* setup pci memory address space mapping into system address space */ From patchwork Thu Mar 28 15:54:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13608874 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6E400CD11DD for ; Thu, 28 Mar 2024 16:01:02 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps6m-0003c1-Rc; Thu, 28 Mar 2024 11:56:04 -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 1rps6k-0003K1-4S for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:56:02 -0400 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps6i-0002IU-9C for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:56:01 -0400 Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-566e869f631so1282122a12.0 for ; Thu, 28 Mar 2024 08:55:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641358; x=1712246158; 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=jlOZmiJcfWhY/E5lc2Om2vdspo8I2MenAyugtnCqPJ8=; b=f21uSOyCySSMOqPB44Usm/FXaQQGWzlQgVB1SPVdp5pwWlRj5e+0ehCrabNYUgcQ6Q bfXglLE1eZrwidEBkvwC3x0Bo/wevvxz8BYjaHRuvd4Z/5LL0Dkw5VyFHbqfVDwRDojQ Fy4bYKwlwQXLP9nntSXMAsjBYt5FOcWhzgeRbZoC309Bcf/oQgnBwOuZ22h5y5EzhXiH vwWKox+bmLobJHNqTMhEnFztGc3Uu/IKRE7NZ17cftXZn21dyfcPhMbiJ6YhlY4Id8nV h5tw4V/ZR/nXVKk+0KYuZ8haP/OxUBTO/QcK62DPpmOutKriFdfXEt6JAmhn47934ZGm r2Iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641358; x=1712246158; 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=jlOZmiJcfWhY/E5lc2Om2vdspo8I2MenAyugtnCqPJ8=; b=XtTRM9E8GHvSrG2yGlKo9Df6QA0yyx6BfQxKSNe2WYWkXeeveRYj4UXAIOS+JRD4xJ h7bZpsPOS7U76CXMnl4ihjvrExk6KBKPS3EyylWOjnyh3FGDG2v7dsFILXY8r2A4/qMG u8YmBuGikkRwVKCdHmjNcLp4qNkCxC+qWQBSZ8AjB1N1L5rL2p+GbotXVQIdBkZAhb7x FQqDtQ5iEKuWGY27I47D/H8IAaEL2EhwD/SrWdEMxRMGllSI7bGNrqrXyRibhjrpuYIK w91/eHe/cBLjUVH/vHmH5ORDAEw4zppn8HcSI5fZlfr1mNtoLzTtKT6SfBLb/NYLZXn9 0HiA== X-Gm-Message-State: AOJu0Yy8s6ucyMIUhGVzHe8X55GY9SygVkyyNF6XjcvVqqqEAdoQCtCg 3UE0kr8jToM+UfG0KEnfwGSsiNvqjMJB+BcWiDgN4yjw9JuTEQtkzbUuFJfo05cbQxaJhDmm+OM + X-Google-Smtp-Source: AGHT+IEHlPzirbO0NxvTAiaCR1AzHmEf11L/n2EPgKkmIcgFqhAD5O/Yt/mmGevQB4ExiPCyjyrkcg== X-Received: by 2002:a50:d650:0:b0:56b:cda3:6de6 with SMTP id c16-20020a50d650000000b0056bcda36de6mr2166952edj.42.1711641358386; Thu, 28 Mar 2024 08:55:58 -0700 (PDT) Received: from m1x-phil.lan (pas38-h02-176-184-5-52.dsl.sta.abo.bbox.fr. [176.184.5.52]) by smtp.gmail.com with ESMTPSA id g20-20020aa7c594000000b0056be0d1cd83sm954932edq.97.2024.03.28.08.55.56 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 28 Mar 2024 08:55:57 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eduardo Habkost , Stefano Stabellini , xen-devel@lists.xenproject.org, Bernhard Beschow , Thomas Huth , Marcel Apfelbaum , "Michael S. Tsirkin" , Paolo Bonzini , Igor Mammedov , Anthony Perard , Ani Sinha , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Paul Durrant Subject: [RFC PATCH-for-9.1 12/29] hw/i386/pc: Move acpi_build_enabled to PcPciMachineState Date: Thu, 28 Mar 2024 16:54:20 +0100 Message-ID: <20240328155439.58719-13-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240328155439.58719-1-philmd@linaro.org> References: <20240328155439.58719-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::535; envelope-from=philmd@linaro.org; helo=mail-ed1-x535.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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Since only PCI-based machines use the 'acpi_build_enabled', move it to PcPciMachineState. Signed-off-by: Philippe Mathieu-Daudé --- hw/i386/acpi-build.h | 2 +- include/hw/i386/pc.h | 3 ++- hw/i386/acpi-build.c | 8 ++++---- hw/i386/pc.c | 5 ++--- hw/i386/xen/xen-hvm.c | 3 ++- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/hw/i386/acpi-build.h b/hw/i386/acpi-build.h index 31de5bddbd..4c1511c432 100644 --- a/hw/i386/acpi-build.h +++ b/hw/i386/acpi-build.h @@ -10,7 +10,7 @@ extern const struct AcpiGenericAddress x86_nvdimm_acpi_dsmio; #define ACPI_PCIHP_SEJ_BASE 0x8 #define ACPI_PCIHP_BNMR_BASE 0x10 -void acpi_setup(PCMachineState *pcms); +void acpi_setup(PcPciMachineState *ppms); Object *acpi_get_i386_pci_host(void); #endif diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index dd5ee448ef..67f8f4730b 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -41,7 +41,6 @@ typedef struct PCMachineState { SmbiosEntryPointType smbios_entry_point_type; const char *south_bridge; - bool acpi_build_enabled; bool smbus_enabled; bool sata_enabled; bool hpet_enabled; @@ -61,6 +60,8 @@ typedef struct PcPciMachineState { Notifier machine_done; + bool acpi_build_enabled; + CXLState cxl_devices_state; } PcPciMachineState; diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index e702d5e9d2..ee0e99a2fa 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -2749,9 +2749,9 @@ static const VMStateDescription vmstate_acpi_build = { }, }; -void acpi_setup(PCMachineState *pcms) +void acpi_setup(PcPciMachineState *ppms) { - X86MachineState *x86ms = X86_MACHINE(pcms); + X86MachineState *x86ms = X86_MACHINE(ppms); AcpiBuildTables tables; AcpiBuildState *build_state; Object *vmgenid_dev; @@ -2765,7 +2765,7 @@ void acpi_setup(PCMachineState *pcms) return; } - if (!pcms->acpi_build_enabled) { + if (!ppms->acpi_build_enabled) { ACPI_BUILD_DPRINTF("ACPI build disabled. Bailing out.\n"); return; } @@ -2778,7 +2778,7 @@ void acpi_setup(PCMachineState *pcms) build_state = g_malloc0(sizeof *build_state); acpi_build_tables_init(&tables); - acpi_build(&tables, MACHINE(pcms)); + acpi_build(&tables, MACHINE(ppms)); /* Now expose it all to Guest */ build_state->table_mr = acpi_add_rom_blob(acpi_build_update, diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 47fe3a7c02..f184808e3e 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -627,7 +627,7 @@ static void pc_pci_machine_done(Notifier *notifier, void *data) fw_cfg_add_extra_pci_roots(pcms->pcibus, x86ms->fw_cfg); - acpi_setup(pcms); + acpi_setup(ppms); } /* setup pci memory address space mapping into system address space */ @@ -1687,9 +1687,8 @@ static void pc_machine_initfn(Object *obj) static void pc_pci_machine_initfn(Object *obj) { PcPciMachineState *ppms = PC_PCI_MACHINE(obj); - PCMachineState *pcms = PC_MACHINE(obj); - pcms->acpi_build_enabled = true; + ppms->acpi_build_enabled = true; cxl_machine_init(obj, &ppms->cxl_devices_state); diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c index 7745cb3963..ce48d51842 100644 --- a/hw/i386/xen/xen-hvm.c +++ b/hw/i386/xen/xen-hvm.c @@ -586,6 +586,7 @@ static void xen_wakeup_notifier(Notifier *notifier, void *data) void xen_hvm_init_pc(PCMachineState *pcms, MemoryRegion **ram_memory) { MachineState *ms = MACHINE(pcms); + PcPciMachineState *ppms = PC_PCI_MACHINE(pcms); unsigned int max_cpus = ms->smp.max_cpus; int rc; xen_pfn_t ioreq_pfn; @@ -624,7 +625,7 @@ void xen_hvm_init_pc(PCMachineState *pcms, MemoryRegion **ram_memory) xen_ram_init(pcms, ms->ram_size, ram_memory); /* Disable ACPI build because Xen handles it */ - pcms->acpi_build_enabled = false; + ppms->acpi_build_enabled = false; return; From patchwork Thu Mar 28 15:54:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13608861 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4A2EFCD1283 for ; Thu, 28 Mar 2024 15:57:26 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps78-00045l-Tk; Thu, 28 Mar 2024 11:56:30 -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 1rps6q-0003lr-G3 for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:56:09 -0400 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps6o-0002J6-BG for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:56:07 -0400 Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-56c0bd07e7bso1371670a12.1 for ; Thu, 28 Mar 2024 08:56:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641364; x=1712246164; 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=fL5eL7xorZDz2tK167vrCTC41p6AHRY9fWJiDBIL8BM=; b=U5IWLHRodA+EjotpgdrESsIE43e6MyT3vhIRFYmFCm3+T04ngqC6DvFeGDxq8f++Ht Dyx6nCBUjVIdlXFCK5hg53+6LSKaaGar4XB//kbVuB1njIXpCviF0hUlMLWFSw77SS9V AAaTNJAiyuAdDVxaGE9KeZ4XLCL/WrUMpbKHX49gw8wdirSJs59oxw6xY3YhJdUiMNpu UgwgUM+PXGQq/ov+lMk6wAaZ3Yo9RuSkZoKOzGYaN+S3ApiOW1Gr2AXUjASLhGx16hf4 DmoR8cUE3xOWfYyli6KC5XXwxt9Ns5Juj1R9gAdKQ3m+X3ODbSHki24BqpYKTGyA/OqC 37ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641364; x=1712246164; 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=fL5eL7xorZDz2tK167vrCTC41p6AHRY9fWJiDBIL8BM=; b=YTxY8OyI+XiLRDgSG8YvOG4ExJwpWJX+89YQwU4yC/LEFK0r1vVijtARIzvkzQEqFU /kpxZK0vSVB75DmYzMYpJU/McC7N6MZvJnqFmpheMgyxtXHEuBGBCIPPFMMYCE4HALy1 vq90cxBT+54efPrMP27/q2+H+LVipNM2kstCEazaUOizfMBgVO0C6Jklo3Ogubjk8bQR S+Zi6OAhwVZRrd10BBZ+xvEmiUYLGr4NzKtgnpvfcQGB7xJ0tp0dC4LjlMAdaClXfZNB In7ntaDTsMgSQQwFPDrIFocyoNq2GU4r0mEerNH7OY9uEi7zsn0qSREx2S2Kj916t2tU f6yA== X-Gm-Message-State: AOJu0YyioFVxYRqM51Y8O4Nbei8KyRCKadP45ZeGrQZoveSdirW1Vg2z TaoaOhP9fB+PmDj46x3Ur83ejIunoHAzwVFTM3Ze6xUs2t+ysEvFYqCAw/nrZlBV5WQfU3hIBKd 7 X-Google-Smtp-Source: AGHT+IGYMyA4RPPygj+1esA4Svl7bwqA35pfEh79go4U6GODzZLQBPhA8oiV4mBtfx3NK33wxcn4Rg== X-Received: by 2002:a50:d7d5:0:b0:56c:24e6:ca7e with SMTP id m21-20020a50d7d5000000b0056c24e6ca7emr2463412edj.2.1711641364572; Thu, 28 Mar 2024 08:56:04 -0700 (PDT) Received: from m1x-phil.lan (pas38-h02-176-184-5-52.dsl.sta.abo.bbox.fr. [176.184.5.52]) by smtp.gmail.com with ESMTPSA id ev6-20020a056402540600b005682a0e915fsm970201edb.76.2024.03.28.08.56.02 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 28 Mar 2024 08:56:04 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eduardo Habkost , Stefano Stabellini , xen-devel@lists.xenproject.org, Bernhard Beschow , Thomas Huth , Marcel Apfelbaum , "Michael S. Tsirkin" , Paolo Bonzini , Igor Mammedov , Anthony Perard , Ani Sinha , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [RFC PATCH-for-9.1 13/29] hw/i386/pc: Remove non-PCI code from pc_system_firmware_init() Date: Thu, 28 Mar 2024 16:54:21 +0100 Message-ID: <20240328155439.58719-14-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240328155439.58719-1-philmd@linaro.org> References: <20240328155439.58719-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52d; envelope-from=philmd@linaro.org; helo=mail-ed1-x52d.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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org x86_bios_rom_init() is the single non-PCI-machine call from pc_system_firmware_init(). Extract it to the caller. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Bernhard Beschow --- hw/i386/pc.c | 6 +++++- hw/i386/pc_sysfw.c | 5 +---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index f184808e3e..5b96daa414 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -956,7 +956,11 @@ void pc_memory_init(PCMachineState *pcms, } /* Initialize PC system firmware */ - pc_system_firmware_init(pcms, rom_memory); + if (pci_enabled) { + pc_system_firmware_init(pcms, rom_memory); + } else { + x86_bios_rom_init(machine, "bios.bin", rom_memory, true); + } option_rom_mr = g_malloc(sizeof(*option_rom_mr)); memory_region_init_ram(option_rom_mr, NULL, "pc.rom", PC_ROM_SIZE, diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c index 862a082b0a..541dcaef71 100644 --- a/hw/i386/pc_sysfw.c +++ b/hw/i386/pc_sysfw.c @@ -202,10 +202,7 @@ void pc_system_firmware_init(PCMachineState *pcms, int i; BlockBackend *pflash_blk[ARRAY_SIZE(pcms->flash)]; - if (!pc_machine_is_pci_enabled(pcms)) { - x86_bios_rom_init(MACHINE(pcms), "bios.bin", rom_memory, true); - return; - } + assert(pc_machine_is_pci_enabled(pcms)); /* Map legacy -drive if=pflash to machine properties */ for (i = 0; i < ARRAY_SIZE(pcms->flash); i++) { From patchwork Thu Mar 28 15:54:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13608876 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E7229CD11DD for ; Thu, 28 Mar 2024 16:01:11 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps7X-0004n4-8V; Thu, 28 Mar 2024 11:56:51 -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 1rps6w-0003wg-Sf for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:56:17 -0400 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps6v-0002MF-4v for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:56:14 -0400 Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-513e6777af4so1700414e87.2 for ; Thu, 28 Mar 2024 08:56:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641371; x=1712246171; 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=tmBHuqnVEd7WMmkqyo1h18jdjcgOKQnVi/P8Phxm0vQ=; b=fzEr0irz5PJAPfF76k6gmP/7JU5ZehUhXTXtSzwvvpD79CxYiFu0aj1GtclTzaf98f AgPi27XB5szUYkWnv5nqrSbsiF9uZo7bItB07Wse95kCdSyje9uI0vR27jKqiVfpcVSn efHfnFueRmKNnlrfLNYArW0YJT8uAJ0ZZW3D9vMal/DMq8zr/Eb3EP87a6leOeKqCyLX wjQR9Aa7AGP/5sVI4kHqXp27B6s1OHo49WWSprlGPRz8obBNX2S66MViogAaNEQnErQf 7X5wgmaMgk2mrsoYGVoTRfAGxNciMyamaUs4OT/ze+PB6SNKGDM7+eH4Ouc9R8dIWvx9 /Hxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641371; x=1712246171; 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=tmBHuqnVEd7WMmkqyo1h18jdjcgOKQnVi/P8Phxm0vQ=; b=YPTbbBeAUFwwbhB2ZZjdUeYAuIwn8b7OTTDc1BoNyK6Tgq0hXB3aDx3POBmCTLBacj e9JkJ34vXGHrL21Ew4/sjaGRptcHT0AKd+5vgkPBOT6uldsW30rlAY+DAPzwtLGc5qBW +b9yRU0GJi7ibRHhfQUG+iSDh4sSjIgKtEtoo8kV8Wfwy/O5fWu3gxhP/2OmUvrL4SoJ didUCiip5PZNo/62p7dUvKWsX6CtTvmZe/9iz4eNGEQheOfieMkIkeDKF1iZDn/MtuXW 8JEXMJeGPSh3j8UdIf2hDMvPNXwtHzizWmT30oGfb012i8ZJ6fFufvyYZTJBwMlCoe5s IweQ== X-Gm-Message-State: AOJu0YwM+r/QWY+16TDvBLb0hf6tmjpu9Qydm1NmjrKfX/VobTSApUJc OapJjPq7H8xjcxhY3Xr1Nd3E2yZ58SmvbRcRwyTW2WSEirG2ZtcZtS8zWRoIj/dCP1gQxAAJVcV R X-Google-Smtp-Source: AGHT+IFUtefnyMETNOsHVcJ8GlW5rJsH0GdNooS/V5PGz6OttTSyM+Vcg71L2tN7ryhsnM23ZMka+w== X-Received: by 2002:ac2:489c:0:b0:515:af1f:5bad with SMTP id x28-20020ac2489c000000b00515af1f5badmr2600673lfc.28.1711641370819; Thu, 28 Mar 2024 08:56:10 -0700 (PDT) Received: from m1x-phil.lan (pas38-h02-176-184-5-52.dsl.sta.abo.bbox.fr. [176.184.5.52]) by smtp.gmail.com with ESMTPSA id ds17-20020a170907725100b00a471b5b25b9sm887001ejc.127.2024.03.28.08.56.09 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 28 Mar 2024 08:56:10 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eduardo Habkost , Stefano Stabellini , xen-devel@lists.xenproject.org, Bernhard Beschow , Thomas Huth , Marcel Apfelbaum , "Michael S. Tsirkin" , Paolo Bonzini , Igor Mammedov , Anthony Perard , Ani Sinha , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [RFC PATCH-for-9.1 14/29] hw/i386/pc: Move pc_system_flash_create() to pc_pci_machine_initfn() Date: Thu, 28 Mar 2024 16:54:22 +0100 Message-ID: <20240328155439.58719-15-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240328155439.58719-1-philmd@linaro.org> References: <20240328155439.58719-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::129; envelope-from=philmd@linaro.org; helo=mail-lf1-x129.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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org pc_system_flash_create() is only useful for PCI-based machines. Move the call to the PCI-based init() handler. Signed-off-by: Philippe Mathieu-Daudé --- hw/i386/pc.c | 2 +- hw/i386/pc_sysfw.c | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 5b96daa414..33724791fd 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1679,7 +1679,6 @@ static void pc_machine_initfn(Object *obj) pcms->fd_bootchk = true; pcms->default_bus_bypass_iommu = false; - pc_system_flash_create(pcms); pcms->pcspk = isa_new(TYPE_PC_SPEAKER); object_property_add_alias(OBJECT(pcms), "pcspk-audiodev", OBJECT(pcms->pcspk), "audiodev"); @@ -1694,6 +1693,7 @@ static void pc_pci_machine_initfn(Object *obj) ppms->acpi_build_enabled = true; + pc_system_flash_create(PC_MACHINE(obj)); cxl_machine_init(obj, &ppms->cxl_devices_state); ppms->machine_done.notify = pc_pci_machine_done; diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c index 541dcaef71..167ff24fcb 100644 --- a/hw/i386/pc_sysfw.c +++ b/hw/i386/pc_sysfw.c @@ -93,12 +93,10 @@ static PFlashCFI01 *pc_pflash_create(PCMachineState *pcms, void pc_system_flash_create(PCMachineState *pcms) { - if (pc_machine_is_pci_enabled(pcms)) { - pcms->flash[0] = pc_pflash_create(pcms, "system.flash0", - "pflash0"); - pcms->flash[1] = pc_pflash_create(pcms, "system.flash1", - "pflash1"); - } + assert(pc_machine_is_pci_enabled(pcms)); + + pcms->flash[0] = pc_pflash_create(pcms, "system.flash0", "pflash0"); + pcms->flash[1] = pc_pflash_create(pcms, "system.flash1", "pflash1"); } void pc_system_flash_cleanup_unused(PCMachineState *pcms) From patchwork Thu Mar 28 15:54:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13608818 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6F42ACD11DD for ; Thu, 28 Mar 2024 15:57:04 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps7a-00051u-M7; Thu, 28 Mar 2024 11:56:54 -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 1rps74-0004HT-39 for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:56:25 -0400 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps71-0002Nk-HA for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:56:21 -0400 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-513e6777af4so1700653e87.2 for ; Thu, 28 Mar 2024 08:56:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641377; x=1712246177; 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=a1jNCFtYZSmUOBchzYP/5PRkNu6FHAH8wzcx932FlSY=; b=XbWjQnxCd4A8s2e6R2ZZH2FLan6+OX46wdU+XB7fbmC8D7KoBlW0tVY8fDdprXAmsc yyofQNmcN6MEiqrmiN9Je9BctqmfiZUtJehxH+XmHfNP2E4eGZFUlp9vQCfs64hhJui3 LeCfwlVgq8RPWTdsmJLPhow9mnQpwzT0EGmegZ0HIoDxXvyQVuhKDFVdL/ZC6ujidDyW 1lNzHsJcoVRH4/a0OUyWyh0CziG0ofgq0S6jIspqMkU/Nwnw3IPK4AQtomZKZ3ycv5lP zQUqR354g7iy1rtWn4wlab1WJQcpM2MBJ4jdmKpFjvSAtSt8ntGdmYEKeMwZ8mP4steB aafQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641377; x=1712246177; 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=a1jNCFtYZSmUOBchzYP/5PRkNu6FHAH8wzcx932FlSY=; b=Hc0JsKDUu2B3QRlODbEnNVkSTIX7ipdSU6gNbTlvtp6d5hAG2FmxqICR75VKJ/CfnV qme5jjSN3PgcuI68Y46hAahtxASO6OL4jTTZwkDU3ylB76R7S7GxQxoXToiZ0Ac6QTqz CkArGhWXqDyKaAD7ZB2fmSHPJFkwk86M3S5m+BLWtZmWyBcfILITEs9oLoW7rZWUoSMv ZkOvCUMqcrhKat3ij2m+I0kuVJM16sVYaXhoNHQAp0Axrf6bByyz4tQ+glGFewq+5IKc c0Xp8n/5UWe3BvhkArTkwk0JjIvBptfQUstFfWgKw3LYfnEq68ALRuGEL2DuTVRmsyhm /Bug== X-Gm-Message-State: AOJu0YzXRdvLwWOhdYMrLqvKT1KVJK1vBRbiEcvt28MS9oK8rs8gLGOy hZjjBUEAKTOqDnkDNF64KBfk/baU+cKPL3zkQt+a0fiS+yxRP6AIyuTfMz5XnZ6/yn945fXDli4 T X-Google-Smtp-Source: AGHT+IHXj5Yz165xDmy5t4NF8sNvW6bTjTmkAtHF7KcewPKZsVQV788UJXIfXnYu/c9dgv0TxzoB4g== X-Received: by 2002:a05:6512:110a:b0:515:c882:c44a with SMTP id l10-20020a056512110a00b00515c882c44amr2329607lfg.39.1711641377096; Thu, 28 Mar 2024 08:56:17 -0700 (PDT) Received: from m1x-phil.lan (pas38-h02-176-184-5-52.dsl.sta.abo.bbox.fr. [176.184.5.52]) by smtp.gmail.com with ESMTPSA id z1-20020a170906668100b00a474b7bbc76sm886773ejo.56.2024.03.28.08.56.15 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 28 Mar 2024 08:56:16 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eduardo Habkost , Stefano Stabellini , xen-devel@lists.xenproject.org, Bernhard Beschow , Thomas Huth , Marcel Apfelbaum , "Michael S. Tsirkin" , Paolo Bonzini , Igor Mammedov , Anthony Perard , Ani Sinha , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [RFC PATCH-for-9.1 15/29] hw/i386/pc: Move FW/pflash related fields to PcPciMachineState Date: Thu, 28 Mar 2024 16:54:23 +0100 Message-ID: <20240328155439.58719-16-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240328155439.58719-1-philmd@linaro.org> References: <20240328155439.58719-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::133; envelope-from=philmd@linaro.org; helo=mail-lf1-x133.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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Only PCI-based machines use the set of parallel flash devices. Move the fields from PCMachineState to PcPciMachineState. Directly pass a PcPciMachineState argument to the pc_system_flash/fw methods. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/i386/pc.h | 10 ++++---- hw/i386/pc.c | 25 +++++++++--------- hw/i386/pc_piix.c | 3 ++- hw/i386/pc_sysfw.c | 60 +++++++++++++++++++------------------------- 4 files changed, 45 insertions(+), 53 deletions(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 67f8f4730b..668347c248 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -30,7 +30,6 @@ typedef struct PCMachineState { /* Pointers to devices and objects: */ PCIBus *pcibus; I2CBus *smbus; - PFlashCFI01 *flash[2]; ISADevice *pcspk; DeviceState *iommu; BusState *idebus[MAX_IDE_BUS]; @@ -47,7 +46,6 @@ typedef struct PCMachineState { bool i8042_enabled; bool default_bus_bypass_iommu; bool fd_bootchk; - uint64_t max_fw_size; /* ACPI Memory hotplug IO base address */ hwaddr memhp_io_base; @@ -61,7 +59,9 @@ typedef struct PcPciMachineState { Notifier machine_done; bool acpi_build_enabled; + uint64_t max_fw_size; + PFlashCFI01 *flash[2]; CXLState cxl_devices_state; } PcPciMachineState; @@ -184,9 +184,9 @@ void pc_i8259_create(ISABus *isa_bus, qemu_irq *i8259_irqs); #define TYPE_PORT92 "port92" /* pc_sysfw.c */ -void pc_system_flash_create(PCMachineState *pcms); -void pc_system_flash_cleanup_unused(PCMachineState *pcms); -void pc_system_firmware_init(PCMachineState *pcms, MemoryRegion *rom_memory); +void pc_system_flash_create(PcPciMachineState *ppms); +void pc_system_flash_cleanup_unused(PcPciMachineState *ppms); +void pc_system_firmware_init(PcPciMachineState *ppms, MemoryRegion *rom_memory); bool pc_system_ovmf_table_find(const char *entry, uint8_t **data, int *data_len); void pc_system_parse_ovmf_flash(uint8_t *flash_ptr, size_t flash_size); diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 33724791fd..5753a3ff0b 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -957,7 +957,7 @@ void pc_memory_init(PCMachineState *pcms, /* Initialize PC system firmware */ if (pci_enabled) { - pc_system_firmware_init(pcms, rom_memory); + pc_system_firmware_init(ppms, rom_memory); } else { x86_bios_rom_init(machine, "bios.bin", rom_memory, true); } @@ -1617,8 +1617,8 @@ static void pc_machine_get_max_fw_size(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - PCMachineState *pcms = PC_MACHINE(obj); - uint64_t value = pcms->max_fw_size; + PcPciMachineState *ppms = PC_PCI_MACHINE(obj); + uint64_t value = ppms->max_fw_size; visit_type_size(v, name, &value, errp); } @@ -1627,7 +1627,7 @@ static void pc_machine_set_max_fw_size(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - PCMachineState *pcms = PC_MACHINE(obj); + PcPciMachineState *ppms = PC_PCI_MACHINE(obj); uint64_t value; if (!visit_type_size(v, name, &value, errp)) { @@ -1651,7 +1651,7 @@ static void pc_machine_set_max_fw_size(Object *obj, Visitor *v, return; } - pcms->max_fw_size = value; + ppms->max_fw_size = value; } @@ -1672,7 +1672,6 @@ static void pc_machine_initfn(Object *obj) pcms->smbus_enabled = true; pcms->sata_enabled = true; pcms->i8042_enabled = true; - pcms->max_fw_size = 8 * MiB; #ifdef CONFIG_HPET pcms->hpet_enabled = true; #endif @@ -1692,8 +1691,9 @@ static void pc_pci_machine_initfn(Object *obj) PcPciMachineState *ppms = PC_PCI_MACHINE(obj); ppms->acpi_build_enabled = true; + ppms->max_fw_size = 8 * MiB; - pc_system_flash_create(PC_MACHINE(obj)); + pc_system_flash_create(ppms); cxl_machine_init(obj, &ppms->cxl_devices_state); ppms->machine_done.notify = pc_pci_machine_done; @@ -1815,12 +1815,6 @@ static void pc_machine_class_init(ObjectClass *oc, void *data) pc_machine_get_default_bus_bypass_iommu, pc_machine_set_default_bus_bypass_iommu); - object_class_property_add(oc, PC_MACHINE_MAX_FW_SIZE, "size", - pc_machine_get_max_fw_size, pc_machine_set_max_fw_size, - NULL, NULL); - object_class_property_set_description(oc, PC_MACHINE_MAX_FW_SIZE, - "Maximum combined firmware size"); - object_class_property_add(oc, PC_MACHINE_SMBIOS_EP, "str", pc_machine_get_smbios_ep, pc_machine_set_smbios_ep, NULL, NULL); @@ -1834,6 +1828,11 @@ static void pc_machine_class_init(ObjectClass *oc, void *data) static void pc_pci_machine_class_init(ObjectClass *oc, void *data) { + object_class_property_add(oc, PC_MACHINE_MAX_FW_SIZE, "size", + pc_machine_get_max_fw_size, + pc_machine_set_max_fw_size, NULL, NULL); + object_class_property_set_description(oc, PC_MACHINE_MAX_FW_SIZE, + "Maximum combined firmware size"); } bool pc_machine_is_pci_enabled(PCMachineState *pcms) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 7aa2598e10..6b3403d0bd 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -118,6 +118,7 @@ static void pc_init1(MachineState *machine, const char *pci_type) ram_addr_t lowmem; uint64_t hole64_size = 0; bool pci_enabled = pc_machine_is_pci_enabled(pcms); + PcPciMachineState *ppms = pci_enabled ? PC_PCI_MACHINE(pcms) : NULL; /* * Calculate ram split, for memory below and above 4G. It's a bit @@ -228,7 +229,7 @@ static void pc_init1(MachineState *machine, const char *pci_type) assert(machine->ram_size == x86ms->below_4g_mem_size + x86ms->above_4g_mem_size); - pc_system_flash_cleanup_unused(pcms); + pc_system_flash_cleanup_unused(ppms); if (machine->kernel_filename != NULL) { /* For xen HVM direct kernel boot, load linux here */ xen_load_linux(pcms); diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c index 167ff24fcb..54d15afa49 100644 --- a/hw/i386/pc_sysfw.c +++ b/hw/i386/pc_sysfw.c @@ -71,7 +71,7 @@ static void pc_isa_bios_init(MemoryRegion *rom_memory, memory_region_set_readonly(isa_bios, true); } -static PFlashCFI01 *pc_pflash_create(PCMachineState *pcms, +static PFlashCFI01 *pc_pflash_create(PcPciMachineState *ppms, const char *name, const char *alias_prop_name) { @@ -80,8 +80,8 @@ static PFlashCFI01 *pc_pflash_create(PCMachineState *pcms, qdev_prop_set_uint64(dev, "sector-length", FLASH_SECTOR_SIZE); qdev_prop_set_uint8(dev, "width", 1); qdev_prop_set_string(dev, "name", name); - object_property_add_child(OBJECT(pcms), name, OBJECT(dev)); - object_property_add_alias(OBJECT(pcms), alias_prop_name, + object_property_add_child(OBJECT(ppms), name, OBJECT(dev)); + object_property_add_alias(OBJECT(ppms), alias_prop_name, OBJECT(dev), "drive"); /* * The returned reference is tied to the child property and @@ -91,28 +91,24 @@ static PFlashCFI01 *pc_pflash_create(PCMachineState *pcms, return PFLASH_CFI01(dev); } -void pc_system_flash_create(PCMachineState *pcms) +void pc_system_flash_create(PcPciMachineState *ppms) { - assert(pc_machine_is_pci_enabled(pcms)); - - pcms->flash[0] = pc_pflash_create(pcms, "system.flash0", "pflash0"); - pcms->flash[1] = pc_pflash_create(pcms, "system.flash1", "pflash1"); + ppms->flash[0] = pc_pflash_create(ppms, "system.flash0", "pflash0"); + ppms->flash[1] = pc_pflash_create(ppms, "system.flash1", "pflash1"); } -void pc_system_flash_cleanup_unused(PCMachineState *pcms) +void pc_system_flash_cleanup_unused(PcPciMachineState *ppms) { char *prop_name; int i; - assert(pc_machine_is_pci_enabled(pcms)); - - for (i = 0; i < ARRAY_SIZE(pcms->flash); i++) { - if (!qdev_is_realized(DEVICE(pcms->flash[i]))) { + for (i = 0; i < ARRAY_SIZE(ppms->flash); i++) { + if (!qdev_is_realized(DEVICE(ppms->flash[i]))) { prop_name = g_strdup_printf("pflash%d", i); - object_property_del(OBJECT(pcms), prop_name); + object_property_del(OBJECT(ppms), prop_name); g_free(prop_name); - object_unparent(OBJECT(pcms->flash[i])); - pcms->flash[i] = NULL; + object_unparent(OBJECT(ppms->flash[i])); + ppms->flash[i] = NULL; } } } @@ -130,7 +126,7 @@ void pc_system_flash_cleanup_unused(PCMachineState *pcms) * pc_isa_bios_init(). Merging several flash devices for isa-bios is * not supported. */ -static void pc_system_flash_map(PCMachineState *pcms, +static void pc_system_flash_map(PcPciMachineState *ppms, MemoryRegion *rom_memory) { hwaddr total_size = 0; @@ -142,10 +138,8 @@ static void pc_system_flash_map(PCMachineState *pcms, void *flash_ptr; int flash_size; - assert(pc_machine_is_pci_enabled(pcms)); - - for (i = 0; i < ARRAY_SIZE(pcms->flash); i++) { - system_flash = pcms->flash[i]; + for (i = 0; i < ARRAY_SIZE(ppms->flash); i++) { + system_flash = ppms->flash[i]; blk = pflash_cfi01_get_blk(system_flash); if (!blk) { break; @@ -166,10 +160,10 @@ static void pc_system_flash_map(PCMachineState *pcms, } if ((hwaddr)size != size || total_size > HWADDR_MAX - size - || total_size + size > pcms->max_fw_size) { + || total_size + size > ppms->max_fw_size) { error_report("combined size of system firmware exceeds " "%" PRIu64 " bytes", - pcms->max_fw_size); + ppms->max_fw_size); exit(1); } @@ -194,23 +188,21 @@ static void pc_system_flash_map(PCMachineState *pcms, } } -void pc_system_firmware_init(PCMachineState *pcms, +void pc_system_firmware_init(PcPciMachineState *ppms, MemoryRegion *rom_memory) { int i; - BlockBackend *pflash_blk[ARRAY_SIZE(pcms->flash)]; - - assert(pc_machine_is_pci_enabled(pcms)); + BlockBackend *pflash_blk[ARRAY_SIZE(ppms->flash)]; /* Map legacy -drive if=pflash to machine properties */ - for (i = 0; i < ARRAY_SIZE(pcms->flash); i++) { - pflash_cfi01_legacy_drive(pcms->flash[i], + for (i = 0; i < ARRAY_SIZE(ppms->flash); i++) { + pflash_cfi01_legacy_drive(ppms->flash[i], drive_get(IF_PFLASH, 0, i)); - pflash_blk[i] = pflash_cfi01_get_blk(pcms->flash[i]); + pflash_blk[i] = pflash_cfi01_get_blk(ppms->flash[i]); } /* Reject gaps */ - for (i = 1; i < ARRAY_SIZE(pcms->flash); i++) { + for (i = 1; i < ARRAY_SIZE(ppms->flash); i++) { if (pflash_blk[i] && !pflash_blk[i - 1]) { error_report("pflash%d requires pflash%d", i, i - 1); exit(1); @@ -219,7 +211,7 @@ void pc_system_firmware_init(PCMachineState *pcms, if (!pflash_blk[0]) { /* Machine property pflash0 not set, use ROM mode */ - x86_bios_rom_init(MACHINE(pcms), "bios.bin", rom_memory, false); + x86_bios_rom_init(MACHINE(ppms), "bios.bin", rom_memory, false); } else { if (kvm_enabled() && !kvm_readonly_mem_enabled()) { /* @@ -231,10 +223,10 @@ void pc_system_firmware_init(PCMachineState *pcms, exit(1); } - pc_system_flash_map(pcms, rom_memory); + pc_system_flash_map(ppms, rom_memory); } - pc_system_flash_cleanup_unused(pcms); + pc_system_flash_cleanup_unused(ppms); } void x86_firmware_configure(void *ptr, int size) From patchwork Thu Mar 28 15:54:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13608873 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 02971CD11DD for ; Thu, 28 Mar 2024 16:00:00 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps7c-0005A6-Sf; Thu, 28 Mar 2024 11:56: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 1rps7D-0004Rf-UL for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:56:35 -0400 Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps79-0002Qm-MC for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:56:30 -0400 Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-513e6777af4so1700851e87.2 for ; Thu, 28 Mar 2024 08:56:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641383; x=1712246183; 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=YADozrynE6WAolQE0PpJsPO9+XRuTB0w7hXGd8JOVMk=; b=bNgcRPVC1lAOCjQ3ZlTPi4Rvg7x9ZYCxsNS9xHm8EtSjXq5pBEugDnEORT0gIM+jLz BWwy1RBcbJxvV7INgHFththJF4onONnPSJj4Hg+6l/sSUj0o6bsSg1j7PhR81sIN6THG GAjdctwf6BaQiwpdrKEBu5CBL+H9qYm1s59t0UE5nH/q7ZOBysCHhMtsZ+EHzhysYL2K 7ooQuBXIuoOSfjyPucuzszDAuwHIDznaIm5VCKvrxqAkZocwdhl+l5BsdNZzvz7hZPue JFCEGhkBb/4+0aS4QVQrBaZU7mYx0lLUbDjTjlU/w4cms1D2a7x8UVxSCms9OT5EC2zs VD8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641383; x=1712246183; 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=YADozrynE6WAolQE0PpJsPO9+XRuTB0w7hXGd8JOVMk=; b=vvhRIsEN6bgNDKIwI9mnrrgjJEc9iDbaxWo/7RE6OM76KlyOHyXxg6ElsB7ISpjPFp /stUoElYHMufpDfG4zOF25U42ZHwmx6fWIivKHitSQ2V7cgaxE9em34S3ekYLHVEOhoY YeG18J7DtafZW6dtQfTY5lJFHjOOdVB5r1S5qqtSRfudSPerLzWuTISKcMNNzSog05k8 dEvJwHw8PYeiGqrFgYsphXsY+fUuq5SFUBq2WDDMov8V002g4VM7LDmUfkWDXnfgkiqj JKp+4ND8y3bgkpMXgwpy3eNoPFOcMs2YyWucpQZZ+4Zg+lGWv0Gl9hw1kwxghHfpFhEr rWwQ== X-Gm-Message-State: AOJu0Yw9YZn0qieKd9/zQXp5gOAfv17O0HNtQ6cwWMcLuzJj3qfrgiUy YuBirRvoE1hUmadBV2xGjHr7bekxwcgcUA40Nz8qmjrG/4Pa8UjSVv8Ss27k7JB2f/o1KdJYPMY u X-Google-Smtp-Source: AGHT+IFET2qLkxCYJlLAe5wqUF2LJxJCZxdIrO9Tbo3cYr9nsR7BCDgXHuGLT1xPB8OJyuTlfGMDhg== X-Received: by 2002:a05:6512:78f:b0:513:e643:cd12 with SMTP id x15-20020a056512078f00b00513e643cd12mr2537328lfr.26.1711641383341; Thu, 28 Mar 2024 08:56:23 -0700 (PDT) Received: from m1x-phil.lan (pas38-h02-176-184-5-52.dsl.sta.abo.bbox.fr. [176.184.5.52]) by smtp.gmail.com with ESMTPSA id i23-20020a170906265700b00a4749a1de50sm911948ejc.176.2024.03.28.08.56.21 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 28 Mar 2024 08:56:22 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eduardo Habkost , Stefano Stabellini , xen-devel@lists.xenproject.org, Bernhard Beschow , Thomas Huth , Marcel Apfelbaum , "Michael S. Tsirkin" , Paolo Bonzini , Igor Mammedov , Anthony Perard , Ani Sinha , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [RFC PATCH-for-9.1 16/29] hw/i386/pc: Move south-bridge related fields to PcPciMachine Date: Thu, 28 Mar 2024 16:54:24 +0100 Message-ID: <20240328155439.58719-17-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240328155439.58719-1-philmd@linaro.org> References: <20240328155439.58719-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::130; envelope-from=philmd@linaro.org; helo=mail-lf1-x130.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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org South bridge type is only relevant for the i440fx/piix machine, which is PCI-based. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/i386/pc.h | 8 ++++---- hw/i386/pc.c | 3 ++- hw/i386/pc_piix.c | 12 ++++++------ 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 668347c248..2db2aa03d3 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -38,7 +38,6 @@ typedef struct PCMachineState { uint64_t max_ram_below_4g; OnOffAuto vmport; SmbiosEntryPointType smbios_entry_point_type; - const char *south_bridge; bool smbus_enabled; bool sata_enabled; @@ -59,6 +58,7 @@ typedef struct PcPciMachineState { Notifier machine_done; bool acpi_build_enabled; + const char *southbridge_typename; uint64_t max_fw_size; PFlashCFI01 *flash[2]; @@ -88,9 +88,6 @@ typedef struct PcPciMachineState { typedef struct PCMachineClass { X86MachineClass parent_class; - /* Device configuration: */ - const char *default_south_bridge; - /* Compat options: */ /* Default CPU model version. See x86_cpu_set_default_version(). */ @@ -126,6 +123,9 @@ typedef struct PCMachineClass { typedef struct PcPciMachineClass { PCMachineClass parent_class; + /* Device configuration: */ + const char *default_southbridge_typename; + /* ACPI compat: */ int pci_root_uid; } PcPciMachineClass; diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 5753a3ff0b..dd44df0470 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1667,7 +1667,6 @@ static void pc_machine_initfn(Object *obj) #endif /* CONFIG_VMPORT */ pcms->max_ram_below_4g = 0; /* use default */ pcms->smbios_entry_point_type = pcmc->default_smbios_ep_type; - pcms->south_bridge = pcmc->default_south_bridge; pcms->smbus_enabled = true; pcms->sata_enabled = true; @@ -1689,9 +1688,11 @@ static void pc_machine_initfn(Object *obj) static void pc_pci_machine_initfn(Object *obj) { PcPciMachineState *ppms = PC_PCI_MACHINE(obj); + PcPciMachineClass *ppmc = PC_PCI_MACHINE_GET_CLASS(ppms); ppms->acpi_build_enabled = true; ppms->max_fw_size = 8 * MiB; + ppms->southbridge_typename = ppmc->default_southbridge_typename; pc_system_flash_create(ppms); cxl_machine_init(obj, &ppms->cxl_devices_state); diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 6b3403d0bd..2043a7022a 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -243,7 +243,7 @@ static void pc_init1(MachineState *machine, const char *pci_type) DeviceState *dev; size_t i; - pci_dev = pci_new_multifunction(-1, pcms->south_bridge); + pci_dev = pci_new_multifunction(-1, ppms->southbridge_typename); object_property_set_bool(OBJECT(pci_dev), "has-usb", machine_usb(machine), &error_abort); object_property_set_bool(OBJECT(pci_dev), "has-acpi", @@ -385,12 +385,12 @@ static const QEnumLookup PCSouthBridgeOption_lookup = { static int pc_get_south_bridge(Object *obj, Error **errp) { - PCMachineState *pcms = PC_MACHINE(obj); + PcPciMachineState *ppms = PC_PCI_MACHINE(obj); int i; for (i = 0; i < PCSouthBridgeOption_lookup.size; i++) { if (g_strcmp0(PCSouthBridgeOption_lookup.array[i], - pcms->south_bridge) == 0) { + ppms->southbridge_typename) == 0) { return i; } } @@ -401,7 +401,7 @@ static int pc_get_south_bridge(Object *obj, Error **errp) static void pc_set_south_bridge(Object *obj, int value, Error **errp) { - PCMachineState *pcms = PC_MACHINE(obj); + PcPciMachineState *ppms = PC_PCI_MACHINE(obj); if (value < 0) { error_setg(errp, "Value can't be negative"); @@ -413,7 +413,7 @@ static void pc_set_south_bridge(Object *obj, int value, Error **errp) return; } - pcms->south_bridge = PCSouthBridgeOption_lookup.array[value]; + ppms->southbridge_typename = PCSouthBridgeOption_lookup.array[value]; } /* Looking for a pc_compat_2_4() function? It doesn't exist. @@ -472,7 +472,7 @@ static void pc_i440fx_machine_options(MachineClass *m) PcPciMachineClass *ppmc = PC_PCI_MACHINE_CLASS(m); ObjectClass *oc = OBJECT_CLASS(m); - pcmc->default_south_bridge = TYPE_PIIX3_DEVICE; + ppmc->default_southbridge_typename = TYPE_PIIX3_DEVICE; ppmc->pci_root_uid = 0; pcmc->default_cpu_version = 1; From patchwork Thu Mar 28 15:54:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13608863 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CA829CD11DD for ; Thu, 28 Mar 2024 15:57:32 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps7a-00050d-5G; Thu, 28 Mar 2024 11:56:54 -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 1rps7F-0004Yw-QL for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:56:37 -0400 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps7D-0002Tc-NN for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:56:33 -0400 Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-a46a7208eedso167670066b.0 for ; Thu, 28 Mar 2024 08:56:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641389; x=1712246189; 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=yelmGOzPahdn50NTFTioUrFj9NGQyALSAi158EJljHU=; b=krvbD78ORnBdXZmJ3OmYQFXUSF7dNlymbl08eDUGLTjroCPPWdUAqYsv540u7Dd9hy S3zp5u2sAbn1rK6MxiEwGyfbx/4MLf1rPGKoO2QHs8VfTmNE1G33Q54DH5pcr08ViTX1 NLrXAL3xlvddf0otKio5moqPtjXJ6eO+Pf8D9oee4cBZHRwvhkwSL2KGvLl1o3o8V+jr OrN/Nd4vnB62IMuGE+IlE/jNX1mhHSVOlz0f2wfmZc8OHSQUZt4sbOQgiCj0VwtuyOWu 1xyUM3QgMO8ccL7saSfLVKdaIubAtgfBs7q4nC0U4Y0vmTDwL6itkG7gfjDPPHJ4LDsZ xmVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641389; x=1712246189; 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=yelmGOzPahdn50NTFTioUrFj9NGQyALSAi158EJljHU=; b=PDs3kENHk62nCRY+EWjBqGWtIgiR5QTqUd8lm1kx0s1kOFr0K/qVE3g7Jq8NPinEDq Mb5t3UlUR+L12W+xMcMy2J5PZlOhOwZKHS1rz+0ycxdrYShO4XpUxOWRk+PbYFwroA00 yxIOeV+wFlhCaU5U7o0Qy3roueZ6qTvaK+3CPzNtdS0J1+QyI2v3Gr0BnaFS7OctJV+u YOoeo54OcEOS8oIOsi4aqncE5XiuD0PVSBhJ6UWiLqPG8YOou8b8PJmabMS6pK9BHYZC 9eY0s6/dmu1HhH3n7DQyJrYObxMlDbxQkp+0DW/5N9cFAhl04oxBD68y3R9maqzRAEC1 myPA== X-Gm-Message-State: AOJu0YwKCyFoU0y7miYmWZVlxS0dlhMuWtd8yWGf4oPbH5HOM6+Lf/Z2 TU26R+5VDJOJqD1qjEKlUw1V8fH7f+YEACY2Y59OePphVQxTq8ay9gMNya8I2/3aJewv+crRbEJ i X-Google-Smtp-Source: AGHT+IGcQH5U/UKgHXGMsAIRXVS3RWDUx0CNeskq1nCdFHfYMz7G0o34lBWrByXcqIlMAc9p2yI9yQ== X-Received: by 2002:a17:906:e24e:b0:a4d:fc83:70e1 with SMTP id gq14-20020a170906e24e00b00a4dfc8370e1mr2038052ejb.56.1711641389600; Thu, 28 Mar 2024 08:56:29 -0700 (PDT) Received: from m1x-phil.lan (pas38-h02-176-184-5-52.dsl.sta.abo.bbox.fr. [176.184.5.52]) by smtp.gmail.com with ESMTPSA id c12-20020a170906170c00b00a47464a6ee4sm907178eje.173.2024.03.28.08.56.27 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 28 Mar 2024 08:56:29 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eduardo Habkost , Stefano Stabellini , xen-devel@lists.xenproject.org, Bernhard Beschow , Thomas Huth , Marcel Apfelbaum , "Michael S. Tsirkin" , Paolo Bonzini , Igor Mammedov , Anthony Perard , Ani Sinha , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [RFC PATCH-for-9.1 17/29] hw/i386/pc: Inline gigabyte_align() Date: Thu, 28 Mar 2024 16:54:25 +0100 Message-ID: <20240328155439.58719-18-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240328155439.58719-1-philmd@linaro.org> References: <20240328155439.58719-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::635; envelope-from=philmd@linaro.org; helo=mail-ej1-x635.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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org All PCI-based machines have the gigabyte_align field set to %true. Simplify by using an inlined helper checking whether the machine is PCI-based or not. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/i386/pc.h | 9 --------- hw/i386/pc.c | 1 - hw/i386/pc_piix.c | 16 +++++++++++++--- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 2db2aa03d3..758dd5f29b 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -76,14 +76,6 @@ typedef struct PcPciMachineState { /** * PCMachineClass: - * - * Compat fields: - * - * @gigabyte_align: Make sure that guest addresses aligned at - * 1Gbyte boundaries get mapped to host - * addresses aligned at 1Gbyte boundaries. This - * way we can use 1GByte pages in the host. - * */ typedef struct PCMachineClass { X86MachineClass parent_class; @@ -99,7 +91,6 @@ typedef struct PCMachineClass { SmbiosEntryPointType default_smbios_ep_type; /* RAM / address space compat: */ - bool gigabyte_align; bool has_reserved_memory; bool broken_reserved_end; bool enforce_amd_1tb_hole; diff --git a/hw/i386/pc.c b/hw/i386/pc.c index dd44df0470..093a7c35f7 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1752,7 +1752,6 @@ static void pc_machine_class_init(ObjectClass *oc, void *data) HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc); pcmc->smbios_defaults = true; - pcmc->gigabyte_align = true; pcmc->has_reserved_memory = true; pcmc->enforce_amd_1tb_hole = true; pcmc->pvh_enabled = true; diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 2043a7022a..0bc14da768 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -99,6 +99,17 @@ static void piix_intx_routing_notifier_xen(PCIDevice *dev) } } +/* + * gigabyte_align: Make sure that guest addresses aligned at + * 1Gbyte boundaries get mapped to host + * addresses aligned at 1Gbyte boundaries. + * This way we can use 1GByte pages in the host. + */ +static bool gigabyte_align(PCMachineState *pcms) +{ + return pc_machine_is_pci_enabled(pcms); +} + /* PC hardware initialisation */ static void pc_init1(MachineState *machine, const char *pci_type) { @@ -130,7 +141,7 @@ static void pc_init1(MachineState *machine, const char *pci_type) * - Then, to gigabyte align the memory, we move the split to 3G * (lowmem = 0xc0000000). But only in case we have to split in * the first place, i.e. ram_size is larger than (traditional) - * lowmem. And for new machine types (gigabyte_align = true) + * lowmem. And for new machine types (gigabyte_align() = true) * only, for live migration compatibility reasons. * * - Next the max-ram-below-4g option was added, which allowed to @@ -160,7 +171,7 @@ static void pc_init1(MachineState *machine, const char *pci_type) } lowmem = pcms->max_ram_below_4g; if (machine->ram_size >= pcms->max_ram_below_4g) { - if (pcmc->gigabyte_align) { + if (gigabyte_align(pcms)) { if (lowmem > 0xc0000000) { lowmem = 0xc0000000; } @@ -818,7 +829,6 @@ static void isapc_machine_options(MachineClass *m) m->option_rom_has_mr = true; m->rom_file_has_mr = false; pcmc->smbios_defaults = false; - pcmc->gigabyte_align = false; pcmc->smbios_legacy_mode = true; pcmc->has_reserved_memory = false; m->default_nic = "ne2k_isa"; From patchwork Thu Mar 28 15:54:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13608862 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 52C14CD1283 for ; Thu, 28 Mar 2024 15:57:30 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps7d-0005EA-MN; Thu, 28 Mar 2024 11:56: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 1rps7L-0004aW-DN for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:56:44 -0400 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps7J-0002Ve-JZ for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:56:39 -0400 Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-5684db9147dso1315132a12.2 for ; Thu, 28 Mar 2024 08:56:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641396; x=1712246196; 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=mvS5b4mOvRgBMXReEbw8mHkHwY6O9r1j8WjPX6hg3zo=; b=yQG8nxLXUsIhy97Z2qz79nI0mLusIbLwc+Tc7VKe9VPE5pjS7zcap8QMh/mRsgQ7ZW acP9BMOTPrkud7/D6oBuEc1L2r5a5l251CNJBuEPpK5XPAR6u4YFFSu0M9y8jW5DY0O9 kxbkfknwbJHfpemXOJliVEk7jYjWp/xYTqjiDZEz+LLPOiRfj1FVFqyHSKiq1YmKdqSq 9Tqy9Ud7x9iVzK9SFA+CDY4/TN5fMzEsKrOy5K91FfLbfKXxTdRKvUZNXqJ0vDKB3zaO lXlcafmrg5JxBDvJYar9mQ1DzP0DHsPzM7OJpT00yKMhe56EOl3KvBgDjAixyPv/TJSt QJVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641396; x=1712246196; 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=mvS5b4mOvRgBMXReEbw8mHkHwY6O9r1j8WjPX6hg3zo=; b=nUQi8Dbz3W+CzXeMtTtAaMso+TV57+lNUGnfwKEb2RrO3fXo8BIfst3I0FToGm3ykB R2CyeZ3ASRGEENnI1bKiRGj/IJ27JzYAdf9PZdx410g242VnIc4nz3xMDqVywLrjN09V Y/Xfo0FYLnqxL+V6y+dvbatN4gIay+yukJMgdGtrtqEhJt6VrI9C9pJaadBemC/1FEsJ nti/iPkpj2pDy2XuWtpS5Gxm+FROT2jlgO09DYRg3Ll00xPTqu8ohO2tlFGShONwj0Qp dYS8ZsENXvIFEKyt/DhquCSqdbNfcpmxN/Q9X2zX2xMlVGJ6P83U48xLSOLBJ1Gf1k5J RkhQ== X-Gm-Message-State: AOJu0Yxm5KRxtBAtDz7IZLFNtP4IVQzZ0OFbYuyoHAxxGMisky5LA87r NJAoTUs+cRf0T3pBr7Cel8b/H8M6/6g98p01sqRlzR16TSO5UZ6qPP1D9pGB+Vayej/xF+rR0pS + X-Google-Smtp-Source: AGHT+IHfWPHo1qaEN4DNEm3R8wOVj4A4iUDXGogGmGPb4Wx0aiRPAERFSIayiOeRYDhmlaAPcH41sw== X-Received: by 2002:a50:d6d7:0:b0:568:a9f3:b3fb with SMTP id l23-20020a50d6d7000000b00568a9f3b3fbmr2267809edj.8.1711641395712; Thu, 28 Mar 2024 08:56:35 -0700 (PDT) Received: from m1x-phil.lan (pas38-h02-176-184-5-52.dsl.sta.abo.bbox.fr. [176.184.5.52]) by smtp.gmail.com with ESMTPSA id l13-20020a056402028d00b0056bfa6ad5eesm959518edv.91.2024.03.28.08.56.34 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 28 Mar 2024 08:56:35 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eduardo Habkost , Stefano Stabellini , xen-devel@lists.xenproject.org, Bernhard Beschow , Thomas Huth , Marcel Apfelbaum , "Michael S. Tsirkin" , Paolo Bonzini , Igor Mammedov , Anthony Perard , Ani Sinha , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [RFC PATCH-for-9.1 18/29] hw/i386/pc: Inline has_reserved_memory() Date: Thu, 28 Mar 2024 16:54:26 +0100 Message-ID: <20240328155439.58719-19-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240328155439.58719-1-philmd@linaro.org> References: <20240328155439.58719-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::534; envelope-from=philmd@linaro.org; helo=mail-ed1-x534.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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org All PCI-based machines have the has_reserved_memory field set to %true. Simplify by using an inlined helper checking whether the machine is PCI-based or not. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/i386/pc.h | 1 - hw/i386/pc.c | 17 ++++++++++------- hw/i386/pc_piix.c | 1 - 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 758dd5f29b..df4c813854 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -91,7 +91,6 @@ typedef struct PCMachineClass { SmbiosEntryPointType default_smbios_ep_type; /* RAM / address space compat: */ - bool has_reserved_memory; bool broken_reserved_end; bool enforce_amd_1tb_hole; diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 093a7c35f7..e36d76656b 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -671,6 +671,11 @@ void xen_load_linux(PCMachineState *pcms) #define PC_ROM_ALIGN 0x800 #define PC_ROM_SIZE (PC_ROM_MAX - PC_ROM_MIN_VGA) +static bool has_reserved_memory(PCMachineState *pcms) +{ + return pc_machine_is_pci_enabled(pcms); +} + static hwaddr pc_above_4g_end(PCMachineState *pcms) { X86MachineState *x86ms = X86_MACHINE(pcms); @@ -702,12 +707,11 @@ static void pc_get_device_memory_range(PCMachineState *pcms, static uint64_t pc_get_cxl_range_start(PCMachineState *pcms) { - PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms); MachineState *ms = MACHINE(pcms); hwaddr cxl_base; ram_addr_t size; - if (pcmc->has_reserved_memory && + if (has_reserved_memory(pcms) && (ms->ram_size < ms->maxram_size)) { pc_get_device_memory_range(pcms, &cxl_base, &size); cxl_base += size; @@ -760,7 +764,7 @@ static hwaddr pc_max_used_gpa(PCMachineState *pcms, uint64_t pci_hole64_size) * calculating the highest possible GPA so that we can properly report * if someone configures them on a CPU that cannot possibly address them. */ - if (pcmc->has_reserved_memory && + if (has_reserved_memory(pcms) && (ms->ram_size < ms->maxram_size)) { hwaddr devmem_start; ram_addr_t devmem_size; @@ -891,7 +895,7 @@ void pc_memory_init(PCMachineState *pcms, e820_add_entry(pcms->sgx_epc.base, pcms->sgx_epc.size, E820_RESERVED); } - if (!pcmc->has_reserved_memory && + if (!has_reserved_memory(pcms) && (machine->ram_slots || (machine->maxram_size > machine->ram_size))) { @@ -901,7 +905,7 @@ void pc_memory_init(PCMachineState *pcms, } /* initialize device memory address space */ - if (pcmc->has_reserved_memory && + if (has_reserved_memory(pcms) && (machine->ram_size < machine->maxram_size)) { ram_addr_t device_mem_size; hwaddr device_mem_base; @@ -1024,7 +1028,7 @@ uint64_t pc_pci_hole64_start(void) if (ppms->cxl_devices_state.is_enabled) { hole64_start = pc_get_cxl_range_end(pcms); - } else if (pcmc->has_reserved_memory && (ms->ram_size < ms->maxram_size)) { + } else if (has_reserved_memory(pcms) && (ms->ram_size < ms->maxram_size)) { pc_get_device_memory_range(pcms, &hole64_start, &size); if (!pcmc->broken_reserved_end) { hole64_start += size; @@ -1752,7 +1756,6 @@ static void pc_machine_class_init(ObjectClass *oc, void *data) HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc); pcmc->smbios_defaults = true; - pcmc->has_reserved_memory = true; pcmc->enforce_amd_1tb_hole = true; pcmc->pvh_enabled = true; pcmc->kvmclock_create_always = true; diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 0bc14da768..e6178f8653 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -830,7 +830,6 @@ static void isapc_machine_options(MachineClass *m) m->rom_file_has_mr = false; pcmc->smbios_defaults = false; pcmc->smbios_legacy_mode = true; - pcmc->has_reserved_memory = false; m->default_nic = "ne2k_isa"; m->default_cpu_type = X86_CPU_TYPE_NAME("486"); m->no_parallel = !module_object_class_by_name(TYPE_ISA_PARALLEL); From patchwork Thu Mar 28 15:54:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13608819 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CAB60CD11DD for ; Thu, 28 Mar 2024 15:57:19 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps7a-00051j-MG; Thu, 28 Mar 2024 11:56:54 -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 1rps7R-0004f8-Fd for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:56:46 -0400 Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps7P-0002XK-UH for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:56:45 -0400 Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-a46ea03c2a5so216843966b.1 for ; Thu, 28 Mar 2024 08:56:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641402; x=1712246202; 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=muQ9YYs1garpvhloVWRUiLPzA6iwq65Rr1SdS4smlFw=; b=xIviQFS5WkfB3SmaSqmdUiAYqROgybIZKD58pgI+nEQ6LVuoxICa+gUvJ/0tTQwbzF o+uLtFAavL7ut4sMimpHF6nxEOCUOeRg6tCtKL3dQnxXVrFop37PE66b9GSDjArbGVpx wuwy6fTwtFcrIWsjIHtCew9cfKdqHUayeiBMlVjFq9nClJpotpgJN133Yet1y+CX7S4V Fe18wz1fhSljbdc1b0Pae2YXWJ1/xZBXZAmBqZHAPr/hgrw0YyYr/qDdL2dka3PjVB19 ueZqFa/A4vS4rpcyqBVsrt0ftb9YlaMc3Bpy9/G51V3NPxYAU/6vOFqKjm5/31/hdo75 Cf1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641402; x=1712246202; 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=muQ9YYs1garpvhloVWRUiLPzA6iwq65Rr1SdS4smlFw=; b=H1wHNYV0VeiOjpMCZUH19sS5E7C5op114D2gNMaL9XBCDneh2zGNS+gLEu9Q8GjAYh wFDCb0wa8UHUFm6IW4VYtO5bPeLDgMax9neYLUmHbftsCjMOpJwSSJ2pY+x3OBBFIcrY N/PvQJtNO34Ll8gfdJ39F3BU8DFCclXuPJWGiseHVgC2VALTB6+v124bOTvFTrCDIJDc d3k59A0RoRgXB4ZnZuVujNOP2R4aNyGFr7Zn6+nD3e87mmR9sUYEQ0PAwpxI0aHojtQo sAfpOtrRyHo2trdLFpdhQS005Ejr2QMw0L16SmkzmTxdj+2AP3GUq5W7yfNKDcD2uiJh bABA== X-Gm-Message-State: AOJu0Yw92N27Qljkj0evo+0qYu+sh/liQkX3exoA9UlnfXOxKC3SRvO4 lpiT5QGG8n8XBguTv4Ia3HkJbC5YHZIwfb/YG+ZJ2q35VLigykaEQBjdAUlzenJQbH2OFHzD3iY 7 X-Google-Smtp-Source: AGHT+IFXbYhPHZn5NXBz7Ikr8yC8QHRf+1TONIhT4Hw3waF5CP4z/i4EhLM/5gQv8lw+8vgiP63smA== X-Received: by 2002:a17:906:714a:b0:a4e:f91:4694 with SMTP id z10-20020a170906714a00b00a4e0f914694mr2568225ejj.27.1711641401851; Thu, 28 Mar 2024 08:56:41 -0700 (PDT) Received: from m1x-phil.lan (pas38-h02-176-184-5-52.dsl.sta.abo.bbox.fr. [176.184.5.52]) by smtp.gmail.com with ESMTPSA id dr3-20020a170907720300b00a4a38d10801sm896023ejc.35.2024.03.28.08.56.40 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 28 Mar 2024 08:56:41 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eduardo Habkost , Stefano Stabellini , xen-devel@lists.xenproject.org, Bernhard Beschow , Thomas Huth , Marcel Apfelbaum , "Michael S. Tsirkin" , Paolo Bonzini , Igor Mammedov , Anthony Perard , Ani Sinha , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [RFC PATCH-for-9.1 19/29] hw/i386/pc: Pass PcPciMachineState argument to CXL helpers Date: Thu, 28 Mar 2024 16:54:27 +0100 Message-ID: <20240328155439.58719-20-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240328155439.58719-1-philmd@linaro.org> References: <20240328155439.58719-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::632; envelope-from=philmd@linaro.org; helo=mail-ej1-x632.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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Since CXL helpers expect a PCI-based machine, we can directly pass them a PcPciMachineState argument. Signed-off-by: Philippe Mathieu-Daudé --- hw/i386/pc.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index e36d76656b..d8e91d18b8 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -705,14 +705,14 @@ static void pc_get_device_memory_range(PCMachineState *pcms, *device_mem_size = size; } -static uint64_t pc_get_cxl_range_start(PCMachineState *pcms) +static uint64_t pc_get_cxl_range_start(PcPciMachineState *ppms) { + PCMachineState *pcms = PC_MACHINE(ppms); MachineState *ms = MACHINE(pcms); hwaddr cxl_base; ram_addr_t size; - if (has_reserved_memory(pcms) && - (ms->ram_size < ms->maxram_size)) { + if ((ms->ram_size < ms->maxram_size)) { pc_get_device_memory_range(pcms, &cxl_base, &size); cxl_base += size; } else { @@ -722,10 +722,9 @@ static uint64_t pc_get_cxl_range_start(PCMachineState *pcms) return cxl_base; } -static uint64_t pc_get_cxl_range_end(PCMachineState *pcms) +static uint64_t pc_get_cxl_range_end(PcPciMachineState *ppms) { - PcPciMachineState *ppms = PC_PCI_MACHINE(pcms); - uint64_t start = pc_get_cxl_range_start(pcms) + MiB; + uint64_t start = pc_get_cxl_range_start(ppms) + MiB; if (ppms->cxl_devices_state.fixed_windows) { GList *it; @@ -937,7 +936,7 @@ void pc_memory_init(PCMachineState *pcms, MemoryRegion *mr = &ppms->cxl_devices_state.host_mr; hwaddr cxl_size = MiB; - cxl_base = pc_get_cxl_range_start(pcms); + cxl_base = pc_get_cxl_range_start(ppms); memory_region_init(mr, OBJECT(machine), "cxl_host_reg", cxl_size); memory_region_add_subregion(system_memory, cxl_base, mr); cxl_resv_end = cxl_base + cxl_size; @@ -1027,7 +1026,7 @@ uint64_t pc_pci_hole64_start(void) ram_addr_t size = 0; if (ppms->cxl_devices_state.is_enabled) { - hole64_start = pc_get_cxl_range_end(pcms); + hole64_start = pc_get_cxl_range_end(ppms); } else if (has_reserved_memory(pcms) && (ms->ram_size < ms->maxram_size)) { pc_get_device_memory_range(pcms, &hole64_start, &size); if (!pcmc->broken_reserved_end) { From patchwork Thu Mar 28 15:54:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13608865 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ECDD1CD1283 for ; Thu, 28 Mar 2024 15:59:10 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps7d-0005BG-IN; Thu, 28 Mar 2024 11:56: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 1rps7X-0004rr-OX for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:56:52 -0400 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps7V-0002ZL-Ta for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:56:51 -0400 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-a47385a4379so400335866b.0 for ; Thu, 28 Mar 2024 08:56:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641408; x=1712246208; 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=3Aa27ZqAQEFmCBsiqy9XwiiPf6EIjcNyjahGDi9IpJg=; b=wmdnFLj8N4MTTkR7GiUS/vACf4UOgkQnipJ9uaXGwtqukwJjWxXXHCpTdrIfMmaC9O vAypE0B0AyVCEO4LDMYLsR5ktjQUbduAPOUKkwgTeP1dmGemNlFXL6EgWk0yypiHpjP4 0CEe6VRJA2xvnxEtRM4RCH/WzVBdHHGEChi9ZcnQet88RxX4yS0m7M8FPyiLRct61ujf gJT1FBUa9UhqIn47HAdOSGJ8SZWQlmncRI9nHiC/oiBHJQkH4q9tZsrK0sQqGgf2tLY+ SPQ8Ov0ceOY0g2oqMNGevizgKfLCrYHFykaHasXTXJkyRK31ObzD1hDYYGn6a3eESre2 WZ1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641408; x=1712246208; 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=3Aa27ZqAQEFmCBsiqy9XwiiPf6EIjcNyjahGDi9IpJg=; b=Po2+yTlOWTJL6gSRXdkHm0NeTJCbbBXoqYQVIRV/16DPm2qoGho3W5/VlH3AAr8lKe FOHwjVBMFC3kGX9cUEBkxWXrfU7NOm8/hkiZ5/VJBs5m+T2eTWly3GYHmp5NAUKhG3cE EQT2tb4y4IQjX6AmNq6fqbJ73hU3sNWT8vGV4eFg79Npo54YNjJVB1CEO3bL9WgOXrPs TOdB4B0jzAkjhygU4pqBa9sn6yxLKOwwnVsVMAU37Of1TmNkEuEqYYEfo34m/JO3ABrl qKRYxMxyVi1U8ScM/q/eR5/6MwhP8rdOd5SesRI66KXgqQ7xCwn4fpE7OQzkjZYdtNcy DeSg== X-Gm-Message-State: AOJu0YxDFLwz1FoW26Neci2HmR1+l1uTKYa291+fJu90vW4yFizRyJUf UTfPGVbrjZNSxH1cUgf9l293XpgpqKz7SpluRcd7iORvVY6hwj1fG5E8XbZZ5YfVIdQNg1VFlWr L X-Google-Smtp-Source: AGHT+IGf+dMAnCAltiuzPzgchc+sbbW407Sj1dQczYyJgyomDKws4CVNCOW6jzbL55k6+JJbXoaF8w== X-Received: by 2002:a17:906:ccc3:b0:a47:1f61:4d02 with SMTP id ot3-20020a170906ccc300b00a471f614d02mr2207346ejb.36.1711641408058; Thu, 28 Mar 2024 08:56:48 -0700 (PDT) Received: from m1x-phil.lan (pas38-h02-176-184-5-52.dsl.sta.abo.bbox.fr. [176.184.5.52]) by smtp.gmail.com with ESMTPSA id u23-20020a170906125700b00a47522c193asm892212eja.196.2024.03.28.08.56.46 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 28 Mar 2024 08:56:47 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eduardo Habkost , Stefano Stabellini , xen-devel@lists.xenproject.org, Bernhard Beschow , Thomas Huth , Marcel Apfelbaum , "Michael S. Tsirkin" , Paolo Bonzini , Igor Mammedov , Anthony Perard , Ani Sinha , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [RFC PATCH-for-9.1 20/29] hw/i386/pc: Pass PcPciMachineState argument to pc_pci_hole64_start() Date: Thu, 28 Mar 2024 16:54:28 +0100 Message-ID: <20240328155439.58719-21-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240328155439.58719-1-philmd@linaro.org> References: <20240328155439.58719-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::636; envelope-from=philmd@linaro.org; helo=mail-ej1-x636.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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org pc_pci_hole64_start() is only used by PCI-based machines. Pass it a PcPciMachineState argument, removing a qdev_get_machine() call. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/i386/pc.h | 2 +- hw/i386/pc.c | 8 ++++---- hw/pci-host/i440fx.c | 2 +- hw/pci-host/q35.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index df4c813854..7da0bc8aa4 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -157,7 +157,7 @@ void pc_memory_init(PCMachineState *pcms, MemoryRegion *system_memory, MemoryRegion *rom_memory, uint64_t pci_hole64_size); -uint64_t pc_pci_hole64_start(void); +uint64_t pc_pci_hole64_start(PcPciMachineState *ppms); DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus); void pc_basic_device_init(struct PCMachineState *pcms, ISABus *isa_bus, qemu_irq *gsi, diff --git a/hw/i386/pc.c b/hw/i386/pc.c index d8e91d18b8..b83abee8e9 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -747,7 +747,8 @@ static hwaddr pc_max_used_gpa(PCMachineState *pcms, uint64_t pci_hole64_size) if (cpu->env.features[FEAT_8000_0001_EDX] & CPUID_EXT2_LM) { /* 64-bit systems */ - return pc_pci_hole64_start() + pci_hole64_size - 1; + PcPciMachineState *ppms = PC_PCI_MACHINE(pcms); + return pc_pci_hole64_start(ppms) + pci_hole64_size - 1; } /* 32-bit systems */ @@ -1016,11 +1017,10 @@ void pc_memory_init(PCMachineState *pcms, * The 64bit pci hole starts after "above 4G RAM" and * potentially the space reserved for memory hotplug. */ -uint64_t pc_pci_hole64_start(void) +uint64_t pc_pci_hole64_start(PcPciMachineState *ppms) { - PCMachineState *pcms = PC_MACHINE(qdev_get_machine()); + PCMachineState *pcms = PC_MACHINE(ppms); PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms); - PcPciMachineState *ppms = PC_PCI_MACHINE(pcms); MachineState *ms = MACHINE(pcms); uint64_t hole64_start = 0; ram_addr_t size = 0; diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c index 4f0a0438d7..add99e4f76 100644 --- a/hw/pci-host/i440fx.c +++ b/hw/pci-host/i440fx.c @@ -180,7 +180,7 @@ static uint64_t i440fx_pcihost_get_pci_hole64_start_value(Object *obj) pci_bus_get_w64_range(h->bus, &w64); value = range_is_empty(&w64) ? 0 : range_lob(&w64); if (!value && s->pci_hole64_fix) { - value = pc_pci_hole64_start(); + value = pc_pci_hole64_start(PC_PCI_MACHINE(qdev_get_machine())); } return value; } diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c index 0d7d4e3f08..baf55897b2 100644 --- a/hw/pci-host/q35.c +++ b/hw/pci-host/q35.c @@ -123,7 +123,7 @@ static uint64_t q35_host_get_pci_hole64_start_value(Object *obj) pci_bus_get_w64_range(h->bus, &w64); value = range_is_empty(&w64) ? 0 : range_lob(&w64); if (!value && s->pci_hole64_fix) { - value = pc_pci_hole64_start(); + value = pc_pci_hole64_start(PC_PCI_MACHINE(qdev_get_machine())); } return value; } From patchwork Thu Mar 28 15:54:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13608869 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AB38ACD1283 for ; Thu, 28 Mar 2024 15:59:25 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps7f-0005JN-Fm; Thu, 28 Mar 2024 11:56:59 -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 1rps7d-0005ER-Jz for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:56:57 -0400 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps7c-0002b0-3S for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:56:57 -0400 Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-a474c4faf5eso131227066b.2 for ; Thu, 28 Mar 2024 08:56:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641414; x=1712246214; 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=wAY/yw6dYKkUP/WFLvpvljjwD9mQwkPWyyzr0cq0w+A=; b=JNDl9J4SJDqRbZFQoGQNMvd+BkAqhAFqoy3Updafh0XZhndsPEsNvvJ92i3A1GANz9 2IaxJYrPLm/XIOop51q5ng/aF41/Ss1+CUbIjxqNX1W+Tex3R0tX9842dgQyrWJhU5dU bIxi1GkxYKHGcglj+dr96Qej8sunG5uNpeUZ3d57NydIe6pQRQnEzm4GXTW9x1nh+aTO 5qwQd2GzxIH5eAlrlHMlRPa5bHpVuNryDKsRziqerpWRxIOeFVUFRHMO+Lojqdj0bIfn mKL+Q/T4RWsZuPf5gqSfQ5SdUJXXiGSlonrgbW4FCkZIJTXnV4Wvp4+IWQs/Hd8K6Ct6 GmOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641414; x=1712246214; 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=wAY/yw6dYKkUP/WFLvpvljjwD9mQwkPWyyzr0cq0w+A=; b=DG8BllfpBT9cCqXNeaUiJrjM/+CY07/SJHI3OhyuEiMvyuLARbQvztCtpmgeUVRBIU sUrDJlpPYH6g4WjkNrHdMeDsNIBsJLtkAHdH0LqxYdJbPuuLCXKOB3wFIglhX7LwqY+J TvX2z+cCpPt5vV8PHYOg/B66xRT649Luwhj8kCVwmrC5wX9RvMIEbhpBylbbr57fDryE 4Xqo6mz9cYDAAZgib+/KTLUnf+lKsiprTeiJpYMEDod+9vxqGbVRaGrWJTLSPmQmAErk 2cAz0k9ueSVEkmmlR90Z3fAidw9p0UlwSzzUsmXgwocYIIexVspubtGKnLEIdMrHNir+ rpJA== X-Gm-Message-State: AOJu0YwLxf7un0NdYT3DuWtH1vpDQk8JhN7ICN4nsUPFad4CkpdQnZiT bBiQcGwbJFy7dvcl3EXZRs0Qlchj0ERkFll1u9VQFsZmGfT7Vw8Rpx4eIDzoQY0NolJmQ/8rFlt t X-Google-Smtp-Source: AGHT+IHHCjINc+B1WA7YTf9CDPOy43wJYCQL0voBiUNztEKWZkyjgtHiZiJjx/du9sQyScNWeJj6tg== X-Received: by 2002:a17:906:35d0:b0:a47:11a9:9038 with SMTP id p16-20020a17090635d000b00a4711a99038mr2127429ejb.58.1711641414401; Thu, 28 Mar 2024 08:56:54 -0700 (PDT) Received: from m1x-phil.lan (pas38-h02-176-184-5-52.dsl.sta.abo.bbox.fr. [176.184.5.52]) by smtp.gmail.com with ESMTPSA id x16-20020a170906135000b00a46ee3c31afsm884227ejb.154.2024.03.28.08.56.52 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 28 Mar 2024 08:56:54 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eduardo Habkost , Stefano Stabellini , xen-devel@lists.xenproject.org, Bernhard Beschow , Thomas Huth , Marcel Apfelbaum , "Michael S. Tsirkin" , Paolo Bonzini , Igor Mammedov , Anthony Perard , Ani Sinha , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [RFC PATCH-for-9.1 21/29] hw/i386/fw_cfg: Include missing 'qapi-types-machine.h' header Date: Thu, 28 Mar 2024 16:54:29 +0100 Message-ID: <20240328155439.58719-22-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240328155439.58719-1-philmd@linaro.org> References: <20240328155439.58719-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::635; envelope-from=philmd@linaro.org; helo=mail-ej1-x635.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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org "fw_cfg.h" declares fw_cfg_build_smbios() which use SmbiosEntryPointType, itself declared in "qapi-types-machine.h". void fw_cfg_build_smbios(PCMachineState *pcms, FWCfgState *fw_cfg, SmbiosEntryPointType ep_type); ^^^^^^^^^^^^^^^^^^^^ Signed-off-by: Philippe Mathieu-Daudé --- hw/i386/fw_cfg.h | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/i386/fw_cfg.h b/hw/i386/fw_cfg.h index 92e310f5fd..7a426119f8 100644 --- a/hw/i386/fw_cfg.h +++ b/hw/i386/fw_cfg.h @@ -12,6 +12,7 @@ #include "hw/boards.h" #include "hw/i386/pc.h" #include "hw/nvram/fw_cfg.h" +#include "qapi/qapi-types-machine.h" #define FW_CFG_IO_BASE 0x510 From patchwork Thu Mar 28 15:54:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13608868 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8CD8ACD1284 for ; Thu, 28 Mar 2024 15:59:11 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps7l-00068d-Pk; Thu, 28 Mar 2024 11:57:05 -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 1rps7k-0005wQ-4B for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:57:04 -0400 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps7i-0002ca-AN for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:57:03 -0400 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-a466e53f8c0so144806466b.1 for ; Thu, 28 Mar 2024 08:57:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641420; x=1712246220; 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=EBrGlAtp7IiqJxUt6Mnv7AOEnMWPJd0FVBqTzh3q09E=; b=I7d976MewaPvuYiDLCGsTimNZLPb8OOBAW6AroOgs3sUOA5qKr4UynSOrYTTjsWaYe A0nUtCh2qWsNaTPEr0xwY8lcIQD/tGYiJ9lTmigNh3taLsRyECwgBxkJjAu/HvnfEaux KZbwvNTt1SiaULh9SBNSqOHvVnmC4sio8LdEMmmzlRM+NeqnQBRm98C6d9sW7tOIrb7F aE+0CTowNqbfVE32ffNlPAn7ALg4y7aXQYF4fEikGBeeDnERnqL8Rje4N97fpMaZVXHK CIqglL7XCgnOVpv6gr7eDO9xrA6uw4p725mv+OIVAxc1TIetGTeueN89oLaYmvAhtpQA dD8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641420; x=1712246220; 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=EBrGlAtp7IiqJxUt6Mnv7AOEnMWPJd0FVBqTzh3q09E=; b=tlajuQVX6bBKgxTdSTj2/OuEi6OjjegVBGYFu4+dW+PIz5RN3VvVPOK2LLrC22SWcP glAbBO0S0sDIg7zxJLUtM0knCPNU01860Yzo27iwNmhEmzqOIFIqmvMsRtdS93rPTdHI w+bg+SG+uNZWbiwhhzbhTkFpfGvihfh04uKe+Mpwm3tK8af3Stzowbx89H3/swOp371d uJYjOjEcbxTMZ9fehPGPaAgSo5JieD7RWKmRojnvtK0+gXDtYvWPEVg1PdG7ACJe8BJF hhsENu+cw6kJ1GJdo6rgbP4emG50xqjz1hPotz88OBcWTsBdXWn+e0WltENuSFU6RWYN 7AHA== X-Gm-Message-State: AOJu0YypXam0aq6uEBXfbwuawSTs0TbfHdrnMr2dHJpjktQC3z5OkL59 5ZSnnyKBXoAJ387zT47qJt8+sMYUKZfRHabn8V+p3AaV8acJHCBOlMLExaLBM2+lwnXy1ge4fDA m X-Google-Smtp-Source: AGHT+IEOvg34oYcu9GAIHQIWSpLYGC94raSmAj67zD4Gs/B4BPRdpoH1JkHeTSn1iij0r48HVMXasQ== X-Received: by 2002:a17:906:3289:b0:a46:420f:8ecb with SMTP id 9-20020a170906328900b00a46420f8ecbmr1904346ejw.62.1711641420490; Thu, 28 Mar 2024 08:57:00 -0700 (PDT) Received: from m1x-phil.lan (pas38-h02-176-184-5-52.dsl.sta.abo.bbox.fr. [176.184.5.52]) by smtp.gmail.com with ESMTPSA id c7-20020a170906340700b00a468bf8586bsm906768ejb.174.2024.03.28.08.56.58 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 28 Mar 2024 08:57:00 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eduardo Habkost , Stefano Stabellini , xen-devel@lists.xenproject.org, Bernhard Beschow , Thomas Huth , Marcel Apfelbaum , "Michael S. Tsirkin" , Paolo Bonzini , Igor Mammedov , Anthony Perard , Ani Sinha , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [RFC PATCH-for-9.1 22/29] hw/i386/fw_cfg: Define fw_cfg_build_smbios() stub Date: Thu, 28 Mar 2024 16:54:30 +0100 Message-ID: <20240328155439.58719-23-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240328155439.58719-1-philmd@linaro.org> References: <20240328155439.58719-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62f; envelope-from=philmd@linaro.org; helo=mail-ej1-x62f.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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org We are going to refactor fw_cfg_build_smbios() in the next patches. In order to avoid too much #ifdef'ry in it, define a stub. Signed-off-by: Philippe Mathieu-Daudé --- hw/i386/fw_cfg-smbios-stub.c | 15 +++++++++++++++ hw/i386/fw_cfg.c | 4 ++-- hw/i386/meson.build | 1 + 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 hw/i386/fw_cfg-smbios-stub.c diff --git a/hw/i386/fw_cfg-smbios-stub.c b/hw/i386/fw_cfg-smbios-stub.c new file mode 100644 index 0000000000..37dbfdee7c --- /dev/null +++ b/hw/i386/fw_cfg-smbios-stub.c @@ -0,0 +1,15 @@ +/* + * QEMU fw_cfg/SMBIOS stubs + * + * SPDX-License-Identifier: GPL-2.0-or-later + * SPDX-FileCopyrightText: 2024 Linaro Ltd. + */ + +#include "qemu/osdep.h" +#include "hw/firmware/smbios.h" +#include "fw_cfg.h" + +void fw_cfg_build_smbios(PCMachineState *pcms, FWCfgState *fw_cfg, + SmbiosEntryPointType ep_type) +{ +} diff --git a/hw/i386/fw_cfg.c b/hw/i386/fw_cfg.c index ecc4047a4b..14a7dfbdc9 100644 --- a/hw/i386/fw_cfg.c +++ b/hw/i386/fw_cfg.c @@ -48,10 +48,10 @@ const char *fw_cfg_arch_key_name(uint16_t key) return NULL; } +#ifdef CONFIG_SMBIOS void fw_cfg_build_smbios(PCMachineState *pcms, FWCfgState *fw_cfg, SmbiosEntryPointType ep_type) { -#ifdef CONFIG_SMBIOS uint8_t *smbios_tables, *smbios_anchor; size_t smbios_tables_len, smbios_anchor_len; struct smbios_phys_mem_area *mem_array; @@ -100,8 +100,8 @@ void fw_cfg_build_smbios(PCMachineState *pcms, FWCfgState *fw_cfg, fw_cfg_add_file(fw_cfg, "etc/smbios/smbios-anchor", smbios_anchor, smbios_anchor_len); } -#endif } +#endif FWCfgState *fw_cfg_arch_create(MachineState *ms, uint16_t boot_cpus, diff --git a/hw/i386/meson.build b/hw/i386/meson.build index d8b70ef3e9..1a6e731196 100644 --- a/hw/i386/meson.build +++ b/hw/i386/meson.build @@ -6,6 +6,7 @@ i386_ss.add(files( 'multiboot.c', 'x86.c', )) +i386_ss.add(when: 'CONFIG_SMBIOS', if_false: files('fw_cfg-smbios-stub.c')) i386_ss.add(when: 'CONFIG_X86_IOMMU', if_true: files('x86-iommu.c'), if_false: files('x86-iommu-stub.c')) From patchwork Thu Mar 28 15:54:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13608820 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 868FFCD1283 for ; Thu, 28 Mar 2024 15:57:22 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps7r-0006m1-Fa; Thu, 28 Mar 2024 11:57:11 -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 1rps7p-0006ew-W8 for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:57:10 -0400 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps7o-0002hL-7c for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:57:09 -0400 Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-a2f22bfb4e6so155232066b.0 for ; Thu, 28 Mar 2024 08:57:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641426; x=1712246226; 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=4BSXB7GHW5TBQXIjnxuyxFyj9B1iDsM8cHi/htTyRxs=; b=bamZfs6ZpZARXoFfvhiYUlk8JTdEt5Hy6MRpnESxzdU/z6Xhk9ZW4tRux1pQNHonKj fRHLphy6mkLkdv+0zARX7iIv7teQaq4q0tqKQONQFCWjds3TRl40tHn+kg/N/sydP/9b BG5xAcbmxKc+Z9u901CL2g+8GVRWlGeRQEvn/u58yPKjf4W+YI+j77JYYgdMtbK8VdFG b7nAMQT0SVI6C+ejaWNoXtOkKnhEmXkgUHEx2ho1UtbK/McWUm0lhbmcV7FLsSvp28FV Fq8lyiaSRepRUUzzW3quXa0cZWdhyrly3UxSTYr5qbCS7zUkvnw7S2Mi8S3n1KjyliNI hYyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641426; x=1712246226; 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=4BSXB7GHW5TBQXIjnxuyxFyj9B1iDsM8cHi/htTyRxs=; b=DidA3cYSThwSF5F/irkkmopfVCh9sxPVHmGTFl5/7gIdCFm2B4afWxzMsujzcvadPD C40OUrNrMXCKSL4QYWbVvQVBsLjHgLEEkb9GAc/XN0lzOD42dV+4nUySSdwvCa9xVu1G pbJMmVtgAx6SDNkg9+3d6kayoQL6AT3cfoayUcWGEYcDecW26HPv5bEV9fg/00xWFO7d w4tTcZPuY24qaVTQZmcQtNRP29ij+IfFimcYzqvCVRFL930Aj9s0F6w2+dwB7p2vYi3N MBllRAnCW5ogTWg9w4WUNdd8Bnc04B+Ofpxwe7qBZGk+TTODJEiw6e3By4Gu7wN/FZP+ IyFA== X-Gm-Message-State: AOJu0YzxOQcoBjUgmVdOMo7qw8SSULlVRqBdgnMcF8BkC8FK2GWk9lF/ sBZlYAzkFNt/taaetqzqxxOgAR2ZH8ScU3GMVQ+O+lE3mJH7w5hpkz77Bi+l6mucBtTrALu+33s x X-Google-Smtp-Source: AGHT+IFF/skKWHNCTMPwJb+B2ckteIOxmThfN9+aMTRN8D0HIEaksr7NEcZ4nuV98VsFYsHsSKmB9w== X-Received: by 2002:a17:906:b112:b0:a47:1fe8:9825 with SMTP id u18-20020a170906b11200b00a471fe89825mr2020350ejy.32.1711641426506; Thu, 28 Mar 2024 08:57:06 -0700 (PDT) Received: from m1x-phil.lan (pas38-h02-176-184-5-52.dsl.sta.abo.bbox.fr. [176.184.5.52]) by smtp.gmail.com with ESMTPSA id f8-20020a17090624c800b00a46fbff47a6sm891626ejb.168.2024.03.28.08.57.04 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 28 Mar 2024 08:57:06 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eduardo Habkost , Stefano Stabellini , xen-devel@lists.xenproject.org, Bernhard Beschow , Thomas Huth , Marcel Apfelbaum , "Michael S. Tsirkin" , Paolo Bonzini , Igor Mammedov , Anthony Perard , Ani Sinha , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [RFC PATCH-for-9.1 23/29] hw/i386/fw_cfg: Inline smbios_defaults() Date: Thu, 28 Mar 2024 16:54:31 +0100 Message-ID: <20240328155439.58719-24-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240328155439.58719-1-philmd@linaro.org> References: <20240328155439.58719-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::630; envelope-from=philmd@linaro.org; helo=mail-ej1-x630.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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org All PCI-based machines have the smbios_defaults field set to %true. Simplify by using an inlined helper checking whether the machine is PCI-based or not. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/i386/pc.h | 1 - hw/i386/fw_cfg.c | 7 ++++++- hw/i386/pc.c | 1 - hw/i386/pc_piix.c | 1 - 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 7da0bc8aa4..6a6a8df005 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -86,7 +86,6 @@ typedef struct PCMachineClass { int default_cpu_version; /* SMBIOS compat: */ - bool smbios_defaults; bool smbios_legacy_mode; SmbiosEntryPointType default_smbios_ep_type; diff --git a/hw/i386/fw_cfg.c b/hw/i386/fw_cfg.c index 14a7dfbdc9..f60390ed56 100644 --- a/hw/i386/fw_cfg.c +++ b/hw/i386/fw_cfg.c @@ -49,6 +49,11 @@ const char *fw_cfg_arch_key_name(uint16_t key) } #ifdef CONFIG_SMBIOS +static bool smbios_defaults(PCMachineState *pcms) +{ + return pc_machine_is_pci_enabled(pcms); +} + void fw_cfg_build_smbios(PCMachineState *pcms, FWCfgState *fw_cfg, SmbiosEntryPointType ep_type) { @@ -61,7 +66,7 @@ void fw_cfg_build_smbios(PCMachineState *pcms, FWCfgState *fw_cfg, MachineClass *mc = MACHINE_GET_CLASS(pcms); X86CPU *cpu = X86_CPU(ms->possible_cpus->cpus[0].cpu); - if (pcmc->smbios_defaults) { + if (smbios_defaults(pcms)) { /* These values are guest ABI, do not change */ smbios_set_defaults("QEMU", mc->desc, mc->name); } diff --git a/hw/i386/pc.c b/hw/i386/pc.c index b83abee8e9..7a758a2e84 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1754,7 +1754,6 @@ static void pc_machine_class_init(ObjectClass *oc, void *data) PCMachineClass *pcmc = PC_MACHINE_CLASS(oc); HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc); - pcmc->smbios_defaults = true; pcmc->enforce_amd_1tb_hole = true; pcmc->pvh_enabled = true; pcmc->kvmclock_create_always = true; diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index e6178f8653..70dc8686f9 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -828,7 +828,6 @@ static void isapc_machine_options(MachineClass *m) m->max_cpus = 1; m->option_rom_has_mr = true; m->rom_file_has_mr = false; - pcmc->smbios_defaults = false; pcmc->smbios_legacy_mode = true; m->default_nic = "ne2k_isa"; m->default_cpu_type = X86_CPU_TYPE_NAME("486"); From patchwork Thu Mar 28 15:54:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13608870 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0B96FCD1283 for ; Thu, 28 Mar 2024 15:59:30 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps7y-0007Rb-Dg; Thu, 28 Mar 2024 11:57:18 -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 1rps7x-0007MZ-2h for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:57:17 -0400 Received: from mail-lj1-x232.google.com ([2a00:1450:4864:20::232]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps7v-0002iW-3e for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:57:16 -0400 Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2d6fd3cfaceso15191651fa.3 for ; Thu, 28 Mar 2024 08:57:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641433; x=1712246233; 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=Jd0AyxLTXxReg2ZsCl/5FvAkstq2JBvxx9RU6rO30AU=; b=YaFF0AYhEO9xz1ReqBDLs/SzLrEX6uR7FIH2m/OL6ZGlYI5GdQxGPeUMT6tfWs6gej hHW2nDMWDpnvFLs8Qn/LIcusd5DxibV+KA4lhjxoWpFmPNv5eq0DgBNqkiAbbVhlFFq5 OF2JFsiO+GG68sf5JiMmSDzJobveb3TOBdAmt5DXv7u8r6AZ3u59DBLBCM/go8SCGQ1M oeQlGbaevzdjmKvIATxdkiv7gvtOFrwVu2fw6HO46fLfYh67PdDCkhkzHzWoZaQ/It6N N/67bZNxx/MJ6rI3OYD1o07HDnjYQPyBlrjDJbBwa/TsDSrjOYcOr/0IgbE8EMQKut+v 4JUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641433; x=1712246233; 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=Jd0AyxLTXxReg2ZsCl/5FvAkstq2JBvxx9RU6rO30AU=; b=xLWLgQK0iGzkt/OBuoVIc8TO1Cwmggnj4U2VjJkDN1nGZ4Y5WJS5TRbLjxXWAxH90D q7KX1UXL0LWGCCZU0MpeI7lbx4DAsOLLeyJWgr0AIYCr+9D66m3ZblIsRrMfYu9q1eyN ptWU8hFs9Y3jFsv3tmKC4lje2vvSTMYrfKPn5NyIeNo0c58MkPy2bbcrEm59RMlnzVJM sC7GDsIM7v/awgEqTwRxOIgz3Ms/e/EUYeXLOYVmcY90h7Aw4zXXB4D5MWulZD0TSuqN j0O2byNU5BkX5aAhaYZzvy8ZrRjSRuiOia+jfIwS4gzi5aw2zO7T6eMug6NM+rLtlPF8 Xxbw== X-Gm-Message-State: AOJu0YzaPGnqShzTepMluOYUoy3GChIkJwYJ8Ze78mA7/ElVI0FUpCBB 1FDzwy1T0yAy3fgDDq1seQzTaDcjmRUZhvB6lkOHuwd50oXqD16WwLtvhx4vCU8Z7t6lZRfjCkD C X-Google-Smtp-Source: AGHT+IFp7sCXvlR7d3Mf8BzIjVT/t0rldZPHgrIbP67RUd/bNvgi6xSgjnnhBTrJNCeF2G5tN//CLg== X-Received: by 2002:a2e:a289:0:b0:2d3:5020:17e5 with SMTP id k9-20020a2ea289000000b002d3502017e5mr3152074lja.36.1711641432888; Thu, 28 Mar 2024 08:57:12 -0700 (PDT) Received: from m1x-phil.lan (pas38-h02-176-184-5-52.dsl.sta.abo.bbox.fr. [176.184.5.52]) by smtp.gmail.com with ESMTPSA id lh23-20020a170906f8d700b00a46ab5aaffcsm898765ejb.178.2024.03.28.08.57.11 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 28 Mar 2024 08:57:12 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eduardo Habkost , Stefano Stabellini , xen-devel@lists.xenproject.org, Bernhard Beschow , Thomas Huth , Marcel Apfelbaum , "Michael S. Tsirkin" , Paolo Bonzini , Igor Mammedov , Anthony Perard , Ani Sinha , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [RFC PATCH-for-9.1 24/29] hw/i386/fw_cfg: Inline smbios_legacy_mode() Date: Thu, 28 Mar 2024 16:54:32 +0100 Message-ID: <20240328155439.58719-25-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240328155439.58719-1-philmd@linaro.org> References: <20240328155439.58719-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::232; envelope-from=philmd@linaro.org; helo=mail-lj1-x232.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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org All PCI-based machines have the smbios_legacy_mode field set to %false. Simplify by using an inlined helper checking whether the machine is PCI-based or not. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/i386/pc.h | 1 - hw/i386/fw_cfg.c | 8 ++++++-- hw/i386/pc_piix.c | 2 -- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 6a6a8df005..6510914803 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -86,7 +86,6 @@ typedef struct PCMachineClass { int default_cpu_version; /* SMBIOS compat: */ - bool smbios_legacy_mode; SmbiosEntryPointType default_smbios_ep_type; /* RAM / address space compat: */ diff --git a/hw/i386/fw_cfg.c b/hw/i386/fw_cfg.c index f60390ed56..ffa60a4a33 100644 --- a/hw/i386/fw_cfg.c +++ b/hw/i386/fw_cfg.c @@ -54,6 +54,11 @@ static bool smbios_defaults(PCMachineState *pcms) return pc_machine_is_pci_enabled(pcms); } +static bool smbios_legacy_mode(PCMachineState *pcms) +{ + return !pc_machine_is_pci_enabled(pcms); +} + void fw_cfg_build_smbios(PCMachineState *pcms, FWCfgState *fw_cfg, SmbiosEntryPointType ep_type) { @@ -62,7 +67,6 @@ void fw_cfg_build_smbios(PCMachineState *pcms, FWCfgState *fw_cfg, struct smbios_phys_mem_area *mem_array; unsigned i, array_count; MachineState *ms = MACHINE(pcms); - PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms); MachineClass *mc = MACHINE_GET_CLASS(pcms); X86CPU *cpu = X86_CPU(ms->possible_cpus->cpus[0].cpu); @@ -74,7 +78,7 @@ void fw_cfg_build_smbios(PCMachineState *pcms, FWCfgState *fw_cfg, /* tell smbios about cpuid version and features */ smbios_set_cpuid(cpu->env.cpuid_version, cpu->env.features[FEAT_1_EDX]); - if (pcmc->smbios_legacy_mode) { + if (smbios_legacy_mode(pcms)) { smbios_tables = smbios_get_table_legacy(&smbios_tables_len, &error_fatal); fw_cfg_add_bytes(fw_cfg, FW_CFG_SMBIOS_ENTRIES, diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 70dc8686f9..4f07476cfa 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -823,12 +823,10 @@ DEFINE_I440FX_MACHINE(v2_4, "pc-i440fx-2.4", NULL, #ifdef CONFIG_ISAPC static void isapc_machine_options(MachineClass *m) { - PCMachineClass *pcmc = PC_MACHINE_CLASS(m); m->desc = "ISA-only PC"; m->max_cpus = 1; m->option_rom_has_mr = true; m->rom_file_has_mr = false; - pcmc->smbios_legacy_mode = true; m->default_nic = "ne2k_isa"; m->default_cpu_type = X86_CPU_TYPE_NAME("486"); m->no_parallel = !module_object_class_by_name(TYPE_ISA_PARALLEL); From patchwork Thu Mar 28 15:54:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13608866 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 02D1FCD1288 for ; Thu, 28 Mar 2024 15:59:10 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps85-0008Vc-7m; Thu, 28 Mar 2024 11:57:25 -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 1rps82-000859-Mh for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:57:22 -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 1rps81-0002j1-3F for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:57:22 -0400 Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-56c12c73ed8so1458494a12.2 for ; Thu, 28 Mar 2024 08:57:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641439; x=1712246239; 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=KZcClnRjP7+/0e8fY+P9N5bd75aoGZ6efgZZhKhlNAY=; b=TyCwPyPhRh1929UKMQEMeZoUubWRLkspcsSFjnqhDWUlPcH/U6+jL12lMi1grKFMtQ WqF4QZy9LZdPrlALfj1poub4jLN9TXkmSXe1CqSDCAAC9LjXJzNzK8zB6wjQPryXWo9D 9+b47+phR94y/+PXXF7zDQgMAA8jJ8QfsMDD11qIkrPIsS/udQ6mZB6I5I6v+gRDvLWY tyAN2H+b8T/bhYw02LAjI1E7B8PcNrkckLVaY0tKwqcXKyw30NO8dQ32+D/cLUK4/RPq DBFMR2kPVzPA/jdic3LmaFlsAsLg5e9BUDO9uoC30dO33gPDMaS4NMCa5BPH9BHNHkmE /3Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641439; x=1712246239; 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=KZcClnRjP7+/0e8fY+P9N5bd75aoGZ6efgZZhKhlNAY=; b=JXScT5z1ZCU9UZ/nc81ioDi0lcfgewo2KkEeN+w/bUNDz6PCSg4jCiwwim9Adfk43K DEpXLBRPhqdCj5lH6Zq8YQPsl0iwkHCf3Hffc9NdGkVy/XbVqwRg6DIIlY40gZtpsaZ4 hJtiRsXC1EjqrJma3LWMPOeJ4ojqKK03lCuCIu9rIKFpVd4hJowDwNX3IBkgUbd9cQUJ p0k+7i4Yr6LMLJBsFElAFbTHjngU7MHuz/jCzQ72FO2zEe9oCi6qiMz56nPqPZ0XpBkw A73oknZQJkTCK/SNbKw6as/15XG6cZ8B5MhgtrwMGh4Bwm323zJN0noFBN4ZcgbM3KAH obSQ== X-Gm-Message-State: AOJu0YwYHKMer+xJJpqleHyqOmuBVJJtz3q+LuP6Mqvr8YVNzCleunAE b4udpCyGA2HGXNNBlqz98Ru3KBGXUYCNyh8l+sODTdXeRmz333ZH6ZqIc7DBcmKKTgCfb+Gq0Ew d X-Google-Smtp-Source: AGHT+IFt2sBCHTR2Jv1SbwhNWwKdKTxoa7hJqsQNpLxVlwdOrAYikOdlndg+94qQnyUkEffbEuTZKw== X-Received: by 2002:a17:907:971c:b0:a46:a1d0:8451 with SMTP id jg28-20020a170907971c00b00a46a1d08451mr2602412ejc.16.1711641439232; Thu, 28 Mar 2024 08:57:19 -0700 (PDT) Received: from m1x-phil.lan (pas38-h02-176-184-5-52.dsl.sta.abo.bbox.fr. [176.184.5.52]) by smtp.gmail.com with ESMTPSA id eb16-20020a170907281000b00a4e0df9e793sm887845ejc.136.2024.03.28.08.57.17 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 28 Mar 2024 08:57:18 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eduardo Habkost , Stefano Stabellini , xen-devel@lists.xenproject.org, Bernhard Beschow , Thomas Huth , Marcel Apfelbaum , "Michael S. Tsirkin" , Paolo Bonzini , Igor Mammedov , Anthony Perard , Ani Sinha , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [RFC PATCH-for-9.1 25/29] hw/i386/fw_cfg: Replace smbios_defaults() by !smbios_legacy_mode() Date: Thu, 28 Mar 2024 16:54:33 +0100 Message-ID: <20240328155439.58719-26-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240328155439.58719-1-philmd@linaro.org> References: <20240328155439.58719-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::533; envelope-from=philmd@linaro.org; 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, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org smbios_defaults() and smbios_legacy_mode() are logical opposite. Simplify using the latter. Signed-off-by: Philippe Mathieu-Daudé --- hw/i386/fw_cfg.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/hw/i386/fw_cfg.c b/hw/i386/fw_cfg.c index ffa60a4a33..df05fe060c 100644 --- a/hw/i386/fw_cfg.c +++ b/hw/i386/fw_cfg.c @@ -49,11 +49,6 @@ const char *fw_cfg_arch_key_name(uint16_t key) } #ifdef CONFIG_SMBIOS -static bool smbios_defaults(PCMachineState *pcms) -{ - return pc_machine_is_pci_enabled(pcms); -} - static bool smbios_legacy_mode(PCMachineState *pcms) { return !pc_machine_is_pci_enabled(pcms); @@ -70,7 +65,7 @@ void fw_cfg_build_smbios(PCMachineState *pcms, FWCfgState *fw_cfg, MachineClass *mc = MACHINE_GET_CLASS(pcms); X86CPU *cpu = X86_CPU(ms->possible_cpus->cpus[0].cpu); - if (smbios_defaults(pcms)) { + if (!smbios_legacy_mode(pcms)) { /* These values are guest ABI, do not change */ smbios_set_defaults("QEMU", mc->desc, mc->name); } From patchwork Thu Mar 28 15:54:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13608875 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3D947CD1283 for ; Thu, 28 Mar 2024 16:01:11 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps8A-0000fO-Mg; Thu, 28 Mar 2024 11:57:30 -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 1rps89-0000TB-3U for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:57:29 -0400 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps87-0002l0-8d for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:57:28 -0400 Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-a466fc8fcccso150255666b.1 for ; Thu, 28 Mar 2024 08:57:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641445; x=1712246245; 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=9JGjTd1WToEahvAfY8NVbIAQ8SXrGvIMBj7UnII/d+c=; b=tlzTTWfdU3qU6qSN81Ar6w+u/pQDI1vqH0ikHLsAxcPhGNj8J9NQRlEDHc2ERjal7l R5QBfGLIxZcSitdvJFhhR0KOnDNdZB8ROLzT3/vmjk/vkGmV5wiFdXbS7Br6pQ4FWvFJ Qc+z90m5v3Uv+n8Hn2yn6e9C/P8+sKBvxhgQZMsH14JROgo0vfs46hWsJVxAL7+Np2hk cKwQ8W89d7F4+CpYEXTSjvz1kXPa+aUTl07NpwcgeSfctCLIIemxG/uY/jUYb2MuIjSf GasRWq+t0YcOJw+Vu962XS1v+iWnpwnTy/8fBMWLXe6OykCPxqioVhVwYpHRnI0xameS TKtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641445; x=1712246245; 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=9JGjTd1WToEahvAfY8NVbIAQ8SXrGvIMBj7UnII/d+c=; b=RF+OvI4rZsnGl6Y8EYB1bQG+DHdKcNwr6uFtMTT4tHVfsbs5yp1Jxdxn718qL3O4xl kp33VfvNYJTlMlp32dAkaGx/piWdxJ24pP1HGcw5ThokzPVMQqotDr+8JEDx1tuAC+OW uIf33bFBwaIbx5xrmqYl6F3K8oGUnqy/dy3P+t5sl97Hi+WRD0HMtav16fQMF8rvubjK eS7YvZJfT3Ziwp/H8LQ91tIGDe1gitTGIrgp7eRl8pc6kScSmVIsx1b887x6vNLIc3OI pDTuMzMwjGVnVlxH4fSXMXMoX5rjBQnoFpMxEvSN+ILWI8RBiX+XQg281iMop58LgVhK 9eRw== X-Gm-Message-State: AOJu0Ywn59rLMmfPA0yP93jqMdA8aTyZYbB2tkuk0Lz4J2pwu5Vq/8rP schrc3k4hOrV5xFCfre+rGX3i3f9CGsp9QHXnXUmFtJMivDuhHxZO24iTlTQmckdgOfwl0iTpEG 9 X-Google-Smtp-Source: AGHT+IEke0w2rGaQ9eaNpJe9RsSUrMNnkosA5ZqUCdCrrEsx8n7A8+12nHMQifWFPzkMKHDz/PJUtg== X-Received: by 2002:a17:907:7d89:b0:a47:5265:9aac with SMTP id oz9-20020a1709077d8900b00a4752659aacmr2577836ejc.55.1711641445324; Thu, 28 Mar 2024 08:57:25 -0700 (PDT) Received: from m1x-phil.lan (pas38-h02-176-184-5-52.dsl.sta.abo.bbox.fr. [176.184.5.52]) by smtp.gmail.com with ESMTPSA id k13-20020a1709067acd00b00a47df55cf5esm914850ejo.13.2024.03.28.08.57.23 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 28 Mar 2024 08:57:24 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eduardo Habkost , Stefano Stabellini , xen-devel@lists.xenproject.org, Bernhard Beschow , Thomas Huth , Marcel Apfelbaum , "Michael S. Tsirkin" , Paolo Bonzini , Igor Mammedov , Anthony Perard , Ani Sinha , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [RFC PATCH-for-9.1 26/29] hw/i386/fw_cfg: Factor fw_cfg_build_smbios_legacy() out Date: Thu, 28 Mar 2024 16:54:34 +0100 Message-ID: <20240328155439.58719-27-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240328155439.58719-1-philmd@linaro.org> References: <20240328155439.58719-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62d; envelope-from=philmd@linaro.org; helo=mail-ej1-x62d.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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Factor fw_cfg_build_smbios_legacy() out of fw_cfg_build_smbios(). Signed-off-by: Philippe Mathieu-Daudé --- hw/i386/fw_cfg.h | 1 + hw/i386/fw_cfg-smbios-stub.c | 4 ++++ hw/i386/fw_cfg.c | 33 ++++++++++++++++++++++----------- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/hw/i386/fw_cfg.h b/hw/i386/fw_cfg.h index 7a426119f8..25ce86ec1b 100644 --- a/hw/i386/fw_cfg.h +++ b/hw/i386/fw_cfg.h @@ -24,6 +24,7 @@ FWCfgState *fw_cfg_arch_create(MachineState *ms, uint16_t boot_cpus, uint16_t apic_id_limit); +void fw_cfg_build_smbios_legacy(PCMachineState *pcms, FWCfgState *fw_cfg); void fw_cfg_build_smbios(PCMachineState *pcms, FWCfgState *fw_cfg, SmbiosEntryPointType ep_type); void fw_cfg_build_feature_control(MachineState *ms, FWCfgState *fw_cfg); diff --git a/hw/i386/fw_cfg-smbios-stub.c b/hw/i386/fw_cfg-smbios-stub.c index 37dbfdee7c..da00ffc9ae 100644 --- a/hw/i386/fw_cfg-smbios-stub.c +++ b/hw/i386/fw_cfg-smbios-stub.c @@ -13,3 +13,7 @@ void fw_cfg_build_smbios(PCMachineState *pcms, FWCfgState *fw_cfg, SmbiosEntryPointType ep_type) { } + +void fw_cfg_build_smbios_legacy(PCMachineState *pcms, FWCfgState *fw_cfg) +{ +} diff --git a/hw/i386/fw_cfg.c b/hw/i386/fw_cfg.c index df05fe060c..be37e28f46 100644 --- a/hw/i386/fw_cfg.c +++ b/hw/i386/fw_cfg.c @@ -54,6 +54,22 @@ static bool smbios_legacy_mode(PCMachineState *pcms) return !pc_machine_is_pci_enabled(pcms); } +void fw_cfg_build_smbios_legacy(PCMachineState *pcms, FWCfgState *fw_cfg) +{ + uint8_t *smbios_tables; + size_t smbios_tables_len; + MachineState *ms = MACHINE(pcms); + X86CPU *cpu = X86_CPU(ms->possible_cpus->cpus[0].cpu); + + /* tell smbios about cpuid version and features */ + smbios_set_cpuid(cpu->env.cpuid_version, cpu->env.features[FEAT_1_EDX]); + + smbios_tables = smbios_get_table_legacy(&smbios_tables_len, + &error_fatal); + fw_cfg_add_bytes(fw_cfg, FW_CFG_SMBIOS_ENTRIES, + smbios_tables, smbios_tables_len); +} + void fw_cfg_build_smbios(PCMachineState *pcms, FWCfgState *fw_cfg, SmbiosEntryPointType ep_type) { @@ -65,22 +81,17 @@ void fw_cfg_build_smbios(PCMachineState *pcms, FWCfgState *fw_cfg, MachineClass *mc = MACHINE_GET_CLASS(pcms); X86CPU *cpu = X86_CPU(ms->possible_cpus->cpus[0].cpu); - if (!smbios_legacy_mode(pcms)) { - /* These values are guest ABI, do not change */ - smbios_set_defaults("QEMU", mc->desc, mc->name); + if (smbios_legacy_mode(pcms)) { + fw_cfg_build_smbios_legacy(pcms, fw_cfg); + return; } + /* These values are guest ABI, do not change */ + smbios_set_defaults("QEMU", mc->desc, mc->name); + /* tell smbios about cpuid version and features */ smbios_set_cpuid(cpu->env.cpuid_version, cpu->env.features[FEAT_1_EDX]); - if (smbios_legacy_mode(pcms)) { - smbios_tables = smbios_get_table_legacy(&smbios_tables_len, - &error_fatal); - fw_cfg_add_bytes(fw_cfg, FW_CFG_SMBIOS_ENTRIES, - smbios_tables, smbios_tables_len); - return; - } - /* build the array of physical mem area from e820 table */ mem_array = g_malloc0(sizeof(*mem_array) * e820_get_num_entries()); for (i = 0, array_count = 0; i < e820_get_num_entries(); i++) { From patchwork Thu Mar 28 15:54:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13608872 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 51DC5CD11DD for ; Thu, 28 Mar 2024 15:59:48 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps8H-00019r-0F; Thu, 28 Mar 2024 11:57:37 -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 1rps8E-00011d-TP for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:57:35 -0400 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps8D-0002mw-A7 for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:57:34 -0400 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-a47385a4379so400471666b.0 for ; Thu, 28 Mar 2024 08:57:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641451; x=1712246251; 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=OhT6+kuDArhB7vl7wmlOYwb5F71/kFsimohZE69/WJ4=; b=wPfi4xDZ+OZFr0EK/9vhFd4a6Bhqsc0O6HVjX/5tm+KZQFDfb8HqSLFpGWpfcSiTGX eoQZQFMUonQ7Kpd6AAtKo4zHR9uJTIu0GpJXDKTmBvyX3+0Nx+qklnGkoQntyIJCEUbj 1Wdb21INEXISlrRDVMC8Kxr7dvgqV2mr6/Op3SIF0sIs8SLo9Lp01Y92zkoYi7dSd/Li ptxzP7KyVmegtwYntW7/o8jvB2JTOt46TZ8A8qfOkGPuxAF/oxd+FwJKdt0M0l28MWpq ldmXtv/0QRociJA7vO+gnBaq9l86GD+95aXa6KceEA2CrxsVIh5lIYzNNlhRNhxsPSPc zIEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641451; x=1712246251; 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=OhT6+kuDArhB7vl7wmlOYwb5F71/kFsimohZE69/WJ4=; b=lpNbOPh9/LQB++w3aVUA9aF2wIB9ybXfcj8ItCiPvK/rWY61gPRnan6R/BAPhx6lKJ 3hq76PAoQIGSXkwJQhbDjEWTozV5HAp51X3AlsFI9I++UTVVbWDWN2o55JhKFF/fvJIw 8BBYbslXA7Wl8aYwoCv9KiupHdrLQn/b8zYaRWhuor+uyeZcTTfpgt4bEv8A3GFxHxqN g+1IeNGQJaRm446PPifLNh7E/Xr+zyUQnzdgbpclvg4FTz2SkObQdwFgXeyIb0ft7xtb VobCNZSPWGTHjC7S3Nolk+/bC+mZ0xmMl6UB4i64RcZfSt5OFlxHjAwNOACx/yO5KWGl YKbg== X-Gm-Message-State: AOJu0YzBsZpiKngVj3I9Iy7SGEb4iU4E1bUc2a3KZ2YaTa6XL6YdplNf +wRcjRrCxrS389L6jiAjkxv0R/uRx3BLwKiWM6yn1/ojZEAzhN20qOBcQzIwNhBBwRWMOkmy5a4 u X-Google-Smtp-Source: AGHT+IE5iPw2wKGziuJIAfhXkqj1URHuVnsVTHRuhgnnHINXGtkc2NpEDzBwrK/9AluQ+8R3bvD5jA== X-Received: by 2002:a17:906:48d7:b0:a45:ab98:aec with SMTP id d23-20020a17090648d700b00a45ab980aecmr2166613ejt.10.1711641451420; Thu, 28 Mar 2024 08:57:31 -0700 (PDT) Received: from m1x-phil.lan (pas38-h02-176-184-5-52.dsl.sta.abo.bbox.fr. [176.184.5.52]) by smtp.gmail.com with ESMTPSA id o19-20020a17090637d300b00a46cc48ab07sm894776ejc.221.2024.03.28.08.57.29 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 28 Mar 2024 08:57:31 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eduardo Habkost , Stefano Stabellini , xen-devel@lists.xenproject.org, Bernhard Beschow , Thomas Huth , Marcel Apfelbaum , "Michael S. Tsirkin" , Paolo Bonzini , Igor Mammedov , Anthony Perard , Ani Sinha , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [RFC PATCH-for-9.1 27/29] hw/i386/pc: Call fw_cfg_build_smbios_legacy() in pc_machine_done() Date: Thu, 28 Mar 2024 16:54:35 +0100 Message-ID: <20240328155439.58719-28-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240328155439.58719-1-philmd@linaro.org> References: <20240328155439.58719-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62f; envelope-from=philmd@linaro.org; helo=mail-ej1-x62f.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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Keep fw_cfg_build_smbios() for PCI-based machines, call fw_cfg_build_smbios_legacy() directly from pc_machine_done(). Signed-off-by: Philippe Mathieu-Daudé --- hw/i386/fw_cfg.c | 10 ---------- hw/i386/pc.c | 12 +++++++++++- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/hw/i386/fw_cfg.c b/hw/i386/fw_cfg.c index be37e28f46..92e058446f 100644 --- a/hw/i386/fw_cfg.c +++ b/hw/i386/fw_cfg.c @@ -49,11 +49,6 @@ const char *fw_cfg_arch_key_name(uint16_t key) } #ifdef CONFIG_SMBIOS -static bool smbios_legacy_mode(PCMachineState *pcms) -{ - return !pc_machine_is_pci_enabled(pcms); -} - void fw_cfg_build_smbios_legacy(PCMachineState *pcms, FWCfgState *fw_cfg) { uint8_t *smbios_tables; @@ -81,11 +76,6 @@ void fw_cfg_build_smbios(PCMachineState *pcms, FWCfgState *fw_cfg, MachineClass *mc = MACHINE_GET_CLASS(pcms); X86CPU *cpu = X86_CPU(ms->possible_cpus->cpus[0].cpu); - if (smbios_legacy_mode(pcms)) { - fw_cfg_build_smbios_legacy(pcms, fw_cfg); - return; - } - /* These values are guest ABI, do not change */ smbios_set_defaults("QEMU", mc->desc, mc->name); diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 7a758a2e84..7d06a088cf 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -591,6 +591,11 @@ void pc_acpi_smi_interrupt(void *opaque, int irq, int level) } } +static bool smbios_legacy_mode(PCMachineState *pcms) +{ + return !pc_machine_is_pci_enabled(pcms); +} + static void pc_machine_done(Notifier *notifier, void *data) { @@ -602,7 +607,12 @@ void pc_machine_done(Notifier *notifier, void *data) x86_rtc_set_cpus_count(x86ms->rtc, x86ms->boot_cpus); if (x86ms->fw_cfg) { - fw_cfg_build_smbios(pcms, x86ms->fw_cfg, pcms->smbios_entry_point_type); + if (smbios_legacy_mode(pcms)) { + fw_cfg_build_smbios_legacy(pcms, x86ms->fw_cfg); + } else { + fw_cfg_build_smbios(pcms, x86ms->fw_cfg, + pcms->smbios_entry_point_type); + } fw_cfg_build_feature_control(MACHINE(pcms), x86ms->fw_cfg); /* update FW_CFG_NB_CPUS to account for -device added CPUs */ fw_cfg_modify_i16(x86ms->fw_cfg, FW_CFG_NB_CPUS, x86ms->boot_cpus); From patchwork Thu Mar 28 15:54:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13608877 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B24CCCD11DD for ; Thu, 28 Mar 2024 16:01:14 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps8X-0001ei-70; Thu, 28 Mar 2024 11:57:54 -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 1rps8L-0001KC-Ir for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:57:43 -0400 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps8J-0002ny-Rx for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:57:41 -0400 Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-56be32b9775so1376425a12.1 for ; Thu, 28 Mar 2024 08:57:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641458; x=1712246258; 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=WrzkMtkcnF1yss3niHYQFeUj6lW7JvFYG513ZWQp60s=; b=uIgXU92Ol/NISoRgpNbzf/PzWEwBgS3/kVomi69bd5HXFLehCuA3Afao1WjECHViPF Cnkfnb7ihYF9IrUjgsom4QAbZxpwDE6CqMYds/+sDDnM1oEzgt5F6dLuZcHvz3erkJJS wG8zE10FrhUGKDIDtxtUEVaWBrN+99eT254X8mIZV3CNuaNipG0eag5TwlTOG8JLO9k5 96DeHATjs3LvNAyutPTQ9f4YSVeRn9rQsyCEw7qM9ugyGHt9T/QljWOoyd6rvr5WilTc SSnVHVz94s9UkPsLVqd/S3f/RgFgSFg+/ph8KfZ7Eim92gOMxb6Nnr52Zht6Kerr+oaS nUtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641458; x=1712246258; 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=WrzkMtkcnF1yss3niHYQFeUj6lW7JvFYG513ZWQp60s=; b=vEv1yVhmlUmQd3IoS9o0NJ67fQZGBiNRMezeUOIEZyUMCLeO7FmW/Ve2jTP3UwM5RE vdI3iUS+Wg4ij5gKuOQ3Elai91FM7DIBbHcqDJbTpj0KB5iJf0l78gYbOfFBPhgNQbyq TastFBpLyJ6a4c022MMGXOv5gB9hXzw1/A97muVE2eZNn8IeUMm45BKa92UgksQSoWeR 1QP0KbUsxCeqhKTY9g/yLkcInwrNTwhAhqbnWe9Cv5r643skvuwOImafsVohtJ6RbrKt uUpcLyNJi6eFt5Iv1yBdhtLz2RbNeCXH8fzyjQ5swafje8bo8I70wprkbIwoBUeonNER J79A== X-Gm-Message-State: AOJu0Yy5QdshH5bLce00GOrE7cwClqRjIJDEbCOFLlFG4Sc0xvr4SQyE wOKirrFWtGK+CtHS8U7jlX4p11ycQ+sYl8yCqN89LiWB2B49VbgWdnCeNSbvaeE36N9S55y9boN d X-Google-Smtp-Source: AGHT+IEc3JVavZ6Yb+b8wnDqhR3/uKAR+Oeu24avwh9VyWUhM3fQrZfwqOBt+dWLPG1vVVlO5yf/BQ== X-Received: by 2002:a50:9b0b:0:b0:56b:dce0:c795 with SMTP id o11-20020a509b0b000000b0056bdce0c795mr2044180edi.4.1711641458009; Thu, 28 Mar 2024 08:57:38 -0700 (PDT) Received: from m1x-phil.lan (pas38-h02-176-184-5-52.dsl.sta.abo.bbox.fr. [176.184.5.52]) by smtp.gmail.com with ESMTPSA id ek25-20020a056402371900b0056bdc4a5cd6sm959160edb.62.2024.03.28.08.57.35 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 28 Mar 2024 08:57:37 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eduardo Habkost , Stefano Stabellini , xen-devel@lists.xenproject.org, Bernhard Beschow , Thomas Huth , Marcel Apfelbaum , "Michael S. Tsirkin" , Paolo Bonzini , Igor Mammedov , Anthony Perard , Ani Sinha , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Aurelien Jarno , =?utf-8?q?Herv=C3=A9_Poussineau?= Subject: [RFC PATCH-for-9.1 28/29] hw/i386/pc: Rename pc_init1() -> pc_piix_init() Date: Thu, 28 Mar 2024 16:54:36 +0100 Message-ID: <20240328155439.58719-29-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240328155439.58719-1-philmd@linaro.org> References: <20240328155439.58719-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::534; envelope-from=philmd@linaro.org; helo=mail-ed1-x534.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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org pc_init1() is specific to the isapc and i440fx/piix machines, rename it as pc_piix_init(). Expose it in "hw/i386/pc.h" to be able to call it externally (see next patch). Signed-off-by: Philippe Mathieu-Daudé --- include/hw/i386/pc.h | 1 + hw/i386/pc_piix.c | 8 ++++---- hw/isa/piix.c | 2 +- hw/pci-host/i440fx.c | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 6510914803..9a11835b7e 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -163,6 +163,7 @@ void pc_basic_device_init(struct PCMachineState *pcms, bool create_fdctrl, uint32_t hpet_irqs); void pc_nic_init(PCMachineClass *pcmc, ISABus *isa_bus, PCIBus *pci_bus); +void pc_piix_init(MachineState *machine, const char *pci_type); void pc_i8259_create(ISABus *isa_bus, qemu_irq *i8259_irqs); diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 4f07476cfa..4a3ae72fe4 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -111,7 +111,7 @@ static bool gigabyte_align(PCMachineState *pcms) } /* PC hardware initialisation */ -static void pc_init1(MachineState *machine, const char *pci_type) +void pc_piix_init(MachineState *machine, const char *pci_type) { PCMachineState *pcms = PC_MACHINE(machine); PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms); @@ -437,7 +437,7 @@ static void pc_set_south_bridge(Object *obj, int value, Error **errp) #ifdef CONFIG_ISAPC static void pc_init_isa(MachineState *machine) { - pc_init1(machine, NULL); + pc_piix_init(machine, NULL); } #endif @@ -447,7 +447,7 @@ static void pc_xen_hvm_init_pci(MachineState *machine) const char *pci_type = xen_igd_gfx_pt_enabled() ? TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE : TYPE_I440FX_PCI_DEVICE; - pc_init1(machine, pci_type); + pc_piix_init(machine, pci_type); } static void pc_xen_hvm_init(MachineState *machine) @@ -472,7 +472,7 @@ static void pc_xen_hvm_init(MachineState *machine) if (compat) { \ compat(machine); \ } \ - pc_init1(machine, TYPE_I440FX_PCI_DEVICE); \ + pc_piix_init(machine, TYPE_I440FX_PCI_DEVICE); \ } \ DEFINE_PC_MACHINE(suffix, name, pc_init_##suffix, optionfn, \ TYPE_PC_PCI_MACHINE) diff --git a/hw/isa/piix.c b/hw/isa/piix.c index 2d30711b17..14dc9e78be 100644 --- a/hw/isa/piix.c +++ b/hw/isa/piix.c @@ -432,7 +432,7 @@ static void pci_piix_class_init(ObjectClass *klass, void *data) k->class_id = PCI_CLASS_BRIDGE_ISA; /* * Reason: part of PIIX southbridge, needs to be wired up by e.g. - * pc_piix.c's pc_init1() + * pc_piix.c's pc_piix_init() */ dc->user_creatable = false; device_class_set_props(dc, pci_piix_props); diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c index add99e4f76..9f47d5507a 100644 --- a/hw/pci-host/i440fx.c +++ b/hw/pci-host/i440fx.c @@ -374,7 +374,7 @@ static void i440fx_pcihost_class_init(ObjectClass *klass, void *data) dc->realize = i440fx_pcihost_realize; dc->fw_name = "pci"; device_class_set_props(dc, i440fx_props); - /* Reason: needs to be wired up by pc_init1 */ + /* Reason: needs to be wired up by pc_piix_init */ dc->user_creatable = false; object_class_property_add(klass, PCI_HOST_PROP_PCI_HOLE_START, "uint32", From patchwork Thu Mar 28 15:54:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13608871 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7D903CD1283 for ; Thu, 28 Mar 2024 15:59:45 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps8Z-0001ni-Uq; Thu, 28 Mar 2024 11:57:56 -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 1rps8R-0001Wt-VC for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:57:48 -0400 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps8Q-0002pM-3j for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:57:47 -0400 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-56bb22ff7baso1289250a12.3 for ; Thu, 28 Mar 2024 08:57:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641464; x=1712246264; 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=K6394pyfYpf5VBXUXIwRMOR2ZbX+o8CbfYrADQtuSgY=; b=jhd29j4MdfwOf113zIcv8UX2buDkfsD4w6qamHe3Z57LvS0+lYQ2reoVjpM1L6bY7x CNDLuowdOkZrj4PvzFecJvhHUL8tT4sSNKS9LFdBQLz7sARYfd45Y5FPuLiLEtVl2H59 2/B9J879qAk1mvWzYMSiJlvNm22orYnWbRWhFgTrTOQblhOA0pVU4lNaBDqkAXmJMouS aAYZIF8k7KvPwmImynj6vTvlLDAXyEIaxl/6GbhrBdE7wrgHj1leI8HDmzbpEQGOr0CJ mDNxQBxbhl6P+JCTlHPPcOWAFjmFMZGQZtB/O5NFOD+yR3wRz0D5OEE5oqiCXx3XK/Qo 6QHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641464; x=1712246264; 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=K6394pyfYpf5VBXUXIwRMOR2ZbX+o8CbfYrADQtuSgY=; b=hPEL4I926jpNAMpKOGEXvA0DDuzBszvO4xp26DRxtnLBigzI9yOF7QJgk0t9xkoQZO Bnkt0VGmpT/z/JECSMkko6bKojHRFKq/M4L398+ASHOy4TP9Wh/bLGvmJu7RpvMLTEZ3 ER+WMfC8PBmOCd5tMvYNxTZSdgW6PiFuFSBUptrvI/ovrAk0C22FpUZh1+HzxtQJSVyA dCF/sz+SZdOIhd/U6/r4VOOwv1NT+hK/7AnL7r/yNTPdo8y7nXvzc/SLUV5WdaNdOpni kXTtNEPtj/OcPZQBd04PL53EgNxp8AcGh2gSAmZdeSfIgxO8A1fnbXx5yhioANa9TYtU GzCw== X-Gm-Message-State: AOJu0YzpfXJwPlwKZ7NcbqZ05wrPCpBGa5paLg8XQmRxua4nRfjbqdo4 aq9uNzFKQpyRfHxlrPH5MU3CbqBqmD7llTDHBYlVgmf5uN/zk7FdUmAFBsxaaFwMQMQk5uMKS8J y X-Google-Smtp-Source: AGHT+IHopSZ4mG4FmVwZwRyY4uEq7A+kY6caw0K60z5ZjV+GdO0roOAWBLEuOIrEv1csN4Rr2G6Jmg== X-Received: by 2002:a50:d750:0:b0:565:e610:c358 with SMTP id i16-20020a50d750000000b00565e610c358mr2278668edj.38.1711641464364; Thu, 28 Mar 2024 08:57:44 -0700 (PDT) Received: from m1x-phil.lan (pas38-h02-176-184-5-52.dsl.sta.abo.bbox.fr. [176.184.5.52]) by smtp.gmail.com with ESMTPSA id p12-20020a50c94c000000b005689bfe2688sm980668edh.39.2024.03.28.08.57.42 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 28 Mar 2024 08:57:43 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eduardo Habkost , Stefano Stabellini , xen-devel@lists.xenproject.org, Bernhard Beschow , Thomas Huth , Marcel Apfelbaum , "Michael S. Tsirkin" , Paolo Bonzini , Igor Mammedov , Anthony Perard , Ani Sinha , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [RFC PATCH-for-9.1 29/29] hw/i386/pc: Move ISA-only PC machine to pc_isa.c Date: Thu, 28 Mar 2024 16:54:37 +0100 Message-ID: <20240328155439.58719-30-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240328155439.58719-1-philmd@linaro.org> References: <20240328155439.58719-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::530; envelope-from=philmd@linaro.org; helo=mail-ed1-x530.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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Extract the ISA-only PC machine code from pc_piix.c to a new file, pc_isa.c. Signed-off-by: Philippe Mathieu-Daudé --- MAINTAINERS | 1 + hw/i386/pc_isa.c | 33 +++++++++++++++++++++++++++++++++ hw/i386/pc_piix.c | 23 ----------------------- hw/i386/meson.build | 1 + 4 files changed, 35 insertions(+), 23 deletions(-) create mode 100644 hw/i386/pc_isa.c diff --git a/MAINTAINERS b/MAINTAINERS index a07af6b9d4..a68fa813b8 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1812,6 +1812,7 @@ M: Marcel Apfelbaum S: Supported F: include/hw/i386/ F: hw/i386/ +X: hw/i386/pc_isa.c F: hw/pci-host/i440fx.c F: hw/pci-host/q35.c F: hw/pci-host/pam.c diff --git a/hw/i386/pc_isa.c b/hw/i386/pc_isa.c new file mode 100644 index 0000000000..a98c75f3ae --- /dev/null +++ b/hw/i386/pc_isa.c @@ -0,0 +1,33 @@ +/* + * QEMU ISA PC System Emulator + * + * Copyright (c) 2003-2004 Fabrice Bellard + * + * SPDX-License-Identifier: MIT + */ + +#include "qemu/osdep.h" +#include "qom/object.h" +#include "hw/boards.h" +#include "hw/i386/pc.h" +#include "hw/char/parallel-isa.h" +#include "target/i386/cpu-qom.h" + +static void pc_init_isa(MachineState *machine) +{ + pc_piix_init(machine, NULL); +} + +static void isapc_machine_options(MachineClass *m) +{ + m->desc = "ISA-only PC"; + m->max_cpus = 1; + m->option_rom_has_mr = true; + m->rom_file_has_mr = false; + m->default_nic = "ne2k_isa"; + m->default_cpu_type = X86_CPU_TYPE_NAME("486"); + m->no_parallel = !module_object_class_by_name(TYPE_ISA_PARALLEL); +} + +DEFINE_PC_MACHINE(isapc, "isapc", pc_init_isa, + isapc_machine_options, TYPE_PC_MACHINE); diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 4a3ae72fe4..f94221ab92 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -434,13 +434,6 @@ static void pc_set_south_bridge(Object *obj, int value, Error **errp) * hw_compat_*, pc_compat_*, or * pc_*_machine_options(). */ -#ifdef CONFIG_ISAPC -static void pc_init_isa(MachineState *machine) -{ - pc_piix_init(machine, NULL); -} -#endif - #ifdef CONFIG_XEN static void pc_xen_hvm_init_pci(MachineState *machine) { @@ -820,22 +813,6 @@ static void pc_i440fx_2_4_machine_options(MachineClass *m) DEFINE_I440FX_MACHINE(v2_4, "pc-i440fx-2.4", NULL, pc_i440fx_2_4_machine_options) -#ifdef CONFIG_ISAPC -static void isapc_machine_options(MachineClass *m) -{ - m->desc = "ISA-only PC"; - m->max_cpus = 1; - m->option_rom_has_mr = true; - m->rom_file_has_mr = false; - m->default_nic = "ne2k_isa"; - m->default_cpu_type = X86_CPU_TYPE_NAME("486"); - m->no_parallel = !module_object_class_by_name(TYPE_ISA_PARALLEL); -} - -DEFINE_PC_MACHINE(isapc, "isapc", pc_init_isa, - isapc_machine_options, TYPE_PC_MACHINE); -#endif - #ifdef CONFIG_XEN static void xenfv_4_2_machine_options(MachineClass *m) { diff --git a/hw/i386/meson.build b/hw/i386/meson.build index 1a6e731196..0576fc6541 100644 --- a/hw/i386/meson.build +++ b/hw/i386/meson.build @@ -12,6 +12,7 @@ i386_ss.add(when: 'CONFIG_X86_IOMMU', if_true: files('x86-iommu.c'), if_false: files('x86-iommu-stub.c')) i386_ss.add(when: 'CONFIG_AMD_IOMMU', if_true: files('amd_iommu.c'), if_false: files('amd_iommu-stub.c')) +i386_ss.add(when: 'CONFIG_ISAPC', if_true: files('pc_isa.c')) i386_ss.add(when: 'CONFIG_I440FX', if_true: files('pc_piix.c')) i386_ss.add(when: 'CONFIG_MICROVM', if_true: files('microvm.c', 'acpi-microvm.c', 'microvm-dt.c')) i386_ss.add(when: 'CONFIG_Q35', if_true: files('pc_q35.c'))