From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web11.87915.1674770601029675482 for ; Thu, 26 Jan 2023 14:03:21 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VmbNtp63; spf=pass (domain: kernel.org, ip: 139.178.84.217, mailfrom: ardb@kernel.org) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 78E7261967 for ; Thu, 26 Jan 2023 22:03:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2EAFC433A0 for ; Thu, 26 Jan 2023 22:03:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674770599; bh=NPlmAF5r84wTaIV6MY/kk+qt8cXPJSub3Uz8Wu8lSG8=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=VmbNtp63LCCYR1cGFfOYj8vhMG7XrUXwNVS8zGof1NxNs37+QSbF6ryM9ZXMEGyEA Q2WJrzFoPpaFSz7BSWXFrTo4pXOH37B/qga+Z6cF1mdYxCaBCtxnP//e2loG3SZ+q6 FKTbUBRB++HKSTnpWPbf/VGb3OpoKuCN9HDPz2IOD3HyEam7eDZaBPgJjdOORWoBg6 i0oLamcXDtAfMJZiUTV1U0kS+OYdoriWTeLQSVWfYYbNIkD7M3RN0Dv1M8haKdrCjU YWRO+AecHgTR9u1ltdVWW9T/Rytft+DrfrKpAuuImDBCZV2fyogyqCuWVZTWiTqXDM nOkca9ve++1qg== Received: by mail-lf1-f54.google.com with SMTP id x40so5173903lfu.12 for ; Thu, 26 Jan 2023 14:03:19 -0800 (PST) X-Gm-Message-State: AFqh2krBWlTorwW2DHDcNdTXY6mq76LfgLmEvLaO8gTYIaH3elvMRQsR 1k68jldofVGwY3pn45qRGR2aQcI39RcQtsJBpSg= X-Google-Smtp-Source: AMrXdXsWMblZWYPwmb/n2fE6zv+AU8kHsBXUbV+VHB5sZ611JKEEFYlpPPYcXq2UBiRKCo86fCcC6SVuPc5wxRWzoi4= X-Received: by 2002:ac2:5de7:0:b0:4b5:5f2d:1458 with SMTP id z7-20020ac25de7000000b004b55f2d1458mr1967373lfq.253.1674770597893; Thu, 26 Jan 2023 14:03:17 -0800 (PST) MIME-Version: 1.0 References: <20230126211740.3235408-1-dionnaglaze@google.com> <20230126211740.3235408-5-dionnaglaze@google.com> In-Reply-To: <20230126211740.3235408-5-dionnaglaze@google.com> From: "Ard Biesheuvel" Date: Thu, 26 Jan 2023 23:03:05 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v11 4/4] OvmfPkg/PlatformPei: SEV-SNP make >=4GB unaccepted To: Dionna Glaze Cc: devel@edk2.groups.io, "Min M. Xu" , Gerd Hoffmann , James Bottomley , Tom Lendacky , Jiewen Yao , Erdem Aktas Content-Type: text/plain; charset="UTF-8" On Thu, 26 Jan 2023 at 22:17, Dionna Glaze wrote: > > Instead of eagerly accepting all memory in PEI, only accept memory under > the 4GB address. This allows a loaded image to use the > MEMORY_ACCEPTANCE_PROTOCOL to disable the accept behavior and indicate > that it can interpret the memory type accordingly. > > This classification is safe since ExitBootServices will accept and > reclassify the memory as conventional if the disable protocol is not > used. > > Cc: Ard Biescheuvel > Cc: "Min M. Xu" > Cc: Gerd Hoffmann > Cc: James Bottomley > Cc: Tom Lendacky > Cc: Jiewen Yao > Cc: Erdem Aktas > > Signed-off-by: Dionna Glaze > --- > OvmfPkg/PlatformPei/AmdSev.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/OvmfPkg/PlatformPei/AmdSev.c b/OvmfPkg/PlatformPei/AmdSev.c > index e4e7b72e67..7d824cc282 100644 > --- a/OvmfPkg/PlatformPei/AmdSev.c > +++ b/OvmfPkg/PlatformPei/AmdSev.c > @@ -16,6 +16,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -63,6 +64,10 @@ AmdSevSnpInitialize ( > for (Hob.Raw = GetHobList (); !END_OF_HOB_LIST (Hob); Hob.Raw = GET_NEXT_HOB (Hob)) { > if ((Hob.Raw != NULL) && (GET_HOB_TYPE (Hob) == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR)) { > ResourceHob = Hob.ResourceDescriptor; > + if (ResourceHob->PhysicalStart >= SIZE_4GB) { Shouldn't this check be inside the if () below? Or are all resources that start at or above 4 GiB guaranteed to be system memory? No need to resend - if needed, I can fix that up when applying. > + ResourceHob->ResourceType = BZ3937_EFI_RESOURCE_MEMORY_UNACCEPTED; > + continue; > + } > > if (ResourceHob->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) { > MemEncryptSevSnpPreValidateSystemRam ( > -- > 2.39.1.456.gfc5497dd1b-goog >