Re: [PATCH v4 3/8] x86/virt/tdx: Prepare to support reading other global metadata fields

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2024-10-01 at 21:40 +0000, Huang, Kai wrote:
> On Tue, 2024-10-01 at 08:19 -0700, Dave Hansen wrote:
> > On 10/1/24 03:44, Huang, Kai wrote:
> > > Please let me know if you have any concern?  Otherwise I will go with
> > > this route.
> > I still see some long unwieldy #defines in the mail thread.  That's my
> > biggest worry.
> 
> I suppose you mean the read_sys_metadata_field() macro?
> 
> We can split that into two smaller macros by moving BUILD_BUG_ON() out:
> 
> /* Don't use this directly, use read_sys_metadata_read() instead. */
> #define __read_sys_metadata_field(_field_id, _valptr)   \
> ({                                                      \
>         u64 ___tmp;                                     \
>         int ___ret;                                     \
>                                                         \
>         ___ret = tdh_sys_rd(_field_id, &___tmp);        \
>         *_valptr = ___tmp;                              \
>                                                         \
>         ___ret;                                         \
> })
> 
> /* @_valptr must be pointer of u8/u16/u32/u64. */
> #define read_sys_metadata_field(_field_id, _valptr)     \
> ({                                                      \
>         BUILD_BUG_ON(MD_FIELD_ELE_SIZE(_field_id) !=    \
>                         sizeof(*_valptr));              \
>         __read_sys_metadata_field(_field_id, _valptr);  \
> })
> 
> Does this look good to you?

Hi Dave,

Would you let me know are you OK with this?

If not, I will revert back to what you suggested:

https://lore.kernel.org/lkml/cover.1727173372.git.kai.huang@xxxxxxxxx/T/#m3874080ef158a4704c4082259d3594aa0a322fc8




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux