lkml.org 
[lkml]   [2021]   [Nov]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v7 35/45] x86/boot: add a pointer to Confidential Computing blob in bootparams
    Date
    From: Michael Roth <michael.roth@amd.com>

    The previously defined Confidential Computing blob is provided to the
    kernel via a setup_data structure or EFI config table entry. Currently
    these are both checked for by boot/compressed kernel to access the
    CPUID table address within it for use with SEV-SNP CPUID enforcement.

    To also enable SEV-SNP CPUID enforcement for the run-time kernel,
    similar early access to the CPUID table is needed early on while it's
    still using the identity-mapped page table set up by boot/compressed,
    where global pointers need to be accessed via fixup_pointer().

    This isn't much of an issue for accessing setup_data, and the EFI
    config table helper code currently used in boot/compressed *could* be
    used in this case as well since they both rely on identity-mapping.
    However, it has some reliance on EFI helpers/string constants that
    would need to be accessed via fixup_pointer(), and fixing it up while
    making it shareable between boot/compressed and run-time kernel is
    fragile and introduces a good bit of uglyness.

    Instead, add a boot_params->cc_blob_address pointer that the
    boot/compressed kernel can initialize so that the run-time kernel can
    access the CC blob from there instead of re-scanning the EFI config
    table.

    Signed-off-by: Michael Roth <michael.roth@amd.com>
    Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
    ---
    arch/x86/include/asm/bootparam_utils.h | 1 +
    arch/x86/include/uapi/asm/bootparam.h | 3 ++-
    2 files changed, 3 insertions(+), 1 deletion(-)

    diff --git a/arch/x86/include/asm/bootparam_utils.h b/arch/x86/include/asm/bootparam_utils.h
    index 981fe923a59f..53e9b0620d96 100644
    --- a/arch/x86/include/asm/bootparam_utils.h
    +++ b/arch/x86/include/asm/bootparam_utils.h
    @@ -74,6 +74,7 @@ static void sanitize_boot_params(struct boot_params *boot_params)
    BOOT_PARAM_PRESERVE(hdr),
    BOOT_PARAM_PRESERVE(e820_table),
    BOOT_PARAM_PRESERVE(eddbuf),
    + BOOT_PARAM_PRESERVE(cc_blob_address),
    };

    memset(&scratch, 0, sizeof(scratch));
    diff --git a/arch/x86/include/uapi/asm/bootparam.h b/arch/x86/include/uapi/asm/bootparam.h
    index 1ac5acca72ce..bea5cdcdf532 100644
    --- a/arch/x86/include/uapi/asm/bootparam.h
    +++ b/arch/x86/include/uapi/asm/bootparam.h
    @@ -188,7 +188,8 @@ struct boot_params {
    __u32 ext_ramdisk_image; /* 0x0c0 */
    __u32 ext_ramdisk_size; /* 0x0c4 */
    __u32 ext_cmd_line_ptr; /* 0x0c8 */
    - __u8 _pad4[116]; /* 0x0cc */
    + __u8 _pad4[112]; /* 0x0cc */
    + __u32 cc_blob_address; /* 0x13c */
    struct edid_info edid_info; /* 0x140 */
    struct efi_info efi_info; /* 0x1c0 */
    __u32 alt_mem_k; /* 0x1e0 */
    --
    2.25.1
    \
     
     \ /
      Last update: 2021-11-10 23:11    [W:2.132 / U:0.052 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site