commit
e03327122e2c ("pci_endpoint_test: Add 2 ioctl commands")
uses module parameter 'irqtype' in pci_endpoint_test_set_irq()
to check if IRQ vectors of a particular type (MSI or MSI-X or
LEGACY) is already allocated. However with multi-function devices,
'irqtype' will not correctly reflect the IRQ type of the PCI device.
Fix it here by adding 'irqtype' for each PCI device to show the
IRQ type of a particular PCI device.
Fixes:
e03327122e2c ("pci_endpoint_test: Add 2 ioctl commands")
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: stable@vger.kernel.org # v4.19+
struct completion irq_raised;
int last_irq;
int num_irqs;
struct completion irq_raised;
int last_irq;
int num_irqs;
/* mutex to protect the ioctls */
struct mutex mutex;
struct miscdevice miscdev;
/* mutex to protect the ioctls */
struct mutex mutex;
struct miscdevice miscdev;
struct pci_dev *pdev = test->pdev;
pci_free_irq_vectors(pdev);
struct pci_dev *pdev = test->pdev;
pci_free_irq_vectors(pdev);
+ test->irq_type = IRQ_TYPE_UNDEFINED;
}
static bool pci_endpoint_test_alloc_irq_vectors(struct pci_endpoint_test *test,
}
static bool pci_endpoint_test_alloc_irq_vectors(struct pci_endpoint_test *test,
+
+ test->irq_type = type;
test->num_irqs = irq;
return res;
test->num_irqs = irq;
return res;
dma_addr_t orig_dst_phys_addr;
size_t offset;
size_t alignment = test->alignment;
dma_addr_t orig_dst_phys_addr;
size_t offset;
size_t alignment = test->alignment;
+ int irq_type = test->irq_type;
u32 src_crc32;
u32 dst_crc32;
int err;
u32 src_crc32;
u32 dst_crc32;
int err;
dma_addr_t orig_phys_addr;
size_t offset;
size_t alignment = test->alignment;
dma_addr_t orig_phys_addr;
size_t offset;
size_t alignment = test->alignment;
+ int irq_type = test->irq_type;
size_t size;
u32 crc32;
int err;
size_t size;
u32 crc32;
int err;
dma_addr_t orig_phys_addr;
size_t offset;
size_t alignment = test->alignment;
dma_addr_t orig_phys_addr;
size_t offset;
size_t alignment = test->alignment;
+ int irq_type = test->irq_type;
- if (irq_type == req_irq_type)
+ if (test->irq_type == req_irq_type)
return true;
pci_endpoint_test_release_irq(test);
return true;
pci_endpoint_test_release_irq(test);
if (!pci_endpoint_test_request_irq(test))
goto err;
if (!pci_endpoint_test_request_irq(test))
goto err;
- irq_type = req_irq_type;
return true;
err:
pci_endpoint_test_free_irq_vectors(test);
return true;
err:
pci_endpoint_test_free_irq_vectors(test);
- irq_type = IRQ_TYPE_UNDEFINED;
test->test_reg_bar = 0;
test->alignment = 0;
test->pdev = pdev;
test->test_reg_bar = 0;
test->alignment = 0;
test->pdev = pdev;
+ test->irq_type = IRQ_TYPE_UNDEFINED;
if (no_msi)
irq_type = IRQ_TYPE_LEGACY;
if (no_msi)
irq_type = IRQ_TYPE_LEGACY;