[PATCH v5 08/14] iommufd/viommu: Add iommufd_viommu_report_event helper
Tian, Kevin
kevin.tian at intel.com
Thu Jan 9 23:12:46 PST 2025
> From: Nicolin Chen <nicolinc at nvidia.com>
> Sent: Wednesday, January 8, 2025 1:10 AM
>
> +/*
> + * Typically called in driver's threaded IRQ handler.
> + * The @type and @event_data must be defined in
> include/uapi/linux/iommufd.h
> + */
> +int iommufd_viommu_report_event(struct iommufd_viommu *viommu,
> + enum iommu_veventq_type type, void
> *event_data,
> + size_t data_len)
> +{
> + struct iommufd_veventq *veventq;
> + struct iommufd_vevent *vevent;
> + int rc = 0;
> +
> + if (!viommu)
> + return -ENODEV;
> + if (WARN_ON_ONCE(!viommu->ops || !viommu->ops-
> >supports_veventq ||
> + !viommu->ops->supports_veventq(type)))
> + return -EOPNOTSUPP;
Hmm the driver knows which type is supported by itself before
calling this helper. Why bother having the helper calling into
the driver again to verify?
More information about the linux-arm-kernel
mailing list