mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-12 04:36:51 +07:00
Merge branch 'for-linus' of git://git390.osdl.marist.edu/pub/scm/linux-2.6
* 'for-linus' of git://git390.osdl.marist.edu/pub/scm/linux-2.6: [S390] monwriter: Serialization bug for multithreaded applications. [S390] vmur: diag14 only works with buffers below 2GB [S390] vmur: add "top of queue" sanity check for reader open [S390] vmur: reject open on z/VM reader files with status HOLD [S390] vmur: use DECLARE_COMPLETION_ONSTACK to keep lockdep happy [S390] vmur: allocate single record buffers instead of one big data buffer [S390] remove DEFAULT_MIGRATION_COST [S390] qdio: make sure data structures are correctly aligned. [S390] hypfs: implement show_options [S390] cio: avoid memory leak on error in css_alloc_subchannel().
This commit is contained in:
commit
3864e8ccbb
@ -109,10 +109,6 @@ config HOTPLUG_CPU
|
|||||||
can be controlled through /sys/devices/system/cpu/cpu#.
|
can be controlled through /sys/devices/system/cpu/cpu#.
|
||||||
Say N if you want to disable CPU hotplug.
|
Say N if you want to disable CPU hotplug.
|
||||||
|
|
||||||
config DEFAULT_MIGRATION_COST
|
|
||||||
int
|
|
||||||
default "1000000"
|
|
||||||
|
|
||||||
config MATHEMU
|
config MATHEMU
|
||||||
bool "IEEE FPU emulation"
|
bool "IEEE FPU emulation"
|
||||||
depends on MARCH_G5
|
depends on MARCH_G5
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
#include <linux/parser.h>
|
#include <linux/parser.h>
|
||||||
#include <linux/sysfs.h>
|
#include <linux/sysfs.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
|
#include <linux/seq_file.h>
|
||||||
|
#include <linux/mount.h>
|
||||||
#include <asm/ebcdic.h>
|
#include <asm/ebcdic.h>
|
||||||
#include "hypfs.h"
|
#include "hypfs.h"
|
||||||
|
|
||||||
@ -256,6 +258,15 @@ static int hypfs_parse_options(char *options, struct super_block *sb)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int hypfs_show_options(struct seq_file *s, struct vfsmount *mnt)
|
||||||
|
{
|
||||||
|
struct hypfs_sb_info *hypfs_info = mnt->mnt_sb->s_fs_info;
|
||||||
|
|
||||||
|
seq_printf(s, ",uid=%u", hypfs_info->uid);
|
||||||
|
seq_printf(s, ",gid=%u", hypfs_info->gid);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int hypfs_fill_super(struct super_block *sb, void *data, int silent)
|
static int hypfs_fill_super(struct super_block *sb, void *data, int silent)
|
||||||
{
|
{
|
||||||
struct inode *root_inode;
|
struct inode *root_inode;
|
||||||
@ -459,6 +470,7 @@ static struct file_system_type hypfs_type = {
|
|||||||
static struct super_operations hypfs_s_ops = {
|
static struct super_operations hypfs_s_ops = {
|
||||||
.statfs = simple_statfs,
|
.statfs = simple_statfs,
|
||||||
.drop_inode = hypfs_drop_inode,
|
.drop_inode = hypfs_drop_inode,
|
||||||
|
.show_options = hypfs_show_options,
|
||||||
};
|
};
|
||||||
|
|
||||||
static decl_subsys(s390, NULL, NULL);
|
static decl_subsys(s390, NULL, NULL);
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include <linux/miscdevice.h>
|
#include <linux/miscdevice.h>
|
||||||
#include <linux/ctype.h>
|
#include <linux/ctype.h>
|
||||||
#include <linux/poll.h>
|
#include <linux/poll.h>
|
||||||
|
#include <linux/mutex.h>
|
||||||
#include <asm/uaccess.h>
|
#include <asm/uaccess.h>
|
||||||
#include <asm/ebcdic.h>
|
#include <asm/ebcdic.h>
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
@ -41,6 +42,7 @@ struct mon_private {
|
|||||||
size_t hdr_to_read;
|
size_t hdr_to_read;
|
||||||
size_t data_to_read;
|
size_t data_to_read;
|
||||||
struct mon_buf *current_buf;
|
struct mon_buf *current_buf;
|
||||||
|
struct mutex thread_mutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -179,6 +181,7 @@ static int monwrite_open(struct inode *inode, struct file *filp)
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
INIT_LIST_HEAD(&monpriv->list);
|
INIT_LIST_HEAD(&monpriv->list);
|
||||||
monpriv->hdr_to_read = sizeof(monpriv->hdr);
|
monpriv->hdr_to_read = sizeof(monpriv->hdr);
|
||||||
|
mutex_init(&monpriv->thread_mutex);
|
||||||
filp->private_data = monpriv;
|
filp->private_data = monpriv;
|
||||||
return nonseekable_open(inode, filp);
|
return nonseekable_open(inode, filp);
|
||||||
}
|
}
|
||||||
@ -209,6 +212,7 @@ static ssize_t monwrite_write(struct file *filp, const char __user *data,
|
|||||||
void *to;
|
void *to;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
mutex_lock(&monpriv->thread_mutex);
|
||||||
for (written = 0; written < count; ) {
|
for (written = 0; written < count; ) {
|
||||||
if (monpriv->hdr_to_read) {
|
if (monpriv->hdr_to_read) {
|
||||||
len = min(count - written, monpriv->hdr_to_read);
|
len = min(count - written, monpriv->hdr_to_read);
|
||||||
@ -247,11 +251,13 @@ static ssize_t monwrite_write(struct file *filp, const char __user *data,
|
|||||||
}
|
}
|
||||||
monpriv->hdr_to_read = sizeof(monpriv->hdr);
|
monpriv->hdr_to_read = sizeof(monpriv->hdr);
|
||||||
}
|
}
|
||||||
|
mutex_unlock(&monpriv->thread_mutex);
|
||||||
return written;
|
return written;
|
||||||
|
|
||||||
out_error:
|
out_error:
|
||||||
monpriv->data_to_read = 0;
|
monpriv->data_to_read = 0;
|
||||||
monpriv->hdr_to_read = sizeof(struct monwrite_hdr);
|
monpriv->hdr_to_read = sizeof(struct monwrite_hdr);
|
||||||
|
mutex_unlock(&monpriv->thread_mutex);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,10 +119,12 @@ static void urdev_put(struct urdev *urd)
|
|||||||
/*
|
/*
|
||||||
* Low-level functions to do I/O to a ur device.
|
* Low-level functions to do I/O to a ur device.
|
||||||
* alloc_chan_prog
|
* alloc_chan_prog
|
||||||
|
* free_chan_prog
|
||||||
* do_ur_io
|
* do_ur_io
|
||||||
* ur_int_handler
|
* ur_int_handler
|
||||||
*
|
*
|
||||||
* alloc_chan_prog allocates and builds the channel program
|
* alloc_chan_prog allocates and builds the channel program
|
||||||
|
* free_chan_prog frees memory of the channel program
|
||||||
*
|
*
|
||||||
* do_ur_io issues the channel program to the device and blocks waiting
|
* do_ur_io issues the channel program to the device and blocks waiting
|
||||||
* on a completion event it publishes at urd->io_done. The function
|
* on a completion event it publishes at urd->io_done. The function
|
||||||
@ -137,6 +139,16 @@ static void urdev_put(struct urdev *urd)
|
|||||||
* address pointer that alloc_chan_prog returned.
|
* address pointer that alloc_chan_prog returned.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
static void free_chan_prog(struct ccw1 *cpa)
|
||||||
|
{
|
||||||
|
struct ccw1 *ptr = cpa;
|
||||||
|
|
||||||
|
while (ptr->cda) {
|
||||||
|
kfree((void *)(addr_t) ptr->cda);
|
||||||
|
ptr++;
|
||||||
|
}
|
||||||
|
kfree(cpa);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* alloc_chan_prog
|
* alloc_chan_prog
|
||||||
@ -144,44 +156,45 @@ static void urdev_put(struct urdev *urd)
|
|||||||
* with a final NOP CCW command-chained on (which ensures that CE and DE
|
* with a final NOP CCW command-chained on (which ensures that CE and DE
|
||||||
* are presented together in a single interrupt instead of as separate
|
* are presented together in a single interrupt instead of as separate
|
||||||
* interrupts unless an incorrect length indication kicks in first). The
|
* interrupts unless an incorrect length indication kicks in first). The
|
||||||
* data length in each CCW is reclen. The caller must ensure that count
|
* data length in each CCW is reclen.
|
||||||
* is an integral multiple of reclen.
|
|
||||||
* The channel program pointer returned by this function must be freed
|
|
||||||
* with kfree. The caller is responsible for checking that
|
|
||||||
* count/reclen is not ridiculously large.
|
|
||||||
*/
|
*/
|
||||||
static struct ccw1 *alloc_chan_prog(char *buf, size_t count, size_t reclen)
|
static struct ccw1 *alloc_chan_prog(const char __user *ubuf, int rec_count,
|
||||||
|
int reclen)
|
||||||
{
|
{
|
||||||
size_t num_ccws;
|
|
||||||
struct ccw1 *cpa;
|
struct ccw1 *cpa;
|
||||||
|
void *kbuf;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
TRACE("alloc_chan_prog(%p, %zu, %zu)\n", buf, count, reclen);
|
TRACE("alloc_chan_prog(%p, %i, %i)\n", ubuf, rec_count, reclen);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We chain a NOP onto the writes to force CE+DE together.
|
* We chain a NOP onto the writes to force CE+DE together.
|
||||||
* That means we allocate room for CCWs to cover count/reclen
|
* That means we allocate room for CCWs to cover count/reclen
|
||||||
* records plus a NOP.
|
* records plus a NOP.
|
||||||
*/
|
*/
|
||||||
num_ccws = count / reclen + 1;
|
cpa = kzalloc((rec_count + 1) * sizeof(struct ccw1),
|
||||||
cpa = kmalloc(num_ccws * sizeof(struct ccw1), GFP_KERNEL | GFP_DMA);
|
GFP_KERNEL | GFP_DMA);
|
||||||
if (!cpa)
|
if (!cpa)
|
||||||
return NULL;
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
for (i = 0; count; i++) {
|
for (i = 0; i < rec_count; i++) {
|
||||||
cpa[i].cmd_code = WRITE_CCW_CMD;
|
cpa[i].cmd_code = WRITE_CCW_CMD;
|
||||||
cpa[i].flags = CCW_FLAG_CC | CCW_FLAG_SLI;
|
cpa[i].flags = CCW_FLAG_CC | CCW_FLAG_SLI;
|
||||||
cpa[i].count = reclen;
|
cpa[i].count = reclen;
|
||||||
cpa[i].cda = __pa(buf);
|
kbuf = kmalloc(reclen, GFP_KERNEL | GFP_DMA);
|
||||||
buf += reclen;
|
if (!kbuf) {
|
||||||
count -= reclen;
|
free_chan_prog(cpa);
|
||||||
|
return ERR_PTR(-ENOMEM);
|
||||||
|
}
|
||||||
|
cpa[i].cda = (u32)(addr_t) kbuf;
|
||||||
|
if (copy_from_user(kbuf, ubuf, reclen)) {
|
||||||
|
free_chan_prog(cpa);
|
||||||
|
return ERR_PTR(-EFAULT);
|
||||||
|
}
|
||||||
|
ubuf += reclen;
|
||||||
}
|
}
|
||||||
/* The following NOP CCW forces CE+DE to be presented together */
|
/* The following NOP CCW forces CE+DE to be presented together */
|
||||||
cpa[i].cmd_code = CCW_CMD_NOOP;
|
cpa[i].cmd_code = CCW_CMD_NOOP;
|
||||||
cpa[i].flags = 0;
|
|
||||||
cpa[i].count = 0;
|
|
||||||
cpa[i].cda = 0;
|
|
||||||
|
|
||||||
return cpa;
|
return cpa;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,7 +202,7 @@ static int do_ur_io(struct urdev *urd, struct ccw1 *cpa)
|
|||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
struct ccw_device *cdev = urd->cdev;
|
struct ccw_device *cdev = urd->cdev;
|
||||||
DECLARE_COMPLETION(event);
|
DECLARE_COMPLETION_ONSTACK(event);
|
||||||
|
|
||||||
TRACE("do_ur_io: cpa=%p\n", cpa);
|
TRACE("do_ur_io: cpa=%p\n", cpa);
|
||||||
|
|
||||||
@ -325,24 +338,11 @@ static ssize_t do_write(struct urdev *urd, const char __user *udata,
|
|||||||
size_t count, size_t reclen, loff_t *ppos)
|
size_t count, size_t reclen, loff_t *ppos)
|
||||||
{
|
{
|
||||||
struct ccw1 *cpa;
|
struct ccw1 *cpa;
|
||||||
char *buf;
|
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
/* Data buffer must be under 2GB line for fmt1 CCWs: hence GFP_DMA */
|
cpa = alloc_chan_prog(udata, count / reclen, reclen);
|
||||||
buf = kmalloc(count, GFP_KERNEL | GFP_DMA);
|
if (IS_ERR(cpa))
|
||||||
if (!buf)
|
return PTR_ERR(cpa);
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
if (copy_from_user(buf, udata, count)) {
|
|
||||||
rc = -EFAULT;
|
|
||||||
goto fail_kfree_buf;
|
|
||||||
}
|
|
||||||
|
|
||||||
cpa = alloc_chan_prog(buf, count, reclen);
|
|
||||||
if (!cpa) {
|
|
||||||
rc = -ENOMEM;
|
|
||||||
goto fail_kfree_buf;
|
|
||||||
}
|
|
||||||
|
|
||||||
rc = do_ur_io(urd, cpa);
|
rc = do_ur_io(urd, cpa);
|
||||||
if (rc)
|
if (rc)
|
||||||
@ -354,10 +354,9 @@ static ssize_t do_write(struct urdev *urd, const char __user *udata,
|
|||||||
}
|
}
|
||||||
*ppos += count;
|
*ppos += count;
|
||||||
rc = count;
|
rc = count;
|
||||||
|
|
||||||
fail_kfree_cpa:
|
fail_kfree_cpa:
|
||||||
kfree(cpa);
|
free_chan_prog(cpa);
|
||||||
fail_kfree_buf:
|
|
||||||
kfree(buf);
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -473,7 +472,7 @@ static ssize_t diag14_read(struct file *file, char __user *ubuf, size_t count,
|
|||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
len = min((size_t) PAGE_SIZE, count);
|
len = min((size_t) PAGE_SIZE, count);
|
||||||
buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
|
buf = (char *) __get_free_page(GFP_KERNEL | GFP_DMA);
|
||||||
if (!buf)
|
if (!buf)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
@ -500,7 +499,7 @@ static ssize_t diag14_read(struct file *file, char __user *ubuf, size_t count,
|
|||||||
*offs += copied;
|
*offs += copied;
|
||||||
rc = copied;
|
rc = copied;
|
||||||
fail:
|
fail:
|
||||||
kfree(buf);
|
free_page((unsigned long) buf);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -543,56 +542,97 @@ static int diag_read_next_file_info(struct file_control_block *buf, int spid)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int verify_device(struct urdev *urd)
|
static int verify_uri_device(struct urdev *urd)
|
||||||
{
|
{
|
||||||
struct file_control_block fcb;
|
struct file_control_block *fcb;
|
||||||
char *buf;
|
char *buf;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
fcb = kmalloc(sizeof(*fcb), GFP_KERNEL | GFP_DMA);
|
||||||
|
if (!fcb)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
/* check for empty reader device (beginning of chain) */
|
||||||
|
rc = diag_read_next_file_info(fcb, 0);
|
||||||
|
if (rc)
|
||||||
|
goto fail_free_fcb;
|
||||||
|
|
||||||
|
/* if file is in hold status, we do not read it */
|
||||||
|
if (fcb->file_stat & (FLG_SYSTEM_HOLD | FLG_USER_HOLD)) {
|
||||||
|
rc = -EPERM;
|
||||||
|
goto fail_free_fcb;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* open file on virtual reader */
|
||||||
|
buf = (char *) __get_free_page(GFP_KERNEL | GFP_DMA);
|
||||||
|
if (!buf) {
|
||||||
|
rc = -ENOMEM;
|
||||||
|
goto fail_free_fcb;
|
||||||
|
}
|
||||||
|
rc = diag_read_file(urd->dev_id.devno, buf);
|
||||||
|
if ((rc != 0) && (rc != -ENODATA)) /* EOF does not hurt */
|
||||||
|
goto fail_free_buf;
|
||||||
|
|
||||||
|
/* check if the file on top of the queue is open now */
|
||||||
|
rc = diag_read_next_file_info(fcb, 0);
|
||||||
|
if (rc)
|
||||||
|
goto fail_free_buf;
|
||||||
|
if (!(fcb->file_stat & FLG_IN_USE)) {
|
||||||
|
rc = -EMFILE;
|
||||||
|
goto fail_free_buf;
|
||||||
|
}
|
||||||
|
rc = 0;
|
||||||
|
|
||||||
|
fail_free_buf:
|
||||||
|
free_page((unsigned long) buf);
|
||||||
|
fail_free_fcb:
|
||||||
|
kfree(fcb);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int verify_device(struct urdev *urd)
|
||||||
|
{
|
||||||
switch (urd->class) {
|
switch (urd->class) {
|
||||||
case DEV_CLASS_UR_O:
|
case DEV_CLASS_UR_O:
|
||||||
return 0; /* no check needed here */
|
return 0; /* no check needed here */
|
||||||
case DEV_CLASS_UR_I:
|
case DEV_CLASS_UR_I:
|
||||||
/* check for empty reader device (beginning of chain) */
|
return verify_uri_device(urd);
|
||||||
rc = diag_read_next_file_info(&fcb, 0);
|
|
||||||
if (rc)
|
|
||||||
return rc;
|
|
||||||
|
|
||||||
/* open file on virtual reader */
|
|
||||||
buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
|
|
||||||
if (!buf)
|
|
||||||
return -ENOMEM;
|
|
||||||
rc = diag_read_file(urd->dev_id.devno, buf);
|
|
||||||
kfree(buf);
|
|
||||||
|
|
||||||
if ((rc != 0) && (rc != -ENODATA)) /* EOF does not hurt */
|
|
||||||
return rc;
|
|
||||||
return 0;
|
|
||||||
default:
|
default:
|
||||||
return -ENOTSUPP;
|
return -ENOTSUPP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_file_reclen(struct urdev *urd)
|
static int get_uri_file_reclen(struct urdev *urd)
|
||||||
{
|
{
|
||||||
struct file_control_block fcb;
|
struct file_control_block *fcb;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
fcb = kmalloc(sizeof(*fcb), GFP_KERNEL | GFP_DMA);
|
||||||
|
if (!fcb)
|
||||||
|
return -ENOMEM;
|
||||||
|
rc = diag_read_next_file_info(fcb, 0);
|
||||||
|
if (rc)
|
||||||
|
goto fail_free;
|
||||||
|
if (fcb->file_stat & FLG_CP_DUMP)
|
||||||
|
rc = 0;
|
||||||
|
else
|
||||||
|
rc = fcb->rec_len;
|
||||||
|
|
||||||
|
fail_free:
|
||||||
|
kfree(fcb);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_file_reclen(struct urdev *urd)
|
||||||
|
{
|
||||||
switch (urd->class) {
|
switch (urd->class) {
|
||||||
case DEV_CLASS_UR_O:
|
case DEV_CLASS_UR_O:
|
||||||
return 0;
|
return 0;
|
||||||
case DEV_CLASS_UR_I:
|
case DEV_CLASS_UR_I:
|
||||||
rc = diag_read_next_file_info(&fcb, 0);
|
return get_uri_file_reclen(urd);
|
||||||
if (rc)
|
|
||||||
return rc;
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
return -ENOTSUPP;
|
return -ENOTSUPP;
|
||||||
}
|
}
|
||||||
if (fcb.file_stat & FLG_CP_DUMP)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return fcb.rec_len;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ur_open(struct inode *inode, struct file *file)
|
static int ur_open(struct inode *inode, struct file *file)
|
||||||
|
@ -50,7 +50,10 @@ struct file_control_block {
|
|||||||
char rest[200];
|
char rest[200];
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
#define FLG_CP_DUMP 0x10
|
#define FLG_SYSTEM_HOLD 0x04
|
||||||
|
#define FLG_CP_DUMP 0x10
|
||||||
|
#define FLG_USER_HOLD 0x20
|
||||||
|
#define FLG_IN_USE 0x80
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A struct urdev is created for each ur device that is made available
|
* A struct urdev is created for each ur device that is made available
|
||||||
|
@ -79,6 +79,7 @@ css_alloc_subchannel(struct subchannel_id schid)
|
|||||||
sch->schib.pmcw.intparm = (__u32)(unsigned long)sch;
|
sch->schib.pmcw.intparm = (__u32)(unsigned long)sch;
|
||||||
ret = cio_modify(sch);
|
ret = cio_modify(sch);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
kfree(sch->lock);
|
||||||
kfree(sch);
|
kfree(sch);
|
||||||
return ERR_PTR(ret);
|
return ERR_PTR(ret);
|
||||||
}
|
}
|
||||||
|
@ -81,6 +81,7 @@ static __u32 volatile spare_indicator;
|
|||||||
static atomic_t spare_indicator_usecount;
|
static atomic_t spare_indicator_usecount;
|
||||||
#define QDIO_MEMPOOL_SCSSC_ELEMENTS 2
|
#define QDIO_MEMPOOL_SCSSC_ELEMENTS 2
|
||||||
static mempool_t *qdio_mempool_scssc;
|
static mempool_t *qdio_mempool_scssc;
|
||||||
|
static struct kmem_cache *qdio_q_cache;
|
||||||
|
|
||||||
static debug_info_t *qdio_dbf_setup;
|
static debug_info_t *qdio_dbf_setup;
|
||||||
static debug_info_t *qdio_dbf_sbal;
|
static debug_info_t *qdio_dbf_sbal;
|
||||||
@ -1617,23 +1618,21 @@ static void
|
|||||||
qdio_release_irq_memory(struct qdio_irq *irq_ptr)
|
qdio_release_irq_memory(struct qdio_irq *irq_ptr)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
struct qdio_q *q;
|
||||||
|
|
||||||
for (i=0;i<QDIO_MAX_QUEUES_PER_IRQ;i++) {
|
for (i = 0; i < QDIO_MAX_QUEUES_PER_IRQ; i++) {
|
||||||
if (!irq_ptr->input_qs[i])
|
q = irq_ptr->input_qs[i];
|
||||||
goto next;
|
if (q) {
|
||||||
|
free_page((unsigned long) q->slib);
|
||||||
kfree(irq_ptr->input_qs[i]->slib);
|
kmem_cache_free(qdio_q_cache, q);
|
||||||
kfree(irq_ptr->input_qs[i]);
|
}
|
||||||
|
q = irq_ptr->output_qs[i];
|
||||||
next:
|
if (q) {
|
||||||
if (!irq_ptr->output_qs[i])
|
free_page((unsigned long) q->slib);
|
||||||
continue;
|
kmem_cache_free(qdio_q_cache, q);
|
||||||
|
}
|
||||||
kfree(irq_ptr->output_qs[i]->slib);
|
|
||||||
kfree(irq_ptr->output_qs[i]);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
kfree(irq_ptr->qdr);
|
free_page((unsigned long) irq_ptr->qdr);
|
||||||
free_page((unsigned long) irq_ptr);
|
free_page((unsigned long) irq_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1680,44 +1679,35 @@ qdio_alloc_qs(struct qdio_irq *irq_ptr,
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct qdio_q *q;
|
struct qdio_q *q;
|
||||||
int result=-ENOMEM;
|
|
||||||
|
|
||||||
for (i=0;i<no_input_qs;i++) {
|
for (i = 0; i < no_input_qs; i++) {
|
||||||
q = kzalloc(sizeof(struct qdio_q), GFP_KERNEL);
|
q = kmem_cache_alloc(qdio_q_cache, GFP_KERNEL);
|
||||||
|
if (!q)
|
||||||
|
return -ENOMEM;
|
||||||
|
memset(q, 0, sizeof(*q));
|
||||||
|
|
||||||
if (!q) {
|
q->slib = (struct slib *) __get_free_page(GFP_KERNEL);
|
||||||
QDIO_PRINT_ERR("kmalloc of q failed!\n");
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
q->slib = kmalloc(PAGE_SIZE, GFP_KERNEL);
|
|
||||||
if (!q->slib) {
|
if (!q->slib) {
|
||||||
QDIO_PRINT_ERR("kmalloc of slib failed!\n");
|
kmem_cache_free(qdio_q_cache, q);
|
||||||
goto out;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
irq_ptr->input_qs[i]=q;
|
irq_ptr->input_qs[i]=q;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=0;i<no_output_qs;i++) {
|
for (i = 0; i < no_output_qs; i++) {
|
||||||
q = kzalloc(sizeof(struct qdio_q), GFP_KERNEL);
|
q = kmem_cache_alloc(qdio_q_cache, GFP_KERNEL);
|
||||||
|
if (!q)
|
||||||
|
return -ENOMEM;
|
||||||
|
memset(q, 0, sizeof(*q));
|
||||||
|
|
||||||
if (!q) {
|
q->slib = (struct slib *) __get_free_page(GFP_KERNEL);
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
q->slib=kmalloc(PAGE_SIZE,GFP_KERNEL);
|
|
||||||
if (!q->slib) {
|
if (!q->slib) {
|
||||||
QDIO_PRINT_ERR("kmalloc of slib failed!\n");
|
kmem_cache_free(qdio_q_cache, q);
|
||||||
goto out;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
irq_ptr->output_qs[i]=q;
|
irq_ptr->output_qs[i]=q;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
result=0;
|
|
||||||
out:
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -2985,17 +2975,17 @@ qdio_allocate(struct qdio_initialize *init_data)
|
|||||||
QDIO_DBF_HEX0(0,setup,&irq_ptr,sizeof(void*));
|
QDIO_DBF_HEX0(0,setup,&irq_ptr,sizeof(void*));
|
||||||
|
|
||||||
if (!irq_ptr) {
|
if (!irq_ptr) {
|
||||||
QDIO_PRINT_ERR("kmalloc of irq_ptr failed!\n");
|
QDIO_PRINT_ERR("allocation of irq_ptr failed!\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
init_MUTEX(&irq_ptr->setting_up_sema);
|
init_MUTEX(&irq_ptr->setting_up_sema);
|
||||||
|
|
||||||
/* QDR must be in DMA area since CCW data address is only 32 bit */
|
/* QDR must be in DMA area since CCW data address is only 32 bit */
|
||||||
irq_ptr->qdr=kmalloc(sizeof(struct qdr), GFP_KERNEL | GFP_DMA);
|
irq_ptr->qdr = (struct qdr *) __get_free_page(GFP_KERNEL | GFP_DMA);
|
||||||
if (!(irq_ptr->qdr)) {
|
if (!(irq_ptr->qdr)) {
|
||||||
free_page((unsigned long) irq_ptr);
|
free_page((unsigned long) irq_ptr);
|
||||||
QDIO_PRINT_ERR("kmalloc of irq_ptr->qdr failed!\n");
|
QDIO_PRINT_ERR("allocation of irq_ptr->qdr failed!\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
QDIO_DBF_TEXT0(0,setup,"qdr:");
|
QDIO_DBF_TEXT0(0,setup,"qdr:");
|
||||||
@ -3004,6 +2994,7 @@ qdio_allocate(struct qdio_initialize *init_data)
|
|||||||
if (qdio_alloc_qs(irq_ptr,
|
if (qdio_alloc_qs(irq_ptr,
|
||||||
init_data->no_input_qs,
|
init_data->no_input_qs,
|
||||||
init_data->no_output_qs)) {
|
init_data->no_output_qs)) {
|
||||||
|
QDIO_PRINT_ERR("queue allocation failed!\n");
|
||||||
qdio_release_irq_memory(irq_ptr);
|
qdio_release_irq_memory(irq_ptr);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
@ -3895,9 +3886,19 @@ init_QDIO(void)
|
|||||||
if (res)
|
if (res)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
|
qdio_q_cache = kmem_cache_create("qdio_q", sizeof(struct qdio_q),
|
||||||
|
256, 0, NULL);
|
||||||
|
if (!qdio_q_cache) {
|
||||||
|
qdio_release_qdio_memory();
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
res = qdio_register_dbf_views();
|
res = qdio_register_dbf_views();
|
||||||
if (res)
|
if (res) {
|
||||||
|
kmem_cache_destroy(qdio_q_cache);
|
||||||
|
qdio_release_qdio_memory();
|
||||||
return res;
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
QDIO_DBF_TEXT0(0,setup,"initQDIO");
|
QDIO_DBF_TEXT0(0,setup,"initQDIO");
|
||||||
res = bus_create_file(&ccw_bus_type, &bus_attr_qdio_performance_stats);
|
res = bus_create_file(&ccw_bus_type, &bus_attr_qdio_performance_stats);
|
||||||
@ -3929,6 +3930,7 @@ cleanup_QDIO(void)
|
|||||||
qdio_release_qdio_memory();
|
qdio_release_qdio_memory();
|
||||||
qdio_unregister_dbf_views();
|
qdio_unregister_dbf_views();
|
||||||
mempool_destroy(qdio_mempool_scssc);
|
mempool_destroy(qdio_mempool_scssc);
|
||||||
|
kmem_cache_destroy(qdio_q_cache);
|
||||||
bus_remove_file(&ccw_bus_type, &bus_attr_qdio_performance_stats);
|
bus_remove_file(&ccw_bus_type, &bus_attr_qdio_performance_stats);
|
||||||
printk("qdio: %s: module removed\n",version);
|
printk("qdio: %s: module removed\n",version);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user