Commit 61f0bfcf authored by Sebastian Ott's avatar Sebastian Ott Committed by Martin Schwidefsky

s390/cio: ensure consistent measurement state

Make sure that in all cases where we could not obtain measurement
characteristics the associated fields are set to invalid values.

Note: without this change the "shared" capability of a channel path
for which we could not obtain the measurement characteristics was
incorrectly displayed as 0 (not shared). We will now correctly
report "unknown" in this case.
Signed-off-by: default avatarSebastian Ott <sebott@linux.vnet.ibm.com>
Reviewed-by: default avatarPeter Oberparleiter <oberpar@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 0d9bfe91
...@@ -466,14 +466,11 @@ int chp_new(struct chp_id chpid) ...@@ -466,14 +466,11 @@ int chp_new(struct chp_id chpid)
ret = -ENODEV; ret = -ENODEV;
goto out_free; goto out_free;
} }
/* Get channel-measurement characteristics. */
if (css_chsc_characteristics.scmc && css_chsc_characteristics.secm) {
ret = chsc_get_channel_measurement_chars(chp); ret = chsc_get_channel_measurement_chars(chp);
if (ret) if (ret)
goto out_free; goto out_free;
} else {
chp->cmg = -1;
}
dev_set_name(&chp->dev, "chp%x.%02x", chpid.cssid, chpid.id); dev_set_name(&chp->dev, "chp%x.%02x", chpid.cssid, chpid.id);
/* make it known to the system */ /* make it known to the system */
......
...@@ -1003,6 +1003,12 @@ int chsc_get_channel_measurement_chars(struct channel_path *chp) ...@@ -1003,6 +1003,12 @@ int chsc_get_channel_measurement_chars(struct channel_path *chp)
u32 data[NR_MEASUREMENT_CHARS]; u32 data[NR_MEASUREMENT_CHARS];
} __attribute__ ((packed)) *scmc_area; } __attribute__ ((packed)) *scmc_area;
chp->shared = -1;
chp->cmg = -1;
if (!css_chsc_characteristics.scmc || !css_chsc_characteristics.secm)
return 0;
spin_lock_irq(&chsc_page_lock); spin_lock_irq(&chsc_page_lock);
memset(chsc_page, 0, PAGE_SIZE); memset(chsc_page, 0, PAGE_SIZE);
scmc_area = chsc_page; scmc_area = chsc_page;
...@@ -1023,11 +1029,9 @@ int chsc_get_channel_measurement_chars(struct channel_path *chp) ...@@ -1023,11 +1029,9 @@ int chsc_get_channel_measurement_chars(struct channel_path *chp)
scmc_area->response.code); scmc_area->response.code);
goto out; goto out;
} }
if (scmc_area->not_valid) { if (scmc_area->not_valid)
chp->cmg = -1;
chp->shared = -1;
goto out; goto out;
}
chp->cmg = scmc_area->cmg; chp->cmg = scmc_area->cmg;
chp->shared = scmc_area->shared; chp->shared = scmc_area->shared;
if (chp->cmg != 2 && chp->cmg != 3) { if (chp->cmg != 2 && chp->cmg != 3) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment