11// SPDX-License-Identifier: GPL-1.0+
22/*
33 * zcore module to export memory content and register sets for creating system
4- * dumps on SCSI disks (zfcpdump). The "zcore/mem" debugfs file shows the same
5- * dump format as s390 standalone dumps.
4+ * dumps on SCSI disks (zfcpdump).
65 *
76 * For more information please refer to Documentation/s390/zfcpdump.rst
87 *
1615#include <linux/init.h>
1716#include <linux/slab.h>
1817#include <linux/debugfs.h>
19- #include <linux/memblock.h>
2018
2119#include <asm/asm-offsets.h>
2220#include <asm/ipl.h>
3331
3432#define TRACE (x ...) debug_sprintf_event(zcore_dbf, 1, x)
3533
36- #define CHUNK_INFO_SIZE 34 /* 2 16-byte char, each followed by blank */
37-
3834enum arch_id {
3935 ARCH_S390 = 0 ,
4036 ARCH_S390X = 1 ,
@@ -48,7 +44,6 @@ struct ipib_info {
4844static struct debug_info * zcore_dbf ;
4945static int hsa_available ;
5046static struct dentry * zcore_dir ;
51- static struct dentry * zcore_memmap_file ;
5247static struct dentry * zcore_reipl_file ;
5348static struct dentry * zcore_hsa_file ;
5449static struct ipl_parameter_block * zcore_ipl_block ;
@@ -139,46 +134,6 @@ static void release_hsa(void)
139134 hsa_available = 0 ;
140135}
141136
142- static ssize_t zcore_memmap_read (struct file * filp , char __user * buf ,
143- size_t count , loff_t * ppos )
144- {
145- return simple_read_from_buffer (buf , count , ppos , filp -> private_data ,
146- memblock .memory .cnt * CHUNK_INFO_SIZE );
147- }
148-
149- static int zcore_memmap_open (struct inode * inode , struct file * filp )
150- {
151- struct memblock_region * reg ;
152- char * buf ;
153- int i = 0 ;
154-
155- buf = kcalloc (memblock .memory .cnt , CHUNK_INFO_SIZE , GFP_KERNEL );
156- if (!buf ) {
157- return - ENOMEM ;
158- }
159- for_each_memblock (memory , reg ) {
160- sprintf (buf + (i ++ * CHUNK_INFO_SIZE ), "%016llx %016llx " ,
161- (unsigned long long ) reg -> base ,
162- (unsigned long long ) reg -> size );
163- }
164- filp -> private_data = buf ;
165- return nonseekable_open (inode , filp );
166- }
167-
168- static int zcore_memmap_release (struct inode * inode , struct file * filp )
169- {
170- kfree (filp -> private_data );
171- return 0 ;
172- }
173-
174- static const struct file_operations zcore_memmap_fops = {
175- .owner = THIS_MODULE ,
176- .read = zcore_memmap_read ,
177- .open = zcore_memmap_open ,
178- .release = zcore_memmap_release ,
179- .llseek = no_llseek ,
180- };
181-
182137static ssize_t zcore_reipl_write (struct file * filp , const char __user * buf ,
183138 size_t count , loff_t * ppos )
184139{
@@ -335,17 +290,11 @@ static int __init zcore_init(void)
335290 rc = - ENOMEM ;
336291 goto fail ;
337292 }
338- zcore_memmap_file = debugfs_create_file ("memmap" , S_IRUSR , zcore_dir ,
339- NULL , & zcore_memmap_fops );
340- if (!zcore_memmap_file ) {
341- rc = - ENOMEM ;
342- goto fail_dir ;
343- }
344293 zcore_reipl_file = debugfs_create_file ("reipl" , S_IRUSR , zcore_dir ,
345294 NULL , & zcore_reipl_fops );
346295 if (!zcore_reipl_file ) {
347296 rc = - ENOMEM ;
348- goto fail_memmap_file ;
297+ goto fail_dir ;
349298 }
350299 zcore_hsa_file = debugfs_create_file ("hsa" , S_IRUSR |S_IWUSR , zcore_dir ,
351300 NULL , & zcore_hsa_fops );
@@ -357,8 +306,6 @@ static int __init zcore_init(void)
357306
358307fail_reipl_file :
359308 debugfs_remove (zcore_reipl_file );
360- fail_memmap_file :
361- debugfs_remove (zcore_memmap_file );
362309fail_dir :
363310 debugfs_remove (zcore_dir );
364311fail :
0 commit comments