[PATCH v6 05/14] x86: Secure Launch main header file

Ross Philipson ross.philipson at oracle.com
Fri May 5 10:37:43 PDT 2023


On 5/5/23 12:25, Simon Horman wrote:
> On Thu, May 04, 2023 at 02:50:14PM +0000, Ross Philipson wrote:
>> Introduce the main Secure Launch header file used in the early SL stub
>> and the early setup code.
>>
>> Signed-off-by: Ross Philipson <ross.philipson at oracle.com>
>> ---
>>   include/linux/slaunch.h | 513 ++++++++++++++++++++++++++++++++++++++++++++++++
>>   1 file changed, 513 insertions(+)
>>   create mode 100644 include/linux/slaunch.h
>>
>> diff --git a/include/linux/slaunch.h b/include/linux/slaunch.h
> 
> ...
> 
>> +/* TXTCR_STS status bits */
>> +#define TXT_SENTER_DONE_STS		(1<<0)
>> +#define TXT_SEXIT_DONE_STS		(1<<1)
> 
> nit: Please consider using BIT()

Ack

> 
> ...
> 
>> +/*
>> + * External functions avalailable in mainline kernel.
>> + */
>> +extern void slaunch_setup_txt(void);
>> +extern u32 slaunch_get_flags(void);
>> +extern struct sl_ap_wake_info *slaunch_get_ap_wake_info(void);
>> +extern struct acpi_table_header *slaunch_get_dmar_table(struct acpi_table_header *dmar);
>> +extern void __noreturn slaunch_txt_reset(void __iomem *txt,
>> +					 const char *msg, u64 error);
>> +extern void slaunch_finalize(int do_sexit);
> 
> I think that extern should be avoided.
> Perhaps these are in a header file that can be included?

Someone in an earlier review asked me to add the externs. The function 
are not in another header, they are in a C module.

> 
>> +
>> +#endif /* !__ASSEMBLY */
>> +
>> +#else
>> +
>> +#define slaunch_setup_txt()		do { } while (0)
>> +#define slaunch_get_flags()		0
>> +#define slaunch_get_dmar_table(d)	(d)
>> +#define slaunch_finalize(d)		do { } while (0)
> 
> I think it is usual to use static functions for this purpose.
> Usually they end up in header files as static inline functions.

Yea we can switch to using static functions.

Thanks
Ross

> 
>> +
>> +#endif /* !IS_ENABLED(CONFIG_SECURE_LAUNCH) */
>> +
>> +#endif /* _LINUX_SLAUNCH_H */




More information about the kexec mailing list