MCPcopy Create free account
hub / github.com/F-Stack/f-stack / vfio_disable_intx

Function vfio_disable_intx

dpdk/lib/eal/linux/eal_interrupts.c:151–192  ·  view source on GitHub ↗

disable legacy (INTx) interrupts */

Source from the content-addressed store, hash-verified

149
150/* disable legacy (INTx) interrupts */
151static int
152vfio_disable_intx(const struct rte_intr_handle *intr_handle) {
153 struct vfio_irq_set *irq_set;
154 char irq_set_buf[IRQ_SET_BUF_LEN];
155 int len, ret, vfio_dev_fd;
156
157 len = sizeof(struct vfio_irq_set);
158
159 /* mask interrupts before disabling */
160 irq_set = (struct vfio_irq_set *) irq_set_buf;
161 irq_set->argsz = len;
162 irq_set->count = 1;
163 irq_set->flags = VFIO_IRQ_SET_DATA_NONE | VFIO_IRQ_SET_ACTION_MASK;
164 irq_set->index = VFIO_PCI_INTX_IRQ_INDEX;
165 irq_set->start = 0;
166
167 vfio_dev_fd = rte_intr_dev_fd_get(intr_handle);
168 ret = ioctl(vfio_dev_fd, VFIO_DEVICE_SET_IRQS, irq_set);
169
170 if (ret) {
171 RTE_LOG(ERR, EAL, "Error masking INTx interrupts for fd %d\n",
172 rte_intr_fd_get(intr_handle));
173 return -1;
174 }
175
176 /* disable INTx*/
177 memset(irq_set, 0, len);
178 irq_set->argsz = len;
179 irq_set->count = 0;
180 irq_set->flags = VFIO_IRQ_SET_DATA_NONE | VFIO_IRQ_SET_ACTION_TRIGGER;
181 irq_set->index = VFIO_PCI_INTX_IRQ_INDEX;
182 irq_set->start = 0;
183
184 ret = ioctl(vfio_dev_fd, VFIO_DEVICE_SET_IRQS, irq_set);
185
186 if (ret) {
187 RTE_LOG(ERR, EAL, "Error disabling INTx interrupts for fd %d\n",
188 rte_intr_fd_get(intr_handle));
189 return -1;
190 }
191 return 0;
192}
193
194/* unmask/ack legacy (INTx) interrupts */
195static int

Callers 1

rte_intr_disableFunction · 0.85

Calls 4

rte_intr_dev_fd_getFunction · 0.85
rte_intr_fd_getFunction · 0.85
memsetFunction · 0.85
ioctlFunction · 0.50

Tested by

no test coverage detected