From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Dave Jiang <dave.jiang@intel.com>
Cc: <linux-cxl@vger.kernel.org>, <dan.j.williams@intel.com>,
<ira.weiny@intel.com>, <vishal.l.verma@intel.com>,
<alison.schofield@intel.com>
Subject: Re: [PATCH v6 06/11] cxl: Store the access coordinates for the generic ports
Date: Thu, 1 Jun 2023 15:20:42 +0100 [thread overview]
Message-ID: <20230601152042.0000575b@Huawei.com> (raw)
In-Reply-To: <168451603029.3470703.13447576080193633262.stgit@djiang5-mobl3>
On Fri, 19 May 2023 10:07:10 -0700
Dave Jiang <dave.jiang@intel.com> wrote:
> Each CXL host bridge is represented by an ACPI0016 device. A generic port
> device handle that is an ACPI device is represented by a string of
> ACPI0016 device HID and UID. Create a device handle from the ACPI device
> and retrieve the access coordinates from the stored memory targets. The
> access coordinates are stored under the cxl_dport that is associated with
> the CXL host bridge.
>
> The access coordinates struct is dynamically allocated under cxl_dport in
> order for code later on to detect whether the data exists or not.
>
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
>
Trivial suggestion inline.
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
I guess I got distracted a while back and only half reviewed this version.
Sorry about the delay!
> ---
> v6:
> - Change memcpy to strncpy. ACPI HID and UID are strings.
> ---
> drivers/cxl/acpi.c | 22 ++++++++++++++++++++++
> drivers/cxl/cxl.h | 2 ++
> 2 files changed, 24 insertions(+)
>
> diff --git a/drivers/cxl/acpi.c b/drivers/cxl/acpi.c
> index 8247df06d683..0c22cc9dbcba 100644
> --- a/drivers/cxl/acpi.c
> +++ b/drivers/cxl/acpi.c
> @@ -557,8 +557,26 @@ static int cxl_get_chbcr(union acpi_subtable_headers *header, void *arg,
> return 0;
> }
>
> +static int get_genport_coordinates(struct device *dev, struct cxl_dport *dport)
> +{
> + struct acpi_device *hb = to_cxl_host_bridge(NULL, dev);
> + u8 handle[ACPI_SRAT_DEVICE_HANDLE_SIZE] = { 0 };
> + int rc;
> +
> + /* ACPI spec 6.5 table 5.65 */
> + strncpy(handle, acpi_device_hid(hb), 8);
> + strncpy(&handle[8], acpi_device_uid(hb), 4);
> +
> + rc = acpi_get_genport_coordinates(handle, &dport->hb_access);
> + if (rc)
> + return rc;
return acpi_get_genport....
and get rid of local variable rc as no longer used.
> +
> + return 0;
> +}
> +
> static int add_host_bridge_dport(struct device *match, void *arg)
> {
> + int ret;
> acpi_status rc;
> struct device *bridge;
> unsigned long long uid;
> @@ -614,6 +632,10 @@ static int add_host_bridge_dport(struct device *match, void *arg)
> if (IS_ERR(dport))
> return PTR_ERR(dport);
>
> + ret = get_genport_coordinates(match, dport);
> + if (ret)
> + dev_dbg(match, "Failed to get generic port perf coordinates.\n");
> +
> return 0;
> }
>
> diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h
> index 3d0c8c63f6d6..2369e91add63 100644
> --- a/drivers/cxl/cxl.h
> +++ b/drivers/cxl/cxl.h
> @@ -636,6 +636,7 @@ cxl_find_dport_by_dev(struct cxl_port *port, const struct device *dport_dev)
> * @rcrb: base address for the Root Complex Register Block
> * @rch: Indicate whether this dport was enumerated in RCH or VH mode
> * @port: reference to cxl_port that contains this downstream port
> + * @genport_coord: access coordinates (performance) from ACPI generic port
> * @coord: access coordinates (performance) for switch from CDAT
> * @link_latency: calculated PCIe downstream latency
> */
> @@ -646,6 +647,7 @@ struct cxl_dport {
> resource_size_t rcrb;
> bool rch;
> struct cxl_port *port;
> + struct access_coordinate hb_access;
> struct access_coordinate coord;
> long link_latency;
> };
>
>
next prev parent reply other threads:[~2023-06-01 14:21 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-19 17:06 [PATCH v6 00/11] cxl: Add support for QTG ID retrieval for CXL subsystem Dave Jiang
2023-05-19 17:06 ` [PATCH v6 01/11] cxl: Add callback to parse the DSMAS subtables from CDAT Dave Jiang
2023-05-25 16:43 ` Jonathan Cameron
2023-05-19 17:06 ` [PATCH v6 02/11] cxl: Add callback to parse the DSLBIS subtable " Dave Jiang
2023-05-19 17:06 ` [PATCH v6 03/11] cxl: Add callback to parse the SSLBIS " Dave Jiang
2023-05-19 17:06 ` [PATCH v6 04/11] cxl: Add support for _DSM Function for retrieving QTG ID Dave Jiang
2023-05-25 16:44 ` Jonathan Cameron
2023-05-25 21:09 ` Dave Jiang
2023-05-19 17:07 ` [PATCH v6 05/11] cxl: Calculate and store PCI link latency for the downstream ports Dave Jiang
2023-05-19 17:07 ` [PATCH v6 06/11] cxl: Store the access coordinates for the generic ports Dave Jiang
2023-06-01 14:20 ` Jonathan Cameron [this message]
2023-05-19 17:07 ` [PATCH v6 07/11] cxl: Add helper function that calculate performance data for downstream ports Dave Jiang
2023-05-19 17:07 ` [PATCH v6 08/11] cxl: Compute the entire CXL path latency and bandwidth data Dave Jiang
2023-05-19 17:07 ` [PATCH v6 09/11] cxl: Store QTG IDs and related info to the CXL memory device context Dave Jiang
2023-06-01 14:32 ` Jonathan Cameron
2023-05-19 17:07 ` [PATCH v6 10/11] cxl: Export sysfs attributes for memory device QoS class Dave Jiang
2023-06-01 14:30 ` Jonathan Cameron
2023-06-01 17:13 ` Dave Jiang
2023-05-19 17:07 ` [PATCH v6 11/11] cxl/mem: Add debugfs output for QTG related data 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=20230601152042.0000575b@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=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