Skip to content

Commit ec50746

Browse files
xiongzubiaobgoglin
authored andcommitted
linux: add CXL device serial number
Signed-off-by: Zubiao Xiong <[email protected]>
1 parent 3efaa9c commit ec50746

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

doc/hwloc.doxy

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2109,13 +2109,16 @@ A Solaris-specific general processor type name, such as "i86pc".
21092109
These info attributes are attached to OS device objects specified in parentheses.
21102110

21112111
<dl>
2112-
<dt>Vendor, Model, Revision, SerialNumber, Size, SectorSize (Storage OS devices)</dt>
2113-
<dd>The vendor and model names, revision, serial number, size (in KiB = 1024 bytes)
2112+
<dt>Vendor, Model, Revision, Size, SectorSize (Storage OS devices)</dt>
2113+
<dd>The vendor and model names, revision, size (in KiB = 1024 bytes)
21142114
and SectorSize (in bytes).
21152115
</dd>
21162116
<dt>LinuxDeviceID (Storage OS devices)</dt>
21172117
<dd>The major/minor device number such as 8:0 of Linux device.
21182118
</dd>
2119+
<dt>SerialNumber (Storage and CXL Memory OS devices)</dt>
2120+
<dd>The serial number of the device.
2121+
</dd>
21192122
<dt>CXLRAMSize, CXLPMEMSize (CXL Memory OS devices)</dt>
21202123
<dd>The size of the volatile (RAM) or persistent (PMEM) memory
21212124
in a CXL Type-3 device.

hwloc/topology-linux.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6837,6 +6837,14 @@ hwloc_linuxfs_cxlmem_fillinfos(int root_fd,
68376837
hwloc_obj_add_info(obj, "CXLPMEMSize", tmp);
68386838
}
68396839
}
6840+
6841+
snprintf(path, sizeof(path), "%s/serial", osdevpath);
6842+
if (hwloc_read_path_by_length(path, tmp, sizeof(tmp), root_fd) > 0) {
6843+
char *end = strchr(tmp, '\n');
6844+
if (end)
6845+
*end = '\0';
6846+
hwloc_obj_add_info(obj, "SerialNumber", tmp);
6847+
}
68406848
}
68416849

68426850
static int

0 commit comments

Comments
 (0)