From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Dave Jiang <dave.jiang@intel.com>
Cc: <linux-acpi@vger.kernel.org>, <linux-cxl@vger.kernel.org>,
<rafael@kernel.org>, <lenb@kernel.org>,
<dan.j.williams@intel.com>, <ira.weiny@intel.com>,
<vishal.l.verma@intel.com>, <alison.schofield@intel.com>,
<lukas@wunner.de>
Subject: Re: [PATCH 4/4] acpi: numa: Add helper function to retrieve the performance attributes
Date: Fri, 12 May 2023 17:25:41 +0100 [thread overview]
Message-ID: <20230512172541.00005669@Huawei.com> (raw)
In-Reply-To: <168333153420.2290593.8903766148018143689.stgit@djiang5-mobl3>
On Fri, 05 May 2023 17:05:34 -0700
Dave Jiang <dave.jiang@intel.com> wrote:
> Add helper to retrieve the performance attributes based on the device
> handle. The helper function is exported so the CXL driver can use that
> to acquire the performance data between the CPU and the CXL host bridge.
>
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Trivial comment inline. Otherwise LGTM
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---
> drivers/acpi/numa/hmat.c | 35 +++++++++++++++++++++++++++++++++++
> include/linux/acpi.h | 9 +++++++++
> 2 files changed, 44 insertions(+)
>
> diff --git a/drivers/acpi/numa/hmat.c b/drivers/acpi/numa/hmat.c
> index 951579e903cf..73d716e6096e 100644
> --- a/drivers/acpi/numa/hmat.c
> +++ b/drivers/acpi/numa/hmat.c
> @@ -107,6 +107,41 @@ static struct memory_target *find_mem_target(unsigned int mem_pxm)
> return NULL;
> }
>
> +static struct memory_target *acpi_find_genport_target(u8 *device_handle)
> +{
> + struct memory_target *target;
> +
> + list_for_each_entry(target, &targets, node) {
> + if (!strncmp(target->device_handle, device_handle,
> + ACPI_SRAT_DEVICE_HANDLE_SIZE))
Using this for something that isn't a string?
memcmp() ?
Mind you I'm not sure what the nameless author this code was doing
in packing the device handle as a u8 array rather than a union of the two
types it can contain. They probably had a reason lost to the mists of time...
> + return target;
> + }
> +
> + return NULL;
> +}
> +
> +/**
> + * acpi_get_genport_coordinates - Retrieve the access coordinates for a generic port
> + * @device_handle: Device handle string (ACPI or PCI) to match up to the gen port
> + * @coord: The access coordinates written back out for the generic port
> + *
> + * Return: 0 on success. Errno on failure.
> + */
> +int acpi_get_genport_coordinates(u8 *device_handle,
> + struct access_coordinate *coord)
> +{
> + struct memory_target *target;
> +
> + target = acpi_find_genport_target(device_handle);
> + if (!target)
> + return -ENOENT;
> +
> + *coord = target->coord[NODE_ACCESS_CLASS_GENPORT];
> +
> + return 0;
> +}
> +EXPORT_SYMBOL_NS_GPL(acpi_get_genport_coordinates, CXL);
> +
> static __init void alloc_memory_initiator(unsigned int cpu_pxm)
> {
> struct memory_initiator *initiator;
> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
> index 4c3dfe7587e9..d6a99fa430dd 100644
> --- a/include/linux/acpi.h
> +++ b/include/linux/acpi.h
> @@ -15,6 +15,7 @@
> #include <linux/device.h>
> #include <linux/property.h>
> #include <linux/uuid.h>
> +#include <linux/node.h>
>
> #ifndef _LINUX
> #define _LINUX
> @@ -455,6 +456,8 @@ extern bool acpi_osi_is_win8(void);
> #ifdef CONFIG_ACPI_NUMA
> int acpi_map_pxm_to_node(int pxm);
> int acpi_get_node(acpi_handle handle);
> +int acpi_get_genport_coordinates(u8 *device_handle,
> + struct access_coordinate *coord);
>
> /**
> * pxm_to_online_node - Map proximity ID to online node
> @@ -489,6 +492,12 @@ static inline int acpi_get_node(acpi_handle handle)
> {
> return 0;
> }
> +
> +static inline int acpi_get_genport_coordinates(u8 *device_handle,
> + struct access_coordinate *coord)
> +{
> + return -EOPNOTSUPP;
> +}
> #endif
> extern int acpi_paddr_to_node(u64 start_addr, u64 size);
>
>
>
prev parent reply other threads:[~2023-05-12 16:26 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-06 0:05 [PATCH 0/4] acpi: numa: add target support for generic port to HMAT parsing Dave Jiang
2023-05-06 0:05 ` [PATCH 1/4] acpi: numa: Create enum for memory_target access coordinates indexing Dave Jiang
2023-05-12 15:43 ` Jonathan Cameron
2023-05-06 0:05 ` [PATCH 2/4] acpi: numa: Add genport target allocation to the HMAT parsing Dave Jiang
2023-05-12 16:00 ` Jonathan Cameron
2023-05-06 0:05 ` [PATCH 3/4] acpi: numa: Add setting of generic port system locality attributes Dave Jiang
2023-05-12 16:10 ` Jonathan Cameron
2023-05-12 16:16 ` Jonathan Cameron
2023-05-12 16:22 ` Dave Jiang
2023-05-06 0:05 ` [PATCH 4/4] acpi: numa: Add helper function to retrieve the performance attributes Dave Jiang
2023-05-12 16:25 ` Jonathan Cameron [this message]
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=20230512172541.00005669@Huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=alison.schofield@intel.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=ira.weiny@intel.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-cxl@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=rafael@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 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.