Commit b39e7724 authored by Alexander Egorenkov's avatar Alexander Egorenkov Committed by Heiko Carstens
Browse files

s390/zcore: remove memmap device



Remove unused /sys/kernel/debug/zcore/memmap device.
Since at least version 1.24.0 of s390-tools zfcpdump no longer
needs it and reads /proc/vmcore instead.

Signed-off-by: default avatarAlexander Egorenkov <egorenar@linux.ibm.com>
Reviewed-by: default avatarPhilipp Rudo <prudo@linux.ibm.com>
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
parent 0188d08a
Loading
Loading
Loading
Loading
+2 −55
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-1.0+
/*
 * zcore module to export memory content and register sets for creating system
 * dumps on SCSI disks (zfcpdump). The "zcore/mem" debugfs file shows the same
 * dump format as s390 standalone dumps.
 * dumps on SCSI disks (zfcpdump).
 *
 * For more information please refer to Documentation/s390/zfcpdump.rst
 *
@@ -16,7 +15,6 @@
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/debugfs.h>
#include <linux/memblock.h>

#include <asm/asm-offsets.h>
#include <asm/ipl.h>
@@ -33,8 +31,6 @@

#define TRACE(x...) debug_sprintf_event(zcore_dbf, 1, x)

#define CHUNK_INFO_SIZE	34 /* 2 16-byte char, each followed by blank */

enum arch_id {
	ARCH_S390	= 0,
	ARCH_S390X	= 1,
@@ -48,7 +44,6 @@ struct ipib_info {
static struct debug_info *zcore_dbf;
static int hsa_available;
static struct dentry *zcore_dir;
static struct dentry *zcore_memmap_file;
static struct dentry *zcore_reipl_file;
static struct dentry *zcore_hsa_file;
static struct ipl_parameter_block *zcore_ipl_block;
@@ -139,46 +134,6 @@ static void release_hsa(void)
	hsa_available = 0;
}

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,
				       memblock.memory.cnt * CHUNK_INFO_SIZE);
}

static int zcore_memmap_open(struct inode *inode, struct file *filp)
{
	struct memblock_region *reg;
	char *buf;
	int i = 0;

	buf = kcalloc(memblock.memory.cnt, CHUNK_INFO_SIZE, GFP_KERNEL);
	if (!buf) {
		return -ENOMEM;
	}
	for_each_memblock(memory, reg) {
		sprintf(buf + (i++ * CHUNK_INFO_SIZE), "%016llx %016llx ",
			(unsigned long long) reg->base,
			(unsigned long long) reg->size);
	}
	filp->private_data = buf;
	return nonseekable_open(inode, filp);
}

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,
	.llseek		= no_llseek,
};

static ssize_t zcore_reipl_write(struct file *filp, const char __user *buf,
				 size_t count, loff_t *ppos)
{
@@ -335,17 +290,11 @@ static int __init zcore_init(void)
		rc = -ENOMEM;
		goto fail;
	}
	zcore_memmap_file = debugfs_create_file("memmap", S_IRUSR, zcore_dir,
						NULL, &zcore_memmap_fops);
	if (!zcore_memmap_file) {
		rc = -ENOMEM;
		goto fail_dir;
	}
	zcore_reipl_file = debugfs_create_file("reipl", S_IRUSR, zcore_dir,
						NULL, &zcore_reipl_fops);
	if (!zcore_reipl_file) {
		rc = -ENOMEM;
		goto fail_memmap_file;
		goto fail_dir;
	}
	zcore_hsa_file = debugfs_create_file("hsa", S_IRUSR|S_IWUSR, zcore_dir,
					     NULL, &zcore_hsa_fops);
@@ -357,8 +306,6 @@ static int __init zcore_init(void)

fail_reipl_file:
	debugfs_remove(zcore_reipl_file);
fail_memmap_file:
	debugfs_remove(zcore_memmap_file);
fail_dir:
	debugfs_remove(zcore_dir);
fail: