[PATCH 00/50] Aspeed: I2C device models and the Minerva BMC machine

Emmanuel Blot via qemu development posted 50 patches 2 weeks, 5 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260907-bmc-minerva-v1-0-0d83ad610c3b@free.fr
Maintainers: "Cédric Le Goater" <clg@kaod.org>, Peter Maydell <peter.maydell@linaro.org>, Steven Lee <steven_lee@aspeedtech.com>, Troy Lee <leetroy@gmail.com>, Jamin Lin <jamin_lin@aspeedtech.com>, Kane Chen <kane_chen@aspeedtech.com>, Andrew Jeffery <andrew@codeconstruct.com.au>, Joel Stanley <joel@jms.id.au>, Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>, Paolo Bonzini <pbonzini@redhat.com>, Patrick Leis <venture@google.com>, Bernhard Beschow <shentey@gmail.com>, Nicholas Piggin <npiggin@gmail.com>, Anirudh Srinivasan <asrinivasan@oss.tenstorrent.com>, Michael Ellerman <mpe@kernel.org>, Portia Stephens <portias@oss.tenstorrent.com>, Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <alistair.francis@wdc.com>, Weiwei Li <liwei1518@gmail.com>, Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>, Liu Zhiwei <zhiwei_liu@linux.alibaba.com>, Chao Liu <chao.liu@processmission.com>, "Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>, Fabiano Rosas <farosas@suse.de>, Laurent Vivier <lvivier@redhat.com>
docs/system/arm/aspeed.rst                  |   7 +-
hw/arm/Kconfig                              |   2 +
hw/arm/aspeed_ast2400_palmetto.c            |   4 +-
hw/arm/aspeed_ast2400_supermicrox11.c       |   4 +-
hw/arm/aspeed_ast2500_romulus.c             |   4 +-
hw/arm/aspeed_ast2500_supermicro-x11spi.c   |   4 +-
hw/arm/aspeed_ast2500_witherspoon.c         |   4 +-
hw/arm/aspeed_ast2600_bletchley.c           |   3 +-
hw/arm/aspeed_ast2600_catalina.c            |   2 +-
hw/arm/aspeed_ast2600_minerva.c             | 856 ++++++++++++++++++++++++++++
hw/arm/aspeed_ast2600_sanmiguel.c           |   7 +-
hw/arm/meson.build                          |   1 +
hw/arm/realview.c                           |   3 +-
hw/arm/versatilepb.c                        |   3 +-
hw/i2c/i2c_mux_pca954x.c                    |  98 +++-
hw/ppc/e500.c                               |   3 +-
hw/riscv/tt_atlantis.c                      |   3 +-
hw/rtc/ds1338.c                             | 427 +++++++++++---
hw/sensor/Kconfig                           |   8 +
hw/sensor/ina230.c                          | 597 +++++++++++++++++++
hw/sensor/ina238.c                          | 802 ++++++++++++++++++++++++++
hw/sensor/meson.build                       |   2 +
hw/sensor/trace-events                      |  14 +
include/hw/i2c/i2c_mux_pca954x.h            |   1 +
include/hw/rtc/ds1338.h                     |  21 +
include/hw/sensor/ina230.h                  |  14 +
include/hw/sensor/ina238.h                  |  14 +
tests/functional/arm/meson.build            |   2 +
tests/functional/arm/test_aspeed_minerva.py |  30 +
tests/qtest/ds1338-test.c                   | 191 ++++++-
tests/qtest/ds1339-test.c                   | 581 +++++++++++++++++++
tests/qtest/ina230-test.c                   | 602 +++++++++++++++++++
tests/qtest/ina238-test.c                   | 806 ++++++++++++++++++++++++++
tests/qtest/meson.build                     |   4 +
tests/qtest/pca9545-test.c                  | 116 ++++
35 files changed, 5125 insertions(+), 115 deletions(-)
[PATCH 00/50] Aspeed: I2C device models and the Minerva BMC machine
Posted by Emmanuel Blot via qemu development 2 weeks, 5 days ago
Add the minerva-bmc machine and the I2C device models it needs.

Based on legoater/aspeed-next, at:
  1c05d7e94d ("tests/functional: aspeed: optionally check the device
  tree model on boot")

New models:

  INA230   TI 36V current-shunt and power monitor
  INA238   TI 85V current-shunt, power and temperature monitor
  DS1339   RTC, a DS1338 variant
  PCA9545  4-channel I2C mux with per-channel interrupt inputs

The INA devices derive current and power from the shunt voltage and
their calibration registers. ALERT output is supported. Measurements
come in through QOM properties; however, conversion delay is not
modelled.

Introduce a device class to manage different variants of the DS1338
register map, such as the DS1339. Improve the DS1338 implementation
with a Resettable reset, support for the clock-halt bit, and a
"persist-on-reset" property keeping the registers across a reset.

The minerva-bmc machine is derived from the platform device tree and
instantiates every device that is supported in QEMU. FRU EEPROMs are
sanitised images taken from real hardware.

New qtests for the DS1339, INA230, INA238 and PCA9545, plus DS1338
cases for the register map, and a functional test booting OpenBMC on
minerva-bmc.

The docs now mention the previously missing catalina-bmc and
sanmiguel-bmc machines, and the title has been simplified.

One thing worth a second opinion: the PCA954x muxes now have a
VMStateDescription, which changes the migration stream for the
existing PCA9546 and PCA9548. The DS1338 vmstate also goes from
version 2 to 3, but older streams still load fine.

Signed-off-by: Emmanuel Blot <emmanuel.blot@free.fr>
---
Emmanuel Blot (50):
      docs/system/arm/aspeed: add the catalina-bmc machine
      docs/system/arm/aspeed: add the sanmiguel-bmc machine
      hw/arm: sanmiguel: remove the second SPI flash controller
      hw/i2c: pca954x: drop unused header inclusions
      hw/i2c: pca954x: add PCA9545 4-channel mux model
      hw/i2c: pca954x: migrate mux state
      tests/qtest: pca9545: add mux test
      hw/rtc: ds1338: move TYPE_DS1338 to a public header
      hw: ds1338: use the TYPE_DS1338 constant instead of the "ds1338" string
      hw/rtc: ds1338: implement Resettable reset
      hw/rtc: ds1338: prefix the file-local helpers with ds1338_
      hw/rtc: ds1338: parameterise the register map via a device class
      hw/rtc: ds1338: program the clock from the time registers
      hw/rtc: ds1338: implement the DS1338 clock-halt bit
      hw/rtc: ds1338: refresh the user registers on a read rollover only
      hw/rtc: ds1338: add a persist-on-reset property
      tests/qtest: ds1338: cover the DS1338-specific register map
      tests/qtest: ds1338: cover the power-on register defaults
      tests/qtest: ds1338: cover the clock-halt bit
      tests/qtest: ds1338: cover persist-on-reset
      tests/qtest: ds1338: cover the reserved bits of the time registers
      hw/rtc: ds1338: add DS1339 variant
      tests/qtest: ds1339: add RTC test
      tests/qtest: ds1339: cover power-on defaults and reserved-bit masking
      tests/qtest: ds1339: cover oscillator stop/restart and time programming
      tests/qtest: ds1339: cover the Century bit
      tests/qtest: ds1339: cover the end-of-month rollover
      tests/qtest: ds1339: cover the 12-hour format
      tests/qtest: ds1339: cover the day-of-week counter
      tests/qtest: ds1339: cover persist-on-reset
      tests/qtest: ds1339: cover the migration round trip
      hw/sensor: ina230: add current/voltage/power monitor
      tests/qtest: ina230: add current/voltage/power monitor test
      tests/qtest: ina230: cover voltage injection and power derivation
      tests/qtest: ina230: cover the ALERT limit functions and CVRF
      tests/qtest: ina230: cover the injection-property limits
      tests/qtest: ina230: cover operating modes and triggered conversions
      tests/qtest: ina230: cover ALERT latch persistence
      tests/qtest: ina230: cover a cleared calibration per channel
      hw/sensor: ina238: add current/voltage/power monitor
      tests/qtest: ina238: add current/voltage/power monitor test
      tests/qtest: ina238: cover voltage/temperature injection and derivation
      tests/qtest: ina238: cover the ALERT path and conversion-ready flag
      tests/qtest: ina238: cover the injection-property limits
      tests/qtest: ina238: cover the operating modes
      tests/qtest: ina238: cover conversion-ready and alert-latch semantics
      tests/qtest: ina238: cover a cleared calibration per channel
      hw/arm: minerva: add Facebook BMC machine
      hw/arm: minerva: populate EEPROM data
      tests/functional/arm: minerva: add BMC boot test

 docs/system/arm/aspeed.rst                  |   7 +-
 hw/arm/Kconfig                              |   2 +
 hw/arm/aspeed_ast2400_palmetto.c            |   4 +-
 hw/arm/aspeed_ast2400_supermicrox11.c       |   4 +-
 hw/arm/aspeed_ast2500_romulus.c             |   4 +-
 hw/arm/aspeed_ast2500_supermicro-x11spi.c   |   4 +-
 hw/arm/aspeed_ast2500_witherspoon.c         |   4 +-
 hw/arm/aspeed_ast2600_bletchley.c           |   3 +-
 hw/arm/aspeed_ast2600_catalina.c            |   2 +-
 hw/arm/aspeed_ast2600_minerva.c             | 856 ++++++++++++++++++++++++++++
 hw/arm/aspeed_ast2600_sanmiguel.c           |   7 +-
 hw/arm/meson.build                          |   1 +
 hw/arm/realview.c                           |   3 +-
 hw/arm/versatilepb.c                        |   3 +-
 hw/i2c/i2c_mux_pca954x.c                    |  98 +++-
 hw/ppc/e500.c                               |   3 +-
 hw/riscv/tt_atlantis.c                      |   3 +-
 hw/rtc/ds1338.c                             | 427 +++++++++++---
 hw/sensor/Kconfig                           |   8 +
 hw/sensor/ina230.c                          | 597 +++++++++++++++++++
 hw/sensor/ina238.c                          | 802 ++++++++++++++++++++++++++
 hw/sensor/meson.build                       |   2 +
 hw/sensor/trace-events                      |  14 +
 include/hw/i2c/i2c_mux_pca954x.h            |   1 +
 include/hw/rtc/ds1338.h                     |  21 +
 include/hw/sensor/ina230.h                  |  14 +
 include/hw/sensor/ina238.h                  |  14 +
 tests/functional/arm/meson.build            |   2 +
 tests/functional/arm/test_aspeed_minerva.py |  30 +
 tests/qtest/ds1338-test.c                   | 191 ++++++-
 tests/qtest/ds1339-test.c                   | 581 +++++++++++++++++++
 tests/qtest/ina230-test.c                   | 602 +++++++++++++++++++
 tests/qtest/ina238-test.c                   | 806 ++++++++++++++++++++++++++
 tests/qtest/meson.build                     |   4 +
 tests/qtest/pca9545-test.c                  | 116 ++++
 35 files changed, 5125 insertions(+), 115 deletions(-)
---
base-commit: 1c05d7e94da04129ea16147074fe73158fb85ff9
change-id: 20260907-bmc-minerva-cd13a718c90b

Best regards,
--  
Emmanuel Blot <emmanuel.blot@free.fr>
[PING] Re: [PATCH 00/50] Aspeed: I2C device models and the Minerva BMC machine
Posted by Emmanuel Blot via qemu development 3 days, 2 hours ago
Hi,

Gentle ping on this series.

The I2C device models stand on their own and can be reviewed — or
picked — independently of the Minerva board:

  04-07  pca954x: PCA9545 model, migrated mux state, qtest
  08-21  ds1338: cleanups, class-parameterised register map,
         clock-halt bit, persist-on-reset, qtest coverage
  22-31  DS1339 variant and its qtest coverage
  32-39  ina230 model and its qtest coverage
  40-47  ina238 model and its qtest coverage

The board work is only the last three patches, and 01-03 are the two
missing doc entries plus a sanmiguel flash-controller fix.

Happy to respin the device models as their own series if that makes
review easier.

Thanks,
Emmanuel


On 7 Sep 2026, at 18:41, Emmanuel Blot wrote:

> Add the minerva-bmc machine and the I2C device models it needs.
>
> Based on legoater/aspeed-next, at:
>   1c05d7e94d ("tests/functional: aspeed: optionally check the device
>   tree model on boot")
>
> New models:
>
>   INA230   TI 36V current-shunt and power monitor
>   INA238   TI 85V current-shunt, power and temperature monitor
>   DS1339   RTC, a DS1338 variant
>   PCA9545  4-channel I2C mux with per-channel interrupt inputs
>
> The INA devices derive current and power from the shunt voltage and
> their calibration registers. ALERT output is supported. Measurements
> come in through QOM properties; however, conversion delay is not
> modelled.
>
> Introduce a device class to manage different variants of the DS1338
> register map, such as the DS1339. Improve the DS1338 implementation
> with a Resettable reset, support for the clock-halt bit, and a
> "persist-on-reset" property keeping the registers across a reset.
>
> The minerva-bmc machine is derived from the platform device tree and
> instantiates every device that is supported in QEMU. FRU EEPROMs are
> sanitised images taken from real hardware.
>
> New qtests for the DS1339, INA230, INA238 and PCA9545, plus DS1338
> cases for the register map, and a functional test booting OpenBMC on
> minerva-bmc.
>
> The docs now mention the previously missing catalina-bmc and
> sanmiguel-bmc machines, and the title has been simplified.
>
> One thing worth a second opinion: the PCA954x muxes now have a
> VMStateDescription, which changes the migration stream for the
> existing PCA9546 and PCA9548. The DS1338 vmstate also goes from
> version 2 to 3, but older streams still load fine.
>
> Signed-off-by: Emmanuel Blot <emmanuel.blot@free.fr>
> ---
> Emmanuel Blot (50):
>       docs/system/arm/aspeed: add the catalina-bmc machine
>       docs/system/arm/aspeed: add the sanmiguel-bmc machine
>       hw/arm: sanmiguel: remove the second SPI flash controller
>       hw/i2c: pca954x: drop unused header inclusions
>       hw/i2c: pca954x: add PCA9545 4-channel mux model
>       hw/i2c: pca954x: migrate mux state
>       tests/qtest: pca9545: add mux test
>       hw/rtc: ds1338: move TYPE_DS1338 to a public header
>       hw: ds1338: use the TYPE_DS1338 constant instead of the "ds1338" string
>       hw/rtc: ds1338: implement Resettable reset
>       hw/rtc: ds1338: prefix the file-local helpers with ds1338_
>       hw/rtc: ds1338: parameterise the register map via a device class
>       hw/rtc: ds1338: program the clock from the time registers
>       hw/rtc: ds1338: implement the DS1338 clock-halt bit
>       hw/rtc: ds1338: refresh the user registers on a read rollover only
>       hw/rtc: ds1338: add a persist-on-reset property
>       tests/qtest: ds1338: cover the DS1338-specific register map
>       tests/qtest: ds1338: cover the power-on register defaults
>       tests/qtest: ds1338: cover the clock-halt bit
>       tests/qtest: ds1338: cover persist-on-reset
>       tests/qtest: ds1338: cover the reserved bits of the time registers
>       hw/rtc: ds1338: add DS1339 variant
>       tests/qtest: ds1339: add RTC test
>       tests/qtest: ds1339: cover power-on defaults and reserved-bit masking
>       tests/qtest: ds1339: cover oscillator stop/restart and time programming
>       tests/qtest: ds1339: cover the Century bit
>       tests/qtest: ds1339: cover the end-of-month rollover
>       tests/qtest: ds1339: cover the 12-hour format
>       tests/qtest: ds1339: cover the day-of-week counter
>       tests/qtest: ds1339: cover persist-on-reset
>       tests/qtest: ds1339: cover the migration round trip
>       hw/sensor: ina230: add current/voltage/power monitor
>       tests/qtest: ina230: add current/voltage/power monitor test
>       tests/qtest: ina230: cover voltage injection and power derivation
>       tests/qtest: ina230: cover the ALERT limit functions and CVRF
>       tests/qtest: ina230: cover the injection-property limits
>       tests/qtest: ina230: cover operating modes and triggered conversions
>       tests/qtest: ina230: cover ALERT latch persistence
>       tests/qtest: ina230: cover a cleared calibration per channel
>       hw/sensor: ina238: add current/voltage/power monitor
>       tests/qtest: ina238: add current/voltage/power monitor test
>       tests/qtest: ina238: cover voltage/temperature injection and derivation
>       tests/qtest: ina238: cover the ALERT path and conversion-ready flag
>       tests/qtest: ina238: cover the injection-property limits
>       tests/qtest: ina238: cover the operating modes
>       tests/qtest: ina238: cover conversion-ready and alert-latch semantics
>       tests/qtest: ina238: cover a cleared calibration per channel
>       hw/arm: minerva: add Facebook BMC machine
>       hw/arm: minerva: populate EEPROM data
>       tests/functional/arm: minerva: add BMC boot test
>
>  docs/system/arm/aspeed.rst                  |   7 +-
>  hw/arm/Kconfig                              |   2 +
>  hw/arm/aspeed_ast2400_palmetto.c            |   4 +-
>  hw/arm/aspeed_ast2400_supermicrox11.c       |   4 +-
>  hw/arm/aspeed_ast2500_romulus.c             |   4 +-
>  hw/arm/aspeed_ast2500_supermicro-x11spi.c   |   4 +-
>  hw/arm/aspeed_ast2500_witherspoon.c         |   4 +-
>  hw/arm/aspeed_ast2600_bletchley.c           |   3 +-
>  hw/arm/aspeed_ast2600_catalina.c            |   2 +-
>  hw/arm/aspeed_ast2600_minerva.c             | 856 ++++++++++++++++++++++++++++
>  hw/arm/aspeed_ast2600_sanmiguel.c           |   7 +-
>  hw/arm/meson.build                          |   1 +
>  hw/arm/realview.c                           |   3 +-
>  hw/arm/versatilepb.c                        |   3 +-
>  hw/i2c/i2c_mux_pca954x.c                    |  98 +++-
>  hw/ppc/e500.c                               |   3 +-
>  hw/riscv/tt_atlantis.c                      |   3 +-
>  hw/rtc/ds1338.c                             | 427 +++++++++++---
>  hw/sensor/Kconfig                           |   8 +
>  hw/sensor/ina230.c                          | 597 +++++++++++++++++++
>  hw/sensor/ina238.c                          | 802 ++++++++++++++++++++++++++
>  hw/sensor/meson.build                       |   2 +
>  hw/sensor/trace-events                      |  14 +
>  include/hw/i2c/i2c_mux_pca954x.h            |   1 +
>  include/hw/rtc/ds1338.h                     |  21 +
>  include/hw/sensor/ina230.h                  |  14 +
>  include/hw/sensor/ina238.h                  |  14 +
>  tests/functional/arm/meson.build            |   2 +
>  tests/functional/arm/test_aspeed_minerva.py |  30 +
>  tests/qtest/ds1338-test.c                   | 191 ++++++-
>  tests/qtest/ds1339-test.c                   | 581 +++++++++++++++++++
>  tests/qtest/ina230-test.c                   | 602 +++++++++++++++++++
>  tests/qtest/ina238-test.c                   | 806 ++++++++++++++++++++++++++
>  tests/qtest/meson.build                     |   4 +
>  tests/qtest/pca9545-test.c                  | 116 ++++
>  35 files changed, 5125 insertions(+), 115 deletions(-)
> ---
> base-commit: 1c05d7e94da04129ea16147074fe73158fb85ff9
> change-id: 20260907-bmc-minerva-cd13a718c90b
>
> Best regards,
> --
> Emmanuel Blot <emmanuel.blot@free.fr>