From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f201.google.com (mail-pf1-f201.google.com [209.85.210.201]) by mx.groups.io with SMTP id smtpd.web10.2317.1664220784849830162 for ; Mon, 26 Sep 2022 12:33:04 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@google.com header.s=20210112 header.b=PMCQqL4g; spf=pass (domain: flex--dionnaglaze.bounces.google.com, ip: 209.85.210.201, mailfrom: 3cp4xywskbvu05baax38xm13bb381.zb901i18107p.3ebhcf.5b@flex--dionnaglaze.bounces.google.com) Received: by mail-pf1-f201.google.com with SMTP id z24-20020a056a001d9800b0054667d493bdso4550448pfw.0 for ; Mon, 26 Sep 2022 12:33:04 -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=PMCQqL4gHT1+LOi746kZqh93tQZUreNotcbSlTT23EYavGIxl6AmGMIzlXivobCIOw R2OtsFt4hulJXgISbkvJ7JjGq6Cq2a170W6mKitbfMKLwg9O8T66TlUSXjAt1uF+5Viy P+kuE7NL+jG/0cwmzNkyyjBHI5QAk3Pb2YDxeDMpO7cjg+LfV6KXq0PiLJnK+PpVJtuu 06iHOSj3D72h/8xX6Asx86yN5NOj8uaOxyVGgtwN1ia4IYQhPTcO5o1w780saPOAVtuC Dwp9u/VqXCRf+HP2Dsa7niz+wr6yHOxR+kgw6XH9xUuHmPz41vNHNWRA9IC5W/7GIVIQ aRdg== 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=DABLZLHbm3le7E+gNW7h2V4VB7bjGaxRV2m7mQj+OvhldX7kw5F50lSK0oL6pE9a8p r8PlLUi6/GBmca1YAH8Od7XI2SlmPwEHc8JcoNA2ZRJ60+AP+K3tpjI9UNUQHoy4KoZl kN9OWN5EkhKhC/ErnrcIIJbOzi98AJIbndLKYea9eIgAIQkMHsdMr1KrHe80KBQqMA/7 dJas1OoaCggEDY2A1o7HFl+MLTU6PRWWKTqzJ450NclUaODVtewhM81yOzidV+MsLMyw rI9oMmjoDmnXTY+Saj/4Bpi7NcweP5CbmySxvHMLUq0Ohh090ocE/3X8cJVR2CThA5bx sfCA== X-Gm-Message-State: ACrzQf1o3tOU9xP0taDVtOMz7PCYXFs7QWJTT4aT8/EbyhV48Zi5759n 53/U03zBMwNaQsoxZZFqIH78tyaVqgcez5s3x+wGv1r+whbMHXnr/mZfyavKklzEx56alAcAnQZ l2oDAQZxYo7TZw/lWpvgkO813/QFNNydIsu+QNCTvwFZCAL0PXdSDBoMToqjV/shZBwuWhb5Q X-Google-Smtp-Source: AMsMyM5PyLdCIYAXrI/k24OHwkmXQVxMPCUu/Rp4Tfyzr7x4ImIfbi0B8LQ9Sf/HrAB4q6lTkVdAYrRcJQcZK+LjVw== X-Received: from dionnaglaze.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:2ee6]) (user=dionnaglaze job=sendgmr) by 2002:a05:6a00:84d:b0:542:4254:17ef with SMTP id q13-20020a056a00084d00b00542425417efmr25072263pfk.31.1664220784229; Mon, 26 Sep 2022 12:33:04 -0700 (PDT) Date: Mon, 26 Sep 2022 19:32:42 +0000 In-Reply-To: <20220926193242.2094502-1-dionnaglaze@google.com> Mime-Version: 1.0 References: <20220926193242.2094502-1-dionnaglaze@google.com> X-Mailer: git-send-email 2.37.3.998.g577e59143f-goog Message-ID: <20220926193242.2094502-5-dionnaglaze@google.com> Subject: [PATCH v3 4/4] 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