From nobody Thu Apr 25 09:42:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+96900+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+96900+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1669986623; cv=none; d=zohomail.com; s=zohoarc; b=IxTTYhXvy6kSROqGjfH11JbJvzIjTSlygpJplQabQ1avbiDv/cBr2dfsMfgvPCVsSODWBVVuHU3Ox/gy7QzRUrXcYyoINnhF2QUqSNF1ntus1zYUvqhe07LjcLLf5plzgUbetHJzruWKxwDQb8QFpmjklDrePEG/9V3wJt2c6bw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1669986623; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=+D59tRV7jFcZl8We8TM3ao0c/c32f7iV7logRBPtccw=; b=boIl7ykPKsin+y497keyxO9jf2JWhMjoHjVN1Om6EowE7ej/QmuAyRvLBnAqTz2sbIYotnYRC/MVjg+sUdBdWipNp4A8nBSv0b0Z6z73z3Slr2kWOgfFo6vwz0Q8RW/UXbaR7CoenRuecELOLXO6QFsoZzKB6ZS9LoL5U/s5TNE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+96900+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1669986623591723.8033137080603; Fri, 2 Dec 2022 05:10:23 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id cGg6YY1788612xlLVVnhrPkr; Fri, 02 Dec 2022 05:10:22 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web11.74522.1669986621956055981 for ; Fri, 02 Dec 2022 05:10:22 -0800 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-651-dsvAvju9OGyBiotD09LPog-1; Fri, 02 Dec 2022 08:10:16 -0500 X-MC-Unique: dsvAvju9OGyBiotD09LPog-1 X-Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 58B0B101A52A; Fri, 2 Dec 2022 13:10:15 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.79]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 168564EA61; Fri, 2 Dec 2022 13:10:13 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id CB95D180127E; Fri, 2 Dec 2022 14:10:09 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Bob Feng , Yuwei Chen , Erdem Aktas , Jordan Justen , Peter Grehan , Rebecca Cran , Liming Gao , Ard Biesheuvel , Gerd Hoffmann , Jiewen Yao , Min Xu , Brijesh Singh , Oliver Steffen , Pawel Polawski , Tom Lendacky , James Bottomley Subject: [edk2-devel] [PATCH 01/14] tools_def: remove GCC_IA32_CC_FLAGS/GCC_X64_CC_FLAGS Date: Fri, 2 Dec 2022 14:09:56 +0100 Message-Id: <20221202131009.3190040-2-kraxel@redhat.com> In-Reply-To: <20221202131009.3190040-1-kraxel@redhat.com> References: <20221202131009.3190040-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,kraxel@redhat.com X-Gm-Message-State: J4BSDebJo0nfdox6U9VznWq2x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1669986622; bh=2SW/57XGahFT7cyzz/HWQXwXY8VPaYZ96d4DqfmSRKA=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=k9mWn1F477ez8fJPy3XWio06+MUsd7PltnJXzaaCe57wlZAJHJC9RB4p3Lfv0W5Kmpp 5mtWX9mu9uT0htHUqnsUzRbnwl93IDai9h0FdJyrqHiUsKZLMPHVVHfFnNR/coSUz4MYV iQ0U8OwYJOUPcbAkN7sqZm4mj2228jszDyU= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1669986625265100007 Content-Type: text/plain; charset="utf-8"; x-default="true" They are not used anywhere. Remove them. Signed-off-by: Gerd Hoffmann Tested-by: Tom Lendacky --- BaseTools/Conf/tools_def.template | 2 -- 1 file changed, 2 deletions(-) diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.t= emplate index c4e4c7ded0af..73f95b2a3a9f 100755 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -1850,8 +1850,6 @@ NOOPT_*_*_OBJCOPY_ADDDEBUGFLAG =3D --add-gnu-debu= glink=3D$(DEBUG_DIR)/$(MODULE_N *_*_*_DTC_PATH =3D DEF(DTC_BIN) =20 DEFINE GCC_ALL_CC_FLAGS =3D -g -Os -fshort-wchar -fno-builtin -= fno-strict-aliasing -Wall -Werror -Wno-array-bounds -include AutoGen.h -fno= -common -DEFINE GCC_IA32_CC_FLAGS =3D DEF(GCC_ALL_CC_FLAGS) -m32 -malign-= double -freorder-blocks -freorder-blocks-and-partition -O2 -mno-stack-arg-p= robe -DEFINE GCC_X64_CC_FLAGS =3D DEF(GCC_ALL_CC_FLAGS) -mno-red-zone= -Wno-address -mno-stack-arg-probe DEFINE GCC_ARM_CC_FLAGS =3D DEF(GCC_ALL_CC_FLAGS) -mlittle-endi= an -mabi=3Daapcs -fno-short-enums -funsigned-char -ffunction-sections -fdat= a-sections -fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=3Dsoft -fn= o-pic -fno-pie DEFINE GCC_LOONGARCH64_CC_FLAGS =3D DEF(GCC_ALL_CC_FLAGS) -mabi=3Dlp64d= -fno-asynchronous-unwind-tables -fno-plt -Wno-address -fno-short-enums -fs= igned-char -ffunction-sections -fdata-sections DEFINE GCC_ARM_CC_XIPFLAGS =3D -mno-unaligned-access --=20 2.38.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#96900): https://edk2.groups.io/g/devel/message/96900 Mute This Topic: https://groups.io/mt/95405204/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Apr 25 09:42:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+96902+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+96902+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1669986627; cv=none; d=zohomail.com; s=zohoarc; b=kZWgKqrLcs1u1rlUXXSN2yMOacTKUnpzT73wbF2rSnrvgKP+u2W+XhnE34je3RAFlBL5Gw0TV2FPasnBWM0ZROcJLYNBlxN/YFRMAB2zgYl7lB6H9/1DyGHgBzidSdrRl84nmJqc8Lxrob6lmMunHdXkPQE01AlGMzAvhchJ3pg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1669986627; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=dhSF3Q8V0N/itvWYZRZmyyoTILz+CMEoiLf0dsKdZi8=; b=WUluwlJeq9MLc8/10RGvowocW1kzKwfBwvzr+2DuJksreWhGi1yfsdI7BeTsSJUzENOvTeINblTl0c7thmpsoqpQ6RwN/2OgadpGqjMMjY+w7YVFTsrczg4u+yef/9nUF3Zw6aHe0SUEa0702imL5jj+9K4+ljCkR1zSuW4akCI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+96902+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1669986627447113.64549589275998; Fri, 2 Dec 2022 05:10:27 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id QGspYY1788612xeSzTyEQZxm; Fri, 02 Dec 2022 05:10:27 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web11.74525.1669986626187063438 for ; Fri, 02 Dec 2022 05:10:26 -0800 X-Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-183-Xho4nYomOZe0oDbB54yqrQ-1; Fri, 02 Dec 2022 08:10:21 -0500 X-MC-Unique: Xho4nYomOZe0oDbB54yqrQ-1 X-Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 68EB23801F57; Fri, 2 Dec 2022 13:10:20 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.79]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 93F8EC15BB4; Fri, 2 Dec 2022 13:10:18 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id D1598180127F; Fri, 2 Dec 2022 14:10:09 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Bob Feng , Yuwei Chen , Erdem Aktas , Jordan Justen , Peter Grehan , Rebecca Cran , Liming Gao , Ard Biesheuvel , Gerd Hoffmann , Jiewen Yao , Min Xu , Brijesh Singh , Oliver Steffen , Pawel Polawski , Tom Lendacky , James Bottomley Subject: [edk2-devel] [PATCH 02/14] tools_def: add -fno-omit-frame-pointer to GCC48_{IA32,X64}_CC_FLAGS Date: Fri, 2 Dec 2022 14:09:57 +0100 Message-Id: <20221202131009.3190040-3-kraxel@redhat.com> In-Reply-To: <20221202131009.3190040-1-kraxel@redhat.com> References: <20221202131009.3190040-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,kraxel@redhat.com X-Gm-Message-State: SSWtUWua5Hc0Fi6lOM2sk2UEx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1669986627; bh=rYXVrZ78lfgSAVdJqib+ijTt3nal6SpxGXom2PHmk5k=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=g2oxn3uX3w/YdhXC6XZH1esITH0ZqzFVkPbeHs27OjN1nEytaow00Ghub9kwrb0h8oz ZpERQG2AQ63qMhBnRpSewIttoyncv02jM6KMeQxti8yh4/nMv/spYlMn4726Bkahv5w/D xIZzaSxhVl91gljx2PDmK4tKwhFh3fId9mM= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1669986629341100017 Content-Type: text/plain; charset="utf-8"; x-default="true" Fixes problems due to code assuming it runs with frame pointers and thus updates rbp / ebp registers when switching stacks. Signed-off-by: Gerd Hoffmann Tested-by: Tom Lendacky --- BaseTools/Conf/tools_def.template | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.t= emplate index 73f95b2a3a9f..f1fd6a003062 100755 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -1888,8 +1888,8 @@ DEFINE GCC_DEPS_FLAGS =3D -MMD -MF $@.de= ps =20 DEFINE GCC48_ALL_CC_FLAGS =3D DEF(GCC_ALL_CC_FLAGS) -ffunction-= sections -fdata-sections -DSTRING_ARRAY_NAME=3D$(BASE_NAME)Strings DEFINE GCC48_IA32_X64_DLINK_COMMON =3D -nostdlib -Wl,-n,-q,--gc-sections= -z common-page-size=3D0x20 -DEFINE GCC48_IA32_CC_FLAGS =3D DEF(GCC48_ALL_CC_FLAGS) -m32 -mar= ch=3Di586 -malign-double -fno-stack-protector -D EFI32 -fno-asynchronous-un= wind-tables -Wno-address -DEFINE GCC48_X64_CC_FLAGS =3D DEF(GCC48_ALL_CC_FLAGS) -m64 -fno= -stack-protector "-DEFIAPI=3D__attribute__((ms_abi))" -maccumulate-outgoing= -args -mno-red-zone -Wno-address -mcmodel=3Dsmall -fpie -fno-asynchronous-u= nwind-tables -Wno-address +DEFINE GCC48_IA32_CC_FLAGS =3D DEF(GCC48_ALL_CC_FLAGS) -m32 -mar= ch=3Di586 -malign-double -fno-stack-protector -D EFI32 -fno-asynchronous-un= wind-tables -Wno-address -fno-omit-frame-pointer +DEFINE GCC48_X64_CC_FLAGS =3D DEF(GCC48_ALL_CC_FLAGS) -m64 -fno= -stack-protector "-DEFIAPI=3D__attribute__((ms_abi))" -maccumulate-outgoing= -args -mno-red-zone -Wno-address -mcmodel=3Dsmall -fpie -fno-asynchronous-u= nwind-tables -Wno-address -fno-omit-frame-pointer DEFINE GCC48_IA32_X64_ASLDLINK_FLAGS =3D DEF(GCC48_IA32_X64_DLINK_COMMON) = -Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable DEFINE GCC48_IA32_X64_DLINK_FLAGS =3D DEF(GCC48_IA32_X64_DLINK_COMMON) = -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Wl,-Map,$(DEST_DI= R_DEBUG)/$(BASE_NAME).map,--whole-archive DEFINE GCC48_IA32_DLINK2_FLAGS =3D -Wl,--defsym=3DPECOFF_HEADER_SIZE= =3D0x220 DEF(GCC_DLINK2_FLAGS_COMMON) --=20 2.38.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#96902): https://edk2.groups.io/g/devel/message/96902 Mute This Topic: https://groups.io/mt/95405207/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Apr 25 09:42:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+96901+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+96901+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1669986625; cv=none; d=zohomail.com; s=zohoarc; b=IwvVOGdPyoVnQElTbRBOnSc3VpGD070SozGQyEBSrbsFEXV74zogh6gggtFQLC0kgWxF8td9CA3d9DZMr4cXdPJacPmTmsuHizWug6mVBTEcn8rYMq7RlSy2n4E2jToZ55OBNYJH42OR3ByXTXXhvyWYMzLmlTo6oj9S+kF7XQc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1669986625; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=BJZzwWxqa7kjLyWQMWWQlLeVyujTSGsYWHMNBm2H2Cw=; b=MiziYQmcUeQlC6VQuWRqkBdqySLw1r1TI9kMrX+UzujEUu6ATesfZWvfu5Xf6loQuNZgcQRmuAZSzeLswspWIxnvm4UHxHINRufb4tjcdIG8YpRyTN58G0l94IJLelaDzqsM/+Fzxs2/+/DRq+YEIjfvlyoKhxpOOBLaD+1t2IA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+96901+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1669986625850709.2474661654581; Fri, 2 Dec 2022 05:10:25 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id bVPVYY1788612x7EWiqZWIaG; Fri, 02 Dec 2022 05:10:24 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web10.74421.1669986624329922040 for ; Fri, 02 Dec 2022 05:10:24 -0800 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-659-jk8YOv6AOF2Vm1pJEgtOVg-1; Fri, 02 Dec 2022 08:10:19 -0500 X-MC-Unique: jk8YOv6AOF2Vm1pJEgtOVg-1 X-Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CE34A811E81; Fri, 2 Dec 2022 13:10:18 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.79]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 919BB200D8D4; Fri, 2 Dec 2022 13:10:18 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id D5B3B1801543; Fri, 2 Dec 2022 14:10:09 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Bob Feng , Yuwei Chen , Erdem Aktas , Jordan Justen , Peter Grehan , Rebecca Cran , Liming Gao , Ard Biesheuvel , Gerd Hoffmann , Jiewen Yao , Min Xu , Brijesh Singh , Oliver Steffen , Pawel Polawski , Tom Lendacky , James Bottomley Subject: [edk2-devel] [PATCH 03/14] OvmfPkg/PlatformPei: AmdSev: stop using mPlatformInfoHob Date: Fri, 2 Dec 2022 14:09:58 +0100 Message-Id: <20221202131009.3190040-4-kraxel@redhat.com> In-Reply-To: <20221202131009.3190040-1-kraxel@redhat.com> References: <20221202131009.3190040-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,kraxel@redhat.com X-Gm-Message-State: 2DHECwWAbz03M108x2F6KEBfx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1669986624; bh=p0pgghFyFtU983JbjeTBlBl9avrXZlqct6mQpgJQwok=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=cu1MkyN2xkRyS8vFLZTT/4C5kYYcQM4IeNgb/0MMdCa4RDlrO0vddkMaWIC6dzXTki1 MRvKN/GfjSed0H50bK67ksOjCKNYmm2WrZs/NG/BmuDqLg5saI9FyzpqSyQcodBjhs8W/ yJkCvRumN3Tayum+a+EqglJxZLPwdrF56j4= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1669986627334100011 Content-Type: text/plain; charset="utf-8"; x-default="true" Stop using the mPlatformInfoHob global variable in AmdSevInitialize() and AmdSevEsInitialize() functions. Pass a pointer to the PlatformInfoHob instead. Signed-off-by: Gerd Hoffmann Tested-by: Tom Lendacky --- OvmfPkg/PlatformPei/Platform.h | 2 +- OvmfPkg/PlatformPei/AmdSev.c | 14 +++++++------- OvmfPkg/PlatformPei/Platform.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/OvmfPkg/PlatformPei/Platform.h b/OvmfPkg/PlatformPei/Platform.h index 29b51b2debd8..f245025fb46f 100644 --- a/OvmfPkg/PlatformPei/Platform.h +++ b/OvmfPkg/PlatformPei/Platform.h @@ -82,7 +82,7 @@ InstallClearCacheCallback ( =20 VOID AmdSevInitialize ( - VOID + IN EFI_HOB_PLATFORM_INFO *PlatformInfoHob ); =20 /** diff --git a/OvmfPkg/PlatformPei/AmdSev.c b/OvmfPkg/PlatformPei/AmdSev.c index e1b9fd9b7f68..c23fae7fcae0 100644 --- a/OvmfPkg/PlatformPei/AmdSev.c +++ b/OvmfPkg/PlatformPei/AmdSev.c @@ -201,7 +201,7 @@ GhcbRegister ( STATIC VOID AmdSevEsInitialize ( - VOID + IN EFI_HOB_PLATFORM_INFO *PlatformInfoHob ) { UINT8 *GhcbBase; @@ -228,7 +228,7 @@ AmdSevEsInitialize ( // Since the pages must survive across the UEFI to OS transition // make them reserved. // - GhcbPageCount =3D mPlatformInfoHob.PcdCpuMaxLogicalProcessorNumber * 2; + GhcbPageCount =3D PlatformInfoHob->PcdCpuMaxLogicalProcessorNumber * 2; GhcbBase =3D AllocateReservedPages (GhcbPageCount); ASSERT (GhcbBase !=3D NULL); =20 @@ -266,7 +266,7 @@ AmdSevEsInitialize ( // Allocate #VC recursion backup pages. The number of backup pages neede= d is // one less than the maximum VC count. // - GhcbBackupPageCount =3D mPlatformInfoHob.PcdCpuMaxLogicalProcessorNumber= * (VMGEXIT_MAXIMUM_VC_COUNT - 1); + GhcbBackupPageCount =3D PlatformInfoHob->PcdCpuMaxLogicalProcessorNumber= * (VMGEXIT_MAXIMUM_VC_COUNT - 1); GhcbBackupBase =3D AllocatePages (GhcbBackupPageCount); ASSERT (GhcbBackupBase !=3D NULL); =20 @@ -320,7 +320,7 @@ AmdSevEsInitialize ( **/ VOID AmdSevInitialize ( - VOID + IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob ) { UINT64 EncryptionMask; @@ -367,7 +367,7 @@ AmdSevInitialize ( // until after re-encryption, in order to prevent an information leak to= the // hypervisor. // - if (mPlatformInfoHob.SmmSmramRequire && (mPlatformInfoHob.BootMode !=3D = BOOT_ON_S3_RESUME)) { + if (PlatformInfoHob->SmmSmramRequire && (PlatformInfoHob->BootMode !=3D = BOOT_ON_S3_RESUME)) { RETURN_STATUS LocateMapStatus; UINTN MapPagesBase; UINTN MapPagesCount; @@ -378,7 +378,7 @@ AmdSevInitialize ( ); ASSERT_RETURN_ERROR (LocateMapStatus); =20 - if (mPlatformInfoHob.Q35SmramAtDefaultSmbase) { + if (PlatformInfoHob->Q35SmramAtDefaultSmbase) { // // The initial SMRAM Save State Map has been covered as part of a la= rger // reserved memory allocation in InitializeRamRegions(). @@ -400,7 +400,7 @@ AmdSevInitialize ( // // Check and perform SEV-ES initialization if required. // - AmdSevEsInitialize (); + AmdSevEsInitialize (PlatformInfoHob); =20 // // Set the Confidential computing attr PCD to communicate which SEV diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c index b1f8140d6041..f2c1e2b213cb 100644 --- a/OvmfPkg/PlatformPei/Platform.c +++ b/OvmfPkg/PlatformPei/Platform.c @@ -379,7 +379,7 @@ InitializePlatform ( } =20 InstallClearCacheCallback (); - AmdSevInitialize (); + AmdSevInitialize (&mPlatformInfoHob); if (mPlatformInfoHob.HostBridgeDevId =3D=3D 0xffff) { MiscInitializationForMicrovm (&mPlatformInfoHob); } else { --=20 2.38.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#96901): https://edk2.groups.io/g/devel/message/96901 Mute This Topic: https://groups.io/mt/95405205/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Apr 25 09:42:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+96903+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+96903+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1669986627; cv=none; d=zohomail.com; s=zohoarc; b=Rntauuzpoo+MjQTJDsxAIgkVCXpSfO1HU/RxXG7EhX6kdRii1jE8RQCkkyARvMB8rxFip9uWXD560W/xUuW7iRcWasOt3GmIamshzFRl6cnAvzL+Mk2jbcdDFCO2RaEkocyTVOrw6jRJoOhdPWSO66m2B5FsGGr79xCasEgidcw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1669986627; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=egCtXs5q5n5bb5pU3K/ersd3+PCrW1ofmAkqyLUPJGo=; b=DRJnjB7E+CmRRloI0B5zdkkMcZS0r8mtq95njT2RZ6QnG2+1gXKr3Om51mD0nyQDfkFM2Yhr7BPpmu7p7EMFelOkWJZ9QrnO9Velp/Leoheo07pmTB5uESo18aFX//s2CYpuNhG3pInhiYvueAigDRqVBDfzVkZdaAsUpa5tUqI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+96903+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1669986627058334.93753155181764; Fri, 2 Dec 2022 05:10:27 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id GkAdYY1788612xi8n52Xdni1; Fri, 02 Dec 2022 05:10:26 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web10.74422.1669986626185334527 for ; Fri, 02 Dec 2022 05:10:26 -0800 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-260-36MYzbvkOH-2fM8Dz5yonw-1; Fri, 02 Dec 2022 08:10:24 -0500 X-MC-Unique: 36MYzbvkOH-2fM8Dz5yonw-1 X-Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 38F07185A7A9; Fri, 2 Dec 2022 13:10:22 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.79]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EA4541402BDC; Fri, 2 Dec 2022 13:10:21 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id D965D1801544; Fri, 2 Dec 2022 14:10:09 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Bob Feng , Yuwei Chen , Erdem Aktas , Jordan Justen , Peter Grehan , Rebecca Cran , Liming Gao , Ard Biesheuvel , Gerd Hoffmann , Jiewen Yao , Min Xu , Brijesh Singh , Oliver Steffen , Pawel Polawski , Tom Lendacky , James Bottomley Subject: [edk2-devel] [PATCH 04/14] OvmfPkg/PlatformPei: PeiFv: stop using mPlatformInfoHob Date: Fri, 2 Dec 2022 14:09:59 +0100 Message-Id: <20221202131009.3190040-5-kraxel@redhat.com> In-Reply-To: <20221202131009.3190040-1-kraxel@redhat.com> References: <20221202131009.3190040-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,kraxel@redhat.com X-Gm-Message-State: 7KcI7vFcfYj8soLznY3cJqqLx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1669986626; bh=I6Cq0tG/RAlRcTMEcpE6fl2oEieW7eGmNSJVamdCC1A=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=Oy5wG5lSWZX+Ucr6ueXUT4c/koxeOCUdlprDscVgs2GVYnR6X9/qkz0F3+ZNnMf9GlG lKpFMHQ8p/ghhOLz+COCLGw8H6VBaN/tAWqKDsERH9wBWbYdyNUg63sIQSEs21Rww0poi QJ+W6orXjTca5GqRCBDWpO+9ia1WNB5Vbo0= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1669986627329100009 Content-Type: text/plain; charset="utf-8"; x-default="true" Stop using the mPlatformInfoHob global variable in PeiFvInitialization() function. Pass a pointer to the PlatformInfoHob instead. Signed-off-by: Gerd Hoffmann Tested-by: Tom Lendacky --- OvmfPkg/PlatformPei/Platform.h | 2 +- OvmfPkg/PlatformPei/Fv.c | 6 +++--- OvmfPkg/PlatformPei/Platform.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/OvmfPkg/PlatformPei/Platform.h b/OvmfPkg/PlatformPei/Platform.h index f245025fb46f..b13f45ecdb69 100644 --- a/OvmfPkg/PlatformPei/Platform.h +++ b/OvmfPkg/PlatformPei/Platform.h @@ -62,7 +62,7 @@ MaxCpuCountInitialization ( =20 EFI_STATUS PeiFvInitialization ( - VOID + IN EFI_HOB_PLATFORM_INFO *PlatformInfoHob ); =20 VOID diff --git a/OvmfPkg/PlatformPei/Fv.c b/OvmfPkg/PlatformPei/Fv.c index e40c5922206b..fcf14c88faa7 100644 --- a/OvmfPkg/PlatformPei/Fv.c +++ b/OvmfPkg/PlatformPei/Fv.c @@ -22,7 +22,7 @@ **/ EFI_STATUS PeiFvInitialization ( - VOID + IN EFI_HOB_PLATFORM_INFO *PlatformInfoHob ) { BOOLEAN SecureS3Needed; @@ -37,7 +37,7 @@ PeiFvInitialization ( BuildMemoryAllocationHob ( PcdGet32 (PcdOvmfPeiMemFvBase), PcdGet32 (PcdOvmfPeiMemFvSize), - mPlatformInfoHob.S3Supported ? EfiACPIMemoryNVS : EfiBootServicesData + PlatformInfoHob->S3Supported ? EfiACPIMemoryNVS : EfiBootServicesData ); =20 // @@ -45,7 +45,7 @@ PeiFvInitialization ( // BuildFvHob (PcdGet32 (PcdOvmfDxeMemFvBase), PcdGet32 (PcdOvmfDxeMemFvSiz= e)); =20 - SecureS3Needed =3D mPlatformInfoHob.S3Supported && mPlatformInfoHob.SmmS= mramRequire; + SecureS3Needed =3D PlatformInfoHob->S3Supported && PlatformInfoHob->SmmS= mramRequire; =20 // // Create a memory allocation HOB for the DXE FV. diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c index f2c1e2b213cb..9646a1fa63b0 100644 --- a/OvmfPkg/PlatformPei/Platform.c +++ b/OvmfPkg/PlatformPei/Platform.c @@ -372,7 +372,7 @@ InitializePlatform ( ReserveEmuVariableNvStore (); } =20 - PeiFvInitialization (); + PeiFvInitialization (&mPlatformInfoHob); MemTypeInfoInitialization (); MemMapInitialization (&mPlatformInfoHob); NoexecDxeInitialization (); --=20 2.38.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#96903): https://edk2.groups.io/g/devel/message/96903 Mute This Topic: https://groups.io/mt/95405208/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Apr 25 09:42:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+96905+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+96905+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1669986632; cv=none; d=zohomail.com; s=zohoarc; b=NkYkwe/Sdalpdr8CfOwS+bRtyP94LEGeM77A7DO6+yV+7GS9hpp/kisnRfdMwm48xeY7Q4xxh6WR4aL/np3nXQ8CamvkFs+E6A25KxM4jj5i5VskgHA0t3/rR2XMd3cEc7hvTTIF/nTkB8h5ydiY8Xj2lxRbJUlXXIS9JwlYqZ4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1669986632; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=Rc3jMiAcXemVlb6DSfzPylPMmo01GY1XqQd0kBWOwT4=; b=D089GFX+7Rq+llWF5nmun+RiY+Xao/cGScLWl6bEbkKXwMZYmL7ryX7KNRNOiOXjGH8zfPc4ZyxbiJYQlY5i51BMxj5y+ULRd+SdC6P6AZlxF4dFCsXecq4w6lnQHVgz5FRE/ZigKxOFSazYyozHYDpBAkScmWgmbvHC5u27OY8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+96905+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1669986632680768.7954245615791; Fri, 2 Dec 2022 05:10:32 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 77NRYY1788612xFcqPW86i1G; Fri, 02 Dec 2022 05:10:32 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web11.74529.1669986631526993014 for ; Fri, 02 Dec 2022 05:10:31 -0800 X-Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-173-hdLz89A1P8yCa7fURHpeNQ-1; Fri, 02 Dec 2022 08:10:24 -0500 X-MC-Unique: hdLz89A1P8yCa7fURHpeNQ-1 X-Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 096BE2A59563; Fri, 2 Dec 2022 13:10:24 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.79]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A470D2028E96; Fri, 2 Dec 2022 13:10:23 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id DD3481801545; Fri, 2 Dec 2022 14:10:09 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Bob Feng , Yuwei Chen , Erdem Aktas , Jordan Justen , Peter Grehan , Rebecca Cran , Liming Gao , Ard Biesheuvel , Gerd Hoffmann , Jiewen Yao , Min Xu , Brijesh Singh , Oliver Steffen , Pawel Polawski , Tom Lendacky , James Bottomley Subject: [edk2-devel] [PATCH 05/14] OvmfPkg/PlatformPei Q35 SMM helpers: stop using mPlatformInfoHob Date: Fri, 2 Dec 2022 14:10:00 +0100 Message-Id: <20221202131009.3190040-6-kraxel@redhat.com> In-Reply-To: <20221202131009.3190040-1-kraxel@redhat.com> References: <20221202131009.3190040-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,kraxel@redhat.com X-Gm-Message-State: xWsqjrFsZXPTZRt1yxE3sunqx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1669986632; bh=ZPse1kyqmy/w3HH8mq6w8PWLMgd/hQVXjWPFBCrdDP4=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=vMkE+JhjoIyfpCRVlV/vN/WJlm90PyvRPUIYGkU1NPGCEEbx3pcIWW0PeFxv9BQZNFd OyE/0lWS/wnustsWaT7UUxkioP5dKxfWLI/YKYvUo4BTLphKYDqgNb/YwcaXy6+yjwUyB +pgeaMeDmDPTRJeHDg3cOyP4DJ9edprH3Wg= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1669986633352100026 Content-Type: text/plain; charset="utf-8"; x-default="true" Stop using the mPlatformInfoHob global variable in Q35TsegMbytesInitialization() and Q35SmramAtDefaultSmbaseInitialization() ) functions. Pass a pointer to the PlatformInfoHob instead. Signed-off-by: Gerd Hoffmann Tested-by: Tom Lendacky --- OvmfPkg/PlatformPei/Platform.h | 4 ++-- OvmfPkg/PlatformPei/MemDetect.c | 20 ++++++++++---------- OvmfPkg/PlatformPei/Platform.c | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/OvmfPkg/PlatformPei/Platform.h b/OvmfPkg/PlatformPei/Platform.h index b13f45ecdb69..7baa5e1d289f 100644 --- a/OvmfPkg/PlatformPei/Platform.h +++ b/OvmfPkg/PlatformPei/Platform.h @@ -22,12 +22,12 @@ AddressWidthInitialization ( =20 VOID Q35TsegMbytesInitialization ( - VOID + IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob ); =20 VOID Q35SmramAtDefaultSmbaseInitialization ( - VOID + IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob ); =20 EFI_STATUS diff --git a/OvmfPkg/PlatformPei/MemDetect.c b/OvmfPkg/PlatformPei/MemDetec= t.c index 2e47b1322990..b9207107b4d9 100644 --- a/OvmfPkg/PlatformPei/MemDetect.c +++ b/OvmfPkg/PlatformPei/MemDetect.c @@ -41,13 +41,13 @@ Module Name: =20 VOID Q35TsegMbytesInitialization ( - VOID + IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob ) { UINT16 ExtendedTsegMbytes; RETURN_STATUS PcdStatus; =20 - ASSERT (mPlatformInfoHob.HostBridgeDevId =3D=3D INTEL_Q35_MCH_DEVICE_ID); + ASSERT (PlatformInfoHob->HostBridgeDevId =3D=3D INTEL_Q35_MCH_DEVICE_ID); =20 // // Check if QEMU offers an extended TSEG. @@ -68,7 +68,7 @@ Q35TsegMbytesInitialization ( PciWrite16 (DRAMC_REGISTER_Q35 (MCH_EXT_TSEG_MB), MCH_EXT_TSEG_MB_QUERY); ExtendedTsegMbytes =3D PciRead16 (DRAMC_REGISTER_Q35 (MCH_EXT_TSEG_MB)); if (ExtendedTsegMbytes =3D=3D MCH_EXT_TSEG_MB_QUERY) { - mPlatformInfoHob.Q35TsegMbytes =3D PcdGet16 (PcdQ35TsegMbytes); + PlatformInfoHob->Q35TsegMbytes =3D PcdGet16 (PcdQ35TsegMbytes); return; } =20 @@ -80,19 +80,19 @@ Q35TsegMbytesInitialization ( )); PcdStatus =3D PcdSet16S (PcdQ35TsegMbytes, ExtendedTsegMbytes); ASSERT_RETURN_ERROR (PcdStatus); - mPlatformInfoHob.Q35TsegMbytes =3D ExtendedTsegMbytes; + PlatformInfoHob->Q35TsegMbytes =3D ExtendedTsegMbytes; } =20 VOID Q35SmramAtDefaultSmbaseInitialization ( - VOID + IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob ) { RETURN_STATUS PcdStatus; =20 - ASSERT (mPlatformInfoHob.HostBridgeDevId =3D=3D INTEL_Q35_MCH_DEVICE_ID); + ASSERT (PlatformInfoHob->HostBridgeDevId =3D=3D INTEL_Q35_MCH_DEVICE_ID); =20 - mPlatformInfoHob.Q35SmramAtDefaultSmbase =3D FALSE; + PlatformInfoHob->Q35SmramAtDefaultSmbase =3D FALSE; if (FeaturePcdGet (PcdCsmEnable)) { DEBUG (( DEBUG_INFO, @@ -106,19 +106,19 @@ Q35SmramAtDefaultSmbaseInitialization ( CtlReg =3D DRAMC_REGISTER_Q35 (MCH_DEFAULT_SMBASE_CTL); PciWrite8 (CtlReg, MCH_DEFAULT_SMBASE_QUERY); CtlRegVal =3D PciRead8 (CtlReg); - mPlatformInfoHob.Q35SmramAtDefaultSmbase =3D (BOOLEAN)(CtlRegVal =3D= =3D + PlatformInfoHob->Q35SmramAtDefaultSmbase =3D (BOOLEAN)(CtlRegVal =3D= =3D MCH_DEFAULT_SMBAS= E_IN_RAM); DEBUG (( DEBUG_INFO, "%a: SMRAM at default SMBASE %a\n", __FUNCTION__, - mPlatformInfoHob.Q35SmramAtDefaultSmbase ? "found" : "not found" + PlatformInfoHob->Q35SmramAtDefaultSmbase ? "found" : "not found" )); } =20 PcdStatus =3D PcdSetBoolS ( PcdQ35SmramAtDefaultSmbase, - mPlatformInfoHob.Q35SmramAtDefaultSmbase + PlatformInfoHob->Q35SmramAtDefaultSmbase ); ASSERT_RETURN_ERROR (PcdStatus); } diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c index 9646a1fa63b0..8b055fb451d7 100644 --- a/OvmfPkg/PlatformPei/Platform.c +++ b/OvmfPkg/PlatformPei/Platform.c @@ -357,8 +357,8 @@ InitializePlatform ( =20 if (mPlatformInfoHob.SmmSmramRequire) { Q35BoardVerification (); - Q35TsegMbytesInitialization (); - Q35SmramAtDefaultSmbaseInitialization (); + Q35TsegMbytesInitialization (&mPlatformInfoHob); + Q35SmramAtDefaultSmbaseInitialization (&mPlatformInfoHob); } =20 PublishPeiMemory (); --=20 2.38.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#96905): https://edk2.groups.io/g/devel/message/96905 Mute This Topic: https://groups.io/mt/95405210/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Apr 25 09:42:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+96904+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+96904+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1669986630; cv=none; d=zohomail.com; s=zohoarc; b=RUOmulHtw/yekoaldLMielWAZJ2d3xCLvQMWAB0b448ZPvRbTDsrsxNaq+gw8w07W0RaFssTgPQPdn7gB2z0/Vx7Lwt7ohv1WT5j8nV8LazMHGZ4cAiTFmpSZQqKKS/1VEyshWfCZePyxncyqqN15UaPD1rBFwgcDu/5ybQvbHw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1669986630; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=o8stG8zhE3N6rwbTOLAMyUqb2atK6VMpGNLRge4m4PI=; b=S45LxwjYLRUYTfq5lc3P9QYprMbHfcpCQi42d/2lb1zFErIgaALUnwUGk9dDxVqJxigN2h/ZDhIGHryk/NmAvYSM35QKWnYs36B9q+fcR/VyvjbUequIraK96f92las0Ul7PAxjne53ZB40HsZvEll5Kcjv8VN2Lm+6cAE5SSDk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+96904+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1669986630072120.74758835897262; Fri, 2 Dec 2022 05:10:30 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id VWDuYY1788612xDFhefrTpeH; Fri, 02 Dec 2022 05:10:29 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web10.74424.1669986629170058661 for ; Fri, 02 Dec 2022 05:10:29 -0800 X-Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-574-MEMAITIRNG2FogkfGc_Qvg-1; Fri, 02 Dec 2022 08:10:25 -0500 X-MC-Unique: MEMAITIRNG2FogkfGc_Qvg-1 X-Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B131E3C025CF; Fri, 2 Dec 2022 13:10:24 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.79]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4ED001402BDC; Fri, 2 Dec 2022 13:10:24 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id E13251801546; Fri, 2 Dec 2022 14:10:09 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Bob Feng , Yuwei Chen , Erdem Aktas , Jordan Justen , Peter Grehan , Rebecca Cran , Liming Gao , Ard Biesheuvel , Gerd Hoffmann , Jiewen Yao , Min Xu , Brijesh Singh , Oliver Steffen , Pawel Polawski , Tom Lendacky , James Bottomley Subject: [edk2-devel] [PATCH 06/14] OvmfPkg/PlatformPei: PeiMemory: stop using mPlatformInfoHob Date: Fri, 2 Dec 2022 14:10:01 +0100 Message-Id: <20221202131009.3190040-7-kraxel@redhat.com> In-Reply-To: <20221202131009.3190040-1-kraxel@redhat.com> References: <20221202131009.3190040-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,kraxel@redhat.com X-Gm-Message-State: lxdz0Zx00mx5qKecrbjEfgbwx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1669986629; bh=rkZlyGVPJCOR4rVUMFkM10tq575LKCdjWTGeddXaEJc=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=lSLgGCkDebCIx8hhJrvVNYnoes/P7+njMiccGnVRVgbCjdWUzJyylKb9rfbQgdg1PT9 S7jlQTS7uPg5cH7+r9KL2NlGeUqdlXPuOCwPPmOaehHQC6nps33Lp9FCy7MRF+AFNr7EC //Pw0m75NivXJFbLoU3ekPT+ac0r644PmHs= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1669986631321100021 Content-Type: text/plain; charset="utf-8"; x-default="true" Stop using the mPlatformInfoHob global variable in PublishPeiMemory() and GetPeiMemoryCap() functions. Pass a pointer to the PlatformInfoHob instead. Signed-off-by: Gerd Hoffmann Tested-by: Tom Lendacky --- OvmfPkg/PlatformPei/Platform.h | 2 +- OvmfPkg/PlatformPei/MemDetect.c | 36 ++++++++++++++++----------------- OvmfPkg/PlatformPei/Platform.c | 2 +- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/OvmfPkg/PlatformPei/Platform.h b/OvmfPkg/PlatformPei/Platform.h index 7baa5e1d289f..d0c673c5a346 100644 --- a/OvmfPkg/PlatformPei/Platform.h +++ b/OvmfPkg/PlatformPei/Platform.h @@ -32,7 +32,7 @@ Q35SmramAtDefaultSmbaseInitialization ( =20 EFI_STATUS PublishPeiMemory ( - VOID + IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob ); =20 VOID diff --git a/OvmfPkg/PlatformPei/MemDetect.c b/OvmfPkg/PlatformPei/MemDetec= t.c index b9207107b4d9..3d8375320dcb 100644 --- a/OvmfPkg/PlatformPei/MemDetect.c +++ b/OvmfPkg/PlatformPei/MemDetect.c @@ -188,7 +188,7 @@ AddressWidthInitialization ( STATIC UINT32 GetPeiMemoryCap ( - VOID + IN EFI_HOB_PLATFORM_INFO *PlatformInfoHob ) { BOOLEAN Page1GSupport; @@ -225,15 +225,15 @@ GetPeiMemoryCap ( } } =20 - if (mPlatformInfoHob.PhysMemAddressWidth <=3D 39) { + if (PlatformInfoHob->PhysMemAddressWidth <=3D 39) { Pml4Entries =3D 1; - PdpEntries =3D 1 << (mPlatformInfoHob.PhysMemAddressWidth - 30); + PdpEntries =3D 1 << (PlatformInfoHob->PhysMemAddressWidth - 30); ASSERT (PdpEntries <=3D 0x200); } else { - if (mPlatformInfoHob.PhysMemAddressWidth > 48) { + if (PlatformInfoHob->PhysMemAddressWidth > 48) { Pml4Entries =3D 0x200; } else { - Pml4Entries =3D 1 << (mPlatformInfoHob.PhysMemAddressWidth - 39); + Pml4Entries =3D 1 << (PlatformInfoHob->PhysMemAddressWidth - 39); } =20 ASSERT (Pml4Entries <=3D 0x200); @@ -260,7 +260,7 @@ GetPeiMemoryCap ( **/ EFI_STATUS PublishPeiMemory ( - VOID + IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob ) { EFI_STATUS Status; @@ -271,12 +271,12 @@ PublishPeiMemory ( UINT32 S3AcpiReservedMemoryBase; UINT32 S3AcpiReservedMemorySize; =20 - LowerMemorySize =3D PlatformGetSystemMemorySizeBelow4gb (&mPlatformInfoH= ob); - if (mPlatformInfoHob.SmmSmramRequire) { + LowerMemorySize =3D PlatformGetSystemMemorySizeBelow4gb (PlatformInfoHob= ); + if (PlatformInfoHob->SmmSmramRequire) { // // TSEG is chipped from the end of low RAM // - LowerMemorySize -=3D mPlatformInfoHob.Q35TsegMbytes * SIZE_1MB; + LowerMemorySize -=3D PlatformInfoHob->Q35TsegMbytes * SIZE_1MB; } =20 S3AcpiReservedMemoryBase =3D 0; @@ -287,27 +287,27 @@ PublishPeiMemory ( // downwards. Its size is primarily dictated by CpuMpPei. The formula be= low // is an approximation. // - if (mPlatformInfoHob.S3Supported) { + if (PlatformInfoHob->S3Supported) { S3AcpiReservedMemorySize =3D SIZE_512KB + - mPlatformInfoHob.PcdCpuMaxLogicalProcessorN= umber * + PlatformInfoHob->PcdCpuMaxLogicalProcessorN= umber * PcdGet32 (PcdCpuApStackSize); S3AcpiReservedMemoryBase =3D LowerMemorySize - S3AcpiReservedMemorySiz= e; LowerMemorySize =3D S3AcpiReservedMemoryBase; } =20 - mPlatformInfoHob.S3AcpiReservedMemoryBase =3D S3AcpiReservedMemoryBase; - mPlatformInfoHob.S3AcpiReservedMemorySize =3D S3AcpiReservedMemorySize; + PlatformInfoHob->S3AcpiReservedMemoryBase =3D S3AcpiReservedMemoryBase; + PlatformInfoHob->S3AcpiReservedMemorySize =3D S3AcpiReservedMemorySize; =20 - if (mPlatformInfoHob.BootMode =3D=3D BOOT_ON_S3_RESUME) { + if (PlatformInfoHob->BootMode =3D=3D BOOT_ON_S3_RESUME) { MemoryBase =3D S3AcpiReservedMemoryBase; MemorySize =3D S3AcpiReservedMemorySize; } else { - PeiMemoryCap =3D GetPeiMemoryCap (); + PeiMemoryCap =3D GetPeiMemoryCap (PlatformInfoHob); DEBUG (( DEBUG_INFO, "%a: PhysMemAddressWidth=3D%d PeiMemoryCap=3D%u KB\n", __FUNCTION__, - mPlatformInfoHob.PhysMemAddressWidth, + PlatformInfoHob->PhysMemAddressWidth, PeiMemoryCap >> 10 )); =20 @@ -321,7 +321,7 @@ PublishPeiMemory ( // allocation HOB, and other allocations served from the permanent PEI= RAM // shouldn't overlap with that HOB. // - MemoryBase =3D mPlatformInfoHob.S3Supported && mPlatformInfoHob.SmmSmr= amRequire ? + MemoryBase =3D PlatformInfoHob->S3Supported && PlatformInfoHob->SmmSmr= amRequire ? PcdGet32 (PcdOvmfDecompressionScratchEnd) : PcdGet32 (PcdOvmfDxeMemFvBase) + PcdGet32 (PcdOvmfDxeMemF= vSize); MemorySize =3D LowerMemorySize - MemoryBase; @@ -336,7 +336,7 @@ PublishPeiMemory ( // normal boot permanent PEI RAM. Regarding the S3 boot path, the S3 // permanent PEI RAM is located even higher. // - if (mPlatformInfoHob.SmmSmramRequire && mPlatformInfoHob.Q35SmramAtDefau= ltSmbase) { + if (PlatformInfoHob->SmmSmramRequire && PlatformInfoHob->Q35SmramAtDefau= ltSmbase) { ASSERT (SMM_DEFAULT_SMBASE + MCH_DEFAULT_SMBASE_SIZE <=3D MemoryBase); } =20 diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c index 8b055fb451d7..4cd77fd5f84f 100644 --- a/OvmfPkg/PlatformPei/Platform.c +++ b/OvmfPkg/PlatformPei/Platform.c @@ -361,7 +361,7 @@ InitializePlatform ( Q35SmramAtDefaultSmbaseInitialization (&mPlatformInfoHob); } =20 - PublishPeiMemory (); + PublishPeiMemory (&mPlatformInfoHob); =20 PlatformQemuUc32BaseInitialization (&mPlatformInfoHob); =20 --=20 2.38.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#96904): https://edk2.groups.io/g/devel/message/96904 Mute This Topic: https://groups.io/mt/95405209/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Apr 25 09:42:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+96907+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+96907+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1669986633; cv=none; d=zohomail.com; s=zohoarc; b=j4B8FhYJnkm2m6w0dxBZ0zAybJlx6/cgzxpZttRYKAKbjIxMSjEfmnvgT9azXEzOE4iAXG13A/faNAZcejD0LnBP2rg5rJKxCAdAJEmEZ9CSLu4KaQP3TYn/LJ7cTvjDgcPw9hfkRlAPsbVVV6ARLgyU5a3bW45XkXLeViiSc34= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1669986633; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=p+PrQO2Ov29mdMvGY/tBMXAjKJTFbePliEEcdAhQ/ao=; b=XXD5cmzhHtT2JMtToj37NrqkLWduv9KuQ5uXQxb9fIHRW7yjFLSqRQi/iZUV1NCEG1X22DJzmbRySRMJFVD/MotvW+wLIQ5YCfaksPQYPD569pCF0Xz7lQJrwfFt+kY9GDwVPhDzsT7YeSYHsN35e1LT4rZ5hL/UcZ6+yvxjoIk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+96907+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1669986633931734.2676403307387; Fri, 2 Dec 2022 05:10:33 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id BIqxYY1788612xqdWYF8v7Mr; Fri, 02 Dec 2022 05:10:33 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web11.74532.1669986633032770380 for ; Fri, 02 Dec 2022 05:10:33 -0800 X-Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-544-ZF6pSAIDOlC4xVlcKEl9LQ-1; Fri, 02 Dec 2022 08:10:26 -0500 X-MC-Unique: ZF6pSAIDOlC4xVlcKEl9LQ-1 X-Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5B6C738012D8; Fri, 2 Dec 2022 13:10:25 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.79]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 26FED483EFB; Fri, 2 Dec 2022 13:10:25 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id E54291801547; Fri, 2 Dec 2022 14:10:09 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Bob Feng , Yuwei Chen , Erdem Aktas , Jordan Justen , Peter Grehan , Rebecca Cran , Liming Gao , Ard Biesheuvel , Gerd Hoffmann , Jiewen Yao , Min Xu , Brijesh Singh , Oliver Steffen , Pawel Polawski , Tom Lendacky , James Bottomley Subject: [edk2-devel] [PATCH 07/14] OvmfPkg/PlatformPei: MemTypeInfo: stop using mPlatformInfoHob Date: Fri, 2 Dec 2022 14:10:02 +0100 Message-Id: <20221202131009.3190040-8-kraxel@redhat.com> In-Reply-To: <20221202131009.3190040-1-kraxel@redhat.com> References: <20221202131009.3190040-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,kraxel@redhat.com X-Gm-Message-State: FJaci7LLMnmI94UZyouw9irrx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1669986633; bh=2UatWBDFVioS5UOI+sV7yH0HBb+Darlo14NIcw7974U=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=pbLQyrG3zC3hhqxZLYw5cu6HB82u0Aot3FqWLIM71B/PI65HICjB2Ud9QrlotndPato 0c5cQmym3c89y6ijYaXkq2Tf+2Ylnh1SjZTtrpVLNuZftuZX/Wkxv8aj2PpK1G6Q2dqhP nt2rl7tU+iUwwnyNQzhEbmRam3SsOUtgmpE= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1669986635326100029 Content-Type: text/plain; charset="utf-8"; x-default="true" Stop using the mPlatformInfoHob global variable in MemTypeInfoInitializatio= n() function. Pass a pointer to the PlatformInfoHob instead. Signed-off-by: Gerd Hoffmann Tested-by: Tom Lendacky --- OvmfPkg/PlatformPei/Platform.h | 2 +- OvmfPkg/PlatformPei/MemTypeInfo.c | 4 ++-- OvmfPkg/PlatformPei/Platform.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/OvmfPkg/PlatformPei/Platform.h b/OvmfPkg/PlatformPei/Platform.h index d0c673c5a346..0c0558f0626c 100644 --- a/OvmfPkg/PlatformPei/Platform.h +++ b/OvmfPkg/PlatformPei/Platform.h @@ -67,7 +67,7 @@ PeiFvInitialization ( =20 VOID MemTypeInfoInitialization ( - VOID + IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob ); =20 VOID diff --git a/OvmfPkg/PlatformPei/MemTypeInfo.c b/OvmfPkg/PlatformPei/MemTyp= eInfo.c index c8fcf1732687..eb37febb31ae 100644 --- a/OvmfPkg/PlatformPei/MemTypeInfo.c +++ b/OvmfPkg/PlatformPei/MemTypeInfo.c @@ -203,12 +203,12 @@ STATIC CONST EFI_PEI_NOTIFY_DESCRIPTOR mReadOnlyVari= able2Notify =3D { =20 VOID MemTypeInfoInitialization ( - VOID + IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob ) { EFI_STATUS Status; =20 - if (!mPlatformInfoHob.SmmSmramRequire) { + if (!PlatformInfoHob->SmmSmramRequire) { // // EFI_PEI_READ_ONLY_VARIABLE2_PPI will never be available; install // the default memory type information HOB right away. diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c index 4cd77fd5f84f..85b47e7ed8df 100644 --- a/OvmfPkg/PlatformPei/Platform.c +++ b/OvmfPkg/PlatformPei/Platform.c @@ -373,7 +373,7 @@ InitializePlatform ( } =20 PeiFvInitialization (&mPlatformInfoHob); - MemTypeInfoInitialization (); + MemTypeInfoInitialization (&mPlatformInfoHob); MemMapInitialization (&mPlatformInfoHob); NoexecDxeInitialization (); } --=20 2.38.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#96907): https://edk2.groups.io/g/devel/message/96907 Mute This Topic: https://groups.io/mt/95405212/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Apr 25 09:42:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+96906+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+96906+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1669986639; cv=none; d=zohomail.com; s=zohoarc; b=esgr4Rs/i9Hsl1BUyy4dSLUc5iweCeGKeEEH5ti4Bd36iLsGvy3cbeTJh6hbhxb5OfMlcWnhk/8hcFrv54ZaWpbMYmF8dXgbeoe4vhLBu2uYfwtucBdK/U3JAtYHIbIaedVhlFVvSLOguoAjx+eL3qLjtAdEfhrVYF+dUeJ/qZk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1669986639; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=ORnWCbFJro8Co3UvU6wg+p3iradsVDoLxCigWlHMrYc=; b=nQ5Qq5yfR6a5ASodV3vYeAfc4cGWpEGiRHZ4+OcWtdoPLAERpcZQCzdnXvAUrLsnSVP0aMKVXEqNFaryIYG7kKmOwXrQlsKdL2G69OWSuNS2Hi3Qw0aKrvHsqAzUUNWLmW4OHh3/c0zwkVk6fWmOGFTxVEQfWh2rnMjzJ5FVyFs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+96906+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1669986639108985.4127653469578; Fri, 2 Dec 2022 05:10:39 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id HtiUYY1788612xZT41G9K0b9; Fri, 02 Dec 2022 05:10:38 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web11.74531.1669986632701566533 for ; Fri, 02 Dec 2022 05:10:32 -0800 X-Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-3-NIJEJcXbNEunhn38t5mHRQ-1; Fri, 02 Dec 2022 08:10:28 -0500 X-MC-Unique: NIJEJcXbNEunhn38t5mHRQ-1 X-Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0AE8238012CC; Fri, 2 Dec 2022 13:10:28 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.79]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CC0F31410DDA; Fri, 2 Dec 2022 13:10:27 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id E965B1801548; Fri, 2 Dec 2022 14:10:09 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Bob Feng , Yuwei Chen , Erdem Aktas , Jordan Justen , Peter Grehan , Rebecca Cran , Liming Gao , Ard Biesheuvel , Gerd Hoffmann , Jiewen Yao , Min Xu , Brijesh Singh , Oliver Steffen , Pawel Polawski , Tom Lendacky , James Bottomley Subject: [edk2-devel] [PATCH 08/14] OvmfPkg/PlatformPei: NoExec: stop using mPlatformInfoHob Date: Fri, 2 Dec 2022 14:10:03 +0100 Message-Id: <20221202131009.3190040-9-kraxel@redhat.com> In-Reply-To: <20221202131009.3190040-1-kraxel@redhat.com> References: <20221202131009.3190040-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,kraxel@redhat.com X-Gm-Message-State: EEY36RhV4EGKN3BOVNCTuW3sx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1669986638; bh=1pqrTwLAfTwL5UwtlZdFRZHJsYp49JA7OFOGUBK5hQ4=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=dANtBjuRCpgq69m3oQcU73UKBxoaBQrcjD6GVS8boK4V94Yuw8OUJ+ByH77w4f6/0M2 YCJ6JVoeijlusq3F2mlKmTTIBZNEFqrF9ye/wfILHEWFwu8Ta1j2D9CW5kOfV6CDMnUiB x6oZ/SCx1y4vt0G06jTLbvbMVsTIHbqwWMs= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1669986639388100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Stop using the mPlatformInfoHob global variable in NoexecDxeInitialization() function. Pass a pointer to the PlatformInfoHob instead. Signed-off-by: Gerd Hoffmann Tested-by: Tom Lendacky --- OvmfPkg/PlatformPei/Platform.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c index 85b47e7ed8df..7f3a26092626 100644 --- a/OvmfPkg/PlatformPei/Platform.c +++ b/OvmfPkg/PlatformPei/Platform.c @@ -75,16 +75,17 @@ MemMapInitialization ( ASSERT_RETURN_ERROR (PcdStatus); } =20 +STATIC VOID NoexecDxeInitialization ( - VOID + IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob ) { RETURN_STATUS Status; =20 - Status =3D PlatformNoexecDxeInitialization (&mPlatformInfoHob); + Status =3D PlatformNoexecDxeInitialization (PlatformInfoHob); if (!RETURN_ERROR (Status)) { - Status =3D PcdSetBoolS (PcdSetNxForStack, mPlatformInfoHob.PcdSetNxFor= Stack); + Status =3D PcdSetBoolS (PcdSetNxForStack, PlatformInfoHob->PcdSetNxFor= Stack); ASSERT_RETURN_ERROR (Status); } } @@ -375,7 +376,7 @@ InitializePlatform ( PeiFvInitialization (&mPlatformInfoHob); MemTypeInfoInitialization (&mPlatformInfoHob); MemMapInitialization (&mPlatformInfoHob); - NoexecDxeInitialization (); + NoexecDxeInitialization (&mPlatformInfoHob); } =20 InstallClearCacheCallback (); --=20 2.38.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#96906): https://edk2.groups.io/g/devel/message/96906 Mute This Topic: https://groups.io/mt/95405211/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Apr 25 09:42:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+96908+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+96908+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1669986634; cv=none; d=zohomail.com; s=zohoarc; b=JL9A1A/VCC/VPrXrBzB8iT/SJ4/AnYlAd1W5btOnr05sOdgqD7cF5Tf5H/DDITeLISduY7ghjnnhvqjkiGPqBW9bvCaYOtnc9MzocYNu5VyygJjBg1c6aDAjZdyWIHJj2DRaYu7kgXpSRypiJ/7/MlAnT/uahsUPzTG3ZRT5dP4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1669986634; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=bWstvkf5J5lqc7QJ0UlFRyM19BkgLuqEejw+XsaO+B0=; b=g/Uk2Gn4NDLPLHCjBQoTzqow2qKW66zZdTW6vXGfRRUwpMAVGp15FWoQe6Nxu2bcDjSZjFWwsyRic+3GoaC6PMs8EZ2HFf9tDGq7Po+4Gyv7VSB3UCQRGdIaKXnOg/VPx3MrdiNustCM67uSWDI6WcrpO1nyxGKyuZ0BRoH/dOM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+96908+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1669986634475413.15038903015545; Fri, 2 Dec 2022 05:10:34 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id WWLjYY1788612xvFHudo3cXM; Fri, 02 Dec 2022 05:10:34 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web11.74533.1669986633407771711 for ; Fri, 02 Dec 2022 05:10:33 -0800 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-628-L1D5Ad5DPMqmsYmt7D8YPA-1; Fri, 02 Dec 2022 08:10:29 -0500 X-MC-Unique: L1D5Ad5DPMqmsYmt7D8YPA-1 X-Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CB081101A528; Fri, 2 Dec 2022 13:10:28 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.79]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 96BF82028CE4; Fri, 2 Dec 2022 13:10:28 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id ED670180155F; Fri, 2 Dec 2022 14:10:09 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Bob Feng , Yuwei Chen , Erdem Aktas , Jordan Justen , Peter Grehan , Rebecca Cran , Liming Gao , Ard Biesheuvel , Gerd Hoffmann , Jiewen Yao , Min Xu , Brijesh Singh , Oliver Steffen , Pawel Polawski , Tom Lendacky , James Bottomley Subject: [edk2-devel] [PATCH 09/14] OvmfPkg/PlatformPei: Verification: stop using mPlatformInfoHob Date: Fri, 2 Dec 2022 14:10:04 +0100 Message-Id: <20221202131009.3190040-10-kraxel@redhat.com> In-Reply-To: <20221202131009.3190040-1-kraxel@redhat.com> References: <20221202131009.3190040-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,kraxel@redhat.com X-Gm-Message-State: fGR5hiiGLB5wRDe9rLbFZcvix1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1669986634; bh=dfFmkFww8vUbDXfxUClKLvMP0bxp1K6LkQmTmRWvQ1Q=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=o5ujjs4tBrfAmSiUjHZ5dYKSAHdZcicNMdEn0ZfARtBLpc3LzuSf+wlVOb/atu165vC H+v+37Ql0wdHQKUNIZBUyw0s+FXshpFi9Sp1eLLJXsSKQPmcqsixbPmoO9HsJQpfrw9BZ uY2FF28rcA6hmvOQoyJ13/VTHeL3iAYS8Tg= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1669986635358100033 Content-Type: text/plain; charset="utf-8"; x-default="true" Stop using the mPlatformInfoHob global variable in S3Verification() and Q35BoardVerification() functions. Pass a pointer to the PlatformInfoHob instead. Signed-off-by: Gerd Hoffmann Tested-by: Tom Lendacky --- OvmfPkg/PlatformPei/Platform.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c index 7f3a26092626..d8c4499804fb 100644 --- a/OvmfPkg/PlatformPei/Platform.c +++ b/OvmfPkg/PlatformPei/Platform.c @@ -231,13 +231,14 @@ ReserveEmuVariableNvStore ( ASSERT_RETURN_ERROR (PcdStatus); } =20 +STATIC VOID S3Verification ( - VOID + IN EFI_HOB_PLATFORM_INFO *PlatformInfoHob ) { #if defined (MDE_CPU_X64) - if (mPlatformInfoHob.SmmSmramRequire && mPlatformInfoHob.S3Supported) { + if (PlatformInfoHob->SmmSmramRequire && PlatformInfoHob->S3Supported) { DEBUG (( DEBUG_ERROR, "%a: S3Resume2Pei doesn't support X64 PEI + SMM yet.\n", @@ -260,12 +261,13 @@ S3Verification ( #endif } =20 +STATIC VOID Q35BoardVerification ( - VOID + IN EFI_HOB_PLATFORM_INFO *PlatformInfoHob ) { - if (mPlatformInfoHob.HostBridgeDevId =3D=3D INTEL_Q35_MCH_DEVICE_ID) { + if (PlatformInfoHob->HostBridgeDevId =3D=3D INTEL_Q35_MCH_DEVICE_ID) { return; } =20 @@ -274,7 +276,7 @@ Q35BoardVerification ( "%a: no TSEG (SMRAM) on host bridge DID=3D0x%04x; " "only DID=3D0x%04x (Q35) is supported\n", __FUNCTION__, - mPlatformInfoHob.HostBridgeDevId, + PlatformInfoHob->HostBridgeDevId, INTEL_Q35_MCH_DEVICE_ID )); ASSERT (FALSE); @@ -345,7 +347,7 @@ InitializePlatform ( ASSERT_EFI_ERROR (Status); } =20 - S3Verification (); + S3Verification (&mPlatformInfoHob); BootModeInitialization (&mPlatformInfoHob); =20 // @@ -357,7 +359,7 @@ InitializePlatform ( MaxCpuCountInitialization (&mPlatformInfoHob); =20 if (mPlatformInfoHob.SmmSmramRequire) { - Q35BoardVerification (); + Q35BoardVerification (&mPlatformInfoHob); Q35TsegMbytesInitialization (&mPlatformInfoHob); Q35SmramAtDefaultSmbaseInitialization (&mPlatformInfoHob); } --=20 2.38.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#96908): https://edk2.groups.io/g/devel/message/96908 Mute This Topic: https://groups.io/mt/95405213/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Apr 25 09:42:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+96910+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+96910+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1669986639; cv=none; d=zohomail.com; s=zohoarc; b=QweeXbJAWInkkUR0Pf+8/Cexslw0X+WSoX8ObHOniKFyFX+MHfwRC6qq0/bFsXPpH7vnHh0+WbFfFm3FI3Dyswt3TNzhl/TuBhhtW+g/xi5uqfbP76EiXUx2vxABmYBwkm6eNWxFVAMO6BT0Ll7BmV8g+rETWaXgn8ddshNwoYA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1669986639; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=/2jYoKYenT9wAWBOx8aIfBz/Dx3osv54mgqTX+t0oRw=; b=j7oFSAyFGzt5C9IolKBfjkTYjAFcdBNaJu7qaqpiH/tCk3P0sr0l3ryX6G0y4y+4Nb70bdUmfD5NbaGwwqrRllmcxnDNx6kMz5E1lJ3DXvwmKj4qDiEMpDt8m9UcikTezAz/hd968bR/qs6RgHAckNwAWdZ6JsZij/TkuDkHDe8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+96910+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1669986639485245.11804973681205; Fri, 2 Dec 2022 05:10:39 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 8vUcYY1788612xZt44kWzOOp; Fri, 02 Dec 2022 05:10:39 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web11.74536.1669986637972626002 for ; Fri, 02 Dec 2022 05:10:38 -0800 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-644-MsmtmOWBNRCUnmdwqvBdVA-1; Fri, 02 Dec 2022 08:10:32 -0500 X-MC-Unique: MsmtmOWBNRCUnmdwqvBdVA-1 X-Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 81146800159; Fri, 2 Dec 2022 13:10:31 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.79]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2639840C94AA; Fri, 2 Dec 2022 13:10:31 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id F15A41801560; Fri, 2 Dec 2022 14:10:09 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Bob Feng , Yuwei Chen , Erdem Aktas , Jordan Justen , Peter Grehan , Rebecca Cran , Liming Gao , Ard Biesheuvel , Gerd Hoffmann , Jiewen Yao , Min Xu , Brijesh Singh , Oliver Steffen , Pawel Polawski , Tom Lendacky , James Bottomley Subject: [edk2-devel] [PATCH 10/14] OvmfPkg/PlatformPei: remove mPlatformInfoHob Date: Fri, 2 Dec 2022 14:10:05 +0100 Message-Id: <20221202131009.3190040-11-kraxel@redhat.com> In-Reply-To: <20221202131009.3190040-1-kraxel@redhat.com> References: <20221202131009.3190040-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,kraxel@redhat.com X-Gm-Message-State: esc1X7Ltblp9x73W8eyQ9yq9x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1669986639; bh=jQnrMhn47qYi45AWJTBPpkHHB4jJX+KAJKFz7QSHlbU=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=OwQ/xVOULxrjRHl3PlC+ka87J3jEDuqJG8wAaJQvz+FuKUmrDwsSMpLChnvjv9fEiAU qCtCR4FR6SGZPfYgODF0aBcr6XFSk1lXpIolXEuFatSeDOEsoJX97yDlbE1NGOLsyL8ii wjfsEImDxTJLmfaCBHJol/vKb+vsPewGoxc= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1669986641353100005 Content-Type: text/plain; charset="utf-8"; x-default="true" Stop using the mPlatformInfoHob global variable. Let BuildPlatformInfoHob() allocate and return PlatformInfoHob instead. Signed-off-by: Gerd Hoffmann Tested-by: Tom Lendacky --- OvmfPkg/PlatformPei/Platform.h | 4 +- OvmfPkg/PlatformPei/Platform.c | 71 ++++++++++++++++++---------------- 2 files changed, 39 insertions(+), 36 deletions(-) diff --git a/OvmfPkg/PlatformPei/Platform.h b/OvmfPkg/PlatformPei/Platform.h index 0c0558f0626c..86f603ff649c 100644 --- a/OvmfPkg/PlatformPei/Platform.h +++ b/OvmfPkg/PlatformPei/Platform.h @@ -13,8 +13,6 @@ #include #include =20 -extern EFI_HOB_PLATFORM_INFO mPlatformInfoHob; - VOID AddressWidthInitialization ( IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob @@ -98,7 +96,7 @@ IntelTdxInitialize ( /** * @brief Builds PlatformInfo Hob */ -VOID +EFI_HOB_PLATFORM_INFO * BuildPlatformInfoHob ( VOID ); diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c index d8c4499804fb..ebce2ba1290e 100644 --- a/OvmfPkg/PlatformPei/Platform.c +++ b/OvmfPkg/PlatformPei/Platform.c @@ -41,8 +41,6 @@ =20 #include "Platform.h" =20 -EFI_HOB_PLATFORM_INFO mPlatformInfoHob =3D { 0 }; - EFI_PEI_PPI_DESCRIPTOR mPpiBootMode[] =3D { { EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST, @@ -305,12 +303,18 @@ MaxCpuCountInitialization ( /** * @brief Builds PlatformInfo Hob */ -VOID +EFI_HOB_PLATFORM_INFO * BuildPlatformInfoHob ( VOID ) { - BuildGuidDataHob (&gUefiOvmfPkgPlatformInfoGuid, &mPlatformInfoHob, size= of (EFI_HOB_PLATFORM_INFO)); + EFI_HOB_PLATFORM_INFO PlatformInfoHob; + EFI_HOB_GUID_TYPE *GuidHob; + + ZeroMem (&PlatformInfoHob, sizeof PlatformInfoHob); + BuildGuidDataHob (&gUefiOvmfPkgPlatformInfoGuid, &PlatformInfoHob, sizeo= f (EFI_HOB_PLATFORM_INFO)); + GuidHob =3D GetFirstGuidHob (&gUefiOvmfPkgPlatformInfoGuid); + return (EFI_HOB_PLATFORM_INFO *)GET_GUID_HOB_DATA (GuidHob); } =20 /** @@ -329,69 +333,70 @@ InitializePlatform ( IN CONST EFI_PEI_SERVICES **PeiServices ) { - EFI_STATUS Status; + EFI_HOB_PLATFORM_INFO *PlatformInfoHob; + EFI_STATUS Status; =20 DEBUG ((DEBUG_INFO, "Platform PEIM Loaded\n")); + PlatformInfoHob =3D BuildPlatformInfoHob (); =20 - mPlatformInfoHob.SmmSmramRequire =3D FeaturePcdGet (PcdSmmSmramRequi= re); - mPlatformInfoHob.SevEsIsEnabled =3D MemEncryptSevEsIsEnabled (); - mPlatformInfoHob.PcdPciMmio64Size =3D PcdGet64 (PcdPciMmio64Size); - mPlatformInfoHob.DefaultMaxCpuNumber =3D PcdGet32 (PcdCpuMaxLogicalProce= ssorNumber); + PlatformInfoHob->SmmSmramRequire =3D FeaturePcdGet (PcdSmmSmramRequi= re); + PlatformInfoHob->SevEsIsEnabled =3D MemEncryptSevEsIsEnabled (); + PlatformInfoHob->PcdPciMmio64Size =3D PcdGet64 (PcdPciMmio64Size); + PlatformInfoHob->DefaultMaxCpuNumber =3D PcdGet32 (PcdCpuMaxLogicalProce= ssorNumber); =20 PlatformDebugDumpCmos (); =20 if (QemuFwCfgS3Enabled ()) { DEBUG ((DEBUG_INFO, "S3 support was detected on QEMU\n")); - mPlatformInfoHob.S3Supported =3D TRUE; + PlatformInfoHob->S3Supported =3D TRUE; Status =3D PcdSetBoolS (PcdAcpiS3Enable, TRUE); ASSERT_EFI_ERROR (Status); } =20 - S3Verification (&mPlatformInfoHob); - BootModeInitialization (&mPlatformInfoHob); + S3Verification (PlatformInfoHob); + BootModeInitialization (PlatformInfoHob); =20 // // Query Host Bridge DID // - mPlatformInfoHob.HostBridgeDevId =3D PciRead16 (OVMF_HOSTBRIDGE_DID); - AddressWidthInitialization (&mPlatformInfoHob); + PlatformInfoHob->HostBridgeDevId =3D PciRead16 (OVMF_HOSTBRIDGE_DID); + AddressWidthInitialization (PlatformInfoHob); =20 - MaxCpuCountInitialization (&mPlatformInfoHob); + MaxCpuCountInitialization (PlatformInfoHob); =20 - if (mPlatformInfoHob.SmmSmramRequire) { - Q35BoardVerification (&mPlatformInfoHob); - Q35TsegMbytesInitialization (&mPlatformInfoHob); - Q35SmramAtDefaultSmbaseInitialization (&mPlatformInfoHob); + if (PlatformInfoHob->SmmSmramRequire) { + Q35BoardVerification (PlatformInfoHob); + Q35TsegMbytesInitialization (PlatformInfoHob); + Q35SmramAtDefaultSmbaseInitialization (PlatformInfoHob); } =20 - PublishPeiMemory (&mPlatformInfoHob); + PublishPeiMemory (PlatformInfoHob); =20 - PlatformQemuUc32BaseInitialization (&mPlatformInfoHob); + PlatformQemuUc32BaseInitialization (PlatformInfoHob); =20 - InitializeRamRegions (&mPlatformInfoHob); + InitializeRamRegions (PlatformInfoHob); =20 - if (mPlatformInfoHob.BootMode !=3D BOOT_ON_S3_RESUME) { - if (!mPlatformInfoHob.SmmSmramRequire) { + if (PlatformInfoHob->BootMode !=3D BOOT_ON_S3_RESUME) { + if (!PlatformInfoHob->SmmSmramRequire) { ReserveEmuVariableNvStore (); } =20 - PeiFvInitialization (&mPlatformInfoHob); - MemTypeInfoInitialization (&mPlatformInfoHob); - MemMapInitialization (&mPlatformInfoHob); - NoexecDxeInitialization (&mPlatformInfoHob); + PeiFvInitialization (PlatformInfoHob); + MemTypeInfoInitialization (PlatformInfoHob); + MemMapInitialization (PlatformInfoHob); + NoexecDxeInitialization (PlatformInfoHob); } =20 InstallClearCacheCallback (); - AmdSevInitialize (&mPlatformInfoHob); - if (mPlatformInfoHob.HostBridgeDevId =3D=3D 0xffff) { - MiscInitializationForMicrovm (&mPlatformInfoHob); + AmdSevInitialize (PlatformInfoHob); + if (PlatformInfoHob->HostBridgeDevId =3D=3D 0xffff) { + MiscInitializationForMicrovm (PlatformInfoHob); } else { - MiscInitialization (&mPlatformInfoHob); + MiscInitialization (PlatformInfoHob); } =20 IntelTdxInitialize (); InstallFeatureControlCallback (); - BuildPlatformInfoHob (); =20 return EFI_SUCCESS; } --=20 2.38.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#96910): https://edk2.groups.io/g/devel/message/96910 Mute This Topic: https://groups.io/mt/95405215/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Apr 25 09:42:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+96909+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+96909+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1669986638; cv=none; d=zohomail.com; s=zohoarc; b=MQb67Nto76s/e/PtZzskmSnoGHjlbLGTtPBMVmaFtTe9spdcnu4CV8QF8YhctpEOanQ8I4CUEexWBrptVjUrJBNl6Ce165hmhw3JyWFsso0eXwFL9P9ROiOHQSmbI9yaMyMbfY5ilfe0jjIdoCnY6T55Bfo0qkdZ2XmkEvTdGUk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1669986638; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=Fv3TQC71GfwD7kA1isNcRV8bGCzoVUaFMXp72ShV1BA=; b=lK3psQMwzfLX/Ixe5nmE053kJX7P00azCb/sfZ3QDPuTzy3AvjnCUBLTbkq4nfok2UOAoKub33bJsx6Lxd1QVQUpdKkuMEwBeEIRhbKGWlslFkuebmh1McdXD6Ey7RqJSy0Em49FFduH9ACXHHFrpjkl1hJh4eYIhCVI0OID3vw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+96909+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1669986638824154.78801265166715; Fri, 2 Dec 2022 05:10:38 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 7802YY1788612xiJd8iPENFl; Fri, 02 Dec 2022 05:10:38 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web10.74425.1669986637790697739 for ; Fri, 02 Dec 2022 05:10:37 -0800 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-470-O3GrG7DxMS-Ll723i-Qk_g-1; Fri, 02 Dec 2022 08:10:33 -0500 X-MC-Unique: O3GrG7DxMS-Ll723i-Qk_g-1 X-Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4C1A4185A794; Fri, 2 Dec 2022 13:10:32 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.79]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E7A9A1402BDC; Fri, 2 Dec 2022 13:10:31 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 00EE81801561; Fri, 2 Dec 2022 14:10:10 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Bob Feng , Yuwei Chen , Erdem Aktas , Jordan Justen , Peter Grehan , Rebecca Cran , Liming Gao , Ard Biesheuvel , Gerd Hoffmann , Jiewen Yao , Min Xu , Brijesh Singh , Oliver Steffen , Pawel Polawski , Tom Lendacky , James Bottomley Subject: [edk2-devel] [PATCH 11/14] OvmfPkg/PlatformPei: remove mFeatureControlValue Date: Fri, 2 Dec 2022 14:10:06 +0100 Message-Id: <20221202131009.3190040-12-kraxel@redhat.com> In-Reply-To: <20221202131009.3190040-1-kraxel@redhat.com> References: <20221202131009.3190040-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,kraxel@redhat.com X-Gm-Message-State: zDmush4v0DvKbjDImUK2Z1aKx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1669986638; bh=KKyT/VEQAziMuCmrSJUGN6SpDCQj1C5LHU8yBHYtb2I=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=VmH71LZALiIiM9e0nY+f6V0/TB8Z00yH7JE8FyjrGlchUdzE/7/F0iMZfMXZnNi7zT/ uEk3UDByEdfapr/DXjWt/LSc/gJM3sRbEO2K2M4a75K2U4M5q13xroscJZQv1i3T8MkUZ rsB/pyHmM5ACfR/D/sdyVslLfiwoImQlFds= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1669986639408100002 Content-Type: text/plain; charset="utf-8"; x-default="true" Use PlatformInfoHob->FeatureControlValue instead. OnMpServicesAvailable() will find PlatformInfoHob using GetFirstGuidHob() and pass a pointer to the WriteFeatureControl callback. Signed-off-by: Gerd Hoffmann Tested-by: Tom Lendacky --- OvmfPkg/Include/Library/PlatformInitLib.h | 2 ++ OvmfPkg/PlatformPei/Platform.h | 2 +- OvmfPkg/PlatformPei/FeatureControl.c | 44 ++++++++++++++++------- OvmfPkg/PlatformPei/Platform.c | 2 +- 4 files changed, 36 insertions(+), 14 deletions(-) diff --git a/OvmfPkg/Include/Library/PlatformInitLib.h b/OvmfPkg/Include/Li= brary/PlatformInitLib.h index c5234bf26d45..da7ed76041d2 100644 --- a/OvmfPkg/Include/Library/PlatformInitLib.h +++ b/OvmfPkg/Include/Library/PlatformInitLib.h @@ -48,6 +48,8 @@ typedef struct { =20 UINT32 S3AcpiReservedMemoryBase; UINT32 S3AcpiReservedMemorySize; + + UINT64 FeatureControlValue; } EFI_HOB_PLATFORM_INFO; #pragma pack() =20 diff --git a/OvmfPkg/PlatformPei/Platform.h b/OvmfPkg/PlatformPei/Platform.h index 86f603ff649c..1cf44844a781 100644 --- a/OvmfPkg/PlatformPei/Platform.h +++ b/OvmfPkg/PlatformPei/Platform.h @@ -70,7 +70,7 @@ MemTypeInfoInitialization ( =20 VOID InstallFeatureControlCallback ( - VOID + IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob ); =20 VOID diff --git a/OvmfPkg/PlatformPei/FeatureControl.c b/OvmfPkg/PlatformPei/Fea= tureControl.c index 5864ee0c214d..d8a398cd5565 100644 --- a/OvmfPkg/PlatformPei/FeatureControl.c +++ b/OvmfPkg/PlatformPei/FeatureControl.c @@ -8,6 +8,7 @@ **/ =20 #include +#include #include #include #include @@ -16,11 +17,6 @@ =20 #include "Platform.h" =20 -// -// The value to be written to the Feature Control MSR, retrieved from fw_c= fg. -// -STATIC UINT64 mFeatureControlValue; - /** Write the Feature Control MSR on an Application Processor or the Boot Processor. @@ -38,10 +34,22 @@ WriteFeatureControl ( IN OUT VOID *WorkSpace ) { + EFI_HOB_PLATFORM_INFO *PlatformInfoHob =3D WorkSpace; + if (TdIsEnabled ()) { - TdVmCall (TDVMCALL_WRMSR, (UINT64)MSR_IA32_FEATURE_CONTROL, mFeatureCo= ntrolValue, 0, 0, 0); + TdVmCall ( + TDVMCALL_WRMSR, + (UINT64)MSR_IA32_FEATURE_CONTROL, + PlatformInfoHob->FeatureControlValue, + 0, + 0, + 0 + ); } else { - AsmWriteMsr64 (MSR_IA32_FEATURE_CONTROL, mFeatureControlValue); + AsmWriteMsr64 ( + MSR_IA32_FEATURE_CONTROL, + PlatformInfoHob->FeatureControlValue + ); } } =20 @@ -67,6 +75,15 @@ OnMpServicesAvailable ( { EFI_PEI_MP_SERVICES_PPI *MpServices; EFI_STATUS Status; + EFI_HOB_PLATFORM_INFO *PlatformInfoHob; + EFI_HOB_GUID_TYPE *GuidHob; + + GuidHob =3D GetFirstGuidHob (&gUefiOvmfPkgPlatformInfoGuid); + if (GuidHob =3D=3D NULL) { + return EFI_UNSUPPORTED; + } + + PlatformInfoHob =3D (EFI_HOB_PLATFORM_INFO *)GET_GUID_HOB_DATA (GuidHob); =20 DEBUG ((DEBUG_VERBOSE, "%a: %a\n", gEfiCallerBaseName, __FUNCTION__)); =20 @@ -80,7 +97,7 @@ OnMpServicesAvailable ( WriteFeatureControl, // Procedure FALSE, // SingleThread 0, // TimeoutInMicroSeconds= : inf. - NULL // ProcedureArgument + PlatformInfoHob // ProcedureArgument ); if (EFI_ERROR (Status) && (Status !=3D EFI_NOT_STARTED)) { DEBUG ((DEBUG_ERROR, "%a: StartupAllAps(): %r\n", __FUNCTION__, Status= )); @@ -90,7 +107,7 @@ OnMpServicesAvailable ( // // Now write the MSR on the BSP too. // - WriteFeatureControl (NULL); + WriteFeatureControl (PlatformInfoHob); return EFI_SUCCESS; } =20 @@ -107,7 +124,7 @@ STATIC CONST EFI_PEI_NOTIFY_DESCRIPTOR mMpServicesNoti= fy =3D { =20 VOID InstallFeatureControlCallback ( - VOID + IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob ) { EFI_STATUS Status; @@ -119,7 +136,7 @@ InstallFeatureControlCallback ( &FwCfgItem, &FwCfgSize ); - if (EFI_ERROR (Status) || (FwCfgSize !=3D sizeof mFeatureControlValue)) { + if (EFI_ERROR (Status) || (FwCfgSize !=3D sizeof (PlatformInfoHob->Featu= reControlValue))) { // // Nothing to do. // @@ -127,7 +144,10 @@ InstallFeatureControlCallback ( } =20 QemuFwCfgSelectItem (FwCfgItem); - QemuFwCfgReadBytes (sizeof mFeatureControlValue, &mFeatureControlValue); + QemuFwCfgReadBytes ( + sizeof (PlatformInfoHob->FeatureControlValue), + &(PlatformInfoHob->FeatureControlValue) + ); =20 Status =3D PeiServicesNotifyPpi (&mMpServicesNotify); if (EFI_ERROR (Status)) { diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c index ebce2ba1290e..148240342b4b 100644 --- a/OvmfPkg/PlatformPei/Platform.c +++ b/OvmfPkg/PlatformPei/Platform.c @@ -396,7 +396,7 @@ InitializePlatform ( } =20 IntelTdxInitialize (); - InstallFeatureControlCallback (); + InstallFeatureControlCallback (PlatformInfoHob); =20 return EFI_SUCCESS; } --=20 2.38.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#96909): https://edk2.groups.io/g/devel/message/96909 Mute This Topic: https://groups.io/mt/95405214/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Apr 25 09:42:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+96911+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+96911+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1669986641; cv=none; d=zohomail.com; s=zohoarc; b=QcM/t16EMLpcKEaK9G7oVnlM0j9eRANqjw7NcmKPPBxV7MwPV9IBWMEoscNKzfFw8OEolyEloqoym2u2DJd0mzU/c1RAo8Og9mJ73YJSq9IAZu/o2Quwo/tdLTfy+lOAFoZ7GyZH4jdmfKZc0q+QXZC9nNSotfDbrLqVa3LRaQA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1669986641; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=sIIgIo10RAqLj3NNxEktTH4b6JPTTPHXdkOMFAiuLmc=; b=AQBc+e9ts9HTwLkETiQ3+umgPmKM9uHuU7DZc9gzDa+kiwzkYSAUHCJtIDYt4313pAdTuGAJmS12WgRGavTCAMvEFJOFdORiIqz8mN19HbKMfXTi7X2Ac1Tf1qEFKkhp3KwQN0MhS4sG4CoVtEZxEN/JSjAMN90qeZcz9igPSHs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+96911+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 166998664133450.055515338640475; Fri, 2 Dec 2022 05:10:41 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id hEPoYY1788612xuw7yRltpsu; Fri, 02 Dec 2022 05:10:40 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web11.74537.1669986639600330196 for ; Fri, 02 Dec 2022 05:10:39 -0800 X-Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-302-6imif8NFM_CdSb2Pf7Mbqw-1; Fri, 02 Dec 2022 08:10:35 -0500 X-MC-Unique: 6imif8NFM_CdSb2Pf7Mbqw-1 X-Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2949A38012C1; Fri, 2 Dec 2022 13:10:35 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.79]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BF01E2028CE4; Fri, 2 Dec 2022 13:10:34 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 04A9D1801562; Fri, 2 Dec 2022 14:10:10 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Bob Feng , Yuwei Chen , Erdem Aktas , Jordan Justen , Peter Grehan , Rebecca Cran , Liming Gao , Ard Biesheuvel , Gerd Hoffmann , Jiewen Yao , Min Xu , Brijesh Singh , Oliver Steffen , Pawel Polawski , Tom Lendacky , James Bottomley Subject: [edk2-devel] [PATCH 12/14] OvmfPkg/DebugLibIoPort: use Rom version for PEI Date: Fri, 2 Dec 2022 14:10:07 +0100 Message-Id: <20221202131009.3190040-13-kraxel@redhat.com> In-Reply-To: <20221202131009.3190040-1-kraxel@redhat.com> References: <20221202131009.3190040-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,kraxel@redhat.com X-Gm-Message-State: YoAJ9R70nYdbTw8XW2T8znZlx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1669986640; bh=ob4eL6u8uEiKbc3rIkPS4EA7KK7QfwqTwGtncnaDSO0=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=whmkkTXhCEYtpe3Qhi5DMarnHj7nclPDYnX0hwG1nW+v2R+sjdPYkQ/otL+ElENeUiI hScwd4o8AQwRCCkEmJkgUV8vuSMRUCEPIX/llnkOcnHouhhFPW9TjLKj8Y9XXXLcbEMl0 WTqWvFA2nqvzA3lfIY4g9mawsbe6/DO+qQQ= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1669986643412100013 Content-Type: text/plain; charset="utf-8"; x-default="true" This variant does not use global variables. Signed-off-by: Gerd Hoffmann Tested-by: Tom Lendacky --- OvmfPkg/AmdSev/AmdSevX64.dsc | 4 ++-- OvmfPkg/Bhyve/BhyveX64.dsc | 4 ++-- OvmfPkg/Microvm/MicrovmX64.dsc | 4 ++-- OvmfPkg/OvmfPkgIa32.dsc | 4 ++-- OvmfPkg/OvmfPkgIa32X64.dsc | 4 ++-- OvmfPkg/OvmfPkgX64.dsc | 4 ++-- .../PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc b/OvmfPkg/AmdSev/AmdSevX64.dsc index 8f7cae787e97..cf051c83165e 100644 --- a/OvmfPkg/AmdSev/AmdSevX64.dsc +++ b/OvmfPkg/AmdSev/AmdSevX64.dsc @@ -244,7 +244,7 @@ [LibraryClasses.common.PEI_CORE] !ifdef $(DEBUG_ON_SERIAL_PORT) DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf !else - DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.i= nf + DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPor= t.inf !endif PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf =20 @@ -260,7 +260,7 @@ [LibraryClasses.common.PEIM] !ifdef $(DEBUG_ON_SERIAL_PORT) DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf !else - DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.i= nf + DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPor= t.inf !endif PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf ResourcePublicationLib|MdePkg/Library/PeiResourcePublicationLib/PeiResou= rcePublicationLib.inf diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc index e3bb367b6bf6..befec670d4f3 100644 --- a/OvmfPkg/Bhyve/BhyveX64.dsc +++ b/OvmfPkg/Bhyve/BhyveX64.dsc @@ -265,7 +265,7 @@ [LibraryClasses.common.PEI_CORE] !ifdef $(DEBUG_ON_SERIAL_PORT) DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf !else - DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.i= nf + DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPor= t.inf !endif PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf =20 @@ -281,7 +281,7 @@ [LibraryClasses.common.PEIM] !ifdef $(DEBUG_ON_SERIAL_PORT) DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf !else - DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.i= nf + DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPor= t.inf !endif PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf ResourcePublicationLib|MdePkg/Library/PeiResourcePublicationLib/PeiResou= rcePublicationLib.inf diff --git a/OvmfPkg/Microvm/MicrovmX64.dsc b/OvmfPkg/Microvm/MicrovmX64.dsc index 994a02d30107..583e0cd12dc0 100644 --- a/OvmfPkg/Microvm/MicrovmX64.dsc +++ b/OvmfPkg/Microvm/MicrovmX64.dsc @@ -292,7 +292,7 @@ [LibraryClasses.common.PEI_CORE] !ifdef $(DEBUG_ON_SERIAL_PORT) DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf !else - DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.i= nf + DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPor= t.inf !endif PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf =20 @@ -308,7 +308,7 @@ [LibraryClasses.common.PEIM] !ifdef $(DEBUG_ON_SERIAL_PORT) DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf !else - DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.i= nf + DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPor= t.inf !endif PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf ResourcePublicationLib|MdePkg/Library/PeiResourcePublicationLib/PeiResou= rcePublicationLib.inf diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc index 6f774baf90f5..23ed6fb2b659 100644 --- a/OvmfPkg/OvmfPkgIa32.dsc +++ b/OvmfPkg/OvmfPkgIa32.dsc @@ -294,7 +294,7 @@ [LibraryClasses.common.PEI_CORE] !ifdef $(DEBUG_ON_SERIAL_PORT) DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf !else - DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.i= nf + DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPor= t.inf !endif PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf =20 @@ -310,7 +310,7 @@ [LibraryClasses.common.PEIM] !ifdef $(DEBUG_ON_SERIAL_PORT) DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf !else - DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.i= nf + DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPor= t.inf !endif PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf ResourcePublicationLib|MdePkg/Library/PeiResourcePublicationLib/PeiResou= rcePublicationLib.inf diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc index c851764dec05..6ed5eadd163d 100644 --- a/OvmfPkg/OvmfPkgIa32X64.dsc +++ b/OvmfPkg/OvmfPkgIa32X64.dsc @@ -300,7 +300,7 @@ [LibraryClasses.common.PEI_CORE] !ifdef $(DEBUG_ON_SERIAL_PORT) DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf !else - DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.i= nf + DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPor= t.inf !endif PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf =20 @@ -316,7 +316,7 @@ [LibraryClasses.common.PEIM] !ifdef $(DEBUG_ON_SERIAL_PORT) DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf !else - DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.i= nf + DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPor= t.inf !endif PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf ResourcePublicationLib|MdePkg/Library/PeiResourcePublicationLib/PeiResou= rcePublicationLib.inf diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc index 63c3a47aea30..39bba265e877 100644 --- a/OvmfPkg/OvmfPkgX64.dsc +++ b/OvmfPkg/OvmfPkgX64.dsc @@ -318,7 +318,7 @@ [LibraryClasses.common.PEI_CORE] !ifdef $(DEBUG_ON_SERIAL_PORT) DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf !else - DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.i= nf + DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPor= t.inf !endif PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf CcProbeLib|OvmfPkg/Library/CcProbeLib/SecPeiCcProbeLib.inf @@ -335,7 +335,7 @@ [LibraryClasses.common.PEIM] !ifdef $(DEBUG_ON_SERIAL_PORT) DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf !else - DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.i= nf + DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPor= t.inf !endif PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf ResourcePublicationLib|MdePkg/Library/PeiResourcePublicationLib/PeiResou= rcePublicationLib.inf diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPo= rt.inf b/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.i= nf index 8f721d249dd5..c89b1571bad8 100644 --- a/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf +++ b/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf @@ -16,7 +16,7 @@ [Defines] FILE_GUID =3D CEB0D9D3-328F-4C24-8C02-28FA1986AE1B MODULE_TYPE =3D BASE VERSION_STRING =3D 1.0 - LIBRARY_CLASS =3D DebugLib|SEC + LIBRARY_CLASS =3D DebugLib|SEC PEI_CORE PEIM CONSTRUCTOR =3D PlatformRomDebugLibIoPortConstructor =20 # --=20 2.38.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#96911): https://edk2.groups.io/g/devel/message/96911 Mute This Topic: https://groups.io/mt/95405216/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Apr 25 09:42:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+96912+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+96912+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1669986643; cv=none; d=zohomail.com; s=zohoarc; b=MmLko3wGDMb8MdM2uyleWCv3H1pMu1pIqT2B9jMgFDPY+SQH12GsKJTL8jQjEN1neQ6UpbhWvYCPAMzFyKa8BkKxqndzWplzGSykULMVQyB8TNL/rNOOydrs5OLJqQWWWAYtd/KVDqb+I5kOlfjMcQiePP2nT4V+55LhGKboFXk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1669986643; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=qcZSNXZH+TSMBAjOX2zpe1q9TfAalf4m54egpqgi/bg=; b=mxSd9abpddnQkx83iRWRTva+2exML9V65QMSc6lP/jd7pzckb6rhtPoSiDWVUKXWaNv4E3G+tHEe18/DIO8pAUK9y8F0ORWbEHOgWSEn77NIS7Sp/bBSH+vYuJQbHr9hhVKOamj4N8hQujFFjLjCqOFFM49PtPc4ZSQWwvdjARs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+96912+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1669986643973889.0108642503843; Fri, 2 Dec 2022 05:10:43 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id XOGnYY1788612xu1G1DfKR7v; Fri, 02 Dec 2022 05:10:43 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web11.74539.1669986643049131410 for ; Fri, 02 Dec 2022 05:10:43 -0800 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-64--HLdzwXjMOCXzkFI4KMw3A-1; Fri, 02 Dec 2022 08:10:37 -0500 X-MC-Unique: -HLdzwXjMOCXzkFI4KMw3A-1 X-Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0A854101A528; Fri, 2 Dec 2022 13:10:35 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.79]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 99910C1908E; Fri, 2 Dec 2022 13:10:34 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 08A341801563; Fri, 2 Dec 2022 14:10:10 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Bob Feng , Yuwei Chen , Erdem Aktas , Jordan Justen , Peter Grehan , Rebecca Cran , Liming Gao , Ard Biesheuvel , Gerd Hoffmann , Jiewen Yao , Min Xu , Brijesh Singh , Oliver Steffen , Pawel Polawski , Tom Lendacky , James Bottomley Subject: [edk2-devel] [PATCH 13/14] OvmfPkg/QemuFwCfgLib: rewrite fw_cfg probe Date: Fri, 2 Dec 2022 14:10:08 +0100 Message-Id: <20221202131009.3190040-14-kraxel@redhat.com> In-Reply-To: <20221202131009.3190040-1-kraxel@redhat.com> References: <20221202131009.3190040-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,kraxel@redhat.com X-Gm-Message-State: PPG1qXN7KfUZnKuIrvQVmAImx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1669986643; bh=zdOlIFC0V4BTZNyt7hzIJcfWvOIy2jKkw//xwJeD9WM=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=jxgPoWEqj4yJVYWfGuOHdE9Ch3ON06NMkYFk9sOpdTwjyGsIblGn8cfO7EJ2FHnSMLN I6gQwVGWdvz81rXljD4qBbp2vQs8fH1V2VF8pewi06NNiFA8tjEbI3XfwyVxqFvONLbbN U49z24JLSMSFtsvgSsHE1wLwr1ehAlggQHE= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1669986645383100017 Content-Type: text/plain; charset="utf-8"; x-default="true" Move the code to a new QemuFwCfgProbe() function. Use direct Io*() calls instead of indirect QemuFwCfg*() calls to make sure we don't get recursive calls. Also simplify CC guest detection. Signed-off-by: Gerd Hoffmann Tested-by: Tom Lendacky --- .../Library/QemuFwCfgLib/QemuFwCfgPeiLib.inf | 1 - OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPei.c | 101 +++++++----------- 2 files changed, 41 insertions(+), 61 deletions(-) diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPeiLib.inf b/OvmfPkg/Lib= rary/QemuFwCfgLib/QemuFwCfgPeiLib.inf index 3910511880c9..1d7543a7d40f 100644 --- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPeiLib.inf +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPeiLib.inf @@ -41,7 +41,6 @@ [LibraryClasses] DebugLib IoLib MemoryAllocationLib - MemEncryptSevLib =20 [Pcd] gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaBase diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPei.c b/OvmfPkg/Library/= QemuFwCfgLib/QemuFwCfgPei.c index 7ab7027af168..a936fd103955 100644 --- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPei.c +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPei.c @@ -13,7 +13,6 @@ #include #include #include -#include #include =20 #include "QemuFwCfgLibInternal.h" @@ -27,15 +26,16 @@ STATIC BOOLEAN mQemuFwCfgDmaSupported; @retval TRUE It is Tdx guest @retval FALSE It is not Tdx guest **/ +STATIC BOOLEAN -QemuFwCfgIsTdxGuest ( +QemuFwCfgIsCcGuest ( VOID ) { CONFIDENTIAL_COMPUTING_WORK_AREA_HEADER *CcWorkAreaHeader; =20 CcWorkAreaHeader =3D (CONFIDENTIAL_COMPUTING_WORK_AREA_HEADER *)FixedPcd= Get32 (PcdOvmfWorkAreaBase); - return (CcWorkAreaHeader !=3D NULL && CcWorkAreaHeader->GuestType =3D=3D= CcGuestTypeIntelTdx); + return (CcWorkAreaHeader !=3D NULL && CcWorkAreaHeader->GuestType !=3D C= cGuestTypeNonEncrypted); } =20 /** @@ -57,62 +57,49 @@ QemuFwCfgIsAvailable ( return InternalQemuFwCfgIsAvailable (); } =20 +STATIC +VOID +QemuFwCfgProbe ( + BOOLEAN *Supported, + BOOLEAN *DmaSupported + ) +{ + UINT32 Signature; + UINT32 Revision; + BOOLEAN CcGuest; + + // Use direct Io* calls for probing to avoid recursion. + IoWrite16 (FW_CFG_IO_SELECTOR, (UINT16)QemuFwCfgItemSignature); + IoReadFifo8 (FW_CFG_IO_DATA, sizeof Signature, &Signature); + IoWrite16 (FW_CFG_IO_SELECTOR, (UINT16)QemuFwCfgItemInterfaceVersion); + IoReadFifo8 (FW_CFG_IO_DATA, sizeof Revision, &Revision); + CcGuest =3D QemuFwCfgIsCcGuest (); + + *Supported =3D FALSE; + *DmaSupported =3D FALSE; + if ((Signature =3D=3D SIGNATURE_32 ('Q', 'E', 'M', 'U')) && (Revision >= =3D 1)) { + *Supported =3D TRUE; + if ((Revision & FW_CFG_F_DMA) && !CcGuest) { + *DmaSupported =3D TRUE; + } + } + + DEBUG (( + DEBUG_INFO, + "%a: Supported %d, DMA %d\n", + __func__, + *Supported, + *DmaSupported + )); +} + RETURN_STATUS EFIAPI QemuFwCfgInitialize ( VOID ) { - UINT32 Signature; - UINT32 Revision; - - // - // Enable the access routines while probing to see if it is supported. - // For probing we always use the IO Port (IoReadFifo8()) access method. - // - mQemuFwCfgSupported =3D TRUE; - mQemuFwCfgDmaSupported =3D FALSE; - - QemuFwCfgSelectItem (QemuFwCfgItemSignature); - Signature =3D QemuFwCfgRead32 (); - DEBUG ((DEBUG_INFO, "FW CFG Signature: 0x%x\n", Signature)); - QemuFwCfgSelectItem (QemuFwCfgItemInterfaceVersion); - Revision =3D QemuFwCfgRead32 (); - DEBUG ((DEBUG_INFO, "FW CFG Revision: 0x%x\n", Revision)); - if ((Signature !=3D SIGNATURE_32 ('Q', 'E', 'M', 'U')) || - (Revision < 1) - ) - { - DEBUG ((DEBUG_INFO, "QemuFwCfg interface not supported.\n")); - mQemuFwCfgSupported =3D FALSE; - return RETURN_SUCCESS; - } - - if ((Revision & FW_CFG_F_DMA) =3D=3D 0) { - DEBUG ((DEBUG_INFO, "QemuFwCfg interface (IO Port) is supported.\n")); - } else { - // - // If SEV is enabled then we do not support DMA operations in PEI phas= e. - // This is mainly because DMA in SEV guest requires using bounce buffer - // (which need to allocate dynamic memory and allocating a PAGE size'd - // buffer can be challenge in PEI phase) - // - if (MemEncryptSevIsEnabled ()) { - DEBUG ((DEBUG_INFO, "SEV: QemuFwCfg fallback to IO Port interface.\n= ")); - } else if (QemuFwCfgIsTdxGuest ()) { - // - // If TDX is enabled then we do not support DMA operations in PEI ph= ase. - // This is mainly because DMA in TDX guest requires using bounce buf= fer - // (which need to allocate dynamic memory and allocating a PAGE size= 'd - // buffer can be challenge in PEI phase) - // - DEBUG ((DEBUG_INFO, "TDX: QemuFwCfg fallback to IO Port interface.\n= ")); - } else { - mQemuFwCfgDmaSupported =3D TRUE; - DEBUG ((DEBUG_INFO, "QemuFwCfg interface (DMA) is supported.\n")); - } - } - + QemuFwCfgProbe (&mQemuFwCfgSupported, &mQemuFwCfgDmaSupported); return RETURN_SUCCESS; } =20 @@ -183,17 +170,11 @@ InternalQemuFwCfgDmaBytes ( return; } =20 - // - // SEV does not support DMA operations in PEI stage, we should - // not have reached here. - // - ASSERT (!MemEncryptSevIsEnabled ()); - // // TDX does not support DMA operations in PEI stage, we should // not have reached here. // - ASSERT (!QemuFwCfgIsTdxGuest ()); + ASSERT (!QemuFwCfgIsCcGuest ()); =20 Access.Control =3D SwapBytes32 (Control); Access.Length =3D SwapBytes32 (Size); --=20 2.38.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#96912): https://edk2.groups.io/g/devel/message/96912 Mute This Topic: https://groups.io/mt/95405218/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Apr 25 09:42:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+96913+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+96913+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1669986644; cv=none; d=zohomail.com; s=zohoarc; b=MWkqEgyjHnYggWdhh1W1S1ZirM2kYXHL0v/eE1cOd0z2fX3WGqMNDT3QVyBwjxRzkCbuWHzp79hjt+WmN2IcX8KWt9Z01RReQ1Ap2cJB0KfPGyMjkZq/3iroU/Rk8ly9FfxsXF65FH+YoUx2ccYwdzwmXmmquftsRY1Vlpvg+gI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1669986644; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=XwT+aOXNHs5SeINfK0/DbimL1whpeBtthEjPvurDEY8=; b=datDLaCWvFb+5M6Is+4/BE1ApGkn9cELQo8Ngu8YuUuwBgQrB8BKZ8UZ+lEsX4aiWVVjRp0o16tC2KlX6tbPMP7WjFfEVhZxLNHmkqNRUCrWenDnrHgH4iYs5sFVmyULkc200JvnD5IEto8bEV7QVhHHgDUldarqwem4igPf/7E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+96913+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1669986644956722.448795914431; Fri, 2 Dec 2022 05:10:44 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id ZUFtYY1788612xOgiO2xRbxA; Fri, 02 Dec 2022 05:10:44 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web10.74431.1669986643244242625 for ; Fri, 02 Dec 2022 05:10:43 -0800 X-Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-146-fKzciBbiNxGa1gkGGaf1bA-1; Fri, 02 Dec 2022 08:10:38 -0500 X-MC-Unique: fKzciBbiNxGa1gkGGaf1bA-1 X-Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5EADC38012C2; Fri, 2 Dec 2022 13:10:37 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.79]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 264B94A9257; Fri, 2 Dec 2022 13:10:37 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 0CBD11801564; Fri, 2 Dec 2022 14:10:10 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Bob Feng , Yuwei Chen , Erdem Aktas , Jordan Justen , Peter Grehan , Rebecca Cran , Liming Gao , Ard Biesheuvel , Gerd Hoffmann , Jiewen Yao , Min Xu , Brijesh Singh , Oliver Steffen , Pawel Polawski , Tom Lendacky , James Bottomley Subject: [edk2-devel] [PATCH 14/14] OvmfPkg/QemuFwCfgLib: remove mQemuFwCfgSupported + mQemuFwCfgDmaSupported Date: Fri, 2 Dec 2022 14:10:09 +0100 Message-Id: <20221202131009.3190040-15-kraxel@redhat.com> In-Reply-To: <20221202131009.3190040-1-kraxel@redhat.com> References: <20221202131009.3190040-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,kraxel@redhat.com X-Gm-Message-State: CR21QyWDN6nMxUzjW1e43EkIx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1669986644; bh=chIiCAsFraX5D++EtxcZI2ZRay3CarY16ZyR/u56uWw=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=uui/hDCAdUG9viP2bUCFQYg0SZ0jKi5EiB9d23/DXuAMtQYBsni6zKqFYwiaL4rkBrI sNj7SBFTGWSAjlPaAe87r1FkA9u0Kgtb5heDeBGW+zf2JdgaAWqEfLR07PSYZNqPvjbvF fMV6qCMpNb71cm/DBAVKsn8W+SzTI0OE8aU= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1669986645388100018 Content-Type: text/plain; charset="utf-8"; x-default="true" Remove global variables, store the state in PlatformInfoHob instead. Probing for fw_cfg happens on first use, at library initialization time the Hob might not be present yet. Signed-off-by: Gerd Hoffmann Tested-by: Tom Lendacky --- .../Library/QemuFwCfgLib/QemuFwCfgPeiLib.inf | 4 ++ OvmfPkg/Include/Library/PlatformInitLib.h | 4 ++ OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPei.c | 44 ++++++++++++++++--- 3 files changed, 45 insertions(+), 7 deletions(-) diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPeiLib.inf b/OvmfPkg/Lib= rary/QemuFwCfgLib/QemuFwCfgPeiLib.inf index 1d7543a7d40f..b1f548febcf7 100644 --- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPeiLib.inf +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPeiLib.inf @@ -39,8 +39,12 @@ [LibraryClasses] BaseLib BaseMemoryLib DebugLib + HobLib IoLib MemoryAllocationLib =20 +[Guids] + gUefiOvmfPkgPlatformInfoGuid + [Pcd] gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaBase diff --git a/OvmfPkg/Include/Library/PlatformInitLib.h b/OvmfPkg/Include/Li= brary/PlatformInitLib.h index da7ed76041d2..bf6f90a5761c 100644 --- a/OvmfPkg/Include/Library/PlatformInitLib.h +++ b/OvmfPkg/Include/Library/PlatformInitLib.h @@ -50,6 +50,10 @@ typedef struct { UINT32 S3AcpiReservedMemorySize; =20 UINT64 FeatureControlValue; + + BOOLEAN QemuFwCfgChecked; + BOOLEAN QemuFwCfgSupported; + BOOLEAN QemuFwCfgDmaSupported; } EFI_HOB_PLATFORM_INFO; #pragma pack() =20 diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPei.c b/OvmfPkg/Library/= QemuFwCfgLib/QemuFwCfgPei.c index a936fd103955..da86a3c84c02 100644 --- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPei.c +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPei.c @@ -9,17 +9,17 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ =20 +#include #include -#include #include +#include +#include +#include #include #include =20 #include "QemuFwCfgLibInternal.h" =20 -STATIC BOOLEAN mQemuFwCfgSupported =3D FALSE; -STATIC BOOLEAN mQemuFwCfgDmaSupported; - /** Check if it is Tdx guest =20 @@ -93,13 +93,39 @@ QemuFwCfgProbe ( )); } =20 +STATIC +EFI_HOB_PLATFORM_INFO * +QemuFwCfgGetPlatformInfo ( + VOID + ) +{ + EFI_HOB_PLATFORM_INFO *PlatformInfoHob; + EFI_HOB_GUID_TYPE *GuidHob; + + GuidHob =3D GetFirstGuidHob (&gUefiOvmfPkgPlatformInfoGuid); + if (GuidHob =3D=3D NULL) { + return NULL; + } + + PlatformInfoHob =3D (EFI_HOB_PLATFORM_INFO *)GET_GUID_HOB_DATA (GuidHob); + + if (!PlatformInfoHob->QemuFwCfgChecked) { + QemuFwCfgProbe ( + &PlatformInfoHob->QemuFwCfgSupported, + &PlatformInfoHob->QemuFwCfgDmaSupported + ); + PlatformInfoHob->QemuFwCfgChecked =3D TRUE; + } + + return PlatformInfoHob; +} + RETURN_STATUS EFIAPI QemuFwCfgInitialize ( VOID ) { - QemuFwCfgProbe (&mQemuFwCfgSupported, &mQemuFwCfgDmaSupported); return RETURN_SUCCESS; } =20 @@ -117,7 +143,9 @@ InternalQemuFwCfgIsAvailable ( VOID ) { - return mQemuFwCfgSupported; + EFI_HOB_PLATFORM_INFO *PlatformInfoHob =3D QemuFwCfgGetPlatformInfo (); + + return PlatformInfoHob->QemuFwCfgSupported; } =20 /** @@ -132,7 +160,9 @@ InternalQemuFwCfgDmaIsAvailable ( VOID ) { - return mQemuFwCfgDmaSupported; + EFI_HOB_PLATFORM_INFO *PlatformInfoHob =3D QemuFwCfgGetPlatformInfo (); + + return PlatformInfoHob->QemuFwCfgDmaSupported; } =20 /** --=20 2.38.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#96913): https://edk2.groups.io/g/devel/message/96913 Mute This Topic: https://groups.io/mt/95405219/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-