File tree Expand file tree Collapse file tree 4 files changed +19
-5
lines changed Expand file tree Collapse file tree 4 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -595,6 +595,14 @@ enum {
595
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
606
struct OpalIoPhbErrorCommon {
599
607
__be32 version ;
600
608
__be32 ioType ;
Original file line number Diff line number Diff line change 13
13
#include <linux/pci.h>
14
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
17
int pnv_cxl_ioda_msi_setup (struct pci_dev * dev , unsigned int hwirq ,
18
18
unsigned int virq );
19
19
int pnv_cxl_alloc_hwirqs (struct pci_dev * dev , int num );
Original file line number Diff line number Diff line change @@ -1468,7 +1468,7 @@ struct device_node *pnv_pci_to_phb_node(struct pci_dev *dev)
1468
1468
}
1469
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
1473
struct pci_controller * hose = pci_bus_to_host (dev -> bus );
1474
1474
struct pnv_phb * phb = hose -> private_data ;
@@ -1481,13 +1481,13 @@ int pnv_phb_to_cxl(struct pci_dev *dev)
1481
1481
1482
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
1485
if (rc )
1486
1486
dev_err (& dev -> dev , "opal_pci_set_phb_cxl_mode failed: %i\n" , rc );
1487
1487
1488
1488
return rc ;
1489
1489
}
1490
- EXPORT_SYMBOL (pnv_phb_to_cxl );
1490
+ EXPORT_SYMBOL (pnv_phb_to_cxl_mode );
1491
1491
1492
1492
/* Find PHB for cxl dev and allocate MSI hwirqs?
1493
1493
* Returns the absolute hardware IRQ number
Original file line number Diff line number Diff line change @@ -926,9 +926,15 @@ static struct cxl *cxl_init_adapter(struct pci_dev *dev)
926
926
if ((rc = init_implementation_adapter_regs (adapter , dev )))
927
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
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
938
if ((rc = cxl_register_psl_err_irq (adapter )))
933
939
goto err3 ;
934
940
You can’t perform that action at this time.
0 commit comments