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.web11.86800.1674767873716475155 for ; Thu, 26 Jan 2023 13:17:53 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@google.com header.s=20210112 header.b=LvSxUxoJ; spf=pass (domain: flex--dionnaglaze.bounces.google.com, ip: 209.85.215.201, mailfrom: 3ae7sywskbu4ty433qw1qfuw44w1u.s42tubu1ut0i.w74a58.y4@flex--dionnaglaze.bounces.google.com) Received: by mail-pg1-f201.google.com with SMTP id 38-20020a630b26000000b004773803dda1so1281903pgl.17 for ; Thu, 26 Jan 2023 13:17:53 -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=2lGdwUkSrYHtBySSTfQ2A9cY+XMOmoQymwkYOdtT15o=; b=LvSxUxoJxvjuDXxuu4sp+A9aZwB4mfRJTRnfDLtHtMFM13O/N0HLr8tdV7aXg7aS9c d2ADwzBVoXeOirWTn+nTPe3HOpQzxbRGc2XyMSCtDcaPS3T0yjx3oEvebvMwLC0P89kq S4qkj6b8tqMeafSFemSPDj1/O0uEzM+X99CwPbKCc60Sqm5yDaTfTN1toJz58GuIC88j 6/uQnph8Hj9DxJIfpfJsVSZk8aSmxzYJPov6RozPJAZRE+rrWL6pkuOASGYSRGCKbRiZ PmmuoZuWHklEgRVDERiojnrhdFRegnWLJtTKGR/mH4uTBvA92EUKZSEl6l3DE1cpMWyy dnnQ== 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=2lGdwUkSrYHtBySSTfQ2A9cY+XMOmoQymwkYOdtT15o=; b=IhWu+irJKoUvJ1VWH0msi53jIzVTCh8JrKEHhPY3Rw45+fP2dXo0AMGC2eIwI3YoFX on/GCUhtSOcz0AXGP7aTf+43692+6axXhxTd8c6Tdim/Gs1zUWXuYiN93IyDU72VtzUY POR+iGM2JDMkyvO5HUD92Mv9PtHssw8W4kwmWrEFP3Y0hFeND+DfGUPTQc4QCB6NPPuR creNlMfEZIAiAYqPOKPcdRkMzHf91F0ySHXxcrO4SOEZGZo1z3Qj940ZlKkfGDdPlXm1 oda2EsrkXKOf2a4RLMXXeTooW5rFIw9bxO0CDuOkOu2dKjVvOYWxsI1KnU0Kmf3aeRny KgfQ== X-Gm-Message-State: AFqh2kpgo/ShoPpl8KQ6n2ggH7U5hjpa7Q5HQIIIKPyXkmSdUXmgVdpM KL8yIrnEyxnh+xP4Cd72q157oAi3MEMt3onccU4iCZgXZFzrtbINs6nqSvVEQaDA2aSjcm6sErB yAP2qev26v74Sa4QuqNnbQ9PG6vuWd5EK1glE86gMjgq+MVn4VgxzBB5d+2NDgKCrhCNK+80S X-Google-Smtp-Source: AMrXdXvav46tjxHEFnYAA6vZxq5VO3TCciw7sq+I45tj/j4DJxkyVkDRwoxjG289W/KRjhX4t7TdVDuJriCS1+srEA== X-Received: from dionnaglaze.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:2ee6]) (user=dionnaglaze job=sendgmr) by 2002:a17:90a:138a:b0:22b:ba09:cb1a with SMTP id i10-20020a17090a138a00b0022bba09cb1amr2886188pja.188.1674767873123; Thu, 26 Jan 2023 13:17:53 -0800 (PST) Date: Thu, 26 Jan 2023 21:17:40 +0000 In-Reply-To: <20230126211740.3235408-1-dionnaglaze@google.com> Mime-Version: 1.0 References: <20230126211740.3235408-1-dionnaglaze@google.com> X-Mailer: git-send-email 2.39.1.456.gfc5497dd1b-goog Message-ID: <20230126211740.3235408-5-dionnaglaze@google.com> Subject: [PATCH v11 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.1.456.gfc5497dd1b-goog