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: 13608798 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.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 F183FCD1284 for ; Thu, 28 Mar 2024 15:55:00 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.699005.1091367 (Exim 4.92) (envelope-from ) id 1rps5c-00072p-EA; Thu, 28 Mar 2024 15:54:52 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 699005.1091367; Thu, 28 Mar 2024 15:54:52 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps5c-00072H-Ao; Thu, 28 Mar 2024 15:54:52 +0000 Received: by outflank-mailman (input) for mailman id 699005; Thu, 28 Mar 2024 15:54:51 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps5b-00071m-A6 for xen-devel@lists.xenproject.org; Thu, 28 Mar 2024 15:54:51 +0000 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [2a00:1450:4864:20::62f]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 81b0bf09-ed1b-11ee-a1ef-f123f15fe8a2; Thu, 28 Mar 2024 16:54:49 +0100 (CET) Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-a468226e135so141646566b.0 for ; Thu, 28 Mar 2024 08:54:49 -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) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 81b0bf09-ed1b-11ee-a1ef-f123f15fe8a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641289; x=1712246089; darn=lists.xenproject.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=zvuhEkeh0L+78tpAIgLDZI5zyApCsWNLjhpa8HgahhVcrSjd3yi1t1APPfZscnn1Ba 6AVNjgIYYbxAP9HyGRau26VeodkgTpHY0DoihcFFxheZn8ry0Q4Y0og5toGSK0QBZBRJ AoqmPobglXRz/WBAwNYxvChm3i9DHMeFTNEsvHIoAdkoMpwvAIWUakmZG/IXJjKoh+8v jrKtmZinG4bXx/72lab40FPvUOtybeoMtvANIHlcQqRfxw+6lNGP8lnuG8Vq5i9XEOsB 0ZWhfg8fkKkd/PE8ssHH5JvB4zlz8n1ab2z+zUBU2kcJzLcC/RBgypZJ8sjwdnKviqMO yJTw== 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=sCbO5tkDckaLljRkDbTj2wVO3s2eTbT9MqoYlm5Wg29jNgHGdf4FqRAttfjs9npUwg 38icl65Of2WcoruYQ7Duc5S9jSjerZji1iepAq+29sTNrKfP/IyZMbp3QClFNcqsoJ88 GXKQeye6Q9tXyM/7x0e2FnN3Yj7EJyReBDAph6P77QRYjoP7+Hi+Cwckwwg4m2zrCAVX HjmP8doxAZuVEzR7AFTzAD+ZsRdhsbevRtfxImFyu7A2Pz4PTVcP1yU/nJrSSL5We5UX t7iogU0IENShjVweD/ZeOV4aXmqxdmLyXJmACfKP3DFKjdjKzRK6HNqlJjMBVAbDU3a9 n8HQ== X-Forwarded-Encrypted: i=1; AJvYcCVdIo2dn7PQ1zb3kV2i6xRPRWgbkJsbFYFW0by6UEKaz64FzZadBOcNQdr5ZPGyDE6NaTU2gY47cXZr2DmVrBrefX6d1+DHLguxmZvme0A= X-Gm-Message-State: AOJu0YxBIccQnsS9r2qjDUY4vEI36R3UiN+Azth+3SyCGhTWkJGUtU32 T7GxiqZ5T2UF0ktjCo07py1WSD/6Oa6w28QmEDg6StKD4mAbbE7dCSnuMA/xlxw= 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) 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 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: 13608799 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.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 63AC1CD1283 for ; Thu, 28 Mar 2024 15:55:05 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.699006.1091377 (Exim 4.92) (envelope-from ) id 1rps5i-0007N2-Qc; Thu, 28 Mar 2024 15:54:58 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 699006.1091377; Thu, 28 Mar 2024 15:54:58 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps5i-0007Mt-Nc; Thu, 28 Mar 2024 15:54:58 +0000 Received: by outflank-mailman (input) for mailman id 699006; Thu, 28 Mar 2024 15:54:57 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps5h-00071m-BB for xen-devel@lists.xenproject.org; Thu, 28 Mar 2024 15:54:57 +0000 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [2a00:1450:4864:20::530]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 85787c7a-ed1b-11ee-a1ef-f123f15fe8a2; Thu, 28 Mar 2024 16:54:55 +0100 (CET) Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-568c714a9c7so1311102a12.2 for ; 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) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 85787c7a-ed1b-11ee-a1ef-f123f15fe8a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641295; x=1712246095; darn=lists.xenproject.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=j+ae31P+QTOwkdt0sOkfiBijANSyo/hdbRqKY14Hj4HnYOsGvyhYKoiotr13ze918E hKSphsF6r7vX5FAs37JJ//FnDE0PzEDu2poMvN7tG+olcJTiFaODpdL5uD5FQr63+FRL rV/P2lk4OuyHxX7EhjN8z8iCIEN7BbldPlq2f5bqWGU5+oTOH7XnS95HAOhfu0I+zUan J2lkWBOYQbt2vW0Ta7fsmAPCrGsRPdN7mPj4/19oVNYi9P/XY3eRB5wUCjUZVYpKt+ZL 3io5zq/6kpiefrcddRvildoinyQt7RcheY51hZnKBUBze41wH1XH22dUCNMPX8lQZbq+ hTJw== 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=K0wRrncQ9BHiz+Ph3lMjkX3piA0VavgmT19yL/b4wemUVQCXRca5ZgHi3Of8NKdrBE x+E78Gckfg944+KVAl5wbyWRbcYY8ZA5C2wKhiRFYZLHISZwqKMvQS3N/fhZNL3X0Zfv DGWldL5zoaoQzosLt98Me6gcfMKxtWJYPxXULsqmaJyU+8FeOYjwhqYCvRRkDn7VEl71 jr4dSsYpgsA8QxGoYp3q2J3p7jCl30eI60rX/OAkUuex37JAIVh/ErB2yzO6TcOyaApW cgc6ujWx0r5Cf/fYSf5NtV4bpVI/YldxVRz29dup+Q0vX+HoxnF8OjCsfpR2+UVgezBm /FFA== X-Forwarded-Encrypted: i=1; AJvYcCVgf/le8uPcEMgOGQtWjdJITcLLxXzHBd+5eKHYbjzNqCX/Xhe6BJZ4XIkVSW2EhE76T7Nh1gQY4rvKSQoV288n6HEYYdrJY+UTXebaA3o= X-Gm-Message-State: AOJu0Yx+uNjm6c/Ne5eFf7S40PonvC31NfkTf58l98enUiryc94QV4u1 EGmUbfn/BtHhI0dTcOR9icZb+ortz3dvWf8i+Z99W7olGUNAZWP/ZZDR4ID5Tf8= 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) 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 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: 13608800 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.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 2A988CD1283 for ; Thu, 28 Mar 2024 15:55:12 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.699008.1091387 (Exim 4.92) (envelope-from ) id 1rps5p-0007kB-31; Thu, 28 Mar 2024 15:55:05 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 699008.1091387; Thu, 28 Mar 2024 15:55:05 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps5o-0007k4-Vx; Thu, 28 Mar 2024 15:55:04 +0000 Received: by outflank-mailman (input) for mailman id 699008; Thu, 28 Mar 2024 15:55:03 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps5n-00071m-Oe for xen-devel@lists.xenproject.org; Thu, 28 Mar 2024 15:55:03 +0000 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [2a00:1450:4864:20::52b]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 894fca6a-ed1b-11ee-a1ef-f123f15fe8a2; Thu, 28 Mar 2024 16:55:02 +0100 (CET) Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-56c441e66a5so1506470a12.0 for ; Thu, 28 Mar 2024 08:55:02 -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) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 894fca6a-ed1b-11ee-a1ef-f123f15fe8a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641301; x=1712246101; darn=lists.xenproject.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=bkqBL4bo2Svvjj7lEOuBvYoMO9KyQw1FlEWq8WhstjxaJe5bYOJ2lutvnT0lVF37El kXxDRSVgVXG7daUTsiz59Jp2hRR0LR/R5lciyFjSDRuWW6XXFMnjFJghzb9zjE8d4z2t 1UZebdVecrURjkLyjcJfRJwl4AFfIaF7ou6VlZHT1mS2reFhFHe0ckoG3wRbDwJp4Csv zsOPYwWYnlWNCewDgG8qGJBFt7drYCaX1TQ9AraDv7m6Tj6N/fbq1GzntKUdXccX0MpH cOCYxrN278D0Y1UVqYvalm0SsVwkmUDmA7VlPJJyPTBZuBi9PLR9swsoHY2suSs8T6oa zBbg== 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=XKDcOvqv2vMEWxzzryQdZrEVwUnqpVSq8Y1znEOTUCej69+L+eypyW0rphHZ1e4W0Y Wss0wAPuKnchKuWawBUtOqFylq8pVOuhqXq1Mn2HV6J2hJrhvOS3GEVBvvNAjbuO84rt rnHa7v1H1TxObKay/p8IKH4K6LOyNFioq0p7Hd3gCq2TbnpHRGjMrYAs4Q9PEAaH/Y85 suyy5jxvJxsy/JaeKkkmgyFDQeBl/ufMghQ/NuZKKwL4rpMX2EILlOjnY5g5mE7X3xV6 d0OX2A8hQ5OUGnjODpn54I8EE6lHAvCqTY89LV936SvYdWSh5fg2AIJt6Fx9Ev+g8+UD LBqA== X-Forwarded-Encrypted: i=1; AJvYcCVilW8zfLRtF0jW1HiH7xiz76ZaJxmAAcsf7brJ+Rl96H9VaFE1MlvvQ2ui4o32tTR0dJCbWZpnsTv3z89KuAp9RKOUTM5EvON0Ef+9bcw= X-Gm-Message-State: AOJu0YwSc+xZWf1UBoYox8q1pKFalShlMBZL+BP7rmH3yG71kjPHaTj4 o5LNBGqa107fORaQO4tIQGs8JqFfnYT5qI04qByDoqSQrFSDxepUpeNjydEq8AY= 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) 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 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: 13608801 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.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 29418CD1284 for ; Thu, 28 Mar 2024 15:55:18 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.699011.1091397 (Exim 4.92) (envelope-from ) id 1rps5v-0008EZ-Ab; Thu, 28 Mar 2024 15:55:11 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 699011.1091397; Thu, 28 Mar 2024 15:55:11 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps5v-0008EP-72; Thu, 28 Mar 2024 15:55:11 +0000 Received: by outflank-mailman (input) for mailman id 699011; Thu, 28 Mar 2024 15:55:10 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps5u-00071m-05 for xen-devel@lists.xenproject.org; Thu, 28 Mar 2024 15:55:10 +0000 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [2a00:1450:4864:20::629]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 8d0c78df-ed1b-11ee-a1ef-f123f15fe8a2; Thu, 28 Mar 2024 16:55:08 +0100 (CET) Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-a466a27d30aso140406066b.1 for ; Thu, 28 Mar 2024 08:55:08 -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) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 8d0c78df-ed1b-11ee-a1ef-f123f15fe8a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641308; x=1712246108; darn=lists.xenproject.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=Vn9FOkK5rbxKDOcsJsoG4m3RzXE3u6iynMo0RBATJ5xt0gHnevApEuRZNjDuMbnkDc Ys6wttlZn3yWUAWSKvGfdxXBWAEaiEMyZTP1eeXTPq6GqZCaq5BPmFGGwFpUOcuYF++5 1imB5tG5LuhMQ+tQeA0SkgmRmYzb3l+ylDWm9P4sIrRCDzCYDumxfUhsjYfJa4kMWYtD efcBFR7vCeq5ox2nLWt81pqX3zIHZVXhW+AhnaZzpzYPDrbGWqx7tRzwI5A6QsZ9aDl5 rnSAWm2AuaJh/jMHLvfKXGE0w/sgMdKRgssyJJX0Xl1iqfNyn4txRhlUOXgxMQCxzpjT /aDA== 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=bU+ABrF1xDTQQMJWroU8JY6puiFoJyVm0yJT2Ldb4zq0AQuOzhK+ZgaC20uYZqi4FA 4heJd91xr2LUg1LDGJuAF+BIdgbnIRElYl2OlMkPmmPr9n1/U8XfIt/0TjlaCdOCGaYC 470D/6u3m2HoJpPn2J8AqFWsHtT8jegT4Ns3wfv9VFzOnPZHLmDpDL4mKlsUZAFm/P6M jX/KQ8eIDqMuftuEONF/KmNmtu2yn39D/jtpsxVGHPhtX0RO8OXZQgxj8m3iz9q9nqbu iG6FdublxQtXyxW8UpxvdV9hn7qUap1M9lMyF9qA+VPiQOc6rTEsrEcWFGoaF0ZKicz7 HMgA== X-Forwarded-Encrypted: i=1; AJvYcCWe2TJmIdHOlqOk5HnjS82gnR5YKxDXvff81NkhxxMNBdL4EqHpYhkrNSrMdwXnjNV5ZO1NXwF5vVUSCeXN1kpzO2M8CivQP4FE0LXXR6g= X-Gm-Message-State: AOJu0Ywz4cwtl3HC44/a9t72nMt7Yjp7kFcpcZSVsItG179DK59vTga6 tiza+8Y8V60SAnYEi0jS05hEzTI3a0d6a3FuIPkXL6B47fk6LMvLXo2xkKxqWC8= 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) 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 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: 13608802 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.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 27E12CD1283 for ; Thu, 28 Mar 2024 15:55:24 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.699012.1091407 (Exim 4.92) (envelope-from ) id 1rps61-0000FK-IZ; Thu, 28 Mar 2024 15:55:17 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 699012.1091407; Thu, 28 Mar 2024 15:55:17 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps61-0000FB-F2; Thu, 28 Mar 2024 15:55:17 +0000 Received: by outflank-mailman (input) for mailman id 699012; Thu, 28 Mar 2024 15:55:16 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps60-00071m-4Z for xen-devel@lists.xenproject.org; Thu, 28 Mar 2024 15:55:16 +0000 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [2a00:1450:4864:20::52c]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 90c7fdec-ed1b-11ee-a1ef-f123f15fe8a2; Thu, 28 Mar 2024 16:55:14 +0100 (CET) Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-5688eaf1165so1559510a12.1 for ; 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) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 90c7fdec-ed1b-11ee-a1ef-f123f15fe8a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641314; x=1712246114; darn=lists.xenproject.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=ibZx7HWLcG19iRFa2+Ujih7qh7KsXlbb++txSWiCkWPBqXOaj8m2oatxYXwqBAueCy 8Cx2Wp4h5UEbNhBMjIQlqxctepba6mCnjXD8meogi03FrMKgRzwxovwd16ELHg/h9npE oMTOG3docFRHgVpCU7STrYmIYOjwiFFtr6UZWiPWD6XfExqJiJ6BoCUcWDzgln9dYY8R vu+Me6RES7DFaS+hsIaM2tzmA7c479/11BPen/DWMyCk828hfNBD9mYA18UN3cJzs/2B Hl3+KRvBqxwqryiAFnMxnyGozgnVD5LCVdlhYuG1d05uC760iDMBUMK7dTDTie8a/t0Q 7F7g== 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=csJX5PrsFWJ+s0HFI39Vq1930eCbhU7u5tsDNPQb3D9GGQb9+f6X7qrKQkrRHQHL5T d54VbD5pipVqAGdedaUqqTlhf1TYTq+8n9NuRxliWd41e8LoUkGWJQoTKKxlbZJV0c5c NDtRpQSHpyVEUXILIHx8cvEP0ayCDImEZsmTCctlv5NZDZZ943wrbRqd3JdVpKkpG95h +61iXmq9CzKndct3KI0/1ZQDJmYgz8RMibORD2ii9YETLpPE0GocCNpeuAhA5CYqYVxI KNhMllEz+ksn4IOIrS+wpX/E/klviMc8DlupzLuEF/ovw2BOaOM4cBN1oTm3OXja1YfZ MOaQ== X-Forwarded-Encrypted: i=1; AJvYcCUxowz0nQPigc6ALzELu5nWtmXu9/wT/jAA4/M5nGrvqWohT/oH9Vkp+ah+n4HktjdjHKk2YyEb1cIESw3xh3BmAl5CoAZeW1yiMrJf7mY= X-Gm-Message-State: AOJu0YzSOkr3DIrZvEIEWnA/sVOq1fsxcSrhBb/PLzBOY/NTk362tD3/ 0D7Qc6TXX2ylCg9EZc07NTCeTVKibVAoSvXJrXhF7Rt8vhRH0zVtSnjlpqYXFNU= 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) 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 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: 13608803 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.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 6CD77CD1284 for ; Thu, 28 Mar 2024 15:55:31 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.699014.1091417 (Exim 4.92) (envelope-from ) id 1rps68-0000ll-09; Thu, 28 Mar 2024 15:55:24 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 699014.1091417; Thu, 28 Mar 2024 15:55:23 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps67-0000kI-Sv; Thu, 28 Mar 2024 15:55:23 +0000 Received: by outflank-mailman (input) for mailman id 699014; Thu, 28 Mar 2024 15:55:22 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps66-00071m-Fw for xen-devel@lists.xenproject.org; Thu, 28 Mar 2024 15:55:22 +0000 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [2a00:1450:4864:20::62f]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 948b9e10-ed1b-11ee-a1ef-f123f15fe8a2; Thu, 28 Mar 2024 16:55:20 +0100 (CET) Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-a466a1f9ea0so72974566b.1 for ; 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) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 948b9e10-ed1b-11ee-a1ef-f123f15fe8a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641320; x=1712246120; darn=lists.xenproject.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=GF1ky0xXBcM+9mqpMVIjN5ldUvzgeGYbPRszRQDdLHC2Tlz2nQyPvJqqhK4MJTGlh+ 9LR3PoFVcS0XO4QJ8mblVO6UCr/SweKxSVGI6mLpB/F6LpdkgOUt6bADna1HRNiPpOhW raqy1tgoR8T5t9Hxeoi+e6Fo/0nVMnfwXw0v3o2ZGm/3Pj9VpZ1nGkE+fAFqzk/5ZfpE 6xMvW9We7ZpcyLd2WL6zmMy3h/odjvqTsOr9qLSs728DlQJHWZ4hOBKyue1Yyy/ssd+I nKkGzuoz213Qhy3omhJkUFPH3haU9juMZv1P8R3OUMBjpTXTzEy7+77n6Y6bLadMLhf5 AUDA== 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=VkXLKiVxAVas+17HQHd3LvDNvFqib1WKp8P/q8eIZvE+2bZ0ZdvMaAVsRO65MIwjxE d/ECBKwh5XDlrl3K9eU5kuY2rmfuI6Nae6nEO7uYGa1yaNjy+MijuNMwl/5A/7TtOV2k O9085t7zIM5Au4caOxX5qAz98H2EjiXhy+wt3NS02hoPcJVnVvb4XpMaersyVZVSjH21 YkdCcaLUH3iQ3jpnPTpBB9y1srD8Ws9Q/BO7C4oHl8JWfHogAVvuUKgHp0bz8yGJafyg 0pTK7xoKgPpnuY5v//ggAyiB6oqfcETGGNURgvG3ZX/M2zGsOcQLTI32z73k093dDYNr Bq5w== X-Forwarded-Encrypted: i=1; AJvYcCVW44NZU490/Dm8qiaW76SalifgMBpwBP168W8FBBqopft5aOQ5AhcIahQTZjg/lZuDPlkDnj5PETlvY9VABrmw/OrdumjgXyJnngW0FDo= X-Gm-Message-State: AOJu0YxK3ZW4PpGQzLXvFODy5a9Y/Uj+MCKJ1WA3/3PMyZRd6JN/DE44 JGD1XMOOSHqY5GH1tHb4RC1l+fSTZ/y8vWcMdDRBFqchmTNM4SPco9nINoCM2kk= 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) 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 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: 13608804 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.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 AC016CD1284 for ; Thu, 28 Mar 2024 15:55:35 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.699015.1091427 (Exim 4.92) (envelope-from ) id 1rps6D-0001DT-AW; Thu, 28 Mar 2024 15:55:29 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 699015.1091427; Thu, 28 Mar 2024 15:55:29 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps6D-0001DM-6Y; Thu, 28 Mar 2024 15:55:29 +0000 Received: by outflank-mailman (input) for mailman id 699015; Thu, 28 Mar 2024 15:55:28 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps6C-0001AK-4N for xen-devel@lists.xenproject.org; Thu, 28 Mar 2024 15:55:28 +0000 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [2a00:1450:4864:20::533]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 985dd9cb-ed1b-11ee-afe3-a90da7624cb6; Thu, 28 Mar 2024 16:55:27 +0100 (CET) Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-566e869f631so1281270a12.0 for ; Thu, 28 Mar 2024 08:55:27 -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) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 985dd9cb-ed1b-11ee-afe3-a90da7624cb6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641327; x=1712246127; darn=lists.xenproject.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=txM9iJc0yr45dUdIagHwuyhJw6PO8Az7qlrWiOIpm7KCiEGFN345EUqXCuBKQfLMCC y9J2PNqJLpN5gBfQjErKIt81Pm7Nyt5bs/6qlx6X1XZ0sIdY2ulYv/kx5EyPydtbLci9 mbXgIWVn/PWg2kOVT9BmxMSN5rC8Le7LIUZoj0iQcrXjf3HJT6A4hMko1QmsXBOkimZj 1XFg2D622g94rc5GBi9sY0mII8xf9yJD1PEdYSqC7ViRxuT8LExyEjQoyqoX00frJ2M4 T+Ke2x014b/rPS+y7cexWUXUi/0Vo+bDlvP3TzVkNgk0I+pRK0bGMPIbTiIm43X0zjqR VkNg== 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=TYOrhTIa+VZu3BD2KddQryYMZc6Yj3oihAWWT+ggZumymoheuiCHCWXU8jTgvbt78C RZQ6+kvgys2ASkYnTKBSCjxYeVBb9YfArfCep81e4nR4d8DHSJjyayoRW7s8VkHR8F6G Q9CTmk+VcCl9H0dp86scJZ8y+pcKxkXvpy8yYmV3GcIVE6vwadaeDJx+z3/pnZUZpjMR rB59fMG4r6Cy3chhz++MhkKCTTb3KeHHGCTd60kAJrxypT68LkmBXmQEiwcM9c9xZ724 uFzX0QmXX4T9Hz7G/L1jLKv10feKqZu1QKcGyeNI2Ux4pNSzkSDCHfjHhvjAOlUbjlVW zyow== X-Forwarded-Encrypted: i=1; AJvYcCVFAy9kWZQiM1ECVu6F3kh9HJkfZ6s3aIOWqxnNHfmguJHdgzKrBAUeXw7p9TphhW++dJeZFaGyf9Q/GGRuJoG8mQrrO0g22M1nsEWF3Qo= X-Gm-Message-State: AOJu0Yx2TjTN4Q8YocXR76VQIqjxkAn35ra6AQr2Y16JKvo24O8NRb5n tcql4a09i7ljUFRLFiNgB6sYlLHTxLsCIUPdBg1z7a8Ah8qMceMhCuO49CjYsu4= 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) 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 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: 13608805 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.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 46CAFCD1284 for ; Thu, 28 Mar 2024 15:55:42 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.699018.1091437 (Exim 4.92) (envelope-from ) id 1rps6J-0001kV-Ju; Thu, 28 Mar 2024 15:55:35 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 699018.1091437; Thu, 28 Mar 2024 15:55:35 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps6J-0001kO-Gm; Thu, 28 Mar 2024 15:55:35 +0000 Received: by outflank-mailman (input) for mailman id 699018; Thu, 28 Mar 2024 15:55:34 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps6I-0001AK-G3 for xen-devel@lists.xenproject.org; Thu, 28 Mar 2024 15:55:34 +0000 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [2a00:1450:4864:20::62d]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 9c272e9b-ed1b-11ee-afe3-a90da7624cb6; Thu, 28 Mar 2024 16:55:33 +0100 (CET) Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-a472f8c6a55so149503166b.0 for ; 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) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 9c272e9b-ed1b-11ee-afe3-a90da7624cb6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641333; x=1712246133; darn=lists.xenproject.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=HzD778V6aqrHB/+GMu32/EiAaNPHaS7LorEsj5Al4RuC3N8ykXJixllfj0nJeCh6eY JVUlyRwrXTJhgwMkcqEmH5mEzJBoEM6sB0o0O7CediUaiRq+3DeR5qF6t3wmvrJlgdD/ QEynec4mwiiEX7NGzMOkjX+xlL3bHLlJXFJjU8UJ+EVk5qobw9z9g3Dogjzmq1D+oyGY 7t3/814ZyenbFeN6aU2mcANxR/SM14O8IDCKjBw14ZXPtPQxXh8orzNgvNqvaB61i2m4 1MZqUykDviEBB/uvcaaOWHv3IJuB+94M7PU0SpIvml+xEDv9OtRDL4M+Rnw2QNHqKaRe oIXw== 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=CrfOBMbsR4JBEPYHLOoWzOCjGUF4Aa5hlcAKUkf2UnQXg+c70qkpvpeylml1RCCsqP m1lf5oFXEwFegACrqHdNyfCYwiKsp/skyV2IVEBDupvSdiYywTV4lbXn4TTKCn1mUVFB EjKHrFntNiBVQITh1UPKATWFQOHizvhD0ibwj49hGwzb5yghIzoxDBuSXM2kud32vHWU oGkoptdEqqPJuB64o1XRra9srU0ownM5bzlGfrzFqVGrUu4CbRlS8AGVpGL+TJiSWFfY ughb/oVbIs7uLWeRd3YRvxQkdrj058qUDcHqyhULq6Oih/6LO6jrtn5GOigkwFbQdWKV SpyQ== X-Forwarded-Encrypted: i=1; AJvYcCXTvYXdBVcQF1hBtDygH3VXk2+KKQJBz8kCbqztTSXGgwHnInSVJc8oA2i4QNOk3QLVQnaPw6AweJvkuRuaJClqf3gXO7Y3cE2pEgUzzv4= X-Gm-Message-State: AOJu0YxeiUh74vG0ygt5ih1K2YJa2Z3IFF7E0ZDxAMA+pX9G6L16PNVf ROwEi9yiUSnm0HmDOfx0EuXtXGxVHknDWBuA80fF7W9/7Ft0CGhmqniJbGQ7SvM= 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) 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 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: 13608933 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.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 B2D49CD1283 for ; Thu, 28 Mar 2024 16:13:58 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.699097.1091667 (Exim 4.92) (envelope-from ) id 1rpsNz-0001ve-0o; Thu, 28 Mar 2024 16:13:51 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 699097.1091667; Thu, 28 Mar 2024 16:13:50 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rpsNy-0001v9-TN; Thu, 28 Mar 2024 16:13:50 +0000 Received: by outflank-mailman (input) for mailman id 699097; Thu, 28 Mar 2024 16:13:48 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps6P-00071m-6t for xen-devel@lists.xenproject.org; Thu, 28 Mar 2024 15:55:41 +0000 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [2a00:1450:4864:20::635]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 9fb6da5c-ed1b-11ee-a1ef-f123f15fe8a2; Thu, 28 Mar 2024 16:55:39 +0100 (CET) Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-a2f22bfb4e6so154976866b.0 for ; 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) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 9fb6da5c-ed1b-11ee-a1ef-f123f15fe8a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641339; x=1712246139; darn=lists.xenproject.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=VLRlRVMtsCcUj8gm8+ZKYALS4tR+eUM/GC7Qv6j7tfYWLou6mzrFCzuVd4GkTnG2sQ yZGN0XSDC8NdF2c30bDI6lLdOvVI8Vf/6FVMLWfCOperFm78Ht4JtorXTNlldTzOrs+l VcTIsZhTzQmH3ev64qwpYr0Gi1DveK/5aJcBbYk7wZYdEsx9/s8X0WjPKuCsLrde9AT3 27++mK8lms3TKLIHY5K5hhSeCTFz3p2yjbsms/gIOb3WrnOPRQu8Q2IWT1kHRIqSK2Tt vA77yEuiin9tLxl2bc2XWAH97fMoxda/Kf6v6Nuir2DxPeTpZKLVJHNYWLtd40sqOYYi Sg+Q== 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=Yo23aEZ2XT8NU/LqJ28+lAC7qJJlTHk3Ao3j7QtNQpfRHNbHEsEJx0R3iv2wp+2Yjt sKwd6BGjtiRL/CBYFwmrRYHgR/l7KhKYUzP1uComAQZDtOfJLdjaENPtWWVkjNLt2BVc WNktc9MQAVv6sQiqrlLB2NlB4k1j+uJ3mx3R/NaigeSL3DDFgoYXdfGhDUpJHmYygK+p 70w819H7ECPrUN2koc80VkSZLHZhw4j0CfCJLRZLRXRsCSiDtb+5yqlfibIDOyuW3fDp TpsNSzFR+k1hkr7hsV9uJh7ye2vhx615TcLINUtdyGaBdNhkY1efvZ1fREH1QmrRUUMF 3vXg== X-Forwarded-Encrypted: i=1; AJvYcCVmogoDO5zf6jjyHtelA6BbNepygGlCJ8nX14oq4XoWBNHbXVguHuGQS7Yzu9R/thZpA+chOZj4i0pVbd+Vgrjt9+tQWqPKX5TRcUnu+a0= X-Gm-Message-State: AOJu0YyqdpvbFGsXW9NKZpvU+aFg1Mw97w0/mGdUkmjRasOAFJ9kwb8Y 99/C7UgoGFQOTcFnR+agWcHtUXH397HyffECR9wzx9FrSpaTbO2B4VS4Q2TRdtM= 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) 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 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: 13608806 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.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 A18CFCD1284 for ; Thu, 28 Mar 2024 15:55:55 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.699019.1091447 (Exim 4.92) (envelope-from ) id 1rps6V-0002V9-SR; Thu, 28 Mar 2024 15:55:47 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 699019.1091447; Thu, 28 Mar 2024 15:55:47 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps6V-0002V2-PD; Thu, 28 Mar 2024 15:55:47 +0000 Received: by outflank-mailman (input) for mailman id 699019; Thu, 28 Mar 2024 15:55:46 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps6U-0001AK-IC for xen-devel@lists.xenproject.org; Thu, 28 Mar 2024 15:55:46 +0000 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [2a00:1450:4864:20::536]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id a38a74cb-ed1b-11ee-afe3-a90da7624cb6; Thu, 28 Mar 2024 16:55:46 +0100 (CET) Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-56c2b4850d2so1407108a12.2 for ; Thu, 28 Mar 2024 08:55:46 -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) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: a38a74cb-ed1b-11ee-afe3-a90da7624cb6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641345; x=1712246145; darn=lists.xenproject.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=lNJDLqZW9NEMGRWweBxLfSo2JFd3oApy7h8DgV7+lE5SXPKodKLsud3rIRxOjMlWp+ m05b11yOqliLYv27I5t3UNG6cVVoe9sz3i3fXMQBnRm49073SeiFn+HS/4BgCJS/TPJe 75j/Bwv1mG2c/RaNVbzAIBX9ObG2dTEHK7xgAcX/mR1XpbeSQ9EQJzWz7F7azME595WZ yJw28bdxxQiLPwyN7Y88Sl+rRqkM3q2ci9m0ftbGuHdrD6w4gIbgUZ/72ox7eo4ewZRu 0M00pB+IQT2HZJJ2Mw3kry7u3U0iAQMpCQMurTBOrotP4SZk6f+X5bvR1S+FoLXlTIOG PmbQ== 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=CM5rSkowNVAlw6yj0lYxt2Zl6EyKN4VwLEk9FFyg1BBKI3ft06Dj7TSegIDt3KlWOi WyEwtaISw6wIdcvVgv+oDKL9a7ft6iPLzcZ+dqDfbwBbdr6mbHTcoLvajDEK8pjyZxbe PtykylIuDWse1HEgSHWKwDrEk/ulWhbkR4+xuNNMKJ2M4fwYVvZ2tPT4TVTwHqpVfdlC XtAoQBzNCpKawOiAG9eSH4EajGTLHg6/YjlgHaZhs5fUPTzgy4IK9+g7nOEtmLlVQ9B/ cqL1nV/TcM53zrwM/H+YhJvO1qIEy5jAFEeHnfce5xhwOwhRChBZmSsTk8+hMx3tihMC mGdQ== X-Forwarded-Encrypted: i=1; AJvYcCXUbnGbqxsGBYc//hP83u+MT3apaPJIJ4IF6Hmnf6h5dpYXr1EPjwsdG0pknlBzvF6U+NmxImjuHUwWMIrDUiU1gpxbGUQDWyXb8/27xCU= X-Gm-Message-State: AOJu0YxN0FFLzLtLq8/lpP+uaB/NmE71rJVsFSqCHRRyTC1QTRzYpVMh dfYEzvBS0L0uBE74F3eVSQptQLt1zIc2x23wDOD+daxHyzdrNPw7YWOqcHn3s0c= 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) 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 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: 13608807 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.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 765D9CD1284 for ; Thu, 28 Mar 2024 15:56:02 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.699022.1091457 (Exim 4.92) (envelope-from ) id 1rps6d-00032b-7m; Thu, 28 Mar 2024 15:55:55 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 699022.1091457; Thu, 28 Mar 2024 15:55:55 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps6d-00032U-54; Thu, 28 Mar 2024 15:55:55 +0000 Received: by outflank-mailman (input) for mailman id 699022; Thu, 28 Mar 2024 15:55:53 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps6b-0001AK-3D for xen-devel@lists.xenproject.org; Thu, 28 Mar 2024 15:55:53 +0000 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [2a00:1450:4864:20::531]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id a7723f0c-ed1b-11ee-afe3-a90da7624cb6; Thu, 28 Mar 2024 16:55:52 +0100 (CET) Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-568c714a9c7so1312485a12.2 for ; Thu, 28 Mar 2024 08:55:52 -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) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: a7723f0c-ed1b-11ee-afe3-a90da7624cb6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641352; x=1712246152; darn=lists.xenproject.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=BG/FPI3FZWPijrJvR/3GBAQnfxn8sdeqkyr7hR50D3lgiBXWShG1ghMVZ166fM/tcN 5f7/TVUdmDpx4sYFkUyz4Scr4XziUsWn79NHVUGylQNBqHOqWebyawbemLf9lcRq61ri n26f5bpXO2+lKQjtL5zxY7gQCzp34sM56Vt6+2wjYJGi7fuKwMJDXG+Z9zcw+P502ei3 b29ZTlAbwNQuREr0LvgqnmCYL7p3BsxEfo7nc2ACVJ7rMk1Yc5/2PrCemulqT9NgcMVI 6jvu4gKt3Aon0tI10eehKstbT/UYj0+tdMIbWQd+DCGLiwPB6WxrX1YqxlJpAWnTdwvD DFdg== 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=ik4KjRkBzMXycBAxThV6Ba0BT+UNR0JBsYxKIceZILrvhj9s0xtlEs29hrESJ0pIM/ rQdzYydtK9coHjch/VAEKgh4c7MGrPvAGsk5/xif9XMyUY6xNmff84CPoKoGYQ+VxR+h 6EISkiD43xcs5/V7p2A0eEBVl+fQOphRw7TLXyHaL2sB02rEknsCRZxth9ajCU9LRqH9 iwytAF/OF0o3evouBYd+jx2+2pcEyU1wi3phaDXCYZy6fb/qaz0SIRCd0F3cGF/Ce/eN 2ZwPCBkEFwRle34zfugSvWzGrjJkLZzwvDhiHLpvQplI3gCKBb/6pzYZHgDRQ3ymVNxW rMHw== X-Forwarded-Encrypted: i=1; AJvYcCX8JMWghPzm5yDKErBc9aoBPERzSilRTWf4693dAS776w43SRbBRHk6ZabEpAiurOF9NlbPe8vSLdzE3OPuRxR2U5HoY/V7Mgz4z1CFnLg= X-Gm-Message-State: AOJu0YzdqVakuRaisnoixowfPjhufu6V8fgYQL3EgJr5UYgsVFSbEkzG wJ+a4OZOaWQgBYMnuuQg1whweLYtMCX7hGvkdLckqSZ8cqXkYk2nDQfHMX6/uss= 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) 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 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: 13608808 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.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 8655ECD11DD for ; Thu, 28 Mar 2024 15:56:07 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.699023.1091467 (Exim 4.92) (envelope-from ) id 1rps6i-0003Sp-He; Thu, 28 Mar 2024 15:56:00 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 699023.1091467; Thu, 28 Mar 2024 15:56:00 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps6i-0003Sd-En; Thu, 28 Mar 2024 15:56:00 +0000 Received: by outflank-mailman (input) for mailman id 699023; Thu, 28 Mar 2024 15:55:59 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps6h-0001AK-A6 for xen-devel@lists.xenproject.org; Thu, 28 Mar 2024 15:55:59 +0000 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [2a00:1450:4864:20::536]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id ab22719c-ed1b-11ee-afe3-a90da7624cb6; Thu, 28 Mar 2024 16:55:58 +0100 (CET) Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-56c12c73ed8so1456496a12.2 for ; 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) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ab22719c-ed1b-11ee-afe3-a90da7624cb6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641358; x=1712246158; darn=lists.xenproject.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=WthVM38weC/OsP93dMX7SOGT7bwOuSWVSP4NHAf7johrMLill/YrI8e5A0sIMaqL6p 5+gu4IVdZIIYASaJ1Ax0v+ZWgTrn7q38ZN8DHmr24ASgpgoBnJ0HMNZmIjTRer7bkveW 8AR157bx4BdrXdf/yd/FK3hCXMwiv9g0koGT3GoFZQmg9SBi+iFFtPB4O33JQn/b6TkT GIc1zcuYQkugkfPm1lLSY2FKYcdtYb8nhhS7nrvEH801Ji2TVyQRT+/Z0LtrbtXgVPdI tstHL02DwJnlsFGbGIiOYNrrTcxssCz1Imd4ufqp3z7yKBXFbeJKIjzhHw56chIlVhHp Af/A== 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=J5ehBKurT4lWW4lYxajsPGYaZYFoI0vFtZFuK3sccHDpNdAHi2TvDe/kFznYTDNeDy AFD2Wsl3A/22Sq7QGbVUJOh9otzQ9c6+zXgWhG41qq7ihMlkce0PcK2Bhalc7SmN1yc8 o0UI2OW3csZ408Aie37JOM0yb9JoeZmiKemuzY00Z6HRFKJm4lTQz7BEekMTp77iTP8F jD0R/nSJvlZthGHTA61ntlYhcJMajTaXb7gKT88Z8qUWerRnSRw0qMHiTcSjvVyyJfIB /FuK5Nf9aEflM6amKZOGqZ4OrBbWaUmsgNyMyIQ9cpvhsoiboQVCkTSttAv9hJj1aw38 9vEg== X-Forwarded-Encrypted: i=1; AJvYcCXhAhqXL4AKxbxNo9vF2VogyFdgJ7vgvKfI50gqKJ8QsuwpMwJR3kBycqayh9Gsr+kycsTR4C4pchO4oN2RtPHTV4chCaQDBEgSVqCN5DA= X-Gm-Message-State: AOJu0YxPE6wGHNImO1uRPQAGFPDyPe+G+T00OENsg6CxroC6g9u0QX9z Qb02hj92LsVCU1JifLN/bIrd0wYN//KLqcAbv9ISBA5ISGBLgsT/0Qmn+xFl+i8= 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) 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 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: 13608809 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.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 BC0CCCD11DD for ; Thu, 28 Mar 2024 15:56:12 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.699024.1091477 (Exim 4.92) (envelope-from ) id 1rps6o-0003yM-Qi; Thu, 28 Mar 2024 15:56:06 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 699024.1091477; Thu, 28 Mar 2024 15:56:06 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps6o-0003yE-N5; Thu, 28 Mar 2024 15:56:06 +0000 Received: by outflank-mailman (input) for mailman id 699024; Thu, 28 Mar 2024 15:56:05 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps6n-0001AK-JL for xen-devel@lists.xenproject.org; Thu, 28 Mar 2024 15:56:05 +0000 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [2a00:1450:4864:20::52b]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id aee72dcc-ed1b-11ee-afe3-a90da7624cb6; Thu, 28 Mar 2024 16:56:05 +0100 (CET) Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-56c0bd07e7bso1371652a12.1 for ; Thu, 28 Mar 2024 08:56:05 -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) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: aee72dcc-ed1b-11ee-afe3-a90da7624cb6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641364; x=1712246164; darn=lists.xenproject.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=aVmKDe9ABwAldbxQonVT5xEa/QK8aqCNX6AoDt3lDter6xtemBMaSXkhkzBiWs5oMV AwtXujfk58Af8yKkeS3OOe3WG8Y96uNE5cf7XrRiHzQIJ3+nds51B1IC1MHUHdxRJ2iD lRlZtOT8WoYNbOnZZOle9XX7Ie1Up15kZqDaQ3bd17BQaaL9vshvpwB+0EPohVGXC3Q0 /2KtgFq+3zUwMyujuv0WFKVWn9T9adcbA8kwLs2Y9KBxhkLjHR5lXIypXy/IzF++MWik Z6m40BeUDYp1I9uhtVF34ap3QQicU6CyXhcyhauFaYhHGh3JvBrF5ERv023O2jxQm7Kc H5KQ== 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=UVxnldlrSDcjr/9FE9WvyoaL+OpSuHASJCeowaaQlSOUzDvu3zi0BTs5EMvCZ+b9XH Ht5lMLqsMuRfgpm8AcZ5sWwOQZfQwIf3cllYgxmjWOTDJIJlyX4p5jUZTBaIzly1iKYJ VGwPncYwrtLbKYDY5Lxt69vfTEBckXDAZ7g2j5tsrO9COHWGHKVvhq41wBO+/Y3pRByp 7t09rFkXJ8M/lORGehjGi1W+6ajjTEGAjeBGRWbyQfoiLs1ujgkfK4+edmUDTk8CgW04 ofkwS3tnK1ejM7Npl11Xk4pIBLPJXMMNs9cFgxE78JxclM/ZOo61JN+7VeoykyTH5UiT tFBw== X-Forwarded-Encrypted: i=1; AJvYcCXdlWxlxbuq5uu6kESF72wddImOAZGQNkO9FBtu4/Y7JDkqq1U5vttc1edSzA8VbRJIVXhKu33Guu5ZiVpFLg2yvJvu2MrXNa3qcO6Tro8= X-Gm-Message-State: AOJu0YxYETn/Aps2X07+W9ZF3Q4dFJx4ZblirEa1Bf6rgc6JVbpbNfAH Us7sSPycysGhZ43mdi68scEqu/c3XRstEYLYVIhdmaRh6JLf2Q4dxFoBDdUhBio= 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) 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 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: 13608913 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.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 2C73BCD1283 for ; Thu, 28 Mar 2024 16:04:11 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.699055.1091583 (Exim 4.92) (envelope-from ) id 1rpsEU-0003b9-6f; Thu, 28 Mar 2024 16:04:02 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 699055.1091583; Thu, 28 Mar 2024 16:04:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rpsEU-0003b2-2s; Thu, 28 Mar 2024 16:04:02 +0000 Received: by outflank-mailman (input) for mailman id 699055; Thu, 28 Mar 2024 16:04:00 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps6t-0001AK-OU for xen-devel@lists.xenproject.org; Thu, 28 Mar 2024 15:56:11 +0000 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [2a00:1450:4864:20::130]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id b2a136c3-ed1b-11ee-afe3-a90da7624cb6; Thu, 28 Mar 2024 16:56:11 +0100 (CET) Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-515a81928a1so1638126e87.3 for ; Thu, 28 Mar 2024 08:56:11 -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) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: b2a136c3-ed1b-11ee-afe3-a90da7624cb6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641371; x=1712246171; darn=lists.xenproject.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=tuUaXOOk88LUv5Qe2yM9SzIt+C6InQHrAD9k2uyB19qrdPBE+Omgzs8YHMqlsDVHc1 0B+dspuz2X0O4NV1Dz4Gi5prxyize7D96Z5E1fIo1b1ElVZ/78IsHHYxQ79oA7UwRoUy QuhgTPcaicgne8WwSKQuMB+4mKBA4/6Ppbfred6/rXrFCIQYtR0SygKmqxCpPCQkoukP JxKIqFWWXB8zGZ2c8I9GyzEpSGEEDEqpXSlDUocpcY6uKDXp8l5/09cl/xpGd93KI/gu sA9igr5jaWAXZqrmwCeJj6pP+mQuieAflJVsKZH3AhNE2a0e/DEgruWtm+rSdgaL9Zka sYWw== 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=OW2EkDjna+Xn8HNs1tpValc8I9wQ10SGiG4M3yyff02sSKlSmfMVZbk9z65P9NZ01C 6vph6W4u+46YBSiD90tnPvfmYhoL4iRamEtYWBokJz9e22iY7Os5rXlfcHCAH4ETj3pe EcRLLc0CBFxl843HbAcpd5htYYePhScOPcAudQmwAwTo7L6fUsRKeRMjUnxb7wDX6XWn oqpp+0T52FOs6OGTjrAJVkwoJ8kaFOVsRqVxDJv97mMExNil6H4QdWHftBr/aGQmyDne a8Et0rZtoP/a5e6mC29dpscJfiVIXZwg/sGuG8vdvNCvb6r5MZ6XYJ0dlb988RMzCahD A8jw== X-Forwarded-Encrypted: i=1; AJvYcCVJBfzx/eScTqkFnqqa9FRIDKJtd6Frqj80T9ZMwvLFtx2/RitV43hqIDkAfqoP6kJOpU0chkViAs2N4+WIuQX+jy4dD+V04hwdBtpLv4g= X-Gm-Message-State: AOJu0YwTeIyz4rPbK+DXJAtq6QXuEVk33S/2nDXqL7aVl6M/KF6jqj2o gqnpBssABOFfAzlfRazSD0GZreOXWClXpljHenDmQnAvZO/Z9Ad716Gdlhfg3PI= 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) 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 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: 13608929 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.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 77349CD1283 for ; Thu, 28 Mar 2024 16:10:27 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.699083.1091623 (Exim 4.92) (envelope-from ) id 1rpsKY-0007HI-HB; Thu, 28 Mar 2024 16:10:18 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 699083.1091623; Thu, 28 Mar 2024 16:10:18 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rpsKY-0007HB-E2; Thu, 28 Mar 2024 16:10:18 +0000 Received: by outflank-mailman (input) for mailman id 699083; Thu, 28 Mar 2024 16:10:17 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps70-0001AK-Ev for xen-devel@lists.xenproject.org; Thu, 28 Mar 2024 15:56:18 +0000 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [2a00:1450:4864:20::129]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id b668fd9e-ed1b-11ee-afe3-a90da7624cb6; Thu, 28 Mar 2024 16:56:17 +0100 (CET) Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-513ccc70a6dso1820969e87.1 for ; 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) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: b668fd9e-ed1b-11ee-afe3-a90da7624cb6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641377; x=1712246177; darn=lists.xenproject.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=EnaYBR8QzWipKM3eSIDrpfuOaiM8XXi6t/yfp5CwmfQmz0eRBAb+c+F9aaZGDPChM3 s+WJBI5fmM/UsErX487wD4t04BKZF2JriYLmcwEq6Qv8vvCsgjXp95GOvum9SFNp6HN+ wHZh6sLN9cERnHueMgL/sVCwcRVGmMX1rP/KijDjjkz6ZzdzzYvLKgTC2DZAOL3ozqTE kXbuiVdGiOIjg+D7n8wUW4iSa8nfJvcsC8uq/KU3jeEa9WPSAl8eHoEw/DqQweplx/N6 b5kANDtPnfczJq0Zwa5I+gjp3KuHCxqTB/QgX8pFdf9xIxHa7uHs9ubiELehG00L3TkJ aqug== 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=I+E8ZEd7ZwpVY92fHDRtTEvQkXgEPKTwoBeW3GsAMnoNMfpv5mDEySfP9b3rA8Rxco FLmF4MaA3zeUmERn/MeKyPDASMMq1hXZUcHWpfIawon6BKTaKTexpgsnXe4WihwIiFIi ZywW+p26XQgmb+jEih3Y6wJd1SAR3Flma128wZfTaz3dHzualQojpRfINUEtxmVouLGU Slx4Lq5Q057OtJsyCXMy0ZwOIXecKuB2FmeZTgCEhFfkDKe8HFzRMcax3Hw7POR4nOnL fuReGtRI+klbtRDvDVuZW9XddNQu7jUyPjsmiIX32wBFkVoKJJc3+kdxny3n0lprZZ6N YyFg== X-Forwarded-Encrypted: i=1; AJvYcCUA3r2OnEEmUQB7bkym5uN2z0aLyC6uNUVbZxrHaouoTfhRoqEeWPitmGnJkFIeQEecfehagz56LJDiXeZtWFB6ClZrV5enV4uVrwHCm9M= X-Gm-Message-State: AOJu0YxIfYNxrb1DsBADCZJl/llhPi71Fer28/g7SOhiZwOaFjWBMsEV cBj8/IWtezdhtvKDuheLc7r2boVCcmd2yz+Do2tM91Nf6MMeMBxqqWznA3i/zQk= 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) 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 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: 13608932 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.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 3E6FECD1283 for ; Thu, 28 Mar 2024 16:12:50 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.699093.1091653 (Exim 4.92) (envelope-from ) id 1rpsMs-0000pb-FU; Thu, 28 Mar 2024 16:12:42 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 699093.1091653; Thu, 28 Mar 2024 16:12:42 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rpsMs-0000pS-CH; Thu, 28 Mar 2024 16:12:42 +0000 Received: by outflank-mailman (input) for mailman id 699093; Thu, 28 Mar 2024 16:12:41 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps77-00071m-G7 for xen-devel@lists.xenproject.org; Thu, 28 Mar 2024 15:56:25 +0000 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [2a00:1450:4864:20::12e]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id ba189f94-ed1b-11ee-a1ef-f123f15fe8a2; Thu, 28 Mar 2024 16:56:23 +0100 (CET) Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-513ccc70a6dso1821156e87.1 for ; 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) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ba189f94-ed1b-11ee-a1ef-f123f15fe8a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641383; x=1712246183; darn=lists.xenproject.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=t+/1N04qiasqsLsW1lgmgpEzggXkQbmk+oQ1NJhOyjhH0YcvmjGTucJMeeT8eBUPFq IKeUNuKpBY1tycbKrGhB8bFrGRDwZSldhAImr+KZainvMB2DKkCwP2Huxkvzq6L3KvUf OmSyAf7lS307LtfbyDepTokbaVt3z3IUmC6VkYgSYzYuUDQrwDbP+0d9y9UMRVIqwVWX zcA3jxx0wh2Ux5QXvYzm1kciPjlNxM0t2H+zn9fMJ00MTFdnhLVGw39uEDZS4Jl/De5Y VzAsc4jyPlvNfw5nvj9rBt5xZjEB1PPFMrcYul712K/zGc66mvBzIo/6toieFCmTuIi5 8ing== 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=aRnAOmSTY0S9nWMix/CY6m/mbmG/eZgdFvmLyczqTJNtH8tYWN8Y9VjMahrMudSR9j KFKQriAmQIngs4OHBkOUDNCXkLy0Vo9rRNe5EznpvWmPSXjbhO3QO9+/g+cCcuK5B6Pe RebLECxBlD8+hm7+UPg4EjWgkCXUe13NMGxUd5qsDWnB9BqR6yRVDU97J7TSZPrl29y/ idRQ0rXhkNs6186kJ8A6lnMh6Xm30RVKGTTao4jCYhk5x9b0QbHvWVZCAaL2+QVAPHnQ g0wBdLpSsOcZ9B0DlMeeh50PJQ/rQyoiL2ibu7aMQ/bunh3h/EnOJDPg6e0/D9eIoyGp /0Hw== X-Forwarded-Encrypted: i=1; AJvYcCX6L2J7bRd4C7QUV46BxOJFaZIGVRyeU28Ofq4oS/PfwEGEyz3kPPv/hW8pxMxaq00Y07pYr6+lM1doBvIBOuT6qts5jNOnjvbVwzcDJcA= X-Gm-Message-State: AOJu0YxP05X8BH+CYOjCT9bK+3d1BzZZZzjbwrsoiP184pxD3vG4c2PZ D6iqMUSAIIDmXG36hvleZMBZ17Fjw9ub8fqMF4e/aGGalmQrxnBsT/O9ptjwR1E= 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) 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 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: 13608927 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.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 9D4A6CD11DD for ; Thu, 28 Mar 2024 16:09:07 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.699078.1091603 (Exim 4.92) (envelope-from ) id 1rpsJF-0005Gz-1C; Thu, 28 Mar 2024 16:08:57 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 699078.1091603; Thu, 28 Mar 2024 16:08:57 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rpsJE-0005Gs-Uw; Thu, 28 Mar 2024 16:08:56 +0000 Received: by outflank-mailman (input) for mailman id 699078; Thu, 28 Mar 2024 16:08:55 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps7C-0001AK-O7 for xen-devel@lists.xenproject.org; Thu, 28 Mar 2024 15:56:30 +0000 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [2a00:1450:4864:20::530]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id bdd4fcca-ed1b-11ee-afe3-a90da7624cb6; Thu, 28 Mar 2024 16:56:30 +0100 (CET) Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-56c1922096cso1484891a12.0 for ; Thu, 28 Mar 2024 08:56:30 -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) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: bdd4fcca-ed1b-11ee-afe3-a90da7624cb6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641389; x=1712246189; darn=lists.xenproject.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=NbVIhU0HE1DDNfS1gj4xjsrTs3iMwsqqeDqC+/QzzgpHEvZIvG8GZiMIIfIphkjnFm Rya2O+kOJx23kzvVCriif9OfG506w3YwgEXk5tYLz/KEdDbEyisQsWpxN3x2nDHAQ89B sMGCgmXGEb2INgCW8KsJpQWwT3p9vucnQkKcW265I/+INQ9dGsSyiV0q1SyqBq8D0Xgi cYnj2ocZNn72St6r0dTAnCTNtgtz5hmXqfVUIaNNMxqjAWIufL7vrYWUeY3aWik1HxcZ OJRo0xHnHdU+aC77irQRu3xFGuEfpbc85OSMBGqIeBoo7N/2uH8oOrh7NwnmLZ0bKe2q VMvQ== 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=L/RJeKm5GInCGI6XdJmsNzIkvCVDojscFigePSvlbJwmk3DSpXy2JRlWT+9EX+vBtj KWfeqHCZf8dg2r5FCBklLbE0WLOY28S584NGH7mGRs+pg6tnR9HSUpKITTqCxhvrc3Lg 59Mv6/QjdEkH0LKaCYKtNfQtGPYTi5RS160SBXihVEKNC3ia1cOYqyX2uWrrQTR+KYZl 8UAygpYJMU2IC3eiyqtIu9P+QdqIIdLqLoNC5YQEFExUG+x6RMylWmWlxW4DfSNzs0Kr hSUH8Mt1DNeUgHsjJGMQqdo9lvxYcKgADcc/mAM4BZ4sVjMLBQWYLjrFq1+I2LO/2c2+ Q3Hg== X-Forwarded-Encrypted: i=1; AJvYcCXfwtR/v1keepv9ELyldp4sbYgfe06c4VwLejAD0yqWfe6GbaWdMYfkYF02FoegioUAJkBxiYQY8OJ/U6CrJw9l6gpNQId2aA9+x0IMa/k= X-Gm-Message-State: AOJu0YwSiyo9IzbLFK7NHb5p2xlNJm5aLmMCqRgZhKq6Tq0KR7XHdgo2 ZTxlP9UbA1+/bnWWRxHMvQ2S1EoZoQTbUQP1EePrp4i/GZSvpT+qvAXm3QntrCbXjoWoW7wSO4A K 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) 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 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: 13608848 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.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 3E297CD1284 for ; Thu, 28 Mar 2024 15:59:38 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.699030.1091507 (Exim 4.92) (envelope-from ) id 1rpsA0-0006YU-0V; Thu, 28 Mar 2024 15:59:24 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 699030.1091507; Thu, 28 Mar 2024 15:59:23 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps9z-0006YN-Tm; Thu, 28 Mar 2024 15:59:23 +0000 Received: by outflank-mailman (input) for mailman id 699030; Thu, 28 Mar 2024 15:59:23 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps7I-0001AK-SM for xen-devel@lists.xenproject.org; Thu, 28 Mar 2024 15:56:36 +0000 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [2a00:1450:4864:20::52c]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id c1831ad9-ed1b-11ee-afe3-a90da7624cb6; Thu, 28 Mar 2024 16:56:36 +0100 (CET) Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-5684db9147dso1315122a12.2 for ; Thu, 28 Mar 2024 08:56:36 -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) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c1831ad9-ed1b-11ee-afe3-a90da7624cb6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641396; x=1712246196; darn=lists.xenproject.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=gnpdPFgLW51sHyUyoXDwAOZDvI82FBpxhPc1kJVd0P9OD+7e9BhtZVFFO40jzchbss VkTI4CekE0NeVoVzrAAMMTZlO7irkRt417toCdVs0Vd/bsP0bMwgf9T0O5sc8zm9D62u qrgU5PVgvyyOkWhdTvcodVbGc1u2IKv1/J/l1pa4Db+oT20L3G9hUzbb6y+djmif+EPQ Vmw/yflu4lHS5lPkcqIgqElyt0VpedKVGk9VbTOk+vOjWPuFHrPNO/CnHFeXOd+eVUV9 /2RhBmvOtqeWCF7ol7JeHxDXkovaoPgReWAHhYGLVPpOO0F3dSLOsZgF7MLn2H1Nb/EW DJlQ== 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=shV4e98lHzsq7+CX3Itr+Kbug4Fk5fGKUZne70K11rMq0F8smHLE9ZsEXiui9cNhLA UfXKo8Nw8j4b428R0Wdmf8VXhnKSemzCfl6N1M0eOCtoeZxLV7jXrACdc7TRogD+9J2N XQn+RmjOTx9LeBFWjB6R4CYeUZW9POh2Tw1uEibBKpvUkZ7KXnK0TQ1PdLtEs1sLVBY1 /I2w0ioZch9RhCO+/zC37LTngmtZjc244Qv2V5gqmtHsuQVex06kvI6/UU5ZeyNFYS5B LZ2uBvlgu3yUHENyvwEfFcNSpc29QIXLMX5E06jhQ6oZ3wYX5yRME4Ab+VHP6ipyhFKX glFw== X-Forwarded-Encrypted: i=1; AJvYcCXaTin6EX8lHgqxMhVP4ars4fwYtjb0qhSlBsAdZg1ACdjn52ZiPyOPEO+/iFfJhw+reMN/aTHJ22JPW1lmccojQ3JYCyx46owPXSB2K2E= X-Gm-Message-State: AOJu0Ywf63NaRPxaZc34WS2tG+Qy7tArtsPKxB15XqQIZIlBIfu++SMf w42N1fUwhYXuWk34+m7ObYI4QqZwaj2WQ9SVDIT4OQJYMQgSWM1WvKG3QoRfILs= 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) 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 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: 13608851 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.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 27269CD1283 for ; Thu, 28 Mar 2024 16:01:42 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.699038.1091553 (Exim 4.92) (envelope-from ) id 1rpsC6-000182-VS; Thu, 28 Mar 2024 16:01:34 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 699038.1091553; Thu, 28 Mar 2024 16:01:34 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rpsC6-00017v-S5; Thu, 28 Mar 2024 16:01:34 +0000 Received: by outflank-mailman (input) for mailman id 699038; Thu, 28 Mar 2024 16:01:33 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps7O-0001AK-Oe for xen-devel@lists.xenproject.org; Thu, 28 Mar 2024 15:56:42 +0000 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [2a00:1450:4864:20::533]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id c50d2a0f-ed1b-11ee-afe3-a90da7624cb6; Thu, 28 Mar 2024 16:56:42 +0100 (CET) Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-56c36f8f932so3857578a12.0 for ; Thu, 28 Mar 2024 08:56:42 -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) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c50d2a0f-ed1b-11ee-afe3-a90da7624cb6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641402; x=1712246202; darn=lists.xenproject.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=RWcLFlwpxKOxRVTv6vZ42+0EO6VG+UqgRYg/Yo3diAdm7VfxfYajPuiS/IWOCVx9n4 gnavJs7860POBYvxnh+h48KI8/oAOCLgxg0TTSdlKVlF/tBxBic+H4q277gRJo0Ttt/5 tOlM632xJ5ggf6c3ohagfDn4o+Tz6uZ3eMVSVAkrCe7MVVtXjpsXnLAhTSvcin/6TK36 5j8Kxl7K+FkF+FIbIShxCzT048BX4Gy2hwDeNN45OHLlzIrcqbsLJMFCXBDx6aj8Bn/O 09/dy7b9LgaS+poSbdkLS+YB5MZ5M2UmayC4VA04XSbN30OqYG6oC16p7pBeRY7SdwPQ UaFQ== 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=L2Sokzu5ITWusGqpR5j2WJ8y0jLddOsJrDXnyfTaxX1Y36mW/XT4Q7SmPE8+kouH47 sN4DFGt/JXON5fe28/TcM25sKvhPC5wakW2AKpTF95a4UBSM/CoQR7dsjpYIWrnJElye f85StrGViMWCN1LJPykCCRQ0Tp8RKCnrBUffMOMaSNLV4rf2r3dv+lJtNx3GYATuiLOL YDowCuRF0kk7gObdsRxo/snFtTgMAahQ7AIyCW+s48kGvdnvTO2Ki57fJ/80cQI6DOqy WajyDsF+M67g3tW7+QCs4sgyVJyq8N603hRJ3ZTeF6C2/WlUKZOTNZp5huOK5ONH8rtk B/AQ== X-Forwarded-Encrypted: i=1; AJvYcCVZMbbauBFZmg6AxeTvF30z3sEOlK8XJESSEucBgYW3cUc/Nc6P/okyFi+ur6FBiirenzkquMWv20idlGjLx1O5jMuvOc8N6Oq/WcHG/Oc= X-Gm-Message-State: AOJu0Yz8RUc58JbX1bPWWHAhSWMuHzSbAaa+XbVqMjDM/cGRFQOgBt6K riwPjbXyyIyDaQTYevkrZOXM6MIVFhceYi411fr8e6ibQwa+Y7E1r8ckVb5tH8o= 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) 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 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: 13608846 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.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 C0D9CCD11DD for ; Thu, 28 Mar 2024 15:58:41 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.699026.1091493 (Exim 4.92) (envelope-from ) id 1rps9B-0005QW-Ja; Thu, 28 Mar 2024 15:58:33 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 699026.1091493; Thu, 28 Mar 2024 15:58:33 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps9B-0005Pq-Cr; Thu, 28 Mar 2024 15:58:33 +0000 Received: by outflank-mailman (input) for mailman id 699026; Thu, 28 Mar 2024 15:58:31 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps7V-0001AK-1u for xen-devel@lists.xenproject.org; Thu, 28 Mar 2024 15:56:49 +0000 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [2a00:1450:4864:20::62e]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id c8c3fa24-ed1b-11ee-afe3-a90da7624cb6; Thu, 28 Mar 2024 16:56:48 +0100 (CET) Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-a46ea03c2a5so216859666b.1 for ; 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) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c8c3fa24-ed1b-11ee-afe3-a90da7624cb6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641408; x=1712246208; darn=lists.xenproject.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=THbj2G4pRSyqcX7zGCv8FZ3Kjw9z916Flj1ZcDQO8dyIO9fmrg8zrDl4HQ8ErAxQ5m Cm5xyqf8FsiXzq3+HbSV+Yni/NyHB827BgCRV00bvn2orEdmLsOdnKaEnFcgebPtcphh wqvHFsgZ5R4Tnu/BfPmUhHH4LKN3e7xOvk9Mv0XcDWDq4ocxokge6aWQQd0X0YsHmHmK riPxiT1gY9Yg6nz+k+cvQKpDwo+kUvWG11U8hAW0lg8wtDq1fr+JZ5W1UflF2FHcWu1F jtfGzlqcLdkUcvaF7GvDQ/ZHfV+lqBAbCajUXNYvLiNYBbUiLTbpAHTbJHOsKLlTpQqv pn9g== 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=GUTR01UyxXmykMSHJ/67r4FujSCOhkA3dgXhEf+I9r0zC3iaENeujIJT7zCHLvLpiV JnrNaqzrqKHMFkNOaTrr9+QGOwG/DfPiJ/+4nERQFOnBi93FaKpj7Y26vwYMGBONPsiP 1d1hCY9K+nmLmofIGClfSspCGE2YSRNKl6OuAL6wmMk8nGWNpiiNlu0hDWPkzumhKlV4 oZut4iKwGBEUMNMVJFbMBA11BR+Y7D2JTNlnjlhUZzw351iaozUxZElxUFoLeL9lA6B1 NtOuWoDOhBXQ0UyCxtv4RZJzuEHB7hzhEnB2jsSNsK+Iy5l8NOp7z3tkA6EReNYaDNgl bOtA== X-Forwarded-Encrypted: i=1; AJvYcCVSDbFAQIozLKArjDWcmV3yXtu2ORZi+cKpbP34bHFwaHQQnxCXdk3tVNfazMLuZgKpWZtW9wt3bYHm9TUXN/BNUglstWb6pR3O1idVd8o= X-Gm-Message-State: AOJu0Yw6uIj/K1V92VfcbGQWBfwXxWQwbBAfcH1YpwBsEbc6niPwOKdG HgVBrH+aPR9U4zeZ2nmBHN0/OVIplkIFN1Okhgl3ju5I6Zl82CVkf0suo8XVeIw= 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) 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 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: 13608850 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.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 7C0E2CD11DD for ; Thu, 28 Mar 2024 16:01:39 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.699037.1091543 (Exim 4.92) (envelope-from ) id 1rpsC3-0000pb-O7; Thu, 28 Mar 2024 16:01:31 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 699037.1091543; Thu, 28 Mar 2024 16:01:31 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rpsC3-0000pS-Kh; Thu, 28 Mar 2024 16:01:31 +0000 Received: by outflank-mailman (input) for mailman id 699037; Thu, 28 Mar 2024 16:01:30 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps7b-0001AK-C2 for xen-devel@lists.xenproject.org; Thu, 28 Mar 2024 15:56:55 +0000 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [2a00:1450:4864:20::630]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id cc8680f1-ed1b-11ee-afe3-a90da7624cb6; Thu, 28 Mar 2024 16:56:54 +0100 (CET) Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-a2f22bfb4e6so155203766b.0 for ; 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) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: cc8680f1-ed1b-11ee-afe3-a90da7624cb6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641414; x=1712246214; darn=lists.xenproject.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=LziBG55fXFnBOAAR2+719XgGwzr5DV3/+fBODODb6hO9Eqwt59sGLE2eVqc9w1zjhL yHxQA5QZ93utZHTv/qoUa5Hh7DZEOGH5mN4ZYM7uRdoYL+i7vtLgUYKajhwA5uveDHLt RTaBq45tlyDnhc5daWAUKFQ0EDF9L0S060a4rEJch0joV9X0ko5slrAPj4ZiSAmr2kpU J0z5btOCOfdZCmSKwMK3zJHidw7nqq2xv2PtU0OqVyAkGqiPQKXC2sRWZpAkG3oY7+4k Tin+oVDeyRVHUg7CcR6YBPEE3hVTUCOLPYkIzglSWLsStg8Pikfl6A+oHagG0QZrIp+Z a0dQ== 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=jCWfIN+DDrCKAxkbYAmq5pHwC7zlBl7mZuubXuozji4ynpdjhTEHHXQuS/T6KVsmIk IrFs7NXfigxaIv11kGPVlxOfMgYOmCxD3i5lXtTDx3bbiWBEvzXy8cBSh/zYpCAwg5A/ KJYqdF5a8sP73JD+cSTWTwK7z3Qxh4ZWlGl+N6K9ZJXFGruX/Cks+uU/vVtibXEDWy+a eTfAuGlxlJfcJ3nNhFX7pw1rBtjDTQLuj73M35EQxfbkEB1XnsS94ahee0QilzmiCDLM +40jEuDbdbg6Z4NPS06mPVJu30va3nkVpEsGNtOH0lhwLp0Iw2Frq7CG9ASJBU3i7HVa Q47Q== X-Forwarded-Encrypted: i=1; AJvYcCUIGXQ/h8JlvSSZbn31WP/cKSE8Ps6IfpkP3wbBI1yrgBv0wJrqYavHW7+Pc9cPgzyjtcJz7gkUy31dPzVDHYcTwYls8J4ND2DSqQ+U2rg= X-Gm-Message-State: AOJu0Yy0xJGlM2KKXEPrGX4AxIXBlX2Zyx5lQiEv+NAfQ4TP7thzZxpL 9dVcpvrVZKJewHuft/KoFYp9gf6AB0ItDg2guNbCq4nh8zUEoMRhe1sebQlbXfI= 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) 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 "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: 13608930 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.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 CE221CD1283 for ; Thu, 28 Mar 2024 16:11:32 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.699087.1091633 (Exim 4.92) (envelope-from ) id 1rpsLb-00084Y-VI; Thu, 28 Mar 2024 16:11:23 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 699087.1091633; Thu, 28 Mar 2024 16:11:23 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rpsLb-00084R-Rd; Thu, 28 Mar 2024 16:11:23 +0000 Received: by outflank-mailman (input) for mailman id 699087; Thu, 28 Mar 2024 16:11:23 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps7i-00071m-FZ for xen-devel@lists.xenproject.org; Thu, 28 Mar 2024 15:57:02 +0000 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [2a00:1450:4864:20::630]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id d0226048-ed1b-11ee-a1ef-f123f15fe8a2; Thu, 28 Mar 2024 16:57:00 +0100 (CET) Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-a4a3a5e47baso151644966b.2 for ; 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) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: d0226048-ed1b-11ee-a1ef-f123f15fe8a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641420; x=1712246220; darn=lists.xenproject.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=fTbQNm9sC7hP8TvZo64yoh7W9+gUa+lbBeORV82mRt3yUz/o/duVFycfCZ1f6Wj6nB 7V/Ald3tAKZudYvMf22AUcTS03diJ8pL17CEZ2rhr+Dy+mj6jtKToBHnj7ZXcn3T/M0x aftZNNVLh3h3fYF/YWvT4Hvd5UpefSfJMxvTDZIenokHCNpCbf+CSFgsWgqQnnstY7db OeqCQqucYsHxo1wJPnhliZ+bil3zOnf2OstRHXYQslpkF2ev4/RlHr8ziopGAgSuvUjo FllNj19qYKn+1jRDIqZr38fF/mlovjfWuGdf4DFfE0YJC+toLQWFeUPXYa5d1IZ1bztP +oAw== 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=ubpx2/goAZ6eY9QA6RsZmdEQPTsORe97V3KDyAdIxSsboJ/91E8DCyk5UBQM2jl1dI kjHQpbGctMFIc4XuFHk5ftDmqZlh1GrTPlmYmdHNYHn13ZwgTfb3hS+IYwAx7BdpjKpe R9cmyCe1C2SDmYNlI4x1jXYnC13Z/KI05IognC2K0H+BePNIQjNrFRgp7+KolrZTeorI g7IbzjEH84r5by2aOtLeeBods1fVMLOIdP+y8CrvFjggt+wjZcpkLYJX48BjM7ZSrV6w swmz9UYlHEnYnygpF/pFJG9B8boU8lEj6TU7NfY40c8S1MsGQhY/T2gAsx0Uo7DGR9SK nj8A== X-Forwarded-Encrypted: i=1; AJvYcCXweWtMCP5oXfAqCvJ1NyZ1+VRR3KaQOgUiQMHYtE8MIobwr4pAKmmNj3QRurUauIzT2QZeuA42Eee/sIcfInKNE2fUAYFK94SFAbcN6Jw= X-Gm-Message-State: AOJu0Ywo58zhqzEHQzo3qzfUATk0e1L6vAFBgPlE+eDx932nrKjfqmq9 kQapS+8moCHkejO+ulPK1rjs6hm4jSlbs3l6B4BD9aobRJwDSHpXZ8keLZg/eTw= 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) 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 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: 13608931 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.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 3592DCD11DD for ; Thu, 28 Mar 2024 16:12:23 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.699090.1091642 (Exim 4.92) (envelope-from ) id 1rpsMS-0000IR-6f; Thu, 28 Mar 2024 16:12:16 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 699090.1091642; Thu, 28 Mar 2024 16:12:16 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rpsMS-0000I6-4A; Thu, 28 Mar 2024 16:12:16 +0000 Received: by outflank-mailman (input) for mailman id 699090; Thu, 28 Mar 2024 16:12:14 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps7n-0001AK-EE for xen-devel@lists.xenproject.org; Thu, 28 Mar 2024 15:57:07 +0000 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [2a00:1450:4864:20::62e]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id d3c5034c-ed1b-11ee-afe3-a90da7624cb6; Thu, 28 Mar 2024 16:57:06 +0100 (CET) Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-a466a27d30aso140700166b.1 for ; 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) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: d3c5034c-ed1b-11ee-afe3-a90da7624cb6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641426; x=1712246226; darn=lists.xenproject.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=H/TUrYVppdn7LmwRGsgx2j1wQU1h58w8/D/39uon7Jhk6b7slCRn97xbTg/LKyZoVY VJBJXV9OnD3YoJ3XiVC8kZxVxyNX/BZaTexO0SWUHL30WB0K8btFK3HGKLNjCq8ztgna vUnz/75nWBTquQnVecf1GUicG7lMFGgIuqkl0HYQFspy7CXJola8DESy+ff6OEqY1/Hk G26nvrb01XzF71lPtamFgGQum8MDO3xo4XW/cy62T1HEMhruqv3jF5vbEiJmJubnKesE RmmIFPNbVgBM55MOyFb8m6qqX4T6/8hCwqt2xi5hgXb92SfTNV9PtYsTciLDDy2gcHBK NnVA== 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=lttiTexABxs/MZ1G9wVhWkn3X6mdCF/63J+2oCOb0SdU3eM4hxen8tIVBXc2bKYz8D c+IgbGvXXAVZoJhPci/GaXb7KaPfS1zoI5lOYpGkTIAyPZdeHlmYmL/iw5siZw7vEmz7 02YJp3LP38zW/5TeRLnzD2ibieu4243U4q4He8W08qJdg6SW+2dazjuEZOBThProxg7e 2qBl+1oxiCUKLS+fZYobgtVYvuB81xqDv+iyNlTMMvo30nQDGj0vqKO9sLX8w++BvpUn AXZzEVTUGrbJdILxL42P5u1jpz6B5QeppuIogR84h5wucdKLB0GPizkVtK0gHqoWkZch inww== X-Forwarded-Encrypted: i=1; AJvYcCWdjweH8hCNV+vAtH7CnsX7fF0Ea6497PBY8wQGDvWS8rzMHqkFs4OkBxh9rtfVxn9mz6PofYakHxzHHDo6QNUGHNZnpXsFWlMGv/EeO8c= X-Gm-Message-State: AOJu0Yy0JqKG5kgPIqm7Q+2R18VwWwABH/w+tWxO8OqlpsrGwi4PrYWk +fBqx38XNPRz22s+Gsc2a43dl0p8gkE4jwgjLYhnfBrKGsOLyUav6NC1HrayfiA= 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) 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 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: 13608928 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.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 4C452CD11DD for ; Thu, 28 Mar 2024 16:09:46 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.699081.1091612 (Exim 4.92) (envelope-from ) id 1rpsJu-0005qD-8u; Thu, 28 Mar 2024 16:09:38 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 699081.1091612; Thu, 28 Mar 2024 16:09:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rpsJu-0005q6-6J; Thu, 28 Mar 2024 16:09:38 +0000 Received: by outflank-mailman (input) for mailman id 699081; Thu, 28 Mar 2024 16:09:36 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps7t-0001AK-RP for xen-devel@lists.xenproject.org; Thu, 28 Mar 2024 15:57:13 +0000 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [2a00:1450:4864:20::229]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id d79ff39e-ed1b-11ee-afe3-a90da7624cb6; Thu, 28 Mar 2024 16:57:13 +0100 (CET) Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2d485886545so17750501fa.2 for ; Thu, 28 Mar 2024 08:57:13 -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) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: d79ff39e-ed1b-11ee-afe3-a90da7624cb6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641433; x=1712246233; darn=lists.xenproject.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=OcRZeKwc5MAFrMjXvdeEeYyW5w79qP/SrZQlhZUXnYIuFhKrbRm1BkkR1TMsHtlqfL 9clYB9IQxvJsHjcpBgRd26Cv5BPzgNbCjb48zDVZZcvix0wrRtWnH8XmEWSMgmmw/p3u TdVnPbrx+xJVDJHzuf79mYPxXboEDcSr/DYOgvCVPGsbihlgKwPuTi8308WYy1ptA358 HLHeduXayJzVXlqcYIGfGwaz1XTdeOo1hKFWYdlTfqLqW5JYI1Wl1iNsygKHObIuijEG xjt2eof+n0Dxw3UayP6q5Pxb/VEy8mM7lukfy31RyuNQzaQrtcRzw7omLdGJfx4MAUcs nu6A== 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=cV+mnpKPhW3T2JQRoeQDvrew9UJ5Azol4xoX0DS+uXrrIsLAeZ/TJi5n2jUPNXTBBm Rrnv3dzhPXqrjUgS02b47RuZQFxPgubqQuGGgKsGsmj4Y1I6acNRTMfpbwfKkSiGLf7Y HEYUP2nWr5xmi6N4RGJgcvdQHI3aOA4RJSMOZxfgDxH3huR0IDCc980ygF2Psnt5AI/z fq0w/JKNiDA3l8smijA7TYL9b9t1TgVbd/19XgKHiICePyNArj0Kuzm99XAu6hqbZCRu OtTWGpNBqlzJGnd1NMKZnnCx0IKCzpxA9ym3+Zn1dn3YpO14k8D7FIRZi4rkhoc4hvVb DFDg== X-Forwarded-Encrypted: i=1; AJvYcCXAOVhkwWZ+fhYE7fzPWKSvWOHFcuxFKQ+jLT3c+Sh5n6Mh/hVHb8OLQOvOC3+jj7nRQsRnc1Fd5OWdnibq8b5SmLcrXDsuxSS7YSxnWRg= X-Gm-Message-State: AOJu0YwkLSp2tTyLgOX2pJy5dCjvijDMekg9bsncpjvASmDcC7DLWbvK wsY0pmJduB/0WZye9Q88s8BG3WCKqa/jpenkJ/2vgvqKi7Uphp6C+T8PINpbxVQ= 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) 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 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: 13608847 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.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 D3272CD1283 for ; Thu, 28 Mar 2024 15:58:42 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.699025.1091487 (Exim 4.92) (envelope-from ) id 1rps9B-0005NF-8A; Thu, 28 Mar 2024 15:58:33 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 699025.1091487; Thu, 28 Mar 2024 15:58:33 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps9B-0005N8-5X; Thu, 28 Mar 2024 15:58:33 +0000 Received: by outflank-mailman (input) for mailman id 699025; Thu, 28 Mar 2024 15:58:31 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps81-00071m-3g for xen-devel@lists.xenproject.org; Thu, 28 Mar 2024 15:57:21 +0000 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [2a00:1450:4864:20::52f]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id db4cd983-ed1b-11ee-a1ef-f123f15fe8a2; Thu, 28 Mar 2024 16:57:19 +0100 (CET) Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-5688eaf1165so1563121a12.1 for ; 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) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: db4cd983-ed1b-11ee-a1ef-f123f15fe8a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641439; x=1712246239; darn=lists.xenproject.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=urCTAc0pM2fSVMVe4942E6e03pP7UrNwM+65tC2gLhhpT89TRnUFjPCagACF9b9Haa N8pAl0FH4karCohbzNmdO86SKN6I8sP8IOab/99ULp/4VfKtOcrqjx1Cq8UI0+X1l6Sb OJxoMRABGW2qolkfB55gckFkIajVQYY/7x2hpYqnW25i0oGuYIlU8wqVEBvLiLAXTp0V VMnhGKT/gKdDsY7lhnod41uXOxMSgwOgeUcrwTeAmahbkLRGNVgyX1hoXz+7iE4IVJjM Zml0aKYLisScG3UbXeYBQ74wqEZ7hE4z0nizHC3DvNsprLWIeFbXgq7T9weywnqer6cF Ulcw== 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=EzjWqr6KpZ1mjewm7ZHX5r0WZN7Y4sgAZpLVe4b/ysS6mP5YSV15PrXftTkdIV6m2T wS3KQraV40O5gvNT5443iJJsqjySeIveG0DT8sxJCGGYONOjGDwn4VVqmsRuJA7+ipAm ijERbN6dIZSu7T1xhkYFduxhOIQ9ICvO0r5Bsoie6G9jImcJsabe1y6q9KHIeeke5dyR aJFJcLvFqEbtJ1FO/hlcncPSqhPuLfUPawBzVA9iKvVI4yuSH9aAyoSl7Ihc5CAaUmsL 68GEaUtaAPQjcWA2NVOOwlGjQSrwnYdy2vIwfv7fohOQ4qKihKngZDETZ6ozv9HkADHe 1CEw== X-Forwarded-Encrypted: i=1; AJvYcCXFV+NewaBYXYz9mALMU8oF9VxidU6PDvLydR7lndZupFnaLpNgJOF7lFwfcERK+jKR/U8ER0LjwcgL5cVVaJWYErBQzJNGcvtaEviZOvk= X-Gm-Message-State: AOJu0Yy4OrAOA3ca4FSzyQn7M+/JIXRrFZ7YZX4KKGg+ixcSVuBEHlX8 bhaHCkUxXYn4w/9uJFVjPySi967O90EAG/zsvfEIUlt63NcXsKQg4BljS6dpFeE= 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) 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 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: 13608849 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.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 63EE1CD1283 for ; Thu, 28 Mar 2024 16:01:28 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.699036.1091532 (Exim 4.92) (envelope-from ) id 1rpsBn-0000Tn-Ee; Thu, 28 Mar 2024 16:01:15 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 699036.1091532; Thu, 28 Mar 2024 16:01:15 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rpsBn-0000Tg-CA; Thu, 28 Mar 2024 16:01:15 +0000 Received: by outflank-mailman (input) for mailman id 699036; Thu, 28 Mar 2024 16:01:14 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps87-00071m-Ey for xen-devel@lists.xenproject.org; Thu, 28 Mar 2024 15:57:27 +0000 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [2a00:1450:4864:20::631]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id df0457be-ed1b-11ee-a1ef-f123f15fe8a2; Thu, 28 Mar 2024 16:57:25 +0100 (CET) Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-a466fc8fcccso150254866b.1 for ; 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) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: df0457be-ed1b-11ee-a1ef-f123f15fe8a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641445; x=1712246245; darn=lists.xenproject.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=PeVw7HqXQfyBYwOKtTmkKxh/q/3MsDf5dRffkzxN75mmNWLGDz7BfVnLg8UpfjkAg3 wI/pk0M6bxXyA1jrgBCU4MlXe2KbpYWkhEIIj8qYMqyxOmVTJwXrS3PxFl8AvkrAq/tB LzFRv+slu77S3ImpIMoz+N+3s/hvDiXfv+bW3v3qaMp4bU4JROokgdUiVRDAuiQCaACB S8vQAGYW74BwUaU3x4GJh61cqkY1ic3HkOoGEKgosfwXanV3dd3OOK/yfU5bews5qTS3 VuOQrXHCY+7AbLOWwXVZejkRUgOt3+vhm4UB55w7WOUQXhsH95ay8CvBzTJSXZ5LjQR8 iuUw== 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=dlrhL8wiWOdA7rTUMueHCGsk4xNsjpkbZ5VFF6zxtvytoeThwrQDdCgK6b/gpl1kcz TTGIkJbCsGnTp7JP6wsE6+rfNSnYrDQUJOKIPzWcFMl+/ovsILu5DvD+M7V8eJkdmFAQ /9p5/XN4zkizrlPhhHJnv/Y3fvWOyfMJ7Zcx8rNHtvQpAMvk6yTYWCoIRM/mGMifSlka l2MQFm62e0uCZOLseTVITG5R49GGwy+Jvj0fwNg3O2ioOqz85M3Dsi2dluBnc/lLfFYO Y7CQfYilYZ4QqaWeCPnz2pk7m6gPV7ahjRKyxhQOSTXBmpnmY5ylVI4O2dN9No+hjh18 VEqg== X-Forwarded-Encrypted: i=1; AJvYcCUrO0trlGvISPTKXfXOIHddDf1fUrfFKvy8LmIAjRjlNzg4nTRRyaRgmtfrWZq+o3e/d82U4vpdRTORdoknRlYppTwwy3tS4qvYIePOrhA= X-Gm-Message-State: AOJu0YzL5a8Xd359Cf6IKwVi0ZqcS66vmowWNxA8il7Po88Ai78739gv oX06+aIEJQq4M65Mb/MnfLFCVT4+f/Ws6zWzcYCV5CUF5K9mS0WcAub66FRWxDU= 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) 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 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: 13608914 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.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 9C47FCD1283 for ; Thu, 28 Mar 2024 16:05:39 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.699060.1091593 (Exim 4.92) (envelope-from ) id 1rpsFv-0004Im-Fe; Thu, 28 Mar 2024 16:05:31 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 699060.1091593; Thu, 28 Mar 2024 16:05:31 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rpsFv-0004If-Cj; Thu, 28 Mar 2024 16:05:31 +0000 Received: by outflank-mailman (input) for mailman id 699060; Thu, 28 Mar 2024 16:05:30 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps8C-0001AK-ED for xen-devel@lists.xenproject.org; Thu, 28 Mar 2024 15:57:32 +0000 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [2a00:1450:4864:20::52b]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id e2aef80a-ed1b-11ee-afe3-a90da7624cb6; Thu, 28 Mar 2024 16:57:31 +0100 (CET) Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-565c6cf4819so3746426a12.1 for ; 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) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: e2aef80a-ed1b-11ee-afe3-a90da7624cb6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641451; x=1712246251; darn=lists.xenproject.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=n+5XDGcQYBjbYVDl0ASQF6LbHmjFNwot3DYVVLcUQ5AKH4cDVyVaq98Yz/D7DN0ry+ dy+K5++IZbFg5sDgzdckSPlwhD26c5no5pk5+BZXgZIBIcZ72tqJj7tNfAyClCXkJmA5 ckbxW5PD4Wqa8PCXW5oREgAHbLg5EAM3uhfcQ0Im51gzjWOje88fH3l60zP1F8zh/li2 8TjUUpfQGcnauwyQpqg8DNL5vPAsWTmCgiIIWQOhN5cf3BguKBGRDeEXSIXOj8a+2b3H p3N+dgpr7fKCBLZEmAsyNBPOj3QUn/7ipsgF8u/GZj5uMmEJdJJoFENIdSwhz6tOSLii C3bg== 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=FS1zMk4ydoi6Zcw3HPpoS7CaUoTPFLXC2qHkANTAC/j+LkOeGDyhHJlvNz7uqrrOLA l4F4U/G37r3p45erl07sHgzdhRcG0oudRvaMywiOfJwT32WFZReqm30IG/3CX2qQpK9Z MgE4cH8gYQXwPXm/bl6iT58Cvn/pKhKhaBvKMJB+SaRNIIxL0CSPuKreNlnJn6DfBD7S fdeFP0cYdFpKe+GS7pZ7Mg7duUpsGU5sRMpjOY9IRlSu0/fMPOb60EFbWksNZblfTUri ulh1clW+jqXrVgxgXeMfeRCAHphJv38DjG7wS+7O2D80ZjSvb8cmPP2mVlWK38z1rQDJ IaIw== X-Forwarded-Encrypted: i=1; AJvYcCVX6DAji0F8XxKEIgFLovy8hAwsDoWkVCxXlUy6ftsDXA1r5uSu7Uzrnld8WYshqegrfAE/sSxVj93RRnvgxgcmkmEpoGlPJDV4IRc3Tgs= X-Gm-Message-State: AOJu0YzZkHWc7e7052qNjX5msNvcgF3Bbz67JrCUUVsgYxjFmYXZ9Ck4 AQnFCA88/huNqCI/Q6F0+MJu8K8ik36O2/OiR3LtV4ebyvsWvtLhLfWgTYTrgEo= 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) 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 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: 13608852 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.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 55A00CD1284 for ; Thu, 28 Mar 2024 16:01:43 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.699039.1091557 (Exim 4.92) (envelope-from ) id 1rpsC7-0001BC-7i; Thu, 28 Mar 2024 16:01:35 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 699039.1091557; Thu, 28 Mar 2024 16:01:35 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rpsC7-0001Ae-49; Thu, 28 Mar 2024 16:01:35 +0000 Received: by outflank-mailman (input) for mailman id 699039; Thu, 28 Mar 2024 16:01:33 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps8K-00071m-47 for xen-devel@lists.xenproject.org; Thu, 28 Mar 2024 15:57:40 +0000 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [2a00:1450:4864:20::52c]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id e699f142-ed1b-11ee-a1ef-f123f15fe8a2; Thu, 28 Mar 2024 16:57:38 +0100 (CET) Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-56c1922096cso1486560a12.0 for ; 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) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: e699f142-ed1b-11ee-a1ef-f123f15fe8a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641458; x=1712246258; darn=lists.xenproject.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=GSd899zuFf6RMLrZBW9cClN548SHoJV4gzuiuGLbyr5ETcg/LtuoXsscBv5UZ4c0Lx Fq+P4k8U8pw2MCZ4I/Tn/KSw8wstTDYRpSu5kYobeQZwHySXya47Hxipi7NyqtoN8ciH FdyXkEd6faVR6grUZvTDzUN/xH2TuOJu79alVcwfS0PxN2AEqd7zRHptZV93C2w+OHJt E8q+eRCXM2LD/6bRhaxV4lDlbBNZQOwWLecUoTCJ6W/4fPGGyMVDGDBkOt1S9wOWDVHc gtGt/y2nUVkeQ1+PLQ4ANAyUlDAE9ehodw8uRJiF3zqjg/+XEUAwCmjBW1wm0YAO8hZa 682A== 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=sXoS9TbifQk2O7Oc5zlWN+fxX5Cbgx1rvPjCrItsZuJTNmVMh4ryaUzVcFmBZi+DWf lx70i0/na+jKAXVDR5XYhTBEEBgMwh6mmPY7TaE1z12W1KW1n1OAqAJYPJEUubsvQbwk QhpWGkLYGZeZkSi67Y7cHmzmB8xmyGF3bfGOXbZpsvBprb+6WdYE+F2bI4CWohVGYA0N 2a5ZN+I172MG/KWsuPOS8Vinwj3fd/klED4I6dqJlM+tYipK1XeJc5zwdVu1TyfLgFWX G5g7+dbMTuBiH4GbCTPDXVkto9xhjNcizRpQXDg+ihHO+wzJbdioEFfCfajbfpZKpDG2 n/aA== X-Forwarded-Encrypted: i=1; AJvYcCXGg4OBvqyaYVqvzANdh/SLSmRmDKKYVrJ8iSYsL9mm6a7C7nvgAVwR8vjemcUOHVitmUaICQvN7oV/oPCCarQKZOVGeKEbVWV1m2DYBAo= X-Gm-Message-State: AOJu0YzFAm5b2NKiMHKUFG0J8OUtu571lWH1zjijy8BlOLJcdQYMSYxq b6Z60Ys/YSQWy0OeqhDhoPmLf7uoRfVNXx+otV87VWGuvbQBOG6X92yjM+0Gasc= 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) 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 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: 13608934 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.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 BB70ECD1284 for ; Thu, 28 Mar 2024 16:13:59 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.699096.1091662 (Exim 4.92) (envelope-from ) id 1rpsNy-0001sv-Ns; Thu, 28 Mar 2024 16:13:50 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 699096.1091662; Thu, 28 Mar 2024 16:13:50 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rpsNy-0001so-LH; Thu, 28 Mar 2024 16:13:50 +0000 Received: by outflank-mailman (input) for mailman id 699096; Thu, 28 Mar 2024 16:13:48 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rps8Q-00071m-F1 for xen-devel@lists.xenproject.org; Thu, 28 Mar 2024 15:57:46 +0000 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [2a00:1450:4864:20::536]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id ea569b5e-ed1b-11ee-a1ef-f123f15fe8a2; Thu, 28 Mar 2024 16:57:44 +0100 (CET) Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-56be32b9775so1376564a12.1 for ; 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) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ea569b5e-ed1b-11ee-a1ef-f123f15fe8a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641464; x=1712246264; darn=lists.xenproject.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=WvI1SBUK4fKEIdNST5Oom0UvcTyjk0JKgtMjJVPOFxIkuyfji5tAKzA8hrnw9pnA8I /5HQNNqXTjLs2BO7m7XiL+hadBT8bd2VbQcEoHj+/MVFJF+GbejXSkPR6OFZuzF+/um6 pr5ScokIigQD9i+T/sI51DWty9RLBKk5OgTGt/TnfDEbD1Rz5TVwtG4wuf8TDkZAqxnU CZ2kLvpSEg27Va7tcgGyA6mCDdRn0i5zppb79RwwNZSCPoFYhirLQItQsqj0DR3PhwkP F+jSx9UBdFeIgMOXRNvUkIe594IiksN6kf7LRuOoQRCATldF9nbHP23ZxRiaY2MKzKWB fNBA== 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=H7HtCWa1lKWFwIlMV/Dwlb4Arm4vOaFOQIWq0p4Vi6EofMVjX/BBIleP9SxG1kGVxt 9/Qnf5RH18+S07VW6RBYnJ8A9/oe/o2ufL5LwIG6N6bHgPKlAk/3IA8LfritCgKE8ten RO1uAr4ax4HRG5XbVLIHJxXsIca8qRW2s1BnIuwWsxGMsNpOKd7hALRvcmswSQr0sa1u 1r+rXdrJDHVwypByhRLTU0TPWKHJu5eSjVoZb6IjgEAvhXi+uxsO7d24pUMyEuS9MHMY 8iz/38Y3jrPKNj2mW8r1b4LFOHS1CubLBNf0N/f6l+EhgMFA4NmQNQ2OUMF3VST+ecGL hlfg== X-Forwarded-Encrypted: i=1; AJvYcCUFN905sBQh/WmeaegqW4nyTHiuIGy3+xmQgOl13QXPB/ytj/5/X9Gz2AAgd7JsAlYon2D+5xQLcQ7Cnk90OF5kpEIxYfj5OcMV4BPEqBU= X-Gm-Message-State: AOJu0YwfJIfcTlIdQwfd5+mma2MvRETMRpjuM0eBn9DsXs6xGobkM4gh 1B0nbXL9uoR0JTW+wd3opzADDwtq57hq+Q9SU5Q7Cai+YV+v/AARMGqb+yKjjZk= 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) 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 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'))