Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 0dcfe41e9a4c ("dmanegine: idxd: cleanup all device related bits after disabling device")
Reported-by: Lucas Van <lucas.van@intel.com>
Tested-by: Lucas Van <lucas.van@intel.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Link: https://lore.kernel.org/r/163951291732.2987775.13576571320501115257.stgit@djiang5-desk3.ch.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Dave Jiang and committed by
Vinod Koul
0f225705 403a2e23

+10 -2
+10 -2
drivers/dma/idxd/device.c
··· 358 358 lockdep_assert_held(&wq->wq_lock); 359 359 memset(wq->wqcfg, 0, idxd->wqcfg_size); 360 360 wq->type = IDXD_WQT_NONE; 361 - wq->size = 0; 362 - wq->group = NULL; 363 361 wq->threshold = 0; 364 362 wq->priority = 0; 365 363 wq->ats_dis = 0; ··· 367 369 memset(wq->name, 0, WQ_NAME_SIZE); 368 370 wq->max_xfer_bytes = WQ_DEFAULT_MAX_XFER; 369 371 wq->max_batch_size = WQ_DEFAULT_MAX_BATCH; 372 + } 373 + 374 + static void idxd_wq_device_reset_cleanup(struct idxd_wq *wq) 375 + { 376 + lockdep_assert_held(&wq->wq_lock); 377 + 378 + idxd_wq_disable_cleanup(wq); 379 + wq->size = 0; 380 + wq->group = NULL; 370 381 } 371 382 372 383 static void idxd_wq_ref_release(struct percpu_ref *ref) ··· 696 689 697 690 if (wq->state == IDXD_WQ_ENABLED) { 698 691 idxd_wq_disable_cleanup(wq); 692 + idxd_wq_device_reset_cleanup(wq); 699 693 wq->state = IDXD_WQ_DISABLED; 700 694 } 701 695 }