Skip to content

Commit 0b91516

Browse files
kishonbjorn-helgaas
authored andcommitted
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 <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]>
1 parent 13107c6 commit 0b91516

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

drivers/misc/pci_endpoint_test.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ struct pci_endpoint_test {
9797
struct pci_endpoint_test_data {
9898
enum pci_barno test_reg_bar;
9999
size_t alignment;
100+
bool no_msi;
100101
};
101102

102103
static int bar_size[] = { 512, 512, 1024, 16384, 131072, 1048576 };
@@ -449,8 +450,9 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
449450
{
450451
int i;
451452
int err;
452-
int irq;
453+
int irq = 0;
453454
int id;
455+
bool no_msi = false;
454456
char name[20];
455457
enum pci_barno bar;
456458
void __iomem *base;
@@ -475,6 +477,7 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
475477
if (data) {
476478
test_reg_bar = data->test_reg_bar;
477479
test->alignment = data->alignment;
480+
no_msi = data->no_msi;
478481
}
479482

480483
init_completion(&test->irq_raised);
@@ -494,9 +497,11 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
494497

495498
pci_set_master(pdev);
496499

497-
irq = pci_alloc_irq_vectors(pdev, 1, 32, PCI_IRQ_MSI);
498-
if (irq < 0)
499-
dev_err(dev, "failed to get MSI interrupts\n");
500+
if (!no_msi) {
501+
irq = pci_alloc_irq_vectors(pdev, 1, 32, PCI_IRQ_MSI);
502+
if (irq < 0)
503+
dev_err(dev, "failed to get MSI interrupts\n");
504+
}
500505

501506
err = devm_request_irq(dev, pdev->irq, pci_endpoint_test_irqhandler,
502507
IRQF_SHARED, DRV_MODULE_NAME, test);

0 commit comments

Comments
 (0)