Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
Pull s390 updates from Martin Schwidefsky: "common I/O layer - Fix bit-fields crossing storage-unit boundaries in css_general_char dasd driver - Avoid a sparse warning in regard to the queue lock - Allocate the struct dasd_ccw_req as per request data. Only for internal I/O is the structure allocated separately - Remove the unused function dasd_kmalloc_set_cda - Save a few bytes in struct dasd_ccw_req by reordering fields - Convert remaining users of dasd_kmalloc_request to dasd_smalloc_request and remove the now unused function vfio/ccw - Refactor and improve pfn_array_alloc_pin/pfn_array_pin - Add a new tracepoint for failed vfio/ccw requests - Add a CCW translation improvement to accept more requests as valid - Bug fixes" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: s390/dasd: only use preallocated requests s390/dasd: reshuffle struct dasd_ccw_req s390/dasd: remove dasd_kmalloc_set_cda s390/dasd: move dasd_ccw_req to per request data s390/dasd: simplify locking in process_final_queue s390/cio: sanitize css_general_characteristics definition vfio: ccw: add tracepoints for interesting error paths vfio: ccw: set ccw->cda to NULL defensively vfio: ccw: refactor and improve pfn_array_alloc_pin() vfio: ccw: shorten kernel doc description for pfn_array_pin() vfio: ccw: push down unsupported IDA check vfio: ccw: fix error return in vfio_ccw_sch_event s390/archrandom: Rework arch random implementation. s390/net: add pnetid support
This commit is contained in:
@@ -1222,80 +1222,37 @@ static void dasd_hosts_init(struct dentry *base_dentry,
|
||||
device->hosts_dentry = pde;
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate memory for a channel program with 'cplength' channel
|
||||
* command words and 'datasize' additional space. There are two
|
||||
* variantes: 1) dasd_kmalloc_request uses kmalloc to get the needed
|
||||
* memory and 2) dasd_smalloc_request uses the static ccw memory
|
||||
* that gets allocated for each device.
|
||||
*/
|
||||
struct dasd_ccw_req *dasd_kmalloc_request(int magic, int cplength,
|
||||
int datasize,
|
||||
struct dasd_device *device)
|
||||
{
|
||||
struct dasd_ccw_req *cqr;
|
||||
|
||||
/* Sanity checks */
|
||||
BUG_ON(datasize > PAGE_SIZE ||
|
||||
(cplength*sizeof(struct ccw1)) > PAGE_SIZE);
|
||||
|
||||
cqr = kzalloc(sizeof(struct dasd_ccw_req), GFP_ATOMIC);
|
||||
if (cqr == NULL)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
cqr->cpaddr = NULL;
|
||||
if (cplength > 0) {
|
||||
cqr->cpaddr = kcalloc(cplength, sizeof(struct ccw1),
|
||||
GFP_ATOMIC | GFP_DMA);
|
||||
if (cqr->cpaddr == NULL) {
|
||||
kfree(cqr);
|
||||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
}
|
||||
cqr->data = NULL;
|
||||
if (datasize > 0) {
|
||||
cqr->data = kzalloc(datasize, GFP_ATOMIC | GFP_DMA);
|
||||
if (cqr->data == NULL) {
|
||||
kfree(cqr->cpaddr);
|
||||
kfree(cqr);
|
||||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
}
|
||||
cqr->magic = magic;
|
||||
set_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags);
|
||||
dasd_get_device(device);
|
||||
return cqr;
|
||||
}
|
||||
EXPORT_SYMBOL(dasd_kmalloc_request);
|
||||
|
||||
struct dasd_ccw_req *dasd_smalloc_request(int magic, int cplength,
|
||||
int datasize,
|
||||
struct dasd_device *device)
|
||||
struct dasd_ccw_req *dasd_smalloc_request(int magic, int cplength, int datasize,
|
||||
struct dasd_device *device,
|
||||
struct dasd_ccw_req *cqr)
|
||||
{
|
||||
unsigned long flags;
|
||||
struct dasd_ccw_req *cqr;
|
||||
char *data;
|
||||
int size;
|
||||
char *data, *chunk;
|
||||
int size = 0;
|
||||
|
||||
size = (sizeof(struct dasd_ccw_req) + 7L) & -8L;
|
||||
if (cplength > 0)
|
||||
size += cplength * sizeof(struct ccw1);
|
||||
if (datasize > 0)
|
||||
size += datasize;
|
||||
if (!cqr)
|
||||
size += (sizeof(*cqr) + 7L) & -8L;
|
||||
|
||||
spin_lock_irqsave(&device->mem_lock, flags);
|
||||
cqr = (struct dasd_ccw_req *)
|
||||
dasd_alloc_chunk(&device->ccw_chunks, size);
|
||||
data = chunk = dasd_alloc_chunk(&device->ccw_chunks, size);
|
||||
spin_unlock_irqrestore(&device->mem_lock, flags);
|
||||
if (cqr == NULL)
|
||||
if (!chunk)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
memset(cqr, 0, sizeof(struct dasd_ccw_req));
|
||||
data = (char *) cqr + ((sizeof(struct dasd_ccw_req) + 7L) & -8L);
|
||||
cqr->cpaddr = NULL;
|
||||
if (cplength > 0) {
|
||||
cqr->cpaddr = (struct ccw1 *) data;
|
||||
data += cplength*sizeof(struct ccw1);
|
||||
memset(cqr->cpaddr, 0, cplength*sizeof(struct ccw1));
|
||||
if (!cqr) {
|
||||
cqr = (void *) data;
|
||||
data += (sizeof(*cqr) + 7L) & -8L;
|
||||
}
|
||||
memset(cqr, 0, sizeof(*cqr));
|
||||
cqr->mem_chunk = chunk;
|
||||
if (cplength > 0) {
|
||||
cqr->cpaddr = data;
|
||||
data += cplength * sizeof(struct ccw1);
|
||||
memset(cqr->cpaddr, 0, cplength * sizeof(struct ccw1));
|
||||
}
|
||||
cqr->data = NULL;
|
||||
if (datasize > 0) {
|
||||
cqr->data = data;
|
||||
memset(cqr->data, 0, datasize);
|
||||
@@ -1307,33 +1264,12 @@ struct dasd_ccw_req *dasd_smalloc_request(int magic, int cplength,
|
||||
}
|
||||
EXPORT_SYMBOL(dasd_smalloc_request);
|
||||
|
||||
/*
|
||||
* Free memory of a channel program. This function needs to free all the
|
||||
* idal lists that might have been created by dasd_set_cda and the
|
||||
* struct dasd_ccw_req itself.
|
||||
*/
|
||||
void dasd_kfree_request(struct dasd_ccw_req *cqr, struct dasd_device *device)
|
||||
{
|
||||
struct ccw1 *ccw;
|
||||
|
||||
/* Clear any idals used for the request. */
|
||||
ccw = cqr->cpaddr;
|
||||
do {
|
||||
clear_normalized_cda(ccw);
|
||||
} while (ccw++->flags & (CCW_FLAG_CC | CCW_FLAG_DC));
|
||||
kfree(cqr->cpaddr);
|
||||
kfree(cqr->data);
|
||||
kfree(cqr);
|
||||
dasd_put_device(device);
|
||||
}
|
||||
EXPORT_SYMBOL(dasd_kfree_request);
|
||||
|
||||
void dasd_sfree_request(struct dasd_ccw_req *cqr, struct dasd_device *device)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&device->mem_lock, flags);
|
||||
dasd_free_chunk(&device->ccw_chunks, cqr);
|
||||
dasd_free_chunk(&device->ccw_chunks, cqr->mem_chunk);
|
||||
spin_unlock_irqrestore(&device->mem_lock, flags);
|
||||
dasd_put_device(device);
|
||||
}
|
||||
@@ -1885,6 +1821,33 @@ static void __dasd_device_process_ccw_queue(struct dasd_device *device,
|
||||
}
|
||||
}
|
||||
|
||||
static void __dasd_process_cqr(struct dasd_device *device,
|
||||
struct dasd_ccw_req *cqr)
|
||||
{
|
||||
char errorstring[ERRORLENGTH];
|
||||
|
||||
switch (cqr->status) {
|
||||
case DASD_CQR_SUCCESS:
|
||||
cqr->status = DASD_CQR_DONE;
|
||||
break;
|
||||
case DASD_CQR_ERROR:
|
||||
cqr->status = DASD_CQR_NEED_ERP;
|
||||
break;
|
||||
case DASD_CQR_CLEARED:
|
||||
cqr->status = DASD_CQR_TERMINATED;
|
||||
break;
|
||||
default:
|
||||
/* internal error 12 - wrong cqr status*/
|
||||
snprintf(errorstring, ERRORLENGTH, "12 %p %x02", cqr, cqr->status);
|
||||
dev_err(&device->cdev->dev,
|
||||
"An error occurred in the DASD device driver, "
|
||||
"reason=%s\n", errorstring);
|
||||
BUG();
|
||||
}
|
||||
if (cqr->callback)
|
||||
cqr->callback(cqr, cqr->callback_data);
|
||||
}
|
||||
|
||||
/*
|
||||
* the cqrs from the final queue are returned to the upper layer
|
||||
* by setting a dasd_block state and calling the callback function
|
||||
@@ -1895,40 +1858,18 @@ static void __dasd_device_process_final_queue(struct dasd_device *device,
|
||||
struct list_head *l, *n;
|
||||
struct dasd_ccw_req *cqr;
|
||||
struct dasd_block *block;
|
||||
void (*callback)(struct dasd_ccw_req *, void *data);
|
||||
void *callback_data;
|
||||
char errorstring[ERRORLENGTH];
|
||||
|
||||
list_for_each_safe(l, n, final_queue) {
|
||||
cqr = list_entry(l, struct dasd_ccw_req, devlist);
|
||||
list_del_init(&cqr->devlist);
|
||||
block = cqr->block;
|
||||
callback = cqr->callback;
|
||||
callback_data = cqr->callback_data;
|
||||
if (block)
|
||||
if (!block) {
|
||||
__dasd_process_cqr(device, cqr);
|
||||
} else {
|
||||
spin_lock_bh(&block->queue_lock);
|
||||
switch (cqr->status) {
|
||||
case DASD_CQR_SUCCESS:
|
||||
cqr->status = DASD_CQR_DONE;
|
||||
break;
|
||||
case DASD_CQR_ERROR:
|
||||
cqr->status = DASD_CQR_NEED_ERP;
|
||||
break;
|
||||
case DASD_CQR_CLEARED:
|
||||
cqr->status = DASD_CQR_TERMINATED;
|
||||
break;
|
||||
default:
|
||||
/* internal error 12 - wrong cqr status*/
|
||||
snprintf(errorstring, ERRORLENGTH, "12 %p %x02", cqr, cqr->status);
|
||||
dev_err(&device->cdev->dev,
|
||||
"An error occurred in the DASD device driver, "
|
||||
"reason=%s\n", errorstring);
|
||||
BUG();
|
||||
}
|
||||
if (cqr->callback != NULL)
|
||||
(callback)(cqr, callback_data);
|
||||
if (block)
|
||||
__dasd_process_cqr(device, cqr);
|
||||
spin_unlock_bh(&block->queue_lock);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3041,7 +2982,6 @@ static blk_status_t do_dasd_request(struct blk_mq_hw_ctx *hctx,
|
||||
cqr->callback_data = req;
|
||||
cqr->status = DASD_CQR_FILLED;
|
||||
cqr->dq = dq;
|
||||
*((struct dasd_ccw_req **) blk_mq_rq_to_pdu(req)) = cqr;
|
||||
|
||||
blk_mq_start_request(req);
|
||||
spin_lock(&block->queue_lock);
|
||||
@@ -3072,7 +3012,7 @@ enum blk_eh_timer_return dasd_times_out(struct request *req, bool reserved)
|
||||
unsigned long flags;
|
||||
int rc = 0;
|
||||
|
||||
cqr = *((struct dasd_ccw_req **) blk_mq_rq_to_pdu(req));
|
||||
cqr = blk_mq_rq_to_pdu(req);
|
||||
if (!cqr)
|
||||
return BLK_EH_DONE;
|
||||
|
||||
@@ -3174,7 +3114,7 @@ static int dasd_alloc_queue(struct dasd_block *block)
|
||||
int rc;
|
||||
|
||||
block->tag_set.ops = &dasd_mq_ops;
|
||||
block->tag_set.cmd_size = sizeof(struct dasd_ccw_req *);
|
||||
block->tag_set.cmd_size = sizeof(struct dasd_ccw_req);
|
||||
block->tag_set.nr_hw_queues = DASD_NR_HW_QUEUES;
|
||||
block->tag_set.queue_depth = DASD_MAX_LCU_DEV * DASD_REQ_PER_DEV;
|
||||
block->tag_set.flags = BLK_MQ_F_SHOULD_MERGE;
|
||||
@@ -4038,7 +3978,8 @@ static struct dasd_ccw_req *dasd_generic_build_rdc(struct dasd_device *device,
|
||||
struct ccw1 *ccw;
|
||||
unsigned long *idaw;
|
||||
|
||||
cqr = dasd_smalloc_request(magic, 1 /* RDC */, rdc_buffer_size, device);
|
||||
cqr = dasd_smalloc_request(magic, 1 /* RDC */, rdc_buffer_size, device,
|
||||
NULL);
|
||||
|
||||
if (IS_ERR(cqr)) {
|
||||
/* internal error 13 - Allocating the RDC request failed*/
|
||||
|
@@ -407,9 +407,9 @@ static int read_unit_address_configuration(struct dasd_device *device,
|
||||
int rc;
|
||||
unsigned long flags;
|
||||
|
||||
cqr = dasd_kmalloc_request(DASD_ECKD_MAGIC, 1 /* PSF */ + 1 /* RSSD */,
|
||||
cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, 1 /* PSF */ + 1 /* RSSD */,
|
||||
(sizeof(struct dasd_psf_prssd_data)),
|
||||
device);
|
||||
device, NULL);
|
||||
if (IS_ERR(cqr))
|
||||
return PTR_ERR(cqr);
|
||||
cqr->startdev = device;
|
||||
@@ -457,7 +457,7 @@ static int read_unit_address_configuration(struct dasd_device *device,
|
||||
lcu->flags |= NEED_UAC_UPDATE;
|
||||
spin_unlock_irqrestore(&lcu->lock, flags);
|
||||
}
|
||||
dasd_kfree_request(cqr, cqr->memdev);
|
||||
dasd_sfree_request(cqr, cqr->memdev);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@@ -536,7 +536,8 @@ static struct dasd_ccw_req *dasd_diag_build_cp(struct dasd_device *memdev,
|
||||
/* Build the request */
|
||||
datasize = sizeof(struct dasd_diag_req) +
|
||||
count*sizeof(struct dasd_diag_bio);
|
||||
cqr = dasd_smalloc_request(DASD_DIAG_MAGIC, 0, datasize, memdev);
|
||||
cqr = dasd_smalloc_request(DASD_DIAG_MAGIC, 0, datasize, memdev,
|
||||
blk_mq_rq_to_pdu(req));
|
||||
if (IS_ERR(cqr))
|
||||
return cqr;
|
||||
|
||||
|
@@ -886,7 +886,7 @@ static int dasd_eckd_read_conf_lpm(struct dasd_device *device,
|
||||
}
|
||||
cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, 1 /* RCD */,
|
||||
0, /* use rcd_buf as data ara */
|
||||
device);
|
||||
device, NULL);
|
||||
if (IS_ERR(cqr)) {
|
||||
DBF_DEV_EVENT(DBF_WARNING, device, "%s",
|
||||
"Could not allocate RCD request");
|
||||
@@ -1442,7 +1442,7 @@ static int dasd_eckd_read_features(struct dasd_device *device)
|
||||
cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, 1 /* PSF */ + 1 /* RSSD */,
|
||||
(sizeof(struct dasd_psf_prssd_data) +
|
||||
sizeof(struct dasd_rssd_features)),
|
||||
device);
|
||||
device, NULL);
|
||||
if (IS_ERR(cqr)) {
|
||||
DBF_EVENT_DEVID(DBF_WARNING, device->cdev, "%s", "Could not "
|
||||
"allocate initialization request");
|
||||
@@ -1504,7 +1504,7 @@ static struct dasd_ccw_req *dasd_eckd_build_psf_ssc(struct dasd_device *device,
|
||||
|
||||
cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, 1 /* PSF */ ,
|
||||
sizeof(struct dasd_psf_ssc_data),
|
||||
device);
|
||||
device, NULL);
|
||||
|
||||
if (IS_ERR(cqr)) {
|
||||
DBF_DEV_EVENT(DBF_WARNING, device, "%s",
|
||||
@@ -1815,7 +1815,8 @@ dasd_eckd_analysis_ccw(struct dasd_device *device)
|
||||
|
||||
cplength = 8;
|
||||
datasize = sizeof(struct DE_eckd_data) + 2*sizeof(struct LO_eckd_data);
|
||||
cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, cplength, datasize, device);
|
||||
cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, cplength, datasize, device,
|
||||
NULL);
|
||||
if (IS_ERR(cqr))
|
||||
return cqr;
|
||||
ccw = cqr->cpaddr;
|
||||
@@ -2092,7 +2093,8 @@ dasd_eckd_build_check_tcw(struct dasd_device *base, struct format_data_t *fdata,
|
||||
*/
|
||||
itcw_size = itcw_calc_size(0, count, 0);
|
||||
|
||||
cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, 0, itcw_size, startdev);
|
||||
cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, 0, itcw_size, startdev,
|
||||
NULL);
|
||||
if (IS_ERR(cqr))
|
||||
return cqr;
|
||||
|
||||
@@ -2186,7 +2188,7 @@ dasd_eckd_build_check(struct dasd_device *base, struct format_data_t *fdata,
|
||||
cplength += count;
|
||||
|
||||
cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, cplength, datasize,
|
||||
startdev);
|
||||
startdev, NULL);
|
||||
if (IS_ERR(cqr))
|
||||
return cqr;
|
||||
|
||||
@@ -2332,7 +2334,7 @@ dasd_eckd_build_format(struct dasd_device *base,
|
||||
}
|
||||
/* Allocate the format ccw request. */
|
||||
fcp = dasd_smalloc_request(DASD_ECKD_MAGIC, cplength,
|
||||
datasize, startdev);
|
||||
datasize, startdev, NULL);
|
||||
if (IS_ERR(fcp))
|
||||
return fcp;
|
||||
|
||||
@@ -3103,7 +3105,7 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_cmd_single(
|
||||
}
|
||||
/* Allocate the ccw request. */
|
||||
cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, cplength, datasize,
|
||||
startdev);
|
||||
startdev, blk_mq_rq_to_pdu(req));
|
||||
if (IS_ERR(cqr))
|
||||
return cqr;
|
||||
ccw = cqr->cpaddr;
|
||||
@@ -3262,7 +3264,7 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_cmd_track(
|
||||
|
||||
/* Allocate the ccw request. */
|
||||
cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, cplength, datasize,
|
||||
startdev);
|
||||
startdev, blk_mq_rq_to_pdu(req));
|
||||
if (IS_ERR(cqr))
|
||||
return cqr;
|
||||
ccw = cqr->cpaddr;
|
||||
@@ -3595,7 +3597,8 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track(
|
||||
|
||||
/* Allocate the ccw request. */
|
||||
itcw_size = itcw_calc_size(0, ctidaw, 0);
|
||||
cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, 0, itcw_size, startdev);
|
||||
cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, 0, itcw_size, startdev,
|
||||
blk_mq_rq_to_pdu(req));
|
||||
if (IS_ERR(cqr))
|
||||
return cqr;
|
||||
|
||||
@@ -3862,7 +3865,7 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_raw(struct dasd_device *startdev,
|
||||
|
||||
/* Allocate the ccw request. */
|
||||
cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, cplength,
|
||||
datasize, startdev);
|
||||
datasize, startdev, blk_mq_rq_to_pdu(req));
|
||||
if (IS_ERR(cqr))
|
||||
return cqr;
|
||||
|
||||
@@ -4102,7 +4105,7 @@ dasd_eckd_release(struct dasd_device *device)
|
||||
return -EACCES;
|
||||
|
||||
useglobal = 0;
|
||||
cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, 1, 32, device);
|
||||
cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, 1, 32, device, NULL);
|
||||
if (IS_ERR(cqr)) {
|
||||
mutex_lock(&dasd_reserve_mutex);
|
||||
useglobal = 1;
|
||||
@@ -4157,7 +4160,7 @@ dasd_eckd_reserve(struct dasd_device *device)
|
||||
return -EACCES;
|
||||
|
||||
useglobal = 0;
|
||||
cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, 1, 32, device);
|
||||
cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, 1, 32, device, NULL);
|
||||
if (IS_ERR(cqr)) {
|
||||
mutex_lock(&dasd_reserve_mutex);
|
||||
useglobal = 1;
|
||||
@@ -4211,7 +4214,7 @@ dasd_eckd_steal_lock(struct dasd_device *device)
|
||||
return -EACCES;
|
||||
|
||||
useglobal = 0;
|
||||
cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, 1, 32, device);
|
||||
cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, 1, 32, device, NULL);
|
||||
if (IS_ERR(cqr)) {
|
||||
mutex_lock(&dasd_reserve_mutex);
|
||||
useglobal = 1;
|
||||
@@ -4271,7 +4274,8 @@ static int dasd_eckd_snid(struct dasd_device *device,
|
||||
|
||||
useglobal = 0;
|
||||
cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, 1,
|
||||
sizeof(struct dasd_snid_data), device);
|
||||
sizeof(struct dasd_snid_data), device,
|
||||
NULL);
|
||||
if (IS_ERR(cqr)) {
|
||||
mutex_lock(&dasd_reserve_mutex);
|
||||
useglobal = 1;
|
||||
@@ -4331,7 +4335,7 @@ dasd_eckd_performance(struct dasd_device *device, void __user *argp)
|
||||
cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, 1 /* PSF */ + 1 /* RSSD */,
|
||||
(sizeof(struct dasd_psf_prssd_data) +
|
||||
sizeof(struct dasd_rssd_perf_stats_t)),
|
||||
device);
|
||||
device, NULL);
|
||||
if (IS_ERR(cqr)) {
|
||||
DBF_DEV_EVENT(DBF_WARNING, device, "%s",
|
||||
"Could not allocate initialization request");
|
||||
@@ -4477,7 +4481,7 @@ static int dasd_symm_io(struct dasd_device *device, void __user *argp)
|
||||
psf1 = psf_data[1];
|
||||
|
||||
/* setup CCWs for PSF + RSSD */
|
||||
cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, 2 , 0, device);
|
||||
cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, 2, 0, device, NULL);
|
||||
if (IS_ERR(cqr)) {
|
||||
DBF_DEV_EVENT(DBF_WARNING, device, "%s",
|
||||
"Could not allocate initialization request");
|
||||
@@ -5037,7 +5041,7 @@ static int dasd_eckd_read_message_buffer(struct dasd_device *device,
|
||||
cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, 1 /* PSF */ + 1 /* RSSD */,
|
||||
(sizeof(struct dasd_psf_prssd_data) +
|
||||
sizeof(struct dasd_rssd_messages)),
|
||||
device);
|
||||
device, NULL);
|
||||
if (IS_ERR(cqr)) {
|
||||
DBF_EVENT_DEVID(DBF_WARNING, device->cdev, "%s",
|
||||
"Could not allocate read message buffer request");
|
||||
@@ -5126,7 +5130,7 @@ static int dasd_eckd_query_host_access(struct dasd_device *device,
|
||||
|
||||
cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, 1 /* PSF */ + 1 /* RSSD */,
|
||||
sizeof(struct dasd_psf_prssd_data) + 1,
|
||||
device);
|
||||
device, NULL);
|
||||
if (IS_ERR(cqr)) {
|
||||
DBF_EVENT_DEVID(DBF_WARNING, device->cdev, "%s",
|
||||
"Could not allocate read message buffer request");
|
||||
@@ -5284,8 +5288,8 @@ dasd_eckd_psf_cuir_response(struct dasd_device *device, int response,
|
||||
int rc;
|
||||
|
||||
cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, 1 /* PSF */ ,
|
||||
sizeof(struct dasd_psf_cuir_response),
|
||||
device);
|
||||
sizeof(struct dasd_psf_cuir_response),
|
||||
device, NULL);
|
||||
|
||||
if (IS_ERR(cqr)) {
|
||||
DBF_DEV_EVENT(DBF_WARNING, device, "%s",
|
||||
|
@@ -447,7 +447,7 @@ static void dasd_eer_snss_cb(struct dasd_ccw_req *cqr, void *data)
|
||||
* is a new ccw in device->eer_cqr. Free the "old"
|
||||
* snss request now.
|
||||
*/
|
||||
dasd_kfree_request(cqr, device);
|
||||
dasd_sfree_request(cqr, device);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -472,8 +472,8 @@ int dasd_eer_enable(struct dasd_device *device)
|
||||
if (rc)
|
||||
goto out;
|
||||
|
||||
cqr = dasd_kmalloc_request(DASD_ECKD_MAGIC, 1 /* SNSS */,
|
||||
SNSS_DATA_SIZE, device);
|
||||
cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, 1 /* SNSS */,
|
||||
SNSS_DATA_SIZE, device, NULL);
|
||||
if (IS_ERR(cqr)) {
|
||||
rc = -ENOMEM;
|
||||
cqr = NULL;
|
||||
@@ -505,7 +505,7 @@ out:
|
||||
spin_unlock_irqrestore(get_ccwdev_lock(device->cdev), flags);
|
||||
|
||||
if (cqr)
|
||||
dasd_kfree_request(cqr, device);
|
||||
dasd_sfree_request(cqr, device);
|
||||
|
||||
return rc;
|
||||
}
|
||||
@@ -528,7 +528,7 @@ void dasd_eer_disable(struct dasd_device *device)
|
||||
in_use = test_and_clear_bit(DASD_FLAG_EER_IN_USE, &device->flags);
|
||||
spin_unlock_irqrestore(get_ccwdev_lock(device->cdev), flags);
|
||||
if (cqr && !in_use)
|
||||
dasd_kfree_request(cqr, device);
|
||||
dasd_sfree_request(cqr, device);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -356,7 +356,8 @@ static struct dasd_ccw_req *dasd_fba_build_cp_discard(
|
||||
datasize = sizeof(struct DE_fba_data) +
|
||||
nr_ccws * (sizeof(struct LO_fba_data) + sizeof(struct ccw1));
|
||||
|
||||
cqr = dasd_smalloc_request(DASD_FBA_MAGIC, cplength, datasize, memdev);
|
||||
cqr = dasd_smalloc_request(DASD_FBA_MAGIC, cplength, datasize, memdev,
|
||||
blk_mq_rq_to_pdu(req));
|
||||
if (IS_ERR(cqr))
|
||||
return cqr;
|
||||
|
||||
@@ -490,7 +491,8 @@ static struct dasd_ccw_req *dasd_fba_build_cp_regular(
|
||||
datasize += (count - 1)*sizeof(struct LO_fba_data);
|
||||
}
|
||||
/* Allocate the ccw request. */
|
||||
cqr = dasd_smalloc_request(DASD_FBA_MAGIC, cplength, datasize, memdev);
|
||||
cqr = dasd_smalloc_request(DASD_FBA_MAGIC, cplength, datasize, memdev,
|
||||
blk_mq_rq_to_pdu(req));
|
||||
if (IS_ERR(cqr))
|
||||
return cqr;
|
||||
ccw = cqr->cpaddr;
|
||||
|
@@ -158,40 +158,33 @@ do { \
|
||||
|
||||
struct dasd_ccw_req {
|
||||
unsigned int magic; /* Eye catcher */
|
||||
int intrc; /* internal error, e.g. from start_IO */
|
||||
struct list_head devlist; /* for dasd_device request queue */
|
||||
struct list_head blocklist; /* for dasd_block request queue */
|
||||
|
||||
/* Where to execute what... */
|
||||
struct dasd_block *block; /* the originating block device */
|
||||
struct dasd_device *memdev; /* the device used to allocate this */
|
||||
struct dasd_device *startdev; /* device the request is started on */
|
||||
struct dasd_device *basedev; /* base device if no block->base */
|
||||
void *cpaddr; /* address of ccw or tcw */
|
||||
short retries; /* A retry counter */
|
||||
unsigned char cpmode; /* 0 = cmd mode, 1 = itcw */
|
||||
char status; /* status of this request */
|
||||
short retries; /* A retry counter */
|
||||
char lpm; /* logical path mask */
|
||||
unsigned long flags; /* flags of this request */
|
||||
struct dasd_queue *dq;
|
||||
|
||||
/* ... and how */
|
||||
unsigned long starttime; /* jiffies time of request start */
|
||||
unsigned long expires; /* expiration period in jiffies */
|
||||
char lpm; /* logical path mask */
|
||||
void *data; /* pointer to data area */
|
||||
|
||||
/* these are important for recovering erroneous requests */
|
||||
int intrc; /* internal error, e.g. from start_IO */
|
||||
struct irb irb; /* device status in case of an error */
|
||||
struct dasd_ccw_req *refers; /* ERP-chain queueing. */
|
||||
void *function; /* originating ERP action */
|
||||
void *mem_chunk;
|
||||
|
||||
/* these are for statistics only */
|
||||
unsigned long buildclk; /* TOD-clock of request generation */
|
||||
unsigned long startclk; /* TOD-clock of request start */
|
||||
unsigned long stopclk; /* TOD-clock of request interrupt */
|
||||
unsigned long endclk; /* TOD-clock of request termination */
|
||||
|
||||
/* Callback that is called after reaching final status. */
|
||||
void (*callback)(struct dasd_ccw_req *, void *data);
|
||||
void *callback_data;
|
||||
};
|
||||
@@ -714,19 +707,10 @@ extern const struct block_device_operations dasd_device_operations;
|
||||
extern struct kmem_cache *dasd_page_cache;
|
||||
|
||||
struct dasd_ccw_req *
|
||||
dasd_kmalloc_request(int , int, int, struct dasd_device *);
|
||||
struct dasd_ccw_req *
|
||||
dasd_smalloc_request(int , int, int, struct dasd_device *);
|
||||
void dasd_kfree_request(struct dasd_ccw_req *, struct dasd_device *);
|
||||
dasd_smalloc_request(int, int, int, struct dasd_device *, struct dasd_ccw_req *);
|
||||
void dasd_sfree_request(struct dasd_ccw_req *, struct dasd_device *);
|
||||
void dasd_wakeup_cb(struct dasd_ccw_req *, void *);
|
||||
|
||||
static inline int
|
||||
dasd_kmalloc_set_cda(struct ccw1 *ccw, void *cda, struct dasd_device *device)
|
||||
{
|
||||
return set_normalized_cda(ccw, cda);
|
||||
}
|
||||
|
||||
struct dasd_device *dasd_alloc_device(void);
|
||||
void dasd_free_device(struct dasd_device *);
|
||||
|
||||
|
Reference in New Issue
Block a user