aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Munsie <imunsie@au1.ibm.com>2016-06-08 01:09:54 -0400
committerMichael Ellerman <mpe@ellerman.id.au>2016-06-16 09:10:26 -0400
commitb385c9e971468eb8816b26742449d6d1e49f55f1 (patch)
treec78d0b179f8fb8e0956a6659df185f3d9e754cf8
parent6d382616ac2283ed65c7a6a52d05b064488aa8f8 (diff)
cxl: Add support for CAPP DMA mode
This adds support for using CAPP DMA mode, which is required for XSL based cards such as the Mellanox CX4 to function. This is currently an RFC as it depends on the corresponding support to be merged into skiboot first, which was submitted here: http://patchwork.ozlabs.org/patch/625582/ In the event that the skiboot on the system does not have the above support, it will indicate as such in the kernel log and abort the init process. Signed-off-by: Ian Munsie <imunsie@au1.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r--arch/powerpc/include/asm/opal-api.h1
-rw-r--r--arch/powerpc/platforms/powernv/pci-ioda.c4
-rw-r--r--drivers/misc/cxl/cxl.h1
-rw-r--r--drivers/misc/cxl/pci.c4
4 files changed, 8 insertions, 2 deletions
diff --git a/arch/powerpc/include/asm/opal-api.h b/arch/powerpc/include/asm/opal-api.h
index 70b5cbc0a49c..cd9371b33f1a 100644
--- a/arch/powerpc/include/asm/opal-api.h
+++ b/arch/powerpc/include/asm/opal-api.h
@@ -825,6 +825,7 @@ enum {
825 OPAL_PHB_CAPI_MODE_CAPI = 1, 825 OPAL_PHB_CAPI_MODE_CAPI = 1,
826 OPAL_PHB_CAPI_MODE_SNOOP_OFF = 2, 826 OPAL_PHB_CAPI_MODE_SNOOP_OFF = 2,
827 OPAL_PHB_CAPI_MODE_SNOOP_ON = 3, 827 OPAL_PHB_CAPI_MODE_SNOOP_ON = 3,
828 OPAL_PHB_CAPI_MODE_DMA = 4,
828}; 829};
829 830
830/* OPAL I2C request */ 831/* OPAL I2C request */
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 1fc53e015d29..2c0e09f2fc50 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -2793,7 +2793,9 @@ int pnv_phb_to_cxl_mode(struct pci_dev *dev, uint64_t mode)
2793 pe_info(pe, "Switching PHB to CXL\n"); 2793 pe_info(pe, "Switching PHB to CXL\n");
2794 2794
2795 rc = opal_pci_set_phb_cxl_mode(phb->opal_id, mode, pe->pe_number); 2795 rc = opal_pci_set_phb_cxl_mode(phb->opal_id, mode, pe->pe_number);
2796 if (rc) 2796 if (rc == OPAL_UNSUPPORTED)
2797 dev_err(&dev->dev, "Required cxl mode not supported by firmware - update skiboot\n");
2798 else if (rc)
2797 dev_err(&dev->dev, "opal_pci_set_phb_cxl_mode failed: %i\n", rc); 2799 dev_err(&dev->dev, "opal_pci_set_phb_cxl_mode failed: %i\n", rc);
2798 2800
2799 return rc; 2801 return rc;
diff --git a/drivers/misc/cxl/cxl.h b/drivers/misc/cxl/cxl.h
index 790faebf44dc..ce2b9d513069 100644
--- a/drivers/misc/cxl/cxl.h
+++ b/drivers/misc/cxl/cxl.h
@@ -543,6 +543,7 @@ struct cxl_service_layer_ops {
543 void (*debugfs_stop_trace)(struct cxl *adapter); 543 void (*debugfs_stop_trace)(struct cxl *adapter);
544 void (*write_timebase_ctrl)(struct cxl *adapter); 544 void (*write_timebase_ctrl)(struct cxl *adapter);
545 u64 (*timebase_read)(struct cxl *adapter); 545 u64 (*timebase_read)(struct cxl *adapter);
546 int capi_mode;
546}; 547};
547 548
548struct cxl_native { 549struct cxl_native {
diff --git a/drivers/misc/cxl/pci.c b/drivers/misc/cxl/pci.c
index 556718d7915f..648817a2e219 100644
--- a/drivers/misc/cxl/pci.c
+++ b/drivers/misc/cxl/pci.c
@@ -1249,7 +1249,7 @@ static int cxl_configure_adapter(struct cxl *adapter, struct pci_dev *dev)
1249 if ((rc = adapter->native->sl_ops->adapter_regs_init(adapter, dev))) 1249 if ((rc = adapter->native->sl_ops->adapter_regs_init(adapter, dev)))
1250 goto err; 1250 goto err;
1251 1251
1252 if ((rc = pnv_phb_to_cxl_mode(dev, OPAL_PHB_CAPI_MODE_CAPI))) 1252 if ((rc = pnv_phb_to_cxl_mode(dev, adapter->native->sl_ops->capi_mode)))
1253 goto err; 1253 goto err;
1254 1254
1255 /* If recovery happened, the last step is to turn on snooping. 1255 /* If recovery happened, the last step is to turn on snooping.
@@ -1293,6 +1293,7 @@ static const struct cxl_service_layer_ops psl_ops = {
1293 .debugfs_stop_trace = cxl_stop_trace, 1293 .debugfs_stop_trace = cxl_stop_trace,
1294 .write_timebase_ctrl = write_timebase_ctrl_psl, 1294 .write_timebase_ctrl = write_timebase_ctrl_psl,
1295 .timebase_read = timebase_read_psl, 1295 .timebase_read = timebase_read_psl,
1296 .capi_mode = OPAL_PHB_CAPI_MODE_CAPI,
1296}; 1297};
1297 1298
1298static const struct cxl_service_layer_ops xsl_ops = { 1299static const struct cxl_service_layer_ops xsl_ops = {
@@ -1300,6 +1301,7 @@ static const struct cxl_service_layer_ops xsl_ops = {
1300 .debugfs_add_adapter_sl_regs = cxl_debugfs_add_adapter_xsl_regs, 1301 .debugfs_add_adapter_sl_regs = cxl_debugfs_add_adapter_xsl_regs,
1301 .write_timebase_ctrl = write_timebase_ctrl_xsl, 1302 .write_timebase_ctrl = write_timebase_ctrl_xsl,
1302 .timebase_read = timebase_read_xsl, 1303 .timebase_read = timebase_read_xsl,
1304 .capi_mode = OPAL_PHB_CAPI_MODE_DMA,
1303}; 1305};
1304 1306
1305static void set_sl_ops(struct cxl *adapter, struct pci_dev *dev) 1307static void set_sl_ops(struct cxl *adapter, struct pci_dev *dev)