Skip to content

Commit 529c0a4

Browse files
davejiangdjbw
authored andcommitted
cxl: Export QTG ids from CFMWS to sysfs as qos_class attribute
Export the QoS Throttling Group ID from the CXL Fixed Memory Window Structure (CFMWS) under the root decoder sysfs attributes as qos_class. CXL rev3.0 9.17.1.3 CXL Fixed Memory Window Structure (CFMWS) cxl cli will use this id to match with the _DSM retrieved id for a hot-plugged CXL memory device DPA memory range to make sure that the DPA range is under the right CFMWS window. Reviewed-by: Davidlohr Bueso <dave@stgolabs.net> Reviewed-by: Ira Weiny <ira.weiny@intel.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Dave Jiang <dave.jiang@intel.com> Link: https://lore.kernel.org/r/169713681699.2205276.14475306324720093079.stgit@djiang5-mobl3 Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent 178e1ea commit 529c0a4

File tree

4 files changed

+32
-0
lines changed

4 files changed

+32
-0
lines changed

Documentation/ABI/testing/sysfs-bus-cxl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,21 @@ Description:
369369
provided it is currently idle / not bound to a driver.
370370

371371

372+
What: /sys/bus/cxl/devices/decoderX.Y/qos_class
373+
Date: May, 2023
374+
KernelVersion: v6.5
375+
Contact: linux-cxl@vger.kernel.org
376+
Description:
377+
(RO) For CXL host platforms that support "QoS Telemmetry" this
378+
root-decoder-only attribute conveys a platform specific cookie
379+
that identifies a QoS performance class for the CXL Window.
380+
This class-id can be compared against a similar "qos_class"
381+
published for each memory-type that an endpoint supports. While
382+
it is not required that endpoints map their local memory-class
383+
to a matching platform class, mismatches are not recommended and
384+
there are platform specific side-effects that may result.
385+
386+
372387
What: /sys/bus/cxl/devices/regionZ/uuid
373388
Date: May, 2022
374389
KernelVersion: v6.0

drivers/cxl/acpi.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,9 @@ static int cxl_parse_cfmws(union acpi_subtable_headers *header, void *arg,
289289
}
290290
}
291291
}
292+
293+
cxlrd->qos_class = cfmws->qtg_id;
294+
292295
rc = cxl_decoder_add(cxld, target_map);
293296
err_xormap:
294297
if (rc)

drivers/cxl/core/port.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,15 @@ static ssize_t interleave_ways_show(struct device *dev,
278278

279279
static DEVICE_ATTR_RO(interleave_ways);
280280

281+
static ssize_t qos_class_show(struct device *dev,
282+
struct device_attribute *attr, char *buf)
283+
{
284+
struct cxl_root_decoder *cxlrd = to_cxl_root_decoder(dev);
285+
286+
return sysfs_emit(buf, "%d\n", cxlrd->qos_class);
287+
}
288+
static DEVICE_ATTR_RO(qos_class);
289+
281290
static struct attribute *cxl_decoder_base_attrs[] = {
282291
&dev_attr_start.attr,
283292
&dev_attr_size.attr,
@@ -297,6 +306,7 @@ static struct attribute *cxl_decoder_root_attrs[] = {
297306
&dev_attr_cap_type2.attr,
298307
&dev_attr_cap_type3.attr,
299308
&dev_attr_target_list.attr,
309+
&dev_attr_qos_class.attr,
300310
SET_CXL_REGION_ATTR(create_pmem_region)
301311
SET_CXL_REGION_ATTR(create_ram_region)
302312
SET_CXL_REGION_ATTR(delete_region)
@@ -1691,6 +1701,7 @@ struct cxl_root_decoder *cxl_root_decoder_alloc(struct cxl_port *port,
16911701
}
16921702

16931703
atomic_set(&cxlrd->region_id, rc);
1704+
cxlrd->qos_class = CXL_QOS_CLASS_INVALID;
16941705
return cxlrd;
16951706
}
16961707
EXPORT_SYMBOL_NS_GPL(cxl_root_decoder_alloc, CXL);

drivers/cxl/cxl.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ enum cxl_decoder_type {
321321
*/
322322
#define CXL_DECODER_MAX_INTERLEAVE 16
323323

324+
#define CXL_QOS_CLASS_INVALID -1
324325

325326
/**
326327
* struct cxl_decoder - Common CXL HDM Decoder Attributes
@@ -432,6 +433,7 @@ typedef struct cxl_dport *(*cxl_calc_hb_fn)(struct cxl_root_decoder *cxlrd,
432433
* @calc_hb: which host bridge covers the n'th position by granularity
433434
* @platform_data: platform specific configuration data
434435
* @range_lock: sync region autodiscovery by address range
436+
* @qos_class: QoS performance class cookie
435437
* @cxlsd: base cxl switch decoder
436438
*/
437439
struct cxl_root_decoder {
@@ -440,6 +442,7 @@ struct cxl_root_decoder {
440442
cxl_calc_hb_fn calc_hb;
441443
void *platform_data;
442444
struct mutex range_lock;
445+
int qos_class;
443446
struct cxl_switch_decoder cxlsd;
444447
};
445448

0 commit comments

Comments
 (0)