Linux CXL
 help / color / mirror / Atom feed
From: Dave Jiang <dave.jiang@intel.com>
To: Ira Weiny <ira.weiny@intel.com>, linux-cxl@vger.kernel.org
Cc: dave@stgolabs.net, jonathan.cameron@huawei.com,
	alison.schofield@intel.com, vishal.l.verma@intel.com,
	dan.j.williams@intel.com, Robert Richter <rrichter@amd.com>
Subject: Re: [PATCH] cxl: Move port register setup to when first dport appear
Date: Thu, 18 Sep 2025 14:05:47 -0700	[thread overview]
Message-ID: <b928abb5-17bb-4c6c-863c-5f32db3b07d5@intel.com> (raw)
In-Reply-To: <68cc5df08dbe3_18f197294e6@iweiny-mobl.notmuch>



On 9/18/25 12:30 PM, Ira Weiny wrote:
> Dave Jiang wrote:
> 
> [snip]
> 
>>
>> diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c
>> index 76dd06d282df..416d45516d82 100644
>> --- a/drivers/cxl/core/port.c
>> +++ b/drivers/cxl/core/port.c
>> @@ -867,9 +867,7 @@ static int cxl_port_add(struct cxl_port *port,
>>  		if (rc)
>>  			return rc;
>>  
>> -		rc = cxl_port_setup_regs(port, component_reg_phys);
>> -		if (rc)
>> -			return rc;
>> +		port->component_reg_phys = component_reg_phys;
>>  	} else {
>>  		rc = dev_set_name(dev, "root%d", port->id);
>>  		if (rc)
>> @@ -1200,6 +1198,18 @@ __devm_cxl_add_dport(struct cxl_port *port, struct device *dport_dev,
>>  
>>  	cxl_debugfs_create_dport_dir(dport);
>>  
>> +	/*
>> +	 * Setup port register if this is the first dport showed up. Having
>> +	 * a dport also means that there is at least 1 active link.
>> +	 */
>> +	if (port->nr_dports == 1 &&
>> +	    port->component_reg_phys != CXL_RESOURCE_NONE) {
> 
> Should this be
> 	    port->component_reg_phys == CXL_RESOURCE_NONE) {
> 	                             ^^
> ?
> 
> to match with 
> 
>         /* Note: endpoint port component registers are derived from @cxlds */
>         endpoint = devm_cxl_add_port(host, &cxlmd->dev, CXL_RESOURCE_NONE,
>                                      parent_dport);
> 
> in the memdev probe path?


No. port->component_reg_phys gets set in cxl_port_add(). So by the time the first dport shows up, we are using it to setup the register and then setting that back to CXL_RESOURCE_NONE. So therefore the port probe happens when it's the first dport and port->component_reg_phys is a valid address. 
 
> 
> Ira
> 
> [snip]


  reply	other threads:[~2025-09-18 21:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-11 20:44 [PATCH] cxl: Move port register setup to when first dport appear Dave Jiang
2025-09-18 18:05 ` Alison Schofield
2025-09-18 19:30 ` Ira Weiny
2025-09-18 21:05   ` Dave Jiang [this message]
2025-09-18 21:28     ` Ira Weiny
2025-09-18 22:07 ` Dave Jiang

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=b928abb5-17bb-4c6c-863c-5f32db3b07d5@intel.com \
    --to=dave.jiang@intel.com \
    --cc=alison.schofield@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave@stgolabs.net \
    --cc=ira.weiny@intel.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=rrichter@amd.com \
    --cc=vishal.l.verma@intel.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