Re: [PATCH 8/9] x86/virt/tdx: Exclude memory region hole within CMR as TDMR's reserved area

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

 



> > > +/* Wrapper to read one metadata field to u8/u16/u32/u64 */
> > > +#define stbuf_read_sysmd_single(_field_id, _pdata)	\
> > > +	stbuf_read_sysmd_field(_field_id, _pdata, 0, sizeof(typeof(*(_pdata))))
> > 
> > What value does adding yet another level of indirection bring here?
> 
> We could use the raw version instead: read_sys_metadata_field().
> 
> This wrapper additionally checks the 'element size' encoded in the field
> ID matches the size that passed in, so it can catch potential kernel bug.
> 
> But I can remove this to simplify the code.
> 

Sorry I didn't finish my reply properly as I was interrupted.

Another advantage of this wrapper is, as mentioned in the comment of it,
it works with 'u8/u16/u32/u64' directly, while the raw
read_sys_metadata_field() always puts data to a 'u64'.

An example is, ...

> > > +
> > > +	ret = stbuf_read_sysmd_single(MD_FIELD_ID_NUM_CMRS,
> > > +			&cmr_info->num_cmrs);
> > > +	if (ret)
> > > +		return ret;
> > > +
> > > 

... here to read cmr_info->num_cmrs, which is a 'u16'.

So it is helpful to me.





[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