Re: [PATCH v9 29/43] x86/boot: Add Confidential Computing type to setup_data

From: Borislav Petkov
Date: Fri Feb 04 2022 - 11:22:05 EST


On Fri, Jan 28, 2022 at 11:17:50AM -0600, Brijesh Singh wrote:
> +/*
> + * AMD SEV Confidential computing blob structure. The structure is
> + * defined in OVMF UEFI firmware header:
> + * https://github.com/tianocore/edk2/blob/master/OvmfPkg/Include/Guid/ConfidentialComputingSevSnpBlob.h

So looking at that typedef struct CONFIDENTIAL_COMPUTING_SNP_BLOB_LOCATION there:

typedef struct {
UINT32 Header;
UINT16 Version;
UINT16 Reserved1;
UINT64 SecretsPhysicalAddress;
UINT32 SecretsSize;
UINT64 CpuidPhysicalAddress;
UINT32 CpuidLSize;
} CONFIDENTIAL_COMPUTING_SNP_BLOB_LOCATION;

> + */
> +#define CC_BLOB_SEV_HDR_MAGIC 0x45444d41
> +struct cc_blob_sev_info {
> + u32 magic;

That's called "Header" there.

> + u16 version;
> + u16 reserved;
> + u64 secrets_phys;
> + u32 secrets_len;
> + u32 rsvd1;

You've added that member for padding but the fw blob one doesn't have
it.

But if we get a blob from the firmware and the structure layout differs,
how is this supposed to even work?

> + u64 cpuid_phys;
> + u32 cpuid_len;
> + u32 rsvd2;

That one too.

Or are you going to change the blob layout in ovmf too, to match?

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette