[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a844e2c1-b3ea-4abb-064d-65c005279cc8@amd.com>
Date: Wed, 27 Nov 2024 09:17:38 +0000
From: Alejandro Lucero Palau <alucerop@....com>
To: Fan Ni <nifan.cxl@...il.com>, 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
Subject: Re: [PATCH v5 02/27] sfc: add cxl support using new CXL API
On 11/26/24 18:08, Fan Ni wrote:
> On Mon, Nov 18, 2024 at 04:44:09PM +0000, alejandro.lucero-palau@....com wrote:
>> From: Alejandro Lucero <alucerop@....com>
>>
>> Add CXL initialization based on new CXL API for accel drivers and make
>> it dependable on kernel CXL configuration.
>>
>> Signed-off-by: Alejandro Lucero <alucerop@....com>
>> ---
>> drivers/net/ethernet/sfc/Kconfig | 7 +++
>> drivers/net/ethernet/sfc/Makefile | 1 +
>> drivers/net/ethernet/sfc/efx.c | 24 +++++++-
>> drivers/net/ethernet/sfc/efx_cxl.c | 88 +++++++++++++++++++++++++++
>> drivers/net/ethernet/sfc/efx_cxl.h | 28 +++++++++
>> drivers/net/ethernet/sfc/net_driver.h | 10 +++
>> 6 files changed, 157 insertions(+), 1 deletion(-)
>> create mode 100644 drivers/net/ethernet/sfc/efx_cxl.c
>> create mode 100644 drivers/net/ethernet/sfc/efx_cxl.h
> ...
>> + res = DEFINE_RES_MEM_NAMED(0, EFX_CTPIO_BUFFER_SIZE, "ram");
>> + if (cxl_set_resource(cxl->cxlds, res, CXL_RES_RAM)) {
>> + pci_err(pci_dev, "cxl_set_resource RAM failed\n");
>> + rc = -EINVAL;
>> + goto err2;
>> + }
>> +
>> + probe_data->cxl = cxl;
>> +
>> + return 0;
>> +
>> +err2:
>> + kfree(cxl->cxlds);
>> +err1:
>> + kfree(cxl);
>> + return rc;
>> +
> Unwanted blank line here.
I'll fix it.
Thanks!
> Fan
>> +}
>> +
>> +void efx_cxl_exit(struct efx_probe_data *probe_data)
>> +{
>> + if (probe_data->cxl) {
>> + kfree(probe_data->cxl->cxlds);
>> + kfree(probe_data->cxl);
>> + }
>> +}
>> +
>> +MODULE_IMPORT_NS(CXL);
>> diff --git a/drivers/net/ethernet/sfc/efx_cxl.h b/drivers/net/ethernet/sfc/efx_cxl.h
>> new file mode 100644
>> index 000000000000..90fa46bc94db
>> --- /dev/null
>> +++ b/drivers/net/ethernet/sfc/efx_cxl.h
>> @@ -0,0 +1,28 @@
>> +/* SPDX-License-Identifier: GPL-2.0-only */
>> +/****************************************************************************
>> + * Driver for AMD network controllers and boards
>> + * Copyright (C) 2024, Advanced Micro Devices, Inc.
>> + *
>> + * This program is free software; you can redistribute it and/or modify it
>> + * under the terms of the GNU General Public License version 2 as published
>> + * by the Free Software Foundation, incorporated herein by reference.
>> + */
>> +
>> +#ifndef EFX_CXL_H
>> +#define EFX_CXL_H
>> +
>> +struct efx_nic;
>> +
>> +struct efx_cxl {
>> + struct cxl_dev_state *cxlds;
>> + struct cxl_memdev *cxlmd;
>> + struct cxl_root_decoder *cxlrd;
>> + struct cxl_port *endpoint;
>> + struct cxl_endpoint_decoder *cxled;
>> + struct cxl_region *efx_region;
>> + void __iomem *ctpio_cxl;
>> +};
>> +
>> +int efx_cxl_init(struct efx_probe_data *probe_data);
>> +void efx_cxl_exit(struct efx_probe_data *probe_data);
>> +#endif
>> diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
>> index b85c51cbe7f9..efc6d90380b9 100644
>> --- a/drivers/net/ethernet/sfc/net_driver.h
>> +++ b/drivers/net/ethernet/sfc/net_driver.h
>> @@ -1160,14 +1160,24 @@ struct efx_nic {
>> atomic_t n_rx_noskb_drops;
>> };
>>
>> +#ifdef CONFIG_SFC_CXL
>> +struct efx_cxl;
>> +#endif
>> +
>> /**
>> * struct efx_probe_data - State after hardware probe
>> * @pci_dev: The PCI device
>> * @efx: Efx NIC details
>> + * @cxl: details of related cxl objects
>> + * @cxl_pio_initialised: cxl initialization outcome.
>> */
>> struct efx_probe_data {
>> struct pci_dev *pci_dev;
>> struct efx_nic efx;
>> +#ifdef CONFIG_SFC_CXL
>> + struct efx_cxl *cxl;
>> + bool cxl_pio_initialised;
>> +#endif
>> };
>>
>> static inline struct efx_nic *efx_netdev_priv(struct net_device *dev)
>> --
>> 2.17.1
>>
Powered by blists - more mailing lists