[PATCH 00/29] hw/arm: improve Aspeed Catalina BMC emulation

Emmanuel Blot posted 29 patches 2 weeks, 2 days ago
Only 10 patches received!
hw/arm/aspeed_ast2600_catalina.c             |  67 ++++---
hw/gpio/pca9552.c                            | 256 ++++++++++++++++++++-------
hw/gpio/pca9554.c                            | 175 ++++++++++--------
hw/i2c/core.c                                |   3 +
include/hw/gpio/pca9552.h                    |  31 +---
include/hw/gpio/pca9554.h                    |   3 +
include/hw/i2c/i2c.h                         |   7 +-
tests/functional/arm/test_aspeed_catalina.py |  81 +++++++++
tests/qtest/meson.build                      |   2 +
tests/qtest/pca9552-test.c                   |  76 ++++++++
tests/qtest/pca9554-test.c                   | 223 +++++++++++++++++++++++
tests/qtest/pca9555-test.c                   | 251 ++++++++++++++++++++++++++
12 files changed, 994 insertions(+), 181 deletions(-)
[PATCH 00/29] hw/arm: improve Aspeed Catalina BMC emulation
Posted by Emmanuel Blot 2 weeks, 2 days ago
This series improves emulation of the Aspeed-based Catalina BMC machine,
mostly around its I2C buses: the GPIO expanders the board relies on and
the temperature sensors sitting next to them.

The bulk of the work is on the PCA95xx I/O expander models. The existing
PCA9552 and PCA9554 drivers only really covered the exact parts a couple
of boards happened to use, and some of their register and pin behaviour
did not match the datasheets. Catalina needs a few more variants and
expects them to act like the real chips, so:

 - the PCA9552 driver now provides proper PCA9555/PCA9535 types, applies
   input polarity inversion on reads, and handles the command register
   as the datasheet describes (auto-increment and wrapping);

 - the PCA9554 driver gains the 4-bit PCA9536 variant, reflects
push-pull
   outputs back into the input register, and grows an opt-in mode that
   honours the configured pin direction instead of forcing pins to
   outputs;

 - both drivers expose each line as a "pinN" QOM property, which lets an
   external actor drive an input pin. The property also allows reading
   the value driven onto an output-configured pin, which is the more
   useful capability, but nothing exercises it yet.

Along the way both models get a fair bit of cleanup (DEFINE_TYPES, the
Resettable interface, state moved out of the headers, default
descriptions derived from the instantiated type).

On the machine itself, Catalina now instantiates its PCA9555 expanders
as their own type, gains the NIC and FIO temperature sensors present on
real hardware, and drives the pca9554 expander input pins from outside
the guest.

Finally, the register-level behaviour of both expanders is covered by
new qtests, and the functional test that boots the OpenBMC image now
exercises the expanders end to end, both through QOM and through the
guest's gpio tooling.

Note that the "hw/i2c: parent slaves created with
i2c_slave_create_simple"
patch is only a temporary dependency here: it already belongs to the
separate ADC128D818 series currently under review, and will be dropped
from this series before it is submitted for final review.

Signed-off-by: Emmanuel Blot <emmanuel.blot@free.fr>
---
Emmanuel Blot (29):
      hw/gpio: pca9552: register types with DEFINE_TYPES()
      hw/gpio: pca9552: move PCA955xState definition out of the header
      hw/gpio: pca9552: rename I2CSlave member to parent_obj
      hw/gpio: pca9552: default description to the instantiated type name
      hw/gpio: pca9552: declare pca9555 device as an alias of pca9535 device
      hw/gpio: pca9552: use the Resettable interface instead of legacy reset
      hw/gpio: pca9552: apply input polarity inversion on read
      hw/gpio: pca9552: conform GPIO command handling to the datasheet
      hw/gpio: pca9552: expose GPIO pins as pin%d QOM properties
      tests/qtest: add PCA9555 register access tests
      tests/qtest: pca9555: test output-to-input reflection and pull-ups
      tests/qtest: pca9555: test polarity inversion
      tests/qtest: pca9555: test auto-increment and command wrapping
      tests/qtest: pca9552: test behaviour specific to the LED variant
      hw/gpio: pca9554: add PCA9536 support
      hw/gpio: pca9554: add hw-dir property honoring the configured pin direction
      hw/gpio: pca9554: reflect push-pull outputs in the input register
      hw/gpio: pca9554: expose pin%d as a string property
      tests/qtest: add PCA9554 register access tests
      tests/qtest: pca9554: test output-to-input reflection and pull-ups
      tests/qtest: pca9554: test polarity inversion
      tests/qtest: pca9554: test absence of command auto-increment
      tests/qtest: pca9554: test the PCA9536 4-bit variant
      hw/arm: catalina: model PCA9555 IO expanders with their own type
      hw/arm: catalina: add NIC and FIO temperature sensors
      hw/i2c: parent slaves created with i2c_slave_create_simple
      test/functional: catalina: test PCA9555 IO expander via QOM
      hw/arm: catalina: drive pca9554 io expander input pins externally
      test/functional: catalina: test PCA9554 IO expander via QOM

 hw/arm/aspeed_ast2600_catalina.c             |  67 ++++---
 hw/gpio/pca9552.c                            | 256 ++++++++++++++++++++-------
 hw/gpio/pca9554.c                            | 175 ++++++++++--------
 hw/i2c/core.c                                |   3 +
 include/hw/gpio/pca9552.h                    |  31 +---
 include/hw/gpio/pca9554.h                    |   3 +
 include/hw/i2c/i2c.h                         |   7 +-
 tests/functional/arm/test_aspeed_catalina.py |  81 +++++++++
 tests/qtest/meson.build                      |   2 +
 tests/qtest/pca9552-test.c                   |  76 ++++++++
 tests/qtest/pca9554-test.c                   | 223 +++++++++++++++++++++++
 tests/qtest/pca9555-test.c                   | 251 ++++++++++++++++++++++++++
 12 files changed, 994 insertions(+), 181 deletions(-)
---
base-commit: f893c46c3931b3684d235d221bf8b7844ddbf1d7
change-id: 20260703-catalina-upgrade-3eae7d9d7289

Best regards,
--  
Emmanuel Blot <emmanuel.blot@free.fr>
Re: [PATCH 00/29] hw/arm: improve Aspeed Catalina BMC emulation
Posted by Cédric Le Goater 1 week, 1 day ago
On 7/9/26 17:23, Emmanuel Blot wrote:
> This series improves emulation of the Aspeed-based Catalina BMC machine,
> mostly around its I2C buses: the GPIO expanders the board relies on and
> the temperature sensors sitting next to them.
> 
> The bulk of the work is on the PCA95xx I/O expander models. The existing
> PCA9552 and PCA9554 drivers only really covered the exact parts a couple
> of boards happened to use, and some of their register and pin behaviour
> did not match the datasheets. Catalina needs a few more variants and
> expects them to act like the real chips, so:
> 
>   - the PCA9552 driver now provides proper PCA9555/PCA9535 types, applies
>     input polarity inversion on reads, and handles the command register
>     as the datasheet describes (auto-increment and wrapping);
> 
>   - the PCA9554 driver gains the 4-bit PCA9536 variant, reflects
> push-pull
>     outputs back into the input register, and grows an opt-in mode that
>     honours the configured pin direction instead of forcing pins to
>     outputs;
> 
>   - both drivers expose each line as a "pinN" QOM property, which lets an
>     external actor drive an input pin. The property also allows reading
>     the value driven onto an output-configured pin, which is the more
>     useful capability, but nothing exercises it yet.
> 
> Along the way both models get a fair bit of cleanup (DEFINE_TYPES, the
> Resettable interface, state moved out of the headers, default
> descriptions derived from the instantiated type).
> 
> On the machine itself, Catalina now instantiates its PCA9555 expanders
> as their own type, gains the NIC and FIO temperature sensors present on
> real hardware, and drives the pca9554 expander input pins from outside
> the guest.
> 
> Finally, the register-level behaviour of both expanders is covered by
> new qtests, and the functional test that boots the OpenBMC image now
> exercises the expanders end to end, both through QOM and through the
> guest's gpio tooling.
> 
> Note that the "hw/i2c: parent slaves created with
> i2c_slave_create_simple"
> patch is only a temporary dependency here: it already belongs to the
> separate ADC128D818 series currently under review, and will be dropped
> from this series before it is submitted for final review.
> 
> Signed-off-by: Emmanuel Blot <emmanuel.blot@free.fr>
> ---
> Emmanuel Blot (29):
>        hw/gpio: pca9552: register types with DEFINE_TYPES()
>        hw/gpio: pca9552: move PCA955xState definition out of the header
>        hw/gpio: pca9552: rename I2CSlave member to parent_obj
>        hw/gpio: pca9552: default description to the instantiated type name
>        hw/gpio: pca9552: declare pca9555 device as an alias of pca9535 device
>        hw/gpio: pca9552: use the Resettable interface instead of legacy reset
>        hw/gpio: pca9552: apply input polarity inversion on read
>        hw/gpio: pca9552: conform GPIO command handling to the datasheet
>        hw/gpio: pca9552: expose GPIO pins as pin%d QOM properties
>        tests/qtest: add PCA9555 register access tests
>        tests/qtest: pca9555: test output-to-input reflection and pull-ups
>        tests/qtest: pca9555: test polarity inversion
>        tests/qtest: pca9555: test auto-increment and command wrapping
>        tests/qtest: pca9552: test behaviour specific to the LED variant
>        hw/gpio: pca9554: add PCA9536 support
>        hw/gpio: pca9554: add hw-dir property honoring the configured pin direction
>        hw/gpio: pca9554: reflect push-pull outputs in the input register
>        hw/gpio: pca9554: expose pin%d as a string property
>        tests/qtest: add PCA9554 register access tests
>        tests/qtest: pca9554: test output-to-input reflection and pull-ups
>        tests/qtest: pca9554: test polarity inversion
>        tests/qtest: pca9554: test absence of command auto-increment
>        tests/qtest: pca9554: test the PCA9536 4-bit variant
>        hw/arm: catalina: model PCA9555 IO expanders with their own type
>        hw/arm: catalina: add NIC and FIO temperature sensors
>        hw/i2c: parent slaves created with i2c_slave_create_simple
>        test/functional: catalina: test PCA9555 IO expander via QOM
>        hw/arm: catalina: drive pca9554 io expander input pins externally
>        test/functional: catalina: test PCA9554 IO expander via QOM
> 
>   hw/arm/aspeed_ast2600_catalina.c             |  67 ++++---
>   hw/gpio/pca9552.c                            | 256 ++++++++++++++++++++-------
>   hw/gpio/pca9554.c                            | 175 ++++++++++--------
>   hw/i2c/core.c                                |   3 +
>   include/hw/gpio/pca9552.h                    |  31 +---
>   include/hw/gpio/pca9554.h                    |   3 +
>   include/hw/i2c/i2c.h                         |   7 +-
>   tests/functional/arm/test_aspeed_catalina.py |  81 +++++++++
>   tests/qtest/meson.build                      |   2 +
>   tests/qtest/pca9552-test.c                   |  76 ++++++++
>   tests/qtest/pca9554-test.c                   | 223 +++++++++++++++++++++++
>   tests/qtest/pca9555-test.c                   | 251 ++++++++++++++++++++++++++
>   12 files changed, 994 insertions(+), 181 deletions(-)
> ---
> base-commit: f893c46c3931b3684d235d221bf8b7844ddbf1d7
> change-id: 20260703-catalina-upgrade-3eae7d9d7289
> 
> Best regards,
> --
> Emmanuel Blot <emmanuel.blot@free.fr>
> 

Applied 1-25 to

     https://github.com/legoater/qemu aspeed-next

Thanks,

C.
Re: [PATCH 00/29] hw/arm: improve Aspeed Catalina BMC emulation
Posted by Cédric Le Goater 1 week, 3 days ago
Hello Glenn

Could you please help reviewing the pca changes ?

Thanks,

C.

On 7/9/26 17:23, Emmanuel Blot wrote:
> This series improves emulation of the Aspeed-based Catalina BMC machine,
> mostly around its I2C buses: the GPIO expanders the board relies on and
> the temperature sensors sitting next to them.
> 
> The bulk of the work is on the PCA95xx I/O expander models. The existing
> PCA9552 and PCA9554 drivers only really covered the exact parts a couple
> of boards happened to use, and some of their register and pin behaviour
> did not match the datasheets. Catalina needs a few more variants and
> expects them to act like the real chips, so:
> 
>   - the PCA9552 driver now provides proper PCA9555/PCA9535 types, applies
>     input polarity inversion on reads, and handles the command register
>     as the datasheet describes (auto-increment and wrapping);
> 
>   - the PCA9554 driver gains the 4-bit PCA9536 variant, reflects
> push-pull
>     outputs back into the input register, and grows an opt-in mode that
>     honours the configured pin direction instead of forcing pins to
>     outputs;
> 
>   - both drivers expose each line as a "pinN" QOM property, which lets an
>     external actor drive an input pin. The property also allows reading
>     the value driven onto an output-configured pin, which is the more
>     useful capability, but nothing exercises it yet.
> 
> Along the way both models get a fair bit of cleanup (DEFINE_TYPES, the
> Resettable interface, state moved out of the headers, default
> descriptions derived from the instantiated type).
> 
> On the machine itself, Catalina now instantiates its PCA9555 expanders
> as their own type, gains the NIC and FIO temperature sensors present on
> real hardware, and drives the pca9554 expander input pins from outside
> the guest.
> 
> Finally, the register-level behaviour of both expanders is covered by
> new qtests, and the functional test that boots the OpenBMC image now
> exercises the expanders end to end, both through QOM and through the
> guest's gpio tooling.
> 
> Note that the "hw/i2c: parent slaves created with
> i2c_slave_create_simple"
> patch is only a temporary dependency here: it already belongs to the
> separate ADC128D818 series currently under review, and will be dropped
> from this series before it is submitted for final review.
> 
> Signed-off-by: Emmanuel Blot <emmanuel.blot@free.fr>
> ---
> Emmanuel Blot (29):
>        hw/gpio: pca9552: register types with DEFINE_TYPES()
>        hw/gpio: pca9552: move PCA955xState definition out of the header
>        hw/gpio: pca9552: rename I2CSlave member to parent_obj
>        hw/gpio: pca9552: default description to the instantiated type name
>        hw/gpio: pca9552: declare pca9555 device as an alias of pca9535 device
>        hw/gpio: pca9552: use the Resettable interface instead of legacy reset
>        hw/gpio: pca9552: apply input polarity inversion on read
>        hw/gpio: pca9552: conform GPIO command handling to the datasheet
>        hw/gpio: pca9552: expose GPIO pins as pin%d QOM properties
>        tests/qtest: add PCA9555 register access tests
>        tests/qtest: pca9555: test output-to-input reflection and pull-ups
>        tests/qtest: pca9555: test polarity inversion
>        tests/qtest: pca9555: test auto-increment and command wrapping
>        tests/qtest: pca9552: test behaviour specific to the LED variant
>        hw/gpio: pca9554: add PCA9536 support
>        hw/gpio: pca9554: add hw-dir property honoring the configured pin direction
>        hw/gpio: pca9554: reflect push-pull outputs in the input register
>        hw/gpio: pca9554: expose pin%d as a string property
>        tests/qtest: add PCA9554 register access tests
>        tests/qtest: pca9554: test output-to-input reflection and pull-ups
>        tests/qtest: pca9554: test polarity inversion
>        tests/qtest: pca9554: test absence of command auto-increment
>        tests/qtest: pca9554: test the PCA9536 4-bit variant
>        hw/arm: catalina: model PCA9555 IO expanders with their own type
>        hw/arm: catalina: add NIC and FIO temperature sensors
>        hw/i2c: parent slaves created with i2c_slave_create_simple
>        test/functional: catalina: test PCA9555 IO expander via QOM
>        hw/arm: catalina: drive pca9554 io expander input pins externally
>        test/functional: catalina: test PCA9554 IO expander via QOM
> 
>   hw/arm/aspeed_ast2600_catalina.c             |  67 ++++---
>   hw/gpio/pca9552.c                            | 256 ++++++++++++++++++++-------
>   hw/gpio/pca9554.c                            | 175 ++++++++++--------
>   hw/i2c/core.c                                |   3 +
>   include/hw/gpio/pca9552.h                    |  31 +---
>   include/hw/gpio/pca9554.h                    |   3 +
>   include/hw/i2c/i2c.h                         |   7 +-
>   tests/functional/arm/test_aspeed_catalina.py |  81 +++++++++
>   tests/qtest/meson.build                      |   2 +
>   tests/qtest/pca9552-test.c                   |  76 ++++++++
>   tests/qtest/pca9554-test.c                   | 223 +++++++++++++++++++++++
>   tests/qtest/pca9555-test.c                   | 251 ++++++++++++++++++++++++++
>   12 files changed, 994 insertions(+), 181 deletions(-)
> ---
> base-commit: f893c46c3931b3684d235d221bf8b7844ddbf1d7
> change-id: 20260703-catalina-upgrade-3eae7d9d7289
> 
> Best regards,
> --
> Emmanuel Blot <emmanuel.blot@free.fr>
>