The capabilities reporting merged for TDX was flawed because
it would always report TDX as supported simply if QEMU was
new enough to have 'tdx-guest'.

Unfortunately the 'query-tdx-capabilities' QMP command that
was in early postings:

https://mail.gnu.org/archive/html/qemu-devel/2021-07/msg01689.html

went missing and I'm not seeing an alternative way to query
QEMU to see if TDX is actually launchable. So in these patches
I open /dev/kvm and directly ask of the 'TDX' VM type is
supported by KVM, which IIUC is equivalent to waht the original
'query-tdx-capabilities' patch was doing.

In v2:

 * Unconditionally report TDX on all arches
 * Also unconditionally report s390 prot-virt on all arches
 * Use VIR_AUTOCLOSE
 * Sanity check ioctl return status < 0
 * Remove dead error reporting paths
 * Add missing ioctl.h header include

Daniel P. Berrangé (3):
  qemu: correctly detect working TDX support
  qemu: always report TDX feature caps on x86
  qemu: always report s390 prot-virt feature in domain caps

 src/qemu/qemu_capabilities.c                  | 70 ++++++++++++++++---
 src/qemu/qemu_capabilities.h                  |  3 +
 .../qemu_10.0.0-q35.x86_64+amdsev.xml         |  2 +
 .../domaincapsdata/qemu_10.0.0-q35.x86_64.xml |  2 +
 .../qemu_10.0.0-tcg.x86_64+amdsev.xml         |  2 +
 .../domaincapsdata/qemu_10.0.0-tcg.x86_64.xml |  2 +
 .../qemu_10.0.0-virt.aarch64.xml              |  2 +
 tests/domaincapsdata/qemu_10.0.0.aarch64.xml  |  2 +
 tests/domaincapsdata/qemu_10.0.0.ppc64.xml    |  2 +
 tests/domaincapsdata/qemu_10.0.0.s390x.xml    |  1 +
 .../qemu_10.0.0.x86_64+amdsev.xml             |  2 +
 tests/domaincapsdata/qemu_10.0.0.x86_64.xml   |  2 +
 .../qemu_10.1.0-q35.x86_64+inteltdx.xml       |  1 +
 .../domaincapsdata/qemu_10.1.0-q35.x86_64.xml |  1 +
 .../qemu_10.1.0-tcg.x86_64+inteltdx.xml       |  2 +
 .../domaincapsdata/qemu_10.1.0-tcg.x86_64.xml |  2 +
 .../qemu_10.1.0.x86_64+inteltdx.xml           |  1 +
 tests/domaincapsdata/qemu_10.1.0.x86_64.xml   |  1 +
 .../qemu_10.2.0-q35.x86_64+mshv.xml           |  1 +
 .../domaincapsdata/qemu_10.2.0-q35.x86_64.xml |  1 +
 .../qemu_10.2.0-tcg.x86_64+mshv.xml           |  2 +
 .../domaincapsdata/qemu_10.2.0-tcg.x86_64.xml |  2 +
 .../qemu_10.2.0.x86_64+mshv.xml               |  1 +
 tests/domaincapsdata/qemu_10.2.0.x86_64.xml   |  1 +
 .../domaincapsdata/qemu_6.2.0-q35.x86_64.xml  |  2 +
 .../domaincapsdata/qemu_6.2.0-tcg.x86_64.xml  |  2 +
 tests/domaincapsdata/qemu_6.2.0.ppc64.xml     |  2 +
 tests/domaincapsdata/qemu_6.2.0.x86_64.xml    |  2 +
 .../domaincapsdata/qemu_7.0.0-q35.x86_64.xml  |  2 +
 .../domaincapsdata/qemu_7.0.0-tcg.x86_64.xml  |  2 +
 tests/domaincapsdata/qemu_7.0.0.ppc64.xml     |  2 +
 tests/domaincapsdata/qemu_7.0.0.x86_64.xml    |  2 +
 .../domaincapsdata/qemu_7.1.0-q35.x86_64.xml  |  2 +
 .../domaincapsdata/qemu_7.1.0-tcg.x86_64.xml  |  2 +
 tests/domaincapsdata/qemu_7.1.0.ppc64.xml     |  2 +
 tests/domaincapsdata/qemu_7.1.0.x86_64.xml    |  2 +
 .../qemu_7.2.0-hvf.x86_64+hvf.xml             |  2 +
 .../domaincapsdata/qemu_7.2.0-q35.x86_64.xml  |  2 +
 .../qemu_7.2.0-tcg.x86_64+hvf.xml             |  2 +
 .../domaincapsdata/qemu_7.2.0-tcg.x86_64.xml  |  2 +
 tests/domaincapsdata/qemu_7.2.0.ppc.xml       |  2 +
 tests/domaincapsdata/qemu_7.2.0.x86_64.xml    |  2 +
 .../domaincapsdata/qemu_8.0.0-q35.x86_64.xml  |  2 +
 .../domaincapsdata/qemu_8.0.0-tcg.x86_64.xml  |  2 +
 tests/domaincapsdata/qemu_8.0.0.x86_64.xml    |  2 +
 .../domaincapsdata/qemu_8.1.0-q35.x86_64.xml  |  2 +
 .../domaincapsdata/qemu_8.1.0-tcg.x86_64.xml  |  2 +
 tests/domaincapsdata/qemu_8.1.0.s390x.xml     |  1 +
 tests/domaincapsdata/qemu_8.1.0.x86_64.xml    |  2 +
 .../domaincapsdata/qemu_8.2.0-q35.x86_64.xml  |  2 +
 .../qemu_8.2.0-tcg-virt.loongarch64.xml       |  2 +
 .../domaincapsdata/qemu_8.2.0-tcg.x86_64.xml  |  2 +
 .../qemu_8.2.0-virt.aarch64.xml               |  2 +
 .../qemu_8.2.0-virt.loongarch64.xml           |  2 +
 tests/domaincapsdata/qemu_8.2.0.aarch64.xml   |  2 +
 tests/domaincapsdata/qemu_8.2.0.armv7l.xml    |  2 +
 tests/domaincapsdata/qemu_8.2.0.s390x.xml     |  1 +
 tests/domaincapsdata/qemu_8.2.0.x86_64.xml    |  2 +
 .../domaincapsdata/qemu_9.0.0-q35.x86_64.xml  |  2 +
 .../domaincapsdata/qemu_9.0.0-tcg.x86_64.xml  |  2 +
 tests/domaincapsdata/qemu_9.0.0.sparc.xml     |  2 +
 tests/domaincapsdata/qemu_9.0.0.x86_64.xml    |  2 +
 .../domaincapsdata/qemu_9.1.0-q35.x86_64.xml  |  2 +
 .../qemu_9.1.0-tcg-virt.riscv64.xml           |  2 +
 .../domaincapsdata/qemu_9.1.0-tcg.x86_64.xml  |  2 +
 .../qemu_9.1.0-virt.riscv64.xml               |  2 +
 tests/domaincapsdata/qemu_9.1.0.s390x.xml     |  1 +
 tests/domaincapsdata/qemu_9.1.0.x86_64.xml    |  2 +
 .../qemu_9.2.0-hvf.aarch64+hvf.xml            |  2 +
 .../qemu_9.2.0-q35.x86_64+amdsev.xml          |  2 +
 .../domaincapsdata/qemu_9.2.0-q35.x86_64.xml  |  2 +
 .../qemu_9.2.0-tcg.x86_64+amdsev.xml          |  2 +
 .../domaincapsdata/qemu_9.2.0-tcg.x86_64.xml  |  2 +
 tests/domaincapsdata/qemu_9.2.0.s390x.xml     |  1 +
 .../qemu_9.2.0.x86_64+amdsev.xml              |  2 +
 tests/domaincapsdata/qemu_9.2.0.x86_64.xml    |  2 +
 tests/domaincapsmock.c                        |  6 ++
 77 files changed, 205 insertions(+), 9 deletions(-)

-- 
2.51.1

Reply via email to