Skip to content

Commit 0f22570

Browse files
davejiangvinodkoul
authored andcommitted
dmaengine: idxd: fix wq settings post wq disable
By the spec, wq size and group association is not changeable unless device is disabled. Exclude clearing the shadow copy on wq disable/reset. This allows wq type to be changed after disable to be re-enabled. Move the size and group association to its own cleanup and only call it during device disable. Fixes: 0dcfe41 ("dmanegine: idxd: cleanup all device related bits after disabling device") Reported-by: Lucas Van <[email protected]> Tested-by: Lucas Van <[email protected]> Signed-off-by: Dave Jiang <[email protected]> Link: https://lore.kernel.org/r/163951291732.2987775.13576571320501115257.stgit@djiang5-desk3.ch.intel.com Signed-off-by: Vinod Koul <[email protected]>
1 parent 403a2e2 commit 0f22570

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

drivers/dma/idxd/device.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,6 @@ static void idxd_wq_disable_cleanup(struct idxd_wq *wq)
358358
lockdep_assert_held(&wq->wq_lock);
359359
memset(wq->wqcfg, 0, idxd->wqcfg_size);
360360
wq->type = IDXD_WQT_NONE;
361-
wq->size = 0;
362-
wq->group = NULL;
363361
wq->threshold = 0;
364362
wq->priority = 0;
365363
wq->ats_dis = 0;
@@ -371,6 +369,15 @@ static void idxd_wq_disable_cleanup(struct idxd_wq *wq)
371369
wq->max_batch_size = WQ_DEFAULT_MAX_BATCH;
372370
}
373371

372+
static void idxd_wq_device_reset_cleanup(struct idxd_wq *wq)
373+
{
374+
lockdep_assert_held(&wq->wq_lock);
375+
376+
idxd_wq_disable_cleanup(wq);
377+
wq->size = 0;
378+
wq->group = NULL;
379+
}
380+
374381
static void idxd_wq_ref_release(struct percpu_ref *ref)
375382
{
376383
struct idxd_wq *wq = container_of(ref, struct idxd_wq, wq_active);
@@ -689,6 +696,7 @@ static void idxd_device_wqs_clear_state(struct idxd_device *idxd)
689696

690697
if (wq->state == IDXD_WQ_ENABLED) {
691698
idxd_wq_disable_cleanup(wq);
699+
idxd_wq_device_reset_cleanup(wq);
692700
wq->state = IDXD_WQ_DISABLED;
693701
}
694702
}

0 commit comments

Comments
 (0)