[PATCH v8 0/8] update linux headers to v6.10-rc1 and shutdown support for pvpanic

Thomas Weißschuh posted 8 patches 6 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20240527-pvpanic-shutdown-v8-0-5a28ec02558b@t-8ch.de
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Cornelia Huck <cohuck@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Eric Blake <eblake@redhat.com>, Markus Armbruster <armbru@redhat.com>, Thomas Huth <thuth@redhat.com>, Laurent Vivier <lvivier@redhat.com>
docs/specs/pvpanic.rst                      |   2 +-
hw/misc/pvpanic-isa.c                       |   3 +-
hw/misc/pvpanic-pci.c                       |   3 +-
hw/misc/pvpanic.c                           |   8 +-
include/hw/misc/pvpanic.h                   |   4 +
include/standard-headers/linux/ethtool.h    |  55 +++++++++++
include/standard-headers/linux/pci_regs.h   |   6 ++
include/standard-headers/linux/pvpanic.h    |   7 +-
include/standard-headers/linux/virtio_bt.h  |   1 -
include/standard-headers/linux/virtio_mem.h |   2 +
include/standard-headers/linux/virtio_net.h | 143 ++++++++++++++++++++++++++++
include/sysemu/runstate.h                   |   1 +
linux-headers/asm-generic/unistd.h          |   5 +-
linux-headers/asm-loongarch/kvm.h           |   4 +
linux-headers/asm-mips/unistd_n32.h         |   1 +
linux-headers/asm-mips/unistd_n64.h         |   1 +
linux-headers/asm-mips/unistd_o32.h         |   1 +
linux-headers/asm-powerpc/unistd_32.h       |   1 +
linux-headers/asm-powerpc/unistd_64.h       |   1 +
linux-headers/asm-riscv/kvm.h               |   1 +
linux-headers/asm-s390/unistd_32.h          |   1 +
linux-headers/asm-s390/unistd_64.h          |   1 +
linux-headers/asm-x86/kvm.h                 |   4 +-
linux-headers/asm-x86/unistd_32.h           |   1 +
linux-headers/asm-x86/unistd_64.h           |   1 +
linux-headers/asm-x86/unistd_x32.h          |   2 +
linux-headers/linux/kvm.h                   |   4 +-
linux-headers/linux/stddef.h                |   8 ++
linux-headers/linux/vhost.h                 |  15 +--
qapi/run-state.json                         |  14 +++
scripts/update-linux-headers.sh             |   2 +-
system/runstate.c                           |   6 ++
tests/qtest/pvpanic-pci-test.c              |  44 ++++++++-
tests/qtest/pvpanic-test.c                  |  34 ++++++-
34 files changed, 361 insertions(+), 26 deletions(-)
[PATCH v8 0/8] update linux headers to v6.10-rc1 and shutdown support for pvpanic
Posted by Thomas Weißschuh 6 months ago
Shutdown requests are normally hardware dependent.
By extending pvpanic to also handle shutdown requests, guests can
submit such requests with an easily implementable and cross-platform
mechanism.

The background is the usage of minimal Linux kernels with different
architectures for testing purposes.
Poweroff support varies highly per architecture and requires a bunch of
code to be compiled to work.
pvpanic on the other hand is very small and uniform.

Patch 1 is a fix for scripts/update-linux-headers.sh
Patch 2 updates the bundled linux headers to Linux v6.10-rc1.

Patch 3 and 4 are general cleanups, which seem useful even without this
proposal being implemented.
They should also be ready to be picked up from the series on their own.

The remaining patches implement the new functionality and update the
docs.

The matching driver for Linux is part of Linux v6.10-rc1.

To: Michael S. Tsirkin <mst@redhat.com>
To: Cornelia Huck <cohuck@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
To: Thomas Huth <thuth@redhat.com>
To: Laurent Vivier <lvivier@redhat.com>
To: Eric Blake <eblake@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org
Cc: Alejandro Jimenez <alejandro.j.jimenez@oracle.com>
Cc: kvm@vger.kernel.org
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>

Changes in v8:
- Import linux headers from v6.10-rc1 (and update series subject)
- Use PVPANIC_SHUTDOWN from new linux headers
- Update Since: tag in QAPI to 9.1
- Link to v7: https://lore.kernel.org/r/20240323-pvpanic-shutdown-v7-0-4ac1fd546d6f@t-8ch.de

Changes in v7:
- Keep standard-header/pvpanic.h
- Predefine PVPANIC_SHUTDOWN in include/hw/misc/pvpanic.h
- Fix alignment in QAPI to comply with newly enforced layout
- Update Since: tag in QAPI to 9.0
- Drop note from pvpanic spec about missing implementation
- Link to v6: https://lore.kernel.org/r/20240208-pvpanic-shutdown-v6-0-965580ac057b@t-8ch.de

Changes in v6:
- Replace magic constant "4" in tests with PVPANIC_SHUTDOWN
- Link to v5: https://lore.kernel.org/r/20240129-pvpanic-shutdown-v5-0-f5a060b87c74@t-8ch.de

Changes in v5:
- Add patch from Alejandro to emit a QMP event.
- Update cover letter.
- Add tests.
- Link to v4: https://lore.kernel.org/r/20240107-pvpanic-shutdown-v4-0-81500a7e4081@t-8ch.de

Changes in v4:
- Rebase on 8.2 master
- Resend after tree reopened and holidays
- Link to v3: https://lore.kernel.org/r/20231129-pvpanic-shutdown-v3-0-c9a2892fc523@t-8ch.de

Changes in v3:
- Drop from Linux imported pvpanic header as discussed with Cornelia and
  requested by Greg
- Link to v2: https://lore.kernel.org/r/20231128-pvpanic-shutdown-v2-0-830393b45cb6@t-8ch.de

Changes in v2:
- Remove RFC status
- Add Ack from Thomas to 2nd patch
- Fix typo in title of 2nd patch
- Link to v1: https://lore.kernel.org/r/20231104-pvpanic-shutdown-v1-0-02353157891b@t-8ch.de

---
Alejandro Jimenez (1):
      pvpanic: Emit GUEST_PVSHUTDOWN QMP event on pvpanic shutdown signal

Thomas Weißschuh (7):
      scripts/update-linux-headers: Copy setup_data.h to correct directory
      linux-headers: update to 6.10-rc1
      hw/misc/pvpanic: centralize definition of supported events
      tests/qtest/pvpanic: use centralized definition of supported events
      hw/misc/pvpanic: add support for normal shutdowns
      tests/qtest/pvpanic: add tests for pvshutdown event
      Revert "docs/specs/pvpanic: mark shutdown event as not implemented"

 docs/specs/pvpanic.rst                      |   2 +-
 hw/misc/pvpanic-isa.c                       |   3 +-
 hw/misc/pvpanic-pci.c                       |   3 +-
 hw/misc/pvpanic.c                           |   8 +-
 include/hw/misc/pvpanic.h                   |   4 +
 include/standard-headers/linux/ethtool.h    |  55 +++++++++++
 include/standard-headers/linux/pci_regs.h   |   6 ++
 include/standard-headers/linux/pvpanic.h    |   7 +-
 include/standard-headers/linux/virtio_bt.h  |   1 -
 include/standard-headers/linux/virtio_mem.h |   2 +
 include/standard-headers/linux/virtio_net.h | 143 ++++++++++++++++++++++++++++
 include/sysemu/runstate.h                   |   1 +
 linux-headers/asm-generic/unistd.h          |   5 +-
 linux-headers/asm-loongarch/kvm.h           |   4 +
 linux-headers/asm-mips/unistd_n32.h         |   1 +
 linux-headers/asm-mips/unistd_n64.h         |   1 +
 linux-headers/asm-mips/unistd_o32.h         |   1 +
 linux-headers/asm-powerpc/unistd_32.h       |   1 +
 linux-headers/asm-powerpc/unistd_64.h       |   1 +
 linux-headers/asm-riscv/kvm.h               |   1 +
 linux-headers/asm-s390/unistd_32.h          |   1 +
 linux-headers/asm-s390/unistd_64.h          |   1 +
 linux-headers/asm-x86/kvm.h                 |   4 +-
 linux-headers/asm-x86/unistd_32.h           |   1 +
 linux-headers/asm-x86/unistd_64.h           |   1 +
 linux-headers/asm-x86/unistd_x32.h          |   2 +
 linux-headers/linux/kvm.h                   |   4 +-
 linux-headers/linux/stddef.h                |   8 ++
 linux-headers/linux/vhost.h                 |  15 +--
 qapi/run-state.json                         |  14 +++
 scripts/update-linux-headers.sh             |   2 +-
 system/runstate.c                           |   6 ++
 tests/qtest/pvpanic-pci-test.c              |  44 ++++++++-
 tests/qtest/pvpanic-test.c                  |  34 ++++++-
 34 files changed, 361 insertions(+), 26 deletions(-)
---
base-commit: 60b54b67c63d8f076152e0f7dccf39854dfc6a77
change-id: 20231104-pvpanic-shutdown-02e4b4cb4949

Best regards,
-- 
Thomas Weißschuh <thomas@t-8ch.de>