]> git.baikalelectronics.ru Git - kernel.git/commitdiff
x86/boot: Add a pointer to Confidential Computing blob in bootparams
authorMichael Roth <michael.roth@amd.com>
Thu, 24 Feb 2022 16:56:13 +0000 (10:56 -0600)
committerBorislav Petkov <bp@suse.de>
Thu, 7 Apr 2022 14:47:11 +0000 (16:47 +0200)
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 that enforcement for the run-time kernel, similar
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 ugliness.

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.

Also document these in Documentation/x86/zero-page.rst. While there,
add missing documentation for the acpi_rsdp_addr field, which serves a
similar purpose in providing the run-time kernel a pointer to the ACPI
RSDP table so that it does not need to [re-]scan the EFI configuration
table.

  [ bp: Fix typos, massage commit message. ]

Signed-off-by: Michael Roth <michael.roth@amd.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lore.kernel.org/r/20220307213356.2797205-34-brijesh.singh@amd.com
Documentation/x86/zero-page.rst
arch/x86/include/asm/bootparam_utils.h
arch/x86/include/uapi/asm/bootparam.h

index f088f58816668fa455a0317b068e3200b471f68f..45aa9cceb4f1940eb9cda3a7176805986008c8ce 100644 (file)
@@ -19,6 +19,7 @@ Offset/Size   Proto   Name                    Meaning
 058/008                ALL     tboot_addr              Physical address of tboot shared page
 060/010                ALL     ist_info                Intel SpeedStep (IST) BIOS support information
                                                (struct ist_info)
+070/008                ALL     acpi_rsdp_addr          Physical address of ACPI RSDP table
 080/010                ALL     hd0_info                hd0 disk parameter, OBSOLETE!!
 090/010                ALL     hd1_info                hd1 disk parameter, OBSOLETE!!
 0A0/010                ALL     sys_desc_table          System description table (struct sys_desc_table),
@@ -27,6 +28,7 @@ Offset/Size   Proto   Name                    Meaning
 0C0/004                ALL     ext_ramdisk_image       ramdisk_image high 32bits
 0C4/004                ALL     ext_ramdisk_size        ramdisk_size high 32bits
 0C8/004                ALL     ext_cmd_line_ptr        cmd_line_ptr high 32bits
+13C/004                ALL     cc_blob_address         Physical address of Confidential Computing blob
 140/080                ALL     edid_info               Video mode setup (struct edid_info)
 1C0/020                ALL     efi_info                EFI 32 information (struct efi_info)
 1E0/004                ALL     alt_mem_k               Alternative mem check, in KB
index 981fe923a59fe5983d385ee042e339aa6cfd131f..53e9b0620d969339a6f1aa890256fc7cc93b2968 100644 (file)
@@ -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));
index 1ac5acca72ceb3a4a8d4813f09abf23b60a7aa36..bea5cdcdf53252bf4fed4199ee2c7b11a48416ac 100644 (file)
@@ -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 */