Commit ecec7c9f authored by Fenghua Yu's avatar Fenghua Yu Committed by Vinod Koul

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: 244da66c ("dmaengine: idxd: setup event log configuration")
Signed-off-by: default avatarFenghua Yu <fenghua.yu@intel.com>
Reviewed-by: default avatarDave Jiang <dave.jiang@intel.com>
Link: https://lore.kernel.org/r/20240215024931.1739621-1-fenghua.yu@intel.comSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent 9ba17def
...@@ -345,7 +345,7 @@ static void idxd_cdev_evl_drain_pasid(struct idxd_wq *wq, u32 pasid) ...@@ -345,7 +345,7 @@ static void idxd_cdev_evl_drain_pasid(struct idxd_wq *wq, u32 pasid)
spin_lock(&evl->lock); spin_lock(&evl->lock);
status.bits = ioread64(idxd->reg_base + IDXD_EVLSTATUS_OFFSET); status.bits = ioread64(idxd->reg_base + IDXD_EVLSTATUS_OFFSET);
t = status.tail; t = status.tail;
h = evl->head; h = status.head;
size = evl->size; size = evl->size;
while (h != t) { while (h != t) {
......
...@@ -68,9 +68,9 @@ static int debugfs_evl_show(struct seq_file *s, void *d) ...@@ -68,9 +68,9 @@ static int debugfs_evl_show(struct seq_file *s, void *d)
spin_lock(&evl->lock); spin_lock(&evl->lock);
h = evl->head;
evl_status.bits = ioread64(idxd->reg_base + IDXD_EVLSTATUS_OFFSET); evl_status.bits = ioread64(idxd->reg_base + IDXD_EVLSTATUS_OFFSET);
t = evl_status.tail; t = evl_status.tail;
h = evl_status.head;
evl_size = evl->size; evl_size = evl->size;
seq_printf(s, "Event Log head %u tail %u interrupt pending %u\n\n", seq_printf(s, "Event Log head %u tail %u interrupt pending %u\n\n",
......
...@@ -300,7 +300,6 @@ struct idxd_evl { ...@@ -300,7 +300,6 @@ struct idxd_evl {
unsigned int log_size; unsigned int log_size;
/* The number of entries in the event log. */ /* The number of entries in the event log. */
u16 size; u16 size;
u16 head;
unsigned long *bmap; unsigned long *bmap;
bool batch_fail[IDXD_MAX_BATCH_IDENT]; bool batch_fail[IDXD_MAX_BATCH_IDENT];
}; };
......
...@@ -367,9 +367,9 @@ static void process_evl_entries(struct idxd_device *idxd) ...@@ -367,9 +367,9 @@ static void process_evl_entries(struct idxd_device *idxd)
/* Clear interrupt pending bit */ /* Clear interrupt pending bit */
iowrite32(evl_status.bits_upper32, iowrite32(evl_status.bits_upper32,
idxd->reg_base + IDXD_EVLSTATUS_OFFSET + sizeof(u32)); idxd->reg_base + IDXD_EVLSTATUS_OFFSET + sizeof(u32));
h = evl->head;
evl_status.bits = ioread64(idxd->reg_base + IDXD_EVLSTATUS_OFFSET); evl_status.bits = ioread64(idxd->reg_base + IDXD_EVLSTATUS_OFFSET);
t = evl_status.tail; t = evl_status.tail;
h = evl_status.head;
size = idxd->evl->size; size = idxd->evl->size;
while (h != t) { while (h != t) {
...@@ -378,7 +378,6 @@ static void process_evl_entries(struct idxd_device *idxd) ...@@ -378,7 +378,6 @@ static void process_evl_entries(struct idxd_device *idxd)
h = (h + 1) % size; h = (h + 1) % size;
} }
evl->head = h;
evl_status.head = h; evl_status.head = h;
iowrite32(evl_status.bits_lower32, idxd->reg_base + IDXD_EVLSTATUS_OFFSET); iowrite32(evl_status.bits_lower32, idxd->reg_base + IDXD_EVLSTATUS_OFFSET);
spin_unlock(&evl->lock); spin_unlock(&evl->lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment