Skip to contentSkip to conversation

ppc/pnv: I2C controller is not user creatable

PATCH In review Cédric Le Goater 3 participants 3 messages Mar 18, 2024

lore
Share & tools
lore
#0 lore raw

PATCH v2 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)
Fixes 263b81ee15af ("ppc/pnv: Add an I2C controller model")
Cc Glenn Miles <[email protected]>
---
 hw/ppc/pnv_i2c.c | 3 +++
 1 file changed, 3 insertions(+)
hw/ppc/pnv_i2c.c +3 -0
index 4581cc5e5d4645ab3e358d983a633e33a214c425..eec5047ce83f842108b53a6e2bd9869a81f14ac1 100644
@@ -557,6 +557,9 @@ static void pnv_i2c_class_init(ObjectClass *klass, void *data)
 
     xscomc->dt_xscom = pnv_i2c_dt_xscom;
 
+    /* Reason: This device is part of the CPU and cannot be used separately */
+    dc->user_creatable = false;
+
     dc->desc = "PowerNV I2C";
     dc->realize = pnv_i2c_realize;
     device_class_set_props(dc, pnv_i2c_properties);
Signature · 1 line
2.44.0
Reviewed-by on v2 1/1
#1 lore raw
Quoted 7 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)
Quoted 8 lines
Fixes 263b81ee15af ("ppc/pnv: Add an I2C controller model")
Cc Glenn Miles <[email protected]>
---
  hw/ppc/pnv_i2c.c | 3 +++
  1 file changed, 3 insertions(+)
Reviewed-by on v2 1/1
#2 lore raw
In reply to Cédric Le Goater

On Mon, 2024-03-18 at 16:58 +0100, Cédric Le Goater wrote:

Thanks for fixing that!

-Glenn

Quoted 36 lines

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)
Fixes 263b81ee15af ("ppc/pnv: Add an I2C controller model")
Cc Glenn Miles <[email protected]>
---
 hw/ppc/pnv_i2c.c | 3 +++
 1 file changed, 3 insertions(+)
hw/ppc/pnv_i2c.c +0 -0

index 4581cc5e5d4645ab3e358d983a633e33a214c425..eec5047ce83f842108b53a6e2bd 9869a81f14ac1 100644

hw/ppc/pnv_i2c.c +1 -0
@@ -557,6 +557,9 @@ static void pnv_i2c_class_init(ObjectClass
 *klass, void *data)
 
     xscomc->dt_xscom = pnv_i2c_dt_xscom;
 
+    /* Reason: This device is part of the CPU and cannot be used

separately */

hw/ppc/pnv_i2c.c +2 -0
+    dc->user_creatable = false;
+
     dc->desc = "PowerNV I2C";
     dc->realize = pnv_i2c_realize;
     device_class_set_props(dc, pnv_i2c_properties);