Thread (77 messages) 77 messages, 4 authors, 2025-01-23

RE: [PATCH v5 08/14] iommufd/viommu: Add iommufd_viommu_report_event helper

From: "Tian, Kevin" <kevin.tian@intel.com>
Date: 2025-01-10 07:13:33
Also in: linux-doc, linux-iommu, linux-kselftest, linux-patches, lkml

From: Nicolin Chen <redacted>
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-
quoted
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?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help