lkml.org 
[lkml]   [2023]   [May]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    SubjectRe: [PATCHv12 4/9] x86/boot/compressed: Handle unaccepted memory
    On Fri, May 19, 2023 at 02:14:29AM +0300, Kirill A. Shutemov wrote:
    > diff --git a/arch/x86/boot/compressed/mem.c b/arch/x86/boot/compressed/mem.c
    > index 67594fcb11d9..87372b96d613 100644
    > --- a/arch/x86/boot/compressed/mem.c
    > +++ b/arch/x86/boot/compressed/mem.c
    > @@ -1,9 +1,32 @@
    > // SPDX-License-Identifier: GPL-2.0-only
    >
    > #include "error.h"
    > +#include "misc.h"
    >
    > void arch_accept_memory(phys_addr_t start, phys_addr_t end)
    > {
    > /* Platform-specific memory-acceptance call goes here */
    > error("Cannot accept memory");
    > }
    > +
    > +void init_unaccepted_memory(void)
    > +{
    > + guid_t guid = LINUX_EFI_UNACCEPTED_MEM_TABLE_GUID;
    > + struct efi_unaccepted_memory *unaccepted_table;
    > + unsigned long cfg_table_pa;
    > + unsigned int cfg_table_len;
    > + int ret;
    > +
    > + ret = efi_get_conf_table(boot_params, &cfg_table_pa, &cfg_table_len);
    > + if (ret)
    > + error("EFI config table not found.");
    > +
    > + unaccepted_table = (void *)efi_find_vendor_table(boot_params,
    > + cfg_table_pa,
    > + cfg_table_len,
    > + guid);
    > + if (unaccepted_table->version != 1)
    > + error("Unknown version of unaccepted memory table\n");
    > +
    > + set_unaccepted_table(unaccepted_table);
    > +}

    0-day reported boot failure outdise TDX guest with CONFIG_INTEL_TDX_GUEST=y.

    The fixup:

    diff --git a/arch/x86/boot/compressed/mem.c b/arch/x86/boot/compressed/mem.c
    index 0108c97399a5..8df3d988ae69 100644
    --- a/arch/x86/boot/compressed/mem.c
    +++ b/arch/x86/boot/compressed/mem.c
    @@ -56,6 +56,9 @@ void init_unaccepted_memory(void)
    cfg_table_pa,
    cfg_table_len,
    guid);
    + if (!unaccepted_table)
    + return;
    +
    if (unaccepted_table->version != 1)
    error("Unknown version of unaccepted memory table\n");

    --
    Kiryl Shutsemau / Kirill A. Shutemov
    \
     
     \ /
      Last update: 2023-05-19 12:17    [W:4.735 / U:0.072 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site