Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

misc: pci_endpoint_test: Add support to not enable MSI interrupts

Some platforms like TI's K2G have a restriction that the host side buffer
address should be aligned to either 1MB/2MB/4MB or 8MB addresses depending
on how it is configured in the endpoint (Ref: 11.14.4.9.1 Outbound Address
Translation in K2G TRM SPRUHY8F January 2016 – Revised May 2017). This
restriction also applies to the MSI addresses provided by the RC. However
it's not possible for the RC to know about this restriction and it may not
provide 1MB/2MB/4MB or 8MB aligned address. So MSI interrupts should be
disabled even if the K2G EP has MSI capabiltiy register.

Add support to not enable MSI interrupts in pci_endpoint_test driver so
that it can be used to test K2G EP.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

authored by

Kishon Vijay Abraham I and committed by
Bjorn Helgaas
0b91516a 13107c60

+9 -4
+9 -4
drivers/misc/pci_endpoint_test.c
··· 97 97 struct pci_endpoint_test_data { 98 98 enum pci_barno test_reg_bar; 99 99 size_t alignment; 100 + bool no_msi; 100 101 }; 101 102 102 103 static int bar_size[] = { 512, 512, 1024, 16384, 131072, 1048576 }; ··· 450 449 { 451 450 int i; 452 451 int err; 453 - int irq; 452 + int irq = 0; 454 453 int id; 454 + bool no_msi = false; 455 455 char name[20]; 456 456 enum pci_barno bar; 457 457 void __iomem *base; ··· 477 475 if (data) { 478 476 test_reg_bar = data->test_reg_bar; 479 477 test->alignment = data->alignment; 478 + no_msi = data->no_msi; 480 479 } 481 480 482 481 init_completion(&test->irq_raised); ··· 497 494 498 495 pci_set_master(pdev); 499 496 500 - irq = pci_alloc_irq_vectors(pdev, 1, 32, PCI_IRQ_MSI); 501 - if (irq < 0) 502 - dev_err(dev, "failed to get MSI interrupts\n"); 497 + if (!no_msi) { 498 + irq = pci_alloc_irq_vectors(pdev, 1, 32, PCI_IRQ_MSI); 499 + if (irq < 0) 500 + dev_err(dev, "failed to get MSI interrupts\n"); 501 + } 503 502 504 503 err = devm_request_irq(dev, pdev->irq, pci_endpoint_test_irqhandler, 505 504 IRQF_SHARED, DRV_MODULE_NAME, test);