All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 0/5 qemu] GNU/Hurd support
@ 2026-02-08  5:59 Damien Zammit
  2026-02-08  5:59 ` [PATCH v5 1/5 qemu] Include new arbitrary limits if not already defined Damien Zammit
                   ` (6 more replies)
  0 siblings, 7 replies; 11+ messages in thread
From: Damien Zammit @ 2026-02-08  5:59 UTC (permalink / raw)
  To: bug-hurd
  Cc: qemu-devel, qemu-block, manolodemedici, pbonzini, stefanb,
	peter.maydell, kwolf, berrange, eblake, bugaevc

Hi,

This patchset is hopefully my final attempt to upstream qemu support for GNU/Hurd.
All review comments have been considered and addressed in the patches.
Some people want minimal diff to tpm header, others want me to delete code.
I went with the reduced diff because it's only one line of code change to fix it,
and passed review originally in other attempts.

This has been rebased onto:
* cd5a79dc98 (origin/master, origin/HEAD) Merge tag 'for_upstream' of ... 

TESTED: Compiles on GNU/Hurd using:
	../configure --target-list=i386-softmmu,x86_64-softmmu
	ninja

Executed qemu-system-{i386,x86_64} on GNU/Hurd x86_64 successfully.

Thanks,
Damien




^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v5 1/5 qemu] Include new arbitrary limits if not already defined
  2026-02-08  5:59 [PATCH v5 0/5 qemu] GNU/Hurd support Damien Zammit
@ 2026-02-08  5:59 ` Damien Zammit
  2026-02-08  5:59 ` [PATCH v5 2/5 qemu] Add GNU/Hurd host_os=gnu Damien Zammit
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Damien Zammit @ 2026-02-08  5:59 UTC (permalink / raw)
  To: bug-hurd
  Cc: qemu-devel, qemu-block, manolodemedici, pbonzini, stefanb,
	peter.maydell, kwolf, berrange, eblake, bugaevc

From: Manolo de Medici <manolodemedici@gmail.com>

Although GNU/Hurd supports unlimited path lengths
only bounded by available memory, for now we can use
an arbitrary limit on PATH_MAX that matches what POSIX requires.
We don't have bandwidth to fix this properly right now.

Author: Manolo de Medici <manolo.demedici@gmail.com>
Signed-off-by: Damien Zammit <damien@zamaudio.com>
---
 include/qemu/osdep.h | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index b384b5b506..2e67d75042 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -385,6 +385,17 @@ void QEMU_ERROR("code path is reachable")
 #define TIME_MAX TYPE_MAXIMUM(time_t)
 #endif
 
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
+/*
+ * Use the same value as Linux for now.
+ */
+#ifndef IOV_MAX
+#define IOV_MAX 1024
+#endif
+
 /* Mac OSX has a <stdint.h> bug that incorrectly defines SIZE_MAX with
  * the wrong type. Our replacement isn't usable in preprocessor
  * expressions, but it is sufficient for our needs. */
@@ -661,10 +672,6 @@ struct iovec {
     void *iov_base;
     size_t iov_len;
 };
-/*
- * Use the same value as Linux for now.
- */
-#define IOV_MAX 1024
 
 ssize_t readv(int fd, const struct iovec *iov, int iov_cnt);
 ssize_t writev(int fd, const struct iovec *iov, int iov_cnt);
-- 
2.51.0




^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v5 2/5 qemu] Add GNU/Hurd host_os=gnu
  2026-02-08  5:59 [PATCH v5 0/5 qemu] GNU/Hurd support Damien Zammit
  2026-02-08  5:59 ` [PATCH v5 1/5 qemu] Include new arbitrary limits if not already defined Damien Zammit
@ 2026-02-08  5:59 ` Damien Zammit
  2026-02-08  5:59 ` [PATCH v5 3/5 qemu] tpm: Add conditional to not compile ioctls on GNU/Hurd Damien Zammit
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Damien Zammit @ 2026-02-08  5:59 UTC (permalink / raw)
  To: bug-hurd
  Cc: qemu-devel, qemu-block, manolodemedici, pbonzini, stefanb,
	peter.maydell, kwolf, berrange, eblake, bugaevc

Signed-off-by: Damien Zammit <damien@zamaudio.com>
---
 configure | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configure b/configure
index 4b61fd3bbf..fae4d06352 100755
--- a/configure
+++ b/configure
@@ -372,6 +372,8 @@ elif check_define __APPLE__; then
 elif check_define EMSCRIPTEN ; then
   host_os=emscripten
   cross_compile="yes"
+elif check_define __GNU__; then
+  host_os=gnu
 else
   # This is a fatal error, but don't report it yet, because we
   # might be going to just print the --help text, or it might
-- 
2.51.0




^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v5 3/5 qemu] tpm: Add conditional to not compile ioctls on GNU/Hurd
  2026-02-08  5:59 [PATCH v5 0/5 qemu] GNU/Hurd support Damien Zammit
  2026-02-08  5:59 ` [PATCH v5 1/5 qemu] Include new arbitrary limits if not already defined Damien Zammit
  2026-02-08  5:59 ` [PATCH v5 2/5 qemu] Add GNU/Hurd host_os=gnu Damien Zammit
@ 2026-02-08  5:59 ` Damien Zammit
  2026-02-08  5:59 ` [PATCH v5 4/5 qemu] block/file-posix: Clean up sys/ioctl import Damien Zammit
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Damien Zammit @ 2026-02-08  5:59 UTC (permalink / raw)
  To: bug-hurd
  Cc: qemu-devel, qemu-block, manolodemedici, pbonzini, stefanb,
	peter.maydell, kwolf, berrange, eblake, bugaevc

The Hurd currently doesn't have any TPM driver, compilation fails
for missing _IOT__IOTBASE_* symbols unless these are left undefined.

Signed-off-by: Damien Zammit <damien@zamaudio.com>
Signed-off-by: Manolo de Medici <manolo.demedici@gmail.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
---
 backends/tpm/tpm_ioctl.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/backends/tpm/tpm_ioctl.h b/backends/tpm/tpm_ioctl.h
index ee2dd15d35..e466311455 100644
--- a/backends/tpm/tpm_ioctl.h
+++ b/backends/tpm/tpm_ioctl.h
@@ -285,7 +285,7 @@ typedef struct ptm_lockstorage ptm_lockstorage;
 #define PTM_CAP_SEND_COMMAND_HEADER (1 << 15)
 #define PTM_CAP_LOCK_STORAGE       (1 << 16)
 
-#ifndef _WIN32
+#if !defined(_WIN32) && !defined(__GNU__)
 enum {
     PTM_GET_CAPABILITY     = _IOR('P', 0, ptm_cap),
     PTM_INIT               = _IOWR('P', 1, ptm_init),
-- 
2.51.0




^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v5 4/5 qemu] block/file-posix: Clean up sys/ioctl import
  2026-02-08  5:59 [PATCH v5 0/5 qemu] GNU/Hurd support Damien Zammit
                   ` (2 preceding siblings ...)
  2026-02-08  5:59 ` [PATCH v5 3/5 qemu] tpm: Add conditional to not compile ioctls on GNU/Hurd Damien Zammit
@ 2026-02-08  5:59 ` Damien Zammit
  2026-06-17  6:03   ` Philippe Mathieu-Daudé
  2026-02-08  5:59 ` [PATCH v5 5/5 qemu] Make copy_file_range non-static on GNU/Hurd Damien Zammit
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 11+ messages in thread
From: Damien Zammit @ 2026-02-08  5:59 UTC (permalink / raw)
  To: bug-hurd
  Cc: qemu-devel, qemu-block, manolodemedici, pbonzini, stefanb,
	peter.maydell, kwolf, berrange, eblake, bugaevc

Since all platforms except sun include this header,
clean up the ifdefs.

Signed-off-by: Damien Zammit <damien@zamaudio.com>
---
 block/file-posix.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/block/file-posix.c b/block/file-posix.c
index 6265d2e248..8a3ba5eecb 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -43,9 +43,11 @@
 #include "scsi/constants.h"
 #include "scsi/utils.h"
 
-#if defined(__APPLE__) && (__MACH__)
+#ifndef __sun__
 #include <sys/ioctl.h>
-#if defined(HAVE_HOST_BLOCK_DEVICE)
+#endif
+
+#if defined(__APPLE__) && (__MACH__) && defined(HAVE_HOST_BLOCK_DEVICE)
 #include <paths.h>
 #include <sys/param.h>
 #include <sys/mount.h>
@@ -57,7 +59,6 @@
 //#include <IOKit/storage/IOCDTypes.h>
 #include <IOKit/storage/IODVDMedia.h>
 #include <CoreFoundation/CoreFoundation.h>
-#endif /* defined(HAVE_HOST_BLOCK_DEVICE) */
 #endif
 
 #ifdef __sun__
@@ -65,7 +66,6 @@
 #include <sys/dkio.h>
 #endif
 #ifdef __linux__
-#include <sys/ioctl.h>
 #include <sys/param.h>
 #include <sys/syscall.h>
 #include <sys/vfs.h>
@@ -95,27 +95,20 @@
 #endif
 
 #ifdef __OpenBSD__
-#include <sys/ioctl.h>
 #include <sys/disklabel.h>
 #include <sys/dkio.h>
 #endif
 
 #ifdef __NetBSD__
-#include <sys/ioctl.h>
 #include <sys/disklabel.h>
 #include <sys/dkio.h>
 #include <sys/disk.h>
 #endif
 
 #ifdef __DragonFly__
-#include <sys/ioctl.h>
 #include <sys/diskslice.h>
 #endif
 
-#ifdef EMSCRIPTEN
-#include <sys/ioctl.h>
-#endif
-
 /* OS X does not have O_DSYNC */
 #ifndef O_DSYNC
 #ifdef O_SYNC
-- 
2.51.0




^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v5 5/5 qemu] Make copy_file_range non-static on GNU/Hurd
  2026-02-08  5:59 [PATCH v5 0/5 qemu] GNU/Hurd support Damien Zammit
                   ` (3 preceding siblings ...)
  2026-02-08  5:59 ` [PATCH v5 4/5 qemu] block/file-posix: Clean up sys/ioctl import Damien Zammit
@ 2026-02-08  5:59 ` Damien Zammit
  2026-06-17  8:43 ` [PATCH v5 0/5 qemu] GNU/Hurd support Paolo Bonzini
  2026-06-18  8:33 ` Philippe Mathieu-Daudé
  6 siblings, 0 replies; 11+ messages in thread
From: Damien Zammit @ 2026-02-08  5:59 UTC (permalink / raw)
  To: bug-hurd
  Cc: qemu-devel, qemu-block, manolodemedici, pbonzini, stefanb,
	peter.maydell, kwolf, berrange, eblake, bugaevc

glibc has a stubs mechanism: a function can be declared in the
system headers, but only implemented as a stub that always fails with
ENOSYS, for example.  Therefore when implementing this function
we cannot use static.

Signed-off-by: Damien Zammit <damien@zamaudio.com>
---
 block/file-posix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/file-posix.c b/block/file-posix.c
index 8a3ba5eecb..b9a7786827 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -2106,7 +2106,7 @@ static int handle_aiocb_write_zeroes_unmap(void *opaque)
 }
 
 #ifndef HAVE_COPY_FILE_RANGE
-#ifndef EMSCRIPTEN
+#if !defined(EMSCRIPTEN) && !defined(__GNU__)
 static
 #endif
 ssize_t copy_file_range(int in_fd, off_t *in_off, int out_fd,
-- 
2.51.0




^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH v5 4/5 qemu] block/file-posix: Clean up sys/ioctl import
  2026-02-08  5:59 ` [PATCH v5 4/5 qemu] block/file-posix: Clean up sys/ioctl import Damien Zammit
@ 2026-06-17  6:03   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-06-17  6:03 UTC (permalink / raw)
  To: Damien Zammit, bug-hurd
  Cc: qemu-devel, qemu-block, manolodemedici, pbonzini, stefanb,
	peter.maydell, kwolf, berrange, eblake, bugaevc

On 8/2/26 06:59, Damien Zammit wrote:
> Since all platforms except sun include this header,
> clean up the ifdefs.
> 
> Signed-off-by: Damien Zammit <damien@zamaudio.com>
> ---
>   block/file-posix.c | 15 ++++-----------
>   1 file changed, 4 insertions(+), 11 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v5 0/5 qemu] GNU/Hurd support
  2026-02-08  5:59 [PATCH v5 0/5 qemu] GNU/Hurd support Damien Zammit
                   ` (4 preceding siblings ...)
  2026-02-08  5:59 ` [PATCH v5 5/5 qemu] Make copy_file_range non-static on GNU/Hurd Damien Zammit
@ 2026-06-17  8:43 ` Paolo Bonzini
  2026-06-18  8:33 ` Philippe Mathieu-Daudé
  6 siblings, 0 replies; 11+ messages in thread
From: Paolo Bonzini @ 2026-06-17  8:43 UTC (permalink / raw)
  To: Damien Zammit
  Cc: bug-hurd, qemu-devel, qemu-block, manolodemedici, pbonzini,
	stefanb, peter.maydell, kwolf, berrange, eblake, bugaevc

Queued, thanks.

Paolo



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v5 0/5 qemu] GNU/Hurd support
  2026-02-08  5:59 [PATCH v5 0/5 qemu] GNU/Hurd support Damien Zammit
                   ` (5 preceding siblings ...)
  2026-06-17  8:43 ` [PATCH v5 0/5 qemu] GNU/Hurd support Paolo Bonzini
@ 2026-06-18  8:33 ` Philippe Mathieu-Daudé
  2026-06-20  8:34   ` Damien Zammit
  6 siblings, 1 reply; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-06-18  8:33 UTC (permalink / raw)
  To: Damien Zammit, bug-hurd
  Cc: qemu-devel, qemu-block, manolodemedici, pbonzini, stefanb,
	peter.maydell, kwolf, berrange, eblake, bugaevc

Hi Damien,

On 8/2/26 06:59, Damien Zammit wrote:
> Hi,
> 
> This patchset is hopefully my final attempt to upstream qemu support for GNU/Hurd.
> All review comments have been considered and addressed in the patches.
> Some people want minimal diff to tpm header, others want me to delete code.
> I went with the reduced diff because it's only one line of code change to fix it,
> and passed review originally in other attempts.
> 
> This has been rebased onto:
> * cd5a79dc98 (origin/master, origin/HEAD) Merge tag 'for_upstream' of ...
> 
> TESTED: Compiles on GNU/Hurd using:
> 	../configure --target-list=i386-softmmu,x86_64-softmmu
> 	ninja
> 
> Executed qemu-system-{i386,x86_64} on GNU/Hurd x86_64 successfully.

Could we get this configuration integrated in our CI to be sure
it won't bitrot?

See how we test OpenBSD or Haiku for example:

tests/vm/Makefile.include:28:X86_IMAGES := freebsd netbsd openbsd 
haiku.x86_64

Thanks,

Phil.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v5 0/5 qemu] GNU/Hurd support
  2026-06-18  8:33 ` Philippe Mathieu-Daudé
@ 2026-06-20  8:34   ` Damien Zammit
  2026-06-20 13:55     ` Alex Bennée
  0 siblings, 1 reply; 11+ messages in thread
From: Damien Zammit @ 2026-06-20  8:34 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, bug-hurd; +Cc: qemu-devel, qemu-block

[-- Attachment #1: Type: text/plain, Size: 671 bytes --]

Hi Phil,

On 18/6/26 6:33 pm, Philippe Mathieu-Daudé wrote:

> On 8/2/26 06:59, Damien Zammit wrote:
>
>> ...
>> Executed qemu-system-{i386,x86_64} on GNU/Hurd x86_64 successfully.

> Could we get this configuration integrated in our CI to be sure
> it won't bitrot?
>
> See how we test OpenBSD or Haiku for example:
>
> tests/vm/Makefile.include:28:X86_IMAGES := freebsd netbsd openbsd
> haiku.x86_64

I took a quick look, it appears virtio-blk and virtio-net are both required
to automate the building of the test vm, but GNU/Hurd does not have drivers for these yet.

I can take another look at this when virtio is working in Hurd with rump framework.

Thanks,
Damien

[-- Attachment #2: Type: text/html, Size: 1613 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v5 0/5 qemu] GNU/Hurd support
  2026-06-20  8:34   ` Damien Zammit
@ 2026-06-20 13:55     ` Alex Bennée
  0 siblings, 0 replies; 11+ messages in thread
From: Alex Bennée @ 2026-06-20 13:55 UTC (permalink / raw)
  To: Damien Zammit
  Cc: Philippe Mathieu-Daudé, bug-hurd, qemu-devel, qemu-block

Damien Zammit <damien@zamaudio.com> writes:

> Hi Phil,
>
> On 18/6/26 6:33 pm, Philippe Mathieu-Daudé wrote: 
>
>  On 8/2/26 06:59, Damien Zammit wrote:
>
>  ...
> Executed qemu-system-{i386,x86_64} on GNU/Hurd x86_64 successfully.
>
>  Could we get this configuration integrated in our CI to be sure
> it won't bitrot?
>
> See how we test OpenBSD or Haiku for example:
>
> tests/vm/Makefile.include:28:X86_IMAGES := freebsd netbsd openbsd
> haiku.x86_64
>
> I took a quick look, it appears virtio-blk and virtio-net are both required
> to automate the building of the test vm, but GNU/Hurd does not have
> drivers for these yet.

What block and network devices does it understand. We do emulate some of
the more common ones and I think the old school IDE/ATAPI interfaces as
well.

>
> I can take another look at this when virtio is working in Hurd with rump framework.
>
> Thanks,
> Damien

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2026-06-20 13:56 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-08  5:59 [PATCH v5 0/5 qemu] GNU/Hurd support Damien Zammit
2026-02-08  5:59 ` [PATCH v5 1/5 qemu] Include new arbitrary limits if not already defined Damien Zammit
2026-02-08  5:59 ` [PATCH v5 2/5 qemu] Add GNU/Hurd host_os=gnu Damien Zammit
2026-02-08  5:59 ` [PATCH v5 3/5 qemu] tpm: Add conditional to not compile ioctls on GNU/Hurd Damien Zammit
2026-02-08  5:59 ` [PATCH v5 4/5 qemu] block/file-posix: Clean up sys/ioctl import Damien Zammit
2026-06-17  6:03   ` Philippe Mathieu-Daudé
2026-02-08  5:59 ` [PATCH v5 5/5 qemu] Make copy_file_range non-static on GNU/Hurd Damien Zammit
2026-06-17  8:43 ` [PATCH v5 0/5 qemu] GNU/Hurd support Paolo Bonzini
2026-06-18  8:33 ` Philippe Mathieu-Daudé
2026-06-20  8:34   ` Damien Zammit
2026-06-20 13:55     ` Alex Bennée

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.