From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f73.google.com (mail-pj1-f73.google.com [209.85.216.73]) by mx.groups.io with SMTP id smtpd.web11.73502.1673568891161659521 for ; Thu, 12 Jan 2023 16:14:51 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@google.com header.s=20210112 header.b=kcJO4Dub; spf=pass (domain: flex--dionnaglaze.bounces.google.com, ip: 209.85.216.73, mailfrom: 3eqlaywskbeukpvuuhnshglnvvnsl.jvtklclslkrj.nyvbwz.pv@flex--dionnaglaze.bounces.google.com) Received: by mail-pj1-f73.google.com with SMTP id h1-20020a17090a470100b0022646263abfso9037958pjg.6 for ; Thu, 12 Jan 2023 16:14:51 -0800 (PST) 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:message-id:reply-to; bh=KecARn4KRfRjeG0UPIX4L9UxOZbbbRPTWMjBSHBWcq8=; b=kcJO4DubWyknjmHvpb/mzDcHxUNOjr+Ga8XMKMNE8P/w2OrxFAA7alv3In18ItWMGl lF0Igj4M5v7raCvEav8bgWG29PtgiWcByKKpk98lRlOX9gFHC1aZ1pClkXnIY1jUnTZ6 o8jz05VWtlsK08ZMEZJSrL/NEgJeMzYYpD5xwQo1ZpLNZaiRC6IoxghM3jtvTRx7dbhK IBPz/Xx7fWmXyOCDszFtOeptlo7udvyYkNGzjCmcevKef3AOXvr2rC6xuVS5ielKNlkt 4PggozDpPjAlyFi4RwLr8zj678zP0xjjW+7UJt4SIj84kyk6buHXGhJAvqalkI+o9KPs cj5A== 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:message-id:reply-to; bh=KecARn4KRfRjeG0UPIX4L9UxOZbbbRPTWMjBSHBWcq8=; b=KiOJRACbvRvEYsfpk+ylx4zqN6Bp1LiDBgSYpKgh6ZjEmytyoGC/Cl1JqIJbVujrKB 31rjc+VO4gqPSxIO5lvT1mn+Bz/3mXUmMiyUEd7ZL3ZZf0rc6Nr5fm+AGx6OJzvkLQon 52CQTW3AHbpWh4wXJoZqfP3yo+gSB2SgUaUWlezdyL4NwNSU76nFM3pF7iiJ2xrb+UEi I0BCTJkbyVSgCZR3bwm7e3/KSQKDON/gQyVbDld+TwNa4T7aO92cQjxig5zoy6gKKvJu L2BHw9ENlWWK8GxHkkocJOdm3GVmBk302MhFcHnxHJ/X5UdJ/H3tQfT8Os2V4cLV9bJ/ UVLQ== X-Gm-Message-State: AFqh2krNzgybjtKiNQdJ8A3hwTkb2KFp1oyNd26RUrWAqjRPU6GOn6Gi JdWwf2JFu00V3IMn90wSbm/urEzJQ9pghMAJH/5mHfZ9s9j2Mvtmt24+Z/4vaRwcGjL5pHVMaQK YKE/07hTrao3Mi5HFOlUjoiFiwAkZZ3xthZGkKpOE1jHFJxOY+tH8DracCtSd8QNPnSS5rglG X-Google-Smtp-Source: AMrXdXvZ/8r1h0+JzA31pstDLmeVwSI9YakjiVMiVj5eKgzkmZjVBBbukXqKkzkAjo4+hLJnIYg0N6tL21sDQI8QJg== X-Received: from dionnaglaze.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:2ee6]) (user=dionnaglaze job=sendgmr) by 2002:a05:6a00:1244:b0:56b:8181:fe3e with SMTP id u4-20020a056a00124400b0056b8181fe3emr5309022pfi.57.1673568890528; Thu, 12 Jan 2023 16:14:50 -0800 (PST) Date: Fri, 13 Jan 2023 00:14:19 +0000 In-Reply-To: <20230113001419.2519031-1-dionnaglaze@google.com> Mime-Version: 1.0 References: <20230113001419.2519031-1-dionnaglaze@google.com> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog Message-ID: <20230113001419.2519031-5-dionnaglaze@google.com> Subject: [PATCH v9 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 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) { + ResourceHob->ResourceType = BZ3937_EFI_RESOURCE_MEMORY_UNACCEPTED; + continue; + } if (ResourceHob->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) { MemEncryptSevSnpPreValidateSystemRam ( -- 2.39.0.314.g84b9a713c41-goog