[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aNp-CHdi9xnXF-Pp@rric.localdomain>
Date: Mon, 29 Sep 2025 14:39:36 +0200
From: Robert Richter <rrichter@....com>
To: Gregory Price <gourry@...rry.net>
Cc: Alison Schofield <alison.schofield@...el.com>,
Vishal Verma <vishal.l.verma@...el.com>,
Ira Weiny <ira.weiny@...el.com>,
Dan Williams <dan.j.williams@...el.com>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>,
Dave Jiang <dave.jiang@...el.com>,
Davidlohr Bueso <dave@...olabs.net>, linux-cxl@...r.kernel.org,
linux-kernel@...r.kernel.org,
"Fabio M. De Francesco" <fabio.m.de.francesco@...ux.intel.com>,
Terry Bowman <terry.bowman@....com>,
Joshua Hahn <joshua.hahnjy@...il.com>
Subject: Re: [PATCH v3 11/11] cxl: Enable AMD Zen5 address translation using
ACPI PRMT
On 26.09.25 21:44:43, Gregory Price wrote:
> On Fri, Sep 26, 2025 at 06:59:40PM +0200, Robert Richter wrote:
> > On 24.09.25 13:09:46, Gregory Price wrote:
> > > On Fri, Sep 12, 2025 at 04:45:13PM +0200, Robert Richter wrote:
> > > > +static void cxl_prm_init(struct cxl_port *port)
> > > > +{
> > > > + u64 spa;
> > > > + struct prm_cxl_dpa_spa_data data = { .out = &spa, };
> > > > + int rc;
> > > > +
> > > > + if (!check_prm_address_translation(port))
> > > > + return;
> > > > +
> > > > + /* Check kernel (-EOPNOTSUPP) and firmware support (-ENODEV) */
> > > > + rc = acpi_call_prm_handler(prm_cxl_dpa_spa_guid, &data);
> > > > + if (rc == -EOPNOTSUPP || rc == -ENODEV)
> > > > + return;
> > > > +
> > > > + port->to_hpa = cxl_prm_to_hpa;
> > > > +
> > > > + dev_dbg(port->host_bridge, "PRM address translation enabled for %s.\n",
> > > > + dev_name(&port->dev));
> > > > +}
> > >
> > > Is it possible that the PRMT function is present but uninitialize?
> > > For example if expanders are not in a normalized address mode.
> > >
> > > This code would likely still add the to_hpa() function reference even
> > > if the underlying PRMT function hasn't been set up for translation.
> >
> > At this point during init, it is not yet possible to determine
> > normalized address mode. Endpoint and hdm decoders are still unknown.
> > Thus, PRM is enabled for the port. Later, during region setup, there is
> > a check for that while determining the region's HPA range. Addresses
> > are translated and ranges adjusted only if needed. Once the ranges are
> > set up, no further PRM handler calls are executed.
> >
>
> Right, but that errors out if address translation fails (below).
>
> Is this code missing a check for the endpoint_decoder.start==0?
Right, it looks like the code does some unnecessary recalculation for
the SPA case. There is the following check for Normalized Addressing
in cxl_prm_to_hpa() which already bypasses the prm call:
if (cxld->hpa_range.start != cxled->dpa_res->start)
return hpa;
But setup_address_translation() continues and recalculates ways and
gran. Finally this should result in the same parameters. I will do
some testing for SPA mode and expect the addr translation debug
messages to show up in this mode too. As a side effect, decoders in
SPA mode will be locked. Need to confirm this and will fix that.
Thanks for catching this,
-Robert
Powered by blists - more mailing lists