Skip to contentSkip to conversation

ppc/pnv: Fix pervasive topology calculation for P10

PATCH In review Caleb Schlossin 2 participants 3 messages Feb 27, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 ppc/pnv: Fix pervasive topology calculation for P10

Pervasive topology(PIR) calculation for core, thread ID was wrong for big cores (SMT8). Fixing for P10.

Based on: <[email protected]>

---
 hw/ppc/pnv.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
hw/ppc/pnv.c +13 -2
index 2f53883916..aa5aba60b4 100644
@@ -1068,12 +1068,23 @@ static uint32_t pnv_chip_pir_p9(PnvChip *chip, uint32_t core_id,
     }
 }
 
+/*
+ *    0:48  Reserved - Read as zeroes
+ *   49:52  Node ID
+ *   53:55  Chip ID
+ *   56     Reserved - Read as zero
+ *   57:59  Quad ID
+ *   60     Core Chiplet Pair ID
+ *   61:63  Thread/Core Chiplet ID t0-t2
+ *
+ * We only care about the lower bits. uint32_t is fine for the moment.
+ */
 static uint32_t pnv_chip_pir_p10(PnvChip *chip, uint32_t core_id,
                                  uint32_t thread_id)
 {
     if (chip->nr_threads == 8) {
-        return (chip->chip_id << 8) | ((thread_id & 1) << 2) | (core_id << 3) |
-               (thread_id >> 1);
+        return (chip->chip_id << 8) | ((core_id / 4) << 4) |
+               ((core_id % 2) << 3) | thread_id;
     } else {
         return (chip->chip_id << 8) | (core_id << 2) | thread_id;
     }
Signature · 1 line
2.31.8
#1 lore raw

Hello Caleb,

Quoted 5 lines · Caleb Schlossin

Pervasive topology(PIR) calculation for core, thread ID was wrong for big cores (SMT8). Fixing for P10.

Based on: <[email protected]>

Since the initial patch [1] is not merged yet, you can simply send a v2 with the update. There is still some time before soft freeze [2].

The Subject of this patch [PATCH 2/2] seems to refer to a series. Is there a patch 1/2 ?

Thanks,

C.

[1] https://lore.kernel.org/all/[email protected]/
[2] https://wiki.qemu.org/Planning/9.0

Quoted 34 lines
---
  hw/ppc/pnv.c | 15 +++++++++++++--
  1 file changed, 13 insertions(+), 2 deletions(-)
hw/ppc/pnv.c +13 -2
index 2f53883916..aa5aba60b4 100644
@@ -1068,12 +1068,23 @@ static uint32_t pnv_chip_pir_p9(PnvChip *chip, uint32_t core_id,
      }
  }
 
+/*
+ *    0:48  Reserved - Read as zeroes
+ *   49:52  Node ID
+ *   53:55  Chip ID
+ *   56     Reserved - Read as zero
+ *   57:59  Quad ID
+ *   60     Core Chiplet Pair ID
+ *   61:63  Thread/Core Chiplet ID t0-t2
+ *
+ * We only care about the lower bits. uint32_t is fine for the moment.
+ */
  static uint32_t pnv_chip_pir_p10(PnvChip *chip, uint32_t core_id,
                                   uint32_t thread_id)
  {
      if (chip->nr_threads == 8) {
-        return (chip->chip_id << 8) | ((thread_id & 1) << 2) | (core_id << 3) |
-               (thread_id >> 1);
+        return (chip->chip_id << 8) | ((core_id / 4) << 4) |
+               ((core_id % 2) << 3) | thread_id;
      } else {
          return (chip->chip_id << 8) | (core_id << 2) | thread_id;
      }
#2 lore raw

Cedric,

I'll resend both patches, so this new patch shows up properly as [PATCH 2/2].

Thanks,
Caleb

Quoted 58 lines · Cédric Le Goater

Hello Caleb,

Quoted 5 lines · Caleb Schlossin

Pervasive topology(PIR) calculation for core, thread ID was wrong for big cores (SMT8). Fixing for P10.

Based on: <[email protected]>

Since the initial patch [1] is not merged yet, you can simply send a v2 with the update. There is still some time before soft freeze [2].

The Subject of this patch [PATCH 2/2] seems to refer to a series. Is there a patch 1/2 ?

Thanks,

C.

[1] https://lore.kernel.org/all/[email protected]/
[2] https://wiki.qemu.org/Planning/9.0

Quoted 33 lines

---
  hw/ppc/pnv.c | 15 +++++++++++++--

  1 file changed, 13 insertions(+), 2 deletions(-)
hw/ppc/pnv.c +0 -0
index 2f53883916..aa5aba60b4 100644
@@ -1068,12 +1068,23 @@ static uint32_t pnv_chip_pir_p9(PnvChip *chip, uint32_t core_id,
       }
   }

  +/*
+ *    0:48  Reserved - Read as zeroes
+ *   49:52  Node ID
+ *   53:55  Chip ID
+ *   56     Reserved - Read as zero
+ *   57:59  Quad ID
+ *   60     Core Chiplet Pair ID
+ *   61:63  Thread/Core Chiplet ID t0-t2
+ *
+ * We only care about the lower bits. uint32_t is fine for the moment.
+ */
  static uint32_t pnv_chip_pir_p10(PnvChip *chip, uint32_t core_id, uint32_t thread_id)
  {
      if (chip->nr_threads == 8) {
-        return (chip->chip_id << 8) | ((thread_id & 1) << 2) | (core_id << 3) | -               (thread_id >> 1);
+        return (chip->chip_id << 8) | ((core_id / 4) << 4) |
+               ((core_id % 2) << 3) | thread_id;
      } else {
          return (chip->chip_id << 8) | (core_id << 2) | thread_id; }