diff options
author | Philipp Rudo <prudo@linux.ibm.com> | 2019-04-08 08:24:08 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2019-04-29 04:44:04 -0400 |
commit | c9896acc7851109d4e84c1e3a54cb1b9794dea6b (patch) | |
tree | e258e2c33f0f5def2a7ae88f991a175235406fa1 | |
parent | 268a78404973594d1a7ec3a2b6a2474e0543a435 (diff) |
s390/ipl: Provide has_secure sysfs attribute
Provide an interface for userspace so it can find out if a machine is
capeable of doing secure boot. The interface is, for example, needed for
zipl so it can find out which file format it can/should write to disk.
Signed-off-by: Philipp Rudo <prudo@linux.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r-- | arch/s390/include/asm/sclp.h | 2 | ||||
-rw-r--r-- | arch/s390/kernel/ipl.c | 17 | ||||
-rw-r--r-- | drivers/s390/char/sclp.h | 4 | ||||
-rw-r--r-- | drivers/s390/char/sclp_early.c | 2 |
4 files changed, 24 insertions, 1 deletions
diff --git a/arch/s390/include/asm/sclp.h b/arch/s390/include/asm/sclp.h index ef4c9dec06a4..ef5d8fa92122 100644 --- a/arch/s390/include/asm/sclp.h +++ b/arch/s390/include/asm/sclp.h | |||
@@ -79,6 +79,8 @@ struct sclp_info { | |||
79 | unsigned char has_kss : 1; | 79 | unsigned char has_kss : 1; |
80 | unsigned char has_gisaf : 1; | 80 | unsigned char has_gisaf : 1; |
81 | unsigned char has_diag318 : 1; | 81 | unsigned char has_diag318 : 1; |
82 | unsigned char has_sipl : 1; | ||
83 | unsigned char has_sipl_g2 : 1; | ||
82 | unsigned int ibc; | 84 | unsigned int ibc; |
83 | unsigned int mtid; | 85 | unsigned int mtid; |
84 | unsigned int mtid_cp; | 86 | unsigned int mtid_cp; |
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c index 6f2bb64cf70e..e123c0df83f1 100644 --- a/arch/s390/kernel/ipl.c +++ b/arch/s390/kernel/ipl.c | |||
@@ -283,6 +283,20 @@ static ssize_t ipl_secure_show(struct kobject *kobj, | |||
283 | static struct kobj_attribute sys_ipl_secure_attr = | 283 | static struct kobj_attribute sys_ipl_secure_attr = |
284 | __ATTR(secure, 0444, ipl_secure_show, NULL); | 284 | __ATTR(secure, 0444, ipl_secure_show, NULL); |
285 | 285 | ||
286 | static ssize_t ipl_has_secure_show(struct kobject *kobj, | ||
287 | struct kobj_attribute *attr, char *page) | ||
288 | { | ||
289 | if (MACHINE_IS_LPAR) | ||
290 | return sprintf(page, "%i\n", !!sclp.has_sipl); | ||
291 | else if (MACHINE_IS_VM) | ||
292 | return sprintf(page, "%i\n", !!sclp.has_sipl_g2); | ||
293 | else | ||
294 | return sprintf(page, "%i\n", 0); | ||
295 | } | ||
296 | |||
297 | static struct kobj_attribute sys_ipl_has_secure_attr = | ||
298 | __ATTR(has_secure, 0444, ipl_has_secure_show, NULL); | ||
299 | |||
286 | static ssize_t ipl_vm_parm_show(struct kobject *kobj, | 300 | static ssize_t ipl_vm_parm_show(struct kobject *kobj, |
287 | struct kobj_attribute *attr, char *page) | 301 | struct kobj_attribute *attr, char *page) |
288 | { | 302 | { |
@@ -379,6 +393,7 @@ static struct attribute *ipl_fcp_attrs[] = { | |||
379 | &sys_ipl_fcp_br_lba_attr.attr, | 393 | &sys_ipl_fcp_br_lba_attr.attr, |
380 | &sys_ipl_ccw_loadparm_attr.attr, | 394 | &sys_ipl_ccw_loadparm_attr.attr, |
381 | &sys_ipl_secure_attr.attr, | 395 | &sys_ipl_secure_attr.attr, |
396 | &sys_ipl_has_secure_attr.attr, | ||
382 | NULL, | 397 | NULL, |
383 | }; | 398 | }; |
384 | 399 | ||
@@ -395,6 +410,7 @@ static struct attribute *ipl_ccw_attrs_vm[] = { | |||
395 | &sys_ipl_ccw_loadparm_attr.attr, | 410 | &sys_ipl_ccw_loadparm_attr.attr, |
396 | &sys_ipl_vm_parm_attr.attr, | 411 | &sys_ipl_vm_parm_attr.attr, |
397 | &sys_ipl_secure_attr.attr, | 412 | &sys_ipl_secure_attr.attr, |
413 | &sys_ipl_has_secure_attr.attr, | ||
398 | NULL, | 414 | NULL, |
399 | }; | 415 | }; |
400 | 416 | ||
@@ -403,6 +419,7 @@ static struct attribute *ipl_ccw_attrs_lpar[] = { | |||
403 | &sys_ipl_device_attr.attr, | 419 | &sys_ipl_device_attr.attr, |
404 | &sys_ipl_ccw_loadparm_attr.attr, | 420 | &sys_ipl_ccw_loadparm_attr.attr, |
405 | &sys_ipl_secure_attr.attr, | 421 | &sys_ipl_secure_attr.attr, |
422 | &sys_ipl_has_secure_attr.attr, | ||
406 | NULL, | 423 | NULL, |
407 | }; | 424 | }; |
408 | 425 | ||
diff --git a/drivers/s390/char/sclp.h b/drivers/s390/char/sclp.h index 367e9d384d85..287382dc21c5 100644 --- a/drivers/s390/char/sclp.h +++ b/drivers/s390/char/sclp.h | |||
@@ -197,7 +197,9 @@ struct read_info_sccb { | |||
197 | u32 hmfai; /* 124-127 */ | 197 | u32 hmfai; /* 124-127 */ |
198 | u8 _pad_128[134 - 128]; /* 128-133 */ | 198 | u8 _pad_128[134 - 128]; /* 128-133 */ |
199 | u8 byte_134; /* 134 */ | 199 | u8 byte_134; /* 134 */ |
200 | u8 _pad_135[4096 - 135]; /* 135-4095 */ | 200 | u8 _pad_135; /* 135 */ |
201 | u16 cbl; /* 136-137 */ | ||
202 | u8 _pad_138[4096 - 138]; /* 138-4095 */ | ||
201 | } __packed __aligned(PAGE_SIZE); | 203 | } __packed __aligned(PAGE_SIZE); |
202 | 204 | ||
203 | struct read_storage_sccb { | 205 | struct read_storage_sccb { |
diff --git a/drivers/s390/char/sclp_early.c b/drivers/s390/char/sclp_early.c index 8332788681c4..dae9de3d7c96 100644 --- a/drivers/s390/char/sclp_early.c +++ b/drivers/s390/char/sclp_early.c | |||
@@ -40,6 +40,8 @@ static void __init sclp_early_facilities_detect(struct read_info_sccb *sccb) | |||
40 | sclp.has_gisaf = !!(sccb->fac118 & 0x08); | 40 | sclp.has_gisaf = !!(sccb->fac118 & 0x08); |
41 | sclp.has_hvs = !!(sccb->fac119 & 0x80); | 41 | sclp.has_hvs = !!(sccb->fac119 & 0x80); |
42 | sclp.has_kss = !!(sccb->fac98 & 0x01); | 42 | sclp.has_kss = !!(sccb->fac98 & 0x01); |
43 | sclp.has_sipl = !!(sccb->cbl & 0x02); | ||
44 | sclp.has_sipl_g2 = !!(sccb->cbl & 0x04); | ||
43 | if (sccb->fac85 & 0x02) | 45 | if (sccb->fac85 & 0x02) |
44 | S390_lowcore.machine_flags |= MACHINE_FLAG_ESOP; | 46 | S390_lowcore.machine_flags |= MACHINE_FLAG_ESOP; |
45 | if (sccb->fac91 & 0x40) | 47 | if (sccb->fac91 & 0x40) |