s390/dump: Add firmware sysfs attribute for dump area size

Dump tools from s390-tools such as zipl need to know the correct dump area
size of the machine they run on in order to be able to create valid
standalone dumper images. Therefore, allow it to be obtained through
the new sysfs read-only attribute /sys/firmware/dump/dump_area_size.

Suggested-by: Heiko Carstens <hca@linux.ibm.com>
Suggested-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
This commit is contained in:
Alexander Egorenkov 2024-11-05 09:08:22 +01:00 committed by Heiko Carstens
parent 97b5cf6294
commit 01bfb451a3

View File

@ -1717,6 +1717,24 @@ static ssize_t dump_type_store(struct kobject *kobj,
static struct kobj_attribute dump_type_attr =
__ATTR(dump_type, 0644, dump_type_show, dump_type_store);
static ssize_t dump_area_size_show(struct kobject *kobj,
struct kobj_attribute *attr, char *page)
{
return sysfs_emit(page, "%lu\n", sclp.hsa_size);
}
static struct kobj_attribute dump_area_size_attr = __ATTR_RO(dump_area_size);
static struct attribute *dump_attrs[] = {
&dump_type_attr.attr,
&dump_area_size_attr.attr,
NULL,
};
static struct attribute_group dump_attr_group = {
.attrs = dump_attrs,
};
static struct kset *dump_kset;
static void diag308_dump(void *dump_block)
@ -1853,7 +1871,7 @@ static int __init dump_init(void)
dump_kset = kset_create_and_add("dump", NULL, firmware_kobj);
if (!dump_kset)
return -ENOMEM;
rc = sysfs_create_file(&dump_kset->kobj, &dump_type_attr.attr);
rc = sysfs_create_group(&dump_kset->kobj, &dump_attr_group);
if (rc) {
kset_unregister(dump_kset);
return rc;