[PATCH 0/2] build: fix sparc64 host

Pierrick Bouvier posted 2 patches 4 days, 11 hours ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260720221715.27108-1-pierrick.bouvier@oss.qualcomm.com
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, Alex Williamson <alex@shazbot.org>, "Cédric Le Goater" <clg@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, "Philippe Mathieu-Daudé" <philmd@mailo.com>, Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Kconfig.host    | 3 +++
hw/vfio/Kconfig | 8 ++++----
meson.build     | 4 ++++
3 files changed, 11 insertions(+), 4 deletions(-)
[PATCH 0/2] build: fix sparc64 host
Posted by Pierrick Bouvier 4 days, 11 hours ago
It was reported that build on sparc64 host is currently broken, due to inclusion
of asm/kvm.h, which is not present on this platform:
https://lore.kernel.org/qemu-devel/c3a7cd83-7666-40c5-9baa-ebe64edacab6@tls.msk.ru/

Problem is that we assumed in Kconfig that VFIO is available for all linux
hosts, which is wrong. It is limited to linux hosts having kvm support.
Since we already have a meson.build section identifying those hosts, just define
a new CONFIG_KVM_HOST in host configuration.

Pierrick Bouvier (2):
  meson.build: define CONFIG_KVM_HOST
  hw/vfio: restrict to kvm hosts

 Kconfig.host    | 3 +++
 hw/vfio/Kconfig | 8 ++++----
 meson.build     | 4 ++++
 3 files changed, 11 insertions(+), 4 deletions(-)

-- 
2.43.0
Re: [PATCH 0/2] build: fix sparc64 host
Posted by Alex Williamson 4 days, 10 hours ago
On Mon, 20 Jul 2026 22:17:13 +0000
Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com> wrote:

> It was reported that build on sparc64 host is currently broken, due to inclusion
> of asm/kvm.h, which is not present on this platform:
> https://lore.kernel.org/qemu-devel/c3a7cd83-7666-40c5-9baa-ebe64edacab6@tls.msk.ru/

Isn't is sufficient just to remove the stale <linux/kvm.h> include?

I don't know of a case that fails, platforms that support vfio might
actually be a sub-set of those that support KVM, but being dependent on
a KVM supported host has no technical basis.  KVM and VFIO are
independent features where neither should have a hard dependency on the
other.  Thanks,

Alex

> Problem is that we assumed in Kconfig that VFIO is available for all linux
> hosts, which is wrong. It is limited to linux hosts having kvm support.
> Since we already have a meson.build section identifying those hosts, just define
> a new CONFIG_KVM_HOST in host configuration.
> 
> Pierrick Bouvier (2):
>   meson.build: define CONFIG_KVM_HOST
>   hw/vfio: restrict to kvm hosts
> 
>  Kconfig.host    | 3 +++
>  hw/vfio/Kconfig | 8 ++++----
>  meson.build     | 4 ++++
>  3 files changed, 11 insertions(+), 4 deletions(-)
>
Re: [PATCH 0/2] build: fix sparc64 host
Posted by Pierrick Bouvier 4 days, 7 hours ago
On 7/20/2026 4:10 PM, Alex Williamson wrote:
> On Mon, 20 Jul 2026 22:17:13 +0000
> Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com> wrote:
> 
>> It was reported that build on sparc64 host is currently broken, due to inclusion
>> of asm/kvm.h, which is not present on this platform:
>> https://lore.kernel.org/qemu-devel/c3a7cd83-7666-40c5-9baa-ebe64edacab6@tls.msk.ru/
> 
> Isn't is sufficient just to remove the stale <linux/kvm.h> include?
> 
> I don't know of a case that fails, platforms that support vfio might
> actually be a sub-set of those that support KVM, but being dependent on
> a KVM supported host has no technical basis.  KVM and VFIO are
> independent features where neither should have a hard dependency on the
> other.  Thanks,
>

It's related to a recent change that was made to get rid of CONFIG_KVM
in the file to deduplicate hw/vfio/listener.c between targets. So it's
now unconditionally included, thus the regression.

Limit inclusion from the build system is the right way to deal with
this, thus CONFIG_VFIO, thus why we need to do something to control
through Kconfig.

> Alex
> 
>> Problem is that we assumed in Kconfig that VFIO is available for all linux
>> hosts, which is wrong. It is limited to linux hosts having kvm support.
>> Since we already have a meson.build section identifying those hosts, just define
>> a new CONFIG_KVM_HOST in host configuration.
>>
>> Pierrick Bouvier (2):
>>   meson.build: define CONFIG_KVM_HOST
>>   hw/vfio: restrict to kvm hosts
>>
>>  Kconfig.host    | 3 +++
>>  hw/vfio/Kconfig | 8 ++++----
>>  meson.build     | 4 ++++
>>  3 files changed, 11 insertions(+), 4 deletions(-)
>>
>
Re: [PATCH 0/2] build: fix sparc64 host
Posted by Alex Williamson 4 days, 6 hours ago
On Mon, Jul 20, 2026, at 8:48 PM, Pierrick Bouvier wrote:
> On 7/20/2026 4:10 PM, Alex Williamson wrote:
>> On Mon, 20 Jul 2026 22:17:13 +0000
>> Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com> wrote:
>> 
>>> It was reported that build on sparc64 host is currently broken, due to inclusion
>>> of asm/kvm.h, which is not present on this platform:
>>> https://lore.kernel.org/qemu-devel/c3a7cd83-7666-40c5-9baa-ebe64edacab6@tls.msk.ru/
>> 
>> Isn't is sufficient just to remove the stale <linux/kvm.h> include?
>> 
>> I don't know of a case that fails, platforms that support vfio might
>> actually be a sub-set of those that support KVM, but being dependent on
>> a KVM supported host has no technical basis.  KVM and VFIO are
>> independent features where neither should have a hard dependency on the
>> other.  Thanks,
>>
>
> It's related to a recent change that was made to get rid of CONFIG_KVM
> in the file to deduplicate hw/vfio/listener.c between targets. So it's
> now unconditionally included, thus the regression.

I understand.  I'm suggesting the fix is simply:

diff --git a/hw/vfio/listener.c b/hw/vfio/listener.c
index c19600e980a8..008f488a3e7d 100644
--- a/hw/vfio/listener.c
+++ b/hw/vfio/listener.c
@@ -20,7 +20,6 @@
 
 #include "qemu/osdep.h"
 #include <sys/ioctl.h>
-#include <linux/kvm.h>
 #include <linux/vfio.h>
 
 #include "exec/target_page.h"

This builds in both a native amd64 environment and a cross-compiled sparc64 environment.

> Limit inclusion from the build system is the right way to deal with
> this, thus CONFIG_VFIO, thus why we need to do something to control
> through Kconfig.

The right way to deal with the regression is to fix the regression, as done above.  If you further want to avoid building vfio on sparc64, that's a separate discussion and should have nothing whatsoever to do with whether the host supports KVM.  Thanks,

Alex

>>> Problem is that we assumed in Kconfig that VFIO is available for all linux
>>> hosts, which is wrong. It is limited to linux hosts having kvm support.
>>> Since we already have a meson.build section identifying those hosts, just define
>>> a new CONFIG_KVM_HOST in host configuration.
>>>
>>> Pierrick Bouvier (2):
>>>   meson.build: define CONFIG_KVM_HOST
>>>   hw/vfio: restrict to kvm hosts
>>>
>>>  Kconfig.host    | 3 +++
>>>  hw/vfio/Kconfig | 8 ++++----
>>>  meson.build     | 4 ++++
>>>  3 files changed, 11 insertions(+), 4 deletions(-)
>>>
>>
Re: [PATCH 0/2] build: fix sparc64 host
Posted by Michael Tokarev 4 days, 2 hours ago
On 21.07.2026 06:33, Alex Williamson wrote:

> diff --git a/hw/vfio/listener.c b/hw/vfio/listener.c
> index c19600e980a8..008f488a3e7d 100644
> --- a/hw/vfio/listener.c
> +++ b/hw/vfio/listener.c
> @@ -20,7 +20,6 @@
>   
>   #include "qemu/osdep.h"
>   #include <sys/ioctl.h>
> -#include <linux/kvm.h>
>   #include <linux/vfio.h>
>   
>   #include "exec/target_page.h"
> 
> This builds in both a native amd64 environment and a cross-compiled sparc64 environment.

Building it on native sparc64 (and on all other targets) on debian right 
now:
https://buildd.debian.org/status/package.php?p=qemu&suite=experimental

It's - drum roll - finishing building, so I guess it will be fine, let's
see in a few minutes.


An unrelated note: we've very frequent failure of test qemu:io-qcow2-161 
   on ppc64 host:

stderr:
--- /build/reproducible-path/qemu-11.1.0~rc0+ds/tests/qemu-iotests/161.out
+++ 
/build/reproducible-path/qemu-11.1.0~rc0+ds/b/qemu/scratch/qcow2-file-161/161.out.bad
@@ -34,6 +34,8 @@
  *** Commit and then change an option on the backing file

  Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=1048576
+qemu-img: TEST_DIR/t.IMGFMT.base: Failed to get "write" lock
+Is another process using the image [TEST_DIR/t.IMGFMT.base]?
  Formatting 'TEST_DIR/t.IMGFMT.int', fmt=IMGFMT size=1048576 
backing_file=TEST_DIR/t.IMGFMT.base backing_fmt=IMGFMT
  Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 
backing_file=TEST_DIR/t.IMGFMT.int backing_fmt=IMGFMT
  { 'execute': 'qmp_capabilities' }

Retrying several times makes it work in the end.
So far this happens on ppc64 debian buildds only.

Thanks,

/mjt
Re: [PATCH 0/2] build: fix sparc64 host
Posted by Michael Tokarev 3 days, 23 hours ago
On 7/21/26 10:42, Michael Tokarev wrote:
> On 21.07.2026 06:33, Alex Williamson wrote:
> 
>> diff --git a/hw/vfio/listener.c b/hw/vfio/listener.c
>> index c19600e980a8..008f488a3e7d 100644
>> --- a/hw/vfio/listener.c
>> +++ b/hw/vfio/listener.c
>> @@ -20,7 +20,6 @@
>>   #include "qemu/osdep.h"
>>   #include <sys/ioctl.h>
>> -#include <linux/kvm.h>
>>   #include <linux/vfio.h>
>>   #include "exec/target_page.h"
>>
>> This builds in both a native amd64 environment and a cross-compiled sparc64 environment.
> 
> Building it on native sparc64 (and on all other targets) on debian right now:
> https://buildd.debian.org/status/package.php?p=qemu&suite=experimental
> 
> It's - drum roll - finishing building, so I guess it will be fine, let's
> see in a few minutes.

With this change, everything is now green on the debian side.

Thanks,

/mjt

Re: [PATCH 0/2] build: fix sparc64 host
Posted by Cédric Le Goater 4 days, 4 hours ago
On 7/21/26 05:33, Alex Williamson wrote:
> On Mon, Jul 20, 2026, at 8:48 PM, Pierrick Bouvier wrote:
>> On 7/20/2026 4:10 PM, Alex Williamson wrote:
>>> On Mon, 20 Jul 2026 22:17:13 +0000
>>> Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com> wrote:
>>>
>>>> It was reported that build on sparc64 host is currently broken, due to inclusion
>>>> of asm/kvm.h, which is not present on this platform:
>>>> https://lore.kernel.org/qemu-devel/c3a7cd83-7666-40c5-9baa-ebe64edacab6@tls.msk.ru/
>>>
>>> Isn't is sufficient just to remove the stale <linux/kvm.h> include?
>>>
>>> I don't know of a case that fails, platforms that support vfio might
>>> actually be a sub-set of those that support KVM, but being dependent on
>>> a KVM supported host has no technical basis.  KVM and VFIO are
>>> independent features where neither should have a hard dependency on the
>>> other.  Thanks,
>>>
>>
>> It's related to a recent change that was made to get rid of CONFIG_KVM
>> in the file to deduplicate hw/vfio/listener.c between targets. So it's
>> now unconditionally included, thus the regression.
> 
> I understand.  I'm suggesting the fix is simply:
> 
> diff --git a/hw/vfio/listener.c b/hw/vfio/listener.c
> index c19600e980a8..008f488a3e7d 100644
> --- a/hw/vfio/listener.c
> +++ b/hw/vfio/listener.c
> @@ -20,7 +20,6 @@
>   
>   #include "qemu/osdep.h"
>   #include <sys/ioctl.h>
> -#include <linux/kvm.h>
>   #include <linux/vfio.h>
>   
>   #include "exec/target_page.h"
> 
> This builds in both a native amd64 environment and a cross-compiled sparc64 environment.

This leaves linux/kvm.h included only in the following VFIO files:

   hw/vfio/kvm-spapr.c
   hw/vfio/kvm-helpers.c

Looks clean to me.

Thanks,

C.
Re: [PATCH 0/2] build: fix sparc64 host
Posted by Pierrick Bouvier 4 days, 4 hours ago
On 7/20/2026 10:14 PM, Cédric Le Goater wrote:
> On 7/21/26 05:33, Alex Williamson wrote:
>> On Mon, Jul 20, 2026, at 8:48 PM, Pierrick Bouvier wrote:
>>> On 7/20/2026 4:10 PM, Alex Williamson wrote:
>>>> On Mon, 20 Jul 2026 22:17:13 +0000
>>>> Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com> wrote:
>>>>
>>>>> It was reported that build on sparc64 host is currently broken, due
>>>>> to inclusion
>>>>> of asm/kvm.h, which is not present on this platform:
>>>>> https://lore.kernel.org/qemu-devel/c3a7cd83-7666-40c5-9baa-
>>>>> ebe64edacab6@tls.msk.ru/
>>>>
>>>> Isn't is sufficient just to remove the stale <linux/kvm.h> include?
>>>>
>>>> I don't know of a case that fails, platforms that support vfio might
>>>> actually be a sub-set of those that support KVM, but being dependent on
>>>> a KVM supported host has no technical basis.  KVM and VFIO are
>>>> independent features where neither should have a hard dependency on the
>>>> other.  Thanks,
>>>>
>>>
>>> It's related to a recent change that was made to get rid of CONFIG_KVM
>>> in the file to deduplicate hw/vfio/listener.c between targets. So it's
>>> now unconditionally included, thus the regression.
>>
>> I understand.  I'm suggesting the fix is simply:
>>
>> diff --git a/hw/vfio/listener.c b/hw/vfio/listener.c
>> index c19600e980a8..008f488a3e7d 100644
>> --- a/hw/vfio/listener.c
>> +++ b/hw/vfio/listener.c
>> @@ -20,7 +20,6 @@
>>     #include "qemu/osdep.h"
>>   #include <sys/ioctl.h>
>> -#include <linux/kvm.h>
>>   #include <linux/vfio.h>
>>     #include "exec/target_page.h"
>>
>> This builds in both a native amd64 environment and a cross-compiled
>> sparc64 environment.
>

Thanks, I'm ok with this.
Do you have instructions (or better, a Dockerfile) for the cross compile
sparc64 environment you use?
It's the only host we don't have cross compilation environment at the
moment.

> This leaves linux/kvm.h included only in the following VFIO files:
> 
>   hw/vfio/kvm-spapr.c
>   hw/vfio/kvm-helpers.c
> 
> Looks clean to me.
> 
> Thanks,
> 
> C.
> 


Re: [PATCH 0/2] build: fix sparc64 host
Posted by Cédric Le Goater 4 days, 3 hours ago
On 7/21/26 07:17, Pierrick Bouvier wrote:
> On 7/20/2026 10:14 PM, Cédric Le Goater wrote:
>> On 7/21/26 05:33, Alex Williamson wrote:
>>> On Mon, Jul 20, 2026, at 8:48 PM, Pierrick Bouvier wrote:
>>>> On 7/20/2026 4:10 PM, Alex Williamson wrote:
>>>>> On Mon, 20 Jul 2026 22:17:13 +0000
>>>>> Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com> wrote:
>>>>>
>>>>>> It was reported that build on sparc64 host is currently broken, due
>>>>>> to inclusion
>>>>>> of asm/kvm.h, which is not present on this platform:
>>>>>> https://lore.kernel.org/qemu-devel/c3a7cd83-7666-40c5-9baa-
>>>>>> ebe64edacab6@tls.msk.ru/
>>>>>
>>>>> Isn't is sufficient just to remove the stale <linux/kvm.h> include?
>>>>>
>>>>> I don't know of a case that fails, platforms that support vfio might
>>>>> actually be a sub-set of those that support KVM, but being dependent on
>>>>> a KVM supported host has no technical basis.  KVM and VFIO are
>>>>> independent features where neither should have a hard dependency on the
>>>>> other.  Thanks,
>>>>>
>>>>
>>>> It's related to a recent change that was made to get rid of CONFIG_KVM
>>>> in the file to deduplicate hw/vfio/listener.c between targets. So it's
>>>> now unconditionally included, thus the regression.
>>>
>>> I understand.  I'm suggesting the fix is simply:
>>>
>>> diff --git a/hw/vfio/listener.c b/hw/vfio/listener.c
>>> index c19600e980a8..008f488a3e7d 100644
>>> --- a/hw/vfio/listener.c
>>> +++ b/hw/vfio/listener.c
>>> @@ -20,7 +20,6 @@
>>>      #include "qemu/osdep.h"
>>>    #include <sys/ioctl.h>
>>> -#include <linux/kvm.h>
>>>    #include <linux/vfio.h>
>>>      #include "exec/target_page.h"
>>>
>>> This builds in both a native amd64 environment and a cross-compiled
>>> sparc64 environment.
>>
> 
> Thanks, I'm ok with this.
> Do you have instructions (or better, a Dockerfile) for the cross compile
> sparc64 environment you use?
> It's the only host we don't have cross compilation environment at the
> moment.
> 
>> This leaves linux/kvm.h included only in the following VFIO files:
>>
>>    hw/vfio/kvm-spapr.c
>>    hw/vfio/kvm-helpers.c
>>
>> Looks clean to me.


With this fix, QEMU (sparc-softmmu,sparc64-softmmu) builds on a
UltraSparc T5 running debian sid with linux 7.1.3.1-sparc64-smp.

For the record, make check passes.

I will send a patch.

Thanks,

C.