Re: [PATCH v1 25/29] cxl/amd: Enable Zen5 address translation using ACPI PRMT

From: Gregory Price
Date: Wed Jan 08 2025 - 10:52:23 EST


On Tue, Jan 07, 2025 at 03:10:11PM +0100, Robert Richter wrote:
> Add AMD platform specific Zen5 support for address translation.
>
... snip ...
>
> Once the endpoint is attached to a region and its SPA range is know,
> calling the PRM is no longer needed, the SPA base can be used.
>
> Signed-off-by: Robert Richter <rrichter@xxxxxxx>

One inline question, but not a blocker

Reviewed-by: Gregory Price <gourry@xxxxxxxxxx>

> ---
> drivers/cxl/Kconfig | 4 +
> drivers/cxl/core/Makefile | 1 +
> drivers/cxl/core/amd.c | 227 ++++++++++++++++++++++++++++++++++++++
> drivers/cxl/core/core.h | 6 +
> drivers/cxl/core/port.c | 7 ++
> 5 files changed, 245 insertions(+)
> create mode 100644 drivers/cxl/core/amd.c
>
> diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c
> index 901555bf4b73..c8176265c15c 100644
> --- a/drivers/cxl/core/port.c
> +++ b/drivers/cxl/core/port.c
> @@ -831,6 +831,11 @@ static void cxl_debugfs_create_dport_dir(struct cxl_dport *dport)
> &cxl_einj_inject_fops);
> }
>
> +static void cxl_port_platform_setup(struct cxl_port *port)
> +{
> + cxl_port_setup_amd(port);
> +}
> +

Assuming this gets expanded (which it may not), should we expect this
function to end up like so?

static void cxl_port_platform_setup(struct cxl_port *port)
{
cxl_port_setup_amd(port);
cxl_port_setup_intel(port);
cxl_port_setup_arm(port);
... etc ...
}

I suppose this logic has to exist somewhere in some form, just want to make
sure this is what we want. Either way, this is easily modifiable, so
not a blocker as I said.

> static int cxl_port_add(struct cxl_port *port,
> resource_size_t component_reg_phys,
> struct cxl_dport *parent_dport)
> @@ -868,6 +873,8 @@ static int cxl_port_add(struct cxl_port *port,
> return rc;
> }
>
> + cxl_port_platform_setup(port);
> +
> rc = device_add(dev);
> if (rc)
> return rc;
> --
> 2.39.5
>