Skip to content

Commit 22bd0df

Browse files
davejiangvinodkoul
authored andcommitted
dmaengine: idxd: convert ats_dis to a wq flag
Make wq attributes access consistent. Convert ats_dis to wq flag WQ_FLAG_ATS_DISABLE. Signed-off-by: Dave Jiang <[email protected]> Co-developed-by: Fenghua Yu <[email protected]> Signed-off-by: Fenghua Yu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 898ec89 commit 22bd0df

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

drivers/dma/idxd/device.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,10 +384,10 @@ static void idxd_wq_disable_cleanup(struct idxd_wq *wq)
384384
wq->type = IDXD_WQT_NONE;
385385
wq->threshold = 0;
386386
wq->priority = 0;
387-
wq->ats_dis = 0;
388387
wq->enqcmds_retries = IDXD_ENQCMDS_RETRIES;
389388
clear_bit(WQ_FLAG_DEDICATED, &wq->flags);
390389
clear_bit(WQ_FLAG_BLOCK_ON_FAULT, &wq->flags);
390+
clear_bit(WQ_FLAG_ATS_DISABLE, &wq->flags);
391391
memset(wq->name, 0, WQ_NAME_SIZE);
392392
wq->max_xfer_bytes = WQ_DEFAULT_MAX_XFER;
393393
wq->max_batch_size = WQ_DEFAULT_MAX_BATCH;
@@ -861,7 +861,7 @@ static int idxd_wq_config_write(struct idxd_wq *wq)
861861
wq->wqcfg->bof = 1;
862862

863863
if (idxd->hw.wq_cap.wq_ats_support)
864-
wq->wqcfg->wq_ats_disable = wq->ats_dis;
864+
wq->wqcfg->wq_ats_disable = test_bit(WQ_FLAG_ATS_DISABLE, &wq->flags);
865865

866866
/* bytes 12-15 */
867867
wq->wqcfg->max_xfer_shift = ilog2(wq->max_xfer_bytes);

drivers/dma/idxd/idxd.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ enum idxd_wq_state {
133133
enum idxd_wq_flag {
134134
WQ_FLAG_DEDICATED = 0,
135135
WQ_FLAG_BLOCK_ON_FAULT,
136+
WQ_FLAG_ATS_DISABLE,
136137
};
137138

138139
enum idxd_wq_type {
@@ -209,7 +210,6 @@ struct idxd_wq {
209210
char name[WQ_NAME_SIZE + 1];
210211
u64 max_xfer_bytes;
211212
u32 max_batch_size;
212-
bool ats_dis;
213213
};
214214

215215
struct idxd_engine {

drivers/dma/idxd/sysfs.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -973,7 +973,7 @@ static ssize_t wq_ats_disable_show(struct device *dev, struct device_attribute *
973973
{
974974
struct idxd_wq *wq = confdev_to_wq(dev);
975975

976-
return sysfs_emit(buf, "%u\n", wq->ats_dis);
976+
return sysfs_emit(buf, "%u\n", test_bit(WQ_FLAG_ATS_DISABLE, &wq->flags));
977977
}
978978

979979
static ssize_t wq_ats_disable_store(struct device *dev, struct device_attribute *attr,
@@ -994,7 +994,10 @@ static ssize_t wq_ats_disable_store(struct device *dev, struct device_attribute
994994
if (rc < 0)
995995
return rc;
996996

997-
wq->ats_dis = ats_dis;
997+
if (ats_dis)
998+
set_bit(WQ_FLAG_ATS_DISABLE, &wq->flags);
999+
else
1000+
clear_bit(WQ_FLAG_ATS_DISABLE, &wq->flags);
9981001

9991002
return count;
10001003
}

0 commit comments

Comments
 (0)