Skip to contentSkip to conversation

ppc/pnv: I2C controller is not user creatable

PATCH Superseded Cédric Le Goater 2 participants 4 messages Mar 18, 2024

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ppc/pnv: I2C controller is not user creatable

The I2C controller is a subunit of the processor. Make it so and avoid QEMU crashes.

  $ build/qemu-system-ppc64 -S -machine powernv9 -device pnv-i2c
  qemu-system-ppc64: ../hw/ppc/pnv_i2c.c:521: pnv_i2c_realize: Assertion `i2c->chip' failed.
  Aborted (core dumped)
---
 hw/ppc/pnv_i2c.c | 1 +
 1 file changed, 1 insertion(+)
hw/ppc/pnv_i2c.c +1 -0
index 4581cc5e5d4645ab3e358d983a633e33a214c425..37d7b3d68a98d88f201b9a297dbb18678ffdcec2 100644
@@ -559,6 +559,7 @@ static void pnv_i2c_class_init(ObjectClass *klass, void *data)
 
     dc->desc = "PowerNV I2C";
     dc->realize = pnv_i2c_realize;
+    dc->user_creatable = false;
     device_class_set_props(dc, pnv_i2c_properties);
 }
 
Signature · 1 line
2.44.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 19 lines · Cédric Le Goater

The I2C controller is a subunit of the processor. Make it so and avoid QEMU crashes.

   $ build/qemu-system-ppc64 -S -machine powernv9 -device pnv-i2c
   qemu-system-ppc64: ../hw/ppc/pnv_i2c.c:521: pnv_i2c_realize: Assertion `i2c->chip' failed.
   Aborted (core dumped)
---
  hw/ppc/pnv_i2c.c | 1 +
  1 file changed, 1 insertion(+)
hw/ppc/pnv_i2c.c +0 -0
index 4581cc5e5d4645ab3e358d983a633e33a214c425..37d7b3d68a98d88f201b9a297dbb18678ffdcec2 100644

hw/ppc/pnv_i2c.c static void pnv_i2c_class_init(ObjectClass *klass, void *data) · line 562

Quoted 4 lines
hw/ppc/pnv_i2c.c +1 -0
@@ -559,6 +559,7 @@ static void pnv_i2c_class_init(ObjectClass *klass, void *data)
 
      dc->desc = "PowerNV I2C";
      dc->realize = pnv_i2c_realize;
+    dc->user_creatable = false;

Maybe add a comment in front of it (which is good style for setting user_creatable = false):

        /* This device is part of the CPU and cannot be used separately */

or so.

Anyway:

Quoted 3 lines
hw/ppc/pnv_i2c.c +0 -0
      device_class_set_props(dc, pnv_i2c_properties);
  }
 
#2 lore raw
Quoted 26 lines · Thomas Huth
Quoted 19 lines · Cédric Le Goater

The I2C controller is a subunit of the processor. Make it so and avoid QEMU crashes.

   $ build/qemu-system-ppc64 -S -machine powernv9 -device pnv-i2c
   qemu-system-ppc64: ../hw/ppc/pnv_i2c.c:521: pnv_i2c_realize: Assertion `i2c->chip' failed.
   Aborted (core dumped)

---
  hw/ppc/pnv_i2c.c | 1 +

  1 file changed, 1 insertion(+)
hw/ppc/pnv_i2c.c +0 -0
index 4581cc5e5d4645ab3e358d983a633e33a214c425..37d7b3d68a98d88f201b9a297dbb18678ffdcec2 100644

hw/ppc/pnv_i2c.c static void pnv_i2c_class_init(ObjectClass *klass, void *data) · line 561

Quoted 3 lines
hw/ppc/pnv_i2c.c +1 -0
@@ -559,6 +559,7 @@ static void pnv_i2c_class_init(ObjectClass *klass, void *data)
       dc->desc = "PowerNV I2C";
       dc->realize = pnv_i2c_realize;
+    dc->user_creatable = false;

Maybe add a comment in front of it (which is good style for setting user_creatable = false):

Quoted 3 lines

        /* This device is part of the CPU and cannot be used separately */

or so.

ok. will resend.

Thanks,

C.

Quoted 7 lines

Anyway:

Quoted 2 lines
hw/ppc/pnv_i2c.c +0 -0
       device_class_set_props(dc, pnv_i2c_properties);
   }
#3 lore raw
In reply to Cédric Le Goater
Quoted 6 lines · Cédric Le Goater

The I2C controller is a subunit of the processor. Make it so and avoid QEMU crashes.

   $ build/qemu-system-ppc64 -S -machine powernv9 -device pnv-i2c
   qemu-system-ppc64: ../hw/ppc/pnv_i2c.c:521: pnv_i2c_realize: Assertion `i2c->chip' failed.
   Aborted (core dumped)

and

Fixes 263b81ee15af ("ppc/pnv: Add an I2C controller model")

Sorry for the noise,

C.

Quoted 19 lines
---
  hw/ppc/pnv_i2c.c | 1 +
  1 file changed, 1 insertion(+)
hw/ppc/pnv_i2c.c +1 -0
index 4581cc5e5d4645ab3e358d983a633e33a214c425..37d7b3d68a98d88f201b9a297dbb18678ffdcec2 100644
@@ -559,6 +559,7 @@ static void pnv_i2c_class_init(ObjectClass *klass, void *data)
 
      dc->desc = "PowerNV I2C";
      dc->realize = pnv_i2c_realize;
+    dc->user_creatable = false;
      device_class_set_props(dc, pnv_i2c_properties);
  }