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.web08.432.1665002030429227143 for ; Wed, 05 Oct 2022 13:33:50 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@google.com header.s=20210112 header.b=ihj2e+zs; spf=pass (domain: flex--dionnaglaze.bounces.google.com, ip: 209.85.210.202, mailfrom: 3leo9ywskbro38edd06b0p46ee6b4.2ec34l4b43as.6hekfi.8e@flex--dionnaglaze.bounces.google.com) Received: by mail-pf1-f202.google.com with SMTP id j25-20020aa78d19000000b00561f966ae13so2301126pfe.14 for ; Wed, 05 Oct 2022 13:33:50 -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=6iKIImg5ZGFl+D1YWtKdSPygpn45lxiV4GayiFvQWSw=; b=ihj2e+zswFNb+Op/jivhGoPgfSsoQz7whBOY/n5imNvpbOYOUKoI81iDSXTNMQsp8P tWhx117cXjSG7RujQDIDEkcTDB6m6GBTR1hYWUuHPd3tcZ35M7hVY/qEoUjyRBuIRPX8 XjcUnBSK9Bzl5bC/iXJU3Bs9vudljJzTQZhhKruDvnIi4uFIOaXiUCZwKwpJlenziQ53 dX2KD0WdTKagFsugjIjeNiZRHlRENQx/K/SJwwRIp0FX2SKoJcHaEdLvbA9pblNQ7TCE IzzXHQHtAyvdbM/ZOqdoSzVnhl2Vt1Fnv3PZdubTNjAizHbmbdnJKpia0b0mGbix5nzs 1Dog== 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=6iKIImg5ZGFl+D1YWtKdSPygpn45lxiV4GayiFvQWSw=; b=tOrY2yuBec98vsQAJH4gmIdFSmxOcm6cs3vrIWiRMbzYxKeZAfnRqWVqrGTtCcCZXs PAoJ18xNLm+8zA17EXLAcjzms6T4VQs9KndY7zPzLLtGlVTsoQ5PP9zxFH5FrLs2V6Vc nCyqY12mVs6FYntv3Qv1IC0snYO6YTLUF4Nt6lv7VdyJyHSbdYjaqdSmMPXSjq0/YNG8 5Q6BMhQVLaHT0mLbM5edZsCF3XBuh6Uofy+IBj7FJGBDBDVyrn9rNNkfOvFknVUMqd51 Rp7v2Y0whFBwRnYU0cIO+bQ7qzNmG18/ORrnQw+PQYfDBG56/2jILZKC7JRy6RFQowBO kpwQ== X-Gm-Message-State: ACrzQf3e9VceRNK4eXu9ZybcUWvRD7diCOYAnG/AexGVFq25tHG+JkEX JNLMvcFMrhW+xUqFK1CWZ6jKJ9iDbUVvY6taQf61FTq1k88NvZLMbLlHafCV8srz1Z/rBh2+azy B0iJSzRejt/RT206yYw2XA8LjdAjxlQaJb3//hN6Hsp8/vte6errHTxFJeeqBqrewJw8fuvyd X-Google-Smtp-Source: AMsMyM4Z5Zu9AxPax9MCMXM/cxWGgemNCKoPLDXj2SQgh14tubUeNqWWPXe0kwi+5cFxiLJZRzuC31W0Tbx8tbtOsg== X-Received: from dionnaglaze.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:2ee6]) (user=dionnaglaze job=sendgmr) by 2002:a17:90b:1242:b0:20a:f75c:de7 with SMTP id gx2-20020a17090b124200b0020af75c0de7mr2945010pjb.70.1665002029745; Wed, 05 Oct 2022 13:33:49 -0700 (PDT) Date: Wed, 5 Oct 2022 20:33:28 +0000 In-Reply-To: <20221005203329.469866-1-dionnaglaze@google.com> Mime-Version: 1.0 References: <20221005203329.469866-1-dionnaglaze@google.com> X-Mailer: git-send-email 2.38.0.rc1.362.ged0d419d3c-goog Message-ID: <20221005203329.469866-7-dionnaglaze@google.com> Subject: [PATCH v7 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 BeforeExitBootServices event this 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 ae64fbf28e..a7c54b36a3 100644 --- a/OvmfPkg/CocoDxe/CocoDxe.c +++ b/OvmfPkg/CocoDxe/CocoDxe.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -105,6 +106,21 @@ ResolveUnacceptedMemory ( ASSERT_EFI_ERROR (Status); } +STATIC +EFI_STATUS +EFIAPI +DisableAcceptAllUnacceptedMemory ( + IN BZ3987_ACCEPT_ALL_UNACCEPTED_MEMORY_PROTOCOL *This + ) +{ + mAcceptAllUnacceptedMemoryEnabled = FALSE; + return EFI_SUCCESS; +} + +STATIC +BZ3987_ACCEPT_ALL_UNACCEPTED_MEMORY_PROTOCOL +mAcceptAllUnacceptedMemoryProtocol = {DisableAcceptAllUnacceptedMemory}; + EFI_STATUS EFIAPI CocoDxeEntryPoint ( @@ -136,5 +152,14 @@ CocoDxeEntryPoint ( DEBUG ((DEBUG_ERROR, "AcceptAllUnacceptedMemory event creation for EventBeforeExitBootServices 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 3bbb5fc9cc..e24188147a 100644 --- a/OvmfPkg/CocoDxe/CocoDxe.inf +++ b/OvmfPkg/CocoDxe/CocoDxe.inf @@ -42,4 +42,5 @@ gEfiEventBeforeExitBootServicesGuid [Protocols] + gBz3987AcceptAllUnacceptedMemoryProtocolGuid gEfiMemoryAcceptProtocolGuid -- 2.38.0.rc1.362.ged0d419d3c-goog