]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
cxl: Add support for CAPP DMA mode
authorIan Munsie <imunsie@au1.ibm.com>
Wed, 8 Jun 2016 05:09:54 +0000 (15:09 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 16 Jun 2016 13:10:26 +0000 (23:10 +1000)
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>
arch/powerpc/include/asm/opal-api.h
arch/powerpc/platforms/powernv/pci-ioda.c
drivers/misc/cxl/cxl.h
drivers/misc/cxl/pci.c

index 70b5cbc0a49c0639a95ab12379e2c23b6f76e639..cd9371b33f1afc912ec4a7badc6c1372af5ccfcc 100644 (file)
@@ -825,6 +825,7 @@ enum {
        OPAL_PHB_CAPI_MODE_CAPI         = 1,
        OPAL_PHB_CAPI_MODE_SNOOP_OFF    = 2,
        OPAL_PHB_CAPI_MODE_SNOOP_ON     = 3,
+       OPAL_PHB_CAPI_MODE_DMA          = 4,
 };
 
 /* OPAL I2C request */
index 1fc53e015d29e427f60abd5147255e0ec7b30b2a..2c0e09f2fc50cf31e8dee9e7e033df8c3d871721 100644 (file)
@@ -2793,7 +2793,9 @@ int pnv_phb_to_cxl_mode(struct pci_dev *dev, uint64_t mode)
        pe_info(pe, "Switching PHB to CXL\n");
 
        rc = opal_pci_set_phb_cxl_mode(phb->opal_id, mode, pe->pe_number);
-       if (rc)
+       if (rc == OPAL_UNSUPPORTED)
+               dev_err(&dev->dev, "Required cxl mode not supported by firmware - update skiboot\n");
+       else if (rc)
                dev_err(&dev->dev, "opal_pci_set_phb_cxl_mode failed: %i\n", rc);
 
        return rc;
index 790faebf44dc12dd4ecf9251540d99d84a6f7970..ce2b9d51306960776e8f219a539b6ebcb0b84bac 100644 (file)
@@ -543,6 +543,7 @@ struct cxl_service_layer_ops {
        void (*debugfs_stop_trace)(struct cxl *adapter);
        void (*write_timebase_ctrl)(struct cxl *adapter);
        u64 (*timebase_read)(struct cxl *adapter);
+       int capi_mode;
 };
 
 struct cxl_native {
index 556718d7915fead5882fa1d5f037dfa0fd152728..648817a2e219ebe4ed68e4f9c4530bcf30baa42b 100644 (file)
@@ -1249,7 +1249,7 @@ static int cxl_configure_adapter(struct cxl *adapter, struct pci_dev *dev)
        if ((rc = adapter->native->sl_ops->adapter_regs_init(adapter, dev)))
                goto err;
 
-       if ((rc = pnv_phb_to_cxl_mode(dev, OPAL_PHB_CAPI_MODE_CAPI)))
+       if ((rc = pnv_phb_to_cxl_mode(dev, adapter->native->sl_ops->capi_mode)))
                goto err;
 
        /* If recovery happened, the last step is to turn on snooping.
@@ -1293,6 +1293,7 @@ static const struct cxl_service_layer_ops psl_ops = {
        .debugfs_stop_trace = cxl_stop_trace,
        .write_timebase_ctrl = write_timebase_ctrl_psl,
        .timebase_read = timebase_read_psl,
+       .capi_mode = OPAL_PHB_CAPI_MODE_CAPI,
 };
 
 static const struct cxl_service_layer_ops xsl_ops = {
@@ -1300,6 +1301,7 @@ static const struct cxl_service_layer_ops xsl_ops = {
        .debugfs_add_adapter_sl_regs = cxl_debugfs_add_adapter_xsl_regs,
        .write_timebase_ctrl = write_timebase_ctrl_xsl,
        .timebase_read = timebase_read_xsl,
+       .capi_mode = OPAL_PHB_CAPI_MODE_DMA,
 };
 
 static void set_sl_ops(struct cxl *adapter, struct pci_dev *dev)