netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jonathan.cameron@huawei.com>
To: <alejandro.lucero-palau@amd.com>
Cc: <linux-cxl@vger.kernel.org>, <netdev@vger.kernel.org>,
	<dan.j.williams@intel.com>, <edward.cree@amd.com>,
	<davem@davemloft.net>, <kuba@kernel.org>, <pabeni@redhat.com>,
	<edumazet@google.com>, <dave.jiang@intel.com>,
	Alejandro Lucero <alucerop@amd.com>
Subject: Re: [PATCH v22 14/25] sfc: obtain decoder and region if committed by firmware
Date: Mon, 15 Dec 2025 13:57:15 +0000	[thread overview]
Message-ID: <20251215135715.00001ee7@huawei.com> (raw)
In-Reply-To: <20251205115248.772945-15-alejandro.lucero-palau@amd.com>

On Fri, 5 Dec 2025 11:52:37 +0000
<alejandro.lucero-palau@amd.com> wrote:

> From: Alejandro Lucero <alucerop@amd.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@amd.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");


  reply	other threads:[~2025-12-15 13:57 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-05 11:52 [PATCH v22 00/25] Type2 device basic support alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 01/25] cxl/mem: Arrange for always-synchronous memdev attach alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 02/25] cxl/port: Arrange for always synchronous endpoint attach alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 03/25] cxl/mem: Introduce a memdev creation ->probe() operation alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 04/25] cxl: Add type2 device basic support alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 05/25] sfc: add cxl support alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 06/25] cxl: Move pci generic code alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 07/25] cxl/sfc: Map cxl component regs alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 08/25] cxl/sfc: Initialize dpa without a mailbox alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 09/25] cxl: Prepare memdev creation for type2 alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 10/25] sfc: create type2 cxl memdev alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 11/25] cxl/hdm: Add support for getting region from committed decoder alejandro.lucero-palau
2025-12-15 13:50   ` Jonathan Cameron
2025-12-18 11:52     ` Alejandro Lucero Palau
2025-12-18 15:03       ` Jonathan Cameron
2025-12-18 15:27         ` Alejandro Lucero Palau
2025-12-19 11:02           ` Jonathan Cameron
2025-12-05 11:52 ` [PATCH v22 12/25] cxl: Add function for obtaining region range alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 13/25] cxl: Export functions for unwinding cxl by accelerators alejandro.lucero-palau
2025-12-15 13:53   ` Jonathan Cameron
2025-12-18 12:07     ` Alejandro Lucero Palau
2025-12-05 11:52 ` [PATCH v22 14/25] sfc: obtain decoder and region if committed by firmware alejandro.lucero-palau
2025-12-15 13:57   ` Jonathan Cameron [this message]
2025-12-18 12:14     ` Alejandro Lucero Palau
2025-12-05 11:52 ` [PATCH v22 15/25] cxl: Define a driver interface for HPA free space enumeration alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 16/25] sfc: get root decoder alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 17/25] cxl: Define a driver interface for DPA allocation alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 18/25] sfc: get endpoint decoder alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 19/25] cxl: Make region type based on endpoint type alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 20/25] cxl/region: Factor out interleave ways setup alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 21/25] cxl/region: Factor out interleave granularity setup alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 22/25] cxl: Allow region creation by type2 drivers alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 23/25] cxl: Avoid dax creation for accelerators alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 24/25] sfc: create cxl region alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 25/25] sfc: support pio mapping based on cxl alejandro.lucero-palau
2025-12-07  7:12 ` [PATCH v22 00/25] Type2 device basic support dan.j.williams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251215135715.00001ee7@huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=alejandro.lucero-palau@amd.com \
    --cc=alucerop@amd.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=edward.cree@amd.com \
    --cc=kuba@kernel.org \
    --cc=linux-cxl@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).