On Tue, Oct 29, 2024 at 12:27:46PM -0300, Jason Gunthorpe wrote:
> On Mon, Oct 28, 2024 at 07:52:10AM -0700, Nicolin Chen wrote:
> > On Mon, Oct 28, 2024 at 10:03:09AM -0300, Jason Gunthorpe wrote:
> > In iommufd_hwpt_paging_alloc(), we reject IOMMU_HWPT_FAULT_ID_VALID:
> >     const u32 valid_flags = IOMMU_HWPT_ALLOC_NEST_PARENT |
> >                             IOMMU_HWPT_ALLOC_DIRTY_TRACKING;
> >     ...
> >     if (flags & ~valid_flags)
> >             return ERR_PTR(-EOPNOTSUPP);
> > 
> > In iommufd_hwpt_nested_alloc(), we mask the flag away:
> >     if ((flags & ~IOMMU_HWPT_FAULT_ID_VALID) ||
> >         !user_data->len || !ops->domain_alloc_user)
> >             return ERR_PTR(-EOPNOTSUPP);
> >     ...
> >     hwpt->domain = ops->domain_alloc_user(idev->dev,
> >                                           flags & 
> > ~IOMMU_HWPT_FAULT_ID_VALID,
> >                                           parent->common.domain, user_data);
> > 
> > Then, in the common function it has a section of
> >     if (cmd->flags & IOMMU_HWPT_FAULT_ID_VALID) {
> >     ...
> > 
> > It seems that this IOMMU_HWPT_FAULT_ID_VALID is for nested domains?
> 
> OK, but ARM should be blocking it since it doesn't work there.
> 
> I think we made some error here, it should have been passed in flags
> to the drivers and only intel should have accepted it.

Trying to limit changes here since two parts are already quite
large, I think a separate series fixing that would be nicer? 

> This suggests we should send flags down the viommu alloc domain path too.

Ack. Will pass it in.

Thanks
Nicolin

Reply via email to