[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250417212926.1343268-7-alejandro.lucero-palau@amd.com>
Date: Thu, 17 Apr 2025 22:29:09 +0100
From: <alejandro.lucero-palau@....com>
To: <linux-cxl@...r.kernel.org>, <netdev@...r.kernel.org>,
<dan.j.williams@...el.com>, <edward.cree@....com>, <davem@...emloft.net>,
<kuba@...nel.org>, <pabeni@...hat.com>, <edumazet@...gle.com>,
<dave.jiang@...el.com>
CC: Alejandro Lucero <alucerop@....com>, Martin Habets
<habetsm.xilinx@...il.com>, Zhi Wang <zhi@...dia.com>, Edward Cree
<ecree.xilinx@...il.com>, Jonathan Cameron <Jonathan.Cameron@...wei.com>
Subject: [PATCH v14 06/22] sfc: make regs setup with checking and set media ready
From: Alejandro Lucero <alucerop@....com>
Use cxl code for registers discovery and mapping.
Validate capabilities found based on those registers against expected
capabilities.
Set media ready explicitly as there is no means for doing so without
a mailbox and without the related cxl register, not mandatory for type2.
Signed-off-by: Alejandro Lucero <alucerop@....com>
Reviewed-by: Martin Habets <habetsm.xilinx@...il.com>
Reviewed-by: Zhi Wang <zhi@...dia.com>
Acked-by: Edward Cree <ecree.xilinx@...il.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>
---
drivers/net/ethernet/sfc/efx_cxl.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/drivers/net/ethernet/sfc/efx_cxl.c b/drivers/net/ethernet/sfc/efx_cxl.c
index 753d5b7d49b6..79427a85a1b7 100644
--- a/drivers/net/ethernet/sfc/efx_cxl.c
+++ b/drivers/net/ethernet/sfc/efx_cxl.c
@@ -19,10 +19,13 @@
int efx_cxl_init(struct efx_probe_data *probe_data)
{
+ DECLARE_BITMAP(expected, CXL_MAX_CAPS) = {};
+ DECLARE_BITMAP(found, CXL_MAX_CAPS) = {};
struct efx_nic *efx = &probe_data->efx;
struct pci_dev *pci_dev = efx->pci_dev;
struct efx_cxl *cxl;
u16 dvsec;
+ int rc;
probe_data->cxl_pio_initialised = false;
@@ -43,6 +46,30 @@ int efx_cxl_init(struct efx_probe_data *probe_data)
if (!cxl)
return -ENOMEM;
+ 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->cxlds, found);
+ if (rc) {
+ pci_err(pci_dev, "CXL accel setup regs failed");
+ return rc;
+ }
+
+ /*
+ * Checking mandatory caps are there as, at least, a subset of those
+ * found.
+ */
+ if (cxl_check_caps(pci_dev, expected, found))
+ return -ENXIO;
+
+ /*
+ * Set media ready explicitly as there are neither mailbox for checking
+ * this state nor the CXL register involved, both not mandatory for
+ * type2.
+ */
+ cxl->cxlds.media_ready = true;
+
probe_data->cxl = cxl;
return 0;
--
2.34.1
Powered by blists - more mailing lists