[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <09593973-23cd-0404-1012-4efce497435d@amd.com>
Date: Mon, 30 Dec 2024 12:16:00 +0000
From: Alejandro Lucero Palau <alucerop@....com>
To: Simon Horman <horms@...nel.org>, 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
Subject: Re: [PATCH v8 27/27] sfc: support pio mapping based on cxl
On 12/18/24 08:32, Alejandro Lucero Palau wrote:
>
> On 12/17/24 10:47, Simon Horman wrote:
>> 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.
>
>
> Yes, I think so. The resource was not available in previous versions,
> then a requested change did not update this.
>
> I will fix it.
>
I was wrong in my previous reply. We do not have the resource but the
range, so I'll keep using the range although doing the same arithmetic
as resource_size.
Thanks
>
>>> + 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.
>
>
> Right. I'll add it.
>
> Thanks!
>
>
>> 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