From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f201.google.com (mail-pg1-f201.google.com [209.85.215.201]) by mx.groups.io with SMTP id smtpd.web10.9452.1664379229517397355 for ; Wed, 28 Sep 2022 08:33:49 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@google.com header.s=20210112 header.b=p83QhTed; spf=pass (domain: flex--dionnaglaze.bounces.google.com, ip: 209.85.215.201, mailfrom: 3xgk0ywskbseaflkk7di7wbdlldib.9ljabsbibahz.dolrmp.fl@flex--dionnaglaze.bounces.google.com) Received: by mail-pg1-f201.google.com with SMTP id e187-20020a6369c4000000b0041c8dfb8447so7692004pgc.23 for ; Wed, 28 Sep 2022 08:33:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date; bh=/sOLLT2tv1Eu1ABLRFJBVANGvMOTgwOS532m3hy1CLo=; b=p83QhTedY9b9RK17SsbhQOX95CeXilvuLm1/XHby+yOlUPYT5CSXsGAxqn67I7BZ4/ VfFmn31O6EJSMc6eTgha0tspxyrVb4InmC/F02YIcCV9JKTKhGlFRTYCEakmiesa5BFt MkOeWZSJ0ytmG4IvtvfOq7sdoT7R9fn5vfjPFRk+tBx0LyvJiByV6s3xJvdQ1xgKHMYw 2Kd3GAEaK2BOS8YrVhc3His8Gml1ISXGH5dfHXr63xe4QkgFLwyV0JVz053daX7ooyB+ boerK9vVuCzjL8jLxv5sxhEk9SNu87MJcR+62cQuVRX4HHC0JOOOHynWPl3vBESO3Lgl EWRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date; bh=/sOLLT2tv1Eu1ABLRFJBVANGvMOTgwOS532m3hy1CLo=; b=SRNckPmn3Wwx8WPj2x/nhRRr2n4c75vHurQYrgbri9G9psi3xaozejSSaMmtrWt0mf cgwvrRFnWqXhNYLpme7CegI0mvg0IxPQP1TQx6kTNzWm1FRRaM6IUSbtKK3uZwSS+wyn IFeoCSF8jMSBXocBu2Z1bBD8/BUuCe3BDjRICc6GYVPxf6225d44Uh8mDAFcf5BPZZoy ohzbgxz/GsFcp6VYLjckVA5+q+jQpuToxzUUkcl5nFCaA3fT7oMZfLdlB6vC6KbjR+iG 90PdwRTu3r6tF1p6mEdmiAEqb/rh/f1BEkxzWvrA9DTJZ3P7xgnFgM7UG2Qp7aFkx0/f dT0w== X-Gm-Message-State: ACrzQf35DkulS6AAZoLs0UjGoRKZrPzb3+8iTbb8E8up7mfkVbn40ujU InLbW4andfWFsibvNY3b2MhOU8nKT3Tma/QXDuyEOFH2Y4dVrWMK9Y2gTwbAHImAHkrlZCgtjLr 9PaGy+ZclXrRtnoPIvTgT9gbcW6fPAB+5TR5CdjR8CSpiwmy7j2d6nhDDBxhrGfAtX0zmgEhB X-Google-Smtp-Source: AMsMyM5+qooofjM/TOJqLewQZKDxNgM93OKNhwID0s1CVONV7ieLVzbUNijgRsBSNA3opSsvpRafuegoW2wBBh1/Tg== X-Received: from dionnaglaze.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:2ee6]) (user=dionnaglaze job=sendgmr) by 2002:a17:90b:1c8b:b0:203:dcf1:128a with SMTP id oo11-20020a17090b1c8b00b00203dcf1128amr10797413pjb.182.1664379228867; Wed, 28 Sep 2022 08:33:48 -0700 (PDT) Date: Wed, 28 Sep 2022 15:33:23 +0000 In-Reply-To: <20220928153323.2583389-1-dionnaglaze@google.com> Mime-Version: 1.0 References: <20220928153323.2583389-1-dionnaglaze@google.com> X-Mailer: git-send-email 2.37.3.998.g577e59143f-goog Message-ID: <20220928153323.2583389-7-dionnaglaze@google.com> Subject: [PATCH v4 6/6] OvmfPkg/PlatformPei: SEV-SNP make >=4GB unaccepted From: "Dionna Glaze" To: devel@edk2.groups.io Cc: Dionna Glaze , Ard Biescheuvel , "Min M. Xu" , Gerd Hoffmann , James Bottomley , Tom Lendacky , Jiewen Yao , Erdem Aktas Content-Type: text/plain; charset="UTF-8" Instead of eagerly accepting all memory in PEI, only accept memory under the 4GB address. This allows a loaded image to use the ENABLE_UNACCEPTED_MEMORY_PROTOCOL to 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 enable 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 385562b44c..2a52d6f491 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) { + ResourceHob->ResourceType = EFI_RESOURCE_MEMORY_UNACCEPTED; + continue; + } if (ResourceHob->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) { MemEncryptSevSnpPreValidateSystemRam ( -- 2.37.3.998.g577e59143f-goog