Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 356109
b: refs/heads/master
c: b4b3d12
h: refs/heads/master
i:
  356107: 5677daa
v: v3
  • Loading branch information
Michael Holzheu authored and Martin Schwidefsky committed Feb 14, 2013
1 parent 8f57670 commit b52196c
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0894b3ae776a60c6bad994e1d8f809ceb59904da
refs/heads/master: b4b3d128c821d70112ac0096d5c1440f5ed9f718
62 changes: 59 additions & 3 deletions trunk/drivers/s390/char/zcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ static struct dentry *zcore_dir;
static struct dentry *zcore_file;
static struct dentry *zcore_memmap_file;
static struct dentry *zcore_reipl_file;
static struct dentry *zcore_hsa_file;
static struct ipl_parameter_block *ipl_block;

/*
Expand All @@ -77,6 +78,8 @@ static int memcpy_hsa(void *dest, unsigned long src, size_t count, int mode)
int offs, blk_num;
static char buf[PAGE_SIZE] __attribute__((__aligned__(PAGE_SIZE)));

if (!hsa_available)
return -ENODATA;
if (count == 0)
return 0;

Expand Down Expand Up @@ -277,6 +280,15 @@ static int zcore_add_lc(char __user *buf, unsigned long start, size_t count)
return 0;
}

/*
* Release the HSA
*/
static void release_hsa(void)
{
diag308(DIAG308_REL_HSA, NULL);
hsa_available = 0;
}

/*
* Read routine for zcore character device
* First 4K are dump header
Expand Down Expand Up @@ -363,8 +375,8 @@ static int zcore_open(struct inode *inode, struct file *filp)

static int zcore_release(struct inode *inode, struct file *filep)
{
diag308(DIAG308_REL_HSA, NULL);
hsa_available = 0;
if (hsa_available)
release_hsa();
return 0;
}

Expand Down Expand Up @@ -474,6 +486,41 @@ static const struct file_operations zcore_reipl_fops = {
.llseek = no_llseek,
};

static ssize_t zcore_hsa_read(struct file *filp, char __user *buf,
size_t count, loff_t *ppos)
{
static char str[18];

if (hsa_available)
snprintf(str, sizeof(str), "%lx\n", ZFCPDUMP_HSA_SIZE);
else
snprintf(str, sizeof(str), "0\n");
return simple_read_from_buffer(buf, count, ppos, str, strlen(str));
}

static ssize_t zcore_hsa_write(struct file *filp, const char __user *buf,
size_t count, loff_t *ppos)
{
char value;

if (*ppos != 0)
return -EPIPE;
if (copy_from_user(&value, buf, 1))
return -EFAULT;
if (value != '0')
return -EINVAL;
release_hsa();
return count;
}

static const struct file_operations zcore_hsa_fops = {
.owner = THIS_MODULE,
.write = zcore_hsa_write,
.read = zcore_hsa_read,
.open = nonseekable_open,
.llseek = no_llseek,
};

#ifdef CONFIG_32BIT

static void __init set_lc_mask(struct save_area *map)
Expand Down Expand Up @@ -658,6 +705,7 @@ static int __init zcore_init(void)
rc = check_sdias();
if (rc)
goto fail;
hsa_available = 1;

rc = memcpy_hsa_kernel(&arch, __LC_AR_MODE_ID, 1);
if (rc)
Expand Down Expand Up @@ -714,9 +762,16 @@ static int __init zcore_init(void)
rc = -ENOMEM;
goto fail_memmap_file;
}
hsa_available = 1;
zcore_hsa_file = debugfs_create_file("hsa", S_IRUSR|S_IWUSR, zcore_dir,
NULL, &zcore_hsa_fops);
if (!zcore_hsa_file) {
rc = -ENOMEM;
goto fail_reipl_file;
}
return 0;

fail_reipl_file:
debugfs_remove(zcore_reipl_file);
fail_memmap_file:
debugfs_remove(zcore_memmap_file);
fail_file:
Expand All @@ -733,6 +788,7 @@ static void __exit zcore_exit(void)
debug_unregister(zcore_dbf);
sclp_sdias_exit();
free_page((unsigned long) ipl_block);
debugfs_remove(zcore_hsa_file);
debugfs_remove(zcore_reipl_file);
debugfs_remove(zcore_memmap_file);
debugfs_remove(zcore_file);
Expand Down

0 comments on commit b52196c

Please sign in to comment.