Skip to content

Commit 3e76cff

Browse files
author
Mete Durlu
committed
s390/cio: Externalize full CMG characteristics
JIRA: https://issues.redhat.com/browse/RHEL-50790 commit 2f4b3b8 Author: Peter Oberparleiter <oberpar@linux.ibm.com> Date: Thu Nov 7 15:50:36 2024 +0100 s390/cio: Externalize full CMG characteristics The current "measurement_chars" CHPID sysfs attribute exposes only a limited, validity-filtered portion of data from the associated Channel- Measurements Characteristics Block (CMCB). New machine models add data that is relevant for userspace tooling to the "header"-portion of the CMCB. This data that is not currently accessible to userspace. To prevent having to add new sysfs attributes whenever a new bit of data is added to the CMCB "header", add a new sysfs attribute named "measurement_chars_full" that exposes the full, unfiltered CMCB. Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com> Reviewed-by: Vineeth Vijayan <vneethv@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Mete Durlu <mdurlu@redhat.com>
1 parent dad607f commit 3e76cff

File tree

4 files changed

+39
-20
lines changed

4 files changed

+39
-20
lines changed

drivers/s390/cio/chp.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,18 @@ static ssize_t measurement_chars_read(struct file *filp, struct kobject *kobj,
144144
}
145145
static BIN_ATTR_ADMIN_RO(measurement_chars, sizeof(struct cmg_chars));
146146

147+
static ssize_t measurement_chars_full_read(struct file *filp,
148+
struct kobject *kobj,
149+
struct bin_attribute *bin_attr,
150+
char *buf, loff_t off, size_t count)
151+
{
152+
struct channel_path *chp = to_channelpath(kobj_to_dev(kobj));
153+
154+
return memory_read_from_buffer(buf, count, &off, &chp->cmcb,
155+
sizeof(chp->cmcb));
156+
}
157+
static BIN_ATTR_ADMIN_RO(measurement_chars_full, sizeof(struct cmg_cmcb));
158+
147159
static ssize_t chp_measurement_copy_block(void *buf, loff_t off, size_t count,
148160
struct kobject *kobj, bool extended)
149161
{
@@ -201,6 +213,7 @@ static BIN_ATTR_ADMIN_RO(ext_measurement, sizeof(struct cmg_ext_entry));
201213

202214
static struct bin_attribute *measurement_attrs[] = {
203215
&bin_attr_measurement_chars,
216+
&bin_attr_measurement_chars_full,
204217
&bin_attr_measurement,
205218
&bin_attr_ext_measurement,
206219
NULL,

drivers/s390/cio/chp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ struct channel_path {
5454
int extended;
5555
unsigned long speed;
5656
struct cmg_chars cmg_chars;
57+
struct cmg_cmcb cmcb;
5758
};
5859

5960
/* Return channel_path struct for given chpid. */

drivers/s390/cio/chsc.c

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,19 +1078,7 @@ int chsc_get_channel_measurement_chars(struct channel_path *chp)
10781078
u32 zeroes1;
10791079
struct chsc_header response;
10801080
u32 zeroes2;
1081-
u32 not_valid : 1;
1082-
u32 shared : 1;
1083-
u32 extended : 1;
1084-
u32 : 21;
1085-
u32 chpid : 8;
1086-
u32 cmcv : 5;
1087-
u32 : 7;
1088-
u32 cmgp : 4;
1089-
u32 cmgq : 8;
1090-
u32 cmg : 8;
1091-
u32 : 16;
1092-
u32 cmgs : 16;
1093-
u32 data[NR_MEASUREMENT_CHARS];
1081+
struct cmg_cmcb cmcb;
10941082
} *scmc_area;
10951083

10961084
chp->shared = -1;
@@ -1121,15 +1109,16 @@ int chsc_get_channel_measurement_chars(struct channel_path *chp)
11211109
scmc_area->response.code);
11221110
goto out;
11231111
}
1124-
if (scmc_area->not_valid)
1112+
chp->cmcb = scmc_area->cmcb;
1113+
if (scmc_area->cmcb.not_valid)
11251114
goto out;
11261115

1127-
chp->cmg = scmc_area->cmg;
1128-
chp->shared = scmc_area->shared;
1129-
chp->extended = scmc_area->extended;
1130-
chp->speed = scmc_get_speed(scmc_area->cmgs, scmc_area->cmgp);
1131-
chsc_initialize_cmg_chars(chp, scmc_area->cmcv,
1132-
(struct cmg_chars *) &scmc_area->data);
1116+
chp->cmg = scmc_area->cmcb.cmg;
1117+
chp->shared = scmc_area->cmcb.shared;
1118+
chp->extended = scmc_area->cmcb.extended;
1119+
chp->speed = scmc_get_speed(scmc_area->cmcb.cmgs, scmc_area->cmcb.cmgp);
1120+
chsc_initialize_cmg_chars(chp, scmc_area->cmcb.cmcv,
1121+
(struct cmg_chars *)&scmc_area->cmcb.data);
11331122
out:
11341123
spin_unlock_irqrestore(&chsc_page_lock, flags);
11351124
return ret;

drivers/s390/cio/chsc.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,22 @@ struct cmg_chars {
1717
u32 values[NR_MEASUREMENT_CHARS];
1818
};
1919

20+
struct cmg_cmcb {
21+
u32 not_valid : 1;
22+
u32 shared : 1;
23+
u32 extended : 1;
24+
u32 : 21;
25+
u32 chpid : 8;
26+
u32 cmcv : 5;
27+
u32 : 7;
28+
u32 cmgp : 4;
29+
u32 cmgq : 8;
30+
u32 cmg : 8;
31+
u32 : 16;
32+
u32 cmgs : 16;
33+
u32 data[NR_MEASUREMENT_CHARS];
34+
};
35+
2036
#define NR_MEASUREMENT_ENTRIES 8
2137
struct cmg_entry {
2238
u32 values[NR_MEASUREMENT_ENTRIES];

0 commit comments

Comments
 (0)