From nobody Sat May 18 06:50:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1711641308; cv=none; d=zohomail.com; s=zohoarc; b=YmjX39+nXR40W65+ZgmerVVu+u/X9BYJIyj4Ix8wmVfolul7N0pIfeEOjImkaOaKxk+wxbSpTbDCrll6iOhjhaZjVJFb+0bjMq5LRPn7GxLHjZMjmuzsw2btmVLwaKVi/weBgyVLcEquxnO8B+CRBZrtPIsjRMZalYy2W+lbrzU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1711641308; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=8xoyjiIw561YlGIaQRdLbxciG2dWfen0yY52crHbWn0=; b=i2cAifckQwHbknfqWuFUlAqgEPCRQUGJrOLZrZIWjSRnvDSIWZZT9D7or/qHcWadqTHSsr6FK5sL1w0y7BAWcG6gYEyTXy8nvGUEC7Ue0gHr/6chmFS8xd2iy4SVkyXS3CajiHuIrYWo/taJ6VTQwvN+VEY/LUt0P9kicKxKgOU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1711641308108945.8281509566883; Thu, 28 Mar 2024 08:55:08 -0700 (PDT) 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 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-Outflank-Mailman: Message body and most headers restored to incoming version 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=20Mathieu-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=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1711641309956100001 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=C3=A9 --- 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); } =20 -static const TypeInfo pc_machine_info =3D { - .name =3D TYPE_PC_MACHINE, - .parent =3D TYPE_X86_MACHINE, - .abstract =3D true, - .instance_size =3D sizeof(PCMachineState), - .instance_init =3D pc_machine_initfn, - .class_size =3D sizeof(PCMachineClass), - .class_init =3D pc_machine_class_init, - .interfaces =3D (InterfaceInfo[]) { - { TYPE_HOTPLUG_HANDLER }, - { } +static const TypeInfo pc_machine_types[] =3D { + { + .name =3D TYPE_PC_MACHINE, + .parent =3D TYPE_X86_MACHINE, + .abstract =3D true, + .instance_size =3D sizeof(PCMachineState), + .instance_init =3D pc_machine_initfn, + .class_size =3D sizeof(PCMachineClass), + .class_init =3D pc_machine_class_init, + .interfaces =3D (InterfaceInfo[]) { + { TYPE_HOTPLUG_HANDLER }, + { } + }, }, }; =20 -static void pc_machine_register_types(void) -{ - type_register_static(&pc_machine_info); -} - -type_init(pc_machine_register_types) +DEFINE_TYPES(pc_machine_types) --=20 2.41.0 From nobody Sat May 18 06:50:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1711641309; cv=none; d=zohomail.com; s=zohoarc; b=Bq76b8nqBwJFcfKrZZGL48ZUaWW2brmDE9W5Bn3OKoLKJBXXC8cqfw238oURmDIl25pasJwHEwjx2qB8vjNRLTK7YFacAlHkl8eysLuwgv4Oh6xm9acy/IwAc5jCXmCnapF0YfYRWKg8Dl7K5aqw728jP2z23URP2JO8sHrtBRU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1711641309; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=djs4Th+kjoxzBDQIObaEvmf5VGdYfcKG9Is4pj2rcJA=; b=Bqrg1ljU3Bai8k/0bt5nKhpULDC/X8srLLUzO0nCUaHivp/uB0rdPDcOrVegt2vZ1uPqFKL03ao8NvLdTaxnvN/iNUvMQBUo6adiXUVEcK+qLnWMA/Db4gzK9wPDIcKxOdyjYZ6NU0gyTF2EOSsginCvS5APZPqV2oQIXNyy55M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1711641309230266.470777234891; Thu, 28 Mar 2024 08:55:09 -0700 (PDT) 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 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-Outflank-Mailman: Message body and most headers restored to incoming version 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=20Mathieu-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=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1711641309990100002 Introduce the pc_machine_is_pci_enabled() helper to be able to alter PCMachineClass fields later. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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) =20 +bool pc_machine_is_pci_enabled(PCMachineState *pcms); + /* ioapic.c */ =20 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 =3D 0; X86CPU *cpu =3D X86_CPU(first_cpu); + bool pci_enabled =3D pc_machine_is_pci_enabled(pcms); =20 assert(machine->ram_size =3D=3D x86ms->below_4g_mem_size + x86ms->above_4g_mem_size); @@ -949,7 +950,7 @@ void pc_memory_init(PCMachineState *pcms, option_rom_mr =3D 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 =3D PC_MACHINE(obj); PCMachineClass *pcmc =3D PC_MACHINE_GET_CLASS(pcms); + bool pci_enabled =3D pc_machine_is_pci_enabled(pcms); =20 #ifdef CONFIG_VMPORT pcms->vmport =3D ON_OFF_AUTO_AUTO; @@ -1668,7 +1670,7 @@ static void pc_machine_initfn(Object *obj) pcms->pcspk =3D 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); } =20 @@ -1810,6 +1812,11 @@ static void pc_machine_class_init(ObjectClass *oc, v= oid *data) pc_machine_set_fd_bootchk); } =20 +bool pc_machine_is_pci_enabled(PCMachineState *pcms) +{ + return PC_MACHINE_GET_CLASS(pcms)->pci_enabled; +} + static const TypeInfo pc_machine_types[] =3D { { .name =3D 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 =3D system_memory; ram_addr_t lowmem; uint64_t hole64_size =3D 0; + bool pci_enabled =3D pc_machine_is_pci_enabled(pcms); =20 /* * 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); } =20 - if (pcmc->pci_enabled) { + if (pci_enabled) { pci_memory =3D g_new(MemoryRegion, 1); memory_region_init(pci_memory, NULL, "pci", UINT64_MAX); rom_memory =3D pci_memory; @@ -234,9 +235,9 @@ static void pc_init1(MachineState *machine, const char = *pci_type) } } =20 - gsi_state =3D pc_gsi_create(&x86ms->gsi, pcmc->pci_enabled); + gsi_state =3D pc_gsi_create(&x86ms->gsi, pci_enabled); =20 - 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]); } =20 - pc_vga_init(isa_bus, pcmc->pci_enabled ? pcms->pcibus : NULL); + pc_vga_init(isa_bus, pci_enabled ? pcms->pcibus : NULL); =20 assert(pcms->vmport !=3D ON_OFF_AUTO__MAX); if (pcms->vmport =3D=3D 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); =20 #ifdef CONFIG_IDE_ISA - if (!pcmc->pci_enabled) { + if (!pci_enabled) { DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; int i; =20 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 =3D 0; =20 - assert(pcmc->pci_enabled); + assert(pc_machine_is_pci_enabled(pcms)); =20 /* 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, =20 void pc_system_flash_create(PCMachineState *pcms) { - PCMachineClass *pcmc =3D PC_MACHINE_GET_CLASS(pcms); - - if (pcmc->pci_enabled) { + if (pc_machine_is_pci_enabled(pcms)) { pcms->flash[0] =3D pc_pflash_create(pcms, "system.flash0", "pflash0"); pcms->flash[1] =3D pc_pflash_create(pcms, "system.flash1", @@ -108,7 +106,7 @@ void pc_system_flash_cleanup_unused(PCMachineState *pcm= s) char *prop_name; int i; =20 - assert(PC_MACHINE_GET_CLASS(pcms)->pci_enabled); + assert(pc_machine_is_pci_enabled(pcms)); =20 for (i =3D 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; =20 - assert(PC_MACHINE_GET_CLASS(pcms)->pci_enabled); + assert(pc_machine_is_pci_enabled(pcms)); =20 for (i =3D 0; i < ARRAY_SIZE(pcms->flash); i++) { system_flash =3D 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 =3D PC_MACHINE_GET_CLASS(pcms); int i; BlockBackend *pflash_blk[ARRAY_SIZE(pcms->flash)]; =20 - if (!pcmc->pci_enabled) { + if (!pc_machine_is_pci_enabled(pcms)) { x86_bios_rom_init(MACHINE(pcms), "bios.bin", rom_memory, true); return; } --=20 2.41.0 From nobody Sat May 18 06:50:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1711641344; cv=none; d=zohomail.com; s=zohoarc; b=AKvcpbo76yEcsycGXvfWtSqb1a9ffrMY3me5lyj5CbF/NB9FLmb464AJUdqvcRyAydpk8Q4GblZDtHUfbyTJfuRBVgfrfwrl3J5mUpvYmkaVHURcw8u3PwrEsv2gmaAO3S9W3DHZpsbJeym0S5/5umTbCZbh2YwZvnoLODJmkRQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1711641344; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=2NXhpW96pCgkEoWuYwRT5cvChay+RSkHkEuAn7B/Dd0=; b=h6BZ4CXoeBaYi9OhKPuZs5MwM2WYpUBSJ85NukYxVpCG7IWVHFsBOZb0exiI/TOM9VRPzxfli20231fBH+Ef2C8m+o6ReoVBSbKt+JfDBJy7yLAsbtEJZpvw/NevfugNcUqtga5MAFUhlIviR0l4VlsUP20CKySEu4TGfEfKJHg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1711641344724537.0418351620448; Thu, 28 Mar 2024 08:55:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps5z-0001Cv-K2; Thu, 28 Mar 2024 11:55:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rps5q-00018b-C0 for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:55:09 -0400 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps5n-0001ui-Jk for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:55:04 -0400 Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-56bc5a3aeb9so1463203a12.3 for ; Thu, 28 Mar 2024 08:55:03 -0700 (PDT) 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641301; x=1712246101; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2NXhpW96pCgkEoWuYwRT5cvChay+RSkHkEuAn7B/Dd0=; b=x97DBHoVgI4tYR7nRGTtRe/rqwAZEQT4s8WcHD8FNi45RLtCA841e9dNZVjVuUEBrK xyy2HqgA1WLdiDTKCunkHxVG9arRnn0bmWvtpTVpOW8qQYH4EVeRT/VIcPkWNEIg4092 PTCabCwwP/LqbojA6VaJZPijzutJfqq8efhb7GGJLO7blUIN2v4XKEAzRw5UpZHAcU/2 IQoqGs+S0CXflPD2IRMpc/57QNfuDnKdNHfc0sbIJXLHOQn2MmgmR0yDg23V2qqxI2xf vyUCkKfrNCg6azBT20W2x/AWYrLn+KGNPRfar+HYHLAjKN+cIyMIw8zf69pq1libRluc bgTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641301; x=1712246101; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2NXhpW96pCgkEoWuYwRT5cvChay+RSkHkEuAn7B/Dd0=; b=Lnc5cBwR7qKcWNam/86Je92EVYkBXjy0c2T10xNAcJ7+KVBgU5lD/BTAc4Xs/xV5ay ZiSlFUrnofMUdbk318MREqSojXSN3oay9KDuBf+TRshK1v2C6NoA1dZvA+iIQkY/IQYk peJ0bw6zQGMuaG9dBTKCm5qPwKEueXkhmhTUw01Hry6MGacfCwdmDetN8v1ufI8rRe7e hmc6fSMpZKJyjh9zNWjrLzLKeMpWB0SIa/CWcZc9NEKPq3DanimDBwHUHobiQGF01xPE RWl3PkVGvBZTrpZAceYykVs4rBHzt9ySJgxKSLDcF09guGyZsi/u/RjQnipfosltcRjS HpXQ== X-Gm-Message-State: AOJu0YynJiPX9ZzXkAaZX0vFsHYuK9fQDzP79Us+Qq1f4ze9FWP6c4HM TERZPrGqNO7EUtsB5jkbVmOLjNnWvriwuaW+b5v8W8t6cKdZjk6gliJxYfuCRAzG72PhNo4BOkv 7 X-Google-Smtp-Source: AGHT+IF6f1YMBvOfsUocaggEtYJ9a+Kecpnx8/ab4gXfJ3RdBR3huqwiywmto+50jVUBk5TY6jKE5g== X-Received: by 2002:a50:a412:0:b0:566:f81:41a1 with SMTP id u18-20020a50a412000000b005660f8141a1mr2402222edb.22.1711641301544; Thu, 28 Mar 2024 08:55:01 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-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=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::52d; envelope-from=philmd@linaro.org; helo=mail-ed1-x52d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1711641346136100010 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=C3=A9 --- 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; =20 -#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 *da= ta) \ { \ MachineClass *mc =3D MACHINE_CLASS(oc); \ @@ -277,7 +277,7 @@ extern const size_t pc_compat_2_3_len; } \ static const TypeInfo pc_machine_type_##suffix =3D { \ .name =3D namestr TYPE_MACHINE_SUFFIX, \ - .parent =3D TYPE_PC_MACHINE, \ + .parent =3D parent_class, \ .class_init =3D 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) =20 static void pc_i440fx_machine_options(MachineClass *m) { @@ -824,7 +825,7 @@ static void isapc_machine_options(MachineClass *m) } =20 DEFINE_PC_MACHINE(isapc, "isapc", pc_init_isa, - isapc_machine_options); + isapc_machine_options, TYPE_PC_MACHINE); #endif =20 #ifdef CONFIG_XEN @@ -837,7 +838,7 @@ static void xenfv_4_2_machine_options(MachineClass *m) } =20 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); =20 static void xenfv_3_1_machine_options(MachineClass *m) { @@ -849,5 +850,5 @@ static void xenfv_3_1_machine_options(MachineClass *m) } =20 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) =20 =20 static void pc_q35_machine_options(MachineClass *m) --=20 2.41.0 From nobody Sat May 18 06:50:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1711641344; cv=none; d=zohomail.com; s=zohoarc; b=U9+JoOZj2/UeOLopvaile06VVax0T3vaVbKgJaR0bHgWEtWDI3fhXBqLxuYA3BaZRwo84aYHvNhFgstgk2qGk11ieLBqq6TqJnxyCYvGMCJhGubgIvxR7PN88Bgyp5vMoquwL8kmL3IyP+I7hGqFj6j8DKBPbf/zpYh9qHzvzRw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1711641344; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=sfY93X5jZfIbOGpoyV/9aTUl+UEfpsvUbOU4aZU0Anc=; b=Jg8o4LeUMfO0bPV3HfZ/dKmJDN3RgVpd3x20+nYT0hF0IhLMExumdw6IOiIBjEiNyhyiLNqNLbCCIxDeNGsundQ/+mvxR/OWpqOusGmrQ9ZloQ/P6veN+281Ni9DXPC3RpuonoouNNnI5OgNhcytPEj2oGUiPOCGQInZmbr6sns= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1711641344647544.1746259188667; Thu, 28 Mar 2024 08:55:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps65-0001SK-Cq; Thu, 28 Mar 2024 11:55:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rps5z-0001GN-7W for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:55:16 -0400 Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps5v-00023G-6T for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:55:14 -0400 Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-a2f22bfb4e6so154897166b.0 for ; Thu, 28 Mar 2024 08:55:09 -0700 (PDT) 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641308; x=1712246108; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sfY93X5jZfIbOGpoyV/9aTUl+UEfpsvUbOU4aZU0Anc=; b=KcDehLZUQFLKH1qMQyQfd7qkVzkHxH1kJCPkbPOwv5fq3LkHOCbg7ydwNNQvMVZ0vh 7iTm43HX5ZO3RBPh/ikhoBgoQQjFtpMInpQpu39B3lycRIEq8XQ/zI/tAS3Pzv2fhTTi bu8y4BaDrcpgVUC8p+NPktKkTDbdhBRUIW8N7zezmz9CkGrz6YiDKi/H3zydbT+vK7jx FpDeN8V7wlUoHOaKKRbEjoub6FcDm335XzO/Terj9+Iy+ZQywBfq7G4EubyGXunw0CdZ rsTSnRdOTVE5ANSEE8E/q8UsGRytQvKraupCTSoNePUgZHyobP+0f9hE95NHt3vo7P9S h14A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641308; x=1712246108; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sfY93X5jZfIbOGpoyV/9aTUl+UEfpsvUbOU4aZU0Anc=; b=K5bADfnC6gQLkGdHqYJg1f1GWU70JpDPnQVhABNXhfb5CXlzRJntH0qVYeDEIhqxq5 i12pz9nfScxdZqRYK+QPlqigMh+4MTVUUgJGMU0Hqg2VgXd7xOFAsiK8MGbpQDLaEEQj dZbrEI/84P/eHHBleRyx6CJlsYHRiuE/Lz1M/UtP/68OWjKmAK+R7y1s05WAOJOPQKWb gUvqly/qxVeiz2y77G0dgg6pjz8W8UaUklRpafWzXV58ykoGT92JAUBS1xNlo/i0ugx/ AVzXxB782lt5NWsHvE6xUhEqJ0zbPMXfiskereeQCcBfAbS94KGSwiKATZN0Upl6XOsO KTCQ== X-Gm-Message-State: AOJu0YwO+zJlTJqq3ciNWMol5TykU4Uq0v1/vSXv/F2riAxwJr/RhsJ/ bGI+3mAaL0xhb0gktooHaoKcNuTSPU9gd84RhYbkXEIaVnk+M64BU4Wy2iAO11XnDHMto8nx0RB 0 X-Google-Smtp-Source: AGHT+IFlVuycGv39RKoJmMuDSzpYHIv5NkuYfdH5v63bTElq/w8DazJwyMi8sNCnbLq/4DH71CZp5g== X-Received: by 2002:a17:906:2dce:b0:a4e:299f:7f4f with SMTP id h14-20020a1709062dce00b00a4e299f7f4fmr690299eji.48.1711641307840; Thu, 28 Mar 2024 08:55:07 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-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=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::632; envelope-from=philmd@linaro.org; helo=mail-ej1-x632.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1711641346178100014 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=C3=A9 --- 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; =20 - /* */ - /* State for other subsystems/APIs: */ Notifier machine_done; =20 @@ -60,6 +57,12 @@ typedef struct PCMachineState { CXLState cxl_devices_state; } PCMachineState; =20 +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; =20 - /*< 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; =20 -#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) =20 bool pc_machine_is_pci_enabled(PCMachineState *pcms); =20 +#define TYPE_PC_PCI_MACHINE "pci-pc-machine" +OBJECT_DECLARE_TYPE(PcPciMachineState, PcPciMachineClass, PC_PCI_MACHINE) + /* ioapic.c */ =20 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); } =20 +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); } =20 +static void pc_pci_machine_initfn(Object *obj) +{ + PcPciMachineState *ppms =3D PC_PCI_MACHINE(obj); + + ppms->machine_done.notify =3D 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, v= oid *data) pc_machine_set_fd_bootchk); } =20 +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[] =3D { { } }, }, + { + .name =3D TYPE_PC_PCI_MACHINE, + .parent =3D TYPE_PC_MACHINE, + .abstract =3D true, + .instance_size =3D sizeof(PcPciMachineState), + .instance_init =3D pc_pci_machine_initfn, + .class_size =3D sizeof(PcPciMachineClass), + .class_init =3D pc_pci_machine_class_init, + }, }; =20 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) =20 static void pc_i440fx_machine_options(MachineClass *m) { @@ -838,7 +838,7 @@ static void xenfv_4_2_machine_options(MachineClass *m) } =20 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); =20 static void xenfv_3_1_machine_options(MachineClass *m) { @@ -850,5 +850,5 @@ static void xenfv_3_1_machine_options(MachineClass *m) } =20 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) =20 =20 static void pc_q35_machine_options(MachineClass *m) --=20 2.41.0 From nobody Sat May 18 06:50:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1711641357; cv=none; d=zohomail.com; s=zohoarc; b=YzNxvsa1hv2sq7UnvuUw/k3JJmfayqx2yr0jRpTKYCU2EZyZvYcC/qTpKzDI6sA8x6yNi6iGU2hEgF7v1hBEH4OaFaThjTz2RxyyyNxHBEVV4tb28bdmtDoTDlt82wPCgBKjVIs/PsPcV7k+82xierMHA+HWXj+EBGq2WxREQ14= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1711641357; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=tfLLKG41I2ogYG1kIbKxMmfGPQoeoLD1UnfKcWEnm1Y=; b=N8mv3fK62yKkoJvvCdt9WVvB6PcwJXae617PviqSHNNMBwN2KuKiCqkzIIUH6fCzWNp+5rx3JhYVvtvrtzrmhGZfWG5/UmrXRlGDxWjhpNh6GERwj9gc4FZu79L47NN/VL9Pmdr2ZTPM6K29C2rb8UmJ3w1nJpQHwvC47qEiOsg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1711641357840536.2936363149074; Thu, 28 Mar 2024 08:55:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps6D-0001bY-W8; Thu, 28 Mar 2024 11:55:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rps64-0001TQ-IN for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:55:21 -0400 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps5z-00023o-VL for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:55:17 -0400 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-56c12c73ed8so1455202a12.2 for ; Thu, 28 Mar 2024 08:55:15 -0700 (PDT) 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641314; x=1712246114; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tfLLKG41I2ogYG1kIbKxMmfGPQoeoLD1UnfKcWEnm1Y=; b=mvt5cp4szbiwSIAxlAz/tZh/2B2lO9Q85L4uA69QlgVmkp6HuoYfeNLmDtsAmkzIt6 KHSbmUup4N9x3CR1ksLJiOIhkjdUQb58cPagpEqGR1iLMoBR9sij8qZYw0aZ4RuqOfTh 9tcAvt2LmFmYu7iI00I9G1j5/oRJxp/OIjPSaqLdC7BDE2r4nFWdvNpT8mo6KiK3wzli fnNd5qz1ZGKx/Qp5k2Ed1mSSj4zINffAnk1MEzDdMp+IwwCowqIFYKCkSdET5Pnlhg8C ou1pPX0LWgqULPz//NrmW0D+dOcnaq1+gSrKIt58zp7g1XzuNHf/3QgentUjTKTHprAu 10cQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641314; x=1712246114; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tfLLKG41I2ogYG1kIbKxMmfGPQoeoLD1UnfKcWEnm1Y=; b=m5QmfiSkYruv3p0yqgYr/Dl1UTfXgcRbgA7ZIWch3A+aD/VA8oX8dG+LutdS0narWE oFrVvv8VJKZUEgt1ctVCZm/XbQiGUFVhp2UOSOtf9mrzewZIkYIcVj4XBgpcAqO3glL8 vwTeorPnrc/WEIrcgJeOaBqeaOpO9pMi5Kcdrfzp+j3dZhNp2qJMetY8kcZr3Jzmi6vd CGKDQu8IH1ktHOtHCga7s81CKsB0CC3vJsDiiMgvK7L9+yd9R2Zcoit3Uw0agQg8glg9 asUA5Arb4w30ohOS3UzeF6s/1wsG3EgDZSQX/c75JgQO87q4eESHVZk6p2fbOZx2uVrK d5xA== X-Gm-Message-State: AOJu0YzP9KPuPN6/0M7Op+hbEN5Ap95pBaH5Dp+C5zsSr1YHPM6DK9U+ Dbe3QSXDCzSQ6ERp6EIXehLFwSc7lPflFVdeUqxWMSied7M+8CPekUgRdBs1yAYArQrXIFw0y0d N X-Google-Smtp-Source: AGHT+IHgYPcqLucwrXXanAHQ1HQbxbpMZQm6yL1cnX0JqCYBkEci+AP5aBFgq++VGYS+wx15kRnpQw== X-Received: by 2002:a50:ccd1:0:b0:56a:e8e4:9aef with SMTP id b17-20020a50ccd1000000b0056ae8e49aefmr2604908edj.7.1711641314036; Thu, 28 Mar 2024 08:55:14 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-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=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::530; envelope-from=philmd@linaro.org; helo=mail-ed1-x530.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1711641358162100001 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=C3=A9 --- 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; =20 /* Device configuration: */ - bool pci_enabled; const char *default_south_bridge; =20 /* 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, vo= id *data) PCMachineClass *pcmc =3D PC_MACHINE_CLASS(oc); HotplugHandlerClass *hc =3D HOTPLUG_HANDLER_CLASS(oc); =20 - pcmc->pci_enabled =3D true; pcmc->has_acpi_build =3D true; pcmc->smbios_defaults =3D true; pcmc->gigabyte_align =3D true; @@ -1830,7 +1829,7 @@ static void pc_pci_machine_class_init(ObjectClass *oc= , void *data) =20 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); } =20 static const TypeInfo pc_machine_types[] =3D { 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 =3D 1; m->option_rom_has_mr =3D true; m->rom_file_has_mr =3D false; - pcmc->pci_enabled =3D false; pcmc->has_acpi_build =3D false; pcmc->smbios_defaults =3D false; pcmc->gigabyte_align =3D false; --=20 2.41.0 From nobody Sat May 18 06:50:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1711641363; cv=none; d=zohomail.com; s=zohoarc; b=eMP45Dzk42kzsaSiclSp0+GaNhrW9FS7P6eG7Z5hbN+k+7JiUEFHl98C3pmOBHofmmsJq5yxb8gSJku2VlkANT+Nk0O2kRdB8nsmfSu6FnoV8JVCr4IpMiZBCiJdx+yhgagDmUGgQlYDmKmnTOJUUufFPp6tqj2Zll7HXmKKbC8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1711641363; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Qqj3zRF0zkE64TiaxdKa2OyadNVq3wsX7i8167PhhDk=; b=XtGf4RXiHwOMshJ70CTjGWwZSDqbY1wELUs6AgGhoSpUW2UBiHLlKv0hQCyolMu0lLLgj2dqRVhuEYCrRaDVt08VLl9ZBLmPznM717XviMQPZKaPPkKi9N8JLItjWL+OFldCG+Gk+wAF201VsdM8OxQSQcP698/UGRyBkuasDKY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1711641363360979.7532414389532; Thu, 28 Mar 2024 08:56:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps6H-0001n7-NI; Thu, 28 Mar 2024 11:55:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rps68-0001Xv-GX for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:55:26 -0400 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps66-00024h-Fd for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:55:24 -0400 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-56c2c41cbdaso648823a12.2 for ; Thu, 28 Mar 2024 08:55:22 -0700 (PDT) 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641320; x=1712246120; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Qqj3zRF0zkE64TiaxdKa2OyadNVq3wsX7i8167PhhDk=; b=fpFpEreOmtqPkGN8wZCLxiaQDUL02smlviXnSG1rTHWvb/HCrx5b4grPSWcsNQXRpn tZdjG4EDK2g9P7UVasve5CEBL+ydTAaYLbQJgswM0+v+704FhNUSsxUeTXzY1V9n8RO4 OdBb47UI2Z9f2gQ/8ZszJRdebX1G5UkLYocS2FZ405krHs45dpjkrPoiEkcLd7sjoWz+ +cYNrApJhKkeoZGPZqWL93aMVqdkcX7YCEvMN9ber2fpA5HjCuiE7Uh8xJjpdinF3hZp 1iZ8jIWQvwNkDOVULNMungitVCfgJypewuFUKiYNAoQrnpB3nd8kra7Z9s8nDAx9kIeU Xhcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641320; x=1712246120; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Qqj3zRF0zkE64TiaxdKa2OyadNVq3wsX7i8167PhhDk=; b=X5YK9aM/Fbb9wWMjwPA/gsTssU4ihRunn1alTYeUT3hwzAvddQT2FoHEz4njWCJ4PR k1tS22M47G0Mq43OjQZbPbJTQgmHE0DjN4tBsorZ9lqzPjGdC0OlJROSJRh7eei5r8Qc PBgl83bS4q+D59HYYcvZiEez2Dqvpd3PCAQbQC+vPs1DkL0qbH6DU/E4txkDEZj0Sapt WUdXdzHD+gk5mNpli2Z3Fd9MGBoDxfbtonhAAWfG+CbLRR5wsu1yf6i1c1QhVTcmQweg 711TlzTujrjNgz4p0bPOpiw+GW4hRsZPFGHVdJv5UXkDeczwjnxlapqgeoNJmrziRPR2 jtGw== X-Gm-Message-State: AOJu0YxsvvRYtLCTu78+vui0a1fHaAudJejz9vVyXQoZ5bdw99Gb1Jth nl5/xyUAAhwpGCz7iuxVWQRmEcW2akuxXD1E+mHzsezXzlb3FDmMfQ6f+wuWXmuuNnTzMpkopfR + X-Google-Smtp-Source: AGHT+IHK7QxU7AgeWAocSeLH4R3SrP+9YZVhIuiOSStSg8CKPyXF7V4Tf4M9BXjp5dsE6yThozBjEA== X-Received: by 2002:a50:8d08:0:b0:566:ecce:9d3c with SMTP id s8-20020a508d08000000b00566ecce9d3cmr2991678eds.26.1711641320462; Thu, 28 Mar 2024 08:55:20 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-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=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::530; envelope-from=philmd@linaro.org; helo=mail-ed1-x530.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1711641364191100002 The 'pci_root_uid' field is irrelevant for non-PCI machines, restrict it to the PcPciMachineClass. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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 { =20 /* ACPI compat: */ bool has_acpi_build; - int pci_root_uid; =20 /* SMBIOS compat: */ bool smbios_defaults; @@ -127,6 +126,9 @@ typedef struct PCMachineClass { =20 typedef struct PcPciMachineClass { PCMachineClass parent_class; + + /* ACPI compat: */ + int pci_root_uid; } PcPciMachineClass; =20 #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 =3D PC_MACHINE(machine); PCMachineClass *pcmc =3D PC_MACHINE_GET_CLASS(machine); + PcPciMachineClass *ppmc; X86MachineState *x86ms =3D X86_MACHINE(machine); AcpiMcfgInfo mcfg; bool mcfg_valid =3D !!acpi_get_mcfg(&mcfg); @@ -1448,10 +1449,12 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, =20 build_dbg_aml(dsdt); if (i440fx) { + ppmc =3D PC_PCI_MACHINE_GET_CLASS(machine); + sb_scope =3D aml_scope("_SB"); dev =3D 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 =3D PC_PCI_MACHINE_GET_CLASS(machine); + sb_scope =3D aml_scope("_SB"); dev =3D 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 =3D PC_MACHINE_CLASS(m); + PcPciMachineClass *ppmc =3D PC_PCI_MACHINE_CLASS(m); ObjectClass *oc =3D OBJECT_CLASS(m); + pcmc->default_south_bridge =3D TYPE_PIIX3_DEVICE; - pcmc->pci_root_uid =3D 0; + ppmc->pci_root_uid =3D 0; pcmc->default_cpu_version =3D 1; =20 m->family =3D "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 =3D PC_MACHINE_CLASS(m); + PcPciMachineClass *ppmc =3D PC_PCI_MACHINE_CLASS(m); =20 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 =3D false; - pcmc->pci_root_uid =3D 1; + ppmc->pci_root_uid =3D 1; } =20 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 =3D PC_MACHINE_CLASS(m); - pcmc->pci_root_uid =3D 0; + PcPciMachineClass *ppmc =3D PC_PCI_MACHINE_CLASS(m); + + ppmc->pci_root_uid =3D 0; pcmc->default_cpu_version =3D 1; =20 m->family =3D "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 =3D PC_MACHINE_CLASS(m); + PcPciMachineClass *ppmc =3D PC_PCI_MACHINE_CLASS(m); =20 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 =3D false; - pcmc->pci_root_uid =3D 1; + ppmc->pci_root_uid =3D 1; } =20 DEFINE_Q35_MACHINE(v5_1, "pc-q35-5.1", NULL, --=20 2.41.0 From nobody Sat May 18 06:50:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1711641342; cv=none; d=zohomail.com; s=zohoarc; b=SoDDxnoeD+3YcG5ILxfiwXPYzscPjJSA/wdzFH5G2/p13uWowhGyQo4uJqBasMIZjShtLewUsUkud5iAcG9gJ0DB904mmEOU1wOxQry0c5K/SZdGWsJXOPegGvASf4ntBvp4k0AnPS7PsP1SRT9P/3cRFk9rmDpaLG+rTfi90Rc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1711641342; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=6t/11DBdsC4+Se7Vaykag7BJymn7PIzchj3B9U9dVz4=; b=RjVeNR/q0oYomQpclfCZoQPrd3A974Is/g/+U16YsGsKrlDaeZeTViZx6FnqffWiBh4opq0AxM4pMJS7RO/TjGUf2etsdD1arYqdw2FmeuMjLIh59GetX5Gj3G4Z8Hekma7D9inSxOOwu73SVoBNrVH+kzD0QCXEvABUFhIyCcg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1711641342067237.44234961179893; Thu, 28 Mar 2024 08:55:42 -0700 (PDT) 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 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-Outflank-Mailman: Message body and most headers restored to incoming version 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=20Mathieu-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=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1711641344095100001 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=C3=A9 --- 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); =20 - 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) =20 static void pc_pci_machine_done(Notifier *notifier, void *data) { + PcPciMachineState *ppms =3D container_of(notifier, + PcPciMachineState, machine_done= ); + PCMachineState *pcms =3D PC_MACHINE(ppms); + X86MachineState *x86ms =3D X86_MACHINE(pcms); + + fw_cfg_add_extra_pci_roots(pcms->pcibus, x86ms->fw_cfg); } =20 /* setup pci memory address space mapping into system address space */ --=20 2.41.0 From nobody Sat May 18 06:50:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1711641346; cv=none; d=zohomail.com; s=zohoarc; b=OYz/e4GeVyLwtQr/b0LedyyDji6Ym2v66RY8OJcLBJznahsUxcoOocKwOVKwi/ozKMWfihHi2C14jWd7YonAvor1vwZeYq5Z0qGNbZQlUNAeIK58CZGeSePIwnGnxAMOA17j6siZnxQaOxroOzrgToHTxqn1tRXc7iGnKs5fxOI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1711641346; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=SSkLCR/UlhKFiQpvqkRVhG8wkTGDHk2a+aqlC/uZCjk=; b=W7hiVSsmKECBzluC5Q4lvG+o4SLesAw4fJbPjjS5eu7wDWUP/dMUqMgOWwW0uAlGtMgbYSbiMHOxaypnozGsAd8WEefNTWEjLa+IdPxMNXe8DusvI9GVcTWHf3Om6eEBZI4mjItptAMnNfuRbG2AO7j80LxLfSHmsmby1BibrDA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1711641346936315.221171204446; Thu, 28 Mar 2024 08:55:46 -0700 (PDT) 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 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-Outflank-Mailman: Message body and most headers restored to incoming version 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=20Mathieu-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=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1711641348143100023 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=C3=A9 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; =20 SGXEPCState sgx_epc; - CXLState cxl_devices_state; } PCMachineState; =20 typedef struct PcPciMachineState { PCMachineState parent_obj; =20 Notifier machine_done; + + CXLState cxl_devices_state; } PcPciMachineState; =20 #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 =3D PC_MACHINE(machine)->pcibus; if (bus) { + PcPciMachineState *ppms; + + assert(pc_machine_is_pci_enabled(pcms)); + ppms =3D PC_PCI_MACHINE(machine); + QLIST_FOREACH(bus, &bus->child, sibling) { uint8_t bus_num =3D pci_bus_num(bus); uint8_t numa_node =3D pci_bus_numa_node(bus); @@ -1607,7 +1612,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, =20 /* Handle the ranges for the PXB expanders */ if (pci_bus_is_cxl(bus)) { - MemoryRegion *mr =3D &pcms->cxl_devices_state.host_mr; + MemoryRegion *mr =3D &ppms->cxl_devices_state.host_mr; uint64_t base =3D mr->addr; =20 cxl_present =3D 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 =3D pc_machine_is_pci_enabled(pcms); + PcPciMachineState *ppms =3D pci_enabled ? PC_PCI_MACHINE(pcms) : NULL; =20 acpi_get_pm_info(machine, &pm); acpi_get_misc_info(&misc); @@ -2640,9 +2647,10 @@ void acpi_build(AcpiBuildTables *tables, MachineStat= e *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_devi= ces_state); + x86ms->oem_id, x86ms->oem_table_id, + &ppms->cxl_devices_state); } =20 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 =3D X86_MACHINE(pcms); =20 - 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); =20 @@ -626,6 +619,13 @@ static void pc_pci_machine_done(Notifier *notifier, vo= id *data) PCMachineState *pcms =3D PC_MACHINE(ppms); X86MachineState *x86ms =3D X86_MACHINE(pcms); =20 + 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); } =20 @@ -719,13 +719,14 @@ static uint64_t pc_get_cxl_range_start(PCMachineState= *pcms) =20 static uint64_t pc_get_cxl_range_end(PCMachineState *pcms) { + PcPciMachineState *ppms =3D PC_PCI_MACHINE(pcms); uint64_t start =3D pc_get_cxl_range_start(pcms) + MiB; =20 - if (pcms->cxl_devices_state.fixed_windows) { + if (ppms->cxl_devices_state.fixed_windows) { GList *it; =20 start =3D ROUND_UP(start, 256 * MiB); - for (it =3D pcms->cxl_devices_state.fixed_windows; it; it =3D it->= next) { + for (it =3D ppms->cxl_devices_state.fixed_windows; it; it =3D it->= next) { CXLFixedWindow *fw =3D it->data; start +=3D fw->size; } @@ -823,6 +824,7 @@ void pc_memory_init(PCMachineState *pcms, hwaddr cxl_base, cxl_resv_end =3D 0; X86CPU *cpu =3D X86_CPU(first_cpu); bool pci_enabled =3D pc_machine_is_pci_enabled(pcms); + PcPciMachineState *ppms =3D pci_enabled ? PC_PCI_MACHINE(pcms) : NULL; =20 assert(machine->ram_size =3D=3D 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_s= ize); } =20 - if (pcms->cxl_devices_state.is_enabled) { - MemoryRegion *mr =3D &pcms->cxl_devices_state.host_mr; + if (ppms && ppms->cxl_devices_state.is_enabled) { + MemoryRegion *mr =3D &ppms->cxl_devices_state.host_mr; hwaddr cxl_size =3D MiB; =20 cxl_base =3D 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 =3D cxl_base + cxl_size; - if (pcms->cxl_devices_state.fixed_windows) { + if (ppms->cxl_devices_state.fixed_windows) { hwaddr cxl_fmw_base; GList *it; =20 cxl_fmw_base =3D ROUND_UP(cxl_base + cxl_size, 256 * MiB); - for (it =3D pcms->cxl_devices_state.fixed_windows; it; it =3D = it->next) { + for (it =3D ppms->cxl_devices_state.fixed_windows; it; it =3D = it->next) { CXLFixedWindow *fw =3D it->data; =20 fw->base =3D cxl_fmw_base; @@ -979,7 +981,7 @@ void pc_memory_init(PCMachineState *pcms, res_mem_end +=3D memory_region_size(&machine->device_memory->m= r); } =20 - if (pcms->cxl_devices_state.is_enabled) { + if (ppms->cxl_devices_state.is_enabled) { res_mem_end =3D cxl_resv_end; } *val =3D cpu_to_le64(ROUND_UP(res_mem_end, 1 * GiB)); @@ -1010,11 +1012,12 @@ uint64_t pc_pci_hole64_start(void) { PCMachineState *pcms =3D PC_MACHINE(qdev_get_machine()); PCMachineClass *pcmc =3D PC_MACHINE_GET_CLASS(pcms); + PcPciMachineState *ppms =3D PC_PCI_MACHINE(pcms); MachineState *ms =3D MACHINE(pcms); uint64_t hole64_start =3D 0; ram_addr_t size =3D 0; =20 - if (pcms->cxl_devices_state.is_enabled) { + if (ppms->cxl_devices_state.is_enabled) { hole64_start =3D pc_get_cxl_range_end(pcms); } else if (pcmc->has_reserved_memory && (ms->ram_size < ms->maxram_siz= e)) { pc_get_device_memory_range(pcms, &hole64_start, &size); @@ -1651,7 +1654,6 @@ static void pc_machine_initfn(Object *obj) { PCMachineState *pcms =3D PC_MACHINE(obj); PCMachineClass *pcmc =3D PC_MACHINE_GET_CLASS(pcms); - bool pci_enabled =3D pc_machine_is_pci_enabled(pcms); =20 #ifdef CONFIG_VMPORT pcms->vmport =3D ON_OFF_AUTO_AUTO; @@ -1678,9 +1680,6 @@ static void pc_machine_initfn(Object *obj) pcms->pcspk =3D 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); - } =20 pcms->machine_done.notify =3D 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 =3D PC_PCI_MACHINE(obj); =20 + cxl_machine_init(obj, &ppms->cxl_devices_state); + ppms->machine_done.notify =3D pc_pci_machine_done; qemu_add_machine_init_done_notifier(&ppms->machine_done); } --=20 2.41.0 From nobody Sat May 18 06:50:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1711641408; cv=none; d=zohomail.com; s=zohoarc; b=XkeYQsskg37Fo0FFdhalJ2XaKIh0sqb1eNbsDZQ5Smpr+LJtdG737y8W4CIBbJBadHdh8Tdae/lGrXiEwmjAC2ZqUFdzNMI5gZkaVYNwOl6XI2xXiAEvyRSqEYNn+1QgD8VMDvPoRJh/10SS7wWg/Azrl3yzg08q8J6iy29+GvM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1711641408; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ckSqN94Ak/AVFv4C8DP1wel6lx7UDcBC5ZVn+IWQ+zI=; b=Rij2ZZZQgWoTZwkiGwwuAIbKRkiFakZ0d8sJ3cD+0FiEvKm6hYUgVryFd4LBeATsAP7tEzVSb4tWeB6ztTsatln8wF0xna4hRGQkVcEFSXtyACNOHZCKNB1hdzOlzcRcfi6bKluTjVw5Ttbe658AFqBA2/jwE9gCqoZilTPbWbo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1711641408423348.9187810074362; Thu, 28 Mar 2024 08:56:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps6R-0002Xx-Fc; Thu, 28 Mar 2024 11:55:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rps6Q-0002RP-I3 for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:55:42 -0400 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps6O-0002GM-VP for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:55:42 -0400 Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-56845954ffeso1750088a12.2 for ; Thu, 28 Mar 2024 08:55:40 -0700 (PDT) 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641339; x=1712246139; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ckSqN94Ak/AVFv4C8DP1wel6lx7UDcBC5ZVn+IWQ+zI=; b=qUWjQLo8W+8Iepc3M0ub/a013BFffUS/zAYZt/PbK1FR3GskA+3/XlDJEa2Ahy1J16 2KchJ4Bug1C/uS/J2dIXrnmm0um6EzmMtU32hJpGsXezEWVDP4JioyMTsN+Quceqt27E A0IlTGfIAGsBMu/u+Rq2hQxYk5vhEeTUcmM+gSFJ47FnZThZAkHh7TQbwIwKqS52Z87l KEJm5jo7eX0kloZPs9QU5Y39+ZUBfz/D11pk2G7y9zzkx+8quq4F8F3MuRqpDZSmWOZ8 KWp6bMvnOyUvsFBAYN7YAazF02CwDFGevdwY3vjcvu8nj2gHtTq2lYhPcUuAmVNN+bje nTVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641339; x=1712246139; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ckSqN94Ak/AVFv4C8DP1wel6lx7UDcBC5ZVn+IWQ+zI=; b=VQnwhSiazY66jk2ccAAndoVg55fkmKM7UIAfNjkAVFXx9i0yMj3SiQ6h100VDBX23W L9BnhGqmHRjthPXk+lDcP/QYUbINtwkqk+AKzD7e1uDrDxOuDtfm0YzmmF/p9uvFCj9V 4BtZdGNd7NltuhB/RxjaM/picDgiYUKWY9XtgISYXyeIpscPiQlRCqUVmFLKQKWLAQae iCVz73uBGlhkW1LSCju436FzYwFrcWwcroigZxQ+28rfIFcPUD+hhQN1J9K7rXaIVwaN 0Gps2lp2F+X6+vhXRfFicC7481LbTuLZq4L9FjgiNAi9zgFdaIhkrcreMrkJ7W+TxpMx x7Nw== X-Gm-Message-State: AOJu0YzXJ7uTfb9ExHbFCH8d77Om1bGvjn3+4Dlgfh2lZTVpTqaZACrK E9+7T9HsjVeJmOdLaxmsVUFV+qIYqKfxtFkohT8kOqTZ0Db83kzdpVdear/nkRkkVMzcaEOa4VF s X-Google-Smtp-Source: AGHT+IGwP6p/08zu3mCMRpeAkzfHcigXM/JR3t5dmiNwQCcEIbh+pOnBScYA897DxMkDTYP+GJc42Q== X-Received: by 2002:a17:906:494f:b0:a47:4fed:514a with SMTP id f15-20020a170906494f00b00a474fed514amr1839620ejt.52.1711641339277; Thu, 28 Mar 2024 08:55:39 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-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=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::52e; envelope-from=philmd@linaro.org; helo=mail-ed1-x52e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1711641410303100003 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=C3=A9 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" =20 extern const struct AcpiGenericAddress x86_nvdimm_acpi_dsmio; =20 @@ -9,7 +10,7 @@ extern const struct AcpiGenericAddress x86_nvdimm_acpi_dsm= io; #define ACPI_PCIHP_SEJ_BASE 0x8 #define ACPI_PCIHP_BNMR_BASE 0x10 =20 -void acpi_setup(void); +void acpi_setup(PCMachineState *pcms); Object *acpi_get_i386_pci_host(void); =20 #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 = =3D { }, }; =20 -void acpi_setup(void) +void acpi_setup(PCMachineState *pcms) { - PCMachineState *pcms =3D PC_MACHINE(qdev_get_machine()); X86MachineState *x86ms =3D X86_MACHINE(pcms); AcpiBuildTables tables; AcpiBuildState *build_state; @@ -2771,7 +2770,7 @@ void acpi_setup(void) return; } =20 - 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); =20 - 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); --=20 2.41.0 From nobody Sat May 18 06:50:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1711641382; cv=none; d=zohomail.com; s=zohoarc; b=B+6nIqOVoO0Komp0AK/77OyBzgYVW2bW9oIZ3NzUGYapUIBZwEzupSI/Gbk3KSWHLvVVyNFQMtiBabCXiGdcHVrFpX76LCN489DFWmjtkgYAHvjaytKS+OfrRB/Ver5uXr2mSCBKsQWQIBHL+qXBZYZZQGcqbagHwqOs6+xPhBw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1711641382; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=HtUfcj3aTDn2mvaMR/QsDVngwC1CAz/OBQXAMI7WNPQ=; b=XkSm6gI5y/kxFFoP+RxnQz6qQVTvBdr2k6Pl3LXTuUOP1njfRlLWu+hLggUzL64Ngs0q15vysAmotn4pkd7o9xubXE796qq/Q3vNl5bZ02nw2HDumBShiDxnaqevrOapnVWuf+FYl0BWPcOkX361E53m5hxCwalj7TsRrwDJ0X4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 171164138282345.53669467460941; Thu, 28 Mar 2024 08:56:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps6Y-0002yP-Cl; Thu, 28 Mar 2024 11:55:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rps6W-0002wX-RF for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:55:48 -0400 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps6V-0002H1-8I for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:55:48 -0400 Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-56c2b4850d2so1407111a12.2 for ; Thu, 28 Mar 2024 08:55:46 -0700 (PDT) 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641345; x=1712246145; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HtUfcj3aTDn2mvaMR/QsDVngwC1CAz/OBQXAMI7WNPQ=; b=FRsHW38GuPBKsFou3iXDlS5O3B5KwEUBWDQYdStUG6bXGjWeFjzBwpaPSyrJ7p6TLE SLywyxjdnH/nBL1ii00peLLRjQLBljD1F/+cf/+GjZp3QsVtM5Wpe1MvnXUSVfrBxsSr kIaMSsNXBnuV3O0Ay1nER6CEecDHcn/IEtNTIknLlBVJ4C8b/ZvYKeM6RMSevtOe0Umz qJ9iqqmwUoKbBkuSHAEOKAkjvdLZxNrS9dRfo01BMYisxQcuVCYaPD/HTDoQGcrKtp0I qTuZpfBvzeqbWev8BMZCI+aJ16LpDFLndOBCr65I1AflXpNQ8awlcAxEGx39ihUC7w15 kcuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641345; x=1712246145; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HtUfcj3aTDn2mvaMR/QsDVngwC1CAz/OBQXAMI7WNPQ=; b=poE5GnXyJWP4gtDZVc6ohAo8hmOYMxWMQW7TjOeRWLnfWnd2PDUyzWtofLB6pDDHME 6siD3WkHBLsoEQF3FZfAwLqFjtwGajnb4UTb1MROKykh5KdOzv6OcWuMn9arN2Vs64ep M9VZ7RliOEJHQA7/RLIsRlXVo3bYrL4UW+eGDcwUnquNAaf7rCNFrl8gDorYGwKaTy/L mm+P8wD1meAFzryAndC8EQyyRSzSo7RoFP934hDymEBkSOM4CbN310xiQO8YSUvJWI4Q if9e2C8m0qpb3/aLI9Kka9X/y2yrohDYCA6lRs+DkWmTv9QYqkVn4HfiyJP3ATOt8mKJ bjyw== X-Gm-Message-State: AOJu0YwkufLJkq5ht31T6MgcxloZHMJaA59v5zYuovMbhcR9+GqOKd6Y VewONXSoGXJcFDIrG7yGXTRoOiQyzUfOleKQiF7s69A6VesajCP2ZQlsxRblRSCerryaz1txroH l X-Google-Smtp-Source: AGHT+IE4H2j7DvpBr0ZgGTO3mYeCN1DwhGLVSa7xknb/dNXvpG290SVF6AQSzPcOp/lNCIhUZoP8Cw== X-Received: by 2002:a17:906:4697:b0:a4e:ebd:254a with SMTP id a23-20020a170906469700b00a4e0ebd254amr2129554ejr.9.1711641345640; Thu, 28 Mar 2024 08:55:45 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-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=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::536; envelope-from=philmd@linaro.org; helo=mail-ed1-x536.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1711641384218100003 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=C3=A9 --- 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; =20 - /* 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 =3D pcmc->default_smbios_ep_type; pcms->south_bridge =3D pcmc->default_south_bridge; =20 - /* acpi build is enabled by default if machine supports it */ - pcms->acpi_build_enabled =3D pcmc->has_acpi_build; pcms->smbus_enabled =3D true; pcms->sata_enabled =3D true; pcms->i8042_enabled =3D true; @@ -1688,6 +1686,9 @@ static void pc_machine_initfn(Object *obj) static void pc_pci_machine_initfn(Object *obj) { PcPciMachineState *ppms =3D PC_PCI_MACHINE(obj); + PCMachineState *pcms =3D PC_MACHINE(obj); + + pcms->acpi_build_enabled =3D true; =20 cxl_machine_init(obj, &ppms->cxl_devices_state); =20 @@ -1745,7 +1746,6 @@ static void pc_machine_class_init(ObjectClass *oc, vo= id *data) PCMachineClass *pcmc =3D PC_MACHINE_CLASS(oc); HotplugHandlerClass *hc =3D HOTPLUG_HANDLER_CLASS(oc); =20 - pcmc->has_acpi_build =3D true; pcmc->smbios_defaults =3D true; pcmc->gigabyte_align =3D true; pcmc->has_reserved_memory =3D 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 =3D 1; m->option_rom_has_mr =3D true; m->rom_file_has_mr =3D false; - pcmc->has_acpi_build =3D false; pcmc->smbios_defaults =3D false; pcmc->gigabyte_align =3D false; pcmc->smbios_legacy_mode =3D true; --=20 2.41.0 From nobody Sat May 18 06:50:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1711641367; cv=none; d=zohomail.com; s=zohoarc; b=MI5RU7UOLCozOuQte5aZPN5pEmLqzHqonfmaikTEnwYeDTSeYnFNPFCfGBL6Cd5oOdoBrS/STdsaZpeP9Iy0i3+AahpvXEw1mK2a7Otfe7KJ8jFQvB5qnsprK2CiQqbTiaZ847pOksU/rMHDWQKCohuFgTfCBYx1L5VR9lwCvy8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1711641367; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ZJ3NIU3pO9930vwNFx0mYgma5e7GvztHkS/rmyU15RU=; b=VY1kqwoj+k9lbaoPclL/CSUgJO/bU7IeXBVAMCs/BmXK3p0issXBDMMBlp3Kn9NBO4dhA5IzF0V2TOFEhuo63TMjTBnlKWJSkX29C9DnwPE8IK/lfjIbGeKlBsa+Ejhy+FLBmvN17HmmG7L/WJPQz03lGCuPqp7eIaiMqgOpYIE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1711641367405592.4779458844035; Thu, 28 Mar 2024 08:56:07 -0700 (PDT) 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 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-Outflank-Mailman: Message body and most headers restored to incoming version 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=20Mathieu-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=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1711641368179100001 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=C3=A9 --- 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); =20 - 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, voi= d *data) } =20 fw_cfg_add_extra_pci_roots(pcms->pcibus, x86ms->fw_cfg); + + acpi_setup(pcms); } =20 /* setup pci memory address space mapping into system address space */ --=20 2.41.0 From nobody Sat May 18 06:50:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1711641372; cv=none; d=zohomail.com; s=zohoarc; b=RegIS+lm40KdYE/YsBgM/JgfCiqhNpcmJWCbUycS3EWQBx7Sp8EVBwO7W1RT9a9VeijhrHHiUXZ3Ozb+TL7avSEZq2mXUAdyLlcw6O1FoT6lhf7sMspKUeFw10P2dktg+gybHcP4YS5VKklTUjALR+v83oV/5hcA0FqZp03/pcc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1711641372; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=jlOZmiJcfWhY/E5lc2Om2vdspo8I2MenAyugtnCqPJ8=; b=AdSG0202n01f2Z/dJYfPQHe8pdMZWQBHGK63+MViUFHohboJtrr75FBnaGjOhq32z7KBo40nXqJT48t5E0JfuqwRB+atynsHTyA3an6zP45X3GKQ7doPOpkofCM/BJIaoTMdB6ZWCBl2TkQmTFQghh5vxLmtWU7RcJ3ja9LrPAg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1711641372819610.8786416254352; Thu, 28 Mar 2024 08:56:12 -0700 (PDT) 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 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-Outflank-Mailman: Message body and most headers restored to incoming version 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=20Mathieu-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=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1711641374207100001 Since only PCI-based machines use the 'acpi_build_enabled', move it to PcPciMachineState. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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_ds= mio; #define ACPI_PCIHP_SEJ_BASE 0x8 #define ACPI_PCIHP_BNMR_BASE 0x10 =20 -void acpi_setup(PCMachineState *pcms); +void acpi_setup(PcPciMachineState *ppms); Object *acpi_get_i386_pci_host(void); =20 #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; =20 - bool acpi_build_enabled; bool smbus_enabled; bool sata_enabled; bool hpet_enabled; @@ -61,6 +60,8 @@ typedef struct PcPciMachineState { =20 Notifier machine_done; =20 + bool acpi_build_enabled; + CXLState cxl_devices_state; } PcPciMachineState; =20 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 = =3D { }, }; =20 -void acpi_setup(PCMachineState *pcms) +void acpi_setup(PcPciMachineState *ppms) { - X86MachineState *x86ms =3D X86_MACHINE(pcms); + X86MachineState *x86ms =3D X86_MACHINE(ppms); AcpiBuildTables tables; AcpiBuildState *build_state; Object *vmgenid_dev; @@ -2765,7 +2765,7 @@ void acpi_setup(PCMachineState *pcms) return; } =20 - 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 =3D g_malloc0(sizeof *build_state); =20 acpi_build_tables_init(&tables); - acpi_build(&tables, MACHINE(pcms)); + acpi_build(&tables, MACHINE(ppms)); =20 /* Now expose it all to Guest */ build_state->table_mr =3D 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, voi= d *data) =20 fw_cfg_add_extra_pci_roots(pcms->pcibus, x86ms->fw_cfg); =20 - acpi_setup(pcms); + acpi_setup(ppms); } =20 /* 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 =3D PC_PCI_MACHINE(obj); - PCMachineState *pcms =3D PC_MACHINE(obj); =20 - pcms->acpi_build_enabled =3D true; + ppms->acpi_build_enabled =3D true; =20 cxl_machine_init(obj, &ppms->cxl_devices_state); =20 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, voi= d *data) void xen_hvm_init_pc(PCMachineState *pcms, MemoryRegion **ram_memory) { MachineState *ms =3D MACHINE(pcms); + PcPciMachineState *ppms =3D PC_PCI_MACHINE(pcms); unsigned int max_cpus =3D 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); =20 /* Disable ACPI build because Xen handles it */ - pcms->acpi_build_enabled =3D false; + ppms->acpi_build_enabled =3D false; =20 return; =20 --=20 2.41.0 From nobody Sat May 18 06:50:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1711641376; cv=none; d=zohomail.com; s=zohoarc; b=YpgD7lpowgHA7VAG8/Ft0VEsQGh9jRibNTzdQPHcNfbmqozRJciCU4YjND5XbXMY0NPCpu1JOC4tIj+I8VAPZdjJtipHTJBhx/SFnCJTVVE287HTTQg7p11KwB3aNiLal/6SHakeGv7U1xF+O4ufNjTCRxw3BD7IYv9zHEP1Ung= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1711641376; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=fL5eL7xorZDz2tK167vrCTC41p6AHRY9fWJiDBIL8BM=; b=HoFNxohAY8lSl2H2Yn+MLJtq9f0Oc9mexynAeUMpv/BFpVaJIMIB0kU38xmVYhm5SrYJ7V6qmZMtYxcbGx8uTS3Nsxufb1WoKqOS/jpbcx3GTfCmFAcbWG7Rv2JdIgQvW18JsnrFjbxa4+2a4KnLhdD639E/woHL8KZYDkyhfSs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1711641376094950.5731923932465; Thu, 28 Mar 2024 08:56:16 -0700 (PDT) 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 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-Outflank-Mailman: Message body and most headers restored to incoming version 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=20Mathieu-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=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1711641378210100001 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=C3=A9 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, } =20 /* 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); + } =20 option_rom_mr =3D 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)]; =20 - 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)); =20 /* Map legacy -drive if=3Dpflash to machine properties */ for (i =3D 0; i < ARRAY_SIZE(pcms->flash); i++) { --=20 2.41.0 From nobody Sat May 18 06:50:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1711641672; cv=none; d=zohomail.com; s=zohoarc; b=ejGFaG9R9MIKA5UXpkd/ndy+PNba3zqRyYFJukEtryl+TAisjPeMTLIRFXqYHq+KwLzhb8za7P0kke9emptL57PMhhSgCHXO8bEZzOxJfuKhXNS/xWLpPX/0eAZ4TAKHziH0Funu5ihpeJvFh+jgAtr2avL16xlsNyUf67LLmhs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1711641672; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=tmBHuqnVEd7WMmkqyo1h18jdjcgOKQnVi/P8Phxm0vQ=; b=IAW/y+JCF4QtMNVwYsb8wvTaysfFz3TCmdI1Qjbn3v6Gn+zDg+/jo2tsvUkZUr1zHICOJGskELMKVNKcbmCX2xkkuadEMIGoR3fTwFPjgCjuayvLNr7fJIoJ7YcaZ8OjXgrUjIBJl25NNuW2BFBcq3ykQrtWRtk9v2FVr6NWHPY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1711641672095856.0034209056769; Thu, 28 Mar 2024 09:01:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps7X-0004n4-8V; Thu, 28 Mar 2024 11:56:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rps6w-0003wg-Sf for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:56:17 -0400 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps6v-0002MF-4v for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:56:14 -0400 Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-513e6777af4so1700414e87.2 for ; Thu, 28 Mar 2024 08:56:12 -0700 (PDT) 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641371; x=1712246171; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tmBHuqnVEd7WMmkqyo1h18jdjcgOKQnVi/P8Phxm0vQ=; b=fzEr0irz5PJAPfF76k6gmP/7JU5ZehUhXTXtSzwvvpD79CxYiFu0aj1GtclTzaf98f AgPi27XB5szUYkWnv5nqrSbsiF9uZo7bItB07Wse95kCdSyje9uI0vR27jKqiVfpcVSn efHfnFueRmKNnlrfLNYArW0YJT8uAJ0ZZW3D9vMal/DMq8zr/Eb3EP87a6leOeKqCyLX wjQR9Aa7AGP/5sVI4kHqXp27B6s1OHo49WWSprlGPRz8obBNX2S66MViogAaNEQnErQf 7X5wgmaMgk2mrsoYGVoTRfAGxNciMyamaUs4OT/ze+PB6SNKGDM7+eH4Ouc9R8dIWvx9 /Hxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641371; x=1712246171; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tmBHuqnVEd7WMmkqyo1h18jdjcgOKQnVi/P8Phxm0vQ=; b=YPTbbBeAUFwwbhB2ZZjdUeYAuIwn8b7OTTDc1BoNyK6Tgq0hXB3aDx3POBmCTLBacj e9JkJ34vXGHrL21Ew4/sjaGRptcHT0AKd+5vgkPBOT6uldsW30rlAY+DAPzwtLGc5qBW +b9yRU0GJi7ibRHhfQUG+iSDh4sSjIgKtEtoo8kV8Wfwy/O5fWu3gxhP/2OmUvrL4SoJ didUCiip5PZNo/62p7dUvKWsX6CtTvmZe/9iz4eNGEQheOfieMkIkeDKF1iZDn/MtuXW 8JEXMJeGPSh3j8UdIf2hDMvPNXwtHzizWmT30oGfb012i8ZJ6fFufvyYZTJBwMlCoe5s IweQ== X-Gm-Message-State: AOJu0YwM+r/QWY+16TDvBLb0hf6tmjpu9Qydm1NmjrKfX/VobTSApUJc OapJjPq7H8xjcxhY3Xr1Nd3E2yZ58SmvbRcRwyTW2WSEirG2ZtcZtS8zWRoIj/dCP1gQxAAJVcV R X-Google-Smtp-Source: AGHT+IFUtefnyMETNOsHVcJ8GlW5rJsH0GdNooS/V5PGz6OttTSyM+Vcg71L2tN7ryhsnM23ZMka+w== X-Received: by 2002:ac2:489c:0:b0:515:af1f:5bad with SMTP id x28-20020ac2489c000000b00515af1f5badmr2600673lfc.28.1711641370819; Thu, 28 Mar 2024 08:56:10 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-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=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::129; envelope-from=philmd@linaro.org; helo=mail-lf1-x129.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1711641673684100006 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=C3=A9 --- 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 =3D true; pcms->default_bus_bypass_iommu =3D false; =20 - pc_system_flash_create(pcms); pcms->pcspk =3D 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) =20 ppms->acpi_build_enabled =3D true; =20 + pc_system_flash_create(PC_MACHINE(obj)); cxl_machine_init(obj, &ppms->cxl_devices_state); =20 ppms->machine_done.notify =3D 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 *pc= ms, =20 void pc_system_flash_create(PCMachineState *pcms) { - if (pc_machine_is_pci_enabled(pcms)) { - pcms->flash[0] =3D pc_pflash_create(pcms, "system.flash0", - "pflash0"); - pcms->flash[1] =3D pc_pflash_create(pcms, "system.flash1", - "pflash1"); - } + assert(pc_machine_is_pci_enabled(pcms)); + + pcms->flash[0] =3D pc_pflash_create(pcms, "system.flash0", "pflash0"); + pcms->flash[1] =3D pc_pflash_create(pcms, "system.flash1", "pflash1"); } =20 void pc_system_flash_cleanup_unused(PCMachineState *pcms) --=20 2.41.0 From nobody Sat May 18 06:50:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1711641424; cv=none; d=zohomail.com; s=zohoarc; b=YkD2sV8BgBVcyWvi1jL2g4ReACDw1IswcTZqH+Vaex6bGxh63AxiTVsYLCYxtjySMffQxpDh+WMjl+uhCYY/2ymIdlmKltlyhxPsNgW2rTcF+R6iMqjAC+U3M6IpEySdfaHADYFseWrNJ9Kn1b6/sYFIgZInVVv96quzjSUQoiM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1711641424; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=a1jNCFtYZSmUOBchzYP/5PRkNu6FHAH8wzcx932FlSY=; b=eKF5kKoSUQOaVTZL2wJsObEVnJyQIVep7NwTIL0PAxHJEvCgVf4yGm28pvqoRGZuWbqjYDCqlGSCrpGGj8kVTtfhxM5fHaaOEktTLMeap7p0GfctQOT/8b8HJpim2jqW+tffs46FkDVENtPKQHPDDZn6J8DAbbez3yd20B+0cKU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1711641424446804.1923251065091; Thu, 28 Mar 2024 08:57:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps7a-00051u-M7; Thu, 28 Mar 2024 11:56:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rps74-0004HT-39 for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:56:25 -0400 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps71-0002Nk-HA for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:56:21 -0400 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-513e6777af4so1700653e87.2 for ; Thu, 28 Mar 2024 08:56:19 -0700 (PDT) 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641377; x=1712246177; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=a1jNCFtYZSmUOBchzYP/5PRkNu6FHAH8wzcx932FlSY=; b=XbWjQnxCd4A8s2e6R2ZZH2FLan6+OX46wdU+XB7fbmC8D7KoBlW0tVY8fDdprXAmsc yyofQNmcN6MEiqrmiN9Je9BctqmfiZUtJehxH+XmHfNP2E4eGZFUlp9vQCfs64hhJui3 LeCfwlVgq8RPWTdsmJLPhow9mnQpwzT0EGmegZ0HIoDxXvyQVuhKDFVdL/ZC6ujidDyW 1lNzHsJcoVRH4/a0OUyWyh0CziG0ofgq0S6jIspqMkU/Nwnw3IPK4AQtomZKZ3ycv5lP zQUqR354g7iy1rtWn4wlab1WJQcpM2MBJ4jdmKpFjvSAtSt8ntGdmYEKeMwZ8mP4steB aafQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641377; x=1712246177; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=a1jNCFtYZSmUOBchzYP/5PRkNu6FHAH8wzcx932FlSY=; b=Hc0JsKDUu2B3QRlODbEnNVkSTIX7ipdSU6gNbTlvtp6d5hAG2FmxqICR75VKJ/CfnV qme5jjSN3PgcuI68Y46hAahtxASO6OL4jTTZwkDU3ylB76R7S7GxQxoXToiZ0Ac6QTqz CkArGhWXqDyKaAD7ZB2fmSHPJFkwk86M3S5m+BLWtZmWyBcfILITEs9oLoW7rZWUoSMv ZkOvCUMqcrhKat3ij2m+I0kuVJM16sVYaXhoNHQAp0Axrf6bByyz4tQ+glGFewq+5IKc c0Xp8n/5UWe3BvhkArTkwk0JjIvBptfQUstFfWgKw3LYfnEq68ALRuGEL2DuTVRmsyhm /Bug== X-Gm-Message-State: AOJu0YzXRdvLwWOhdYMrLqvKT1KVJK1vBRbiEcvt28MS9oK8rs8gLGOy hZjjBUEAKTOqDnkDNF64KBfk/baU+cKPL3zkQt+a0fiS+yxRP6AIyuTfMz5XnZ6/yn945fXDli4 T X-Google-Smtp-Source: AGHT+IHXj5Yz165xDmy5t4NF8sNvW6bTjTmkAtHF7KcewPKZsVQV788UJXIfXnYu/c9dgv0TxzoB4g== X-Received: by 2002:a05:6512:110a:b0:515:c882:c44a with SMTP id l10-20020a056512110a00b00515c882c44amr2329607lfg.39.1711641377096; Thu, 28 Mar 2024 08:56:17 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-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=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::133; envelope-from=philmd@linaro.org; helo=mail-lf1-x133.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1711641426417100003 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=C3=A9 --- 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; =20 /* ACPI Memory hotplug IO base address */ hwaddr memhp_io_base; @@ -61,7 +59,9 @@ typedef struct PcPciMachineState { Notifier machine_done; =20 bool acpi_build_enabled; + uint64_t max_fw_size; =20 + PFlashCFI01 *flash[2]; CXLState cxl_devices_state; } PcPciMachineState; =20 @@ -184,9 +184,9 @@ void pc_i8259_create(ISABus *isa_bus, qemu_irq *i8259_i= rqs); #define TYPE_PORT92 "port92" =20 /* 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_memor= y); +void pc_system_flash_create(PcPciMachineState *ppms); +void pc_system_flash_cleanup_unused(PcPciMachineState *ppms); +void pc_system_firmware_init(PcPciMachineState *ppms, MemoryRegion *rom_me= mory); 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, =20 /* 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, V= isitor *v, const char *name, void *opaque, Error **errp) { - PCMachineState *pcms =3D PC_MACHINE(obj); - uint64_t value =3D pcms->max_fw_size; + PcPciMachineState *ppms =3D PC_PCI_MACHINE(obj); + uint64_t value =3D ppms->max_fw_size; =20 visit_type_size(v, name, &value, errp); } @@ -1627,7 +1627,7 @@ static void pc_machine_set_max_fw_size(Object *obj, V= isitor *v, const char *name, void *opaque, Error **errp) { - PCMachineState *pcms =3D PC_MACHINE(obj); + PcPciMachineState *ppms =3D PC_PCI_MACHINE(obj); uint64_t value; =20 if (!visit_type_size(v, name, &value, errp)) { @@ -1651,7 +1651,7 @@ static void pc_machine_set_max_fw_size(Object *obj, V= isitor *v, return; } =20 - pcms->max_fw_size =3D value; + ppms->max_fw_size =3D value; } =20 =20 @@ -1672,7 +1672,6 @@ static void pc_machine_initfn(Object *obj) pcms->smbus_enabled =3D true; pcms->sata_enabled =3D true; pcms->i8042_enabled =3D true; - pcms->max_fw_size =3D 8 * MiB; #ifdef CONFIG_HPET pcms->hpet_enabled =3D true; #endif @@ -1692,8 +1691,9 @@ static void pc_pci_machine_initfn(Object *obj) PcPciMachineState *ppms =3D PC_PCI_MACHINE(obj); =20 ppms->acpi_build_enabled =3D true; + ppms->max_fw_size =3D 8 * MiB; =20 - pc_system_flash_create(PC_MACHINE(obj)); + pc_system_flash_create(ppms); cxl_machine_init(obj, &ppms->cxl_devices_state); =20 ppms->machine_done.notify =3D pc_pci_machine_done; @@ -1815,12 +1815,6 @@ static void pc_machine_class_init(ObjectClass *oc, v= oid *data) pc_machine_get_default_bus_bypass_iommu, pc_machine_set_default_bus_bypass_iommu); =20 - 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, v= oid *data) =20 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"= ); } =20 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 =3D 0; bool pci_enabled =3D pc_machine_is_pci_enabled(pcms); + PcPciMachineState *ppms =3D pci_enabled ? PC_PCI_MACHINE(pcms) : NULL; =20 /* * 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 =3D=3D x86ms->below_4g_mem_size + x86ms->above_4g_mem_size); =20 - pc_system_flash_cleanup_unused(pcms); + pc_system_flash_cleanup_unused(ppms); if (machine->kernel_filename !=3D 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); } =20 -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 *pc= ms, return PFLASH_CFI01(dev); } =20 -void pc_system_flash_create(PCMachineState *pcms) +void pc_system_flash_create(PcPciMachineState *ppms) { - assert(pc_machine_is_pci_enabled(pcms)); - - pcms->flash[0] =3D pc_pflash_create(pcms, "system.flash0", "pflash0"); - pcms->flash[1] =3D pc_pflash_create(pcms, "system.flash1", "pflash1"); + ppms->flash[0] =3D pc_pflash_create(ppms, "system.flash0", "pflash0"); + ppms->flash[1] =3D pc_pflash_create(ppms, "system.flash1", "pflash1"); } =20 -void pc_system_flash_cleanup_unused(PCMachineState *pcms) +void pc_system_flash_cleanup_unused(PcPciMachineState *ppms) { char *prop_name; int i; =20 - assert(pc_machine_is_pci_enabled(pcms)); - - for (i =3D 0; i < ARRAY_SIZE(pcms->flash); i++) { - if (!qdev_is_realized(DEVICE(pcms->flash[i]))) { + for (i =3D 0; i < ARRAY_SIZE(ppms->flash); i++) { + if (!qdev_is_realized(DEVICE(ppms->flash[i]))) { prop_name =3D 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] =3D NULL; + object_unparent(OBJECT(ppms->flash[i])); + ppms->flash[i] =3D NULL; } } } @@ -130,7 +126,7 @@ void pc_system_flash_cleanup_unused(PCMachineState *pcm= s) * 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 =3D 0; @@ -142,10 +138,8 @@ static void pc_system_flash_map(PCMachineState *pcms, void *flash_ptr; int flash_size; =20 - assert(pc_machine_is_pci_enabled(pcms)); - - for (i =3D 0; i < ARRAY_SIZE(pcms->flash); i++) { - system_flash =3D pcms->flash[i]; + for (i =3D 0; i < ARRAY_SIZE(ppms->flash); i++) { + system_flash =3D ppms->flash[i]; blk =3D pflash_cfi01_get_blk(system_flash); if (!blk) { break; @@ -166,10 +160,10 @@ static void pc_system_flash_map(PCMachineState *pcms, } if ((hwaddr)size !=3D 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); } =20 @@ -194,23 +188,21 @@ static void pc_system_flash_map(PCMachineState *pcms, } } =20 -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)]; =20 /* Map legacy -drive if=3Dpflash to machine properties */ - for (i =3D 0; i < ARRAY_SIZE(pcms->flash); i++) { - pflash_cfi01_legacy_drive(pcms->flash[i], + for (i =3D 0; i < ARRAY_SIZE(ppms->flash); i++) { + pflash_cfi01_legacy_drive(ppms->flash[i], drive_get(IF_PFLASH, 0, i)); - pflash_blk[i] =3D pflash_cfi01_get_blk(pcms->flash[i]); + pflash_blk[i] =3D pflash_cfi01_get_blk(ppms->flash[i]); } =20 /* Reject gaps */ - for (i =3D 1; i < ARRAY_SIZE(pcms->flash); i++) { + for (i =3D 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, =20 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); } =20 - pc_system_flash_map(pcms, rom_memory); + pc_system_flash_map(ppms, rom_memory); } =20 - pc_system_flash_cleanup_unused(pcms); + pc_system_flash_cleanup_unused(ppms); } =20 void x86_firmware_configure(void *ptr, int size) --=20 2.41.0 From nobody Sat May 18 06:50:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1711641606; cv=none; d=zohomail.com; s=zohoarc; b=EUbVgxBoEJWFxyS4m755YMyotyNKNXfnzRq6r28iW6ou8vCKLuoNtFLmvwSGDRFdZe9mWnNrMfxNYA0KyLjP22rJ0Cjr5ooSu5Ysls7iYqCJMV6N7MZXdW4BK1MES6ZwNkMIZj2L+zNTnW9fFq3eoCRpHuIQVooFrTLG+A/TfYQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1711641606; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=YADozrynE6WAolQE0PpJsPO9+XRuTB0w7hXGd8JOVMk=; b=O5Xq9/koGLTqtb0voDpOd9cgG6BPEnRl5X63KGjmwCVjpc9EMw1x3IGP3vuPojnqDDC8z/PLQd7EmkSQP7E7P2HYN2wKftOJrMPxaTjJOt6vC8FER6WQ3N/3YVQqyOfC/uJ4Pzh9aROaVYSFdrloPXc1wDrCivrr+Q1IZKtUILk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1711641601154309.81070074633; Thu, 28 Mar 2024 09:00:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps7c-0005A6-Sf; Thu, 28 Mar 2024 11:56:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rps7D-0004Rf-UL for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:56:35 -0400 Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps79-0002Qm-MC for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:56:30 -0400 Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-513e6777af4so1700851e87.2 for ; Thu, 28 Mar 2024 08:56:25 -0700 (PDT) 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641383; x=1712246183; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YADozrynE6WAolQE0PpJsPO9+XRuTB0w7hXGd8JOVMk=; b=bNgcRPVC1lAOCjQ3ZlTPi4Rvg7x9ZYCxsNS9xHm8EtSjXq5pBEugDnEORT0gIM+jLz BWwy1RBcbJxvV7INgHFththJF4onONnPSJj4Hg+6l/sSUj0o6bsSg1j7PhR81sIN6THG GAjdctwf6BaQiwpdrKEBu5CBL+H9qYm1s59t0UE5nH/q7ZOBysCHhMtsZ+EHzhysYL2K 7ooQuBXIuoOSfjyPucuzszDAuwHIDznaIm5VCKvrxqAkZocwdhl+l5BsdNZzvz7hZPue JFCEGhkBb/4+0aS4QVQrBaZU7mYx0lLUbDjTjlU/w4cms1D2a7x8UVxSCms9OT5EC2zs VD8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641383; x=1712246183; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YADozrynE6WAolQE0PpJsPO9+XRuTB0w7hXGd8JOVMk=; b=vvhRIsEN6bgNDKIwI9mnrrgjJEc9iDbaxWo/7RE6OM76KlyOHyXxg6ElsB7ISpjPFp /stUoElYHMufpDfG4zOF25U42ZHwmx6fWIivKHitSQ2V7cgaxE9em34S3ekYLHVEOhoY YeG18J7DtafZW6dtQfTY5lJFHjOOdVB5r1S5qqtSRfudSPerLzWuTISKcMNNzSog05k8 dEvJwHw8PYeiGqrFgYsphXsY+fUuq5SFUBq2WDDMov8V002g4VM7LDmUfkWDXnfgkiqj JKp+4ND8y3bgkpMXgwpy3eNoPFOcMs2YyWucpQZZ+4Zg+lGWv0Gl9hw1kwxghHfpFhEr rWwQ== X-Gm-Message-State: AOJu0Yw9YZn0qieKd9/zQXp5gOAfv17O0HNtQ6cwWMcLuzJj3qfrgiUy YuBirRvoE1hUmadBV2xGjHr7bekxwcgcUA40Nz8qmjrG/4Pa8UjSVv8Ss27k7JB2f/o1KdJYPMY u X-Google-Smtp-Source: AGHT+IFET2qLkxCYJlLAe5wqUF2LJxJCZxdIrO9Tbo3cYr9nsR7BCDgXHuGLT1xPB8OJyuTlfGMDhg== X-Received: by 2002:a05:6512:78f:b0:513:e643:cd12 with SMTP id x15-20020a056512078f00b00513e643cd12mr2537328lfr.26.1711641383341; Thu, 28 Mar 2024 08:56:23 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-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=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::130; envelope-from=philmd@linaro.org; helo=mail-lf1-x130.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1711641607268100001 South bridge type is only relevant for the i440fx/piix machine, which is PCI-based. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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; =20 bool smbus_enabled; bool sata_enabled; @@ -59,6 +58,7 @@ typedef struct PcPciMachineState { Notifier machine_done; =20 bool acpi_build_enabled; + const char *southbridge_typename; uint64_t max_fw_size; =20 PFlashCFI01 *flash[2]; @@ -88,9 +88,6 @@ typedef struct PcPciMachineState { typedef struct PCMachineClass { X86MachineClass parent_class; =20 - /* Device configuration: */ - const char *default_south_bridge; - /* Compat options: */ =20 /* Default CPU model version. See x86_cpu_set_default_version(). */ @@ -126,6 +123,9 @@ typedef struct PCMachineClass { typedef struct PcPciMachineClass { PCMachineClass parent_class; =20 + /* 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 =3D 0; /* use default */ pcms->smbios_entry_point_type =3D pcmc->default_smbios_ep_type; - pcms->south_bridge =3D pcmc->default_south_bridge; =20 pcms->smbus_enabled =3D true; pcms->sata_enabled =3D true; @@ -1689,9 +1688,11 @@ static void pc_machine_initfn(Object *obj) static void pc_pci_machine_initfn(Object *obj) { PcPciMachineState *ppms =3D PC_PCI_MACHINE(obj); + PcPciMachineClass *ppmc =3D PC_PCI_MACHINE_GET_CLASS(ppms); =20 ppms->acpi_build_enabled =3D true; ppms->max_fw_size =3D 8 * MiB; + ppms->southbridge_typename =3D ppmc->default_southbridge_typename; =20 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; =20 - pci_dev =3D pci_new_multifunction(-1, pcms->south_bridge); + pci_dev =3D 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 = =3D { =20 static int pc_get_south_bridge(Object *obj, Error **errp) { - PCMachineState *pcms =3D PC_MACHINE(obj); + PcPciMachineState *ppms =3D PC_PCI_MACHINE(obj); int i; =20 for (i =3D 0; i < PCSouthBridgeOption_lookup.size; i++) { if (g_strcmp0(PCSouthBridgeOption_lookup.array[i], - pcms->south_bridge) =3D=3D 0) { + ppms->southbridge_typename) =3D=3D 0) { return i; } } @@ -401,7 +401,7 @@ static int pc_get_south_bridge(Object *obj, Error **err= p) =20 static void pc_set_south_bridge(Object *obj, int value, Error **errp) { - PCMachineState *pcms =3D PC_MACHINE(obj); + PcPciMachineState *ppms =3D PC_PCI_MACHINE(obj); =20 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; } =20 - pcms->south_bridge =3D PCSouthBridgeOption_lookup.array[value]; + ppms->southbridge_typename =3D PCSouthBridgeOption_lookup.array[value]; } =20 /* 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 =3D PC_PCI_MACHINE_CLASS(m); ObjectClass *oc =3D OBJECT_CLASS(m); =20 - pcmc->default_south_bridge =3D TYPE_PIIX3_DEVICE; + ppmc->default_southbridge_typename =3D TYPE_PIIX3_DEVICE; ppmc->pci_root_uid =3D 0; pcmc->default_cpu_version =3D 1; =20 --=20 2.41.0 From nobody Sat May 18 06:50:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1711641453; cv=none; d=zohomail.com; s=zohoarc; b=a6lkr84f8FwZLFoaNGBaiD9/Swv+4ffQShE6O0pxRJf/kykYuQD7T/8zYXZ8FQL8IDw1LcSvKs6CmRCrPPYQbxoieNcyH+qobjAi9KD0mfQZBNSuWp7Zc0oN46SlWMuEwQZObjqrXFwDjwNwFVYLVQlu2oiCsTHTMKO2I/YmzaI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1711641453; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=yelmGOzPahdn50NTFTioUrFj9NGQyALSAi158EJljHU=; b=n6M4XhdlnFP7WYwSPEiO/bw8L9jSA3usc8TTVV6fDZJ+LaI80+Fy3Z40+uCQeAAi9L0cQV7kN5RyhAxYlvEq2AZC4fWDgScnHoPp24eDr98L6yxX1QD8NIkEey1zkrExNjCE3JekFHigaBgYo8676NDnVABQLZ9LcEHUqX8ESYQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1711641452997842.7259568095336; Thu, 28 Mar 2024 08:57:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps7a-00050d-5G; Thu, 28 Mar 2024 11:56:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rps7F-0004Yw-QL for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:56:37 -0400 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps7D-0002Tc-NN for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:56:33 -0400 Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-a46a7208eedso167670066b.0 for ; Thu, 28 Mar 2024 08:56:31 -0700 (PDT) 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641389; x=1712246189; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yelmGOzPahdn50NTFTioUrFj9NGQyALSAi158EJljHU=; b=krvbD78ORnBdXZmJ3OmYQFXUSF7dNlymbl08eDUGLTjroCPPWdUAqYsv540u7Dd9hy S3zp5u2sAbn1rK6MxiEwGyfbx/4MLf1rPGKoO2QHs8VfTmNE1G33Q54DH5pcr08ViTX1 NLrXAL3xlvddf0otKio5moqPtjXJ6eO+Pf8D9oee4cBZHRwvhkwSL2KGvLl1o3o8V+jr OrN/Nd4vnB62IMuGE+IlE/jNX1mhHSVOlz0f2wfmZc8OHSQUZt4sbOQgiCj0VwtuyOWu 1xyUM3QgMO8ccL7saSfLVKdaIubAtgfBs7q4nC0U4Y0vmTDwL6itkG7gfjDPPHJ4LDsZ xmVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641389; x=1712246189; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yelmGOzPahdn50NTFTioUrFj9NGQyALSAi158EJljHU=; b=PDs3kENHk62nCRY+EWjBqGWtIgiR5QTqUd8lm1kx0s1kOFr0K/qVE3g7Jq8NPinEDq Mb5t3UlUR+L12W+xMcMy2J5PZlOhOwZKHS1rz+0ycxdrYShO4XpUxOWRk+PbYFwroA00 yxIOeV+wFlhCaU5U7o0Qy3roueZ6qTvaK+3CPzNtdS0J1+QyI2v3Gr0BnaFS7OctJV+u YOoeo54OcEOS8oIOsi4aqncE5XiuD0PVSBhJ6UWiLqPG8YOou8b8PJmabMS6pK9BHYZC 9eY0s6/dmu1HhH3n7DQyJrYObxMlDbxQkp+0DW/5N9cFAhl04oxBD68y3R9maqzRAEC1 myPA== X-Gm-Message-State: AOJu0YwKCyFoU0y7miYmWZVlxS0dlhMuWtd8yWGf4oPbH5HOM6+Lf/Z2 TU26R+5VDJOJqD1qjEKlUw1V8fH7f+YEACY2Y59OePphVQxTq8ay9gMNya8I2/3aJewv+crRbEJ i X-Google-Smtp-Source: AGHT+IGcQH5U/UKgHXGMsAIRXVS3RWDUx0CNeskq1nCdFHfYMz7G0o34lBWrByXcqIlMAc9p2yI9yQ== X-Received: by 2002:a17:906:e24e:b0:a4d:fc83:70e1 with SMTP id gq14-20020a170906e24e00b00a4dfc8370e1mr2038052ejb.56.1711641389600; Thu, 28 Mar 2024 08:56:29 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-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=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::635; envelope-from=philmd@linaro.org; helo=mail-ej1-x635.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1711641454507100010 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=C3=A9 --- 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 { =20 /** * 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; =20 /* 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, vo= id *data) HotplugHandlerClass *hc =3D HOTPLUG_HANDLER_CLASS(oc); =20 pcmc->smbios_defaults =3D true; - pcmc->gigabyte_align =3D true; pcmc->has_reserved_memory =3D true; pcmc->enforce_amd_1tb_hole =3D true; pcmc->pvh_enabled =3D 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 *de= v) } } =20 +/* + * 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 =3D 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 =3D true) + * lowmem. And for new machine types (gigabyte_align() =3D 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 =3D pcms->max_ram_below_4g; if (machine->ram_size >=3D pcms->max_ram_below_4g) { - if (pcmc->gigabyte_align) { + if (gigabyte_align(pcms)) { if (lowmem > 0xc0000000) { lowmem =3D 0xc0000000; } @@ -818,7 +829,6 @@ static void isapc_machine_options(MachineClass *m) m->option_rom_has_mr =3D true; m->rom_file_has_mr =3D false; pcmc->smbios_defaults =3D false; - pcmc->gigabyte_align =3D false; pcmc->smbios_legacy_mode =3D true; pcmc->has_reserved_memory =3D false; m->default_nic =3D "ne2k_isa"; --=20 2.41.0 From nobody Sat May 18 06:50:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1711641451; cv=none; d=zohomail.com; s=zohoarc; b=ewL+Q1Cca2kNth5VOUn9ilhwPfxZgx0GdUVCKNxTylqMeZHoS3uSugPF1a/kv2md/v3ih95h+OXkcep2mJ+jXnpEHtHzzwQJJFAyA3oGOsQ2bWkeseFCsZL9918gfI+Xg54K94WeoX0wW27O4oIqaFaG0SGSGvdQInIRWrYoVWg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1711641451; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=mvS5b4mOvRgBMXReEbw8mHkHwY6O9r1j8WjPX6hg3zo=; b=cF6uxJqusmvioVhTNDVSFy8aX7zF8oBOQwzB4znJL4yjd6bZhmkbE7MwID7iCSguk6Ku9dEpiBbFyPCUY3R0LNP060z/1HazFT71vDEICSxm9b5KZ+gOChdu2q76Vb9dM3DmMxBZRZ3l9Q7qP2J18gJSyKkrRnRn0Tgs4ksSdg0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1711641451409182.41247366420134; Thu, 28 Mar 2024 08:57:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps7d-0005EA-MN; Thu, 28 Mar 2024 11:56:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rps7L-0004aW-DN for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:56:44 -0400 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps7J-0002Ve-JZ for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:56:39 -0400 Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-5684db9147dso1315132a12.2 for ; Thu, 28 Mar 2024 08:56:37 -0700 (PDT) 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641396; x=1712246196; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mvS5b4mOvRgBMXReEbw8mHkHwY6O9r1j8WjPX6hg3zo=; b=yQG8nxLXUsIhy97Z2qz79nI0mLusIbLwc+Tc7VKe9VPE5pjS7zcap8QMh/mRsgQ7ZW acP9BMOTPrkud7/D6oBuEc1L2r5a5l251CNJBuEPpK5XPAR6u4YFFSu0M9y8jW5DY0O9 kxbkfknwbJHfpemXOJliVEk7jYjWp/xYTqjiDZEz+LLPOiRfj1FVFqyHSKiq1YmKdqSq 9Tqy9Ud7x9iVzK9SFA+CDY4/TN5fMzEsKrOy5K91FfLbfKXxTdRKvUZNXqJ0vDKB3zaO lXlcafmrg5JxBDvJYar9mQ1DzP0DHsPzM7OJpT00yKMhe56EOl3KvBgDjAixyPv/TJSt QJVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641396; x=1712246196; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mvS5b4mOvRgBMXReEbw8mHkHwY6O9r1j8WjPX6hg3zo=; b=nUQi8Dbz3W+CzXeMtTtAaMso+TV57+lNUGnfwKEb2RrO3fXo8BIfst3I0FToGm3ykB R2CyeZ3ASRGEENnI1bKiRGj/IJ27JzYAdf9PZdx410g242VnIc4nz3xMDqVywLrjN09V Y/Xfo0FYLnqxL+V6y+dvbatN4gIay+yukJMgdGtrtqEhJt6VrI9C9pJaadBemC/1FEsJ nti/iPkpj2pDy2XuWtpS5Gxm+FROT2jlgO09DYRg3Ll00xPTqu8ohO2tlFGShONwj0Qp dYS8ZsENXvIFEKyt/DhquCSqdbNfcpmxN/Q9X2zX2xMlVGJ6P83U48xLSOLBJ1Gf1k5J RkhQ== X-Gm-Message-State: AOJu0Yxm5KRxtBAtDz7IZLFNtP4IVQzZ0OFbYuyoHAxxGMisky5LA87r NJAoTUs+cRf0T3pBr7Cel8b/H8M6/6g98p01sqRlzR16TSO5UZ6qPP1D9pGB+Vayej/xF+rR0pS + X-Google-Smtp-Source: AGHT+IHfWPHo1qaEN4DNEm3R8wOVj4A4iUDXGogGmGPb4Wx0aiRPAERFSIayiOeRYDhmlaAPcH41sw== X-Received: by 2002:a50:d6d7:0:b0:568:a9f3:b3fb with SMTP id l23-20020a50d6d7000000b00568a9f3b3fbmr2267809edj.8.1711641395712; Thu, 28 Mar 2024 08:56:35 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-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=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::534; envelope-from=philmd@linaro.org; helo=mail-ed1-x534.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1711641452484100003 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=C3=A9 --- 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; =20 /* RAM / address space compat: */ - bool has_reserved_memory; bool broken_reserved_end; bool enforce_amd_1tb_hole; =20 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) =20 +static bool has_reserved_memory(PCMachineState *pcms) +{ + return pc_machine_is_pci_enabled(pcms); +} + static hwaddr pc_above_4g_end(PCMachineState *pcms) { X86MachineState *x86ms =3D X86_MACHINE(pcms); @@ -702,12 +707,11 @@ static void pc_get_device_memory_range(PCMachineState= *pcms, =20 static uint64_t pc_get_cxl_range_start(PCMachineState *pcms) { - PCMachineClass *pcmc =3D PC_MACHINE_GET_CLASS(pcms); MachineState *ms =3D MACHINE(pcms); hwaddr cxl_base; ram_addr_t size; =20 - 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 +=3D size; @@ -760,7 +764,7 @@ static hwaddr pc_max_used_gpa(PCMachineState *pcms, uin= t64_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 th= em. */ - 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_RESERV= ED); } =20 - if (!pcmc->has_reserved_memory && + if (!has_reserved_memory(pcms) && (machine->ram_slots || (machine->maxram_size > machine->ram_size))) { =20 @@ -901,7 +905,7 @@ void pc_memory_init(PCMachineState *pcms, } =20 /* 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) =20 if (ppms->cxl_devices_state.is_enabled) { hole64_start =3D pc_get_cxl_range_end(pcms); - } else if (pcmc->has_reserved_memory && (ms->ram_size < ms->maxram_siz= e)) { + } else if (has_reserved_memory(pcms) && (ms->ram_size < ms->maxram_siz= e)) { pc_get_device_memory_range(pcms, &hole64_start, &size); if (!pcmc->broken_reserved_end) { hole64_start +=3D size; @@ -1752,7 +1756,6 @@ static void pc_machine_class_init(ObjectClass *oc, vo= id *data) HotplugHandlerClass *hc =3D HOTPLUG_HANDLER_CLASS(oc); =20 pcmc->smbios_defaults =3D true; - pcmc->has_reserved_memory =3D true; pcmc->enforce_amd_1tb_hole =3D true; pcmc->pvh_enabled =3D true; pcmc->kvmclock_create_always =3D 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 =3D false; pcmc->smbios_defaults =3D false; pcmc->smbios_legacy_mode =3D true; - pcmc->has_reserved_memory =3D false; m->default_nic =3D "ne2k_isa"; m->default_cpu_type =3D X86_CPU_TYPE_NAME("486"); m->no_parallel =3D !module_object_class_by_name(TYPE_ISA_PARALLEL); --=20 2.41.0 From nobody Sat May 18 06:50:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1711641439; cv=none; d=zohomail.com; s=zohoarc; b=ghRW95DdAq2zsEqmM6VuOGm6EzbqgKlIUSk8Q3l2Jm8Tn/YATS7gmnsOkvHa+jMavJ1DPFMmXjMzwrdnVKE2oekFSbv0PE6hNRmKLcCLtWQ90UXas3jwR/3PgtHLmAVV8rY0GQSchTQonPxrpBhevG8P6nropbNcI0vacnT99Kc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1711641439; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=muQ9YYs1garpvhloVWRUiLPzA6iwq65Rr1SdS4smlFw=; b=Q4e4MFLiK7ZZh4g2LdWy6R4ls7VEg72xbD41I6Baazav/Uh3YiEcz5PW69wmN/lGStIXBFCxv+mBtOiDiPyvetdJFkoXsX6TAHXEirTY3DOUGUjk6J+Pyf8ir3ZzJ6p/+u8V5R0qFTESwIQU+qNdUJWg1YwFa6ntc5gUtEv47Q8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1711641439982757.9122145571883; Thu, 28 Mar 2024 08:57:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps7a-00051j-MG; Thu, 28 Mar 2024 11:56:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rps7R-0004f8-Fd for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:56:46 -0400 Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps7P-0002XK-UH for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:56:45 -0400 Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-a46ea03c2a5so216843966b.1 for ; Thu, 28 Mar 2024 08:56:43 -0700 (PDT) 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641402; x=1712246202; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=muQ9YYs1garpvhloVWRUiLPzA6iwq65Rr1SdS4smlFw=; b=xIviQFS5WkfB3SmaSqmdUiAYqROgybIZKD58pgI+nEQ6LVuoxICa+gUvJ/0tTQwbzF o+uLtFAavL7ut4sMimpHF6nxEOCUOeRg6tCtKL3dQnxXVrFop37PE66b9GSDjArbGVpx wuwy6fTwtFcrIWsjIHtCew9cfKdqHUayeiBMlVjFq9nClJpotpgJN133Yet1y+CX7S4V Fe18wz1fhSljbdc1b0Pae2YXWJ1/xZBXZAmBqZHAPr/hgrw0YyYr/qDdL2dka3PjVB19 ueZqFa/A4vS4rpcyqBVsrt0ftb9YlaMc3Bpy9/G51V3NPxYAU/6vOFqKjm5/31/hdo75 Cf1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641402; x=1712246202; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=muQ9YYs1garpvhloVWRUiLPzA6iwq65Rr1SdS4smlFw=; b=H1wHNYV0VeiOjpMCZUH19sS5E7C5op114D2gNMaL9XBCDneh2zGNS+gLEu9Q8GjAYh wFDCb0wa8UHUFm6IW4VYtO5bPeLDgMax9neYLUmHbftsCjMOpJwSSJ2pY+x3OBBFIcrY N/PvQJtNO34Ll8gfdJ39F3BU8DFCclXuPJWGiseHVgC2VALTB6+v124bOTvFTrCDIJDc d3k59A0RoRgXB4ZnZuVujNOP2R4aNyGFr7Zn6+nD3e87mmR9sUYEQ0PAwpxI0aHojtQo sAfpOtrRyHo2trdLFpdhQS005Ejr2QMw0L16SmkzmTxdj+2AP3GUq5W7yfNKDcD2uiJh bABA== X-Gm-Message-State: AOJu0Yw92N27Qljkj0evo+0qYu+sh/liQkX3exoA9UlnfXOxKC3SRvO4 lpiT5QGG8n8XBguTv4Ia3HkJbC5YHZIwfb/YG+ZJ2q35VLigykaEQBjdAUlzenJQbH2OFHzD3iY 7 X-Google-Smtp-Source: AGHT+IFXbYhPHZn5NXBz7Ikr8yC8QHRf+1TONIhT4Hw3waF5CP4z/i4EhLM/5gQv8lw+8vgiP63smA== X-Received: by 2002:a17:906:714a:b0:a4e:f91:4694 with SMTP id z10-20020a170906714a00b00a4e0f914694mr2568225ejj.27.1711641401851; Thu, 28 Mar 2024 08:56:41 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-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=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::632; envelope-from=philmd@linaro.org; helo=mail-ej1-x632.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1711641440415100001 Since CXL helpers expect a PCI-based machine, we can directly pass them a PcPciMachineState argument. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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 =3D size; } =20 -static uint64_t pc_get_cxl_range_start(PCMachineState *pcms) +static uint64_t pc_get_cxl_range_start(PcPciMachineState *ppms) { + PCMachineState *pcms =3D PC_MACHINE(ppms); MachineState *ms =3D MACHINE(pcms); hwaddr cxl_base; ram_addr_t size; =20 - 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 +=3D size; } else { @@ -722,10 +722,9 @@ static uint64_t pc_get_cxl_range_start(PCMachineState = *pcms) return cxl_base; } =20 -static uint64_t pc_get_cxl_range_end(PCMachineState *pcms) +static uint64_t pc_get_cxl_range_end(PcPciMachineState *ppms) { - PcPciMachineState *ppms =3D PC_PCI_MACHINE(pcms); - uint64_t start =3D pc_get_cxl_range_start(pcms) + MiB; + uint64_t start =3D pc_get_cxl_range_start(ppms) + MiB; =20 if (ppms->cxl_devices_state.fixed_windows) { GList *it; @@ -937,7 +936,7 @@ void pc_memory_init(PCMachineState *pcms, MemoryRegion *mr =3D &ppms->cxl_devices_state.host_mr; hwaddr cxl_size =3D MiB; =20 - cxl_base =3D pc_get_cxl_range_start(pcms); + cxl_base =3D 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 =3D cxl_base + cxl_size; @@ -1027,7 +1026,7 @@ uint64_t pc_pci_hole64_start(void) ram_addr_t size =3D 0; =20 if (ppms->cxl_devices_state.is_enabled) { - hole64_start =3D pc_get_cxl_range_end(pcms); + hole64_start =3D pc_get_cxl_range_end(ppms); } else if (has_reserved_memory(pcms) && (ms->ram_size < ms->maxram_siz= e)) { pc_get_device_memory_range(pcms, &hole64_start, &size); if (!pcmc->broken_reserved_end) { --=20 2.41.0 From nobody Sat May 18 06:50:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1711641526; cv=none; d=zohomail.com; s=zohoarc; b=kEqv226dg0Ptrnhb9mH3Om4sKB20pOIIpViAYk5P7RehJ2/1Czr5HslZuytHNS6WlHJmqzirUaYwX7zAOFLdveS4tT+zzIH6Wv/4bVTKqPSyfy9UszbKXb94RyLcw9U+2CTqeaaxXwXIU+ACFWFroxHerd6nPfvLH5gp51ivMWs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1711641526; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=3Aa27ZqAQEFmCBsiqy9XwiiPf6EIjcNyjahGDi9IpJg=; b=ZHpc8jh0cWjgRED3By6TgX4YlkRBi6asrvVxQZZ1uuee4hJTKnvT2VDzOvsNENEWUzN6xprT2SZPp6hkMvogHNjVWWYQnWJSjGAMrVJDBn2ybGZvcgUKlxmIl7Ys45TZCcSGccyeoogsN7JTjy/Lf4HzgcIjSiEmsKk8j+nXPOk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1711641526040485.6903501661873; Thu, 28 Mar 2024 08:58:46 -0700 (PDT) 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 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-Outflank-Mailman: Message body and most headers restored to incoming version 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=20Mathieu-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=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1711641526689100001 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=C3=A9 --- 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, uin= t64_t pci_hole64_size) =20 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 =3D PC_PCI_MACHINE(pcms); + return pc_pci_hole64_start(ppms) + pci_hole64_size - 1; } =20 /* 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 =3D PC_MACHINE(qdev_get_machine()); + PCMachineState *pcms =3D PC_MACHINE(ppms); PCMachineClass *pcmc =3D PC_MACHINE_GET_CLASS(pcms); - PcPciMachineState *ppms =3D PC_PCI_MACHINE(pcms); MachineState *ms =3D MACHINE(pcms); uint64_t hole64_start =3D 0; ram_addr_t size =3D 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_val= ue(Object *obj) pci_bus_get_w64_range(h->bus, &w64); value =3D range_is_empty(&w64) ? 0 : range_lob(&w64); if (!value && s->pci_hole64_fix) { - value =3D pc_pci_hole64_start(); + value =3D 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(Obj= ect *obj) pci_bus_get_w64_range(h->bus, &w64); value =3D range_is_empty(&w64) ? 0 : range_lob(&w64); if (!value && s->pci_hole64_fix) { - value =3D pc_pci_hole64_start(); + value =3D pc_pci_hole64_start(PC_PCI_MACHINE(qdev_get_machine())); } return value; } --=20 2.41.0 From nobody Sat May 18 06:50:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1711641566; cv=none; d=zohomail.com; s=zohoarc; b=I0CqepkR8TXIvgeJJKLiBnwYVuo+zg6Nx8t3AZZXQAQoCMd4hUuZegJC787IH6b5Mrm06NqP3nXUl9CS3IRmUxQdm/UwJgiSgQeDOSNzOvg2gNb6bJgS6MNtaAVq3TmVIqlykIf3g5IHavevfaqcmEGbLqztgMvcJp3FVbk5/1I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1711641566; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=wAY/yw6dYKkUP/WFLvpvljjwD9mQwkPWyyzr0cq0w+A=; b=caHjSDHahqcXiqSLX+Mq/IkaC7gQ3rVSbvALAd9Zw2lQ0X49APXydu1/QjaPioeg1zehyMGrMaEnV4qmvnTjjeVcZbTrJTB2uzsNPd03nFZLaZ50YwUYLVEiv8hskzeMeKIj4nujfBeU5U3rjxCqItZZA3bMwSpublCIwJadmGM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1711641566086734.4175690226799; Thu, 28 Mar 2024 08:59:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps7f-0005JN-Fm; Thu, 28 Mar 2024 11:56:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rps7d-0005ER-Jz for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:56:57 -0400 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps7c-0002b0-3S for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:56:57 -0400 Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-a474c4faf5eso131227066b.2 for ; Thu, 28 Mar 2024 08:56:55 -0700 (PDT) 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641414; x=1712246214; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wAY/yw6dYKkUP/WFLvpvljjwD9mQwkPWyyzr0cq0w+A=; b=JNDl9J4SJDqRbZFQoGQNMvd+BkAqhAFqoy3Updafh0XZhndsPEsNvvJ92i3A1GANz9 2IaxJYrPLm/XIOop51q5ng/aF41/Ss1+CUbIjxqNX1W+Tex3R0tX9842dgQyrWJhU5dU bIxi1GkxYKHGcglj+dr96Qej8sunG5uNpeUZ3d57NydIe6pQRQnEzm4GXTW9x1nh+aTO 5qwQd2GzxIH5eAlrlHMlRPa5bHpVuNryDKsRziqerpWRxIOeFVUFRHMO+Lojqdj0bIfn mKL+Q/T4RWsZuPf5gqSfQ5SdUJXXiGSlonrgbW4FCkZIJTXnV4Wvp4+IWQs/Hd8K6Ct6 GmOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641414; x=1712246214; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wAY/yw6dYKkUP/WFLvpvljjwD9mQwkPWyyzr0cq0w+A=; b=DG8BllfpBT9cCqXNeaUiJrjM/+CY07/SJHI3OhyuEiMvyuLARbQvztCtpmgeUVRBIU sUrDJlpPYH6g4WjkNrHdMeDsNIBsJLtkAHdH0LqxYdJbPuuLCXKOB3wFIglhX7LwqY+J TvX2z+cCpPt5vV8PHYOg/B66xRT649Luwhj8kCVwmrC5wX9RvMIEbhpBylbbr57fDryE 4Xqo6mz9cYDAAZgib+/KTLUnf+lKsiprTeiJpYMEDod+9vxqGbVRaGrWJTLSPmQmAErk 2cAz0k9ueSVEkmmlR90Z3fAidw9p0UlwSzzUsmXgwocYIIexVspubtGKnLEIdMrHNir+ rpJA== X-Gm-Message-State: AOJu0YwLxf7un0NdYT3DuWtH1vpDQk8JhN7ICN4nsUPFad4CkpdQnZiT bBiQcGwbJFy7dvcl3EXZRs0Qlchj0ERkFll1u9VQFsZmGfT7Vw8Rpx4eIDzoQY0NolJmQ/8rFlt t X-Google-Smtp-Source: AGHT+IHHCjINc+B1WA7YTf9CDPOy43wJYCQL0voBiUNztEKWZkyjgtHiZiJjx/du9sQyScNWeJj6tg== X-Received: by 2002:a17:906:35d0:b0:a47:11a9:9038 with SMTP id p16-20020a17090635d000b00a4711a99038mr2127429ejb.58.1711641414401; Thu, 28 Mar 2024 08:56:54 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-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=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::635; envelope-from=philmd@linaro.org; helo=mail-ej1-x635.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1711641567112100003 "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=C3=A9 --- 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" =20 #define FW_CFG_IO_BASE 0x510 =20 --=20 2.41.0 From nobody Sat May 18 06:50:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1711641552; cv=none; d=zohomail.com; s=zohoarc; b=A4hvGcIvrkZ0sfRibrvasZ+Zj4bDZndTTYfO3Xc5rLEWo/GM5IfrTYK1zGpqHmLogxSSmTpALqndfvkIjstMS3KcYc06Z2NztbE/t/sijMRpgrmZY/9otVbgWGf/j2SEeJuLY5ZWKrDZS/HqtASlPgRE3m6MFhVaPwwdfHAsgGQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1711641552; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=EBrGlAtp7IiqJxUt6Mnv7AOEnMWPJd0FVBqTzh3q09E=; b=KfjkXZUUsW4FtrgRLnUCm1DUZ/GkXk+qAklzylwbsPaelU+tAlaFUdDpEFzIa8hs8GYGAJVIhrxQDhbOrwJDbbpAO+5j/70MSfjmedmviQcrjXmOSej8Kpm59XzW8mSVCFzpc3YCoVkIEbOtuEkTTnyrgqfGkUp+03SagN2ewfA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1711641551913380.5768123029467; Thu, 28 Mar 2024 08:59:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps7l-00068d-Pk; Thu, 28 Mar 2024 11:57:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rps7k-0005wQ-4B for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:57:04 -0400 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps7i-0002ca-AN for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:57:03 -0400 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-a466e53f8c0so144806466b.1 for ; Thu, 28 Mar 2024 08:57:01 -0700 (PDT) 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641420; x=1712246220; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=EBrGlAtp7IiqJxUt6Mnv7AOEnMWPJd0FVBqTzh3q09E=; b=I7d976MewaPvuYiDLCGsTimNZLPb8OOBAW6AroOgs3sUOA5qKr4UynSOrYTTjsWaYe A0nUtCh2qWsNaTPEr0xwY8lcIQD/tGYiJ9lTmigNh3taLsRyECwgBxkJjAu/HvnfEaux KZbwvNTt1SiaULh9SBNSqOHvVnmC4sio8LdEMmmzlRM+NeqnQBRm98C6d9sW7tOIrb7F aE+0CTowNqbfVE32ffNlPAn7ALg4y7aXQYF4fEikGBeeDnERnqL8Rje4N97fpMaZVXHK CIqglL7XCgnOVpv6gr7eDO9xrA6uw4p725mv+OIVAxc1TIetGTeueN89oLaYmvAhtpQA dD8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641420; x=1712246220; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EBrGlAtp7IiqJxUt6Mnv7AOEnMWPJd0FVBqTzh3q09E=; b=tlajuQVX6bBKgxTdSTj2/OuEi6OjjegVBGYFu4+dW+PIz5RN3VvVPOK2LLrC22SWcP glAbBO0S0sDIg7zxJLUtM0knCPNU01860Yzo27iwNmhEmzqOIFIqmvMsRtdS93rPTdHI w+bg+SG+uNZWbiwhhzbhTkFpfGvihfh04uKe+Mpwm3tK8af3Stzowbx89H3/swOp371d uJYjOjEcbxTMZ9fehPGPaAgSo5JieD7RWKmRojnvtK0+gXDtYvWPEVg1PdG7ACJe8BJF hhsENu+cw6kJ1GJdo6rgbP4emG50xqjz1hPotz88OBcWTsBdXWn+e0WltENuSFU6RWYN 7AHA== X-Gm-Message-State: AOJu0YypXam0aq6uEBXfbwuawSTs0TbfHdrnMr2dHJpjktQC3z5OkL59 5ZSnnyKBXoAJ387zT47qJt8+sMYUKZfRHabn8V+p3AaV8acJHCBOlMLExaLBM2+lwnXy1ge4fDA m X-Google-Smtp-Source: AGHT+IEOvg34oYcu9GAIHQIWSpLYGC94raSmAj67zD4Gs/B4BPRdpoH1JkHeTSn1iij0r48HVMXasQ== X-Received: by 2002:a17:906:3289:b0:a46:420f:8ecb with SMTP id 9-20020a170906328900b00a46420f8ecbmr1904346ejw.62.1711641420490; Thu, 28 Mar 2024 08:57:00 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-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=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::62f; envelope-from=philmd@linaro.org; helo=mail-ej1-x62f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1711641553110100012 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=C3=A9 --- 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; } =20 +#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, FWCfgSta= te *fw_cfg, fw_cfg_add_file(fw_cfg, "etc/smbios/smbios-anchor", smbios_anchor, smbios_anchor_len); } -#endif } +#endif =20 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')) =20 i386_ss.add(when: 'CONFIG_X86_IOMMU', if_true: files('x86-iommu.c'), if_false: files('x86-iommu-stub.c')) --=20 2.41.0 From nobody Sat May 18 06:50:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1711641442; cv=none; d=zohomail.com; s=zohoarc; b=U02J5jZWkSqOghOTfgsvyDfpO6//7H4U1g7HJyI2oUWfBjGUz09XAMqqph6dQfK3Td5Wf8Dl4CazMikN7UXy1cK9X9l8XZocmfZVr8bymEqpGg1lw23XkRl57JAPfYEY7byh9pl3N9zu6J/l6MFqkNUAxiI4jcK507tU1BUtN94= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1711641442; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=4BSXB7GHW5TBQXIjnxuyxFyj9B1iDsM8cHi/htTyRxs=; b=Vc/pm6Sbso+aG9oSopDINh9GZFVQDT9g8mQLTfmjcbImnXTXaidbNFlV5RTkdkEm32p+yqhUGj0w/4549H6U2rxFGQ8j2WpXeFICM5m1AyykJ3NGnh4NDEsSYsVKUOTzSfUphCQeKrpyXt3nCz4lZiwbV8hF1cTP34XAWkRKyqU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1711641442837272.38271413938855; Thu, 28 Mar 2024 08:57:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps7r-0006m1-Fa; Thu, 28 Mar 2024 11:57:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rps7p-0006ew-W8 for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:57:10 -0400 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps7o-0002hL-7c for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:57:09 -0400 Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-a2f22bfb4e6so155232066b.0 for ; Thu, 28 Mar 2024 08:57:07 -0700 (PDT) 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641426; x=1712246226; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4BSXB7GHW5TBQXIjnxuyxFyj9B1iDsM8cHi/htTyRxs=; b=bamZfs6ZpZARXoFfvhiYUlk8JTdEt5Hy6MRpnESxzdU/z6Xhk9ZW4tRux1pQNHonKj fRHLphy6mkLkdv+0zARX7iIv7teQaq4q0tqKQONQFCWjds3TRl40tHn+kg/N/sydP/9b BG5xAcbmxKc+Z9u901CL2g+8GVRWlGeRQEvn/u58yPKjf4W+YI+j77JYYgdMtbK8VdFG b7nAMQT0SVI6C+ejaWNoXtOkKnhEmXkgUHEx2ho1UtbK/McWUm0lhbmcV7FLsSvp28FV Fq8lyiaSRepRUUzzW3quXa0cZWdhyrly3UxSTYr5qbCS7zUkvnw7S2Mi8S3n1KjyliNI hYyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641426; x=1712246226; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4BSXB7GHW5TBQXIjnxuyxFyj9B1iDsM8cHi/htTyRxs=; b=DidA3cYSThwSF5F/irkkmopfVCh9sxPVHmGTFl5/7gIdCFm2B4afWxzMsujzcvadPD C40OUrNrMXCKSL4QYWbVvQVBsLjHgLEEkb9GAc/XN0lzOD42dV+4nUySSdwvCa9xVu1G pbJMmVtgAx6SDNkg9+3d6kayoQL6AT3cfoayUcWGEYcDecW26HPv5bEV9fg/00xWFO7d w4tTcZPuY24qaVTQZmcQtNRP29ij+IfFimcYzqvCVRFL930Aj9s0F6w2+dwB7p2vYi3N MBllRAnCW5ogTWg9w4WUNdd8Bnc04B+Ofpxwe7qBZGk+TTODJEiw6e3By4Gu7wN/FZP+ IyFA== X-Gm-Message-State: AOJu0YzxOQcoBjUgmVdOMo7qw8SSULlVRqBdgnMcF8BkC8FK2GWk9lF/ sBZlYAzkFNt/taaetqzqxxOgAR2ZH8ScU3GMVQ+O+lE3mJH7w5hpkz77Bi+l6mucBtTrALu+33s x X-Google-Smtp-Source: AGHT+IFF/skKWHNCTMPwJb+B2ckteIOxmThfN9+aMTRN8D0HIEaksr7NEcZ4nuV98VsFYsHsSKmB9w== X-Received: by 2002:a17:906:b112:b0:a47:1fe8:9825 with SMTP id u18-20020a170906b11200b00a471fe89825mr2020350ejy.32.1711641426506; Thu, 28 Mar 2024 08:57:06 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-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=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::630; envelope-from=philmd@linaro.org; helo=mail-ej1-x630.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1711641444448100007 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=C3=A9 --- 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; =20 /* SMBIOS compat: */ - bool smbios_defaults; bool smbios_legacy_mode; SmbiosEntryPointType default_smbios_ep_type; =20 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) } =20 #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 =3D MACHINE_GET_CLASS(pcms); X86CPU *cpu =3D X86_CPU(ms->possible_cpus->cpus[0].cpu); =20 - 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, vo= id *data) PCMachineClass *pcmc =3D PC_MACHINE_CLASS(oc); HotplugHandlerClass *hc =3D HOTPLUG_HANDLER_CLASS(oc); =20 - pcmc->smbios_defaults =3D true; pcmc->enforce_amd_1tb_hole =3D true; pcmc->pvh_enabled =3D true; pcmc->kvmclock_create_always =3D 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 =3D 1; m->option_rom_has_mr =3D true; m->rom_file_has_mr =3D false; - pcmc->smbios_defaults =3D false; pcmc->smbios_legacy_mode =3D true; m->default_nic =3D "ne2k_isa"; m->default_cpu_type =3D X86_CPU_TYPE_NAME("486"); --=20 2.41.0 From nobody Sat May 18 06:50:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1711641570; cv=none; d=zohomail.com; s=zohoarc; b=SRhEYtDUosU5Xl1gNCFiKD0QWogLp1gFVdnhf6VxFLtHX+O0lZOyHwSR8F9/SPWDd9R0+MwDXOMw0KkDk6qzbtnt1EVPvsyyGb0/+PLPKD32gPSPlErOPIuotZX0EzkBAhNGDWSlBkt7Si0hYlHTfpr1zHRh9bUhnYl9dVZrUsM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1711641570; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Jd0AyxLTXxReg2ZsCl/5FvAkstq2JBvxx9RU6rO30AU=; b=bECWfC4mu8wiEL3ezGPppR39kYyyqQwUj2BBM3XIv6R+EZCLJRYMvJPAapwz2j1qii51/l+APrZOnLFjD8wsK3DtvCKSyyXq01dhOtijyvrxT51ekcprZTbH34TlZD146wKAtdPX8WEHfPY5I7i2a+QZqyzWZaYqDW1TFiXLPCI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1711641570410606.6492250595664; Thu, 28 Mar 2024 08:59:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps7y-0007Rb-Dg; Thu, 28 Mar 2024 11:57:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rps7x-0007MZ-2h for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:57:17 -0400 Received: from mail-lj1-x232.google.com ([2a00:1450:4864:20::232]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps7v-0002iW-3e for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:57:16 -0400 Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2d6fd3cfaceso15191651fa.3 for ; Thu, 28 Mar 2024 08:57:14 -0700 (PDT) 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641433; x=1712246233; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Jd0AyxLTXxReg2ZsCl/5FvAkstq2JBvxx9RU6rO30AU=; b=YaFF0AYhEO9xz1ReqBDLs/SzLrEX6uR7FIH2m/OL6ZGlYI5GdQxGPeUMT6tfWs6gej hHW2nDMWDpnvFLs8Qn/LIcusd5DxibV+KA4lhjxoWpFmPNv5eq0DgBNqkiAbbVhlFFq5 OF2JFsiO+GG68sf5JiMmSDzJobveb3TOBdAmt5DXv7u8r6AZ3u59DBLBCM/go8SCGQ1M oeQlGbaevzdjmKvIATxdkiv7gvtOFrwVu2fw6HO46fLfYh67PdDCkhkzHzWoZaQ/It6N N/67bZNxx/MJ6rI3OYD1o07HDnjYQPyBlrjDJbBwa/TsDSrjOYcOr/0IgbE8EMQKut+v 4JUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641433; x=1712246233; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Jd0AyxLTXxReg2ZsCl/5FvAkstq2JBvxx9RU6rO30AU=; b=xLWLgQK0iGzkt/OBuoVIc8TO1Cwmggnj4U2VjJkDN1nGZ4Y5WJS5TRbLjxXWAxH90D q7KX1UXL0LWGCCZU0MpeI7lbx4DAsOLLeyJWgr0AIYCr+9D66m3ZblIsRrMfYu9q1eyN ptWU8hFs9Y3jFsv3tmKC4lje2vvSTMYrfKPn5NyIeNo0c58MkPy2bbcrEm59RMlnzVJM sC7GDsIM7v/awgEqTwRxOIgz3Ms/e/EUYeXLOYVmcY90h7Aw4zXXB4D5MWulZD0TSuqN j0O2byNU5BkX5aAhaYZzvy8ZrRjSRuiOia+jfIwS4gzi5aw2zO7T6eMug6NM+rLtlPF8 Xxbw== X-Gm-Message-State: AOJu0YzaPGnqShzTepMluOYUoy3GChIkJwYJ8Ze78mA7/ElVI0FUpCBB 1FDzwy1T0yAy3fgDDq1seQzTaDcjmRUZhvB6lkOHuwd50oXqD16WwLtvhx4vCU8Z7t6lZRfjCkD C X-Google-Smtp-Source: AGHT+IFp7sCXvlR7d3Mf8BzIjVT/t0rldZPHgrIbP67RUd/bNvgi6xSgjnnhBTrJNCeF2G5tN//CLg== X-Received: by 2002:a2e:a289:0:b0:2d3:5020:17e5 with SMTP id k9-20020a2ea289000000b002d3502017e5mr3152074lja.36.1711641432888; Thu, 28 Mar 2024 08:57:12 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-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=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::232; envelope-from=philmd@linaro.org; helo=mail-lj1-x232.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1711641571130100001 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=C3=A9 --- 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; =20 /* SMBIOS compat: */ - bool smbios_legacy_mode; SmbiosEntryPointType default_smbios_ep_type; =20 /* 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); } =20 +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 =3D MACHINE(pcms); - PCMachineClass *pcmc =3D PC_MACHINE_GET_CLASS(pcms); MachineClass *mc =3D MACHINE_GET_CLASS(pcms); X86CPU *cpu =3D X86_CPU(ms->possible_cpus->cpus[0].cpu); =20 @@ -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]= ); =20 - if (pcmc->smbios_legacy_mode) { + if (smbios_legacy_mode(pcms)) { smbios_tables =3D 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 =3D PC_MACHINE_CLASS(m); m->desc =3D "ISA-only PC"; m->max_cpus =3D 1; m->option_rom_has_mr =3D true; m->rom_file_has_mr =3D false; - pcmc->smbios_legacy_mode =3D true; m->default_nic =3D "ne2k_isa"; m->default_cpu_type =3D X86_CPU_TYPE_NAME("486"); m->no_parallel =3D !module_object_class_by_name(TYPE_ISA_PARALLEL); --=20 2.41.0 From nobody Sat May 18 06:50:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1711641529; cv=none; d=zohomail.com; s=zohoarc; b=J8rU0TR7tuKZE/5Rfg+p7yi9ZfdQMUUKe29fzhF1fkUUQP3VReetskOXYiN81xH5UyedL025kRPQ0DlXOAtWlh9BnD8AOTCY7uWNOgrgfDwwAWBH8awwOJym7E3kc+U7aTLFFJPKIaew+jcmwW6ladxnut5BN8Ri4casCbOfFhE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1711641529; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=KZcClnRjP7+/0e8fY+P9N5bd75aoGZ6efgZZhKhlNAY=; b=HfLDI+7KIS67Mg5YBteEcxrohHG2EYPJX7c/14ZI+Q1lny7FPCbIHsYEaQNKBT3dl936MIF2CB/AzKtbywFv+las5thYttezCPSepo9CMuJHFUqSfdXBSt98VvoCGPRXKYbPTkFzTG+9PATSLE2D7RGdyMdZMSPW8ZrLTKnHKZA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1711641529926675.8912727941912; Thu, 28 Mar 2024 08:58:49 -0700 (PDT) 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 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-Outflank-Mailman: Message body and most headers restored to incoming version 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=20Mathieu-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=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1711641530709100003 smbios_defaults() and smbios_legacy_mode() are logical opposite. Simplify using the latter. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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) } =20 #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 =3D MACHINE_GET_CLASS(pcms); X86CPU *cpu =3D X86_CPU(ms->possible_cpus->cpus[0].cpu); =20 - 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); } --=20 2.41.0 From nobody Sat May 18 06:50:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1711641695; cv=none; d=zohomail.com; s=zohoarc; b=ReauuhSjo5aD9OHiA8l67wPa1cpyhXX66EqzeJ+7G1n/l8HMZNEr1PO6MwQE8vLPHdTtnKChZ6eZB8MX+fqLy7K6kS4e6yMh22+syrUcdflSqDBrBrvREzq3OnF3YuhM5AxvU1YU2xlnspyo8/I8lu76SrxSMp+yK1ILpcBb/mI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1711641695; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=9JGjTd1WToEahvAfY8NVbIAQ8SXrGvIMBj7UnII/d+c=; b=Z1X0vkuCVFRpYoGWo6xdXgrrYzg0Tcg7WUUY4/XskVeUlWYkPnjCqYP6HeOET3fafWs9SxD9fV4joIn9yuyoX2Yi/NFP5B4O49qylXOThDOlmuBuvseVvyolRfamDs80F9PSCQhmcUPdyAORe9yf1PsWXLOKJq/iV1ygFRDII4U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1711641695266463.0073264008523; Thu, 28 Mar 2024 09:01:35 -0700 (PDT) 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 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-Outflank-Mailman: Message body and most headers restored to incoming version 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=20Mathieu-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=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1711641696042100001 Factor fw_cfg_build_smbios_legacy() out of fw_cfg_build_smbios(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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); } =20 +void fw_cfg_build_smbios_legacy(PCMachineState *pcms, FWCfgState *fw_cfg) +{ + uint8_t *smbios_tables; + size_t smbios_tables_len; + MachineState *ms =3D MACHINE(pcms); + X86CPU *cpu =3D 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 =3D 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, FWCfgSta= te *fw_cfg, MachineClass *mc =3D MACHINE_GET_CLASS(pcms); X86CPU *cpu =3D X86_CPU(ms->possible_cpus->cpus[0].cpu); =20 - 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; } =20 + /* 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]= ); =20 - if (smbios_legacy_mode(pcms)) { - smbios_tables =3D 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 =3D g_malloc0(sizeof(*mem_array) * e820_get_num_entries()); for (i =3D 0, array_count =3D 0; i < e820_get_num_entries(); i++) { --=20 2.41.0 From nobody Sat May 18 06:50:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1711641588; cv=none; d=zohomail.com; s=zohoarc; b=cQH0f0CgJpgteT5v204BLmcAnqiDqOo4PiG1VKjAuFMC36HT+m8RHbNCsXZJG0CK0hkRZ4uHHmqCQMF33vJcl/xPVm1OnVToM0zu19EQ+Z35rI21HqchwOLrcua2xiKiCZ/8anwaHd247ICLO0BCew+JkegBE9aovo10DJXzJYw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1711641588; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=OhT6+kuDArhB7vl7wmlOYwb5F71/kFsimohZE69/WJ4=; b=TW9UnF2jidL8q/egI77gpk3/EgcMvZYi/dXQndUCnxmBp92v8Xg8cjQ55rWihxCJHBilNOTy3IYr1A0GPzPXPL66+6Jmezue75UxS1cRcJ2NQlMF/KCEsT1dQGZWqjjhecsJ/auWlaDGX6FAr70Uq9pZXAyZ+iyiIsLki9+6vK8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1711641588407831.1570017242843; Thu, 28 Mar 2024 08:59:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps8H-00019r-0F; Thu, 28 Mar 2024 11:57:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rps8E-00011d-TP for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:57:35 -0400 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps8D-0002mw-A7 for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:57:34 -0400 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-a47385a4379so400471666b.0 for ; Thu, 28 Mar 2024 08:57:32 -0700 (PDT) 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641451; x=1712246251; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OhT6+kuDArhB7vl7wmlOYwb5F71/kFsimohZE69/WJ4=; b=wPfi4xDZ+OZFr0EK/9vhFd4a6Bhqsc0O6HVjX/5tm+KZQFDfb8HqSLFpGWpfcSiTGX eoQZQFMUonQ7Kpd6AAtKo4zHR9uJTIu0GpJXDKTmBvyX3+0Nx+qklnGkoQntyIJCEUbj 1Wdb21INEXISlrRDVMC8Kxr7dvgqV2mr6/Op3SIF0sIs8SLo9Lp01Y92zkoYi7dSd/Li ptxzP7KyVmegtwYntW7/o8jvB2JTOt46TZ8A8qfOkGPuxAF/oxd+FwJKdt0M0l28MWpq ldmXtv/0QRociJA7vO+gnBaq9l86GD+95aXa6KceEA2CrxsVIh5lIYzNNlhRNhxsPSPc zIEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641451; x=1712246251; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OhT6+kuDArhB7vl7wmlOYwb5F71/kFsimohZE69/WJ4=; b=lpNbOPh9/LQB++w3aVUA9aF2wIB9ybXfcj8ItCiPvK/rWY61gPRnan6R/BAPhx6lKJ 3hq76PAoQIGSXkwJQhbDjEWTozV5HAp51X3AlsFI9I++UTVVbWDWN2o55JhKFF/fvJIw 8BBYbslXA7Wl8aYwoCv9KiupHdrLQn/b8zYaRWhuor+uyeZcTTfpgt4bEv8A3GFxHxqN g+1IeNGQJaRm446PPifLNh7E/Xr+zyUQnzdgbpclvg4FTz2SkObQdwFgXeyIb0ft7xtb VobCNZSPWGTHjC7S3Nolk+/bC+mZ0xmMl6UB4i64RcZfSt5OFlxHjAwNOACx/yO5KWGl YKbg== X-Gm-Message-State: AOJu0YzBsZpiKngVj3I9Iy7SGEb4iU4E1bUc2a3KZ2YaTa6XL6YdplNf +wRcjRrCxrS389L6jiAjkxv0R/uRx3BLwKiWM6yn1/ojZEAzhN20qOBcQzIwNhBBwRWMOkmy5a4 u X-Google-Smtp-Source: AGHT+IE5iPw2wKGziuJIAfhXkqj1URHuVnsVTHRuhgnnHINXGtkc2NpEDzBwrK/9AluQ+8R3bvD5jA== X-Received: by 2002:a17:906:48d7:b0:a45:ab98:aec with SMTP id d23-20020a17090648d700b00a45ab980aecmr2166613ejt.10.1711641451420; Thu, 28 Mar 2024 08:57:31 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-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=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::62f; envelope-from=philmd@linaro.org; helo=mail-ej1-x62f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1711641589194100007 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=C3=A9 --- 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) } =20 #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, FWCfgStat= e *fw_cfg, MachineClass *mc =3D MACHINE_GET_CLASS(pcms); X86CPU *cpu =3D X86_CPU(ms->possible_cpus->cpus[0].cpu); =20 - 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); =20 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) } } =20 +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); =20 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); --=20 2.41.0 From nobody Sat May 18 06:50:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1711641674; cv=none; d=zohomail.com; s=zohoarc; b=ip/1qgyVUV+T/aTYMfehupaLTmu8RTS/Nchgv+GASyNriQRb1B4TugXfCu9UbYi40Xhn70g2Amj/JS7uz2kAYGTSP5VJgChVOV3QxsclDFPfwSmDQ+OlmS7dEZRL31VOe02LSvuCcuCcMYP/IdQ5VvAKfa2evRyBvDMbzRmGyWg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1711641674; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=WrzkMtkcnF1yss3niHYQFeUj6lW7JvFYG513ZWQp60s=; b=oJg8ccJgNxdcz8NdI3I6T4p/wP0LOMNT3WIfhxVerX58DHS8Xe0xkJooSuAfnKeNom3uPa8j8nVg+G/cw1vwNEd4iNEuogGGww4j12OCoXKkegSgIf4cBNPSon0q1Be28C6+EQTP7PJs8hkr9omDtbEPda6voScLAfrrWWc9jkc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1711641674695737.1985219728855; Thu, 28 Mar 2024 09:01:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps8X-0001ei-70; Thu, 28 Mar 2024 11:57:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rps8L-0001KC-Ir for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:57:43 -0400 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps8J-0002ny-Rx for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:57:41 -0400 Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-56be32b9775so1376425a12.1 for ; Thu, 28 Mar 2024 08:57:39 -0700 (PDT) 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641458; x=1712246258; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WrzkMtkcnF1yss3niHYQFeUj6lW7JvFYG513ZWQp60s=; b=uIgXU92Ol/NISoRgpNbzf/PzWEwBgS3/kVomi69bd5HXFLehCuA3Afao1WjECHViPF Cnkfnb7ihYF9IrUjgsom4QAbZxpwDE6CqMYds/+sDDnM1oEzgt5F6dLuZcHvz3erkJJS wG8zE10FrhUGKDIDtxtUEVaWBrN+99eT254X8mIZV3CNuaNipG0eag5TwlTOG8JLO9k5 96DeHATjs3LvNAyutPTQ9f4YSVeRn9rQsyCEw7qM9ugyGHt9T/QljWOoyd6rvr5WilTc SSnVHVz94s9UkPsLVqd/S3f/RgFgSFg+/ph8KfZ7Eim92gOMxb6Nnr52Zht6Kerr+oaS nUtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641458; x=1712246258; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WrzkMtkcnF1yss3niHYQFeUj6lW7JvFYG513ZWQp60s=; b=vEv1yVhmlUmQd3IoS9o0NJ67fQZGBiNRMezeUOIEZyUMCLeO7FmW/Ve2jTP3UwM5RE vdI3iUS+Wg4ij5gKuOQ3Elai91FM7DIBbHcqDJbTpj0KB5iJf0l78gYbOfFBPhgNQbyq TastFBpLyJ6a4c022MMGXOv5gB9hXzw1/A97muVE2eZNn8IeUMm45BKa92UgksQSoWeR 1QP0KbUsxCeqhKTY9g/yLkcInwrNTwhAhqbnWe9Cv5r643skvuwOImafsVohtJ6RbrKt uUpcLyNJi6eFt5Iv1yBdhtLz2RbNeCXH8fzyjQ5swafje8bo8I70wprkbIwoBUeonNER J79A== X-Gm-Message-State: AOJu0Yy5QdshH5bLce00GOrE7cwClqRjIJDEbCOFLlFG4Sc0xvr4SQyE wOKirrFWtGK+CtHS8U7jlX4p11ycQ+sYl8yCqN89LiWB2B49VbgWdnCeNSbvaeE36N9S55y9boN d X-Google-Smtp-Source: AGHT+IEc3JVavZ6Yb+b8wnDqhR3/uKAR+Oeu24avwh9VyWUhM3fQrZfwqOBt+dWLPG1vVVlO5yf/BQ== X-Received: by 2002:a50:9b0b:0:b0:56b:dce0:c795 with SMTP id o11-20020a509b0b000000b0056bdce0c795mr2044180edi.4.1711641458009; Thu, 28 Mar 2024 08:57:38 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-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=20Mathieu-Daud=C3=A9?= , Aurelien Jarno , =?UTF-8?q?Herv=C3=A9=20Poussineau?= 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::534; envelope-from=philmd@linaro.org; helo=mail-ed1-x534.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1711641675834100001 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=C3=A9 --- 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); =20 void pc_i8259_create(ISABus *isa_bus, qemu_irq *i8259_irqs); =20 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) } =20 /* 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 =3D PC_MACHINE(machine); PCMachineClass *pcmc =3D 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 =20 @@ -447,7 +447,7 @@ static void pc_xen_hvm_init_pci(MachineState *machine) const char *pci_type =3D xen_igd_gfx_pt_enabled() ? TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE : TYPE_I440FX_PCI_D= EVICE; =20 - pc_init1(machine, pci_type); + pc_piix_init(machine, pci_type); } =20 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, voi= d *data) k->class_id =3D 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 =3D 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 *klas= s, void *data) dc->realize =3D i440fx_pcihost_realize; dc->fw_name =3D "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 =3D false; =20 object_class_property_add(klass, PCI_HOST_PROP_PCI_HOLE_START, "uint32= ", --=20 2.41.0 From nobody Sat May 18 06:50:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1711641585; cv=none; d=zohomail.com; s=zohoarc; b=ew1Mt6w7dcOv22ono7cwe/eWGD4WQT/tRGFSGcYGvh4PQ/dEp8OmJsjvSAG8FtHgKg07AVjiLZ1Khl1wcqb+fNPGooeq+KkI7qi+LHE2KrtHS4L6p9CxrMHI4Y0BmM+OqlXw/0SeTUvWVZAi2yoHNJc3fs2zvHRLgd3jCC6oDsk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1711641585; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=K6394pyfYpf5VBXUXIwRMOR2ZbX+o8CbfYrADQtuSgY=; b=CcFjsg6KVSgiQ8Og4GN7u0ioENvV/U0NkAmkJ+h2AnnZKhpJu0h+ea6vDg5h94Sq5ENOw03u1SU12VsoriypIxO5kDRShAguncLcVCFTvLLUL0MzCsNZTlirJyFeXmp3TxI8c9FNFvyX5RFK4/mkFgyq+TCWUWraOpOB6pNRwPg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1711641585960976.5273513208685; Thu, 28 Mar 2024 08:59:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rps8Z-0001ni-Uq; Thu, 28 Mar 2024 11:57:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rps8R-0001Wt-VC for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:57:48 -0400 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rps8Q-0002pM-3j for qemu-devel@nongnu.org; Thu, 28 Mar 2024 11:57:47 -0400 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-56bb22ff7baso1289250a12.3 for ; Thu, 28 Mar 2024 08:57:45 -0700 (PDT) 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711641464; x=1712246264; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=K6394pyfYpf5VBXUXIwRMOR2ZbX+o8CbfYrADQtuSgY=; b=jhd29j4MdfwOf113zIcv8UX2buDkfsD4w6qamHe3Z57LvS0+lYQ2reoVjpM1L6bY7x CNDLuowdOkZrj4PvzFecJvhHUL8tT4sSNKS9LFdBQLz7sARYfd45Y5FPuLiLEtVl2H59 2/B9J879qAk1mvWzYMSiJlvNm22orYnWbRWhFgTrTOQblhOA0pVU4lNaBDqkAXmJMouS aAYZIF8k7KvPwmImynj6vTvlLDAXyEIaxl/6GbhrBdE7wrgHj1leI8HDmzbpEQGOr0CJ mDNxQBxbhl6P+JCTlHPPcOWAFjmFMZGQZtB/O5NFOD+yR3wRz0D5OEE5oqiCXx3XK/Qo 6QHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641464; x=1712246264; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=K6394pyfYpf5VBXUXIwRMOR2ZbX+o8CbfYrADQtuSgY=; b=hPEL4I926jpNAMpKOGEXvA0DDuzBszvO4xp26DRxtnLBigzI9yOF7QJgk0t9xkoQZO Bnkt0VGmpT/z/JECSMkko6bKojHRFKq/M4L398+ASHOy4TP9Wh/bLGvmJu7RpvMLTEZ3 ER+WMfC8PBmOCd5tMvYNxTZSdgW6PiFuFSBUptrvI/ovrAk0C22FpUZh1+HzxtQJSVyA dCF/sz+SZdOIhd/U6/r4VOOwv1NT+hK/7AnL7r/yNTPdo8y7nXvzc/SLUV5WdaNdOpni kXTtNEPtj/OcPZQBd04PL53EgNxp8AcGh2gSAmZdeSfIgxO8A1fnbXx5yhioANa9TYtU GzCw== X-Gm-Message-State: AOJu0YzpfXJwPlwKZ7NcbqZ05wrPCpBGa5paLg8XQmRxua4nRfjbqdo4 aq9uNzFKQpyRfHxlrPH5MU3CbqBqmD7llTDHBYlVgmf5uN/zk7FdUmAFBsxaaFwMQMQk5uMKS8J y X-Google-Smtp-Source: AGHT+IHopSZ4mG4FmVwZwRyY4uEq7A+kY6caw0K60z5ZjV+GdO0roOAWBLEuOIrEv1csN4Rr2G6Jmg== X-Received: by 2002:a50:d750:0:b0:565:e610:c358 with SMTP id i16-20020a50d750000000b00565e610c358mr2278668edj.38.1711641464364; Thu, 28 Mar 2024 08:57:44 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-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=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::530; envelope-from=philmd@linaro.org; helo=mail-ed1-x530.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1711641587188100004 Extract the ISA-only PC machine code from pc_piix.c to a new file, pc_isa.c. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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 =3D "ISA-only PC"; + m->max_cpus =3D 1; + m->option_rom_has_mr =3D true; + m->rom_file_has_mr =3D false; + m->default_nic =3D "ne2k_isa"; + m->default_cpu_type =3D X86_CPU_TYPE_NAME("486"); + m->no_parallel =3D !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(). */ =20 -#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) =20 -#ifdef CONFIG_ISAPC -static void isapc_machine_options(MachineClass *m) -{ - m->desc =3D "ISA-only PC"; - m->max_cpus =3D 1; - m->option_rom_has_mr =3D true; - m->rom_file_has_mr =3D false; - m->default_nic =3D "ne2k_isa"; - m->default_cpu_type =3D X86_CPU_TYPE_NAME("486"); - m->no_parallel =3D !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-micr= ovm.c', 'microvm-dt.c')) i386_ss.add(when: 'CONFIG_Q35', if_true: files('pc_q35.c')) --=20 2.41.0