scsi: cxlflash: Explicitly cache number of interrupts per context
The number of interrupts a user requests during a context attach is presently stored within the CXL work ioctl structure that is nested alongside the per context metadata. Keeping this data in a structure that is tied to a particular hardware implementation (CXL) will only complicate matters when supporting newer accelerator transports. Instead of relying upon the number of interrupts being cached within a CXL-specific structure, explicitly cache the value within the context information structure. Signed-off-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com> Signed-off-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Родитель
b070545db1
Коммит
af2047ec00
|
@ -814,15 +814,18 @@ err:
|
||||||
* @ctxid: Previously obtained process element associated with CXL context.
|
* @ctxid: Previously obtained process element associated with CXL context.
|
||||||
* @file: Previously obtained file associated with CXL context.
|
* @file: Previously obtained file associated with CXL context.
|
||||||
* @perms: User-specified permissions.
|
* @perms: User-specified permissions.
|
||||||
|
* @irqs: User-specified number of interrupts.
|
||||||
*/
|
*/
|
||||||
static void init_context(struct ctx_info *ctxi, struct cxlflash_cfg *cfg,
|
static void init_context(struct ctx_info *ctxi, struct cxlflash_cfg *cfg,
|
||||||
void *ctx, int ctxid, struct file *file, u32 perms)
|
void *ctx, int ctxid, struct file *file, u32 perms,
|
||||||
|
u64 irqs)
|
||||||
{
|
{
|
||||||
struct afu *afu = cfg->afu;
|
struct afu *afu = cfg->afu;
|
||||||
|
|
||||||
ctxi->rht_perms = perms;
|
ctxi->rht_perms = perms;
|
||||||
ctxi->ctrl_map = &afu->afu_map->ctrls[ctxid].ctrl;
|
ctxi->ctrl_map = &afu->afu_map->ctrls[ctxid].ctrl;
|
||||||
ctxi->ctxid = ENCODE_CTXID(ctxi, ctxid);
|
ctxi->ctxid = ENCODE_CTXID(ctxi, ctxid);
|
||||||
|
ctxi->irqs = irqs;
|
||||||
ctxi->pid = task_tgid_nr(current); /* tgid = pid */
|
ctxi->pid = task_tgid_nr(current); /* tgid = pid */
|
||||||
ctxi->ctx = ctx;
|
ctxi->ctx = ctx;
|
||||||
ctxi->cfg = cfg;
|
ctxi->cfg = cfg;
|
||||||
|
@ -1312,6 +1315,7 @@ static int cxlflash_disk_attach(struct scsi_device *sdev,
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
u32 perms;
|
u32 perms;
|
||||||
int ctxid = -1;
|
int ctxid = -1;
|
||||||
|
u64 irqs = attach->num_interrupts;
|
||||||
u64 flags = 0UL;
|
u64 flags = 0UL;
|
||||||
u64 rctxid = 0UL;
|
u64 rctxid = 0UL;
|
||||||
struct file *file = NULL;
|
struct file *file = NULL;
|
||||||
|
@ -1320,9 +1324,9 @@ static int cxlflash_disk_attach(struct scsi_device *sdev,
|
||||||
|
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
|
|
||||||
if (attach->num_interrupts > 4) {
|
if (irqs > 4) {
|
||||||
dev_dbg(dev, "%s: Cannot support this many interrupts %llu\n",
|
dev_dbg(dev, "%s: Cannot support this many interrupts %llu\n",
|
||||||
__func__, attach->num_interrupts);
|
__func__, irqs);
|
||||||
rc = -EINVAL;
|
rc = -EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -1402,7 +1406,7 @@ static int cxlflash_disk_attach(struct scsi_device *sdev,
|
||||||
}
|
}
|
||||||
|
|
||||||
work = &ctxi->work;
|
work = &ctxi->work;
|
||||||
work->num_interrupts = attach->num_interrupts;
|
work->num_interrupts = irqs;
|
||||||
work->flags = CXL_START_WORK_NUM_IRQS;
|
work->flags = CXL_START_WORK_NUM_IRQS;
|
||||||
|
|
||||||
rc = cxl_start_work(ctx, work);
|
rc = cxl_start_work(ctx, work);
|
||||||
|
@ -1430,7 +1434,7 @@ static int cxlflash_disk_attach(struct scsi_device *sdev,
|
||||||
perms = SISL_RHT_PERM(attach->hdr.flags + 1);
|
perms = SISL_RHT_PERM(attach->hdr.flags + 1);
|
||||||
|
|
||||||
/* Context mutex is locked upon return */
|
/* Context mutex is locked upon return */
|
||||||
init_context(ctxi, cfg, ctx, ctxid, file, perms);
|
init_context(ctxi, cfg, ctx, ctxid, file, perms, irqs);
|
||||||
|
|
||||||
rc = afu_attach(cfg, ctxi);
|
rc = afu_attach(cfg, ctxi);
|
||||||
if (unlikely(rc)) {
|
if (unlikely(rc)) {
|
||||||
|
|
|
@ -98,6 +98,7 @@ struct ctx_info {
|
||||||
|
|
||||||
struct cxl_ioctl_start_work work;
|
struct cxl_ioctl_start_work work;
|
||||||
u64 ctxid;
|
u64 ctxid;
|
||||||
|
u64 irqs; /* Number of interrupts requested for context */
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
bool initialized;
|
bool initialized;
|
||||||
bool unavail;
|
bool unavail;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче