diff options
author | Philipp Rudo <prudo@linux.ibm.com> | 2019-04-08 14:24:08 +0200 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2019-04-29 10:44:04 +0200 |
commit | c9896acc7851109d4e84c1e3a54cb1b9794dea6b (patch) | |
tree | e258e2c33f0f5def2a7ae88f991a175235406fa1 /arch/s390/kernel/ipl.c | |
parent | 268a78404973594d1a7ec3a2b6a2474e0543a435 (diff) | |
download | linux-stable-c9896acc7851109d4e84c1e3a54cb1b9794dea6b.tar.gz linux-stable-c9896acc7851109d4e84c1e3a54cb1b9794dea6b.tar.bz2 linux-stable-c9896acc7851109d4e84c1e3a54cb1b9794dea6b.zip |
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>
Diffstat (limited to 'arch/s390/kernel/ipl.c')
-rw-r--r-- | arch/s390/kernel/ipl.c | 17 |
1 files changed, 17 insertions, 0 deletions
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, static struct kobj_attribute sys_ipl_secure_attr = __ATTR(secure, 0444, ipl_secure_show, NULL); +static ssize_t ipl_has_secure_show(struct kobject *kobj, + struct kobj_attribute *attr, char *page) +{ + if (MACHINE_IS_LPAR) + return sprintf(page, "%i\n", !!sclp.has_sipl); + else if (MACHINE_IS_VM) + return sprintf(page, "%i\n", !!sclp.has_sipl_g2); + else + return sprintf(page, "%i\n", 0); +} + +static struct kobj_attribute sys_ipl_has_secure_attr = + __ATTR(has_secure, 0444, ipl_has_secure_show, NULL); + static ssize_t ipl_vm_parm_show(struct kobject *kobj, struct kobj_attribute *attr, char *page) { @@ -379,6 +393,7 @@ static struct attribute *ipl_fcp_attrs[] = { &sys_ipl_fcp_br_lba_attr.attr, &sys_ipl_ccw_loadparm_attr.attr, &sys_ipl_secure_attr.attr, + &sys_ipl_has_secure_attr.attr, NULL, }; @@ -395,6 +410,7 @@ static struct attribute *ipl_ccw_attrs_vm[] = { &sys_ipl_ccw_loadparm_attr.attr, &sys_ipl_vm_parm_attr.attr, &sys_ipl_secure_attr.attr, + &sys_ipl_has_secure_attr.attr, NULL, }; @@ -403,6 +419,7 @@ static struct attribute *ipl_ccw_attrs_lpar[] = { &sys_ipl_device_attr.attr, &sys_ipl_ccw_loadparm_attr.attr, &sys_ipl_secure_attr.attr, + &sys_ipl_has_secure_attr.attr, NULL, }; |