From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f202.google.com (mail-pg1-f202.google.com [209.85.215.202]) by mx.groups.io with SMTP id smtpd.web11.982.1664579203281557524 for ; Fri, 30 Sep 2022 16:06:43 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@google.com header.s=20210112 header.b=Tv0dwdIK; spf=pass (domain: flex--dionnaglaze.bounces.google.com, ip: 209.85.215.202, mailfrom: 3gny3ywskbw0otzyylrwlkprzzrwp.nzxopgpwpovn.rczfad.tz@flex--dionnaglaze.bounces.google.com) Received: by mail-pg1-f202.google.com with SMTP id h13-20020a63530d000000b0043087bbf72dso3612253pgb.17 for ; Fri, 30 Sep 2022 16:06:43 -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=l8+iE4R/XCE22/5+3+fsaQpWonjnLMO7DpJ3JevLWRA=; b=Tv0dwdIKqb1XhlOwuwHb9gaxrOUivMaeJgcWIqFKU7KuBGMe6LeEdQMf3uSVKmE4p7 MaXwormfj7XWRgfgb7wIsEdS8+ewGvb8vqw3uWFTMEC1n16joRFzl6Ia6R/WUchdRPle YbuJlj7qKUzatyE7ucRhbfaNPAVWHWqkscrvlDOe2X5P0RAfr/4ZuuOv+rNAAN2eJxXM 5QhZMnEsKqbdnW9BchLhXaA9V//QUVpHG1iUErfaYeOSxSPLFxADitLr7iabn/DCAgMM FJR4B7CKwtSCH2SVQwzwLmBxilvbwUUZPOUcZ9Lxi7xzDMb4aL5cr02tN2etBD3upTtX xFqA== 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=l8+iE4R/XCE22/5+3+fsaQpWonjnLMO7DpJ3JevLWRA=; b=G3VRpsfNcjFYulObMDpcTymabSiS4ysvnEfsIY75NKAWtcvpLbECsptTDSGHvaKYjb 3mXXFx7aeKQx/I0mIhW5PVdKH1olVkVG4JAqHl2hlEb0r3i2vJGKg14xPgNW+u2HP81h TYa/E5tSKyRZtAG88pvXMfMz44JgCd6vCCtkjMtN8JL7mnZUgrPLIvVmwVn+ncodG39f LKTzY7B0hPdlqlMQ+DtymTWH+M1O9hV+vKlRXQ8rj9jT/zCHCiAPFJs2VENTUVBhdRl1 io60EJsk3+/asoIGDdcCgfqj1Em4xcrxCrFas3SLRIwvYG+0OkAW0LOyLS59IWxly97r 0t2Q== X-Gm-Message-State: ACrzQf0HOzzzSpty+Cm3IMvIdwLMt2BrvV6VfzKKIKy2/lYyVEwOia6f gfw3MRRAOT09Ec5tk4zoLzlONYqi1oBqg6WYVLaIKrMMJ2YJ0N+dnMz6vicfcZn2TxmDMUT3uWY NyXCDiw+aHJldPkcjs+eLVkfd3LcVdtkCOoVxEVCGiXITrb2aecXNKg9PTUpMRYnF+Gq+rM57 X-Google-Smtp-Source: AMsMyM5PObs0ASEGFogu+fsaSkFUq1cvccLpTLZG1YoYUgoqsQho3hEAGIpDvHdCDF30pbcg+gs8/UKndf6AB5UPlA== X-Received: from dionnaglaze.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:2ee6]) (user=dionnaglaze job=sendgmr) by 2002:a17:90a:3b4d:b0:20a:6ecb:dcd1 with SMTP id t13-20020a17090a3b4d00b0020a6ecbdcd1mr572127pjf.141.1664579202798; Fri, 30 Sep 2022 16:06:42 -0700 (PDT) Date: Fri, 30 Sep 2022 23:06:27 +0000 In-Reply-To: <20220930230627.3371754-1-dionnaglaze@google.com> Mime-Version: 1.0 References: <20220930230627.3371754-1-dionnaglaze@google.com> X-Mailer: git-send-email 2.38.0.rc1.362.ged0d419d3c-goog Message-ID: <20220930230627.3371754-8-dionnaglaze@google.com> Subject: [PATCH v5 7/7] 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 ACCEPT_ALL_UNACCEPTED_MEMORY_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 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.38.0.rc1.362.ged0d419d3c-goog