[3.13.y-ckt stable] Patch "PCI/MSI: Add device flag indicating that 64-bit MSIs don't work" has been added to staging queue
Kamal Mostafa
kamal at canonical.com
Mon Dec 8 20:10:24 UTC 2014
This is a note to let you know that I have just added a patch titled
PCI/MSI: Add device flag indicating that 64-bit MSIs don't work
to the linux-3.13.y-queue branch of the 3.13.y-ckt extended stable tree
which can be found at:
http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.13.y-queue
This patch is scheduled to be released in version 3.13.11-ckt13.
If you, or anyone else, feels it should not be added to this tree, please
reply to this email.
For more information about the 3.13.y-ckt tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable
Thanks.
-Kamal
------
>From 67e640e0cba1feee7940870ec1728fcb180458c5 Mon Sep 17 00:00:00 2001
From: Benjamin Herrenschmidt <benh at kernel.crashing.org>
Date: Fri, 3 Oct 2014 15:13:24 +1000
Subject: PCI/MSI: Add device flag indicating that 64-bit MSIs don't work
commit f144d1496b47e7450f41b767d0d91c724c2198bc upstream.
This can be set by quirks/drivers to be used by the architecture code
that assigns the MSI addresses.
We additionally add verification in the core MSI code that the values
assigned by the architecture do satisfy the limitation in order to fail
gracefully if they don't (ie. the arch hasn't been updated to deal with
that quirk yet).
Signed-off-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>
Acked-by: Bjorn Helgaas <bhelgaas at google.com>
[ kamal: backport to 3.13-stable: error: label ]
Signed-off-by: Kamal Mostafa <kamal at canonical.com>
---
drivers/pci/msi.c | 26 ++++++++++++++++++++++++++
include/linux/pci.h | 1 +
2 files changed, 27 insertions(+)
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 3fcd67a..1e58285 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -563,6 +563,20 @@ out_unroll:
return ret;
}
+static int msi_verify_entries(struct pci_dev *dev)
+{
+ struct msi_desc *entry;
+
+ list_for_each_entry(entry, &dev->msi_list, list) {
+ if (!dev->no_64bit_msi || !entry->msg.address_hi)
+ continue;
+ dev_err(&dev->dev, "Device has broken 64-bit MSI but arch"
+ " tried to assign one above 4G\n");
+ return -EIO;
+ }
+ return 0;
+}
+
/**
* msi_capability_init - configure device's MSI capability structure
* @dev: pointer to the pci_dev data structure of MSI device function
@@ -616,6 +630,13 @@ static int msi_capability_init(struct pci_dev *dev, int nvec)
return ret;
}
+ ret = msi_verify_entries(dev);
+ if (ret) {
+ msi_mask_irq(entry, mask, ~mask);
+ free_msi_irqs(dev);
+ return ret;
+ }
+
ret = populate_msi_sysfs(dev);
if (ret) {
msi_mask_irq(entry, mask, ~mask);
@@ -731,6 +752,11 @@ static int msix_capability_init(struct pci_dev *dev,
if (ret)
goto error;
+ /* Check if all MSI entries honor device restrictions */
+ ret = msi_verify_entries(dev);
+ if (ret)
+ goto error;
+
/*
* Some devices require MSI-X to be enabled before we can touch the
* MSI-X registers. We need to mask all the vectors to prevent
diff --git a/include/linux/pci.h b/include/linux/pci.h
index a13d682..2a2a184 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -323,6 +323,7 @@ struct pci_dev {
unsigned int is_added:1;
unsigned int is_busmaster:1; /* device is busmaster */
unsigned int no_msi:1; /* device may not use msi */
+ unsigned int no_64bit_msi:1; /* device may only use 32-bit MSIs */
unsigned int block_cfg_access:1; /* config space access is blocked */
unsigned int broken_parity_status:1; /* Device generates false positive parity */
unsigned int irq_reroute_variant:2; /* device needs IRQ rerouting variant */
--
1.9.1
More information about the kernel-team
mailing list