aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/cxl/pci.c
diff options
context:
space:
mode:
authorVaibhav Jain <vaibhav@linux.vnet.ibm.com>2018-02-15 10:49:24 -0500
committerMichael Ellerman <mpe@ellerman.id.au>2018-03-13 00:50:26 -0400
commit94322ed8e857e3b2a33cf75118051af9baaa110f (patch)
tree0f4e6b8b5a5cb61192a2242ca4a56ef2b2e6a9d8 /drivers/misc/cxl/pci.c
parent02b63b420223db3e33e19cc0aaf346371e8efe48 (diff)
cxl: Check if PSL data-cache is available before issue flush request
PSL9D doesn't have a data-cache that needs to be flushed before resetting the card. However when cxl tries to flush data-cache on such a card, it times-out as PSL_Control register never indicates flush operation complete due to missing data-cache. This is usually indicated in the kernel logs with this message: "WARNING: cache flush timed out" To fix this the patch checks PSL_Debug register CDC-Field(BIT:27) which indicates the absence of a data-cache and sets a flag 'no_data_cache' in 'struct cxl_native' to indicate this. When cxl_data_cache_flush() is called it checks the flag and if set bails out early without requesting a data-cache flush operation to the PSL. Signed-off-by: Vaibhav Jain <vaibhav@linux.vnet.ibm.com> Acked-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com> Acked-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'drivers/misc/cxl/pci.c')
-rw-r--r--drivers/misc/cxl/pci.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/misc/cxl/pci.c b/drivers/misc/cxl/pci.c
index 9bc30c20b66b..35f486912ddc 100644
--- a/drivers/misc/cxl/pci.c
+++ b/drivers/misc/cxl/pci.c
@@ -456,6 +456,7 @@ static int init_implementation_adapter_regs_psl9(struct cxl *adapter,
456 u64 chipid; 456 u64 chipid;
457 u32 phb_index; 457 u32 phb_index;
458 u64 capp_unit_id; 458 u64 capp_unit_id;
459 u64 psl_debug;
459 int rc; 460 int rc;
460 461
461 rc = cxl_calc_capp_routing(dev, &chipid, &phb_index, &capp_unit_id); 462 rc = cxl_calc_capp_routing(dev, &chipid, &phb_index, &capp_unit_id);
@@ -510,6 +511,16 @@ static int init_implementation_adapter_regs_psl9(struct cxl *adapter,
510 cxl_p1_write(adapter, CXL_PSL9_DEBUG, 0xC000000000000000ULL); 511 cxl_p1_write(adapter, CXL_PSL9_DEBUG, 0xC000000000000000ULL);
511 } 512 }
512 513
514 /*
515 * Check if PSL has data-cache. We need to flush adapter datacache
516 * when as its about to be removed.
517 */
518 psl_debug = cxl_p1_read(adapter, CXL_PSL9_DEBUG);
519 if (psl_debug & CXL_PSL_DEBUG_CDC) {
520 dev_dbg(&dev->dev, "No data-cache present\n");
521 adapter->native->no_data_cache = true;
522 }
523
513 return 0; 524 return 0;
514} 525}
515 526
@@ -1448,10 +1459,8 @@ int cxl_pci_reset(struct cxl *adapter)
1448 1459
1449 /* 1460 /*
1450 * The adapter is about to be reset, so ignore errors. 1461 * The adapter is about to be reset, so ignore errors.
1451 * Not supported on P9 DD1
1452 */ 1462 */
1453 if ((cxl_is_power8()) || (!(cxl_is_power9_dd1()))) 1463 cxl_data_cache_flush(adapter);
1454 cxl_data_cache_flush(adapter);
1455 1464
1456 /* pcie_warm_reset requests a fundamental pci reset which includes a 1465 /* pcie_warm_reset requests a fundamental pci reset which includes a
1457 * PERST assert/deassert. PERST triggers a loading of the image 1466 * PERST assert/deassert. PERST triggers a loading of the image
@@ -1934,10 +1943,8 @@ static void cxl_pci_remove_adapter(struct cxl *adapter)
1934 1943
1935 /* 1944 /*
1936 * Flush adapter datacache as its about to be removed. 1945 * Flush adapter datacache as its about to be removed.
1937 * Not supported on P9 DD1.
1938 */ 1946 */
1939 if ((cxl_is_power8()) || (!(cxl_is_power9_dd1()))) 1947 cxl_data_cache_flush(adapter);
1940 cxl_data_cache_flush(adapter);
1941 1948
1942 cxl_deconfigure_adapter(adapter); 1949 cxl_deconfigure_adapter(adapter);
1943 1950