GNU/Hurd support
v5 cover GNU/Hurd support
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
PATCH v5 1/5 Include new arbitrary limits if not already defined
From: Manolo de Medici <[email protected]>
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 <[email protected]>
--- include/qemu/osdep.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
include/qemu/osdep.h +11 -4
@@ -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 1024ssize_t readv (int fd,const struct iovec *iov,int iov_cnt);ssize_t writev (int fd,const struct iovec *iov,int iov_cnt);
Signature · 1 line
2.51.0
PATCH v5 2/5 Add GNU/Hurd host_os=gnu
In reply to Damien Zammit--- configure | 2 ++ 1 file changed, 2 insertions(+)
configure +2 -0
@@ -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
Signature · 1 line
2.51.0
PATCH v5 3/5 tpm: Add conditional to not compile ioctls on GNU/Hurd
In reply to Damien ZammitThe Hurd currently doesn't have any TPM driver, compilation fails for missing _IOT__IOTBASE_* symbols unless these are left undefined.
--- backends/tpm/tpm_ioctl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
backends/tpm/tpm_ioctl.h +1 -1
@@ -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),
Signature · 1 line
2.51.0
PATCH v5 4/5 block/file-posix: Clean up sys/ioctl import
In reply to Damien ZammitSince all platforms except sun include this header, clean up the ifdefs.
--- block/file-posix.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-)
block/file-posix.c +4 -11
@@ -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
Signature · 1 line
2.51.0
Re: [PATCH v5 4/5 qemu] block/file-posix: Clean up sys/ioctl import
Quoted 7 lines · Damien Zammit
Since all platforms except sun include this header, clean up the ifdefs.
Signed-off-by Damien Zammit <[email protected]>--- block/file-posix.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-)
PATCH v5 5/5 Make copy_file_range non-static on GNU/Hurd
In reply to Damien Zammitglibc 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.
--- block/file-posix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/file-posix.c +1 -1
@@ -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,
Signature · 1 line
2.51.0
Paolo Bonzini
AppliedQueued, thanks.
Paolo
Hi Damien,
Quoted 8 lines · Damien Zammit
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.
Quoted 8 lines
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 ninjaExecuted qemu-system-{i386,x86_64} on GNU/Hurd
x86_64successfully.
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.
Hi Phil,
Quoted 5 lines · Philippe Mathieu-Daudé
Quoted 2 lines · Damien Zammit
...
Executed qemu-system-{i386,x86_64} on GNU/Hurdx86_64successfully.
Quoted 7 lines
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
Quoted 12 lines · Damien Zammit
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/Hurdx86_64successfully.Could we get this configuration integrated in our CI to be sure
it won't bitrot?
Quoted 8 lines
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.
Quoted 5 lines
I can take another look at this when virtio is working in Hurd with rump framework.
Thanks,
Damien
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro