lkml.org 
[lkml]   [2023]   [Apr]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH RFC v3 2/4] iommufd: Add IOMMUFD_CMD_DEVICE_SET_DATA and IOMMUFD_CMD_DEVICE_UNSET_DATA
Hi Baolu,

On Mon, Apr 24, 2023 at 10:44:08AM +0800, Baolu Lu wrote:

> On 4/23/23 3:40 PM, Nicolin Chen wrote:
> > Add a new pair of ioctls to allow user space to set and unset its iommu-
> > specific device data for a passthrough device that's behind the iommu.
> >
> > On platforms with SMMUv3, this new uAPIs will be used to forward a user
> > space virtual Stream ID of a passthrough device to link to its physical
> > Stream ID and log into a lookup table, in order for the host kernel to
> > later run sanity on ATC invalidation requests from the user space, with
> > ATC_INV commands that have SID fields (virtual Stream IDs).
> >
> > Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
> > ---
> > drivers/iommu/iommufd/device.c | 81 +++++++++++++++++++++++++
> > drivers/iommu/iommufd/iommufd_private.h | 3 +
> > drivers/iommu/iommufd/main.c | 4 ++
> > include/uapi/linux/iommufd.h | 32 ++++++++++
> > 4 files changed, 120 insertions(+)
> >
> > diff --git a/drivers/iommu/iommufd/device.c b/drivers/iommu/iommufd/device.c
> > index c649a3403797..9480cd36a8bd 100644
> > --- a/drivers/iommu/iommufd/device.c
> > +++ b/drivers/iommu/iommufd/device.c
> > @@ -136,6 +136,8 @@ void iommufd_device_destroy(struct iommufd_object *obj)
> > struct iommufd_device *idev =
> > container_of(obj, struct iommufd_device, obj);
> >
> > + if (WARN_ON(idev->has_user_data))
> > + dev_iommu_ops(idev->dev)->unset_dev_user_data(idev->dev);
>
> Do you really need this WARN_ON()? The user space application can easily
> trigger this kernel WARN() by setting the user data and forgetting to
> unset it.

I can drop that, since it's a user triggerable one.

Thanks
Nic

\
 
 \ /
  Last update: 2023-04-24 20:52    [W:0.031 / U:0.284 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site