diff options
-rw-r--r-- | arch/powerpc/include/asm/opal.h | 8 | ||||
-rw-r--r-- | arch/powerpc/include/asm/pnv-pci.h | 2 | ||||
-rw-r--r-- | arch/powerpc/platforms/powernv/pci-ioda.c | 6 | ||||
-rw-r--r-- | drivers/misc/cxl/pci.c | 8 |
4 files changed, 19 insertions, 5 deletions
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h index eb95b675109b..2baf8a5925ca 100644 --- a/arch/powerpc/include/asm/opal.h +++ b/arch/powerpc/include/asm/opal.h | |||
@@ -595,6 +595,14 @@ enum { | |||
595 | OPAL_PHB3_NUM_PEST_REGS = 256 | 595 | OPAL_PHB3_NUM_PEST_REGS = 256 |
596 | }; | 596 | }; |
597 | 597 | ||
598 | /* CAPI modes for PHB */ | ||
599 | enum { | ||
600 | OPAL_PHB_CAPI_MODE_PCIE = 0, | ||
601 | OPAL_PHB_CAPI_MODE_CAPI = 1, | ||
602 | OPAL_PHB_CAPI_MODE_SNOOP_OFF = 2, | ||
603 | OPAL_PHB_CAPI_MODE_SNOOP_ON = 3, | ||
604 | }; | ||
605 | |||
598 | struct OpalIoPhbErrorCommon { | 606 | struct OpalIoPhbErrorCommon { |
599 | __be32 version; | 607 | __be32 version; |
600 | __be32 ioType; | 608 | __be32 ioType; |
diff --git a/arch/powerpc/include/asm/pnv-pci.h b/arch/powerpc/include/asm/pnv-pci.h index f09a22fa1bd7..3c00d648336d 100644 --- a/arch/powerpc/include/asm/pnv-pci.h +++ b/arch/powerpc/include/asm/pnv-pci.h | |||
@@ -13,7 +13,7 @@ | |||
13 | #include <linux/pci.h> | 13 | #include <linux/pci.h> |
14 | #include <misc/cxl.h> | 14 | #include <misc/cxl.h> |
15 | 15 | ||
16 | int pnv_phb_to_cxl(struct pci_dev *dev); | 16 | int pnv_phb_to_cxl_mode(struct pci_dev *dev, uint64_t mode); |
17 | int pnv_cxl_ioda_msi_setup(struct pci_dev *dev, unsigned int hwirq, | 17 | int pnv_cxl_ioda_msi_setup(struct pci_dev *dev, unsigned int hwirq, |
18 | unsigned int virq); | 18 | unsigned int virq); |
19 | int pnv_cxl_alloc_hwirqs(struct pci_dev *dev, int num); | 19 | int pnv_cxl_alloc_hwirqs(struct pci_dev *dev, int num); |
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index fac88ed8a915..5d52d6f274f8 100644 --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c | |||
@@ -1468,7 +1468,7 @@ struct device_node *pnv_pci_to_phb_node(struct pci_dev *dev) | |||
1468 | } | 1468 | } |
1469 | EXPORT_SYMBOL(pnv_pci_to_phb_node); | 1469 | EXPORT_SYMBOL(pnv_pci_to_phb_node); |
1470 | 1470 | ||
1471 | int pnv_phb_to_cxl(struct pci_dev *dev) | 1471 | int pnv_phb_to_cxl_mode(struct pci_dev *dev, uint64_t mode) |
1472 | { | 1472 | { |
1473 | struct pci_controller *hose = pci_bus_to_host(dev->bus); | 1473 | struct pci_controller *hose = pci_bus_to_host(dev->bus); |
1474 | struct pnv_phb *phb = hose->private_data; | 1474 | struct pnv_phb *phb = hose->private_data; |
@@ -1481,13 +1481,13 @@ int pnv_phb_to_cxl(struct pci_dev *dev) | |||
1481 | 1481 | ||
1482 | pe_info(pe, "Switching PHB to CXL\n"); | 1482 | pe_info(pe, "Switching PHB to CXL\n"); |
1483 | 1483 | ||
1484 | rc = opal_pci_set_phb_cxl_mode(phb->opal_id, 1, pe->pe_number); | 1484 | rc = opal_pci_set_phb_cxl_mode(phb->opal_id, mode, pe->pe_number); |
1485 | if (rc) | 1485 | if (rc) |
1486 | dev_err(&dev->dev, "opal_pci_set_phb_cxl_mode failed: %i\n", rc); | 1486 | dev_err(&dev->dev, "opal_pci_set_phb_cxl_mode failed: %i\n", rc); |
1487 | 1487 | ||
1488 | return rc; | 1488 | return rc; |
1489 | } | 1489 | } |
1490 | EXPORT_SYMBOL(pnv_phb_to_cxl); | 1490 | EXPORT_SYMBOL(pnv_phb_to_cxl_mode); |
1491 | 1491 | ||
1492 | /* Find PHB for cxl dev and allocate MSI hwirqs? | 1492 | /* Find PHB for cxl dev and allocate MSI hwirqs? |
1493 | * Returns the absolute hardware IRQ number | 1493 | * Returns the absolute hardware IRQ number |
diff --git a/drivers/misc/cxl/pci.c b/drivers/misc/cxl/pci.c index 014f4c928e4c..a4a4e0217eed 100644 --- a/drivers/misc/cxl/pci.c +++ b/drivers/misc/cxl/pci.c | |||
@@ -926,9 +926,15 @@ static struct cxl *cxl_init_adapter(struct pci_dev *dev) | |||
926 | if ((rc = init_implementation_adapter_regs(adapter, dev))) | 926 | if ((rc = init_implementation_adapter_regs(adapter, dev))) |
927 | goto err3; | 927 | goto err3; |
928 | 928 | ||
929 | if ((rc = pnv_phb_to_cxl(dev))) | 929 | if ((rc = pnv_phb_to_cxl_mode(dev, OPAL_PHB_CAPI_MODE_CAPI))) |
930 | goto err3; | 930 | goto err3; |
931 | 931 | ||
932 | /* If recovery happened, the last step is to turn on snooping. | ||
933 | * In the non-recovery case this has no effect */ | ||
934 | if ((rc = pnv_phb_to_cxl_mode(dev, OPAL_PHB_CAPI_MODE_SNOOP_ON))) { | ||
935 | goto err3; | ||
936 | } | ||
937 | |||
932 | if ((rc = cxl_register_psl_err_irq(adapter))) | 938 | if ((rc = cxl_register_psl_err_irq(adapter))) |
933 | goto err3; | 939 | goto err3; |
934 | 940 | ||