From: Dave Jiang <dave.jiang@intel.com>
To: "Fabio M. De Francesco" <fabio.m.de.francesco@linux.intel.com>
Cc: linux-cxl@vger.kernel.org, dave@stgolabs.net,
jonathan.cameron@huawei.com, alison.schofield@intel.com,
vishal.l.verma@intel.com, ira.weiny@intel.com,
dan.j.williams@intel.com
Subject: Re: [PATCH] cxl: Remove core/acpi.c and cxl core dependency on ACPI
Date: Mon, 9 Jun 2025 16:59:12 -0700 [thread overview]
Message-ID: <ea55b113-510c-470d-934c-38915cd7137e@intel.com> (raw)
In-Reply-To: <2529357.LH7GnMWURc@fdefranc-mobl3>
On 6/9/25 10:03 AM, Fabio M. De Francesco wrote:
> Hi Dave,
>
> On Thursday, June 5, 2025 2:11:47 AM Central European Summer Time Dave Jiang wrote:
>> It was a mistake to introduce core/acpi.c and putting ACPI dependency on
>> cxl_core when adding the extended linear cache support. Add a callback
>> in the cxl_root_decoder to retrieve the extended linear cache size from
>> ACPI via the cxl_acpi driver.
>>
>> In order to deal with cxl_test, a device parameter had to be introduced
>> to the hmat_get_extended_linear_cache_size() call in order to help with
>> the mock wrapped function from ACPI. Even though the 'struct device' is
>> not used by the actual hmat_get_extended_linear_cache_size() function.
>>
>> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
>> ---
>> drivers/acpi/numa/hmat.c | 4 +++-
>> drivers/cxl/acpi.c | 15 ++++++++++++++-
>> drivers/cxl/core/Makefile | 1 -
>> drivers/cxl/core/acpi.c | 11 -----------
>> drivers/cxl/core/core.h | 2 --
>> drivers/cxl/core/port.c | 5 ++++-
>> drivers/cxl/core/region.c | 6 +++++-
>> drivers/cxl/cxl.h | 12 +++++++++++-
>> include/linux/acpi.h | 6 ++++--
>> tools/testing/cxl/Kbuild | 2 +-
>> tools/testing/cxl/test/cxl.c | 20 ++++++++++++++++++++
>> tools/testing/cxl/test/mock.c | 23 +++++++++++++++++++++++
>> tools/testing/cxl/test/mock.h | 4 ++++
>> 13 files changed, 89 insertions(+), 22 deletions(-)
>> delete mode 100644 drivers/cxl/core/acpi.c
>>
>> diff --git a/drivers/acpi/numa/hmat.c b/drivers/acpi/numa/hmat.c
>> index 9d9052258e92..bc8441dc7fe2 100644
>> --- a/drivers/acpi/numa/hmat.c
>> +++ b/drivers/acpi/numa/hmat.c
>> @@ -110,6 +110,7 @@ static struct memory_target *find_mem_target(unsigned int mem_pxm)
>>
>> /**
>> * hmat_get_extended_linear_cache_size - Retrieve the extended linear cache size
>> + * @dev: device for debug output
>
> Isn't dev used to find a port check if it is a mock one?
> BTW, should the test part go to a separate patch?
I'm dropping the dev parameter. So this change should go away.
>
>> * @backing_res: resource from the backing media
>> * @nid: node id for the memory region
>> * @cache_size: (Output) size of extended linear cache.
>> @@ -117,7 +118,8 @@ static struct memory_target *find_mem_target(unsigned int mem_pxm)
>> * Return: 0 on success. Errno on failure.
>> *
>> */
>> -int hmat_get_extended_linear_cache_size(struct resource *backing_res, int nid,
>> +int hmat_get_extended_linear_cache_size(struct device *dev,
>> + struct resource *backing_res, int nid,
>> resource_size_t *cache_size)
>> {
>> unsigned int pxm = node_to_pxm(nid);
>> diff --git a/drivers/cxl/acpi.c b/drivers/cxl/acpi.c
>> index cb14829bb9be..7076d471ada5 100644
>> --- a/drivers/cxl/acpi.c
>> +++ b/drivers/cxl/acpi.c
>> @@ -337,6 +337,19 @@ static int add_or_reset_cxl_resource(struct resource *parent, struct resource *r
>> return rc;
>> }
>>
>> +static int cxl_acpi_get_extended_linear_cache_size(struct cxl_root_decoder *cxlrd,
>> + struct resource *backing_res,
>> + int nid,
>> + resource_size_t *size)
>> +{
>> + return hmat_get_extended_linear_cache_size(&cxlrd->cxlsd.cxld.dev,
>> + backing_res, nid, size);
>> +}
>> +
>> +static const struct cxl_rcd_ops acpi_rcd_ops = {
>
> What does _rcd_ stand for?
Not sure why I named it rcd. Going to change it to rd for root decoder.
>
>> + .get_extended_linear_cache_size = cxl_acpi_get_extended_linear_cache_size,
>> +};
>> +
>
> [skip]
>
>> };
>>
>> +static int mock_hmat_get_extended_linear_cache_size(struct device *dev,
>> + struct resource *backing_res,
>> + int nid, resource_size_t *size)
>> +{
>> + struct cxl_decoder *cxld;
>> + struct cxl_port *port;
>> +
>> + if (!is_root_decoder(dev))
>> + return -EINVAL;
>
> Is there any real chance that dev is not a root decoder? Is that check necessary?
dev getting dropped.
>
> Thanks,
>
> Fabio
>
>
> Thanks,
>
> Fabio
>
>
>
next prev parent reply other threads:[~2025-06-09 23:59 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-05 0:11 [PATCH] cxl: Remove core/acpi.c and cxl core dependency on ACPI Dave Jiang
2025-06-09 10:38 ` Jonathan Cameron
2025-06-09 15:10 ` Dave Jiang
2025-06-09 17:03 ` Fabio M. De Francesco
2025-06-09 23:59 ` Dave Jiang [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-06-10 0:02 Dave Jiang
2025-06-10 0:03 ` Dave Jiang
2025-07-11 15:15 Robert Richter
2025-07-11 15:40 ` Dave Jiang
2025-07-11 16:36 ` Jonathan Cameron
2025-07-11 18:30 ` Alison Schofield
2025-07-14 21:36 ` Dave Jiang
2025-07-14 23:51 ` Dave Jiang
2025-07-15 10:14 ` Robert Richter
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=ea55b113-510c-470d-934c-38915cd7137e@intel.com \
--to=dave.jiang@intel.com \
--cc=alison.schofield@intel.com \
--cc=dan.j.williams@intel.com \
--cc=dave@stgolabs.net \
--cc=fabio.m.de.francesco@linux.intel.com \
--cc=ira.weiny@intel.com \
--cc=jonathan.cameron@huawei.com \
--cc=linux-cxl@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).