From: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: imunsie@au1.ibm.com, fbarrat@linux.vnet.ibm.com,
vaibhav@linux.vnet.ibm.com, felix@linux.vnet.ibm.com,
huyn@mellanox.com, clombard@linux.vnet.ibm.com
Subject: [PATCH] cxl: add device ID for Mellanox ConnectX-4
Date: Mon, 25 Jul 2016 14:58:12 +1000 [thread overview]
Message-ID: <1469422692-30782-1-git-send-email-andrew.donnellan@au1.ibm.com> (raw)
Currently the cxl driver attempts to bind to any class 1200 (processing
accelerator) device, and only works out whether it's actually a CAPI card
later on. This doesn't really break anything (if it's not a CAPI card,
we'll abort very quickly), but ideally we'd like to remove this and be
explicit about the cards we support.
For CAPI-capable FPGA devices, we currently use a regular PCI_DEVICE entry
in the ID table to match the vendor and device ID. However, in the case of
some bi-modal devices, such as the Mellanox ConnectX-4, this may not be
sufficient. The CX-4 uses the same vendor and device ID whether in regular
PCIe mode or in CAPI mode, and one of its functions in PCIe mode has a CAPI
VSEC, so cxl would incorrectly try to initialise it as if it's already in
CAPI mode.
For this case, add a PCI_DEVICE_ACCEL macro which also checks the class
number, and add a device ID for the Mellanox CX-4 in CAPI mode. Don't
remove the generic class entry just yet - we'll remove it eventually after
we're certain that no end users are depending on it.
Suggested-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
---
drivers/misc/cxl/pci.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/drivers/misc/cxl/pci.c b/drivers/misc/cxl/pci.c
index d152e2d..cc66ee2 100644
--- a/drivers/misc/cxl/pci.c
+++ b/drivers/misc/cxl/pci.c
@@ -118,13 +118,29 @@
#define AFUD_EB_LEN(val) EXTRACT_PPC_BITS(val, 8, 63)
#define AFUD_READ_EB_OFF(afu) AFUD_READ(afu, 0x48)
+/*
+ * Matches a given PCI vendor ID and device ID, but only for class 12
+ * (processing accelerators). Useful for bi-modal cards, such as the
+ * Mellanox ConnectX-4, which keep the same vendor/device ID
+ * post-mode-switch.
+ */
+#define PCI_DEVICE_ACCEL(vend, dev) \
+ .vendor = (vend), .device = (dev), \
+ .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, \
+ .class = 0x120000, .class_mask = 0xff0000
+
static const struct pci_device_id cxl_pci_tbl[] = {
+ /* FPGA devices */
{ PCI_DEVICE(PCI_VENDOR_ID_IBM, 0x0477), },
{ PCI_DEVICE(PCI_VENDOR_ID_IBM, 0x044b), },
{ PCI_DEVICE(PCI_VENDOR_ID_IBM, 0x04cf), },
{ PCI_DEVICE(PCI_VENDOR_ID_IBM, 0x0601), },
- { PCI_DEVICE_CLASS(0x120000, ~0), },
+ /* Mellanox ConnectX-4 */
+ { PCI_DEVICE_ACCEL(PCI_VENDOR_ID_MELLANOX, 0x1013), },
+
+ /* Generic match for class 120000 devices, will be removed eventually */
+ { PCI_DEVICE_CLASS(0x120000, ~0), },
{ }
};
MODULE_DEVICE_TABLE(pci, cxl_pci_tbl);
--
Andrew Donnellan OzLabs, ADL Canberra
andrew.donnellan@au1.ibm.com IBM Australia Limited
next reply other threads:[~2016-07-25 4:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-25 4:58 Andrew Donnellan [this message]
2016-07-25 5:52 ` [PATCH] cxl: add device ID for Mellanox ConnectX-4 Ian Munsie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1469422692-30782-1-git-send-email-andrew.donnellan@au1.ibm.com \
--to=andrew.donnellan@au1.ibm.com \
--cc=clombard@linux.vnet.ibm.com \
--cc=fbarrat@linux.vnet.ibm.com \
--cc=felix@linux.vnet.ibm.com \
--cc=huyn@mellanox.com \
--cc=imunsie@au1.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=vaibhav@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).