@@ -22,8 +22,12 @@ int efx_cxl_init(struct efx_probe_data *probe_data)
{
struct efx_nic *efx = &probe_data->efx;
struct pci_dev *pci_dev = efx->pci_dev;
+ DECLARE_BITMAP(expected, CXL_MAX_CAPS);
+ DECLARE_BITMAP(found, CXL_MAX_CAPS);
struct efx_cxl *cxl;
+
u16 dvsec;
+ int rc;
probe_data->cxl_pio_initialised = false;
@@ -46,9 +50,37 @@ int efx_cxl_init(struct efx_probe_data *probe_data)
return PTR_ERR(cxl->cxlmds);
}
+ bitmap_clear(expected, 0, CXL_MAX_CAPS);
+ set_bit(CXL_DEV_CAP_HDM, expected);
+ set_bit(CXL_DEV_CAP_HDM, expected);
+ set_bit(CXL_DEV_CAP_RAS, expected);
+
+ rc = cxl_pci_accel_setup_regs(pci_dev, cxl->cxlmds, found);
+ if (rc) {
+ pci_err(pci_dev, "CXL accel setup regs failed");
+ goto err_regs;
+ }
+
+ /*
+ * Checking mandatory caps are there as, at least, a subset of those
+ * found.
+ */
+ if (!bitmap_subset(expected, found, CXL_MAX_CAPS)) {
+ pci_err(pci_dev,
+ "CXL device capabilities found(%pb) not as expected(%pb)",
+ found, expected);
+ rc = -EIO;
+ goto err_regs;
+ }
+
probe_data->cxl = cxl;
return 0;
+
+err_regs:
+ kfree(probe_data->cxl);
+ return rc;
+
}
void efx_cxl_exit(struct efx_probe_data *probe_data)