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

Joe Komlodi posted 6 patches 2 years, 4 months ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20211216015417.1234812-1-komlodi@google.com
Maintainers: Peter Maydell <peter.maydell@linaro.org>, Thomas Huth <thuth@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Havard Skinnemoen <hskinnemoen@google.com>, Tyrone Ting <kfting@nuvoton.com>, Laurent Vivier <lvivier@redhat.com>
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
[RFC PATCH 0/6] Introduce GPIO transmitter and connect to NPCM7xx
Posted by Joe Komlodi 2 years, 4 months ago
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

-- 
2.34.1.173.g76aa8bc2d0-goog


Re: [RFC PATCH 0/6] Introduce GPIO transmitter and connect to NPCM7xx
Posted by Philippe Mathieu-Daudé 2 years, 4 months ago
+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
>