RE: [PATCH v3 03/14] vfio/type1: Report iommu nesting info to userspace
From: Liu, Yi L
Date: Fri Jul 03 2020 - 09:03:26 EST
Hi Alex,
> From: Liu, Yi L <yi.l.liu@xxxxxxxxx>
> Sent: Friday, July 3, 2020 2:06 PM
[...]
> > > +#define VFIO_IOMMU_TYPE1_INFO_CAP_NESTING 3
> > > +
> > > +struct vfio_iommu_type1_info_cap_nesting {
> > > + struct vfio_info_cap_header header;
> > > + __u32 flags;
> >
> > I think there's an alignment issue here for a uapi. The header field
> > is 8-bytes total and info[] should start at an 8-byte alignment to
> > allow data[] within info to have 8-byte alignment. This could lead to
> > the structure having a compiler dependent size and offsets. We should
> > add a 4-byte reserved field here to resolve.
>
> got it. or how about defining the flags as __u64?
>
> >
> > > + __u8 info[];
> > > +};
> >
> > This should have a lot more description around it, a user could not
> > infer that info[] is including a struct iommu_nesting_info from the
> > information provided here.
> > Thanks,
>
> sure. BTW. do you think it is necessary to add a flag to indicate the info[] is a
> struct iommu_nesting_info? or as a start, it's not necessary to do it.
seems like I misunderstood your comment. Does below description suits
your comment?
/*
* Reporting nesting info to user space.
*
* @info: the nesting info provided by IOMMU driver. Today
* it is expected to be a struct iommu_nesting_info
* data.
*/
struct vfio_iommu_type1_info_cap_nesting {
struct vfio_info_cap_header header;
__u32 flags;
__u32 padding;
__u8 info[];
};
Thanks,
Yi Liu
> Regards,
> Yi Liu
>
> > Alex
> >
> > > +
> > > #define VFIO_IOMMU_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12)
> > >
> > > /**