#define CXL_PSL_SPAP_V    0x0000000000000001ULL
 
 /****** CXL_PSL_Control ****************************************************/
-#define CXL_PSL_Control_tb 0x0000000000000001ULL
+#define CXL_PSL_Control_tb              (0x1ull << (63-63))
+#define CXL_PSL_Control_Fr              (0x1ull << (63-31))
+#define CXL_PSL_Control_Fs_MASK         (0x3ull << (63-29))
+#define CXL_PSL_Control_Fs_Complete     (0x3ull << (63-29))
 
 /****** CXL_PSL_DLCNTL *****************************************************/
 #define CXL_PSL_DLCNTL_D (0x1ull << (63-28))
 int cxl_check_error(struct cxl_afu *afu);
 int cxl_afu_slbia(struct cxl_afu *afu);
 int cxl_tlb_slb_invalidate(struct cxl *adapter);
+int cxl_data_cache_flush(struct cxl *adapter);
 int cxl_afu_disable(struct cxl_afu *afu);
 int cxl_psl_purge(struct cxl_afu *afu);
 
 
        return 0;
 }
 
+int cxl_data_cache_flush(struct cxl *adapter)
+{
+       u64 reg;
+       unsigned long timeout = jiffies + (HZ * CXL_TIMEOUT);
+
+       pr_devel("Flushing data cache\n");
+
+       reg = cxl_p1_read(adapter, CXL_PSL_Control);
+       reg |= CXL_PSL_Control_Fr;
+       cxl_p1_write(adapter, CXL_PSL_Control, reg);
+
+       reg = cxl_p1_read(adapter, CXL_PSL_Control);
+       while ((reg & CXL_PSL_Control_Fs_MASK) != CXL_PSL_Control_Fs_Complete) {
+               if (time_after_eq(jiffies, timeout)) {
+                       dev_warn(&adapter->dev, "WARNING: cache flush timed out!\n");
+                       return -EBUSY;
+               }
+
+               if (!cxl_ops->link_ok(adapter, NULL)) {
+                       dev_warn(&adapter->dev, "WARNING: link down when flushing cache\n");
+                       return -EIO;
+               }
+               cpu_relax();
+               reg = cxl_p1_read(adapter, CXL_PSL_Control);
+       }
+
+       reg &= ~CXL_PSL_Control_Fr;
+       cxl_p1_write(adapter, CXL_PSL_Control, reg);
+       return 0;
+}
+
 static int cxl_write_sstp(struct cxl_afu *afu, u64 sstp0, u64 sstp1)
 {
        int rc;
 
 
        dev_info(&dev->dev, "CXL reset\n");
 
+       /* the adapter is about to be reset, so ignore errors */
+       cxl_data_cache_flush(adapter);
+
        /* pcie_warm_reset requests a fundamental pci reset which includes a
         * PERST assert/deassert.  PERST triggers a loading of the image
         * if "user" or "factory" is selected in sysfs */