[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241217104726.GQ780307@kernel.org>
Date: Tue, 17 Dec 2024 10:47:26 +0000
From: Simon Horman <horms@...nel.org>
To: alejandro.lucero-palau@....com
Cc: linux-cxl@...r.kernel.org, netdev@...r.kernel.org,
dan.j.williams@...el.com, martin.habets@...inx.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 v8 27/27] sfc: support pio mapping based on cxl
On Mon, Dec 16, 2024 at 04:10:42PM +0000, alejandro.lucero-palau@....com wrote:
> From: Alejandro Lucero <alucerop@....com>
>
> With a device supporting CXL and successfully initialised, use the cxl
> region to map the memory range and use this mapping for PIO buffers.
>
> Signed-off-by: Alejandro Lucero <alucerop@....com>
> Acked-by: Edward Cree <ecree.xilinx@...il.com>
...
> diff --git a/drivers/net/ethernet/sfc/efx_cxl.c b/drivers/net/ethernet/sfc/efx_cxl.c
> index 7367ba28a40f..6eab6dfd7ebd 100644
> --- a/drivers/net/ethernet/sfc/efx_cxl.c
> +++ b/drivers/net/ethernet/sfc/efx_cxl.c
> @@ -27,6 +27,7 @@ int efx_cxl_init(struct efx_probe_data *probe_data)
> struct pci_dev *pci_dev;
> struct efx_cxl *cxl;
> struct resource res;
> + struct range range;
> u16 dvsec;
> int rc;
>
> @@ -136,10 +137,25 @@ int efx_cxl_init(struct efx_probe_data *probe_data)
> goto err_region;
> }
>
> + rc = cxl_get_region_range(cxl->efx_region, &range);
> + if (rc) {
> + pci_err(pci_dev, "CXL getting regions params failed");
> + goto err_region_params;
> + }
> +
> + cxl->ctpio_cxl = ioremap(range.start, range.end - range.start);
nit: Smatch suggests that resource_size() may be used here.
> + if (!cxl->ctpio_cxl) {
> + pci_err(pci_dev, "CXL ioremap region (%pra) pfailed", &range);
I think rc should be be set to an error value here.
Also flagged by Smatch.
> + goto err_region_params;
> + }
> +
> probe_data->cxl = cxl;
> + probe_data->cxl_pio_initialised = true;
>
> return 0;
>
> +err_region_params:
> + cxl_accel_region_detach(cxl->cxled);
> err_region:
> cxl_dpa_free(cxl->cxled);
> err_memdev:
...
Powered by blists - more mailing lists