Skip to contentSkip to conversation

ppc/pnv: Extend "quad" model for p10

PATCH Superseded Joel Stanley 5 participants 15 messages Jun 30, 2023 – Jul 1, 2023

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover ppc/pnv: Extend "quad" model for p10

The quad model implements the EC xscoms for the p9 machine, reusing the same model for p10 which isn't quite correct. This series adds a PnvQuad class and subclasses it for P9 and P10. Implement the core thread state xscom as an example. I expect more function to be implemented in future patches.

There's one outstanding question. Skiboot has this for the p10 scom:

#define P10_EC_CORE_THREAD_STATE 0x412

However the read that comes is for 0x28412. I suspect the upper 0x28000 are addressing bits, so we're really reporting the core thread state for the given core. Should the model instead wired so one is created for each chiplet? Or should we report the value for all possible cores, like the P9 code does for P9X_EX_NCU_SPEC_BAR?

    switch (offset) {
    case P9X_EX_NCU_SPEC_BAR:
    case P9X_EX_NCU_SPEC_BAR + 0x400: /* Second EX */

Joel Stanley (4):
ppc/pnv: quad xscom callbacks are P9 specific ppc/pnv: Subclass quad xscom callbacks ppc/pnv: Add P10 quad ops
ppc/pnv: Return zero for core thread state xscom

 include/hw/ppc/pnv_core.h |  12 +++-
 hw/ppc/pnv.c              |  11 ++--
 hw/ppc/pnv_core.c         | 114 +++++++++++++++++++++++++++++++-------
 3 files changed, 113 insertions(+), 24 deletions(-)
Signature · 1 line
2.40.1
#1 lore raw

PATCH 1/4 ppc/pnv: quad xscom callbacks are P9 specific

Rename the to include P9 in the name in preparation for adding P10 versions.

---
 hw/ppc/pnv_core.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
hw/ppc/pnv_core.c +9 -8
index 0bc3ad41c81c..0b1c3cccfebc 100644
@@ -360,8 +360,8 @@ DEFINE_TYPES(pnv_core_infos)
 
 #define P9X_EX_NCU_SPEC_BAR                     0x11010
 
-static uint64_t pnv_quad_xscom_read(void *opaque, hwaddr addr,
-                                    unsigned int width)
+static uint64_t pnv_quad_power9_xscom_read(void *opaque, hwaddr addr,
+                                           unsigned int width)
 {
     uint32_t offset = addr >> 3;
     uint64_t val = -1;
@@ -379,8 +379,8 @@ static uint64_t pnv_quad_xscom_read(void *opaque, hwaddr addr,
     return val;
 }
 
-static void pnv_quad_xscom_write(void *opaque, hwaddr addr, uint64_t val,
-                                 unsigned int width)
+static void pnv_quad_power9_xscom_write(void *opaque, hwaddr addr, uint64_t val,
+                                        unsigned int width)
 {
     uint32_t offset = addr >> 3;
 
@@ -394,9 +394,9 @@ static void pnv_quad_xscom_write(void *opaque, hwaddr addr, uint64_t val,
     }
 }
 
-static const MemoryRegionOps pnv_quad_xscom_ops = {
-    .read = pnv_quad_xscom_read,
-    .write = pnv_quad_xscom_write,
+static const MemoryRegionOps pnv_quad_power9_xscom_ops = {
+    .read = pnv_quad_power9_xscom_read,
+    .write = pnv_quad_power9_xscom_write,
     .valid.min_access_size = 8,
     .valid.max_access_size = 8,
     .impl.min_access_size = 8,
@@ -410,7 +410,8 @@ static void pnv_quad_realize(DeviceState *dev, Error **errp)
     char name[32];
 
     snprintf(name, sizeof(name), "xscom-quad.%d", eq->quad_id);
-    pnv_xscom_region_init(&eq->xscom_regs, OBJECT(dev), &pnv_quad_xscom_ops,
+    pnv_xscom_region_init(&eq->xscom_regs, OBJECT(dev),
+                          &pnv_quad_power9_xscom_ops,
                           eq, name, PNV9_XSCOM_EQ_SIZE);
 }
 
Signature · 1 line
2.40.1
Reviewed-by on v1 1/4
#2 lore raw

Re: [PATCH 1/4] ppc/pnv: quad xscom callbacks are P9 specific

Quoted 4 lines · Joel Stanley

Rename the to include P9 in the name in preparation for adding P10 versions.

Thanks,

C.

Quoted 53 lines
---
  hw/ppc/pnv_core.c | 17 +++++++++--------
  1 file changed, 9 insertions(+), 8 deletions(-)
hw/ppc/pnv_core.c +9 -8
index 0bc3ad41c81c..0b1c3cccfebc 100644
@@ -360,8 +360,8 @@ DEFINE_TYPES(pnv_core_infos)
 
  #define P9X_EX_NCU_SPEC_BAR                     0x11010
 
-static uint64_t pnv_quad_xscom_read(void *opaque, hwaddr addr,
-                                    unsigned int width)
+static uint64_t pnv_quad_power9_xscom_read(void *opaque, hwaddr addr,
+                                           unsigned int width)
  {
      uint32_t offset = addr >> 3;
      uint64_t val = -1;
@@ -379,8 +379,8 @@ static uint64_t pnv_quad_xscom_read(void *opaque, hwaddr addr,
      return val;
  }
 
-static void pnv_quad_xscom_write(void *opaque, hwaddr addr, uint64_t val,
-                                 unsigned int width)
+static void pnv_quad_power9_xscom_write(void *opaque, hwaddr addr, uint64_t val,
+                                        unsigned int width)
  {
      uint32_t offset = addr >> 3;
 
@@ -394,9 +394,9 @@ static void pnv_quad_xscom_write(void *opaque, hwaddr addr, uint64_t val,
      }
  }
 
-static const MemoryRegionOps pnv_quad_xscom_ops = {
-    .read = pnv_quad_xscom_read,
-    .write = pnv_quad_xscom_write,
+static const MemoryRegionOps pnv_quad_power9_xscom_ops = {
+    .read = pnv_quad_power9_xscom_read,
+    .write = pnv_quad_power9_xscom_write,
      .valid.min_access_size = 8,
      .valid.max_access_size = 8,
      .impl.min_access_size = 8,
@@ -410,7 +410,8 @@ static void pnv_quad_realize(DeviceState *dev, Error **errp)
      char name[32];
 
      snprintf(name, sizeof(name), "xscom-quad.%d", eq->quad_id);
-    pnv_xscom_region_init(&eq->xscom_regs, OBJECT(dev), &pnv_quad_xscom_ops,
+    pnv_xscom_region_init(&eq->xscom_regs, OBJECT(dev),
+                          &pnv_quad_power9_xscom_ops,
                            eq, name, PNV9_XSCOM_EQ_SIZE);
  }
 
#3 lore raw

PATCH 2/4 ppc/pnv: Subclass quad xscom callbacks

In reply to Joel Stanley

Make the existing pnv_quad_xscom_read/write be P9 specific, in preparation for a different P10 callback.

---
 include/hw/ppc/pnv_core.h | 12 +++++++++++-
 hw/ppc/pnv.c              | 11 +++++++----
 hw/ppc/pnv_core.c         | 36 ++++++++++++++++++++++++------------
 3 files changed, 42 insertions(+), 17 deletions(-)
include/hw/ppc/pnv_core.h +11 -1
index 3d75706e95da..ab3f6d6c2843 100644
@@ -60,8 +60,18 @@ static inline PnvCPUState *pnv_cpu_state(PowerPCCPU *cpu)
     return (PnvCPUState *)cpu->machine_data;
 }
 
+struct PnvQuadClass {
+    DeviceClass parent_class;
+
+    const MemoryRegionOps *xscom_ops;
+};
+
 #define TYPE_PNV_QUAD "powernv-cpu-quad"
-OBJECT_DECLARE_SIMPLE_TYPE(PnvQuad, PNV_QUAD)
+
+#define PNV_QUAD_TYPE_SUFFIX "-" TYPE_PNV_QUAD
+#define PNV_QUAD_TYPE_NAME(cpu_model) cpu_model PNV_QUAD_TYPE_SUFFIX
+
+OBJECT_DECLARE_TYPE(PnvQuad, PnvQuadClass, PNV_QUAD)
 
 struct PnvQuad {
     DeviceState parent_obj;
hw/ppc/pnv.c +7 -4
index fc083173f346..c77fdb6747a4 100644
@@ -1429,14 +1429,15 @@ static void pnv_chip_power9_instance_init(Object *obj)
 }
 
 static void pnv_chip_quad_realize_one(PnvChip *chip, PnvQuad *eq,
-                                      PnvCore *pnv_core)
+                                      PnvCore *pnv_core,
+                                      const char *type)
 {
     char eq_name[32];
     int core_id = CPU_CORE(pnv_core)->core_id;
 
     snprintf(eq_name, sizeof(eq_name), "eq[%d]", core_id);
     object_initialize_child_with_props(OBJECT(chip), eq_name, eq,
-                                       sizeof(*eq), TYPE_PNV_QUAD,
+                                       sizeof(*eq), type,
                                        &error_fatal, NULL);
 
     object_property_set_int(OBJECT(eq), "quad-id", core_id, &error_fatal);
@@ -1454,7 +1455,8 @@ static void pnv_chip_quad_realize(Pnv9Chip *chip9, Error **errp)
     for (i = 0; i < chip9->nr_quads; i++) {
         PnvQuad *eq = &chip9->quads[i];
 
-        pnv_chip_quad_realize_one(chip, eq, chip->cores[i * 4]);
+        pnv_chip_quad_realize_one(chip, eq, chip->cores[i * 4],
+                                  PNV_QUAD_TYPE_NAME("power9"));
 
         pnv_xscom_add_subregion(chip, PNV9_XSCOM_EQ_BASE(eq->quad_id),
                                 &eq->xscom_regs);
@@ -1666,7 +1668,8 @@ static void pnv_chip_power10_quad_realize(Pnv10Chip *chip10, Error **errp)
     for (i = 0; i < chip10->nr_quads; i++) {
         PnvQuad *eq = &chip10->quads[i];
 
-        pnv_chip_quad_realize_one(chip, eq, chip->cores[i * 4]);
+        pnv_chip_quad_realize_one(chip, eq, chip->cores[i * 4],
+                                  PNV_QUAD_TYPE_NAME("power9"));
 
         pnv_xscom_add_subregion(chip, PNV10_XSCOM_EQ_BASE(eq->quad_id),
                                 &eq->xscom_regs);
hw/ppc/pnv_core.c +24 -12
index 0b1c3cccfebc..b9a57463aec4 100644
@@ -407,11 +407,12 @@ static const MemoryRegionOps pnv_quad_power9_xscom_ops = {
 static void pnv_quad_realize(DeviceState *dev, Error **errp)
 {
     PnvQuad *eq = PNV_QUAD(dev);
+    PnvQuadClass *pqc = PNV_QUAD_GET_CLASS(eq);
     char name[32];
 
     snprintf(name, sizeof(name), "xscom-quad.%d", eq->quad_id);
     pnv_xscom_region_init(&eq->xscom_regs, OBJECT(dev),
-                          &pnv_quad_power9_xscom_ops,
+                          pqc->xscom_ops,
                           eq, name, PNV9_XSCOM_EQ_SIZE);
 }
 
@@ -420,6 +421,13 @@ static Property pnv_quad_properties[] = {
     DEFINE_PROP_END_OF_LIST(),
 };
 
+static void pnv_quad_power9_class_init(ObjectClass *oc, void *data)
+{
+    PnvQuadClass *pqc = PNV_QUAD_CLASS(oc);
+
+    pqc->xscom_ops = &pnv_quad_power9_xscom_ops;
+}
+
 static void pnv_quad_class_init(ObjectClass *oc, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(oc);
@@ -429,16 +437,20 @@ static void pnv_quad_class_init(ObjectClass *oc, void *data)
     dc->user_creatable = false;
 }
 
-static const TypeInfo pnv_quad_info = {
-    .name          = TYPE_PNV_QUAD,
-    .parent        = TYPE_DEVICE,
-    .instance_size = sizeof(PnvQuad),
-    .class_init    = pnv_quad_class_init,
+static const TypeInfo pnv_quad_infos[] = {
+    {
+        .name          = TYPE_PNV_QUAD,
+        .parent        = TYPE_DEVICE,
+        .instance_size = sizeof(PnvQuad),
+        .class_size    = sizeof(PnvQuadClass),
+        .class_init    = pnv_quad_class_init,
+        .abstract      = true,
+    },
+    {
+        .parent = TYPE_PNV_QUAD,
+        .name = PNV_QUAD_TYPE_NAME("power9"),
+        .class_init = pnv_quad_power9_class_init,
+    },
 };
 
-static void pnv_core_register_types(void)
-{
-    type_register_static(&pnv_quad_info);
-}
-
-type_init(pnv_core_register_types)
+DEFINE_TYPES(pnv_quad_infos);
Signature · 1 line
2.40.1
Reviewed-by on v1 2/4
#4 lore raw

Re: [PATCH 2/4] ppc/pnv: Subclass quad xscom callbacks

Quoted 4 lines · Joel Stanley

Make the existing pnv_quad_xscom_read/write be P9 specific, in preparation for a different P10 callback.

Thanks,

C.

Quoted 136 lines
---
  include/hw/ppc/pnv_core.h | 12 +++++++++++-
  hw/ppc/pnv.c              | 11 +++++++----
  hw/ppc/pnv_core.c         | 36 ++++++++++++++++++++++++------------
  3 files changed, 42 insertions(+), 17 deletions(-)
include/hw/ppc/pnv_core.h +11 -1
index 3d75706e95da..ab3f6d6c2843 100644
@@ -60,8 +60,18 @@ static inline PnvCPUState *pnv_cpu_state(PowerPCCPU *cpu)
      return (PnvCPUState *)cpu->machine_data;
  }
 
+struct PnvQuadClass {
+    DeviceClass parent_class;
+
+    const MemoryRegionOps *xscom_ops;
+};
+
  #define TYPE_PNV_QUAD "powernv-cpu-quad"
-OBJECT_DECLARE_SIMPLE_TYPE(PnvQuad, PNV_QUAD)
+
+#define PNV_QUAD_TYPE_SUFFIX "-" TYPE_PNV_QUAD
+#define PNV_QUAD_TYPE_NAME(cpu_model) cpu_model PNV_QUAD_TYPE_SUFFIX
+
+OBJECT_DECLARE_TYPE(PnvQuad, PnvQuadClass, PNV_QUAD)
 
  struct PnvQuad {
      DeviceState parent_obj;
hw/ppc/pnv.c +7 -4
index fc083173f346..c77fdb6747a4 100644
@@ -1429,14 +1429,15 @@ static void pnv_chip_power9_instance_init(Object *obj)
  }
 
  static void pnv_chip_quad_realize_one(PnvChip *chip, PnvQuad *eq,
-                                      PnvCore *pnv_core)
+                                      PnvCore *pnv_core,
+                                      const char *type)
  {
      char eq_name[32];
      int core_id = CPU_CORE(pnv_core)->core_id;
 
      snprintf(eq_name, sizeof(eq_name), "eq[%d]", core_id);
      object_initialize_child_with_props(OBJECT(chip), eq_name, eq,
-                                       sizeof(*eq), TYPE_PNV_QUAD,
+                                       sizeof(*eq), type,
                                         &error_fatal, NULL);
 
      object_property_set_int(OBJECT(eq), "quad-id", core_id, &error_fatal);
@@ -1454,7 +1455,8 @@ static void pnv_chip_quad_realize(Pnv9Chip *chip9, Error **errp)
      for (i = 0; i < chip9->nr_quads; i++) {
          PnvQuad *eq = &chip9->quads[i];
 
-        pnv_chip_quad_realize_one(chip, eq, chip->cores[i * 4]);
+        pnv_chip_quad_realize_one(chip, eq, chip->cores[i * 4],
+                                  PNV_QUAD_TYPE_NAME("power9"));
 
          pnv_xscom_add_subregion(chip, PNV9_XSCOM_EQ_BASE(eq->quad_id),
                                  &eq->xscom_regs);
@@ -1666,7 +1668,8 @@ static void pnv_chip_power10_quad_realize(Pnv10Chip *chip10, Error **errp)
      for (i = 0; i < chip10->nr_quads; i++) {
          PnvQuad *eq = &chip10->quads[i];
 
-        pnv_chip_quad_realize_one(chip, eq, chip->cores[i * 4]);
+        pnv_chip_quad_realize_one(chip, eq, chip->cores[i * 4],
+                                  PNV_QUAD_TYPE_NAME("power9"));
 
          pnv_xscom_add_subregion(chip, PNV10_XSCOM_EQ_BASE(eq->quad_id),
                                  &eq->xscom_regs);
hw/ppc/pnv_core.c +24 -12
index 0b1c3cccfebc..b9a57463aec4 100644
@@ -407,11 +407,12 @@ static const MemoryRegionOps pnv_quad_power9_xscom_ops = {
  static void pnv_quad_realize(DeviceState *dev, Error **errp)
  {
      PnvQuad *eq = PNV_QUAD(dev);
+    PnvQuadClass *pqc = PNV_QUAD_GET_CLASS(eq);
      char name[32];
 
      snprintf(name, sizeof(name), "xscom-quad.%d", eq->quad_id);
      pnv_xscom_region_init(&eq->xscom_regs, OBJECT(dev),
-                          &pnv_quad_power9_xscom_ops,
+                          pqc->xscom_ops,
                            eq, name, PNV9_XSCOM_EQ_SIZE);
  }
 
@@ -420,6 +421,13 @@ static Property pnv_quad_properties[] = {
      DEFINE_PROP_END_OF_LIST(),
  };
 
+static void pnv_quad_power9_class_init(ObjectClass *oc, void *data)
+{
+    PnvQuadClass *pqc = PNV_QUAD_CLASS(oc);
+
+    pqc->xscom_ops = &pnv_quad_power9_xscom_ops;
+}
+
  static void pnv_quad_class_init(ObjectClass *oc, void *data)
  {
      DeviceClass *dc = DEVICE_CLASS(oc);
@@ -429,16 +437,20 @@ static void pnv_quad_class_init(ObjectClass *oc, void *data)
      dc->user_creatable = false;
  }
 
-static const TypeInfo pnv_quad_info = {
-    .name          = TYPE_PNV_QUAD,
-    .parent        = TYPE_DEVICE,
-    .instance_size = sizeof(PnvQuad),
-    .class_init    = pnv_quad_class_init,
+static const TypeInfo pnv_quad_infos[] = {
+    {
+        .name          = TYPE_PNV_QUAD,
+        .parent        = TYPE_DEVICE,
+        .instance_size = sizeof(PnvQuad),
+        .class_size    = sizeof(PnvQuadClass),
+        .class_init    = pnv_quad_class_init,
+        .abstract      = true,
+    },
+    {
+        .parent = TYPE_PNV_QUAD,
+        .name = PNV_QUAD_TYPE_NAME("power9"),
+        .class_init = pnv_quad_power9_class_init,
+    },
  };
 
-static void pnv_core_register_types(void)
-{
-    type_register_static(&pnv_quad_info);
-}
-
-type_init(pnv_core_register_types)
+DEFINE_TYPES(pnv_quad_infos);
#5 lore raw

PATCH 3/4 ppc/pnv: Add P10 quad ops

In reply to Joel Stanley

Add a PnvQuad class for the P10 powernv machine. No xscoms are implemented yet, but this allows them to be added.

---
 hw/ppc/pnv.c      |  2 +-
 hw/ppc/pnv_core.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+), 1 deletion(-)
hw/ppc/pnv.c +1 -1
index c77fdb6747a4..5f25fe985ab2 100644
@@ -1669,7 +1669,7 @@ static void pnv_chip_power10_quad_realize(Pnv10Chip *chip10, Error **errp)
         PnvQuad *eq = &chip10->quads[i];
 
         pnv_chip_quad_realize_one(chip, eq, chip->cores[i * 4],
-                                  PNV_QUAD_TYPE_NAME("power9"));
+                                  PNV_QUAD_TYPE_NAME("power10"));
 
         pnv_xscom_add_subregion(chip, PNV10_XSCOM_EQ_BASE(eq->quad_id),
                                 &eq->xscom_regs);
hw/ppc/pnv_core.c +53 -0

71 lines not on this page · raw message

Signature · 1 line
2.40.1
Reviewed-by on v1 3/4
#6 lore raw

Re: [PATCH 3/4] ppc/pnv: Add P10 quad ops

Quoted 4 lines · Joel Stanley

Add a PnvQuad class for the P10 powernv machine. No xscoms are implemented yet, but this allows them to be added.

Thanks,

C.

Quoted 96 lines
---
  hw/ppc/pnv.c      |  2 +-
  hw/ppc/pnv_core.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++
  2 files changed, 54 insertions(+), 1 deletion(-)
hw/ppc/pnv.c +1 -1
index c77fdb6747a4..5f25fe985ab2 100644
@@ -1669,7 +1669,7 @@ static void pnv_chip_power10_quad_realize(Pnv10Chip *chip10, Error **errp)
          PnvQuad *eq = &chip10->quads[i];
 
          pnv_chip_quad_realize_one(chip, eq, chip->cores[i * 4],
-                                  PNV_QUAD_TYPE_NAME("power9"));
+                                  PNV_QUAD_TYPE_NAME("power10"));
 
          pnv_xscom_add_subregion(chip, PNV10_XSCOM_EQ_BASE(eq->quad_id),
                                  &eq->xscom_regs);
hw/ppc/pnv_core.c +53 -0
index b9a57463aec4..7fff2fd9e298 100644
@@ -404,6 +404,47 @@ static const MemoryRegionOps pnv_quad_power9_xscom_ops = {
      .endianness = DEVICE_BIG_ENDIAN,
  };
 
+/*
+ * POWER10 Quads
+ */
+
+static uint64_t pnv_quad_power10_xscom_read(void *opaque, hwaddr addr,
+                                            unsigned int width)
+{
+    uint32_t offset = addr >> 3;
+    uint64_t val = -1;
+
+    switch (offset) {
+    default:
+        qemu_log_mask(LOG_UNIMP, "%s: writing @0x%08x\n", __func__,
+                      offset);
+    }
+
+    return val;
+}
+
+static void pnv_quad_power10_xscom_write(void *opaque, hwaddr addr, uint64_t val,
+                                         unsigned int width)
+{
+    uint32_t offset = addr >> 3;
+
+    switch (offset) {
+    default:
+        qemu_log_mask(LOG_UNIMP, "%s: writing @0x%08x\n", __func__,
+                  offset);
+    }
+}
+
+static const MemoryRegionOps pnv_quad_power10_xscom_ops = {
+    .read = pnv_quad_power10_xscom_read,
+    .write = pnv_quad_power10_xscom_write,
+    .valid.min_access_size = 8,
+    .valid.max_access_size = 8,
+    .impl.min_access_size = 8,
+    .impl.max_access_size = 8,
+    .endianness = DEVICE_BIG_ENDIAN,
+};
+
  static void pnv_quad_realize(DeviceState *dev, Error **errp)
  {
      PnvQuad *eq = PNV_QUAD(dev);
@@ -428,6 +469,13 @@ static void pnv_quad_power9_class_init(ObjectClass *oc, void *data)
      pqc->xscom_ops = &pnv_quad_power9_xscom_ops;
  }
 
+static void pnv_quad_power10_class_init(ObjectClass *oc, void *data)
+{
+    PnvQuadClass *pqc = PNV_QUAD_CLASS(oc);
+
+    pqc->xscom_ops = &pnv_quad_power10_xscom_ops;
+}
+
  static void pnv_quad_class_init(ObjectClass *oc, void *data)
  {
      DeviceClass *dc = DEVICE_CLASS(oc);
@@ -451,6 +499,11 @@ static const TypeInfo pnv_quad_infos[] = {
          .name = PNV_QUAD_TYPE_NAME("power9"),
          .class_init = pnv_quad_power9_class_init,
      },
+    {
+        .parent = TYPE_PNV_QUAD,
+        .name = PNV_QUAD_TYPE_NAME("power10"),
+        .class_init = pnv_quad_power10_class_init,
+    },
  };
 
  DEFINE_TYPES(pnv_quad_infos);
#7 lore raw

Re: [PATCH 3/4] ppc/pnv: Add P10 quad ops

In reply to Joel Stanley
Quoted 6 lines · Joel Stanley
hw/ppc/pnv_core.c +1 -0
index b9a57463aec4..7fff2fd9e298 100644
 
+static uint64_t pnv_quad_power10_xscom_read(void *opaque, hwaddr addr,

...

Quoted 1 line

+ qemu_log_mask(LOG_UNIMP, "%s: writing @0x%08x\n", __func__,

                                         ^^^ reading

I'm guessing we'll need to flush out that function pretty soon, so not worth resending.

Fred

#8 lore raw

Re: [PATCH 3/4] ppc/pnv: Add P10 quad ops

Quoted 9 lines · Frederic Barrat
Quoted 4 lines · Joel Stanley
hw/ppc/pnv_core.c +0 -0
index b9a57463aec4..7fff2fd9e298 100644
Quoted 8 lines
Quoted 1 line

+static uint64_t pnv_quad_power10_xscom_read(void *opaque, hwaddr addr,

...

Quoted 1 line

+ qemu_log_mask(LOG_UNIMP, "%s: writing @0x%08x\n", __func__,

                                          ^^^ reading

I'm guessing we'll need to flush out that function pretty soon, so not worth resending.

Thanks, good catch. It's incorrect in the p9 callback too.

I had it fixed locally along with a re-wording to make it clear the message was for unimplemented operations, but decided not to send that.

#9 lore raw

Re: [PATCH 3/4] ppc/pnv: Add P10 quad ops

Quoted 16 lines · Joel Stanley
Quoted 15 lines · Frederic Barrat
Quoted 6 lines · Joel Stanley
hw/ppc/pnv_core.c +1 -0
index b9a57463aec4..7fff2fd9e298 100644
 
+static uint64_t pnv_quad_power10_xscom_read(void *opaque, hwaddr addr,

...

Quoted 1 line

+ qemu_log_mask(LOG_UNIMP, "%s: writing @0x%08x\n", __func__,

                                           ^^^ reading
Quoted 8 lines
Quoted 2 lines

I'm guessing we'll need to flush out that function pretty soon, so not worth resending.

Thanks, good catch. It's incorrect in the p9 callback too.

I had it fixed locally along with a re-wording to make it clear the message was for unimplemented operations, but decided not to send that.

There is still time for a v2 ! Please keep the R-b.

Thanks,

C.

#10 lore raw

Re: [PATCH 3/4] ppc/pnv: Add P10 quad ops

Quoted 20 lines · Cédric Le Goater
Quoted 19 lines · Joel Stanley
Quoted 17 lines · Frederic Barrat
Quoted 6 lines · Joel Stanley
hw/ppc/pnv_core.c +1 -0
index b9a57463aec4..7fff2fd9e298 100644
 
+static uint64_t pnv_quad_power10_xscom_read(void *opaque, hwaddr addr,

...

Quoted 1 line

+        qemu_log_mask(LOG_UNIMP, "%s: writing @0x%08x\n", __func__,

                                           ^^^ reading

I'm guessing we'll need to flush out that function pretty soon, so not worth resending.

Quoted 8 lines
Quoted 5 lines

Thanks, good catch. It's incorrect in the p9 callback too.

I had it fixed locally along with a re-wording to make it clear the message was for unimplemented operations, but decided not to send that.

There is still time for a v2 ! Please keep the R-b.

Since you're sending a v2 please fix the 80+ char line in patch 4 to make checkpatch.pl happy:

-static void pnv_quad_power10_xscom_write(void *opaque, hwaddr addr, uint64_t val,
- unsigned int width)
+static void pnv_quad_power10_xscom_write(void *opaque, hwaddr addr,
+ uint64_t val, unsigned int width)

I'll not queue the series for now.

Daniel

Quoted 5 lines

Thanks,

C.

#11 lore raw

PATCH 4/4 ppc/pnv: Return zero for core thread state xscom

In reply to Joel Stanley

Firmware now warns if booting in LPAR per core mode (PPC bit 62). So this warning doesn't trigger report the core thread state is 0.

---
 hw/ppc/pnv_core.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
hw/ppc/pnv_core.c +10 -0
index 7fff2fd9e298..98356d7f6538 100644
@@ -116,6 +116,8 @@ static const MemoryRegionOps pnv_core_power8_xscom_ops = {
 #define PNV9_XSCOM_EC_PPM_SPECIAL_WKUP_HYP 0xf010d
 #define PNV9_XSCOM_EC_PPM_SPECIAL_WKUP_OTR 0xf010a
 
+#define PNV9_XSCOM_EC_CORE_THREAD_STATE    0x10ab3
+
 static uint64_t pnv_core_power9_xscom_read(void *opaque, hwaddr addr,
                                            unsigned int width)
 {
@@ -134,6 +136,9 @@ static uint64_t pnv_core_power9_xscom_read(void *opaque, hwaddr addr,
     case PNV9_XSCOM_EC_PPM_SPECIAL_WKUP_OTR:
         val = 0x0;
         break;
+    case PNV9_XSCOM_EC_CORE_THREAD_STATE:
+        val = 0;
+        break;
     default:
         qemu_log_mask(LOG_UNIMP, "Warning: reading reg=0x%" HWADDR_PRIx "\n",
                   addr);
@@ -408,6 +413,8 @@ static const MemoryRegionOps pnv_quad_power9_xscom_ops = {
  * POWER10 Quads
  */
 
+#define PNV10_XSCOM_EC_PC_PMC_CORE_THREAD_STATE 0x28412
+
 static uint64_t pnv_quad_power10_xscom_read(void *opaque, hwaddr addr,
                                             unsigned int width)
 {
@@ -415,6 +422,9 @@ static uint64_t pnv_quad_power10_xscom_read(void *opaque, hwaddr addr,
     uint64_t val = -1;
 
     switch (offset) {
+    case PNV10_XSCOM_EC_PC_PMC_CORE_THREAD_STATE:
+        val = 0;
+        break;
     default:
         qemu_log_mask(LOG_UNIMP, "%s: writing @0x%08x\n", __func__,
                       offset);
Signature · 1 line
2.40.1
Reviewed-by on v1 4/4
#12 lore raw

Re: [PATCH 4/4] ppc/pnv: Return zero for core thread state xscom

Quoted 4 lines · Joel Stanley

Firmware now warns if booting in LPAR per core mode (PPC bit 62). So this warning doesn't trigger report the core thread state is 0.

Thanks,

C.

Quoted 46 lines
---
  hw/ppc/pnv_core.c | 10 ++++++++++
  1 file changed, 10 insertions(+)
hw/ppc/pnv_core.c +10 -0
index 7fff2fd9e298..98356d7f6538 100644
@@ -116,6 +116,8 @@ static const MemoryRegionOps pnv_core_power8_xscom_ops = {
  #define PNV9_XSCOM_EC_PPM_SPECIAL_WKUP_HYP 0xf010d
  #define PNV9_XSCOM_EC_PPM_SPECIAL_WKUP_OTR 0xf010a
 
+#define PNV9_XSCOM_EC_CORE_THREAD_STATE    0x10ab3
+
  static uint64_t pnv_core_power9_xscom_read(void *opaque, hwaddr addr,
                                             unsigned int width)
  {
@@ -134,6 +136,9 @@ static uint64_t pnv_core_power9_xscom_read(void *opaque, hwaddr addr,
      case PNV9_XSCOM_EC_PPM_SPECIAL_WKUP_OTR:
          val = 0x0;
          break;
+    case PNV9_XSCOM_EC_CORE_THREAD_STATE:
+        val = 0;
+        break;
      default:
          qemu_log_mask(LOG_UNIMP, "Warning: reading reg=0x%" HWADDR_PRIx "\n",
                    addr);
@@ -408,6 +413,8 @@ static const MemoryRegionOps pnv_quad_power9_xscom_ops = {
   * POWER10 Quads
   */
 
+#define PNV10_XSCOM_EC_PC_PMC_CORE_THREAD_STATE 0x28412
+
  static uint64_t pnv_quad_power10_xscom_read(void *opaque, hwaddr addr,
                                              unsigned int width)
  {
@@ -415,6 +422,9 @@ static uint64_t pnv_quad_power10_xscom_read(void *opaque, hwaddr addr,
      uint64_t val = -1;
 
      switch (offset) {
+    case PNV10_XSCOM_EC_PC_PMC_CORE_THREAD_STATE:
+        val = 0;
+        break;
      default:
          qemu_log_mask(LOG_UNIMP, "%s: writing @0x%08x\n", __func__,
                        offset);
#13 lore raw

Re: [PATCH 4/4] ppc/pnv: Return zero for core thread state xscom

In reply to Joel Stanley
Quoted 41 lines · Joel Stanley

Firmware now warns if booting in LPAR per core mode (PPC bit 62). So this warning doesn't trigger report the core thread state is 0.

---
 hw/ppc/pnv_core.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
hw/ppc/pnv_core.c +7 -0
index 7fff2fd9e298..98356d7f6538 100644
@@ -116,6 +116,8 @@ static const MemoryRegionOps pnv_core_power8_xscom_ops = {
 #define PNV9_XSCOM_EC_PPM_SPECIAL_WKUP_HYP 0xf010d
 #define PNV9_XSCOM_EC_PPM_SPECIAL_WKUP_OTR 0xf010a
 
+#define PNV9_XSCOM_EC_CORE_THREAD_STATE    0x10ab3
+
 static uint64_t pnv_core_power9_xscom_read(void *opaque, hwaddr addr,
                                            unsigned int width)
 {
@@ -134,6 +136,9 @@ static uint64_t pnv_core_power9_xscom_read(void *opaque, hwaddr addr,
     case PNV9_XSCOM_EC_PPM_SPECIAL_WKUP_OTR:
         val = 0x0;
         break;
+    case PNV9_XSCOM_EC_CORE_THREAD_STATE:
+        val = 0;
+        break;
     default:
         qemu_log_mask(LOG_UNIMP, "Warning: reading reg=0x%" HWADDR_PRIx "\n",
                   addr);
@@ -408,6 +413,8 @@ static const MemoryRegionOps pnv_quad_power9_xscom_ops = {
  * POWER10 Quads
  */
 
+#define PNV10_XSCOM_EC_PC_PMC_CORE_THREAD_STATE 0x28412
+
 static uint64_t pnv_quad_power10_xscom_read(void *opaque, hwaddr addr,
                                             unsigned int width)
 {

hw/ppc/pnv_core.c static uint64_t pnv_quad_power10_xscom_read(void *opaque, hwaddr addr, · line 430

Quoted 9 lines
hw/ppc/pnv_core.c +3 -0
@@ -415,6 +422,9 @@ static uint64_t pnv_quad_power10_xscom_read(void *opaque, hwaddr addr,
     uint64_t val = -1;
 
     switch (offset) {
+    case PNV10_XSCOM_EC_PC_PMC_CORE_THREAD_STATE:
+        val = 0;
+        break;
     default:
         qemu_log_mask(LOG_UNIMP, "%s: writing @0x%08x\n", __func__,
                       offset);

Yeah this is the problem, this is just addressing one core in the quad. AFAIKS P9 may have the same problem though so I don't blame the confusion.

The other patches seem good because we'll want a P10 quad too I think.

Thanks,
Nick

#14 lore raw
In reply to Joel Stanley
Quoted 16 lines · Joel Stanley

The quad model implements the EC xscoms for the p9 machine, reusing the same model for p10 which isn't quite correct. This series adds a PnvQuad class and subclasses it for P9 and P10. Implement the core thread state xscom as an example. I expect more function to be implemented in future patches.

There's one outstanding question. Skiboot has this for the p10 scom:

#define P10_EC_CORE_THREAD_STATE 0x412

However the read that comes is for 0x28412. I suspect the upper 0x28000 are addressing bits, so we're really reporting the core thread state for the given core. Should the model instead wired so one is created for each chiplet? Or should we report the value for all possible cores, like the P9 code does for P9X_EX_NCU_SPEC_BAR?

Quoted 3 lines
    switch (offset) {
    case P9X_EX_NCU_SPEC_BAR:
    case P9X_EX_NCU_SPEC_BAR + 0x400: /* Second EX */

Yes you're right, 0x28000 is addressing within the quad. The 0x2 selects core/cache/NCU/etc and the 8 is a one-hot encoding to select the core.

So this access should actually be redirected to the pnv core scoms. I think to make that work, those regions have to be a subregion of the quad, right now they seem to overlap (the sizes are a bit wrong too, they end up overlapping).

0x412 is then a register in a particular core's "PC" unit. I assume PC is probably 0x800 or 0x1000 in size.

The quad itself has a QME engine, so you might address that with the quad registers.

IIRC the actual topology is something like

EQ +--- EX +--- ECL2 +--- EC
| +--- L3 +--- L2

   +--- QME          +--- NCU
   +--- maybe some scom and sensor stuff

No point modeling all that of course, just per-core and per-quad regions like it already has for now. But if for example we wanted to model some registers in the L2, it would not be contiguous with the core addresses so we'd have to add it.

Thanks,
Nick

Quoted 11 lines

Joel Stanley (4):
ppc/pnv: quad xscom callbacks are P9 specific ppc/pnv: Subclass quad xscom callbacks ppc/pnv: Add P10 quad ops
ppc/pnv: Return zero for core thread state xscom

 include/hw/ppc/pnv_core.h |  12 +++-
 hw/ppc/pnv.c              |  11 ++--
 hw/ppc/pnv_core.c         | 114 +++++++++++++++++++++++++++++++-------
 3 files changed, 113 insertions(+), 24 deletions(-)