From: Nicolin Chen nicolinc@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?