All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alejandro Lucero Palau <alucerop@amd.com>
To: PJ Waskiewicz <ppwaskie@kernel.org>,
	"Cheatham, Benjamin" <benjamin.cheatham@amd.com>,
	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
Subject: Re: [PATCH v23 08/22] cxl/hdm: Add support for getting region from committed decoder
Date: Tue, 10 Mar 2026 13:54:01 +0000	[thread overview]
Message-ID: <dd2da064-3c75-4311-9d7a-cdc852b56733@amd.com> (raw)
In-Reply-To: <ac50b18c99f5863f456d2d486454df8eebe35719.camel@kernel.org>


On 3/9/26 22:49, PJ Waskiewicz wrote:
> On Thu, 2026-02-12 at 09:16 +0000, Alejandro Lucero Palau wrote:
>> On 2/11/26 22:11, Cheatham, Benjamin wrote:
>>> On 2/1/2026 9:54 AM, alejandro.lucero-palau@amd.com wrote:
>>>> From: Alejandro Lucero <alucerop@amd.com>
>>>>
>>>> A Type2 device configured by the BIOS can already have its HDM
>>>> committed. Add a cxl_get_committed_decoder() function for cheking
>>>> so after memdev creation. A CXL region should have been created
>>>> during memdev initialization, therefore a Type2 driver can ask
>>>> for
>>>> such a region for working with the HPA. If the HDM is not
>>>> committed,
>>>> a Type2 driver will create the region after obtaining proper HPA
>>>> and DPA space.
>>>>
>>>> Signed-off-by: Alejandro Lucero <alucerop@amd.com>
>>>> ---
>>>>    drivers/cxl/core/hdm.c | 39
>>>> +++++++++++++++++++++++++++++++++++++++
>>>>    include/cxl/cxl.h      |  3 +++
>>>>    2 files changed, 42 insertions(+)
>>>>
>>>> diff --git a/drivers/cxl/core/hdm.c b/drivers/cxl/core/hdm.c
>>>> index 6e516c69b2d2..a172ce4e9b19 100644
>>>> --- a/drivers/cxl/core/hdm.c
>>>> +++ b/drivers/cxl/core/hdm.c
>>>> @@ -686,6 +686,45 @@ int cxl_dpa_alloc(struct
>>>> cxl_endpoint_decoder *cxled, u64 size)
>>>>    	return devm_add_action_or_reset(&port->dev,
>>>> cxl_dpa_release, cxled);
>>>>    }
>>>>    
>>>> +static int find_committed_endpoint_decoder(struct device *dev,
>>>> const void *data)
>>>> +{
>>>> +	struct cxl_endpoint_decoder *cxled;
>>>> +	struct cxl_port *port;
>>>> +
>>>> +	if (!is_endpoint_decoder(dev))
>>>> +		return 0;
>>>> +
>>>> +	cxled = to_cxl_endpoint_decoder(dev);
>>>> +	port = cxled_to_port(cxled);
>>>> +
>>>> +	return cxled->cxld.id == port->hdm_end;
>>> Is this the way you're supposed to check if a decoder is committed?
>>> The doc comment for @hdm_end in
>>> struct cxl_port says it's just the last allocated decoder. If
>>> allocated decoders are always committed then
>>> I'm fine with this, otherwise I think you'd want to a register read
>>> or something to find the commit state.
>>
>> Hi Ben,
>>
>>
>> Yes, I think you are right. This works in my tests and it is safe
>> because I check the region does exist before using it. But the error
>> inside sfc should then not be fatal for cxl sfc initialization and
>> fallback to the other cxl initialization possibility.
>>
> So I'm running into this situation I think.
>
> When you're testing, are you surviving a reload of the driver?  Right
> now, I can load and successfully create the region0 device.  However,
> following the same teardown path in SFC, I cannot reload my driver
> afterwards and map the region.  I get:
>
> cxl_port endpoint5: failed to attach decoder5 to region0: -6  (ENXIO)
> <driver> 0000:c1:00.0: CXL found committed decoder without a region
> <driver> 0000:c1:00.0: CXL init failed
>
> I'd be surprised if SFC in its current patch state would survive this
> same insmod/rmmod/insmod test.


Yes, I can load and unload the sfc driver and always getting the HDM 
decoder committed, what was the purpose behind v23.


I wonder if you applied the patch from smita's series:


https://lore.kernel.org/linux-cxl/20260210064501.157591-1-Smita.KoralahalliChannabasappa@amd.com/T/#mdad81d3817def8baace77ead9e2e305e775cf51d


If you did, then not sure what could be happening. Could you post here 
what you see at /sys/bus/cxl/devices after loading your driver, and 
after unloading it?


>
> -PJ

  reply	other threads:[~2026-03-10 13:54 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-01 15:54 [PATCH v23 00/22] Type2 device basic support alejandro.lucero-palau
2026-02-01 15:54 ` [PATCH v23 01/22] cxl: Add type2 " alejandro.lucero-palau
2026-02-11 22:11   ` Cheatham, Benjamin
2026-02-19  8:52     ` Alejandro Lucero Palau
2026-02-01 15:54 ` [PATCH v23 02/22] sfc: add cxl support alejandro.lucero-palau
2026-02-01 15:54 ` [PATCH v23 03/22] cxl: Move pci generic code alejandro.lucero-palau
2026-02-01 15:54 ` [PATCH v23 04/22] cxl/sfc: Map cxl component regs alejandro.lucero-palau
2026-03-20 17:22   ` Edward Cree
2026-02-01 15:54 ` [PATCH v23 05/22] cxl/sfc: Initialize dpa without a mailbox alejandro.lucero-palau
2026-03-20 17:24   ` Edward Cree
2026-02-01 15:54 ` [PATCH v23 06/22] cxl: Prepare memdev creation for type2 alejandro.lucero-palau
2026-02-01 15:54 ` [PATCH v23 07/22] sfc: create type2 cxl memdev alejandro.lucero-palau
2026-02-01 15:54 ` [PATCH v23 08/22] cxl/hdm: Add support for getting region from committed decoder alejandro.lucero-palau
2026-02-11 22:11   ` Cheatham, Benjamin
2026-02-12  9:16     ` Alejandro Lucero Palau
2026-03-09 22:49       ` PJ Waskiewicz
2026-03-10 13:54         ` Alejandro Lucero Palau [this message]
2026-03-13  2:03         ` Dan Williams
2026-03-13 13:10           ` Alejandro Lucero Palau
2026-03-16 14:33             ` Alejandro Lucero Palau
2026-02-01 15:54 ` [PATCH v23 09/22] cxl: Add function for obtaining region range alejandro.lucero-palau
2026-02-01 15:54 ` [PATCH v23 10/22] cxl: Export function for unwinding cxl by accelerators alejandro.lucero-palau
2026-02-19 23:16   ` Dave Jiang
2026-02-21  4:48   ` Gregory Price
2026-02-01 15:54 ` [PATCH v23 11/22] sfc: obtain decoder and region if committed by firmware alejandro.lucero-palau
2026-02-11 22:10   ` Cheatham, Benjamin
2026-02-19  8:55     ` Alejandro Lucero Palau
2026-02-19 23:31   ` Dave Jiang
2026-02-20  8:08     ` Alejandro Lucero Palau
2026-03-20 17:25   ` Edward Cree
2026-02-01 15:54 ` [PATCH v23 12/22] cxl: Define a driver interface for HPA free space enumeration alejandro.lucero-palau
2026-02-11 22:10   ` Cheatham, Benjamin
2026-02-19  9:58     ` Alejandro Lucero Palau
2026-02-19 17:29       ` Cheatham, Benjamin
2026-02-20 15:42   ` Dave Jiang
2026-02-26 16:13   ` Alejandro Lucero Palau
2026-02-01 15:54 ` [PATCH v23 13/22] sfc: get root decoder alejandro.lucero-palau
2026-02-01 15:54 ` [PATCH v23 14/22] cxl: Define a driver interface for DPA allocation alejandro.lucero-palau
2026-02-11 22:10   ` Cheatham, Benjamin
2026-02-11 22:12   ` Cheatham, Benjamin
2026-02-19 10:26     ` Alejandro Lucero Palau
2026-02-13 16:14   ` [PATCH " Gregory Price
2026-02-16 12:34     ` Alejandro Lucero Palau
2026-02-01 15:54 ` [PATCH v23 15/22] sfc: get endpoint decoder alejandro.lucero-palau
2026-02-01 15:54 ` [PATCH v23 16/22] cxl: Make region type based on endpoint type alejandro.lucero-palau
2026-02-11 22:11   ` Cheatham, Benjamin
2026-02-01 15:54 ` [PATCH v23 17/22] cxl/region: Factor out interleave ways setup alejandro.lucero-palau
2026-02-11 22:11   ` Cheatham, Benjamin
2026-02-19 10:40     ` Alejandro Lucero Palau
2026-02-19 17:29       ` Cheatham, Benjamin
2026-02-01 15:54 ` [PATCH v23 18/22] cxl/region: Factor out interleave granularity setup alejandro.lucero-palau
2026-02-11 22:11   ` Cheatham, Benjamin
2026-02-01 15:54 ` [PATCH v23 19/22] cxl: Allow region creation by type2 drivers alejandro.lucero-palau
2026-02-11 22:11   ` Cheatham, Benjamin
2026-02-19 10:48     ` Alejandro Lucero Palau
2026-02-01 15:54 ` [PATCH v23 20/22] cxl: Avoid dax creation for accelerators alejandro.lucero-palau
2026-02-11 22:10   ` Cheatham, Benjamin
2026-02-19 10:50     ` Alejandro Lucero Palau
2026-02-01 15:54 ` [PATCH v23 21/22] sfc: create cxl region alejandro.lucero-palau
2026-02-13 16:14   ` [PATCH " Gregory Price
2026-02-20  8:00     ` Alejandro Lucero Palau
2026-02-01 15:54 ` [PATCH v23 22/22] sfc: support pio mapping based on cxl alejandro.lucero-palau
2026-02-13 16:14   ` [PATCH " Gregory Price
2026-02-20  8:04     ` Alejandro Lucero Palau
2026-02-11 22:12 ` [PATCH v23 00/22] Type2 device basic support Cheatham, Benjamin
2026-03-09 22:43 ` PJ Waskiewicz
2026-03-10 14:02   ` Alejandro Lucero Palau
     [not found] ` <177370560728.3363103.17662978404400921244.git-patchwork-notify@kernel.org>
2026-03-18  7:42   ` Alejandro Lucero Palau
2026-03-18  8:45     ` Alejandro Lucero Palau
2026-03-18 16:35     ` Dave Jiang
2026-03-18 17:18       ` Alejandro Lucero Palau

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=dd2da064-3c75-4311-9d7a-cdc852b56733@amd.com \
    --to=alucerop@amd.com \
    --cc=alejandro.lucero-palau@amd.com \
    --cc=benjamin.cheatham@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 \
    --cc=ppwaskie@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.