[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251215135715.00001ee7@huawei.com>
Date: Mon, 15 Dec 2025 13:57:15 +0000
From: Jonathan Cameron <jonathan.cameron@...wei.com>
To: <alejandro.lucero-palau@....com>
CC: <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>, Alejandro Lucero <alucerop@....com>
Subject: Re: [PATCH v22 14/25] sfc: obtain decoder and region if committed
by firmware
On Fri, 5 Dec 2025 11:52:37 +0000
<alejandro.lucero-palau@....com> wrote:
> From: Alejandro Lucero <alucerop@....com>
>
> Check if device HDM is already committed during firmware/BIOS
> initialization.
>
> A CXL region should exist if so after memdev allocation/initialization.
> Get HPA from region and map it.
I'm confused. If this only occurs if there is a committed decoder,
why is the exist cleanup unconditional?
Looks like you add logic around this in patch 16. I think that should be
back here for ease of reading even if for some reason this isn't broken.
Jonathan
>
> Signed-off-by: Alejandro Lucero <alucerop@....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 f6eda93e67e2..ad1f49e76179 100644
> --- a/drivers/net/ethernet/sfc/efx_cxl.c
> +++ b/drivers/net/ethernet/sfc/efx_cxl.c
> @@ -19,6 +19,7 @@ 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;
> struct efx_cxl *cxl;
> + struct range range;
> u16 dvsec;
> int rc;
>
> @@ -90,6 +91,26 @@ int efx_cxl_init(struct efx_probe_data *probe_data)
> return PTR_ERR(cxl->cxlmd);
> }
>
> + cxl->cxled = cxl_get_committed_decoder(cxl->cxlmd, &cxl->efx_region);
> + if (cxl->cxled) {
> + if (!cxl->efx_region) {
> + pci_err(pci_dev, "CXL found committed decoder without a region");
> + return -ENODEV;
> + }
> + rc = cxl_get_region_range(cxl->efx_region, &range);
> + if (rc) {
> + pci_err(pci_dev,
> + "CXL getting regions params from a committed decoder failed");
> + return rc;
> + }
> +
> + cxl->ctpio_cxl = ioremap(range.start, range.end - range.start + 1);
> + if (!cxl->ctpio_cxl) {
> + pci_err(pci_dev, "CXL ioremap region (%pra) failed", &range);
> + return -ENOMEM;
> + }
> + }
> +
> probe_data->cxl = cxl;
>
> return 0;
> @@ -97,6 +118,12 @@ int efx_cxl_init(struct efx_probe_data *probe_data)
>
> void efx_cxl_exit(struct efx_probe_data *probe_data)
> {
> + if (!probe_data->cxl)
> + return;
> +
> + iounmap(probe_data->cxl->ctpio_cxl);
> + cxl_decoder_detach(NULL, probe_data->cxl->cxled, 0, DETACH_INVALIDATE);
> + unregister_region(probe_data->cxl->efx_region);
> }
>
> MODULE_IMPORT_NS("CXL");
Powered by blists - more mailing lists