Skip to contentSkip to conversation

pnv/xive2: Don't overwrite PC registers when writing TCTXT registers

PATCH Applied Frederic Barrat 3 participants 3 messages May 23, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pnv/xive2: Don't overwrite PC registers when writing TCTXT registers

When writing a register from the TCTXT memory region (4th page within the IC BAR), we were overwriting the Presentation Controller (PC) register at the same offset. It looks like a silly cut and paste error.

We were somehow lucky: the TCTXT registers being touched are TCTXT_ENx/_SET/_RESET to enable physical threads and the PC registers at the same offset are either not used by our model or the update was harmless.

Found through code inspection.

---
 hw/intc/pnv_xive2.c | 3 ---
 1 file changed, 3 deletions(-)
hw/intc/pnv_xive2.c +0 -3
index 87303b4064..a39e070e82 100644
@@ -1295,7 +1295,6 @@ static void pnv_xive2_ic_tctxt_write(void *opaque, hwaddr offset,
                                      uint64_t val, unsigned size)
 {
     PnvXive2 *xive = PNV_XIVE2(opaque);
-    uint32_t reg = offset >> 3;
 
     switch (offset) {
     /*
@@ -1322,8 +1321,6 @@ static void pnv_xive2_ic_tctxt_write(void *opaque, hwaddr offset,
         xive2_error(xive, "TCTXT: invalid write @%"HWADDR_PRIx, offset);
         return;
     }
-
-    xive->pc_regs[reg] = val;
 }
 
 static const MemoryRegionOps pnv_xive2_ic_tctxt_ops = {
Signature · 1 line
2.35.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Frederic Barrat

When writing a register from the TCTXT memory region (4th page within the IC BAR), we were overwriting the Presentation Controller (PC) register at the same offset. It looks like a silly cut and paste error.

Very silly indeed :)

Quoted 8 lines

We were somehow lucky: the TCTXT registers being touched are TCTXT_ENx/_SET/_RESET to enable physical threads and the PC registers at the same offset are either not used by our model or the update was harmless.

Found through code inspection.

Thanks,

C.

Quoted 25 lines
---
  hw/intc/pnv_xive2.c | 3 ---
  1 file changed, 3 deletions(-)
hw/intc/pnv_xive2.c +0 -3
index 87303b4064..a39e070e82 100644
@@ -1295,7 +1295,6 @@ static void pnv_xive2_ic_tctxt_write(void *opaque, hwaddr offset,
                                       uint64_t val, unsigned size)
  {
      PnvXive2 *xive = PNV_XIVE2(opaque);
-    uint32_t reg = offset >> 3;
 
      switch (offset) {
      /*
@@ -1322,8 +1321,6 @@ static void pnv_xive2_ic_tctxt_write(void *opaque, hwaddr offset,
          xive2_error(xive, "TCTXT: invalid write @%"HWADDR_PRIx, offset);
          return;
      }
-
-    xive->pc_regs[reg] = val;
  }
 
  static const MemoryRegionOps pnv_xive2_ic_tctxt_ops = {
#2 lore raw
In reply to Frederic Barrat

Queued in gitlab.com/danielhb/qemu/tree/ppc-next. Thanks,

Daniel

Quoted 38 lines · Frederic Barrat

When writing a register from the TCTXT memory region (4th page within the IC BAR), we were overwriting the Presentation Controller (PC) register at the same offset. It looks like a silly cut and paste error.

We were somehow lucky: the TCTXT registers being touched are TCTXT_ENx/_SET/_RESET to enable physical threads and the PC registers at the same offset are either not used by our model or the update was harmless.

Found through code inspection.

---
  hw/intc/pnv_xive2.c | 3 ---
  1 file changed, 3 deletions(-)
hw/intc/pnv_xive2.c +0 -3
index 87303b4064..a39e070e82 100644
@@ -1295,7 +1295,6 @@ static void pnv_xive2_ic_tctxt_write(void *opaque, hwaddr offset,
                                       uint64_t val, unsigned size)
  {
      PnvXive2 *xive = PNV_XIVE2(opaque);
-    uint32_t reg = offset >> 3;
 
      switch (offset) {
      /*
@@ -1322,8 +1321,6 @@ static void pnv_xive2_ic_tctxt_write(void *opaque, hwaddr offset,
          xive2_error(xive, "TCTXT: invalid write @%"HWADDR_PRIx, offset);
          return;
      }
-
-    xive->pc_regs[reg] = val;
  }
 
  static const MemoryRegionOps pnv_xive2_ic_tctxt_ops = {