mbox series

[RFC,0/6] Introduce GPIO transmitter and connect to NPCM7xx

Message ID 20211216015417.1234812-1-komlodi@google.com (mailing list archive)
Headers show
Series Introduce GPIO transmitter and connect to NPCM7xx | expand

Message

Joe Komlodi Dec. 16, 2021, 1:54 a.m. UTC
Hi all,

This series introduces a GPIO transmitter, which allows the transmission
of GPIO controller pin state over chardev, and attaches it to the NPCM7xx
GPIO controller.

The GPIO transmitter takes in a GPIO controller number and a bitfield
containing the GPIO state of that controller, then formats a packet and
sends it via chardev to whomever is listening for it.
The purpose of this is for external software to receive the packet and
interpret it so it can do any actions it needs to, based on GPIO state.

For example, in our use case, we have a VM manager managing an x86 guest
and an ARM (NPCM7xx) guest. On real hardware, the ARM SoC is a BMC which
has some power control over the x86 SoC.
Because of this, we need to relay GPIO power events from the BMC to the
x86 machine (i.e. reset, power off, etc), so we have software read in
the GPIO transmitter packets, keep track of what power state the x86
machine is in based on the GPIO state of the BMC, and notify the VM
manager of any important changes.
The VM manager can then power up/down and reset the x86 machine as
needed.

Thanks!
Joe

Joe Komlodi (6):
  hw/gpio/gpio_transmitter: Add Device
  hw/gpio/gpio_transmitter: Add allowlist
  hw/gpio/npcm7xx: Number controllers
  hw/arm/npcm7xx: gpio: Add GPIO transmitter
  hw/gpio/npcm7xx: init GPIO transmitter allowlist
  qtests/gpio_transmitter: Add test

 hw/arm/Kconfig                            |   1 +
 hw/arm/npcm7xx.c                          |   8 +
 hw/gpio/Kconfig                           |   3 +
 hw/gpio/google_gpio_transmitter.c         | 249 ++++++++++++++++++++++
 hw/gpio/meson.build                       |   1 +
 hw/gpio/npcm7xx_gpio.c                    |  25 +++
 include/hw/arm/npcm7xx.h                  |   2 +
 include/hw/gpio/google_gpio_transmitter.h |  66 ++++++
 include/hw/gpio/npcm7xx_gpio.h            |   4 +
 tests/qtest/google_gpio_tx-test.c         | 216 +++++++++++++++++++
 tests/qtest/meson.build                   |   1 +
 11 files changed, 576 insertions(+)
 create mode 100644 hw/gpio/google_gpio_transmitter.c
 create mode 100644 include/hw/gpio/google_gpio_transmitter.h
 create mode 100644 tests/qtest/google_gpio_tx-test.c

Comments

Philippe Mathieu-Daudé Dec. 16, 2021, 9:24 a.m. UTC | #1
+Marc-André (chardev) & Dave

On 12/16/21 02:54, Joe Komlodi wrote:
> Hi all,
> 
> This series introduces a GPIO transmitter, which allows the transmission
> of GPIO controller pin state over chardev, and attaches it to the NPCM7xx
> GPIO controller.
> 
> The GPIO transmitter takes in a GPIO controller number and a bitfield
> containing the GPIO state of that controller, then formats a packet and
> sends it via chardev to whomever is listening for it.
> The purpose of this is for external software to receive the packet and
> interpret it so it can do any actions it needs to, based on GPIO state.
> 
> For example, in our use case, we have a VM manager managing an x86 guest
> and an ARM (NPCM7xx) guest. On real hardware, the ARM SoC is a BMC which
> has some power control over the x86 SoC.
> Because of this, we need to relay GPIO power events from the BMC to the
> x86 machine (i.e. reset, power off, etc), so we have software read in
> the GPIO transmitter packets, keep track of what power state the x86
> machine is in based on the GPIO state of the BMC, and notify the VM
> manager of any important changes.
> The VM manager can then power up/down and reset the x86 machine as
> needed.
> 
> Thanks!
> Joe
> 
> Joe Komlodi (6):
>   hw/gpio/gpio_transmitter: Add Device
>   hw/gpio/gpio_transmitter: Add allowlist
>   hw/gpio/npcm7xx: Number controllers
>   hw/arm/npcm7xx: gpio: Add GPIO transmitter
>   hw/gpio/npcm7xx: init GPIO transmitter allowlist
>   qtests/gpio_transmitter: Add test
> 
>  hw/arm/Kconfig                            |   1 +
>  hw/arm/npcm7xx.c                          |   8 +
>  hw/gpio/Kconfig                           |   3 +
>  hw/gpio/google_gpio_transmitter.c         | 249 ++++++++++++++++++++++
>  hw/gpio/meson.build                       |   1 +
>  hw/gpio/npcm7xx_gpio.c                    |  25 +++
>  include/hw/arm/npcm7xx.h                  |   2 +
>  include/hw/gpio/google_gpio_transmitter.h |  66 ++++++
>  include/hw/gpio/npcm7xx_gpio.h            |   4 +
>  tests/qtest/google_gpio_tx-test.c         | 216 +++++++++++++++++++
>  tests/qtest/meson.build                   |   1 +
>  11 files changed, 576 insertions(+)
>  create mode 100644 hw/gpio/google_gpio_transmitter.c
>  create mode 100644 include/hw/gpio/google_gpio_transmitter.h
>  create mode 100644 tests/qtest/google_gpio_tx-test.c
>