From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) by mx.groups.io with SMTP id smtpd.web09.1512.1664823249905982015 for ; Mon, 03 Oct 2022 11:54:10 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@google.com header.s=20210112 header.b=RRby20ex; spf=pass (domain: flex--dionnaglaze.bounces.google.com, ip: 209.85.214.201, mailfrom: 30s87ywskbt4intssflqf4jlttlqj.htrij0jqjip7.lwtzux.nt@flex--dionnaglaze.bounces.google.com) Received: by mail-pl1-f201.google.com with SMTP id a5-20020a170902ecc500b0017eea4a394fso3094941plh.20 for ; Mon, 03 Oct 2022 11:54:09 -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=/XxlhMmaOsLb4Dxi7pTnSZAkVryQ21RNORglaghBXNs=; b=RRby20exWcMQpYR0hhqukkSNEmXdrD1F1kFWdH3spoiitho01sb8vaErXPOQ758/Tq rwE+aluxcHLqIa8ewgGUiYByFvSPqkVV2Elabnb/Rx/mibNjmCWUoFSR6fArDdMH0rGt aux/SRodEJdMw2zuBil23oDz39zpXoaNmp8IMd96t7n6tulXyZp53uCTGAmCQS5YGVH7 m+pfAytui0DKNnLsxYL2zzhxuW/heC2SX0yDVjwQuA4SGt1YDQoh7WMHkmqw66iVSxMa gzH3vyAW+bQj76wdXaBStgC8XJbP7M4IJsGYx+2IsMVZOJnRtEP/enrsfP3GCK6cdnzW NZfg== 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=/XxlhMmaOsLb4Dxi7pTnSZAkVryQ21RNORglaghBXNs=; b=pDtESmxpH1FITauiDkeLFCn13ZFK1+RxDDK58qKXXhoUkYvk2KWQut2trHsOGPpOdu BrRHZhWrYixAd2E5RymOxtL+cKSOhsM1r1GpwhAoxwc5lziFnxAI+5BfwTagfeBBLrmi Kr9uvuAqwdqapXUUWykuvoRfnLSwE4Bk9Tcqf1FA59amXHjriRlRYaAPDw2H4QZfab3/ RDKysCliYZw0YgTTKgKu5GDV6OMECrZPnSq5cT450ZsgChi8YVuAsOZ7t7Y39T16pXKG +I553wmUlwB1YdtFgzEWBGWJrnvqdWNNJJbLyk9YQ4rZp/Sj73WJEKXDpTvDUy9gudDu uUvw== X-Gm-Message-State: ACrzQf1LcK6NCYjzb1x4pcXR5yt5j3Z7lkuQUOzcvIcp7scUi4NRv0BD 1/ldgSqwV4yRZpUOwZpG1SvuD2Ur2FAX/i6oaKQjTLpiMerx7mGpQokHwKdROqC8yx7gN4P2uzI 6AugauT1gnS4y3lczxxC1a8T6hoY4WS8DrbX4W87OFahyw//d47cABQmOxqxkOBAMCkRZ/0Cv X-Google-Smtp-Source: AMsMyM7GWJv+6owLZyB87neXlUhuu7BeUN/RPG8Z2qz1mfHUvT1sd7i+YOYj+Z3FDd/XNUnZgEMb3sdAAZU4RiFeDg== X-Received: from dionnaglaze.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:2ee6]) (user=dionnaglaze job=sendgmr) by 2002:a17:90a:aa96:b0:205:bb67:a85f with SMTP id l22-20020a17090aaa9600b00205bb67a85fmr13365383pjq.202.1664823249388; Mon, 03 Oct 2022 11:54:09 -0700 (PDT) Date: Mon, 3 Oct 2022 18:53:51 +0000 In-Reply-To: <20221003185352.3969999-1-dionnaglaze@google.com> Mime-Version: 1.0 References: <20221003185352.3969999-1-dionnaglaze@google.com> X-Mailer: git-send-email 2.38.0.rc1.362.ged0d419d3c-goog Message-ID: <20221003185352.3969999-7-dionnaglaze@google.com> Subject: [PATCH v6 6/7] OvmfPkg: Implement AcceptAllUnacceptedMemory in CocoDxe From: "Dionna Glaze" To: devel@edk2.groups.io Cc: Dionna Glaze , Gerd Hoffmann , James Bottomley , Jiewen Yao , Tom Lendacky , Ard Biesheuvel , "Min M. Xu" , Andrew Fish , "Michael D. Kinney" Content-Type: text/plain; charset="UTF-8" This protocol implementation disables the accept-all-memory behavior of the ExitBootServicesCallback instance thise driver adds. Cc: Gerd Hoffmann Cc: James Bottomley Cc: Jiewen Yao Cc: Tom Lendacky Cc: Ard Biesheuvel Cc: "Min M. Xu" Cc: Andrew Fish Cc: "Michael D. Kinney" Signed-off-by: Dionna Glaze --- OvmfPkg/CocoDxe/CocoDxe.c | 25 ++++++++++++++++++++ OvmfPkg/CocoDxe/CocoDxe.inf | 1 + 2 files changed, 26 insertions(+) diff --git a/OvmfPkg/CocoDxe/CocoDxe.c b/OvmfPkg/CocoDxe/CocoDxe.c index 9e9a405af1..abf2d2b055 100644 --- a/OvmfPkg/CocoDxe/CocoDxe.c +++ b/OvmfPkg/CocoDxe/CocoDxe.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -113,6 +114,21 @@ STATIC EDKII_EXIT_BOOT_SERVICES_CALLBACK_PROTOCOL mExitBootServicesCallbackProco FALSE, }; +STATIC +EFI_STATUS +EFIAPI +DisableAcceptAllUnacceptedMemory ( + IN BZ3987_ACCEPT_ALL_UNACCEPTED_MEMORY_PROTOCOL *This + ) +{ + mExitBootServicesCallbackProcotol.Disabled = TRUE; + return EFI_SUCCESS; +} + +STATIC +BZ3987_ACCEPT_ALL_UNACCEPTED_MEMORY_PROTOCOL +mAcceptAllUnacceptedMemoryProtocol = {DisableAcceptAllUnacceptedMemory}; + EFI_STATUS EFIAPI CocoDxeEntryPoint ( @@ -140,5 +156,14 @@ CocoDxeEntryPoint ( DEBUG ((DEBUG_ERROR, "Install EdkiiExitBootServicesCallbackProtocol failed.\n")); } + Status = gBS->InstallProtocolInterface (&mCocoDxeHandle, + &gBz3987AcceptAllUnacceptedMemoryProtocolGuid, + EFI_NATIVE_INTERFACE, + &mAcceptAllUnacceptedMemoryProtocol + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Install Bz3987AcceptAllUnacceptedMemoryProtocol failed.\n")); + } + return EFI_SUCCESS; } diff --git a/OvmfPkg/CocoDxe/CocoDxe.inf b/OvmfPkg/CocoDxe/CocoDxe.inf index 3ff2a6fade..96ab3e1c68 100644 --- a/OvmfPkg/CocoDxe/CocoDxe.inf +++ b/OvmfPkg/CocoDxe/CocoDxe.inf @@ -39,5 +39,6 @@ TRUE [Protocols] + gBz3987AcceptAllUnacceptedMemoryProtocolGuid gEdkiiExitBootServicesCallbackProtocolGuid gEfiMemoryAcceptProtocolGuid -- 2.38.0.rc1.362.ged0d419d3c-goog