Re: [PATCH v4 12/28] cxl/cdat: Gather DSMAS data for DCD regions
From: Jonathan Cameron
Date: Thu Oct 10 2024 - 08:51:34 EST
On Mon, 07 Oct 2024 18:16:18 -0500
Ira Weiny <ira.weiny@xxxxxxxxx> wrote:
> Additional DCD region (partition) information is contained in the DSMAS
> CDAT tables, including performance, read only, and shareable attributes.
>
> Match DCD partitions with DSMAS tables and store the meta data.
>
> To: Robert Moore <robert.moore@xxxxxxxxx>
> To: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
> To: Len Brown <lenb@xxxxxxxxxx>
> Cc: linux-acpi@xxxxxxxxxxxxxxx
> Cc: acpica-devel@xxxxxxxxxxxxxxx
> Signed-off-by: Ira Weiny <ira.weiny@xxxxxxxxx>
One trivial comment from me.
As Rafael has raised, the ACPICA dependency in here is
going to be the blocker :(
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
> +static void update_dcd_perf(struct cxl_dev_state *cxlds,
> + struct dsmas_entry *dent)
> +{
> + struct cxl_memdev_state *mds = to_cxl_memdev_state(cxlds);
> + struct device *dev = cxlds->dev;
> +
> + for (int i = 0; i < mds->nr_dc_region; i++) {
> + /* CXL defines a u32 handle while cdat defines u8, ignore upper bits */
CDAT
> + u8 dc_handle = mds->dc_region[i].dsmad_handle & 0xff;
> +
> + if (resource_size(&cxlds->dc_res[i])) {
> + struct range dc_range = {
> + .start = cxlds->dc_res[i].start,
> + .end = cxlds->dc_res[i].end,
> + };
> +
> + if (range_contains(&dent->dpa_range, &dc_range)) {
> + if (dent->handle != dc_handle)
> + dev_warn(dev, "DC Region/DSMAS mis-matched handle/range; region %pra (%u); dsmas %pra (%u)\n"
> + " setting DC region attributes regardless\n",
> + &dent->dpa_range, dent->handle,
> + &dc_range, dc_handle);
> +
> + mds->dc_region[i].shareable = dent->shareable;
> + mds->dc_region[i].read_only = dent->read_only;
> + update_perf_entry(dev, dent, &mds->dc_perf[i]);
> + }
> + }
> + }
> +}