History

fpga: dfl: afu: add interrupt support for port error reporting

Error reporting interrupt is very useful to notify users that some errors are detected by the hardware. Once users are notified, they could query hardware logged error states, no need to continuously poll on these states. This patch adds interrupt support for port error reporting sub feature. It follows the common DFL interrupt notification and handling mechanism, implements two ioctl commands below for user to query number of irqs supported, and set/unset interrupt triggers. Ioctls: * DFL_FPGA_PORT_ERR_GET_IRQ_NUM get the number of irqs, which is used to determine whether/how many interrupts error reporting feature supports. * DFL_FPGA_PORT_ERR_SET_IRQ set/unset given eventfds as error interrupt triggers.

Xu Yilun committed 6 years ago

Commit fe6a3d61 parent 322b5983 files · +44 −0Browse files

Showing the changes to include/uapi/linux (1 of 3 files). Show all

Unified · Split

include/uapi/linux/fpga-dfl.h+23−0
@@ -164,6 +164,29 @@ struct dfl_fpga_irq_set { · 163 unmodified lines
164164 __s32 evtfds[];
165165 };
166166
167+/**
168+ * DFL_FPGA_PORT_ERR_GET_IRQ_NUM - _IOR(DFL_FPGA_MAGIC, DFL_PORT_BASE + 5,
169+ * __u32 num_irqs)
170+ *
171+ * Get the number of irqs supported by the fpga port error reporting private
172+ * feature. Currently hardware supports up to 1 irq.
173+ * Return: 0 on success, -errno on failure.
174+ */
175+#define DFL_FPGA_PORT_ERR_GET_IRQ_NUM _IOR(DFL_FPGA_MAGIC, \
176+ DFL_PORT_BASE + 5, __u32)
177+
178+/**
179+ * DFL_FPGA_PORT_ERR_SET_IRQ - _IOW(DFL_FPGA_MAGIC, DFL_PORT_BASE + 6,
180+ * struct dfl_fpga_irq_set)
181+ *
182+ * Set fpga port error reporting interrupt trigger if evtfds[n] is valid.
183+ * Unset related interrupt trigger if evtfds[n] is a negative value.
184+ * Return: 0 on success, -errno on failure.
185+ */
186+#define DFL_FPGA_PORT_ERR_SET_IRQ _IOW(DFL_FPGA_MAGIC, \
187+ DFL_PORT_BASE + 6, \
188+ struct dfl_fpga_irq_set)
189+
167190 /* IOCTLs for FME file descriptor */
168191
169192 /**