Skip to contentSkip to conversation

GNU/Hurd support

PATCH Applied Damien Zammit 4 participants 11 messages Feb 8 – Jun 20 Block layer

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw

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
index b384b5b506..2e67d75042 100644
@@ -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);
Signature · 1 line
2.51.0
#2 lore raw

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
index 4b61fd3bbf..fae4d06352 100755
@@ -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
#3 lore raw

PATCH v5 3/5 tpm: Add conditional to not compile ioctls on GNU/Hurd

In reply to Damien Zammit

The 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
index ee2dd15d35..e466311455 100644
@@ -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
#4 lore raw

PATCH v5 4/5 block/file-posix: Clean up sys/ioctl import

In reply to Damien Zammit

Since 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
index 6265d2e248..8a3ba5eecb 100644
@@ -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
#6 lore raw

PATCH v5 5/5 Make copy_file_range non-static on GNU/Hurd

In reply to Damien Zammit

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.

---
 block/file-posix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/file-posix.c +1 -1
index 8a3ba5eecb..b9a7786827 100644
@@ -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
#8 lore raw
In reply to Damien Zammit

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
	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.

#9 lore raw

Hi Phil,

Quoted 5 lines · Philippe Mathieu-Daudé
Quoted 2 lines · Damien Zammit

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

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

#10 lore raw
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/Hurd x86_64 successfully.

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