From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f202.google.com (mail-pf1-f202.google.com [209.85.210.202]) by mx.groups.io with SMTP id smtpd.web09.1382.1666644098781640537 for ; Mon, 24 Oct 2022 13:41:38 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@google.com header.s=20210112 header.b=EZNo9MP1; spf=pass (domain: flex--dionnaglaze.bounces.google.com, ip: 209.85.210.202, mailfrom: 3gfhwywskbe4tyeddqwbqpuweewbu.sectulubutas.whekfi.ye@flex--dionnaglaze.bounces.google.com) Received: by mail-pf1-f202.google.com with SMTP id o14-20020a056a00214e00b0056238ef46ebso5139757pfk.2 for ; Mon, 24 Oct 2022 13:41:38 -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:message-id:reply-to; bh=JKU6mR2Ie6xWWm0EryoJs74Y1ofK04+M6a9mMHG65yw=; b=EZNo9MP1fTxNnMLzIivYYLfPFSvd08vCsNJ28seDBRN9OOdCt0WTr+s8q/IdH6Go3/ ccLlKOh54G0CkC3ZgSzADKZgMkLc8eliH57eVyyKMQFt6vs0Ol2pA08cdc2pbd9OEqcb KBwZtqdwKk9kUFvxaGC1JB5gVsB2ZVhXBl2hae4gfwemCQF62WN9oPZqrbG4k8pR5fue HOwDVTFivp5b95YMwH0OqM37tDMN3r/RSpVh45iBUphOPYLpdawwnMVNA4DRlwpQz1pv jGuWVI3m0VZslUdaFm81hZPiQ0xKgbz8AqeLSFcXtirjMVSuSIc1m1gaBUOR7SUzipyJ DA5Q== 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=JKU6mR2Ie6xWWm0EryoJs74Y1ofK04+M6a9mMHG65yw=; b=i1MzkgNAjAuvgDHeXvH7uQ1R77wbOxtL3nKmbPEBV9i3wo1B8V2MFs/TkKOsbrDU43 5CFJHvGmIE9+MkOp96MazZ6CLTnwC/HWh/rysp9vN8cjPuPn1mKxgFKtFCnmTL/aKBey 2ZIvilv1Nu1RwQlTe57HQ3DdQnMmzSfmtdBaICY8PCsMTK58Szs1s6ZsfBtfmmE4b5uw OuoQL5rLFekDAWvRNEPXfH60YWq4NbIT915BqeMCiL8pJPHsUAwOMBdwlDiMSnQ6ymn+ b9mG54dnZ4UnpIbzgBFRmSbGlpSrFRU+NVVnVT94sZcTGXSceqVWTrkUnz/2zflT4IBR 34hA== X-Gm-Message-State: ACrzQf2cNTddSuHeneEwGx88umFtKhwjB6wkOjdx10kv2c7aFq80+/Lx 2Ok35gc7t3SqoX3OuyCa+Y0iElmciknGjdcSipdRyxKCry/5tYYcF8saTSfN8u1cgUB2KFw8c8e rXqH8DDAHZTvlo5ovgYc1ezHd4RRLnyz++ICddidHozT3D7z03qEijjrjg8VmAxc84WM7We47 X-Google-Smtp-Source: AMsMyM7L/kifoMl8z0TanScQ0gzR1daf93pbdnjjwLtuBuVJ7xs++iFZsFLxGz+HMFINOSmYjJ2fAQehDru/As+ZUQ== X-Received: from dionnaglaze.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:2ee6]) (user=dionnaglaze job=sendgmr) by 2002:a17:903:289:b0:186:a8a8:e99a with SMTP id j9-20020a170903028900b00186a8a8e99amr7032712plr.104.1666644097887; Mon, 24 Oct 2022 13:41:37 -0700 (PDT) Date: Mon, 24 Oct 2022 20:41:14 +0000 In-Reply-To: <20221024204114.2772064-1-dionnaglaze@google.com> Mime-Version: 1.0 References: <20221024204114.2772064-1-dionnaglaze@google.com> X-Mailer: git-send-email 2.38.0.135.g90850a2211-goog Message-ID: <20221024204114.2772064-8-dionnaglaze@google.com> Subject: [PATCH v8 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 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 385562b44c..4cb6da4437 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_RESOURCE_MEMORY_UNACCEPTED; + continue; + } if (ResourceHob->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) { MemEncryptSevSnpPreValidateSystemRam ( -- 2.38.0.135.g90850a2211-goog