git: cb86911127e8 - stable/13 - kboot: Implement host_ioctl

From: Warner Losh <imp_at_FreeBSD.org>
Date: Tue, 24 Jan 2023 22:11:39 UTC
The branch stable/13 has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=cb86911127e8d9a0fedead92ba5bb9aa34c3c885

commit cb86911127e8d9a0fedead92ba5bb9aa34c3c885
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2022-07-26 23:30:30 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2023-01-24 21:49:28 +0000

    kboot: Implement host_ioctl
    
    Sponsored by:           Netflix
    
    (cherry picked from commit 54e6e0deb4853dae7e97e7d5659c05e95bebac32)
---
 stand/kboot/arch/aarch64/syscall_nr.h   | 1 +
 stand/kboot/arch/amd64/syscall_nr.h     | 1 +
 stand/kboot/arch/powerpc64/syscall_nr.h | 1 +
 stand/kboot/host_syscall.h              | 1 +
 stand/kboot/host_syscalls.c             | 6 ++++++
 5 files changed, 10 insertions(+)

diff --git a/stand/kboot/arch/aarch64/syscall_nr.h b/stand/kboot/arch/aarch64/syscall_nr.h
index 79bf22947e94..83069dd8dc76 100644
--- a/stand/kboot/arch/aarch64/syscall_nr.h
+++ b/stand/kboot/arch/aarch64/syscall_nr.h
@@ -5,6 +5,7 @@
 #define SYS_getdents64		 61
 #define	SYS_getpid		172
 #define SYS_gettimeofday	169
+#define SYS_ioctl		 29
 #define SYS_lseek		 62
 #define SYS_kexec_load		104
 #define	SYS_mkdirat		 34
diff --git a/stand/kboot/arch/amd64/syscall_nr.h b/stand/kboot/arch/amd64/syscall_nr.h
index 71469109a55e..2cf26d7ca4dc 100644
--- a/stand/kboot/arch/amd64/syscall_nr.h
+++ b/stand/kboot/arch/amd64/syscall_nr.h
@@ -4,6 +4,7 @@
 #define SYS_getdents64		217
 #define	SYS_getpid		 39
 #define SYS_gettimeofday	 96
+#define SYS_ioctl		 16
 #define SYS_kexec_load		246
 #define SYS_lseek		  8
 #define	SYS_mkdirat		258
diff --git a/stand/kboot/arch/powerpc64/syscall_nr.h b/stand/kboot/arch/powerpc64/syscall_nr.h
index 7b425e36c517..71f2452c9124 100644
--- a/stand/kboot/arch/powerpc64/syscall_nr.h
+++ b/stand/kboot/arch/powerpc64/syscall_nr.h
@@ -5,6 +5,7 @@
 #define SYS_getdents64		202
 #define	SYS_getpid		 20
 #define SYS_gettimeofday	 78
+#define SYS_ioctl		 54
 #define SYS_kexec_load		268
 #define SYS_llseek		140
 #define	SYS_mkdirat		287
diff --git a/stand/kboot/host_syscall.h b/stand/kboot/host_syscall.h
index 09f5355e520d..0029004f675a 100644
--- a/stand/kboot/host_syscall.h
+++ b/stand/kboot/host_syscall.h
@@ -160,6 +160,7 @@ int host_fstat(int fd, struct host_kstat *sb);
 int host_getdents64(int fd, void *dirp, int count);
 int host_getpid(void);
 int host_gettimeofday(struct host_timeval *a, void *b);
+int host_ioctl(int fd, unsigned long request, unsigned long arg);
 int host_kexec_load(unsigned long entry, unsigned long nsegs, struct host_kexec_segment *segs, unsigned long flags);
 ssize_t host_llseek(int fd, int32_t offset_high, int32_t offset_lo, uint64_t *result, int whence);
 int host_mkdir(const char *, host_mode_t);
diff --git a/stand/kboot/host_syscalls.c b/stand/kboot/host_syscalls.c
index 8b364083b15c..1ffa04948fdf 100644
--- a/stand/kboot/host_syscalls.c
+++ b/stand/kboot/host_syscalls.c
@@ -54,6 +54,12 @@ host_gettimeofday(struct host_timeval *a, void *b)
 	return host_syscall(SYS_gettimeofday, (uintptr_t)a, (uintptr_t)b);
 }
 
+int
+host_ioctl(int fd, unsigned long request, unsigned long arg)
+{
+	return host_syscall(SYS_ioctl, fd, request, arg);
+}
+
 int
 host_kexec_load(unsigned long entry, unsigned long nsegs, struct host_kexec_segment *segs, unsigned long flags)
 {