Skip to content

Commit ecec7c9

Browse files
Fenghua Yuvinodkoul
authored andcommitted
dmaengine: idxd: Remove shadow Event Log head stored in idxd
head is defined in idxd->evl as a shadow of head in the EVLSTATUS register. There are two issues related to the shadow head: 1. Mismatch between the shadow head and the state of the EVLSTATUS register: If Event Log is supported, upon completion of the Enable Device command, the Event Log head in the variable idxd->evl->head should be cleared to match the state of the EVLSTATUS register. But the variable is not reset currently, leading mismatch between the variable and the register state. The mismatch causes incorrect processing of Event Log entries. 2. Unnecessary shadow head definition: The shadow head is unnecessary as head can be read directly from the EVLSTATUS register. Reading head from the register incurs no additional cost because event log head and tail are always read together and tail is already read directly from the register as required by hardware. Remove the shadow Event Log head stored in idxd->evl to address the mentioned issues. Fixes: 244da66 ("dmaengine: idxd: setup event log configuration") Signed-off-by: Fenghua Yu <fenghua.yu@intel.com> Reviewed-by: Dave Jiang <dave.jiang@intel.com> Link: https://lore.kernel.org/r/20240215024931.1739621-1-fenghua.yu@intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent 9ba17de commit ecec7c9

File tree

4 files changed

+3
-5
lines changed

4 files changed

+3
-5
lines changed

drivers/dma/idxd/cdev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ static void idxd_cdev_evl_drain_pasid(struct idxd_wq *wq, u32 pasid)
345345
spin_lock(&evl->lock);
346346
status.bits = ioread64(idxd->reg_base + IDXD_EVLSTATUS_OFFSET);
347347
t = status.tail;
348-
h = evl->head;
348+
h = status.head;
349349
size = evl->size;
350350

351351
while (h != t) {

drivers/dma/idxd/debugfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ static int debugfs_evl_show(struct seq_file *s, void *d)
6868

6969
spin_lock(&evl->lock);
7070

71-
h = evl->head;
7271
evl_status.bits = ioread64(idxd->reg_base + IDXD_EVLSTATUS_OFFSET);
7372
t = evl_status.tail;
73+
h = evl_status.head;
7474
evl_size = evl->size;
7575

7676
seq_printf(s, "Event Log head %u tail %u interrupt pending %u\n\n",

drivers/dma/idxd/idxd.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,6 @@ struct idxd_evl {
300300
unsigned int log_size;
301301
/* The number of entries in the event log. */
302302
u16 size;
303-
u16 head;
304303
unsigned long *bmap;
305304
bool batch_fail[IDXD_MAX_BATCH_IDENT];
306305
};

drivers/dma/idxd/irq.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,9 +367,9 @@ static void process_evl_entries(struct idxd_device *idxd)
367367
/* Clear interrupt pending bit */
368368
iowrite32(evl_status.bits_upper32,
369369
idxd->reg_base + IDXD_EVLSTATUS_OFFSET + sizeof(u32));
370-
h = evl->head;
371370
evl_status.bits = ioread64(idxd->reg_base + IDXD_EVLSTATUS_OFFSET);
372371
t = evl_status.tail;
372+
h = evl_status.head;
373373
size = idxd->evl->size;
374374

375375
while (h != t) {
@@ -378,7 +378,6 @@ static void process_evl_entries(struct idxd_device *idxd)
378378
h = (h + 1) % size;
379379
}
380380

381-
evl->head = h;
382381
evl_status.head = h;
383382
iowrite32(evl_status.bits_lower32, idxd->reg_base + IDXD_EVLSTATUS_OFFSET);
384383
spin_unlock(&evl->lock);

0 commit comments

Comments
 (0)