Re: [PATCH v2 4/6] docs/about/deprecated: Deprecate the qemu-system-arm binary

2023-03-02 Thread Thomas Huth

On 02/03/2023 23.16, Philippe Mathieu-Daudé wrote:

On 2/3/23 17:31, Thomas Huth wrote:

qemu-system-aarch64 is a proper superset of qemu-system-arm,
and the latter was mainly still required for 32-bit KVM support.
But this 32-bit KVM arm support has been dropped in the Linux
kernel a couple of years ago already, so we don't really need
qemu-system-arm anymore, thus deprecated it now.

Signed-off-by: Thomas Huth 
---
  docs/about/deprecated.rst | 10 ++
  1 file changed, 10 insertions(+)

diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
index a30aa8dfdf..21ce70b5c9 100644
--- a/docs/about/deprecated.rst
+++ b/docs/about/deprecated.rst
@@ -45,6 +45,16 @@ run 32-bit guests by selecting a 32-bit CPU model, 
including KVM support

  on x86_64 hosts. Thus users are recommended to reconfigure their systems
  to use the ``qemu-system-x86_64`` binary instead.
+``qemu-system-arm`` binary (since 8.0)
+''
+
+``qemu-system-aarch64`` is a proper superset of ``qemu-system-arm``. The
+latter was mainly a requirement for running KVM on 32-bit arm hosts, but
+this 32-bit KVM support has been removed some years ago already (see:


s/some/few/?


I can also use "three years ago" since the patch had been merged in March 2020.

+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=541ad0150ca4 


+). Thus the QEMU project will drop the ``qemu-system-arm`` binary in a
+future release. Use ``qemu-system-aarch64`` instead.


If we unify, wouldn't it be simpler to name the single qemu-system
binary emulating various ARM architectures as 'qemu-system-arm'?


That would be more intuitive for people who are completely new to QEMU, but 
I guess it will cause a lot of "you broke my script that uses the -aarch64 
binary" troubles again. So I think it's likely better to not go down that road.


 Thomas



Re: [PATCH] security: Add support for SUSE edk2 firmware paths

2023-03-02 Thread Jim Fehlig

On 3/2/23 07:43, Andrea Bolognani wrote:

On Thu, Feb 23, 2023 at 11:13:28AM -0700, Jim Fehlig wrote:

+++ b/src/security/apparmor/libvirt-qemu
@@ -91,7 +91,7 @@
/usr/share/proll/** r,
/usr/share/qemu-efi/** r,
/usr/share/qemu-kvm/** r,
-  /usr/share/qemu/** r,
+  /usr/share/qemu/** rk,
/usr/share/seabios/** r,
/usr/share/sgabios/** r,
/usr/share/slof/** r,
+++ b/src/security/virt-aa-helper.c
@@ -481,6 +481,7 @@ valid_path(const char *path, const bool readonly)
  "/usr/share/AAVMF/", /* for AAVMF images */
  "/usr/share/qemu-efi/",  /* for AAVMF images */
  "/usr/share/qemu-efi-aarch64/",  /* for AAVMF images */
+"/usr/share/qemu/",  /* SUSE path for OVMF and AAVMF 
images */
  "/usr/lib/u-boot/",  /* u-boot loaders for qemu */
  "/usr/lib/riscv64-linux-gnu/opensbi" /* RISC-V SBI implementation */


Having these files in /usr/share/qemu directly looks... Kinda
sketchy? That directory should belong to the QEMU package. Compare
with how all the other paths listed here point to directories that
are specific to the firmware at hand.

I don't think this really opens up any attack vectors, so


Agree. FYI, I don't know the history behind choosing that location. Probably 
because it contained other firmware files.



   Reviewed-by: Andrea Bolognani 

but perhaps it would be a good idea to consider migrating edk2 images
to their own directory long term?


I think so. A task for the future, when we have a dedicated edk2 maintainer.

Regards,
Jim



Re: [PATCH v2 4/6] docs/about/deprecated: Deprecate the qemu-system-arm binary

2023-03-02 Thread Philippe Mathieu-Daudé

On 2/3/23 17:31, Thomas Huth wrote:

qemu-system-aarch64 is a proper superset of qemu-system-arm,
and the latter was mainly still required for 32-bit KVM support.
But this 32-bit KVM arm support has been dropped in the Linux
kernel a couple of years ago already, so we don't really need
qemu-system-arm anymore, thus deprecated it now.

Signed-off-by: Thomas Huth 
---
  docs/about/deprecated.rst | 10 ++
  1 file changed, 10 insertions(+)

diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
index a30aa8dfdf..21ce70b5c9 100644
--- a/docs/about/deprecated.rst
+++ b/docs/about/deprecated.rst
@@ -45,6 +45,16 @@ run 32-bit guests by selecting a 32-bit CPU model, including 
KVM support
  on x86_64 hosts. Thus users are recommended to reconfigure their systems
  to use the ``qemu-system-x86_64`` binary instead.
  
+``qemu-system-arm`` binary (since 8.0)

+''
+
+``qemu-system-aarch64`` is a proper superset of ``qemu-system-arm``. The
+latter was mainly a requirement for running KVM on 32-bit arm hosts, but
+this 32-bit KVM support has been removed some years ago already (see:


s/some/few/?


+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=541ad0150ca4
+). Thus the QEMU project will drop the ``qemu-system-arm`` binary in a
+future release. Use ``qemu-system-aarch64`` instead.


If we unify, wouldn't it be simpler to name the single qemu-system
binary emulating various ARM architectures as 'qemu-system-arm'?



Re: [PATCH v2 0/6] Deprecate support for 32-bit x86 and arm hosts

2023-03-02 Thread Philippe Mathieu-Daudé

On 2/3/23 17:31, Thomas Huth wrote:

We're struggling quite badly with our CI minutes on the shared
gitlab runners, so we urgently need to think of ways to cut down
our supported build and target environments. qemu-system-i386 and
qemu-system-arm are not really required anymore, since nobody uses
KVM on the corresponding systems for production anymore, and the
-x86_64 and -arch64 variants are a proper superset of those binaries.
So it's time to deprecate them and the corresponding 32-bit host
environments now.

This is a follow-up patch series from the previous discussion here:

  https://lore.kernel.org/qemu-devel/20230130114428.1297295-1-th...@redhat.com/

where people still mentioned that there is still interest in certain
support for 32-bit host hardware. But as far as I could see, there is
no real need for 32-bit x86 host support and for system emulation on
32-bit arm hosts anymore, so it should be fine if we drop these host
environments soon (these are also the two architectures that contribute
the most to the long test times in our CI, so we would benefit a lot by
dropping those).


It is not clear from your cover that the deprecation only concern system
emulation on these hosts, not user emulation.

I wonder about tools. Apparently they depend on sysemu now. I was
building a 'configure --enable-tools --disable-system' but now it
is empty.



Re: [PATCH v2 6/6] gitlab-ci.d/crossbuilds: Drop the 32-bit arm system emulation jobs

2023-03-02 Thread Philippe Mathieu-Daudé

On 2/3/23 17:31, Thomas Huth wrote:

Hardly anybody still uses 32-bit arm environments for running QEMU,
so let's stop wasting our scarce CI minutes with these jobs.

Signed-off-by: Thomas Huth 
---
  .gitlab-ci.d/crossbuilds.yml | 14 --
  1 file changed, 14 deletions(-)


Reviewed-by: Philippe Mathieu-Daudé 



Re: [libvirt PATCH 17/20] ci: build.sh: Make the script executable

2023-03-02 Thread Daniel P . Berrangé
On Mon, Feb 06, 2023 at 02:53:14PM +0100, Erik Skultety wrote:
> Unless we run it as 'sh ci/build.sh' in .gitlab-ci.yml recipes and
> instead opt into doing 'chmod +x && ci/build.sh' it will cause meson
> dist build to fail with a fatal error about having uncommitted changes
> in the repo. Therefore, let's just make the script executable, it's the
> most straightforward solution.
> 
> Signed-off-by: Erik Skultety 
> ---
>  ci/build.sh | 0
>  1 file changed, 0 insertions(+), 0 deletions(-)
>  mode change 100644 => 100755 ci/build.sh
> 
> diff --git a/ci/build.sh b/ci/build.sh
> old mode 100644
> new mode 100755

Reviewed-by: Daniel P. Berrangé 

With regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|



Re: [libvirt PATCH 09/20] ci: build.sh: Join MESON_ARGS and MESON_OPTS

2023-03-02 Thread Daniel P . Berrangé
On Mon, Feb 06, 2023 at 02:53:06PM +0100, Erik Skultety wrote:
> It is quite confusing seeing these two in a call like this one:
> $ meson build $MESON_OPTS $MESON_ARGS
> 
> One has to ask 'how are they different' and 'shouldn't these be
> merged'. In fact, these variables hold very different things and we
> should make it more obvious. The problem is that renaming MESON_OPTS to
> something more meaningful, like 'MESON_CROSS_OPTS' which is what
> MESON_OPTS really does would require changes to lcitool and would
> impact Dockerfile generation which in turn might have an impact on
> other projects which rely on this lcitool functionality which is risky.
> 
> Instead, provide a docstring for the former tu supplement the latter

s/tu/to/

> and join the two variables in a single one MESON_ARGS which is then
> passed to meson's command line so it's a little less confusing.
> 
> Signed-off-by: Erik Skultety 
> ---
>  ci/build.sh | 9 -
>  1 file changed, 8 insertions(+), 1 deletion(-)

Reviewed-by: Daniel P. Berrangé 

With regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|



Re: [libvirt PATCH 07/20] ci: build.sh: Drop the CI prefix from the CI_{MESON, NINJA}_ARGS vars

2023-03-02 Thread Daniel P . Berrangé
On Mon, Feb 06, 2023 at 02:53:04PM +0100, Erik Skultety wrote:
> Although it is currently consistent with the other variables we define
> when running ci in a local container environment, it isn't consistent
> with the variable naming we use in GitLab recipes. Since the idea is
> to unite the two, we're likely going to drop a few other variables from
> the local env configuration anyway, hence this renaming.

The namespacing originated with & was only relevant when we were
still using the old automake system, as it let is 'include ci/Makefile'
without risk of it clashing with automake variables. So yeah, fine for
it to go.

> Signed-off-by: Erik Skultety 
> ---
>  ci/Makefile | 4 ++--
>  ci/build.sh | 4 ++--
>  ci/helper   | 4 ++--
>  3 files changed, 6 insertions(+), 6 deletions(-)

Reviewed-by: Daniel P. Berrangé 


With regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|



Re: [libvirt PATCH 06/20] ci: build.sh: Always assume -Dsystem=true

2023-03-02 Thread Daniel P . Berrangé
On Mon, Feb 06, 2023 at 02:53:03PM +0100, Erik Skultety wrote:
> There's no harm in always building in system mode, i.e. setting the
> right paths.
> 
> Signed-off-by: Erik Skultety 
> ---
>  ci/build.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Daniel P. Berrangé 


With regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|



Re: [libvirt PATCH 05/20] ci: build.sh: Use 'meson setup' explicitly

2023-03-02 Thread Daniel P . Berrangé
On Mon, Feb 06, 2023 at 02:53:02PM +0100, Erik Skultety wrote:
> Even though 'setup' is assumed when no other command is given, we're
> being explicit in our GitLab recipes, so do the same for the local
> build.sh script too.

It is actually gouing to become mandatory soon based
on the warnings shown in recent meson

WARNING: Running the setup command as `meson [options]` instead of `meson setup 
[options]` is ambiguous and deprecated.

so if there are any other places across projects with this
old syntax we'll need to flush them out too.

> Signed-off-by: Erik Skultety 
> ---
>  ci/build.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Daniel P. Berrangé 

> 
> diff --git a/ci/build.sh b/ci/build.sh
> index 3fa28eafa8..c7cba6ffa8 100644
> --- a/ci/build.sh
> +++ b/ci/build.sh
> @@ -8,7 +8,7 @@ export VIR_TEST_DEBUG=1
>  # populated at build time from the Dockerfile. A typical use case would
>  # be to pass options to trigger cross-compilation
>  
> -meson build --werror $MESON_OPTS $CI_MESON_ARGS || \
> +meson setup build --werror $MESON_OPTS $CI_MESON_ARGS || \
>  (cat build/meson-logs/meson-log.txt && exit 1)
>  
>  ninja -C build $CI_NINJA_ARGS
> -- 
> 2.39.1
> 

With regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|



Re: [libvirt PATCH 04/20] ci: build.sh: Drop the commentary about CI_BUILD_SCRIPT

2023-03-02 Thread Daniel P . Berrangé
On Mon, Feb 06, 2023 at 02:53:01PM +0100, Erik Skultety wrote:
> build.sh is not the place where this should be mentioned as the
> official entrypoint for this script locally is ci/helper which can
> download the right image from our upstream CI registry. Since the idea
> is to ultimately drop the usage of a Makefile for the local executions,
> this patch doesn't provide an alternative place for the comment in
> question as the functionality is going to be altered substantially in
> the future.
> 
> Signed-off-by: Erik Skultety 
> ---
>  ci/build.sh | 9 -
>  1 file changed, 9 deletions(-)

Reviewed-by: Daniel P. Berrangé 


With regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|



Re: [libvirt PATCH 03/20] gitlab-ci.yml: Use $HOME for rpmbuild's topdir instead of PWD

2023-03-02 Thread Daniel P . Berrangé
On Mon, Feb 06, 2023 at 02:53:00PM +0100, Erik Skultety wrote:
> Signed-off-by: Erik Skultety 
> ---
>  .gitlab-ci.yml | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Daniel P. Berrangé 


With regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|



Re: [libvirt PATCH 02/20] gitlab-ci.yml: potfile: Consolidate the meson compile calls

2023-03-02 Thread Daniel P . Berrangé
On Mon, Feb 06, 2023 at 02:52:59PM +0100, Erik Skultety wrote:
> You can specify multiple targets at once for the 'compile' command.
> 
> Signed-off-by: Erik Skultety 
> ---
>  .gitlab-ci.yml | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
> index 699be460ca..e20d0b9be8 100644
> --- a/.gitlab-ci.yml
> +++ b/.gitlab-ci.yml
> @@ -153,8 +153,7 @@ potfile:
>  - *script_variables
>script:
>  - meson setup build --werror || (cat build/meson-logs/meson-log.txt && 
> exit 1)
> -- meson compile -C build libvirt-pot-dep
> -- meson compile -C build libvirt-pot
> +- meson compile -C build libvirt-pot-dep libvirt-pot

while possible i think its better to keep them separate so when
things fail you see which of the two commands was the failure
straight away.

With regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|



Re: [libvirt PATCH 01/20] gitlab-ci.yml: Replace all explicit calls to ninja with meson commands

2023-03-02 Thread Daniel P . Berrangé
On Mon, Feb 06, 2023 at 02:52:58PM +0100, Erik Skultety wrote:
> This is continuation of what commit b56e2be68e3 started. If we stick to
> only calling meson commands directly, we can achieve much better
> consistency in passing arguments to meson especially if we unify the
> recipes run in gitlab CI and what we can currently run locally in
> containers using docker/podman.
> 
> Signed-off-by: Erik Skultety 
> ---
>  .gitlab-ci.yml | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)

Reviewed-by: Daniel P. Berrangé 


With regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|



Re: [PATCH v2 6/6] gitlab-ci.d/crossbuilds: Drop the 32-bit arm system emulation jobs

2023-03-02 Thread Daniel P . Berrangé
On Thu, Mar 02, 2023 at 05:31:06PM +0100, Thomas Huth wrote:
> Hardly anybody still uses 32-bit arm environments for running QEMU,
> so let's stop wasting our scarce CI minutes with these jobs.
> 
> Signed-off-by: Thomas Huth 
> ---
>  .gitlab-ci.d/crossbuilds.yml | 14 --
>  1 file changed, 14 deletions(-)

Reviewed-by: Daniel P. Berrangé 


With regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|



Re: [PATCH v2 5/6] docs/about/deprecated: Deprecate 32-bit arm hosts

2023-03-02 Thread Daniel P . Berrangé
On Thu, Mar 02, 2023 at 05:31:05PM +0100, Thomas Huth wrote:
> For running QEMU in system emulation mode, the user needs a rather
> strong host system, i.e. not only an embedded low-frequency controller.
> All recent beefy arm host machines should support 64-bit now, it's
> unlikely that anybody is still seriously using QEMU on a 32-bit arm
> CPU, so we deprecate the 32-bit arm hosts here to finally save use
> some time and precious CI minutes.
> 
> Signed-off-by: Thomas Huth 
> ---
>  docs/about/deprecated.rst | 9 +
>  1 file changed, 9 insertions(+)

Reviewed-by: Daniel P. Berrangé 

> diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
> index 21ce70b5c9..c7113a7510 100644
> --- a/docs/about/deprecated.rst
> +++ b/docs/about/deprecated.rst
> @@ -229,6 +229,15 @@ discontinue it. Since all recent x86 hardware from the 
> past >10 years
>  is capable of the 64-bit x86 extensions, a corresponding 64-bit OS
>  should be used instead.
>  
> +System emulation on 32-bit arm hosts (since 8.0)
> +
> +
> +Since QEMU needs a strong host machine for running full system emulation, and
> +all recent powerful arm hosts support 64-bit, the QEMU project deprecates the
> +support for running any system emulation on 32-bit arm hosts in general. Use
> +64-bit arm hosts for system emulation instead. (Note: "user" mode emulation
> +continuous to be supported on 32-bit arm hosts, too)

s/continuous/continues/

s/,too/, as well as command line tools like qemu-img, qemu-nbd, etc/

> +
>  
>  QEMU API (QAPI) events
>  --
> -- 
> 2.31.1
> 

With regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|



Re: [PATCH v2 3/6] gitlab-ci.d/crossbuilds: Drop the i386 jobs

2023-03-02 Thread Daniel P . Berrangé
On Thu, Mar 02, 2023 at 05:31:03PM +0100, Thomas Huth wrote:
> Hardly anybody still uses 32-bit x86 environments for running QEMU,
> so let's stop wasting our scarce CI minutes with these jobs.
> 
> Signed-off-by: Thomas Huth 
> ---
>  .gitlab-ci.d/crossbuilds.yml | 16 
>  1 file changed, 16 deletions(-)

Reviewed-by: Daniel P. Berrangé 

There's still the mingw 32-bit x86 build, but probably wolrth
keeping that until we actually stop 32-bit from a technical
POV, because Stefan still publishes the 32-bit windows
installers currently

Similarly  the dockerfile can stay in case someone wants to
reproduce a flaw locally

Reviewed-by: Daniel P. Berrangé 


> diff --git a/.gitlab-ci.d/crossbuilds.yml b/.gitlab-ci.d/crossbuilds.yml
> index 101416080c..3ce51adf77 100644
> --- a/.gitlab-ci.d/crossbuilds.yml
> +++ b/.gitlab-ci.d/crossbuilds.yml
> @@ -43,22 +43,6 @@ cross-arm64-user:
>variables:
>  IMAGE: debian-arm64-cross
>  
> -cross-i386-system:
> -  extends: .cross_system_build_job
> -  needs:
> -job: i386-fedora-cross-container
> -  variables:
> -IMAGE: fedora-i386-cross
> -MAKE_CHECK_ARGS: check-qtest
> -
> -cross-i386-user:
> -  extends: .cross_user_build_job
> -  needs:
> -job: i386-fedora-cross-container
> -  variables:
> -IMAGE: fedora-i386-cross
> -MAKE_CHECK_ARGS: check
> -
>  cross-i386-tci:
>extends: .cross_accel_build_job
>timeout: 60m
> -- 
> 2.31.1
> 

With regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|



Re: [PATCH v2 4/6] docs/about/deprecated: Deprecate the qemu-system-arm binary

2023-03-02 Thread Daniel P . Berrangé
On Thu, Mar 02, 2023 at 05:31:04PM +0100, Thomas Huth wrote:
> qemu-system-aarch64 is a proper superset of qemu-system-arm,
> and the latter was mainly still required for 32-bit KVM support.
> But this 32-bit KVM arm support has been dropped in the Linux
> kernel a couple of years ago already, so we don't really need
> qemu-system-arm anymore, thus deprecated it now.
> 
> Signed-off-by: Thomas Huth 
> ---
>  docs/about/deprecated.rst | 10 ++
>  1 file changed, 10 insertions(+)

Reviewed-by: Daniel P. Berrangé 


With regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|



Re: [PATCH v2 2/6] docs/about/deprecated: Deprecate 32-bit x86 hosts

2023-03-02 Thread Daniel P . Berrangé
On Thu, Mar 02, 2023 at 05:31:02PM +0100, Thomas Huth wrote:
> Hardly anybody still uses 32-bit x86 hosts today, so we should start
> deprecating them to stop wasting our time and CI minutes here.
> For example, there are also still some unresolved problems with these:
> When emulating 64-bit binaries in user mode, TCG does not honor atomicity
> for 64-bit accesses, which is "perhaps worse than not working at all"
> (quoting Richard). Let's simply make it clear that people should use
> 64-bit x86 hosts nowadays and we do not intend to fix/maintain the old
> 32-bit stuff.
> 
> Signed-off-by: Thomas Huth 
> ---
>  docs/about/deprecated.rst | 12 
>  1 file changed, 12 insertions(+)

Reviewed-by: Daniel P. Berrangé 

> 
> diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
> index 11700adac9..a30aa8dfdf 100644
> --- a/docs/about/deprecated.rst
> +++ b/docs/about/deprecated.rst
> @@ -208,6 +208,18 @@ CI coverage support may bitrot away before the 
> deprecation process
>  completes. The little endian variants of MIPS (both 32 and 64 bit) are
>  still a supported host architecture.
>  
> +32-bit x86 hosts (since 8.0)
> +
> +
> +Support for 32-bit x86 host deployments is increasingly uncommon in
> +mainstream OS distributions given the widespread availability of 64-bit
> +x86 hardware. The QEMU project no longer considers 32-bit x86 support
> +to be an effective use of its limited resources, and thus intends to
> +discontinue it. Since all recent x86 hardware from the past >10 years
> +is capable of the 64-bit x86 extensions, a corresponding 64-bit OS
> +should be used instead.
> +
> +
>  QEMU API (QAPI) events
>  --
>  
> -- 
> 2.31.1
> 

With regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|



Re: [PATCH v2 1/6] docs/about/deprecated: Deprecate the qemu-system-i386 binary

2023-03-02 Thread Daniel P . Berrangé
On Thu, Mar 02, 2023 at 05:31:01PM +0100, Thomas Huth wrote:
> Hardly anybody really requires the i386 binary anymore, since the
> qemu-system-x86_64 binary is a proper superset. So let's deprecate
> the 32-bit variant now, so that we can finally stop wasting our time
> and CI minutes with this.

The first sentence isn't quite true wrt to KVM. Change slightly to:

Aside from not supporting KVM on 32-bit hosts, the qemu-system-x86_64
binary is a proper superset of the qemu-system-i386 binary. With the
32-bit host support being deprecated, it is now also possible to
deprecate the qemu-system-i386 binary.

> With regards to 32-bit KVM support in the x86 Linux kernel,
> the developers confirmed that they do not need a recent
> qemu-system-i386 binary here:
> 
>  https://lore.kernel.org/kvm/y%2ffkts5ajfy0h...@google.com/
> 
> Signed-off-by: Thomas Huth 
> ---
>  docs/about/deprecated.rst | 12 
>  1 file changed, 12 insertions(+)

Reviewed-by: Daniel P. Berrangé 


With regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|



[PATCH v2 4/6] docs/about/deprecated: Deprecate the qemu-system-arm binary

2023-03-02 Thread Thomas Huth
qemu-system-aarch64 is a proper superset of qemu-system-arm,
and the latter was mainly still required for 32-bit KVM support.
But this 32-bit KVM arm support has been dropped in the Linux
kernel a couple of years ago already, so we don't really need
qemu-system-arm anymore, thus deprecated it now.

Signed-off-by: Thomas Huth 
---
 docs/about/deprecated.rst | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
index a30aa8dfdf..21ce70b5c9 100644
--- a/docs/about/deprecated.rst
+++ b/docs/about/deprecated.rst
@@ -45,6 +45,16 @@ run 32-bit guests by selecting a 32-bit CPU model, including 
KVM support
 on x86_64 hosts. Thus users are recommended to reconfigure their systems
 to use the ``qemu-system-x86_64`` binary instead.
 
+``qemu-system-arm`` binary (since 8.0)
+''
+
+``qemu-system-aarch64`` is a proper superset of ``qemu-system-arm``. The
+latter was mainly a requirement for running KVM on 32-bit arm hosts, but
+this 32-bit KVM support has been removed some years ago already (see:
+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=541ad0150ca4
+). Thus the QEMU project will drop the ``qemu-system-arm`` binary in a
+future release. Use ``qemu-system-aarch64`` instead.
+
 
 System emulator command line arguments
 --
-- 
2.31.1



[PATCH v2 3/6] gitlab-ci.d/crossbuilds: Drop the i386 jobs

2023-03-02 Thread Thomas Huth
Hardly anybody still uses 32-bit x86 environments for running QEMU,
so let's stop wasting our scarce CI minutes with these jobs.

Signed-off-by: Thomas Huth 
---
 .gitlab-ci.d/crossbuilds.yml | 16 
 1 file changed, 16 deletions(-)

diff --git a/.gitlab-ci.d/crossbuilds.yml b/.gitlab-ci.d/crossbuilds.yml
index 101416080c..3ce51adf77 100644
--- a/.gitlab-ci.d/crossbuilds.yml
+++ b/.gitlab-ci.d/crossbuilds.yml
@@ -43,22 +43,6 @@ cross-arm64-user:
   variables:
 IMAGE: debian-arm64-cross
 
-cross-i386-system:
-  extends: .cross_system_build_job
-  needs:
-job: i386-fedora-cross-container
-  variables:
-IMAGE: fedora-i386-cross
-MAKE_CHECK_ARGS: check-qtest
-
-cross-i386-user:
-  extends: .cross_user_build_job
-  needs:
-job: i386-fedora-cross-container
-  variables:
-IMAGE: fedora-i386-cross
-MAKE_CHECK_ARGS: check
-
 cross-i386-tci:
   extends: .cross_accel_build_job
   timeout: 60m
-- 
2.31.1



[PATCH v2 5/6] docs/about/deprecated: Deprecate 32-bit arm hosts

2023-03-02 Thread Thomas Huth
For running QEMU in system emulation mode, the user needs a rather
strong host system, i.e. not only an embedded low-frequency controller.
All recent beefy arm host machines should support 64-bit now, it's
unlikely that anybody is still seriously using QEMU on a 32-bit arm
CPU, so we deprecate the 32-bit arm hosts here to finally save use
some time and precious CI minutes.

Signed-off-by: Thomas Huth 
---
 docs/about/deprecated.rst | 9 +
 1 file changed, 9 insertions(+)

diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
index 21ce70b5c9..c7113a7510 100644
--- a/docs/about/deprecated.rst
+++ b/docs/about/deprecated.rst
@@ -229,6 +229,15 @@ discontinue it. Since all recent x86 hardware from the 
past >10 years
 is capable of the 64-bit x86 extensions, a corresponding 64-bit OS
 should be used instead.
 
+System emulation on 32-bit arm hosts (since 8.0)
+
+
+Since QEMU needs a strong host machine for running full system emulation, and
+all recent powerful arm hosts support 64-bit, the QEMU project deprecates the
+support for running any system emulation on 32-bit arm hosts in general. Use
+64-bit arm hosts for system emulation instead. (Note: "user" mode emulation
+continuous to be supported on 32-bit arm hosts, too)
+
 
 QEMU API (QAPI) events
 --
-- 
2.31.1



[PATCH v2 6/6] gitlab-ci.d/crossbuilds: Drop the 32-bit arm system emulation jobs

2023-03-02 Thread Thomas Huth
Hardly anybody still uses 32-bit arm environments for running QEMU,
so let's stop wasting our scarce CI minutes with these jobs.

Signed-off-by: Thomas Huth 
---
 .gitlab-ci.d/crossbuilds.yml | 14 --
 1 file changed, 14 deletions(-)

diff --git a/.gitlab-ci.d/crossbuilds.yml b/.gitlab-ci.d/crossbuilds.yml
index 3ce51adf77..419b0c2fe1 100644
--- a/.gitlab-ci.d/crossbuilds.yml
+++ b/.gitlab-ci.d/crossbuilds.yml
@@ -1,13 +1,6 @@
 include:
   - local: '/.gitlab-ci.d/crossbuild-template.yml'
 
-cross-armel-system:
-  extends: .cross_system_build_job
-  needs:
-job: armel-debian-cross-container
-  variables:
-IMAGE: debian-armel-cross
-
 cross-armel-user:
   extends: .cross_user_build_job
   needs:
@@ -15,13 +8,6 @@ cross-armel-user:
   variables:
 IMAGE: debian-armel-cross
 
-cross-armhf-system:
-  extends: .cross_system_build_job
-  needs:
-job: armhf-debian-cross-container
-  variables:
-IMAGE: debian-armhf-cross
-
 cross-armhf-user:
   extends: .cross_user_build_job
   needs:
-- 
2.31.1



[PATCH v2 2/6] docs/about/deprecated: Deprecate 32-bit x86 hosts

2023-03-02 Thread Thomas Huth
Hardly anybody still uses 32-bit x86 hosts today, so we should start
deprecating them to stop wasting our time and CI minutes here.
For example, there are also still some unresolved problems with these:
When emulating 64-bit binaries in user mode, TCG does not honor atomicity
for 64-bit accesses, which is "perhaps worse than not working at all"
(quoting Richard). Let's simply make it clear that people should use
64-bit x86 hosts nowadays and we do not intend to fix/maintain the old
32-bit stuff.

Signed-off-by: Thomas Huth 
---
 docs/about/deprecated.rst | 12 
 1 file changed, 12 insertions(+)

diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
index 11700adac9..a30aa8dfdf 100644
--- a/docs/about/deprecated.rst
+++ b/docs/about/deprecated.rst
@@ -208,6 +208,18 @@ CI coverage support may bitrot away before the deprecation 
process
 completes. The little endian variants of MIPS (both 32 and 64 bit) are
 still a supported host architecture.
 
+32-bit x86 hosts (since 8.0)
+
+
+Support for 32-bit x86 host deployments is increasingly uncommon in
+mainstream OS distributions given the widespread availability of 64-bit
+x86 hardware. The QEMU project no longer considers 32-bit x86 support
+to be an effective use of its limited resources, and thus intends to
+discontinue it. Since all recent x86 hardware from the past >10 years
+is capable of the 64-bit x86 extensions, a corresponding 64-bit OS
+should be used instead.
+
+
 QEMU API (QAPI) events
 --
 
-- 
2.31.1



[PATCH v2 0/6] Deprecate support for 32-bit x86 and arm hosts

2023-03-02 Thread Thomas Huth
We're struggling quite badly with our CI minutes on the shared
gitlab runners, so we urgently need to think of ways to cut down
our supported build and target environments. qemu-system-i386 and
qemu-system-arm are not really required anymore, since nobody uses
KVM on the corresponding systems for production anymore, and the
-x86_64 and -arch64 variants are a proper superset of those binaries.
So it's time to deprecate them and the corresponding 32-bit host
environments now.

This is a follow-up patch series from the previous discussion here:

 https://lore.kernel.org/qemu-devel/20230130114428.1297295-1-th...@redhat.com/

where people still mentioned that there is still interest in certain
support for 32-bit host hardware. But as far as I could see, there is
no real need for 32-bit x86 host support and for system emulation on
32-bit arm hosts anymore, so it should be fine if we drop these host
environments soon (these are also the two architectures that contribute
the most to the long test times in our CI, so we would benefit a lot by
dropping those).

v2:
- Split binary and host deprecation into separate patches
- Added patches to immediately drop the jobs from the CI

Thomas Huth (6):
  docs/about/deprecated: Deprecate the qemu-system-i386 binary
  docs/about/deprecated: Deprecate 32-bit x86 hosts
  gitlab-ci.d/crossbuilds: Drop the i386 jobs
  docs/about/deprecated: Deprecate the qemu-system-arm binary
  docs/about/deprecated: Deprecate 32-bit arm hosts
  gitlab-ci.d/crossbuilds: Drop the 32-bit arm system emulation jobs

 docs/about/deprecated.rst| 43 
 .gitlab-ci.d/crossbuilds.yml | 30 -
 2 files changed, 43 insertions(+), 30 deletions(-)

-- 
2.31.1



[PATCH v2 1/6] docs/about/deprecated: Deprecate the qemu-system-i386 binary

2023-03-02 Thread Thomas Huth
Hardly anybody really requires the i386 binary anymore, since the
qemu-system-x86_64 binary is a proper superset. So let's deprecate
the 32-bit variant now, so that we can finally stop wasting our time
and CI minutes with this.

With regards to 32-bit KVM support in the x86 Linux kernel,
the developers confirmed that they do not need a recent
qemu-system-i386 binary here:

 https://lore.kernel.org/kvm/y%2ffkts5ajfy0h...@google.com/

Signed-off-by: Thomas Huth 
---
 docs/about/deprecated.rst | 12 
 1 file changed, 12 insertions(+)

diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
index 15084f7bea..11700adac9 100644
--- a/docs/about/deprecated.rst
+++ b/docs/about/deprecated.rst
@@ -34,6 +34,18 @@ deprecating the build option and no longer defend it in CI. 
The
 ``--enable-gcov`` build option remains for analysis test case
 coverage.
 
+``qemu-system-i386`` binary (since 8.0)
+'''
+
+The ``qemu-system-i386`` binary was mainly useful for running with KVM
+on 32-bit x86 hosts, but most Linux distributions already removed their
+support for 32-bit x86 kernels, so hardly anybody still needs this. The
+``qemu-system-x86_64`` binary is a proper superset and can be used to
+run 32-bit guests by selecting a 32-bit CPU model, including KVM support
+on x86_64 hosts. Thus users are recommended to reconfigure their systems
+to use the ``qemu-system-x86_64`` binary instead.
+
+
 System emulator command line arguments
 --
 
-- 
2.31.1



Re: [libvirt PATCH 10/33] qemu: Introduce qemuDomainDefBootPostParse()

2023-03-02 Thread Michal Prívozník
On 2/15/23 11:42, Andrea Bolognani wrote:
> Move all the boot related parts of qemuDomainDefPostParse()
> to a separate helper.
> 
> Signed-off-by: Andrea Bolognani 
> ---
>  src/qemu/qemu_domain.c | 37 -
>  1 file changed, 24 insertions(+), 13 deletions(-)
> 
> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> index 9db5370055..da1a2413a5 100644
> --- a/src/qemu/qemu_domain.c
> +++ b/src/qemu/qemu_domain.c
> @@ -4425,6 +4425,29 @@ qemuDomainRecheckInternalPaths(virDomainDef *def,
>  }
>  
>  
> +static int
> +qemuDomainDefBootPostParse(virDomainDef *def,
> +   virQEMUDriverConfig *cfg)
> +{
> +if (def->os.bootloader || def->os.bootloaderArgs) {
> +virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> +   _("bootloader is not supported by QEMU"));
> +return -1;
> +}
> +

Strictly speaking, this is a validate check. Haven't look into the
future, but feel free to move it there in a follow up patch.

> +if (virDomainDefHasOldStyleROUEFI(def) &&
> +!def->os.loader->nvram &&
> +def->os.loader->stateless != VIR_TRISTATE_BOOL_YES) {
> +def->os.loader->nvram = virStorageSourceNew();
> +def->os.loader->nvram->type = VIR_STORAGE_TYPE_FILE;
> +def->os.loader->nvram->format = VIR_STORAGE_FILE_RAW;
> +qemuDomainNVRAMPathFormat(cfg, def, >os.loader->nvram->path);
> +}
> +
> +return 0;
> +}
> +
> +
>  static int
>  qemuDomainDefMachinePostParse(virDomainDef *def,
>virQEMUCaps *qemuCaps)
> @@ -4795,20 +4818,8 @@ qemuDomainDefPostParse(virDomainDef *def,
>  if (qemuDomainDefMachinePostParse(def, qemuCaps) < 0)
>  return -1;
>  
> -if (def->os.bootloader || def->os.bootloaderArgs) {
> -virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> -   _("bootloader is not supported by QEMU"));
> +if (qemuDomainDefBootPostParse(def, cfg) < 0)
>  return -1;
> -}
> -
> -if (virDomainDefHasOldStyleROUEFI(def) &&
> -!def->os.loader->nvram &&
> -def->os.loader->stateless != VIR_TRISTATE_BOOL_YES) {
> -def->os.loader->nvram = virStorageSourceNew();
> -def->os.loader->nvram->type = VIR_STORAGE_TYPE_FILE;
> -def->os.loader->nvram->format = VIR_STORAGE_FILE_RAW;
> -qemuDomainNVRAMPathFormat(cfg, def, >os.loader->nvram->path);
> -}
>  
>  if (qemuDomainDefAddDefaultDevices(driver, def, qemuCaps) < 0)
>  return -1;

Michal



Re: [libvirt PATCH 00/33] qemu: Move firmware selection to postparse and add support for QCOW2 firmware

2023-03-02 Thread Michal Prívozník
On 2/15/23 11:41, Andrea Bolognani wrote:
> Motivation for these changes can be found in the commit message
> for patch 20 ("qemu: Move firmware selection from startup to
> postparse") as well as [RHBZ#2161965].
> 
> 
> Patches 01-17 are preparatory fixes/improvements/cleanups.
> 
> Patches 19-20 move firmware selection from startup to postparse,
> and patches 21-22 clean up a bit after that change. Patch 20 in
> particular is significantly larger than I would have liked, but
> I haven't been able to come up with a way to split it while
> still preserving bisectability and making things clearer instead
> of complicating them. If anyone has ideas in this regard, please
> let me know!
> 
> Patches 23-27 add support for choosing a firmware format, but
> are effectively no-op because formats other than raw are still
> rejected at this point.
> 
> Patches 28-30 add support for QCOW2 format firmware in the QEMU
> driver.
> 
> Patches 31-33 document the changes.
> 
> 
> [RHBZ#2161965] https://bugzilla.redhat.com/show_bug.cgi?id=2161965
> 
> Andrea Bolognani (33):
>   docs: Fix documentation for loader.stateless attribute
>   tests: Set nvramDir in qemuxml2xmltest
>   tests: Rename firmware-manual-efi-rw* tests
>   tests: Use x86_64 for all x86 firmware tests
>   tests: Move firmware tests to CAPS_LATEST
>   tests: Unify input files for firmware tests
>   tests: Enable qemuxml2xml for more firmware tests
>   tests: Add more firmware tests
>   qemu: Introduce qemuDomainDefMachinePostParse()
>   qemu: Introduce qemuDomainDefBootPostParse()
>   conf: Introduce virDomainLoaderDefParseXMLLoader()
>   conf: introduce virDomainLoaderDefNew()
>   qemu: Add convenience local variables
>   qemu: Only fill nvramTemplate for local sources
>   qemu: Clear os.firmwareFeatures after autoselection
>   qemu: Don't pick firmware that requires SMM when smm=off
>   qemu: Don't pick firmware with unsupported format
>   tests: Add descriptors for QCOW2 format firmware builds
>   conf: Export virDomainDefOSValidate()
>   qemu: Move firmware selection from startup to postparse
>   qemu: Move qemuDomainNVRAMPathFormat() to qemu_firmware
>   qemu: Introduce qemuFirmwareEnsureNVRAM()
>   conf: Change handling for empty NVRAM path
>   conf: Parse firmware format
>   drivers: Reject unsupported firmware formats
>   qemu: Filter firmwares based on format
>   qemu: Propagate firmware format
>   conf: Accept QCOW2 firmware format
>   qemu: Add support for QCOW2 format firmware
>   tests: Add more firmware tests
>   docs: Document firmware format attribute
>   news: Document changes to firmware autoselection
>   news: Document support for QCOW2 format firmware

>  160 files changed, 1408 insertions(+), 990 deletions(-)

You'll need to rebase these, sorry for late review.

Reviewed-by: Michal Privoznik 

Michal



Re: [PATCH 13/21] qemu: capabilities: Retire unused QEMU_CAPS_IOTHREAD_POLLING

2023-03-02 Thread Ján Tomko

On a Thursday in 2023, Peter Krempa wrote:

We now always assume support for polling mode of iothreads.

Signed-off-by: Peter Krempa 
---
src/qemu/qemu_capabilities.c  | 3 +--
src/qemu/qemu_capabilities.h  | 2 +-
tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml | 1 -
tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml   | 1 -
tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml   | 1 -
tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml  | 1 -
tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml | 1 -
tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml   | 1 -
tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml | 1 -
tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml  | 1 -
tests/qemucapabilitiesdata/caps_5.1.0.sparc.xml   | 1 -
tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml  | 1 -
tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml | 1 -
tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml   | 1 -
tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml | 1 -
tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml   | 1 -
tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml  | 1 -
tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml | 1 -
tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml   | 1 -
tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml  | 1 -
tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml  | 1 -
tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml | 1 -
tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml   | 1 -
tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml  | 1 -
tests/qemucapabilitiesdata/caps_7.0.0.aarch64.xml | 1 -
tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml   | 1 -
tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml  | 1 -
tests/qemucapabilitiesdata/caps_7.1.0.ppc64.xml   | 1 -
tests/qemucapabilitiesdata/caps_7.1.0.x86_64.xml  | 1 -
tests/qemucapabilitiesdata/caps_7.2.0.x86_64.xml  | 1 -
tests/qemucapabilitiesdata/caps_8.0.0.riscv64.xml | 1 -
tests/qemucapabilitiesdata/caps_8.0.0.x86_64.xml  | 1 -
32 files changed, 2 insertions(+), 33 deletions(-)



For all patches up to [0] here:
Reviewed-by: Ján Tomko 

Jano

[0] or down to, depending on which way you're facing


signature.asc
Description: PGP signature


Re: [libvirt PATCH] qemu: Remove duplicate user/group lookup

2023-03-02 Thread Peter Krempa
On Wed, Mar 01, 2023 at 19:04:42 +0100, Andrea Bolognani wrote:
> Commit 068efae5b1a9 created a copy of this code instead of
> simply moving it.
> 
> Signed-off-by: Andrea Bolognani 
> ---
>  src/qemu/qemu_conf.c | 6 --
>  1 file changed, 6 deletions(-)

Reviewed-by: Peter Krempa 



Re: [PATCH RFCv2 0/5] qemu: Handle deprecation of '-no-acpi'

2023-03-02 Thread Ján Tomko

On a Wednesday in 2023, Peter Krempa wrote:

This new version doesn't bother looking for properties of -machine but
uses data added to output of 'query-machines' to do proper decision when
to use -machine  acpi and also adds validation.

Required qemu patch:

https://lists.gnu.org/archive/html/qemu-devel/2023-02/msg08486.html


Peter Krempa (5):
 qemu: capabilities: Refactor XML parsing in virQEMUCapsLoadMachines
 qemu: capabilities: Extract whether machine type supports ACPI
 qemu: capabilities: Introduce virQEMUCapsMachineSupportsACPI
 XXX: tests: qemucapabilitiesdata: Regenerate with support for 'acpi'
   in 'query-machines'
 qemu: Use '-machine acpi=on/off' instead of deprecated '-no-acpi'

src/qemu/qemu_capabilities.c  |  83 +--
src/qemu/qemu_capabilities.h  |   3 +
src/qemu/qemu_capspriv.h  |   3 +-
src/qemu/qemu_command.c   |  42 +-
src/qemu/qemu_monitor.h   |   1 +
src/qemu/qemu_monitor_json.c  |  12 +
src/qemu/qemu_validate.c  |   8 +
.../caps_8.0.0.x86_64.replies | 471 --
.../caps_8.0.0.x86_64.xml | 242 -

...

.../x86_64-q35-graphics.x86_64-latest.args|   2 +-
.../x86_64-q35-headless.x86_64-latest.args|   2 +-
tests/testutilsqemu.c |   9 +-
380 files changed, 928 insertions(+), 999 deletions(-)



Reviewed-by: Ján Tomko 

Jano


signature.asc
Description: PGP signature


Re: [PATCH] security: Add support for SUSE edk2 firmware paths

2023-03-02 Thread Andrea Bolognani
On Thu, Feb 23, 2023 at 11:13:28AM -0700, Jim Fehlig wrote:
> +++ b/src/security/apparmor/libvirt-qemu
> @@ -91,7 +91,7 @@
>/usr/share/proll/** r,
>/usr/share/qemu-efi/** r,
>/usr/share/qemu-kvm/** r,
> -  /usr/share/qemu/** r,
> +  /usr/share/qemu/** rk,
>/usr/share/seabios/** r,
>/usr/share/sgabios/** r,
>/usr/share/slof/** r,
> +++ b/src/security/virt-aa-helper.c
> @@ -481,6 +481,7 @@ valid_path(const char *path, const bool readonly)
>  "/usr/share/AAVMF/", /* for AAVMF images */
>  "/usr/share/qemu-efi/",  /* for AAVMF images */
>  "/usr/share/qemu-efi-aarch64/",  /* for AAVMF images */
> +"/usr/share/qemu/",  /* SUSE path for OVMF and AAVMF 
> images */
>  "/usr/lib/u-boot/",  /* u-boot loaders for qemu */
>  "/usr/lib/riscv64-linux-gnu/opensbi" /* RISC-V SBI implementation */

Having these files in /usr/share/qemu directly looks... Kinda
sketchy? That directory should belong to the QEMU package. Compare
with how all the other paths listed here point to directories that
are specific to the firmware at hand.

I don't think this really opens up any attack vectors, so

  Reviewed-by: Andrea Bolognani 

but perhaps it would be a good idea to consider migrating edk2 images
to their own directory long term?

-- 
Andrea Bolognani / Red Hat / Virtualization



[PATCH 11/21] qemu: capabilities: Retire unused QEMU_CAPS_OBJECT_IOTHREAD

2023-03-02 Thread Peter Krempa
Signed-off-by: Peter Krempa 
---
 src/qemu/qemu_capabilities.c  | 3 +--
 src/qemu/qemu_capabilities.h  | 2 +-
 tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml | 1 -
 tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml   | 1 -
 tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml   | 1 -
 tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml  | 1 -
 tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml | 1 -
 tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml   | 1 -
 tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml | 1 -
 tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml  | 1 -
 tests/qemucapabilitiesdata/caps_5.1.0.sparc.xml   | 1 -
 tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml  | 1 -
 tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml | 1 -
 tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml   | 1 -
 tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml | 1 -
 tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml   | 1 -
 tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml  | 1 -
 tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml | 1 -
 tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml   | 1 -
 tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml  | 1 -
 tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml  | 1 -
 tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml | 1 -
 tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml   | 1 -
 tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml  | 1 -
 tests/qemucapabilitiesdata/caps_7.0.0.aarch64.xml | 1 -
 tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml   | 1 -
 tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml  | 1 -
 tests/qemucapabilitiesdata/caps_7.1.0.ppc64.xml   | 1 -
 tests/qemucapabilitiesdata/caps_7.1.0.x86_64.xml  | 1 -
 tests/qemucapabilitiesdata/caps_7.2.0.x86_64.xml  | 1 -
 tests/qemucapabilitiesdata/caps_8.0.0.riscv64.xml | 1 -
 tests/qemucapabilitiesdata/caps_8.0.0.x86_64.xml  | 1 -
 32 files changed, 2 insertions(+), 33 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 6ba9b109a5..dfcd573b5e 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -308,7 +308,7 @@ VIR_ENUM_IMPL(virQEMUCaps,
   "usb-audio", /* QEMU_CAPS_OBJECT_USB_AUDIO */
   "rtc-reset-reinjection", /* QEMU_CAPS_RTC_RESET_REINJECTION */
   "splash-timeout", /* X_QEMU_CAPS_SPLASH_TIMEOUT */
-  "iothread", /* QEMU_CAPS_OBJECT_IOTHREAD */
+  "iothread", /* X_QEMU_CAPS_OBJECT_IOTHREAD */

   /* 175 */
   "migrate-rdma", /* QEMU_CAPS_MIGRATE_RDMA */
@@ -1287,7 +1287,6 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
 { "pvpanic", QEMU_CAPS_DEVICE_PANIC },
 { "usb-kbd", QEMU_CAPS_DEVICE_USB_KBD },
 { "usb-audio", QEMU_CAPS_OBJECT_USB_AUDIO },
-{ "iothread", QEMU_CAPS_OBJECT_IOTHREAD},
 { "ivshmem", QEMU_CAPS_DEVICE_IVSHMEM },
 { "pc-dimm", QEMU_CAPS_DEVICE_PC_DIMM },
 { "pci-serial", QEMU_CAPS_DEVICE_PCI_SERIAL },
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index d049f79dd9..d778f0f60d 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -286,7 +286,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for 
syntax-check */
 QEMU_CAPS_OBJECT_USB_AUDIO, /* usb-audio device support */
 QEMU_CAPS_RTC_RESET_REINJECTION, /* rtc-reset-reinjection monitor command 
*/
 X_QEMU_CAPS_SPLASH_TIMEOUT, /* -boot splash-time */
-QEMU_CAPS_OBJECT_IOTHREAD, /* -object iothread */
+X_QEMU_CAPS_OBJECT_IOTHREAD, /* -object iothread */

 /* 175 */
 QEMU_CAPS_MIGRATE_RDMA, /* have rdma migration */
diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml 
b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml
index e1a6301897..7fc098125e 100644
--- a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml
+++ b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml
@@ -44,7 +44,6 @@
   
   
   
-  
   
   
   
diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml 
b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml
index 94dcdbc395..e1eac1f12f 100644
--- a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml
+++ b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml
@@ -43,7 +43,6 @@
   
   
   
-  
   
   
   
diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml 
b/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml
index 08fdaaed97..1deef79501 100644
--- a/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml
+++ b/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml
@@ -22,7 +22,6 @@
   
   
   
-  
   
   
   
diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml 
b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml
index b039145384..833efba5db 100644
--- a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml
@@ -58,7 +58,6 @@
   
   
   
-  
   
   
   
diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml 
b/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml
index f83ee7050b..cb7df84e52 100644
--- 

[PATCH RFC 20/21] conf: Add possibility to configure multiple iothreads per disk

2023-03-02 Thread Peter Krempa
Introduce a new  sub-element of disk's  which will
allow configuring multiple iothreads and also map them to specific
virt-queues of virtio devices.

Signed-off-by: Peter Krempa 
---
 docs/formatdomain.rst | 23 +-
 src/conf/domain_conf.c| 76 +++
 src/conf/domain_conf.h| 14 
 src/conf/domain_validate.c|  8 ++
 src/conf/schemas/domaincommon.rng | 47 +---
 .../iothreads-disk.x86_64-latest.args | 13 +++-
 tests/qemuxml2argvdata/iothreads-disk.xml | 25 +-
 .../iothreads-disk.x86_64-latest.xml  | 26 ++-
 8 files changed, 211 insertions(+), 21 deletions(-)

diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
index d831c1e527..4940f3d857 100644
--- a/docs/formatdomain.rst
+++ b/docs/formatdomain.rst
@@ -3233,7 +3233,28 @@ paravirtualized driver is specified via the ``disk`` 
element.
   assigned to the same IOThread and are numbered from 1 to the domain
   iothreads value. Available for a disk device ``target`` configured to use
   "virtio" ``bus`` and "pci" or "ccw" ``address`` types. :since:`Since 
1.2.8
-  (QEMU 2.1)`
+  (QEMU 2.1)` *Note:* ``iothread`` is mutually exclusive with 
``iothreads``.
+   -  The optional ``iothreads`` sub-element allows specifying multiple 
IOThreads
+  via the ``iothread`` sub-element with attribute ``id``  the disk will use
+  for I/O operations. Optionally the ``iothread`` element can have multiple
+  ``queue`` subelements specifying that given iothread should be used to
+  handle given queues. :since:`Since XX`.
+  Example::
+
+
+  
+
+  
+
+
+  
+
+
+  
+
+  
+
+
-  The optional ``queues`` attribute specifies the number of virt queues for
   virtio-blk. ( :since:`Since 3.9.0` )
-  The optional ``queue_size`` attribute specifies the size of each virt
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 9426d55f8d..6904a71c80 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2333,6 +2333,17 @@ virDomainDefGetVcpusTopology(const virDomainDef *def,
 }


+void
+virDomainDiskIothreadDefFree(virDomainDiskIothreadDef *def)
+{
+if (!def)
+return;
+
+g_free(def->queues);
+g_free(def);
+}
+
+
 static virDomainDiskDef *
 virDomainDiskDefNewSource(virDomainXMLOption *xmlopt,
   virStorageSource **src)
@@ -2381,6 +2392,7 @@ virDomainDiskDefFree(virDomainDiskDef *def)
 g_free(def->virtio);
 virDomainDeviceInfoClear(>info);
 virObjectUnref(def->privateData);
+g_slist_free_full(def->iothreads, (GDestroyNotify) 
virDomainDiskIothreadDefFree);

 g_free(def);
 }
@@ -7745,6 +7757,8 @@ static int
 virDomainDiskDefDriverParseXML(virDomainDiskDef *def,
xmlNodePtr cur)
 {
+xmlNodePtr iothreadsNode;
+
 def->driverName = virXMLPropString(cur, "name");

 if (virXMLPropEnum(cur, "cache", virDomainDiskCacheTypeFromString,
@@ -7791,6 +7805,44 @@ virDomainDiskDefDriverParseXML(virDomainDiskDef *def,
 if (virXMLPropUInt(cur, "iothread", 10, VIR_XML_PROP_NONZERO, 
>iothread) < 0)
 return -1;

+if ((iothreadsNode = virXMLNodeGetSubelement(cur, "iothreads"))) {
+g_autoslist(virDomainDiskIothreadDef) ioth = NULL;
+g_autoptr(GPtrArray) iothreadNodes = NULL;
+
+if ((iothreadNodes = virXMLNodeGetSubelementList(iothreadsNode, 
"iothread"))) {
+size_t i;
+
+for (i = 0; i < iothreadNodes->len; i++) {
+xmlNodePtr iothNode = g_ptr_array_index(iothreadNodes, i);
+g_autoptr(virDomainDiskIothreadDef) iothdef = 
g_new0(virDomainDiskIothreadDef, 1);
+g_autoptr(GPtrArray) queueNodes = NULL;
+
+if (virXMLPropUInt(iothNode, "id", 10, VIR_XML_PROP_REQUIRED,
+   >id) < 0)
+return -1;
+
+if ((queueNodes = virXMLNodeGetSubelementList(iothNode, 
"queue"))) {
+size_t q;
+
+iothdef->queues = g_new0(unsigned int, queueNodes->len);
+iothdef->nqueues = queueNodes->len;
+
+for (q = 0; q < queueNodes->len; q++) {
+xmlNodePtr queueNode = g_ptr_array_index(queueNodes, 
q);
+
+if (virXMLPropUInt(queueNode, "id", 10, 
VIR_XML_PROP_REQUIRED,
+   &(iothdef->queues[q])) < 0)
+return -1;
+}
+}
+
+ioth = g_slist_prepend(ioth, g_steal_pointer());
+}
+
+def->iothreads = g_slist_reverse(g_steal_pointer());
+}
+}
+
 if (virXMLPropEnum(cur, "detect_zeroes",

[PATCH 09/21] tests: qemuxml2argvdata: Remove irrelevant from 'iothread-*' cases

2023-03-02 Thread Peter Krempa
Remove disks which are not necessary to demonstrate iothread config.

Signed-off-by: Peter Krempa 
---
 tests/qemuxml2argvdata/iothreads-disk.x86_64-latest.args| 5 +
 tests/qemuxml2argvdata/iothreads-disk.xml   | 6 --
 .../iothreads-ids-partial.x86_64-latest.args| 3 ---
 tests/qemuxml2argvdata/iothreads-ids-partial.xml| 6 --
 .../iothreads-ids-pool-sizes.x86_64-latest.args | 3 ---
 tests/qemuxml2argvdata/iothreads-ids-pool-sizes.xml | 6 --
 tests/qemuxml2argvdata/iothreads-ids.x86_64-latest.args | 3 ---
 tests/qemuxml2argvdata/iothreads-ids.xml| 6 --
 .../iothreads-virtio-scsi-pci.x86_64-5.2.0.args | 5 +
 .../iothreads-virtio-scsi-pci.x86_64-latest.args| 5 +
 tests/qemuxml2argvdata/iothreads-virtio-scsi-pci.xml| 6 --
 tests/qemuxml2xmloutdata/iothreads-disk.x86_64-latest.xml   | 6 --
 .../iothreads-ids-partial.x86_64-latest.xml | 6 --
 tests/qemuxml2xmloutdata/iothreads-ids.x86_64-latest.xml| 6 --
 .../iothreads-virtio-scsi-pci.x86_64-latest.xml | 6 --
 15 files changed, 3 insertions(+), 75 deletions(-)

diff --git a/tests/qemuxml2argvdata/iothreads-disk.x86_64-latest.args 
b/tests/qemuxml2argvdata/iothreads-disk.x86_64-latest.args
index 1f18c97c97..02fb74d945 100644
--- a/tests/qemuxml2argvdata/iothreads-disk.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/iothreads-disk.x86_64-latest.args
@@ -30,12 +30,9 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
 -no-acpi \
 -boot strict=on \
 -device 
'{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \
--blockdev 
'{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-3-storage","auto-read-only":true,"discard":"unmap"}'
 \
--blockdev 
'{"node-name":"libvirt-3-format","read-only":false,"driver":"raw","file":"libvirt-3-storage"}'
 \
--device 
'{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-3-format","id":"ide0-0-0","bootindex":1}'
 \
 -blockdev 
'{"driver":"file","filename":"/var/lib/libvirt/images/iothrtest1.img","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}'
 \
 -blockdev 
'{"node-name":"libvirt-2-format","read-only":false,"driver":"raw","file":"libvirt-2-storage"}'
 \
--device 
'{"driver":"virtio-blk-pci","iothread":"iothread1","bus":"pci.0","addr":"0x4","drive":"libvirt-2-format","id":"virtio-disk1"}'
 \
+-device 
'{"driver":"virtio-blk-pci","iothread":"iothread1","bus":"pci.0","addr":"0x4","drive":"libvirt-2-format","id":"virtio-disk1","bootindex":1}'
 \
 -blockdev 
'{"driver":"file","filename":"/var/lib/libvirt/images/iothrtest2.img","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}'
 \
 -blockdev 
'{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}'
 \
 -device 
'{"driver":"virtio-blk-pci","iothread":"iothread2","bus":"pci.0","addr":"0x2","drive":"libvirt-1-format","id":"virtio-disk2"}'
 \
diff --git a/tests/qemuxml2argvdata/iothreads-disk.xml 
b/tests/qemuxml2argvdata/iothreads-disk.xml
index 485ae3760e..ad0731c79c 100644
--- a/tests/qemuxml2argvdata/iothreads-disk.xml
+++ b/tests/qemuxml2argvdata/iothreads-disk.xml
@@ -15,12 +15,6 @@
   destroy
   
 /usr/bin/qemu-system-x86_64
-
-  
-  
-  
-  
-
 
   
   
diff --git a/tests/qemuxml2argvdata/iothreads-ids-partial.x86_64-latest.args 
b/tests/qemuxml2argvdata/iothreads-ids-partial.x86_64-latest.args
index 857e343f8d..9a43da58e9 100644
--- a/tests/qemuxml2argvdata/iothreads-ids-partial.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/iothreads-ids-partial.x86_64-latest.args
@@ -32,9 +32,6 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
 -no-acpi \
 -boot strict=on \
 -device 
'{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \
--blockdev 
'{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}'
 \
--blockdev 
'{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}'
 \
--device 
'{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-format","id":"ide0-0-0","bootindex":1}'
 \
 -audiodev '{"id":"audio1","driver":"none"}' \
 -sandbox 
on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/iothreads-ids-partial.xml 
b/tests/qemuxml2argvdata/iothreads-ids-partial.xml
index ff759f2ce2..34761792f6 100644
--- a/tests/qemuxml2argvdata/iothreads-ids-partial.xml
+++ b/tests/qemuxml2argvdata/iothreads-ids-partial.xml
@@ -19,12 +19,6 @@
   destroy
   
 /usr/bin/qemu-system-x86_64
-
-  
-  
-  
-  
-
 
 
 
diff --git a/tests/qemuxml2argvdata/iothreads-ids-pool-sizes.x86_64-latest.args 
b/tests/qemuxml2argvdata/iothreads-ids-pool-sizes.x86_64-latest.args
index 

[PATCH 12/21] qemu: Always assume support for QEMU_CAPS_IOTHREAD_POLLING

2023-03-02 Thread Peter Krempa
iothread polling mode and the corresponding properties were added in
qemu-2.9 ( 0d9d86fb4df4882b ). We can always assume that qemu supports
them.

Signed-off-by: Peter Krempa 
---
 src/qemu/qemu_driver.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index fcec445f14..f43d95adcb 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5055,12 +5055,6 @@ qemuDomainHotplugModIOThread(virDomainObj *vm,
 qemuDomainObjPrivate *priv = vm->privateData;
 int rc;

-if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_IOTHREAD_POLLING)) {
-virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-   _("IOThreads polling is not supported for this QEMU"));
-return -1;
-}
-
 qemuDomainObjEnterMonitor(vm);

 rc = qemuMonitorSetIOThread(priv->mon, );
-- 
2.39.2



[PATCH 15/21] qemu: Use configured iothread poll parameters on startup

2023-03-02 Thread Peter Krempa
Implement the support for the persisted poll parameters and remove
restrictions on saving config when modifying them during runtime.

Signed-off-by: Peter Krempa 
---
 src/qemu/qemu_command.c   | 18 +++
 src/qemu/qemu_driver.c| 30 ++-
 ...othreads-ids-pool-sizes.x86_64-latest.args |  6 ++--
 3 files changed, 37 insertions(+), 17 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 4839d45a34..cc476addce 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7167,6 +7167,24 @@ qemuBuildIOThreadCommandLine(virCommand *cmd,
  NULL) < 0)
 return -1;

+if (iothread->set_poll_max_ns &&
+virJSONValueObjectAdd(,
+  "U:poll-max-ns", iothread->poll_max_ns,
+  NULL) < 0)
+return -1;
+
+if (iothread->set_poll_grow &&
+virJSONValueObjectAdd(,
+  "u:poll-grow", iothread->poll_grow,
+  NULL) < 0)
+return -1;
+
+if (iothread->set_poll_shrink &&
+virJSONValueObjectAdd(,
+  "U:poll-shrink", iothread->poll_shrink,
+  NULL) < 0)
+return -1;
+
 if (qemuBuildObjectCommandlineFromJSON(cmd, props, qemuCaps) < 0)
 return -1;
 }
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index f43d95adcb..e7af9887df 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5068,23 +5068,30 @@ qemuDomainHotplugModIOThread(virDomainObj *vm,
 }


-static int
+static void
 qemuDomainHotplugModIOThreadIDDef(virDomainIOThreadIDDef *def,
   qemuMonitorIOThreadInfo mondef)
 {
-/* These have no representation in domain XML */
-if (mondef.set_poll_grow ||
-mondef.set_poll_max_ns ||
-mondef.set_poll_shrink)
-return -1;
+if (mondef.set_poll_max_ns) {
+def->poll_max_ns = mondef.poll_max_ns;
+def->set_poll_max_ns = true;
+}
+
+if (mondef.set_poll_grow) {
+def->poll_grow = mondef.poll_grow;
+def->set_poll_grow = true;
+}
+
+if (mondef.set_poll_shrink) {
+def->poll_shrink = mondef.poll_shrink;
+def->set_poll_shrink = true;
+}

 if (mondef.set_thread_pool_min)
 def->thread_pool_min = mondef.thread_pool_min;

 if (mondef.set_thread_pool_max)
 def->thread_pool_max = mondef.thread_pool_max;
-
-return 0;
 }


@@ -5403,12 +5410,7 @@ qemuDomainChgIOThread(virQEMUDriver *driver,
 if (qemuDomainIOThreadValidate(iothreaddef, iothread, false) < 0)
 goto endjob;

-if (qemuDomainHotplugModIOThreadIDDef(iothreaddef, iothread) < 0) {
-virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
-   _("configuring persistent polling values is not 
supported"));
-goto endjob;
-}
-
+qemuDomainHotplugModIOThreadIDDef(iothreaddef, iothread);
 break;
 }
 }
diff --git a/tests/qemuxml2argvdata/iothreads-ids-pool-sizes.x86_64-latest.args 
b/tests/qemuxml2argvdata/iothreads-ids-pool-sizes.x86_64-latest.args
index 3f0e47fcfa..2008eb848f 100644
--- a/tests/qemuxml2argvdata/iothreads-ids-pool-sizes.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/iothreads-ids-pool-sizes.x86_64-latest.args
@@ -18,9 +18,9 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
 -overcommit mem-lock=off \
 -smp 6,sockets=6,cores=1,threads=1 \
 -object 
'{"qom-type":"iothread","id":"iothread2","thread-pool-min":0,"thread-pool-max":60}'
 \
--object 
'{"qom-type":"iothread","id":"iothread4","thread-pool-min":1,"thread-pool-max":1}'
 \
--object '{"qom-type":"iothread","id":"iothread1"}' \
--object '{"qom-type":"iothread","id":"iothread3"}' \
+-object 
'{"qom-type":"iothread","id":"iothread4","thread-pool-min":1,"thread-pool-max":1,"poll-max-ns":123}'
 \
+-object 
'{"qom-type":"iothread","id":"iothread1","poll-grow":456,"poll-shrink":789}' \
+-object 
'{"qom-type":"iothread","id":"iothread3","poll-max-ns":123000,"poll-grow":456,"poll-shrink":789}'
 \
 -object '{"qom-type":"iothread","id":"iothread5"}' \
 -object 
'{"qom-type":"main-loop","id":"main-loop","thread-pool-min":8,"thread-pool-max":16}'
 \
 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
-- 
2.39.2



[PATCH RFC 21/21] qemu: Implement support for configuring iothread to virtqueue mapping for disks

2023-03-02 Thread Peter Krempa
Add validation and formatting of the commandline.

Note that this is based on Stefan's RFC series which only adds the qemu
interface:

https://lists.gnu.org/archive/html/qemu-devel/2023-01/msg04090.html
---
 src/qemu/qemu_command.c   |  45 +++
 src/qemu/qemu_validate.c  | 117 --
 .../iothreads-disk.x86_64-latest.args |   4 +-
 3 files changed, 153 insertions(+), 13 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index cc476addce..d9bb984101 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1746,6 +1746,45 @@ qemuBuildDriveStr(virDomainDiskDef *disk)
 }


+static virJSONValue *
+qemuBuildDiskDeviceIothreadMappingProps(GSList *iothreads)
+{
+g_autoptr(virJSONValue) ret = virJSONValueNewArray();
+GSList *n;
+
+for (n = iothreads; n; n = n->next) {
+virDomainDiskIothreadDef *ioth = n->data;
+g_autoptr(virJSONValue) props = NULL;
+g_autoptr(virJSONValue) queues = NULL;
+g_autofree char *alias = g_strdup_printf("iothread%u", ioth->id);
+size_t i;
+
+if (ioth->nqueues > 0) {
+queues = virJSONValueNewArray();
+
+for (i = 0; i < ioth->nqueues; i++) {
+g_autoptr(virJSONValue) vq = 
virJSONValueNewNumberUint(ioth->queues[i]);
+
+if (virJSONValueArrayAppend(queues, ))
+return NULL;
+}
+}
+
+if (virJSONValueObjectAdd(,
+  "s:iothread", alias,
+  "A:vqs", ,
+  NULL) < 0)
+return NULL;
+
+
+if (virJSONValueArrayAppend(ret, ))
+return NULL;
+}
+
+return g_steal_pointer();
+}
+
+
 virJSONValue *
 qemuBuildDiskDeviceProps(const virDomainDef *def,
  virDomainDiskDef *disk,
@@ -1804,11 +1843,16 @@ qemuBuildDiskDeviceProps(const virDomainDef *def,

 case VIR_DOMAIN_DISK_BUS_VIRTIO: {
 virTristateSwitch scsi = VIR_TRISTATE_SWITCH_ABSENT;
+g_autoptr(virJSONValue) iothreadMapping = NULL;
 g_autofree char *iothread = NULL;

 if (disk->iothread > 0)
 iothread = g_strdup_printf("iothread%u", disk->iothread);

+if (disk->iothreads &&
+!(iothreadMapping = 
qemuBuildDiskDeviceIothreadMappingProps(disk->iothreads)))
+return NULL;
+
 if (virStorageSourceGetActualType(disk->src) != 
VIR_STORAGE_TYPE_VHOST_USER &&
 virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_BLK_SCSI)) {
 /* if sg_io is true but the scsi option isn't supported,
@@ -1832,6 +1876,7 @@ qemuBuildDiskDeviceProps(const virDomainDef *def,
   "T:scsi", scsi,
   "p:num-queues", disk->queues,
   "p:queue-size", disk->queue_size,
+  "A:iothread-vq-mapping", ,
   NULL) < 0)
 return NULL;
 }
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index c877aa73d4..79096a2fcf 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -2822,12 +2822,24 @@ qemuValidateDomainDeviceDefDiskSerial(const char *value)
 }


-static bool
+static int
 qemuValidateDomainDeviceDefDiskIOThreads(const virDomainDef *def,
- const virDomainDiskDef *disk)
+ const virDomainDiskDef *disk,
+ virQEMUCaps *qemuCaps)
 {
+if (disk->iothread == 0 && !disk->iothreads)
+return 0;
+
 switch ((virDomainDiskBus)disk->bus) {
 case VIR_DOMAIN_DISK_BUS_VIRTIO:
+if (disk->iothreads) {
+if (!virQEMUCapsGet(qemuCaps, 
QEMU_CAPS_VIRTIO_BLK_IOTHREAD_MAPPING)) {
+virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+   _("IOThread mapping for disk '%s' is not 
available with this QEMU binary"),
+   disk->dst);
+return -1;
+}
+}
 break;

 case VIR_DOMAIN_DISK_BUS_IDE:
@@ -2843,18 +2855,101 @@ qemuValidateDomainDeviceDefDiskIOThreads(const 
virDomainDef *def,
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("IOThreads not available for bus %s target %s"),
virDomainDiskBusTypeToString(disk->bus), disk->dst);
-return false;
+return -1;
 }

-/* Can we find the disk iothread in the iothreadid list? */
-if (!virDomainIOThreadIDFind(def, disk->iothread)) {
-virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-   _("Disk iothread '%u' not defined in iothreadid"),
-   disk->iothread);
-return false;
+if (disk->iothreads) {
+virDomainDiskIothreadDef *first_ioth = disk->iothreads->data;
+

[PATCH RFC 18/21] qemucapabilitiesdata: Bump qemu-8.0 caps for virtqeueues

2023-03-02 Thread Peter Krempa
---
 .../caps_8.0.0.x86_64.replies | 197 +-
 .../caps_8.0.0.x86_64.xml |   2 +-
 2 files changed, 102 insertions(+), 97 deletions(-)

diff --git a/tests/qemucapabilitiesdata/caps_8.0.0.x86_64.replies 
b/tests/qemucapabilitiesdata/caps_8.0.0.x86_64.replies
index a41b3e1825..6be1823978 100644
--- a/tests/qemucapabilitiesdata/caps_8.0.0.x86_64.replies
+++ b/tests/qemucapabilitiesdata/caps_8.0.0.x86_64.replies
@@ -21,7 +21,7 @@
   "minor": 2,
   "major": 7
 },
-"package": "v7.2.0-1550-g79b677d658"
+"package": "v7.2.0-1553-g70c4d6d3a2"
   },
   "id": "libvirt-2"
 }
@@ -25374,31 +25374,21 @@
   "description": "on/off",
   "type": "bool"
 },
-{
-  "default-value": false,
-  "name": "share-rw",
-  "type": "bool"
-},
 {
   "default-value": 0,
   "name": "lcyls",
   "type": "uint32"
 },
+{
+  "default-value": false,
+  "name": "share-rw",
+  "type": "bool"
+},
 {
   "default-value": 256,
   "name": "queue-size",
   "type": "uint16"
 },
-{
-  "default-value": 0,
-  "name": "lsecs",
-  "type": "uint32"
-},
-{
-  "default-value": 0,
-  "name": "heads",
-  "type": "uint32"
-},
 {
   "default-value": "auto",
   "name": "account-invalid",
@@ -25406,12 +25396,18 @@
   "type": "OnOffAuto"
 },
 {
-  "name": "iothread",
-  "type": "link"
+  "default-value": 0,
+  "name": "lsecs",
+  "type": "uint32"
 },
 {
   "default-value": 0,
-  "name": "lheads",
+  "name": "min_io_size",
+  "type": "size"
+},
+{
+  "default-value": 0,
+  "name": "secs",
   "type": "uint32"
 },
 {
@@ -25419,6 +25415,14 @@
   "name": "num-queues",
   "type": "uint16"
 },
+{
+  "name": "iothread",
+  "type": "link"
+},
+{
+  "name": "serial",
+  "type": "str"
+},
 {
   "default-value": 0,
   "name": "cyls",
@@ -25426,7 +25430,7 @@
 },
 {
   "default-value": 0,
-  "name": "secs",
+  "name": "lheads",
   "type": "uint32"
 },
 {
@@ -25435,8 +25439,8 @@
 },
 {
   "default-value": 0,
-  "name": "min_io_size",
-  "type": "size"
+  "name": "heads",
+  "type": "uint32"
 },
 {
   "name": "bootindex",
@@ -25464,6 +25468,11 @@
   "description": "Error handling policy, report/ignore/enospc/stop/auto",
   "type": "BlockdevOnError"
 },
+{
+  "name": "iothread-vq-mapping",
+  "description": "IOThread virtqueue mapping list [{\"iothread\":\"\", 
\"vqs\":[1,2,3,...]},...]",
+  "type": "IOThreadVirtQueueMappingList"
+},
 {
   "default-value": true,
   "name": "report-discard-granularity",
@@ -25491,17 +25500,17 @@
   "name": "x-disable-legacy-check",
   "type": "bool"
 },
-{
-  "default-value": true,
-  "name": "use-started",
-  "type": "bool"
-},
 {
   "default-value": false,
   "name": "iommu_platform",
   "description": "on/off",
   "type": "bool"
 },
+{
+  "default-value": true,
+  "name": "use-started",
+  "type": "bool"
+},
 {
   "default-value": 0,
   "name": "physical_block_size",
@@ -25536,6 +25545,12 @@
   "name": "max-discard-sectors",
   "type": "uint32"
 },
+{
+  "default-value": false,
+  "name": "packed",
+  "description": "on/off",
+  "type": "bool"
+},
 {
   "default-value": true,
   "name": "discard",
@@ -25570,12 +25585,6 @@
   "name": "max-write-zeroes-sectors",
   "type": "uint32"
 },
-{
-  "default-value": false,
-  "name": "packed",
-  "description": "on/off",
-  "type": "bool"
-},
 {
   "default-value": "auto",
   "name": "account-failed",
@@ -25594,11 +25603,6 @@
   "description": "on/off",
   "type": "bool"
 },
-{
-  "default-value": true,
-  "name": "x-enable-wce-if-config-wce",
-  "type": "bool"
-},
 {
   "default-value": "auto",
   "name": "backend_defaults",
@@ -25606,8 +25610,9 @@
   "type": "OnOffAuto"
 },
 {
-  "name": "serial",
-  "type": "str"
+  "default-value": true,
+  "name": "x-enable-wce-if-config-wce",
+  "type": "bool"
 }
   ],
   "id": "libvirt-8"
@@ -25902,17 +25907,17 @@
   "description": "on/off",
   "type": "bool"
 },
-{
-  "default-value": true,
-  "name": "use-started",
-  "type": "bool"
-},
 {
   "default-value": false,
   "name": "iommu_platform",
   "description": "on/off",
   "type": "bool"
 },
+{
+  "default-value": true,
+  "name": "use-started",
+  "type": "bool"
+},
 {
   "default-value": true,
   "name": "host_ufo",
@@ -26221,7 +26226,8 @@
 },
 {
   "default-value": true,
-  "name": 

[PATCH RFC 17/21] util: xml: Introduce virXMLNodeGetSubelement

2023-03-02 Thread Peter Krempa
The new helper is similar to virXPathNode list but for cases where we
want to get subelements directly rather than using XPath.

Signed-off-by: Peter Krempa 
---
 src/libvirt_private.syms |  1 +
 src/util/virxml.c| 29 +
 src/util/virxml.h|  4 
 3 files changed, 34 insertions(+)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index f1bed27ba7..951b3691cf 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -3691,6 +3691,7 @@ virXMLFormatMetadata;
 virXMLNewNode;
 virXMLNodeContentString;
 virXMLNodeGetSubelement;
+virXMLNodeGetSubelementList;
 virXMLNodeNameEqual;
 virXMLNodeSanitizeNamespaces;
 virXMLNodeToString;
diff --git a/src/util/virxml.c b/src/util/virxml.c
index 9b6ccfd6c9..7c853a591a 100644
--- a/src/util/virxml.c
+++ b/src/util/virxml.c
@@ -872,6 +872,35 @@ virXMLNodeGetSubelement(xmlNodePtr node,
 }


+/**
+ * virXMLNodeGetSubelementList:
+ * @node: node to get subelement of
+ * @name: name of subelement to fetch (NULL to fetch all sub-elements)
+ *
+ * Find and return a sub-elements node of @node named @name in a GPtrArray
+ * populated with the xmlNodePtr objects. Caller is responsible for freeing the
+ * array but not the contained xmlNode objects.
+ */
+GPtrArray *
+virXMLNodeGetSubelementList(xmlNodePtr node,
+const char *name)
+{
+GPtrArray *ret = g_ptr_array_new();
+xmlNodePtr n;
+
+for (n = node->children; n; n = n->next) {
+if (n->type == XML_ELEMENT_NODE) {
+if (name && !virXMLNodeNameEqual(n, name))
+continue;
+
+g_ptr_array_add(ret, n);
+}
+}
+
+return ret;
+}
+
+
 /**
  * virXPathNode:
  * @xpath: the XPath string to evaluate
diff --git a/src/util/virxml.h b/src/util/virxml.h
index d5b998263c..46a4550788 100644
--- a/src/util/virxml.h
+++ b/src/util/virxml.h
@@ -77,6 +77,10 @@ xmlNodePtr
 virXMLNodeGetSubelement(xmlNodePtr node,
 const char *name);

+GPtrArray *
+virXMLNodeGetSubelementList(xmlNodePtr node,
+const char *name);
+
 xmlNodePtr
 virXPathNode(const char *xpath,
  xmlXPathContextPtr ctxt);
-- 
2.39.2



[PATCH 03/21] qemuxml2(argv|xml)test: Remove 'iothreads' case

2023-03-02 Thread Peter Krempa
'iothreads-disk' covers everything that 'iothreads' did in addition to
actually using the iothread.

Signed-off-by: Peter Krempa 
---
 tests/qemuxml2argvdata/iothreads.args  | 35 -
 tests/qemuxml2argvdata/iothreads.xml   | 31 --
 tests/qemuxml2argvtest.c   |  1 -
 tests/qemuxml2xmloutdata/iothreads.xml | 36 --
 tests/qemuxml2xmltest.c|  1 -
 5 files changed, 104 deletions(-)
 delete mode 100644 tests/qemuxml2argvdata/iothreads.args
 delete mode 100644 tests/qemuxml2argvdata/iothreads.xml
 delete mode 100644 tests/qemuxml2xmloutdata/iothreads.xml

diff --git a/tests/qemuxml2argvdata/iothreads.args 
b/tests/qemuxml2argvdata/iothreads.args
deleted file mode 100644
index 88e6fa4906..00
--- a/tests/qemuxml2argvdata/iothreads.args
+++ /dev/null
@@ -1,35 +0,0 @@
-LC_ALL=C \
-PATH=/bin \
-HOME=/tmp/lib/domain--1-QEMUGuest1 \
-USER=test \
-LOGNAME=test \
-XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \
-XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \
-XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
-/usr/bin/qemu-system-i386 \
--name guest=QEMUGuest1,debug-threads=on \
--S \
--object 
secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes
 \
--machine pc,usb=off,dump-guest-core=off \
--accel tcg \
--m 214 \
--overcommit mem-lock=off \
--smp 2,sockets=2,cores=1,threads=1 \
--object iothread,id=iothread1 \
--object iothread,id=iothread2 \
--uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
--display none \
--no-user-config \
--nodefaults \
--chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
--mon chardev=charmonitor,id=monitor,mode=control \
--rtc base=utc \
--no-shutdown \
--no-acpi \
--boot strict=on \
--usb \
--blockdev 
'{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}'
 \
--blockdev 
'{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}'
 \
--device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1 
\
--audiodev '{"id":"audio1","driver":"none"}' \
--msg timestamp=on
diff --git a/tests/qemuxml2argvdata/iothreads.xml 
b/tests/qemuxml2argvdata/iothreads.xml
deleted file mode 100644
index 1c860ddd25..00
--- a/tests/qemuxml2argvdata/iothreads.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-
-  QEMUGuest1
-  c7a5fdbd-edaf-9455-926a-d65c16db1809
-  219136
-  219136
-  2
-  2
-  
-hvm
-
-  
-  
-  destroy
-  restart
-  destroy
-  
-/usr/bin/qemu-system-i386
-
-  
-  
-  
-  
-
-
-
-
-
-
-
-  
-
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 1956e6da08..5db882a142 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1883,7 +1883,6 @@ mymain(void)
 DO_TEST_NOCAPS("smp");
 DO_TEST("smp-dies", QEMU_CAPS_SMP_DIES);

-DO_TEST("iothreads", QEMU_CAPS_OBJECT_IOTHREAD);
 DO_TEST("iothreads-ids", QEMU_CAPS_OBJECT_IOTHREAD);
 DO_TEST("iothreads-ids-partial", QEMU_CAPS_OBJECT_IOTHREAD);
 DO_TEST_CAPS_LATEST("iothreads-ids-pool-sizes");
diff --git a/tests/qemuxml2xmloutdata/iothreads.xml 
b/tests/qemuxml2xmloutdata/iothreads.xml
deleted file mode 100644
index 17e5f8bce1..00
--- a/tests/qemuxml2xmloutdata/iothreads.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-
-  QEMUGuest1
-  c7a5fdbd-edaf-9455-926a-d65c16db1809
-  219136
-  219136
-  2
-  2
-  
-hvm
-
-  
-  
-  destroy
-  restart
-  destroy
-  
-/usr/bin/qemu-system-i386
-
-  
-  
-  
-  
-
-
-  
-
-
-  
-
-
-
-
-
-
-  
-
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 2d2d800523..676a707f44 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -582,7 +582,6 @@ mymain(void)
 DO_TEST_CAPS_LATEST("numavcpus-topology-mismatch");

 DO_TEST_NOCAPS("smp");
-DO_TEST_NOCAPS("iothreads");
 DO_TEST_NOCAPS("iothreads-ids");
 DO_TEST_CAPS_LATEST("iothreads-ids-pool-sizes");
 DO_TEST_NOCAPS("iothreads-ids-partial");
-- 
2.39.2



[PATCH 07/21] qemuxml2(argv|xmltest): Simplify testing of scheduler settings

2023-03-02 Thread Peter Krempa
Remove the cputune-iothreads, cputune-iothreadsched-zeropriority,
cputune-iothreadsched test files by moving the relevant elements into
the cputune case as we can setup scheduler settings for multiple objects
and thus test everything in one go.

Signed-off-by: Peter Krempa 
---
 tests/qemuxml2argvdata/cputune-iothreads.xml  | 39 --
 .../cputune-iothreadsched-zeropriority.xml| 40 ---
 .../cputune-iothreadsched.xml | 39 --
 .../cputune.x86_64-latest.args|  6 ++-
 tests/qemuxml2argvdata/cputune.xml|  8 ++-
 .../qemuxml2xmloutdata/cputune-iothreads.xml  | 48 -
 .../cputune-iothreadsched-zeropriority.xml| 51 ---
 .../cputune-iothreadsched.xml | 51 ---
 .../cputune.x86_64-latest.xml | 10 +++-
 tests/qemuxml2xmltest.c   |  3 --
 10 files changed, 21 insertions(+), 274 deletions(-)
 delete mode 100644 tests/qemuxml2argvdata/cputune-iothreads.xml
 delete mode 100644 
tests/qemuxml2argvdata/cputune-iothreadsched-zeropriority.xml
 delete mode 100644 tests/qemuxml2argvdata/cputune-iothreadsched.xml
 delete mode 100644 tests/qemuxml2xmloutdata/cputune-iothreads.xml
 delete mode 100644 
tests/qemuxml2xmloutdata/cputune-iothreadsched-zeropriority.xml
 delete mode 100644 tests/qemuxml2xmloutdata/cputune-iothreadsched.xml

diff --git a/tests/qemuxml2argvdata/cputune-iothreads.xml 
b/tests/qemuxml2argvdata/cputune-iothreads.xml
deleted file mode 100644
index d55d85c07d..00
--- a/tests/qemuxml2argvdata/cputune-iothreads.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-
-  QEMUGuest1
-  c7a5fdbd-edaf-9455-926a-d65c16db1809
-  219136
-  219136
-  2
-  2
-  
-
-
-
-
-
-
--1
-100
-2048
-  
-  
-hvm
-
-  
-  
-  destroy
-  restart
-  destroy
-  
-/usr/bin/qemu-system-i386
-
-  
-  
-  
-
-
-
-
-
-  
-
diff --git a/tests/qemuxml2argvdata/cputune-iothreadsched-zeropriority.xml 
b/tests/qemuxml2argvdata/cputune-iothreadsched-zeropriority.xml
deleted file mode 100644
index 1144e0f132..00
--- a/tests/qemuxml2argvdata/cputune-iothreadsched-zeropriority.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-
-  QEMUGuest1
-  c7a5fdbd-edaf-9455-926a-d65c16db1809
-  219136
-  219136
-  2
-  4
-  
-2048
-100
--1
-
-
-
-
-
-  
-  
-hvm
-
-  
-  
-  destroy
-  restart
-  destroy
-  
-/usr/bin/qemu-system-i386
-
-  
-  
-  
-
-
-
-
-
-
-
-  
-
diff --git a/tests/qemuxml2argvdata/cputune-iothreadsched.xml 
b/tests/qemuxml2argvdata/cputune-iothreadsched.xml
deleted file mode 100644
index 73bcec602e..00
--- a/tests/qemuxml2argvdata/cputune-iothreadsched.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-
-  QEMUGuest1
-  c7a5fdbd-edaf-9455-926a-d65c16db1809
-  219136
-  219136
-  2
-  4
-  
-2048
-100
--1
-
-
-
-
-
-
-  
-  
-hvm
-
-  
-  
-  destroy
-  restart
-  destroy
-  
-/usr/bin/qemu-system-i386
-
-  
-  
-  
-
-
-
-
-
-  
-
diff --git a/tests/qemuxml2argvdata/cputune.x86_64-latest.args 
b/tests/qemuxml2argvdata/cputune.x86_64-latest.args
index d77c1db2c2..e52211ee6d 100644
--- a/tests/qemuxml2argvdata/cputune.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/cputune.x86_64-latest.args
@@ -16,7 +16,11 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
 -m 214 \
 -object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \
 -overcommit mem-lock=off \
--smp 2,sockets=2,cores=1,threads=1 \
+-smp 4,sockets=4,cores=1,threads=1 \
+-object '{"qom-type":"iothread","id":"iothread1"}' \
+-object '{"qom-type":"iothread","id":"iothread2"}' \
+-object '{"qom-type":"iothread","id":"iothread3"}' \
+-object '{"qom-type":"iothread","id":"iothread4"}' \
 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
 -display none \
 -no-user-config \
diff --git a/tests/qemuxml2argvdata/cputune.xml 
b/tests/qemuxml2argvdata/cputune.xml
index 3c8116f637..722636780c 100644
--- a/tests/qemuxml2argvdata/cputune.xml
+++ b/tests/qemuxml2argvdata/cputune.xml
@@ -3,7 +3,8 @@
   c7a5fdbd-edaf-9455-926a-d65c16db1809
   219136
   219136
-  2
+  4
+  4
   
 2048
 100
@@ -15,6 +16,11 @@
 
 
 
+
+
+
+
+
   
   
 hvm
diff --git a/tests/qemuxml2xmloutdata/cputune-iothreads.xml 
b/tests/qemuxml2xmloutdata/cputune-iothreads.xml
deleted file mode 100644
index 36c4b0920f..00
--- a/tests/qemuxml2xmloutdata/cputune-iothreads.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-
-  QEMUGuest1
-  c7a5fdbd-edaf-9455-926a-d65c16db1809
-  219136
-  219136
-  2
-  2
-  
-2048
-100
--1
-
-
-
-
-
-  
-  
-hvm
-
-  
-  
-  destroy
-  restart
-  destroy
-  
-/usr/bin/qemu-system-i386
-
-  
-  
-  
-  
-
-
-  
-
-
-  
-
-

[PATCH RFC 19/21] qemu: capabilities: Introduce QEMU_CAPS_VIRTIO_BLK_IOTHREAD_MAPPING

2023-03-02 Thread Peter Krempa
The capability represents the support for mapping virtqueues to
iothreads for the 'virtio-blk' device.

Signed-off-by: Peter Krempa 
---
 src/qemu/qemu_capabilities.c | 2 ++
 src/qemu/qemu_capabilities.h | 1 +
 tests/qemucapabilitiesdata/caps_8.0.0.x86_64.xml | 1 +
 3 files changed, 4 insertions(+)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 39d3ea3e97..d7a8bb124f 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -690,6 +690,7 @@ VIR_ENUM_IMPL(virQEMUCaps,

   /* 445 */
   "netdev.stream.reconnect", /* QEMU_CAPS_NETDEV_STREAM_RECONNECT 
*/
+  "virtio-blk.iothread-mapping", /* 
QEMU_CAPS_VIRTIO_BLK_IOTHREAD_MAPPING */
 );


@@ -1439,6 +1440,7 @@ static struct virQEMUCapsDevicePropsFlags 
virQEMUCapsDevicePropsVirtioBlk[] = {
 { "scsi", QEMU_CAPS_VIRTIO_BLK_SCSI, 
virQEMUCapsDevicePropsVirtioBlkSCSIDefault },
 { "queue-size", QEMU_CAPS_VIRTIO_BLK_QUEUE_SIZE, NULL },
 { "acpi-index", QEMU_CAPS_ACPI_INDEX, NULL },
+{ "iothread-vq-mapping", QEMU_CAPS_VIRTIO_BLK_IOTHREAD_MAPPING, NULL },
 };

 static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsVirtioNet[] = {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index fd2f237aaf..7721c4a2f9 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -669,6 +669,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for 
syntax-check */

 /* 445 */
 QEMU_CAPS_NETDEV_STREAM_RECONNECT, /* -netdev stream supports reconnect */
+QEMU_CAPS_VIRTIO_BLK_IOTHREAD_MAPPING, /* virtio-blk supports 
per-virtqueue iothread mapping */

 QEMU_CAPS_LAST /* this must always be the last item */
 } virQEMUCapsFlags;
diff --git a/tests/qemucapabilitiesdata/caps_8.0.0.x86_64.xml 
b/tests/qemucapabilitiesdata/caps_8.0.0.x86_64.xml
index 8ebaf9da7e..c55bbe07b8 100644
--- a/tests/qemucapabilitiesdata/caps_8.0.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_8.0.0.x86_64.xml
@@ -204,6 +204,7 @@
   
   
   
+  
   7002050
   0
   43100244
-- 
2.39.2



[PATCH 14/21] conf: Store the iothread 'poll' settings in the XML

2023-03-02 Thread Peter Krempa
Currently we allow configuring the 'poll-max-ns', 'poll-grow', and
'poll-shrink' parameters of qemu iothreads only during runtime and they
are not persisted. Add XML machinery to persist them.

Signed-off-by: Peter Krempa 
---
 docs/formatdomain.rst | 11 -
 src/conf/domain_conf.c| 41 ++-
 src/conf/domain_conf.h|  7 
 src/conf/schemas/domaincommon.rng | 19 +
 .../iothreads-ids-pool-sizes.xml  | 12 --
 5 files changed, 85 insertions(+), 5 deletions(-)

diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
index 638768c18d..eff17c1532 100644
--- a/docs/formatdomain.rst
+++ b/docs/formatdomain.rst
@@ -730,7 +730,9 @@ host/guest with many LUNs. :since:`Since 1.2.8 (QEMU only)`



-   
+   
+ 
+   
  
  
  ...
@@ -756,6 +758,13 @@ host/guest with many LUNs. :since:`Since 1.2.8 (QEMU only)`
``thread_pool_max`` which allow setting lower and upper boundary for number
of worker threads for given IOThread. While the former can be value of zero,
the latter can't. :since:`Since 8.5.0`
+   :since:`Since 9.1.0` an optional sub-element ``poll`` with can be used to
+   override the hypervisor-default interval of polling for the iothread before
+   it switches back to events. The optional attribute ``max`` sets the maximum
+   time polling should be used in nanoseconds. Setting ``max`` to ``0`` 
disables
+   polling. Attributes ``grow`` and ``shrink`` override (or disable when set to
+   ``0`` the default steps for increasing/decreasing the polling interval if
+   the set interval is deemed insufficient or extensive.
 ``defaultiothread``
This element represents the default event loop within hypervisor, where I/O
requests from devices not assigned to a specific IOThread are processed.
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index ad2b44b610..9426d55f8d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -15779,6 +15779,7 @@ static virDomainIOThreadIDDef *
 virDomainIOThreadIDDefParseXML(xmlNodePtr node)
 {
 g_autoptr(virDomainIOThreadIDDef) iothrid = virDomainIOThreadIDDefNew();
+xmlNodePtr pollNode;

 if (virXMLPropUInt(node, "id", 10,
VIR_XML_PROP_REQUIRED | VIR_XML_PROP_NONZERO,
@@ -15795,6 +15796,28 @@ virDomainIOThreadIDDefParseXML(xmlNodePtr node)
   >thread_pool_max, -1) < 0)
 return NULL;

+if ((pollNode = virXMLNodeGetSubelement(node, "poll"))) {
+int rc;
+
+if ((rc = virXMLPropULongLong(pollNode, "max", 10, VIR_XML_PROP_NONE,
+  >poll_max_ns)) < 0)
+return NULL;
+
+iothrid->set_poll_max_ns = rc == 1;
+
+if ((rc = virXMLPropUInt(pollNode, "grow", 10, VIR_XML_PROP_NONE,
+ >poll_grow)) < 0)
+return NULL;
+
+iothrid->set_poll_grow = rc == 1;
+
+if ((rc = virXMLPropUInt(pollNode, "shrink", 10, VIR_XML_PROP_NONE,
+ >poll_shrink)) < 0)
+return NULL;
+
+iothrid->set_poll_shrink = rc == 1;
+}
+
 return g_steal_pointer();
 }

@@ -26655,6 +26678,9 @@ virDomainDefIothreadShouldFormat(const virDomainDef 
*def)

 for (i = 0; i < def->niothreadids; i++) {
 if (!def->iothreadids[i]->autofill ||
+def->iothreadids[i]->set_poll_max_ns ||
+def->iothreadids[i]->set_poll_grow ||
+def->iothreadids[i]->set_poll_shrink ||
 def->iothreadids[i]->thread_pool_min >= 0 ||
 def->iothreadids[i]->thread_pool_max >= 0)
 return true;
@@ -26703,6 +26729,8 @@ virDomainDefIOThreadsFormat(virBuffer *buf,
 for (i = 0; i < def->niothreadids; i++) {
 virDomainIOThreadIDDef *iothread = def->iothreadids[i];
 g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
+g_auto(virBuffer) iothreadChildBuf = 
VIR_BUFFER_INIT_CHILD();
+g_auto(virBuffer) pollAttrBuf = VIR_BUFFER_INITIALIZER;

 virBufferAsprintf(, " id='%u'",
   iothread->iothread_id);
@@ -26717,7 +26745,18 @@ virDomainDefIOThreadsFormat(virBuffer *buf,
   iothread->thread_pool_max);
 }

-virXMLFormatElement(, "iothread", , NULL);
+if (iothread->set_poll_max_ns)
+virBufferAsprintf(, " max='%llu'", 
iothread->poll_max_ns);
+
+if (iothread->set_poll_grow)
+virBufferAsprintf(, " grow='%u'", 
iothread->poll_grow);
+
+if (iothread->set_poll_shrink)
+virBufferAsprintf(, " shrink='%u'", 
iothread->poll_shrink);
+
+virXMLFormatElement(, "poll", , NULL);
+
+virXMLFormatElement(, "iothread", , 
);
 }

 virXMLFormatElement(buf, "iothreadids", NULL, );

[PATCH 16/21] docs: formatdomain: Properly indent example XML for setting 'metadata_cache'

2023-03-02 Thread Peter Krempa
Indent the example XML block so that it belongs to the paragraph talking
about it.

Signed-off-by: Peter Krempa 
---
 docs/formatdomain.rst | 42 --
 1 file changed, 20 insertions(+), 22 deletions(-)

diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
index eff17c1532..d831c1e527 100644
--- a/docs/formatdomain.rst
+++ b/docs/formatdomain.rst
@@ -3256,28 +3256,26 @@ paravirtualized driver is specified via the ``disk`` 
element.
   to the ``qemu``
   `qcow2 cache docs 
`__

-  **Example:**
-
-::
-
-   
- 
-   
- 1234
-   
- 
- 
- 
-   
- 
-   1234
- 
-   
-   
-   
- 
- 
-   
+  **Example**::
+
+
+  
+
+  1234
+
+  
+  
+  
+
+  
+1234
+  
+
+
+
+  
+  
+

 ``backenddomain``
The optional ``backenddomain`` element allows specifying a backend domain
-- 
2.39.2



[PATCH 13/21] qemu: capabilities: Retire unused QEMU_CAPS_IOTHREAD_POLLING

2023-03-02 Thread Peter Krempa
We now always assume support for polling mode of iothreads.

Signed-off-by: Peter Krempa 
---
 src/qemu/qemu_capabilities.c  | 3 +--
 src/qemu/qemu_capabilities.h  | 2 +-
 tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml | 1 -
 tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml   | 1 -
 tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml   | 1 -
 tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml  | 1 -
 tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml | 1 -
 tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml   | 1 -
 tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml | 1 -
 tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml  | 1 -
 tests/qemucapabilitiesdata/caps_5.1.0.sparc.xml   | 1 -
 tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml  | 1 -
 tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml | 1 -
 tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml   | 1 -
 tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml | 1 -
 tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml   | 1 -
 tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml  | 1 -
 tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml | 1 -
 tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml   | 1 -
 tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml  | 1 -
 tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml  | 1 -
 tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml | 1 -
 tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml   | 1 -
 tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml  | 1 -
 tests/qemucapabilitiesdata/caps_7.0.0.aarch64.xml | 1 -
 tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml   | 1 -
 tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml  | 1 -
 tests/qemucapabilitiesdata/caps_7.1.0.ppc64.xml   | 1 -
 tests/qemucapabilitiesdata/caps_7.1.0.x86_64.xml  | 1 -
 tests/qemucapabilitiesdata/caps_7.2.0.x86_64.xml  | 1 -
 tests/qemucapabilitiesdata/caps_8.0.0.riscv64.xml | 1 -
 tests/qemucapabilitiesdata/caps_8.0.0.x86_64.xml  | 1 -
 32 files changed, 2 insertions(+), 33 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index dfcd573b5e..39d3ea3e97 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -511,7 +511,7 @@ VIR_ENUM_IMPL(virQEMUCaps,
   "zpci", /* QEMU_CAPS_DEVICE_ZPCI */
   "memory-backend-memfd", /* QEMU_CAPS_OBJECT_MEMORY_MEMFD */
   "memory-backend-memfd.hugetlb", /* 
QEMU_CAPS_OBJECT_MEMORY_MEMFD_HUGETLB */
-  "iothread.poll-max-ns", /* QEMU_CAPS_IOTHREAD_POLLING */
+  "iothread.poll-max-ns", /* X_QEMU_CAPS_IOTHREAD_POLLING */

   /* 320 */
   "machine.pseries.cap-nested-hv", /* 
QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV */
@@ -1569,7 +1569,6 @@ static struct virQEMUCapsStringFlags 
virQEMUCapsQMPSchemaQueries[] = {
 { "query-display-options/ret-type/+egl-headless/rendernode", 
QEMU_CAPS_EGL_HEADLESS_RENDERNODE },
 { "query-display-options/ret-type/+sdl", QEMU_CAPS_SDL },
 { "query-display-options/ret-type/+egl-headless", QEMU_CAPS_EGL_HEADLESS },
-{ "query-iothreads/ret-type/poll-max-ns", QEMU_CAPS_IOTHREAD_POLLING },
 { "query-hotpluggable-cpus/ret-type/props/die-id", QEMU_CAPS_SMP_DIES },
 { "query-named-block-nodes/arg-type/flat", 
QEMU_CAPS_QMP_QUERY_NAMED_BLOCK_NODES_FLAT },
 { "screendump/arg-type/device", QEMU_CAPS_SCREENDUMP_DEVICE },
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index d778f0f60d..fd2f237aaf 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -490,7 +490,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for 
syntax-check */
 QEMU_CAPS_DEVICE_ZPCI, /* -device zpci */
 QEMU_CAPS_OBJECT_MEMORY_MEMFD, /* -object memory-backend-memfd */
 QEMU_CAPS_OBJECT_MEMORY_MEMFD_HUGETLB, /* -object 
memory-backend-memfd.hugetlb */
-QEMU_CAPS_IOTHREAD_POLLING, /* -object iothread.poll-max-ns */
+X_QEMU_CAPS_IOTHREAD_POLLING, /* -object iothread.poll-max-ns */

 /* 320 */
 QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV, /* -machine pseries.cap-nested-hv 
*/
diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml 
b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml
index 7fc098125e..3a082a8fee 100644
--- a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml
+++ b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml
@@ -87,7 +87,6 @@
   
   
   
-  
   
   
   
diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml 
b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml
index e1eac1f12f..de9c102caa 100644
--- a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml
+++ b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml
@@ -87,7 +87,6 @@
   
   
   
-  
   
   
   
diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml 
b/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml
index 1deef79501..cd13201c68 100644
--- a/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml
+++ b/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml
@@ -56,7 +56,6 @@
   
   
   
-  
   
   
   
diff --git 

[PATCH 08/21] qemuxml2argvtest: Modernize negative cputune-* cases

2023-03-02 Thread Peter Krempa
Use latest caps for the tests even though the original test case didn't
need any capabilities.

Signed-off-by: Peter Krempa 
---
 ...ch.err => cputune-iothreadsched-toomuch.x86_64-latest.err} | 0
 ...verlap.err => cputune-vcpusched-overlap.x86_64-latest.err} | 0
 tests/qemuxml2argvtest.c  | 4 ++--
 3 files changed, 2 insertions(+), 2 deletions(-)
 rename tests/qemuxml2argvdata/{cputune-iothreadsched-toomuch.err => 
cputune-iothreadsched-toomuch.x86_64-latest.err} (100%)
 rename tests/qemuxml2argvdata/{cputune-vcpusched-overlap.err => 
cputune-vcpusched-overlap.x86_64-latest.err} (100%)

diff --git a/tests/qemuxml2argvdata/cputune-iothreadsched-toomuch.err 
b/tests/qemuxml2argvdata/cputune-iothreadsched-toomuch.x86_64-latest.err
similarity index 100%
rename from tests/qemuxml2argvdata/cputune-iothreadsched-toomuch.err
rename to tests/qemuxml2argvdata/cputune-iothreadsched-toomuch.x86_64-latest.err
diff --git a/tests/qemuxml2argvdata/cputune-vcpusched-overlap.err 
b/tests/qemuxml2argvdata/cputune-vcpusched-overlap.x86_64-latest.err
similarity index 100%
rename from tests/qemuxml2argvdata/cputune-vcpusched-overlap.err
rename to tests/qemuxml2argvdata/cputune-vcpusched-overlap.x86_64-latest.err
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 3807aee947..81d0044f0f 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1962,8 +1962,8 @@ mymain(void)
 DO_TEST_NOCAPS("blkiotune-device");
 DO_TEST_CAPS_LATEST("cputune");
 DO_TEST_CAPS_LATEST("cputune-zero-shares");
-DO_TEST_PARSE_ERROR_NOCAPS("cputune-iothreadsched-toomuch");
-DO_TEST_PARSE_ERROR_NOCAPS("cputune-vcpusched-overlap");
+DO_TEST_CAPS_LATEST_PARSE_ERROR("cputune-iothreadsched-toomuch");
+DO_TEST_CAPS_LATEST_PARSE_ERROR("cputune-vcpusched-overlap");
 DO_TEST_CAPS_LATEST("cputune-numatune");
 DO_TEST_CAPS_LATEST("vcpu-placement-static");
 DO_TEST_CAPS_LATEST("cputune-cpuset-big-id");
-- 
2.39.2



[PATCH 10/21] qemu: Always assume support for iothreads

2023-03-02 Thread Peter Krempa
iothreads were introduced in qemu-2.0 and can't be compiled out thus we
can always assume qemu supports them.

Signed-off-by: Peter Krempa 
---
 src/qemu/qemu_capabilities.c |  2 +-
 src/qemu/qemu_driver.c   | 21 +
 src/qemu/qemu_process.c  | 23 ---
 3 files changed, 2 insertions(+), 44 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 3cb5785baa..6ba9b109a5 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -6403,7 +6403,7 @@ struct virQEMUCapsDomainFeatureCapabilityTuple {
  * capability XML. Use QEMU_CAPS_LAST to always enable a domain feature.
  * */
 static const struct virQEMUCapsDomainFeatureCapabilityTuple domCapsTuples[] = {
-{ VIR_DOMAIN_CAPS_FEATURE_IOTHREADS, QEMU_CAPS_OBJECT_IOTHREAD },
+{ VIR_DOMAIN_CAPS_FEATURE_IOTHREADS, QEMU_CAPS_LAST },
 { VIR_DOMAIN_CAPS_FEATURE_VMCOREINFO, QEMU_CAPS_DEVICE_VMCOREINFO },
 { VIR_DOMAIN_CAPS_FEATURE_GENID, QEMU_CAPS_DEVICE_VMGENID },
 { VIR_DOMAIN_CAPS_FEATURE_BACKING_STORE_INPUT, QEMU_CAPS_LAST },
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index d00eb1796f..fcec445f14 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4728,7 +4728,6 @@ static int
 qemuDomainGetIOThreadsLive(virDomainObj *vm,
virDomainIOThreadInfoPtr **info)
 {
-qemuDomainObjPrivate *priv;
 qemuMonitorIOThreadInfo **iothreads = NULL;
 virDomainIOThreadInfoPtr *info_ret = NULL;
 int niothreads = 0;
@@ -4744,13 +4743,6 @@ qemuDomainGetIOThreadsLive(virDomainObj *vm,
 goto endjob;
 }

-priv = vm->privateData;
-if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_IOTHREAD)) {
-virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-   _("IOThreads not supported with this binary"));
-goto endjob;
-}
-
 if ((ret = qemuDomainGetIOThreadsMon(vm, , )) < 0)
 goto endjob;

@@ -5428,12 +5420,6 @@ qemuDomainChgIOThread(virQEMUDriver *driver,
 }

 if (def) {
-if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_IOTHREAD)) {
-virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-   _("IOThreads not supported with this binary"));
-goto endjob;
-}
-
 switch (action) {
 case VIR_DOMAIN_IOTHREAD_ACTION_ADD:
 if (virDomainDriverAddIOThreadCheck(def, iothread.iothread_id) < 0)
@@ -18395,11 +18381,6 @@ struct qemuDomainGetStatsWorker {
 };


-static virQEMUCapsFlags queryIOThreadRequired[] = {
-QEMU_CAPS_OBJECT_IOTHREAD,
-QEMU_CAPS_LAST
-};
-
 static virQEMUCapsFlags queryDirtyRateRequired[] = {
 QEMU_CAPS_QUERY_DIRTY_RATE,
 QEMU_CAPS_LAST
@@ -18418,7 +18399,7 @@ static struct qemuDomainGetStatsWorker 
qemuDomainGetStatsWorkers[] = {
 { qemuDomainGetStatsInterface, VIR_DOMAIN_STATS_INTERFACE, false, NULL },
 { qemuDomainGetStatsBlock, VIR_DOMAIN_STATS_BLOCK, true, NULL },
 { qemuDomainGetStatsPerf, VIR_DOMAIN_STATS_PERF, false, NULL },
-{ qemuDomainGetStatsIOThread, VIR_DOMAIN_STATS_IOTHREAD, true, 
queryIOThreadRequired },
+{ qemuDomainGetStatsIOThread, VIR_DOMAIN_STATS_IOTHREAD, true, NULL },
 { qemuDomainGetStatsMemory, VIR_DOMAIN_STATS_MEMORY, false, NULL },
 { qemuDomainGetStatsDirtyRate, VIR_DOMAIN_STATS_DIRTYRATE, true, 
queryDirtyRateRequired },
 { qemuDomainGetStatsVm, VIR_DOMAIN_STATS_VM, true, queryVmRequired },
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 63d7e1138d..678a8f52f4 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2350,11 +2350,6 @@ qemuProcessDetectIOThreadPIDs(virDomainObj *vm,
 int ret = -1;
 size_t i;

-if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_IOTHREAD)) {
-ret = 0;
-goto cleanup;
-}
-
 /* Get the list of IOThreads from qemu */
 if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0)
 goto cleanup;
@@ -5365,21 +5360,6 @@ qemuProcessStartValidateGraphics(virDomainObj *vm)
 }


-static int
-qemuProcessStartValidateIOThreads(virDomainObj *vm,
-  virQEMUCaps *qemuCaps)
-{
-if (vm->def->niothreadids > 0 &&
-!virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_IOTHREAD)) {
-virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-   _("IOThreads not supported for this QEMU"));
-return -1;
-}
-
-return 0;
-}
-
-
 static int
 qemuProcessStartValidateShmem(virDomainObj *vm)
 {
@@ -5554,9 +5534,6 @@ qemuProcessStartValidate(virQEMUDriver *driver,
 if (qemuProcessStartValidateGraphics(vm) < 0)
 return -1;

-if (qemuProcessStartValidateIOThreads(vm, qemuCaps) < 0)
-return -1;
-
 if (qemuProcessStartValidateShmem(vm) < 0)
 return -1;

-- 
2.39.2



[PATCH 06/21] qemuxml2(argv|xml)test: Modernize 'cputune' test cases

2023-03-02 Thread Peter Krempa
Use DO_TEST_CAPS_LATEST for cputune-numatune, cputune-zero-shares,
cputune, and vcpu-placement-static cases. Do the necessary tweaks to
work with actual data.

Signed-off-by: Peter Krempa 
---
 ...gs => cputune-numatune.x86_64-latest.args} | 13 ---
 ...=> cputune-zero-shares.x86_64-latest.args} | 15 ---
 .../qemuxml2argvdata/cputune-zero-shares.xml  |  4 +-
 ...putune.args => cputune.x86_64-latest.args} | 15 ---
 tests/qemuxml2argvdata/cputune.xml|  4 +-
 .../vcpu-placement-static.args| 33 
 .../vcpu-placement-static.x86_64-latest.args  | 39 +++
 .../vcpu-placement-static.xml | 16 
 tests/qemuxml2argvtest.c  | 12 ++
 ...xml => cputune-numatune.x86_64-latest.xml} |  5 ++-
 ... => cputune-zero-shares.x86_64-latest.xml} |  9 +++--
 ...{cputune.xml => cputune.x86_64-latest.xml} |  9 +++--
 ...> vcpu-placement-static.x86_64-latest.xml} |  0
 tests/qemuxml2xmltest.c   | 10 ++---
 14 files changed, 109 insertions(+), 75 deletions(-)
 rename tests/qemuxml2argvdata/{cputune-numatune.args => 
cputune-numatune.x86_64-latest.args} (55%)
 rename tests/qemuxml2argvdata/{cputune-zero-shares.args => 
cputune-zero-shares.x86_64-latest.args} (59%)
 rename tests/qemuxml2argvdata/{cputune.args => cputune.x86_64-latest.args} 
(59%)
 delete mode 100644 tests/qemuxml2argvdata/vcpu-placement-static.args
 create mode 100644 
tests/qemuxml2argvdata/vcpu-placement-static.x86_64-latest.args
 rename tests/qemuxml2xmloutdata/{cputune-numatune.xml => 
cputune-numatune.x86_64-latest.xml} (86%)
 rename tests/qemuxml2xmloutdata/{cputune-zero-shares.xml => 
cputune-zero-shares.x86_64-latest.xml} (84%)
 rename tests/qemuxml2xmloutdata/{cputune.xml => cputune.x86_64-latest.xml} 
(85%)
 rename tests/qemuxml2xmloutdata/{vcpu-placement-static.xml => 
vcpu-placement-static.x86_64-latest.xml} (100%)

diff --git a/tests/qemuxml2argvdata/cputune-numatune.args 
b/tests/qemuxml2argvdata/cputune-numatune.x86_64-latest.args
similarity index 55%
rename from tests/qemuxml2argvdata/cputune-numatune.args
rename to tests/qemuxml2argvdata/cputune-numatune.x86_64-latest.args
index dbadcb9ec5..627be89d83 100644
--- a/tests/qemuxml2argvdata/cputune-numatune.args
+++ b/tests/qemuxml2argvdata/cputune-numatune.x86_64-latest.args
@@ -9,14 +9,16 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-dummy2/.config \
 /usr/bin/qemu-system-x86_64 \
 -name guest=dummy2,debug-threads=on \
 -S \
--object 
secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-dummy2/master-key.aes \
--machine pc,usb=off,dump-guest-core=off \
+-object 
'{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tmp/lib/domain--1-dummy2/master-key.aes"}'
 \
+-machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram \
 -accel kvm \
+-cpu qemu64 \
 -m 128 \
+-object 
'{"qom-type":"memory-backend-ram","id":"pc.ram","size":134217728,"host-nodes":[0,1,2,3],"policy":"bind"}'
 \
 -overcommit mem-lock=off \
 -smp 2,maxcpus=6,sockets=6,cores=1,threads=1 \
--object iothread,id=iothread1 \
--object iothread,id=iothread2 \
+-object '{"qom-type":"iothread","id":"iothread1"}' \
+-object '{"qom-type":"iothread","id":"iothread2"}' \
 -uuid 4d92ec27-9ebf-400b-ae91-20c71c647c19 \
 -display none \
 -no-user-config \
@@ -27,6 +29,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-dummy2/.config \
 -no-shutdown \
 -no-acpi \
 -boot strict=on \
--usb \
+-device 
'{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \
 -audiodev '{"id":"audio1","driver":"none"}' \
+-sandbox 
on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/cputune-zero-shares.args 
b/tests/qemuxml2argvdata/cputune-zero-shares.x86_64-latest.args
similarity index 59%
rename from tests/qemuxml2argvdata/cputune-zero-shares.args
rename to tests/qemuxml2argvdata/cputune-zero-shares.x86_64-latest.args
index f30ed2fed6..d77c1db2c2 100644
--- a/tests/qemuxml2argvdata/cputune-zero-shares.args
+++ b/tests/qemuxml2argvdata/cputune-zero-shares.x86_64-latest.args
@@ -6,13 +6,15 @@ LOGNAME=test \
 XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \
 XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \
 XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
-/usr/bin/qemu-system-i386 \
+/usr/bin/qemu-system-x86_64 \
 -name guest=QEMUGuest1,debug-threads=on \
 -S \
--object 
secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes
 \
--machine pc,usb=off,dump-guest-core=off \
+-object 
'{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tmp/lib/domain--1-QEMUGuest1/master-key.aes"}'
 \
+-machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram \
 -accel tcg \
+-cpu qemu64 \
 -m 214 \
+-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \
 -overcommit mem-lock=off \
 -smp 2,sockets=2,cores=1,threads=1 \
 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
@@ -25,10 +27,11 @@ 

[PATCH 05/21] qemuxml2xmltest: Modernize iothread CWW/SCSI test cases

2023-03-02 Thread Peter Krempa
The argv counterparts are already modernized.

Signed-off-by: Peter Krempa 
---
 ...ccw.xml => iothreads-disk-virtio-ccw.s390x-latest.xml} | 4 
 ...ccw.xml => iothreads-virtio-scsi-ccw.s390x-latest.xml} | 4 
 ...ci.xml => iothreads-virtio-scsi-pci.x86_64-latest.xml} | 5 -
 tests/qemuxml2xmltest.c   | 8 +++-
 4 files changed, 15 insertions(+), 6 deletions(-)
 rename tests/qemuxml2xmloutdata/{iothreads-disk-virtio-ccw.xml => 
iothreads-disk-virtio-ccw.s390x-latest.xml} (89%)
 rename tests/qemuxml2xmloutdata/{iothreads-virtio-scsi-ccw.xml => 
iothreads-virtio-scsi-ccw.s390x-latest.xml} (90%)
 rename tests/qemuxml2xmloutdata/{iothreads-virtio-scsi-pci.xml => 
iothreads-virtio-scsi-pci.x86_64-latest.xml} (92%)

diff --git a/tests/qemuxml2xmloutdata/iothreads-disk-virtio-ccw.xml 
b/tests/qemuxml2xmloutdata/iothreads-disk-virtio-ccw.s390x-latest.xml
similarity index 89%
rename from tests/qemuxml2xmloutdata/iothreads-disk-virtio-ccw.xml
rename to tests/qemuxml2xmloutdata/iothreads-disk-virtio-ccw.s390x-latest.xml
index 05cb204ea5..cdcee3bbb4 100644
--- a/tests/qemuxml2xmloutdata/iothreads-disk-virtio-ccw.xml
+++ b/tests/qemuxml2xmloutdata/iothreads-disk-virtio-ccw.s390x-latest.xml
@@ -9,6 +9,9 @@
 hvm
 
   
+  
+qemu
+  
   
   destroy
   restart
@@ -28,6 +31,7 @@
   
 
 
+
 
 
   
diff --git a/tests/qemuxml2xmloutdata/iothreads-virtio-scsi-ccw.xml 
b/tests/qemuxml2xmloutdata/iothreads-virtio-scsi-ccw.s390x-latest.xml
similarity index 90%
rename from tests/qemuxml2xmloutdata/iothreads-virtio-scsi-ccw.xml
rename to tests/qemuxml2xmloutdata/iothreads-virtio-scsi-ccw.s390x-latest.xml
index 11fead6c8b..d73f43f235 100644
--- a/tests/qemuxml2xmloutdata/iothreads-virtio-scsi-ccw.xml
+++ b/tests/qemuxml2xmloutdata/iothreads-virtio-scsi-ccw.s390x-latest.xml
@@ -9,6 +9,9 @@
 hvm
 
   
+  
+qemu
+  
   
   destroy
   restart
@@ -32,6 +35,7 @@
   
   
 
+
 
 
   
diff --git a/tests/qemuxml2xmloutdata/iothreads-virtio-scsi-pci.xml 
b/tests/qemuxml2xmloutdata/iothreads-virtio-scsi-pci.x86_64-latest.xml
similarity index 92%
rename from tests/qemuxml2xmloutdata/iothreads-virtio-scsi-pci.xml
rename to tests/qemuxml2xmloutdata/iothreads-virtio-scsi-pci.x86_64-latest.xml
index b2c66ba9b8..5418a38a39 100644
--- a/tests/qemuxml2xmloutdata/iothreads-virtio-scsi-pci.xml
+++ b/tests/qemuxml2xmloutdata/iothreads-virtio-scsi-pci.x86_64-latest.xml
@@ -9,6 +9,9 @@
 hvm
 
   
+  
+qemu64
+  
   
   destroy
   restart
@@ -33,7 +36,7 @@
   
   
 
-
+
   
 
 
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 4d9c6853a7..ef71df7b3f 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -587,11 +587,9 @@ mymain(void)
 DO_TEST_CAPS_LATEST("iothreads-ids-partial");
 DO_TEST_NOCAPS("cputune-iothreads");
 DO_TEST_CAPS_LATEST("iothreads-disk");
-DO_TEST_NOCAPS("iothreads-disk-virtio-ccw");
-DO_TEST("iothreads-virtio-scsi-pci",
-QEMU_CAPS_VIRTIO_SCSI);
-DO_TEST("iothreads-virtio-scsi-ccw",
-QEMU_CAPS_VIRTIO_SCSI);
+DO_TEST_CAPS_ARCH_LATEST("iothreads-disk-virtio-ccw", "s390x");
+DO_TEST_CAPS_LATEST("iothreads-virtio-scsi-pci");
+DO_TEST_CAPS_ARCH_LATEST("iothreads-virtio-scsi-ccw", "s390x");
 DO_TEST_NOCAPS("lease");
 DO_TEST_NOCAPS("event_idx");
 DO_TEST_NOCAPS("vhost_queues");
-- 
2.39.2



[PATCH 04/21] qemuxml2argvtest: Modernize the rest of 'iohtreads-*'

2023-03-02 Thread Peter Krempa
Use DO_TEST_CAPS_LATEST for the basic tests. The emulator needed to be
tweaked to work with the real caps data.

Signed-off-by: Peter Krempa 
---
 ...args => iothreads-disk.x86_64-latest.args} | 21 +++
 tests/qemuxml2argvdata/iothreads-disk.xml |  4 ++--
 ... iothreads-ids-partial.x86_64-latest.args} | 19 ++---
 .../iothreads-ids-partial.xml |  4 ++--
 args => iothreads-ids.x86_64-latest.args} | 19 +
 tests/qemuxml2argvdata/iothreads-ids.xml  |  4 ++--
 tests/qemuxml2argvtest.c  |  6 +++---
 ...k.xml => iothreads-disk.x86_64-latest.xml} |  9 +---
 ...> iothreads-ids-partial.x86_64-latest.xml} |  9 +---
 ...ds.xml => iothreads-ids.x86_64-latest.xml} |  9 +---
 tests/qemuxml2xmltest.c   |  6 +++---
 11 files changed, 64 insertions(+), 46 deletions(-)
 rename tests/qemuxml2argvdata/{iothreads-disk.args => 
iothreads-disk.x86_64-latest.args} (60%)
 rename tests/qemuxml2argvdata/{iothreads-ids.args => 
iothreads-ids-partial.x86_64-latest.args} (54%)
 rename tests/qemuxml2argvdata/{iothreads-ids-partial.args => 
iothreads-ids.x86_64-latest.args} (58%)
 rename tests/qemuxml2xmloutdata/{iothreads-disk.xml => 
iothreads-disk.x86_64-latest.xml} (86%)
 rename tests/qemuxml2xmloutdata/{iothreads-ids-partial.xml => 
iothreads-ids-partial.x86_64-latest.xml} (82%)
 rename tests/qemuxml2xmloutdata/{iothreads-ids.xml => 
iothreads-ids.x86_64-latest.xml} (82%)

diff --git a/tests/qemuxml2argvdata/iothreads-disk.args 
b/tests/qemuxml2argvdata/iothreads-disk.x86_64-latest.args
similarity index 60%
rename from tests/qemuxml2argvdata/iothreads-disk.args
rename to tests/qemuxml2argvdata/iothreads-disk.x86_64-latest.args
index ef80cf4008..1f18c97c97 100644
--- a/tests/qemuxml2argvdata/iothreads-disk.args
+++ b/tests/qemuxml2argvdata/iothreads-disk.x86_64-latest.args
@@ -6,17 +6,19 @@ LOGNAME=test \
 XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \
 XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \
 XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
-/usr/bin/qemu-system-i386 \
+/usr/bin/qemu-system-x86_64 \
 -name guest=QEMUGuest1,debug-threads=on \
 -S \
--object 
secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes
 \
--machine pc,usb=off,dump-guest-core=off \
+-object 
'{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tmp/lib/domain--1-QEMUGuest1/master-key.aes"}'
 \
+-machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram \
 -accel tcg \
+-cpu qemu64 \
 -m 214 \
+-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \
 -overcommit mem-lock=off \
 -smp 2,sockets=2,cores=1,threads=1 \
--object iothread,id=iothread1 \
--object iothread,id=iothread2 \
+-object '{"qom-type":"iothread","id":"iothread1"}' \
+-object '{"qom-type":"iothread","id":"iothread2"}' \
 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
 -display none \
 -no-user-config \
@@ -27,15 +29,16 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
 -no-shutdown \
 -no-acpi \
 -boot strict=on \
--usb \
+-device 
'{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \
 -blockdev 
'{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-3-storage","auto-read-only":true,"discard":"unmap"}'
 \
 -blockdev 
'{"node-name":"libvirt-3-format","read-only":false,"driver":"raw","file":"libvirt-3-storage"}'
 \
--device ide-hd,bus=ide.0,unit=0,drive=libvirt-3-format,id=ide0-0-0,bootindex=1 
\
+-device 
'{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-3-format","id":"ide0-0-0","bootindex":1}'
 \
 -blockdev 
'{"driver":"file","filename":"/var/lib/libvirt/images/iothrtest1.img","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}'
 \
 -blockdev 
'{"node-name":"libvirt-2-format","read-only":false,"driver":"raw","file":"libvirt-2-storage"}'
 \
--device 
virtio-blk-pci,iothread=iothread1,bus=pci.0,addr=0x4,drive=libvirt-2-format,id=virtio-disk1
 \
+-device 
'{"driver":"virtio-blk-pci","iothread":"iothread1","bus":"pci.0","addr":"0x4","drive":"libvirt-2-format","id":"virtio-disk1"}'
 \
 -blockdev 
'{"driver":"file","filename":"/var/lib/libvirt/images/iothrtest2.img","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}'
 \
 -blockdev 
'{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}'
 \
--device 
virtio-blk-pci,iothread=iothread2,bus=pci.0,addr=0x2,drive=libvirt-1-format,id=virtio-disk2
 \
+-device 
'{"driver":"virtio-blk-pci","iothread":"iothread2","bus":"pci.0","addr":"0x2","drive":"libvirt-1-format","id":"virtio-disk2"}'
 \
 -audiodev '{"id":"audio1","driver":"none"}' \
+-sandbox 
on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/iothreads-disk.xml 
b/tests/qemuxml2argvdata/iothreads-disk.xml
index bbfac34db5..485ae3760e 100644
--- 

[PATCH 02/21] qemuxml2argvtest: Remove 'iothreads-nocap'

2023-03-02 Thread Peter Krempa
All supported QEMU versions now support iothreads thus upcoming patches
will be removing the capability checks. Remove the 'iothreads-nocap'
case which will become invalid.

Signed-off-by: Peter Krempa 
---
 tests/qemuxml2argvdata/iothreads-nocap.err |  1 -
 tests/qemuxml2argvdata/iothreads-nocap.xml | 37 --
 tests/qemuxml2argvtest.c   |  1 -
 3 files changed, 39 deletions(-)
 delete mode 100644 tests/qemuxml2argvdata/iothreads-nocap.err
 delete mode 100644 tests/qemuxml2argvdata/iothreads-nocap.xml

diff --git a/tests/qemuxml2argvdata/iothreads-nocap.err 
b/tests/qemuxml2argvdata/iothreads-nocap.err
deleted file mode 100644
index ed2f47ecd5..00
--- a/tests/qemuxml2argvdata/iothreads-nocap.err
+++ /dev/null
@@ -1 +0,0 @@
-unsupported configuration: IOThreads not supported for this QEMU
diff --git a/tests/qemuxml2argvdata/iothreads-nocap.xml 
b/tests/qemuxml2argvdata/iothreads-nocap.xml
deleted file mode 100644
index fa04d735cd..00
--- a/tests/qemuxml2argvdata/iothreads-nocap.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-
-  QEMUGuest1
-  c7a5fdbd-edaf-9455-926a-d65c16db1809
-  219136
-  219136
-  2
-  4
-  
-
-
-  
-  
-
-
-  
-  
-hvm
-
-  
-  
-  destroy
-  restart
-  destroy
-  
-/usr/bin/qemu-system-i386
-
-  
-  
-  
-  
-
-
-
-
-
-  
-
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 5a33c336c8..1956e6da08 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1887,7 +1887,6 @@ mymain(void)
 DO_TEST("iothreads-ids", QEMU_CAPS_OBJECT_IOTHREAD);
 DO_TEST("iothreads-ids-partial", QEMU_CAPS_OBJECT_IOTHREAD);
 DO_TEST_CAPS_LATEST("iothreads-ids-pool-sizes");
-DO_TEST_FAILURE_NOCAPS("iothreads-nocap");
 DO_TEST("iothreads-disk", QEMU_CAPS_OBJECT_IOTHREAD);
 DO_TEST_CAPS_ARCH_VER("iothreads-disk-virtio-ccw", "s390x", "4.2.0");
 DO_TEST_CAPS_VER("iothreads-virtio-scsi-pci", "5.2.0");
-- 
2.39.2



[PATCH 00/21] qemu: IOthread setting changes

2023-03-02 Thread Peter Krempa
This series:
 0) cleans up various things (patches 1, 16)
 1) Fixes and modernizes testing of iothreads (patches 2-9)
 2) Cleans up unneeded iothread capabilities (patches 10 - 13)
 3) Adds XML and commandline support for iothread polling attributes
  (patches 14-15)

 4) Contains a RFC for adding iothread to virtqueue mapping for disks
  (patches 17-21)

   The last patches are RFC because the qemu implementation is not done
   yet. It's based on Stefan's patches which add the intrface part (see
   patch 21)

Peter Krempa (21):
  conf: virDomainDiskDefDriverParseXML: Drop unused XPath infrastructure
  qemuxml2argvtest: Remove 'iothreads-nocap'
  qemuxml2(argv|xml)test: Remove 'iothreads' case
  qemuxml2argvtest: Modernize the rest of 'iohtreads-*'
  qemuxml2xmltest: Modernize iothread CWW/SCSI test cases
  qemuxml2(argv|xml)test: Modernize 'cputune' test cases
  qemuxml2(argv|xmltest): Simplify testing of scheduler settings
  qemuxml2argvtest: Modernize negative cputune-* cases
  tests: qemuxml2argvdata: Remove irrelevant  from 'iothread-*'
cases
  qemu: Always assume support for iothreads
  qemu: capabilities: Retire unused QEMU_CAPS_OBJECT_IOTHREAD
  qemu: Always assume support for QEMU_CAPS_IOTHREAD_POLLING
  qemu: capabilities: Retire unused QEMU_CAPS_IOTHREAD_POLLING
  conf: Store the iothread 'poll' settings in the XML
  qemu: Use configured iothread poll parameters on startup
  docs: formatdomain: Properly indent example XML for setting
'metadata_cache'

 <<< RFC starts here >>>

  util: xml: Introduce virXMLNodeGetSubelement
  qemucapabilitiesdata: Bump qemu-8.0 caps for virtqeueues
  qemu: capabilities: Introduce QEMU_CAPS_VIRTIO_BLK_IOTHREAD_MAPPING
  conf: Add possibility to configure multiple iothreads per disk
  qemu: Implement support for configuring iothread to virtqueue mapping
for disks

 docs/formatdomain.rst |  76 ---
 src/conf/domain_conf.c| 124 ++-
 src/conf/domain_conf.h|  21 ++
 src/conf/domain_validate.c|   8 +
 src/conf/schemas/domaincommon.rng |  66 --
 src/libvirt_private.syms  |   1 +
 src/qemu/qemu_capabilities.c  |  10 +-
 src/qemu/qemu_capabilities.h  |   5 +-
 src/qemu/qemu_command.c   |  63 ++
 src/qemu/qemu_driver.c|  57 ++---
 src/qemu/qemu_process.c   |  23 --
 src/qemu/qemu_validate.c  | 117 ++-
 src/util/virxml.c |  29 +++
 src/util/virxml.h |   4 +
 .../caps_4.2.0.aarch64.xml|   2 -
 .../qemucapabilitiesdata/caps_4.2.0.ppc64.xml |   2 -
 .../qemucapabilitiesdata/caps_4.2.0.s390x.xml |   2 -
 .../caps_4.2.0.x86_64.xml |   2 -
 .../caps_5.0.0.aarch64.xml|   2 -
 .../qemucapabilitiesdata/caps_5.0.0.ppc64.xml |   2 -
 .../caps_5.0.0.riscv64.xml|   2 -
 .../caps_5.0.0.x86_64.xml |   2 -
 .../qemucapabilitiesdata/caps_5.1.0.sparc.xml |   2 -
 .../caps_5.1.0.x86_64.xml |   2 -
 .../caps_5.2.0.aarch64.xml|   2 -
 .../qemucapabilitiesdata/caps_5.2.0.ppc64.xml |   2 -
 .../caps_5.2.0.riscv64.xml|   2 -
 .../qemucapabilitiesdata/caps_5.2.0.s390x.xml |   2 -
 .../caps_5.2.0.x86_64.xml |   2 -
 .../caps_6.0.0.aarch64.xml|   2 -
 .../qemucapabilitiesdata/caps_6.0.0.s390x.xml |   2 -
 .../caps_6.0.0.x86_64.xml |   2 -
 .../caps_6.1.0.x86_64.xml |   2 -
 .../caps_6.2.0.aarch64.xml|   2 -
 .../qemucapabilitiesdata/caps_6.2.0.ppc64.xml |   2 -
 .../caps_6.2.0.x86_64.xml |   2 -
 .../caps_7.0.0.aarch64.xml|   2 -
 .../qemucapabilitiesdata/caps_7.0.0.ppc64.xml |   2 -
 .../caps_7.0.0.x86_64.xml |   2 -
 .../qemucapabilitiesdata/caps_7.1.0.ppc64.xml |   2 -
 .../caps_7.1.0.x86_64.xml |   2 -
 .../caps_7.2.0.x86_64.xml |   2 -
 .../caps_8.0.0.riscv64.xml|   2 -
 .../caps_8.0.0.x86_64.replies | 197 +-
 .../caps_8.0.0.x86_64.xml |   5 +-
 tests/qemuxml2argvdata/cputune-iothreads.xml  |  39 
 ...e-iothreadsched-toomuch.x86_64-latest.err} |   0
 .../cputune-iothreadsched-zeropriority.xml|  40 
 .../cputune-iothreadsched.xml |  39 
 tests/qemuxml2argvdata/cputune-numatune.args  |  32 ---
 ...gs => cputune-numatune.x86_64-latest.args} |  14 +-
 ...utune-vcpusched-overlap.x86_64-latest.err} |   0
 ...=> cputune-zero-shares.x86_64-latest.args} |  15 +-
 .../qemuxml2argvdata/cputune-zero-shares.xml  |   4 +-
 ...artial.args => cputune.x86_64-latest.args} |  24 ++-
 tests/qemuxml2argvdata/cputune.xml| 

[PATCH 01/21] conf: virDomainDiskDefDriverParseXML: Drop unused XPath infrastructure

2023-03-02 Thread Peter Krempa
The function doesn't use XPath at all. Don't pass the context to it.

Signed-off-by: Peter Krempa 
---
 src/conf/domain_conf.c | 9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 39ddfb7db0..ad2b44b610 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -7743,13 +7743,8 @@ virDomainDiskDefGeometryParse(virDomainDiskDef *def,

 static int
 virDomainDiskDefDriverParseXML(virDomainDiskDef *def,
-   xmlNodePtr cur,
-   xmlXPathContextPtr ctxt)
+   xmlNodePtr cur)
 {
-VIR_XPATH_NODE_AUTORESTORE(ctxt)
-
-ctxt->node = cur;
-
 def->driverName = virXMLPropString(cur, "name");

 if (virXMLPropEnum(cur, "cache", virDomainDiskCacheTypeFromString,
@@ -8037,7 +8032,7 @@ virDomainDiskDefParseXML(virDomainXMLOption *xmlopt,
 if (virDomainVirtioOptionsParseXML(driverNode, >virtio) < 0)
 return NULL;

-if (virDomainDiskDefDriverParseXML(def, driverNode, ctxt) < 0)
+if (virDomainDiskDefDriverParseXML(def, driverNode) < 0)
 return NULL;

 if (virDomainDiskDefDriverSourceParseXML(def->src, driverNode, ctxt) < 
0)
-- 
2.39.2



Re: [PATCH] security: Add support for SUSE edk2 firmware paths

2023-03-02 Thread Michal Prívozník
On 2/23/23 19:13, Jim Fehlig wrote:
> SUSE installs edk2 firmwares for both x86_64 and aarch64 in /usr/share/qemu.
> Add support for this path in virt-aa-helper and allow locking files within
> the path in the libvirt qemu abstraction.
> 
> Signed-off-by: Jim Fehlig 
> ---
> 
> FYI, I'm fine maintaining this patch downstream if such distro-specific
> change is unwanted upstream. I've already maintained the virt-aa-helper
> hunk for several years.

I think it makes sense to have it upstream. I too try to upstream gentoo
downstream patches (unless they are very gentoo specific).

> 
>  src/security/apparmor/libvirt-qemu | 2 +-
>  src/security/virt-aa-helper.c  | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
Reviewed-by: Michal Privoznik 

Michal