aboutsummaryrefslogtreecommitdiff
path: root/drivers/s390/char
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/char')
-rw-r--r--drivers/s390/char/vmur.c10
-rw-r--r--drivers/s390/char/zcore.c101
2 files changed, 99 insertions, 12 deletions
diff --git a/drivers/s390/char/vmur.c b/drivers/s390/char/vmur.c
index 0a9f1cccbe5..b0ac44b2712 100644
--- a/drivers/s390/char/vmur.c
+++ b/drivers/s390/char/vmur.c
@@ -345,7 +345,7 @@ static int get_urd_class(struct urdev *urd)
cc = diag210(&ur_diag210);
switch (cc) {
case 0:
- return -ENOTSUPP;
+ return -EOPNOTSUPP;
case 2:
return ur_diag210.vrdcvcla; /* virtual device class */
case 3:
@@ -621,7 +621,7 @@ static int verify_device(struct urdev *urd)
case DEV_CLASS_UR_I:
return verify_uri_device(urd);
default:
- return -ENOTSUPP;
+ return -EOPNOTSUPP;
}
}
@@ -654,7 +654,7 @@ static int get_file_reclen(struct urdev *urd)
case DEV_CLASS_UR_I:
return get_uri_file_reclen(urd);
default:
- return -ENOTSUPP;
+ return -EOPNOTSUPP;
}
}
@@ -827,7 +827,7 @@ static int ur_probe(struct ccw_device *cdev)
goto fail_remove_attr;
}
if ((urd->class != DEV_CLASS_UR_I) && (urd->class != DEV_CLASS_UR_O)) {
- rc = -ENOTSUPP;
+ rc = -EOPNOTSUPP;
goto fail_remove_attr;
}
spin_lock_irq(get_ccwdev_lock(cdev));
@@ -892,7 +892,7 @@ static int ur_set_online(struct ccw_device *cdev)
} else if (urd->cdev->id.cu_type == PRINTER_DEVTYPE) {
sprintf(node_id, "vmprt-%s", cdev->dev.bus_id);
} else {
- rc = -ENOTSUPP;
+ rc = -EOPNOTSUPP;
goto fail_free_cdev;
}
diff --git a/drivers/s390/char/zcore.c b/drivers/s390/char/zcore.c
index 047dd92ae80..7fd84be1193 100644
--- a/drivers/s390/char/zcore.c
+++ b/drivers/s390/char/zcore.c
@@ -29,6 +29,7 @@
#define TO_USER 0
#define TO_KERNEL 1
+#define CHUNK_INFO_SIZE 34 /* 2 16-byte char, each followed by blank */
enum arch_id {
ARCH_S390 = 0,
@@ -51,6 +52,7 @@ static struct debug_info *zcore_dbf;
static int hsa_available;
static struct dentry *zcore_dir;
static struct dentry *zcore_file;
+static struct dentry *zcore_memmap_file;
/*
* Copy memory from HSA to kernel or user memory (not reentrant):
@@ -476,6 +478,54 @@ static const struct file_operations zcore_fops = {
.release = zcore_release,
};
+static ssize_t zcore_memmap_read(struct file *filp, char __user *buf,
+ size_t count, loff_t *ppos)
+{
+ return simple_read_from_buffer(buf, count, ppos, filp->private_data,
+ MEMORY_CHUNKS * CHUNK_INFO_SIZE);
+}
+
+static int zcore_memmap_open(struct inode *inode, struct file *filp)
+{
+ int i;
+ char *buf;
+ struct mem_chunk *chunk_array;
+
+ chunk_array = kzalloc(MEMORY_CHUNKS * sizeof(struct mem_chunk),
+ GFP_KERNEL);
+ if (!chunk_array)
+ return -ENOMEM;
+ detect_memory_layout(chunk_array);
+ buf = kzalloc(MEMORY_CHUNKS * CHUNK_INFO_SIZE, GFP_KERNEL);
+ if (!buf) {
+ kfree(chunk_array);
+ return -ENOMEM;
+ }
+ for (i = 0; i < MEMORY_CHUNKS; i++) {
+ sprintf(buf + (i * CHUNK_INFO_SIZE), "%016llx %016llx ",
+ (unsigned long long) chunk_array[i].addr,
+ (unsigned long long) chunk_array[i].size);
+ if (chunk_array[i].size == 0)
+ break;
+ }
+ kfree(chunk_array);
+ filp->private_data = buf;
+ return 0;
+}
+
+static int zcore_memmap_release(struct inode *inode, struct file *filp)
+{
+ kfree(filp->private_data);
+ return 0;
+}
+
+static const struct file_operations zcore_memmap_fops = {
+ .owner = THIS_MODULE,
+ .read = zcore_memmap_read,
+ .open = zcore_memmap_open,
+ .release = zcore_memmap_release,
+};
+
static void __init set_s390_lc_mask(union save_area *map)
{
@@ -554,18 +604,44 @@ static int __init check_sdias(void)
return 0;
}
-static void __init zcore_header_init(int arch, struct zcore_header *hdr)
+static int __init get_mem_size(unsigned long *mem)
+{
+ int i;
+ struct mem_chunk *chunk_array;
+
+ chunk_array = kzalloc(MEMORY_CHUNKS * sizeof(struct mem_chunk),
+ GFP_KERNEL);
+ if (!chunk_array)
+ return -ENOMEM;
+ detect_memory_layout(chunk_array);
+ for (i = 0; i < MEMORY_CHUNKS; i++) {
+ if (chunk_array[i].size == 0)
+ break;
+ *mem += chunk_array[i].size;
+ }
+ kfree(chunk_array);
+ return 0;
+}
+
+static int __init zcore_header_init(int arch, struct zcore_header *hdr)
{
+ int rc;
+ unsigned long memory = 0;
+
if (arch == ARCH_S390X)
hdr->arch_id = DUMP_ARCH_S390X;
else
hdr->arch_id = DUMP_ARCH_S390;
- hdr->mem_size = sys_info.mem_size;
- hdr->rmem_size = sys_info.mem_size;
+ rc = get_mem_size(&memory);
+ if (rc)
+ return rc;
+ hdr->mem_size = memory;
+ hdr->rmem_size = memory;
hdr->mem_end = sys_info.mem_size;
- hdr->num_pages = sys_info.mem_size / PAGE_SIZE;
+ hdr->num_pages = memory / PAGE_SIZE;
hdr->tod = get_clock();
get_cpu_id(&hdr->cpu_id);
+ return 0;
}
static int __init zcore_init(void)
@@ -608,7 +684,9 @@ static int __init zcore_init(void)
if (rc)
goto fail;
- zcore_header_init(arch, &zcore_header);
+ rc = zcore_header_init(arch, &zcore_header);
+ if (rc)
+ goto fail;
zcore_dir = debugfs_create_dir("zcore" , NULL);
if (!zcore_dir) {
@@ -618,13 +696,22 @@ static int __init zcore_init(void)
zcore_file = debugfs_create_file("mem", S_IRUSR, zcore_dir, NULL,
&zcore_fops);
if (!zcore_file) {
- debugfs_remove(zcore_dir);
rc = -ENOMEM;
- goto fail;
+ goto fail_dir;
+ }
+ zcore_memmap_file = debugfs_create_file("memmap", S_IRUSR, zcore_dir,
+ NULL, &zcore_memmap_fops);
+ if (!zcore_memmap_file) {
+ rc = -ENOMEM;
+ goto fail_file;
}
hsa_available = 1;
return 0;
+fail_file:
+ debugfs_remove(zcore_file);
+fail_dir:
+ debugfs_remove(zcore_dir);
fail:
diag308(DIAG308_REL_HSA, NULL);
return rc;