[PATCH v13 04/19] x86: Secure Launch main header file
ross.philipson at oracle.com
ross.philipson at oracle.com
Tue Apr 15 14:04:03 PDT 2025
On 4/12/25 11:34 AM, ALOK TIWARI wrote:
>
>
> On 11-04-2025 02:11, Ross Philipson wrote:
>> Introduce the main Secure Launch header file used in the early SL stub
>> and the early setup code.
>>
>> This header file contains the following categories:
>> - Secure Launch implementation specific structures and definitions.
>> - Intel TXT architecture specific DRTM structures, definitions and
>> functions
>> used by Secure Launch.
>> - DRTM TPM event logging definitions and helper functions.
>>
>> Signed-off-by: Ross Philipson <ross.philipson at oracle.com>
>> ---
>
>
>> +#define TXT_HEAP_EXTDATA_TYPE_TPM_EVENT_LOG_PTR 5
>> +
>> +struct txt_heap_event_log_element {
>> + u64 event_log_phys_addr;
>> +} __packed;
>> +
>
> can be consistence with PTR
The names come from the TXT spec for the most part. But maybe it will
look better if I change it. Will see.
>
>> +#define TXT_HEAP_EXTDATA_TYPE_EVENT_LOG_POINTER2_1 8
>> +
>> +struct txt_heap_event_log_pointer2_1_element {
>> + u64 phys_addr;
>> + u32 allocated_event_container_size;
>> + u32 first_record_offset;
>> + u32 next_record_offset;
>> +} __packed;
>
>
>
>> +/*
>> + * Find the TPM v2 event log element in the TXT heap. This element
>> contains
>> + * the information about the size and location of the DRTM event log.
>> Note
>> + * this is a TXT specific structure.
>> + *
>> + * See:
>> + * Intel Trusted Execution Technology - Measured Launch Environment
>> Developer's Guide - Appendix C.
>> + */
>> +static inline struct txt_heap_event_log_pointer2_1_element*
>> +tpm2_find_log2_1_element(struct txt_os_sinit_data *os_sinit_data)
>> +{
>> + struct txt_heap_ext_data_element *ext_elem;
>> +
>> + /* The extended element array as at the end of this table */
>> + ext_elem = (struct txt_heap_ext_data_element *)
>> + ((u8 *)os_sinit_data + sizeof(struct txt_os_sinit_data));
>> +
>> + while (ext_elem->type != TXT_HEAP_EXTDATA_TYPE_END) {
>> + if (ext_elem->type ==
>> + TXT_HEAP_EXTDATA_TYPE_EVENT_LOG_POINTER2_1) {
>> + return (struct txt_heap_event_log_pointer2_1_element *)
>> + ((u8 *)ext_elem +
>> + sizeof(struct txt_heap_ext_data_element));
>
> indentation can be better here
Ack
>
>> + }
>> + ext_elem =
>> + (struct txt_heap_ext_data_element *)
>> + ((u8 *)ext_elem + ext_elem->size);
>> + }
>> +
>> + return NULL;
>> +}
>> +
> '
Was there an extra empty space here? I will check.
> '
>> +
>> +/*
>> + * External functions avalailable in mainline kernel.
>
> typo avalailable -> available
Ack
>
>> + */
>> +void slaunch_setup_txt(void);
>> +void slaunch_fixup_jump_vector(void);
>> +u32 slaunch_get_flags(void);
>> +struct sl_ap_wake_info *slaunch_get_ap_wake_info(void);
>> +struct acpi_table_header *slaunch_get_dmar_table(struct
>> acpi_table_header *dmar);
>> +void __noreturn slaunch_txt_reset(void __iomem *txt,
>> + const char *msg, u64 error);
>> +void slaunch_finalize(int do_sexit);
>> +
>> +static inline bool slaunch_is_txt_launch(void)
>> +{
>> + u32 mask = SL_FLAG_ACTIVE | SL_FLAG_ARCH_TXT;
>
> extra ' ' after =
Ack will fix these.
>
>> +
>> + return (slaunch_get_flags() & mask) == mask;
>> +}
>
>
> Thanks,
> Alok
>
Thanks
Ross
More information about the kexec
mailing list