[PATCH] update-linux-headers: Inject VIRTIO_RING_NO_LEGACY in virtio_ring.h

Cédric Le Goater posted 1 patch 2 weeks, 5 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260511111913.3327672-1-clg@redhat.com
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Cornelia Huck <cohuck@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>
scripts/update-linux-headers.sh | 1 +
1 file changed, 1 insertion(+)
[PATCH] update-linux-headers: Inject VIRTIO_RING_NO_LEGACY in virtio_ring.h
Posted by Cédric Le Goater 2 weeks, 5 days ago
The kernel commit 3c4629b68dbe ("virtio: uapi: avoid usage of libc
types") changed the virtio_ring.h header and this breaks the build on
Windows which requires the uintptr_t type to cast from pointer to
integer.

Inject '#define VIRTIO_RING_NO_LEGACY' at the top of the synced header
via the update script after the include guard. This discards the code
section incompatible with Windows.

Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
 scripts/update-linux-headers.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh
index da367acee790657e33c71c10bc118b085774f45d..3c3a0e9394d277766e613dd5ef4e9c7407ec0033 100755
--- a/scripts/update-linux-headers.sh
+++ b/scripts/update-linux-headers.sh
@@ -104,6 +104,7 @@ cp_portable() {
         -e 's/__kernel_ulong_t/unsigned long/' \
         -e 's/struct ethhdr/struct eth_header/' \
         -e '/\#define _LINUX_ETHTOOL_H/a \\n\#include "net/eth.h"' \
+        -e '/\#define _LINUX_VIRTIO_RING_H/a \\n\#define VIRTIO_RING_NO_LEGACY' \
         "$f" > "$to/$header";
 }
 
-- 
2.54.0


Re: [PATCH] update-linux-headers: Inject VIRTIO_RING_NO_LEGACY in virtio_ring.h
Posted by Michael S. Tsirkin 2 weeks, 5 days ago
On Mon, May 11, 2026 at 01:19:13PM +0200, Cédric Le Goater wrote:
> The kernel commit 3c4629b68dbe ("virtio: uapi: avoid usage of libc
> types") changed the virtio_ring.h header and this breaks the build on
> Windows which requires the uintptr_t type to cast from pointer to
> integer.
> 
> Inject '#define VIRTIO_RING_NO_LEGACY' at the top of the synced header
> via the update script after the include guard. This discards the code
> section incompatible with Windows.
> 
> Signed-off-by: Cédric Le Goater <clg@redhat.com>

Acked-by: Michael S. Tsirkin <mst@redhat.com>

> ---
>  scripts/update-linux-headers.sh | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh
> index da367acee790657e33c71c10bc118b085774f45d..3c3a0e9394d277766e613dd5ef4e9c7407ec0033 100755
> --- a/scripts/update-linux-headers.sh
> +++ b/scripts/update-linux-headers.sh
> @@ -104,6 +104,7 @@ cp_portable() {
>          -e 's/__kernel_ulong_t/unsigned long/' \
>          -e 's/struct ethhdr/struct eth_header/' \
>          -e '/\#define _LINUX_ETHTOOL_H/a \\n\#include "net/eth.h"' \
> +        -e '/\#define _LINUX_VIRTIO_RING_H/a \\n\#define VIRTIO_RING_NO_LEGACY' \
>          "$f" > "$to/$header";
>  }
>  
> -- 
> 2.54.0