Re: [PATCH v8 06/10] iommufd: Add iommufd fault object

From: Jason Gunthorpe
Date: Mon Jul 08 2024 - 12:23:27 EST


On Fri, Jul 05, 2024 at 12:49:10AM +0000, Tian, Kevin wrote:

> > > > > > > +enum iommu_fault_type {
> > > > > > > + IOMMU_FAULT_TYPE_HWPT_IOPF,
> > > > > > > + IOMMU_FAULT_TYPE_VIOMMU_IRQ,
> > > > > > > +};
> > > > > > >
> > > > > > > struct iommu_fault_alloc {
> > > > > > > __u32 size;
> > > > > > > __u32 flags;
> > > > > > > + __u32 type; /* enum iommu_fault_type */
> > > > > > > __u32 out_fault_id;
> > > > > > > __u32 out_fault_fd;
> > > > and need a new reserved field for alignment.
> >
> > Hmm, what's the reason for enforcing a 64-bit alignment to an
> > all-u32 struct though? I thought we need a reserved field only
> > for padding. The struct iommu_ioas_alloc has three u32 members
> > for example?
>
> yeah please ignore this comment.

Sometimes I encourage it so that people notice the if the structure is
changed later. Almost all structs here are 8 byte aligned. It is OK
like this too.

Jason