Skip to contentSkip to conversation

linux-user: Misc patches for 4.2

PATCH Superseded Aleksandar Markovic 3 participants 15 messages Jul 31, 2019 – Sep 6, 2019

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v4 cover linux-user: Misc patches for 4.2

From: Aleksandar Markovic <[email protected]>

A set of misc linux user patches for 4.2.

v2->v3:

- reworked the patch on semtimedop()
- added five patches containing support for ten additional ioctls
- minor improvements of code formatting

v2->v3:

- minor code formatting improvements
- added a patch on semtimedop()

v1->v2:

- updated commit messages
- minor improvements of code formatting
- added three patches containing support for ten additional ioctls

Aleksandar Markovic (10):
linux-user: Add support for FDMSGON and FDMSGOFF ioctls
linux-user: Add support for FDRESET, FDRAWCMD, FDTWADDLE, and FDEJECT
ioctls
linux-user: Add support for FDFMTBEG, FDFMTTRK, and FDFMTEND ioctls
linux-user: Add support for FDSETEMSGTRESH, FDSETMAXERRS, and
FDGETMAXERRS ioctls
linux-user: Add support for HDIO_GET_NICE and HDIO_SET_NICE ioctls
linux-user: Add support for HDIO_GET_WCACHE and HDIO_SET_WCACHE ioctls
linux-user: Add support for HDIO_GET_ACOUSTIC and HDIO_SET_ACOUSTIC
ioctls
linux-user: Add support for HDIO_GET_ADDRESS and HDIO_SET_ADDRESS
ioctls
linux-user: Add support for HDIO_GET_BUSSTATE and HDIO_SET_BUSSTATE
ioctls
linux-user: Add support for RNDRESEEDCRNG ioctl

Aleksandar Rikalo (1):
linux-user: Add support for semtimedop() syscall

Yunqiang Su (1):
linux user: Add support for FDFLUSH ioctl

 linux-user/ioctls.h        | 26 ++++++++++++++++++++++++++
 linux-user/syscall.c       | 41 +++++++++++++++++++++++++++++++++++++++++
 linux-user/syscall_defs.h  | 43 +++++++++++++++++++++++++++++++++++++++++++
 linux-user/syscall_types.h | 12 ++++++++++++
 4 files changed, 122 insertions(+)
Signature · 1 line
2.7.4
#1 lore raw

PATCH v4 1/12 linux user: Add support for FDFLUSH ioctl

From: Yunqiang Su <[email protected]>

FDFLUSH is used for flushing buffers of floppy drives. Support in QEMU is needed because some of Debian packages use this ioctl while running post-build tests. One such example is 'tar' package.

---
 linux-user/ioctls.h       | 2 ++
 linux-user/syscall.c      | 1 +
 linux-user/syscall_defs.h | 4 ++++
 3 files changed, 7 insertions(+)
linux-user/ioctls.h +2 -0
index 3281c97..fb7b014 100644
@@ -112,6 +112,8 @@
      IOCTL(BLKZEROOUT, IOC_W, MK_PTR(MK_ARRAY(TYPE_ULONGLONG, 2)))
 #endif
 
+     IOCTL(FDFLUSH, 0, TYPE_NULL)
+
 #ifdef FIBMAP
      IOCTL(FIBMAP, IOC_W | IOC_R, MK_PTR(TYPE_LONG))
 #endif
linux-user/syscall.c +1 -0
index 8367cb1..ee80175 100644
@@ -87,6 +87,7 @@
 #include <linux/kd.h>
 #include <linux/mtio.h>
 #include <linux/fs.h>
+#include <linux/fd.h>
 #if defined(CONFIG_FIEMAP)
 #include <linux/fiemap.h>
 #endif
linux-user/syscall_defs.h +4 -0
index 0662270..fb30bce 100644
@@ -883,6 +883,10 @@ struct target_pollfd {
 #define TARGET_BLKROTATIONAL TARGET_IO(0x12, 126)
 #define TARGET_BLKZEROOUT TARGET_IO(0x12, 127)
 
+/* From <linux/fd.h> */
+
+#define TARGET_FDFLUSH        TARGET_IO(2, 0x4b)
+
 #define TARGET_FIBMAP     TARGET_IO(0x00,1)  /* bmap access */
 #define TARGET_FIGETBSZ   TARGET_IO(0x00,2)  /* get the block size used for bmap */
 
Signature · 1 line
2.7.4
#2 lore raw

PATCH v4 2/12 linux-user: Add support for FDMSGON and FDMSGOFF ioctls

In reply to Aleksandar Markovic

From: Aleksandar Markovic <[email protected]>

FDMSGON and FDMSGOFF switch informational messages of floppy drives on and off.

---
 linux-user/ioctls.h       | 2 ++
 linux-user/syscall_defs.h | 2 ++
 2 files changed, 4 insertions(+)
linux-user/ioctls.h +2 -0
index fb7b014..9978163 100644
@@ -112,6 +112,8 @@
      IOCTL(BLKZEROOUT, IOC_W, MK_PTR(MK_ARRAY(TYPE_ULONGLONG, 2)))
 #endif
 
+     IOCTL(FDMSGON, 0, TYPE_NULL)
+     IOCTL(FDMSGOFF, 0, TYPE_NULL)
      IOCTL(FDFLUSH, 0, TYPE_NULL)
 
 #ifdef FIBMAP
linux-user/syscall_defs.h +2 -0
index fb30bce..cd97e9b 100644
@@ -885,6 +885,8 @@ struct target_pollfd {
 
 /* From <linux/fd.h> */
 
+#define TARGET_FDMSGON        TARGET_IO(2, 0x45)
+#define TARGET_FDMSGOFF       TARGET_IO(2, 0x46)
 #define TARGET_FDFLUSH        TARGET_IO(2, 0x4b)
 
 #define TARGET_FIBMAP     TARGET_IO(0x00,1)  /* bmap access */
Signature · 1 line
2.7.4
#3 lore raw

PATCH v4 3/12 linux-user: Add support for FDRESET, FDRAWCMD, FDTWADDLE, and FDEJECT ioctls

In reply to Aleksandar Markovic

From: Aleksandar Markovic <[email protected]>

FDRESET, FDRAWCMD, FDTWADDLE, and FDEJECT ioctls are misc commands for controlling a floppy drive.

---
 linux-user/ioctls.h       | 4 ++++
 linux-user/syscall_defs.h | 4 ++++
 2 files changed, 8 insertions(+)
linux-user/ioctls.h +4 -0
index 9978163..ab4ef2e 100644
@@ -115,6 +115,10 @@
      IOCTL(FDMSGON, 0, TYPE_NULL)
      IOCTL(FDMSGOFF, 0, TYPE_NULL)
      IOCTL(FDFLUSH, 0, TYPE_NULL)
+     IOCTL(FDRESET, 0, TYPE_NULL)
+     IOCTL(FDRAWCMD, 0, TYPE_NULL)
+     IOCTL(FDTWADDLE, 0, TYPE_NULL)
+     IOCTL(FDEJECT, 0, TYPE_NULL)
 
 #ifdef FIBMAP
      IOCTL(FIBMAP, IOC_W | IOC_R, MK_PTR(TYPE_LONG))
linux-user/syscall_defs.h +4 -0
index cd97e9b..4185391 100644
@@ -888,6 +888,10 @@ struct target_pollfd {
 #define TARGET_FDMSGON        TARGET_IO(2, 0x45)
 #define TARGET_FDMSGOFF       TARGET_IO(2, 0x46)
 #define TARGET_FDFLUSH        TARGET_IO(2, 0x4b)
+#define TARGET_FDRESET        TARGET_IO(2, 0x54)
+#define TARGET_FDRAWCMD       TARGET_IO(2, 0x58)
+#define TARGET_FDTWADDLE      TARGET_IO(2, 0x59)
+#define TARGET_FDEJECT        TARGET_IO(2, 0x5a)
 
 #define TARGET_FIBMAP     TARGET_IO(0x00,1)  /* bmap access */
 #define TARGET_FIGETBSZ   TARGET_IO(0x00,2)  /* get the block size used for bmap */
Signature · 1 line
2.7.4
#4 lore raw

PATCH v4 4/12 linux-user: Add support for FDFMTBEG, FDFMTTRK, and FDFMTEND ioctls

In reply to Aleksandar Markovic

From: Aleksandar Markovic <[email protected]>

FDFMTBEG, FDFMTTRK, and FDFMTEND ioctls provide means for controlling formatting of a floppy drive.

---
 linux-user/ioctls.h        | 3 +++
 linux-user/syscall_defs.h  | 3 +++
 linux-user/syscall_types.h | 5 +++++
 3 files changed, 11 insertions(+)
linux-user/ioctls.h +3 -0
index ab4ef2e..e393ad6 100644
@@ -114,6 +114,9 @@
 
      IOCTL(FDMSGON, 0, TYPE_NULL)
      IOCTL(FDMSGOFF, 0, TYPE_NULL)
+     IOCTL(FDFMTBEG, 0, TYPE_NULL)
+     IOCTL(FDFMTTRK, IOC_W, MK_PTR(MK_STRUCT(STRUCT_format_descr)))
+     IOCTL(FDFMTEND, 0, TYPE_NULL)
      IOCTL(FDFLUSH, 0, TYPE_NULL)
      IOCTL(FDRESET, 0, TYPE_NULL)
      IOCTL(FDRAWCMD, 0, TYPE_NULL)
linux-user/syscall_defs.h +3 -0
index 4185391..1ca115d 100644
@@ -887,6 +887,9 @@ struct target_pollfd {
 
 #define TARGET_FDMSGON        TARGET_IO(2, 0x45)
 #define TARGET_FDMSGOFF       TARGET_IO(2, 0x46)
+#define TARGET_FDFMTBEG       TARGET_IO(2, 0x47)
+#define TARGET_FDFMTTRK      TARGET_IOW(2, 0x48, struct target_format_descr)
+#define TARGET_FDFMTEND       TARGET_IO(2, 0x49)
 #define TARGET_FDFLUSH        TARGET_IO(2, 0x4b)
 #define TARGET_FDRESET        TARGET_IO(2, 0x54)
 #define TARGET_FDRAWCMD       TARGET_IO(2, 0x58)
linux-user/syscall_types.h +5 -0
index 4e36983..d82d1a5 100644
@@ -261,6 +261,11 @@ STRUCT(blkpg_ioctl_arg,
        TYPE_INT, /* datalen */
        TYPE_PTRVOID) /* data */
 
+STRUCT(format_descr,
+       TYPE_INT,     /* device */
+       TYPE_INT,     /* head */
+       TYPE_INT)     /* track */
+
 #if defined(CONFIG_USBFS)
 /* usb device ioctls */
 STRUCT(usbdevfs_ctrltransfer,
Signature · 1 line
2.7.4
#5 lore raw

PATCH v4 5/12 linux-user: Add support for FDSETEMSGTRESH, FDSETMAXERRS, and FDGETMAXERRS ioctls

In reply to Aleksandar Markovic

From: Aleksandar Markovic <[email protected]>

FDSETEMSGTRESH, FDSETMAXERRS, and FDGETMAXERRS ioctls are commands for controlling error reporting of a floppy drive.

---
 linux-user/ioctls.h        |  2 ++
 linux-user/syscall_defs.h  | 19 +++++++++++++++++++
 linux-user/syscall_types.h |  7 +++++++
 3 files changed, 28 insertions(+)
linux-user/ioctls.h +2 -0
index e393ad6..6551938 100644
@@ -118,6 +118,8 @@
      IOCTL(FDFMTTRK, IOC_W, MK_PTR(MK_STRUCT(STRUCT_format_descr)))
      IOCTL(FDFMTEND, 0, TYPE_NULL)
      IOCTL(FDFLUSH, 0, TYPE_NULL)
+     IOCTL(FDSETMAXERRS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_floppy_max_errors)))
+     IOCTL(FDGETMAXERRS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_floppy_max_errors)))
      IOCTL(FDRESET, 0, TYPE_NULL)
      IOCTL(FDRAWCMD, 0, TYPE_NULL)
      IOCTL(FDTWADDLE, 0, TYPE_NULL)
linux-user/syscall_defs.h +19 -0
index 1ca115d..36256b0 100644
@@ -885,12 +885,31 @@ struct target_pollfd {
 
 /* From <linux/fd.h> */
 
+struct target_floppy_max_errors {
+    abi_uint        abort;
+    abi_uint        read_track;
+    abi_uint        reset;
+    abi_uint        recal;
+    abi_uint        reporting;
+};
+
+struct target_format_descr {
+    abi_uint        device;
+    abi_uint        head;
+    abi_uint        track;
+};
+
 #define TARGET_FDMSGON        TARGET_IO(2, 0x45)
 #define TARGET_FDMSGOFF       TARGET_IO(2, 0x46)
 #define TARGET_FDFMTBEG       TARGET_IO(2, 0x47)
 #define TARGET_FDFMTTRK      TARGET_IOW(2, 0x48, struct target_format_descr)
 #define TARGET_FDFMTEND       TARGET_IO(2, 0x49)
+#define TARGET_FDSETEMSGTRESH TARGET_IO(2, 0x4a)
 #define TARGET_FDFLUSH        TARGET_IO(2, 0x4b)
+#define TARGET_FDSETMAXERRS  TARGET_IOW(2, 0x4c,                               \
+                                        struct target_floppy_max_errors)
+#define TARGET_FDGETMAXERRS  TARGET_IOR(2, 0x0e,                               \
+                                        struct target_floppy_max_errors)
 #define TARGET_FDRESET        TARGET_IO(2, 0x54)
 #define TARGET_FDRAWCMD       TARGET_IO(2, 0x58)
 #define TARGET_FDTWADDLE      TARGET_IO(2, 0x59)
linux-user/syscall_types.h +7 -0
index d82d1a5..5ba7c34 100644
@@ -261,6 +261,13 @@ STRUCT(blkpg_ioctl_arg,
        TYPE_INT, /* datalen */
        TYPE_PTRVOID) /* data */
 
+STRUCT(floppy_max_errors,
+       TYPE_INT,     /* abort */
+       TYPE_INT,     /* read_track */
+       TYPE_INT,     /* reset */
+       TYPE_INT,     /* recal */
+       TYPE_INT)     /* reporting */
+
 STRUCT(format_descr,
        TYPE_INT,     /* device */
        TYPE_INT,     /* head */
Signature · 1 line
2.7.4
#6 lore raw

PATCH v4 6/12 linux-user: Add support for HDIO_GET_NICE and HDIO_SET_NICE ioctls

In reply to Aleksandar Markovic

From: Aleksandar Markovic <[email protected]>

Add support for HDIO_GET_NICE and HDIO_SET_NICE ioctls.

---
 linux-user/ioctls.h       | 2 ++
 linux-user/syscall_defs.h | 2 ++
 2 files changed, 4 insertions(+)
linux-user/ioctls.h +2 -0
index 6551938..895ba35 100644
@@ -434,6 +434,7 @@
   IOCTL(HDIO_GET_NOWERR, IOC_R, MK_PTR(TYPE_INT))
   IOCTL(HDIO_GET_DMA, IOC_R, MK_PTR(TYPE_INT))
   IOCTL(HDIO_GET_32BIT, IOC_R, MK_PTR(TYPE_INT))
+  IOCTL(HDIO_GET_NICE, IOC_R, MK_PTR(TYPE_INT))
   IOCTL(HDIO_DRIVE_CMD, IOC_R, MK_PTR(TYPE_INT))
   IOCTL(HDIO_SET_UNMASKINTR, 0, TYPE_INT)
   IOCTL(HDIO_SET_MULTCOUNT, 0, TYPE_INT)
@@ -442,6 +443,7 @@
   IOCTL(HDIO_SET_DMA, 0, TYPE_INT)
   IOCTL(HDIO_SET_32BIT, 0, TYPE_INT)
   IOCTL(HDIO_SET_PIO_MODE, 0, TYPE_INT)
+  IOCTL(HDIO_SET_NICE, 0, TYPE_INT)
 
   IOCTL(VFAT_IOCTL_READDIR_BOTH, IOC_R, MK_PTR(MK_ARRAY(MK_STRUCT(STRUCT_dirent), 2)))
   IOCTL(VFAT_IOCTL_READDIR_SHORT, IOC_R, MK_PTR(MK_ARRAY(MK_STRUCT(STRUCT_dirent), 2)))
linux-user/syscall_defs.h +2 -0
index 36256b0..4e219a1 100644
@@ -1064,6 +1064,7 @@ struct target_format_descr {
 #define TARGET_HDIO_GET_32BIT         0x0309  /* get current io_32bit setting */
 #define TARGET_HDIO_GET_NOWERR        0x030a  /* get ignore-write-error flag */
 #define TARGET_HDIO_GET_DMA           0x030b  /* get use-dma flag */
+#define TARGET_HDIO_GET_NICE          0x030c  /* get nice flags */
 #define TARGET_HDIO_GET_IDENTITY      0x030d  /* get IDE identification info */
 #define TARGET_HDIO_DRIVE_CMD         0x031f  /* execute a special drive command */
 
@@ -1075,6 +1076,7 @@ struct target_format_descr {
 #define TARGET_HDIO_SET_NOWERR        0x0325  /* change ignore-write-error flag */
 #define TARGET_HDIO_SET_DMA           0x0326  /* change use-dma flag */
 #define TARGET_HDIO_SET_PIO_MODE      0x0327  /* reconfig interface to new speed */
+#define TARGET_HDIO_SET_NICE          0x0329  /* set nice flags */
 
 /* loop ioctls */
 #define TARGET_LOOP_SET_FD            0x4C00
Signature · 1 line
2.7.4
#7 lore raw

PATCH v4 7/12 linux-user: Add support for HDIO_GET_WCACHE and HDIO_SET_WCACHE ioctls

In reply to Aleksandar Markovic

From: Aleksandar Markovic <[email protected]>

Add support for HDIO_GET_WCACHE and HDIO_SET_WCACHE ioctls.

---
 linux-user/ioctls.h       | 2 ++
 linux-user/syscall_defs.h | 2 ++
 2 files changed, 4 insertions(+)
linux-user/ioctls.h +2 -0
index 895ba35..b54a184 100644
@@ -435,6 +435,7 @@
   IOCTL(HDIO_GET_DMA, IOC_R, MK_PTR(TYPE_INT))
   IOCTL(HDIO_GET_32BIT, IOC_R, MK_PTR(TYPE_INT))
   IOCTL(HDIO_GET_NICE, IOC_R, MK_PTR(TYPE_INT))
+  IOCTL(HDIO_GET_WCACHE, IOC_R, MK_PTR(TYPE_INT))
   IOCTL(HDIO_DRIVE_CMD, IOC_R, MK_PTR(TYPE_INT))
   IOCTL(HDIO_SET_UNMASKINTR, 0, TYPE_INT)
   IOCTL(HDIO_SET_MULTCOUNT, 0, TYPE_INT)
@@ -444,6 +445,7 @@
   IOCTL(HDIO_SET_32BIT, 0, TYPE_INT)
   IOCTL(HDIO_SET_PIO_MODE, 0, TYPE_INT)
   IOCTL(HDIO_SET_NICE, 0, TYPE_INT)
+  IOCTL(HDIO_SET_WCACHE, 0, TYPE_INT)
 
   IOCTL(VFAT_IOCTL_READDIR_BOTH, IOC_R, MK_PTR(MK_ARRAY(MK_STRUCT(STRUCT_dirent), 2)))
   IOCTL(VFAT_IOCTL_READDIR_SHORT, IOC_R, MK_PTR(MK_ARRAY(MK_STRUCT(STRUCT_dirent), 2)))
linux-user/syscall_defs.h +2 -0
index 4e219a1..fb42d32 100644
@@ -1066,6 +1066,7 @@ struct target_format_descr {
 #define TARGET_HDIO_GET_DMA           0x030b  /* get use-dma flag */
 #define TARGET_HDIO_GET_NICE          0x030c  /* get nice flags */
 #define TARGET_HDIO_GET_IDENTITY      0x030d  /* get IDE identification info */
+#define TARGET_HDIO_GET_WCACHE        0x030e  /* get write cache mode on|off */
 #define TARGET_HDIO_DRIVE_CMD         0x031f  /* execute a special drive command */
 
 /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */
@@ -1077,6 +1078,7 @@ struct target_format_descr {
 #define TARGET_HDIO_SET_DMA           0x0326  /* change use-dma flag */
 #define TARGET_HDIO_SET_PIO_MODE      0x0327  /* reconfig interface to new speed */
 #define TARGET_HDIO_SET_NICE          0x0329  /* set nice flags */
+#define TARGET_HDIO_SET_WCACHE        0x032b  /* change write cache mode */
 
 /* loop ioctls */
 #define TARGET_LOOP_SET_FD            0x4C00
Signature · 1 line
2.7.4
#8 lore raw

PATCH v4 8/12 linux-user: Add support for HDIO_GET_ACOUSTIC and HDIO_SET_ACOUSTIC ioctls

In reply to Aleksandar Markovic

From: Aleksandar Markovic <[email protected]>

Add support for HDIO_GET_ACOUSTIC and HDIO_SET_ACOUSTIC ioctls.

---
 linux-user/ioctls.h       | 2 ++
 linux-user/syscall_defs.h | 2 ++
 2 files changed, 4 insertions(+)
linux-user/ioctls.h +2 -0
index b54a184..c9b82eb 100644
@@ -436,6 +436,7 @@
   IOCTL(HDIO_GET_32BIT, IOC_R, MK_PTR(TYPE_INT))
   IOCTL(HDIO_GET_NICE, IOC_R, MK_PTR(TYPE_INT))
   IOCTL(HDIO_GET_WCACHE, IOC_R, MK_PTR(TYPE_INT))
+  IOCTL(HDIO_GET_ACOUSTIC, IOC_R, MK_PTR(TYPE_INT))
   IOCTL(HDIO_DRIVE_CMD, IOC_R, MK_PTR(TYPE_INT))
   IOCTL(HDIO_SET_UNMASKINTR, 0, TYPE_INT)
   IOCTL(HDIO_SET_MULTCOUNT, 0, TYPE_INT)
@@ -446,6 +447,7 @@
   IOCTL(HDIO_SET_PIO_MODE, 0, TYPE_INT)
   IOCTL(HDIO_SET_NICE, 0, TYPE_INT)
   IOCTL(HDIO_SET_WCACHE, 0, TYPE_INT)
+  IOCTL(HDIO_SET_ACOUSTIC, 0, TYPE_INT)
 
   IOCTL(VFAT_IOCTL_READDIR_BOTH, IOC_R, MK_PTR(MK_ARRAY(MK_STRUCT(STRUCT_dirent), 2)))
   IOCTL(VFAT_IOCTL_READDIR_SHORT, IOC_R, MK_PTR(MK_ARRAY(MK_STRUCT(STRUCT_dirent), 2)))
linux-user/syscall_defs.h +2 -0
index fb42d32..b9d1242 100644
@@ -1067,6 +1067,7 @@ struct target_format_descr {
 #define TARGET_HDIO_GET_NICE          0x030c  /* get nice flags */
 #define TARGET_HDIO_GET_IDENTITY      0x030d  /* get IDE identification info */
 #define TARGET_HDIO_GET_WCACHE        0x030e  /* get write cache mode on|off */
+#define TARGET_HDIO_GET_ACOUSTIC      0x030f  /* get acoustic value */
 #define TARGET_HDIO_DRIVE_CMD         0x031f  /* execute a special drive command */
 
 /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */
@@ -1079,6 +1080,7 @@ struct target_format_descr {
 #define TARGET_HDIO_SET_PIO_MODE      0x0327  /* reconfig interface to new speed */
 #define TARGET_HDIO_SET_NICE          0x0329  /* set nice flags */
 #define TARGET_HDIO_SET_WCACHE        0x032b  /* change write cache mode */
+#define TARGET_HDIO_SET_ACOUSTIC      0x032c  /* change acoustic behavior */
 
 /* loop ioctls */
 #define TARGET_LOOP_SET_FD            0x4C00
Signature · 1 line
2.7.4
#9 lore raw

PATCH v4 9/12 linux-user: Add support for HDIO_GET_ADDRESS and HDIO_SET_ADDRESS ioctls

In reply to Aleksandar Markovic

From: Aleksandar Markovic <[email protected]>

Add support for HDIO_GET_ADDRESS and HDIO_SET_ADDRESS ioctls.

---
 linux-user/ioctls.h       | 2 ++
 linux-user/syscall_defs.h | 2 ++
 2 files changed, 4 insertions(+)
linux-user/ioctls.h +2 -0
index c9b82eb..b9c6a5a 100644
@@ -437,6 +437,7 @@
   IOCTL(HDIO_GET_NICE, IOC_R, MK_PTR(TYPE_INT))
   IOCTL(HDIO_GET_WCACHE, IOC_R, MK_PTR(TYPE_INT))
   IOCTL(HDIO_GET_ACOUSTIC, IOC_R, MK_PTR(TYPE_INT))
+  IOCTL(HDIO_GET_ADDRESS, IOC_R, MK_PTR(TYPE_INT))
   IOCTL(HDIO_DRIVE_CMD, IOC_R, MK_PTR(TYPE_INT))
   IOCTL(HDIO_SET_UNMASKINTR, 0, TYPE_INT)
   IOCTL(HDIO_SET_MULTCOUNT, 0, TYPE_INT)
@@ -448,6 +449,7 @@
   IOCTL(HDIO_SET_NICE, 0, TYPE_INT)
   IOCTL(HDIO_SET_WCACHE, 0, TYPE_INT)
   IOCTL(HDIO_SET_ACOUSTIC, 0, TYPE_INT)
+  IOCTL(HDIO_SET_ADDRESS, 0, TYPE_INT)
 
   IOCTL(VFAT_IOCTL_READDIR_BOTH, IOC_R, MK_PTR(MK_ARRAY(MK_STRUCT(STRUCT_dirent), 2)))
   IOCTL(VFAT_IOCTL_READDIR_SHORT, IOC_R, MK_PTR(MK_ARRAY(MK_STRUCT(STRUCT_dirent), 2)))
linux-user/syscall_defs.h +2 -0
index b9d1242..aa9c6af 100644
@@ -1068,6 +1068,7 @@ struct target_format_descr {
 #define TARGET_HDIO_GET_IDENTITY      0x030d  /* get IDE identification info */
 #define TARGET_HDIO_GET_WCACHE        0x030e  /* get write cache mode on|off */
 #define TARGET_HDIO_GET_ACOUSTIC      0x030f  /* get acoustic value */
+#define TARGET_HDIO_GET_ADDRESS       0x0310  /* get lba addressing modes */
 #define TARGET_HDIO_DRIVE_CMD         0x031f  /* execute a special drive command */
 
 /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */
@@ -1081,6 +1082,7 @@ struct target_format_descr {
 #define TARGET_HDIO_SET_NICE          0x0329  /* set nice flags */
 #define TARGET_HDIO_SET_WCACHE        0x032b  /* change write cache mode */
 #define TARGET_HDIO_SET_ACOUSTIC      0x032c  /* change acoustic behavior */
+#define TARGET_HDIO_SET_ADDRESS       0x032f  /* change lba addressing modes */
 
 /* loop ioctls */
 #define TARGET_LOOP_SET_FD            0x4C00
Signature · 1 line
2.7.4
#10 lore raw

PATCH v4 10/12 linux-user: Add support for HDIO_GET_BUSSTATE and HDIO_SET_BUSSTATE ioctls

In reply to Aleksandar Markovic

From: Aleksandar Markovic <[email protected]>

Add support for HDIO_GET_BUSSTATE and HDIO_SET_BUSSTATE ioctls.

---
 linux-user/ioctls.h       | 2 ++
 linux-user/syscall_defs.h | 2 ++
 2 files changed, 4 insertions(+)
linux-user/ioctls.h +2 -0
index b9c6a5a..3796ee6 100644
@@ -438,6 +438,7 @@
   IOCTL(HDIO_GET_WCACHE, IOC_R, MK_PTR(TYPE_INT))
   IOCTL(HDIO_GET_ACOUSTIC, IOC_R, MK_PTR(TYPE_INT))
   IOCTL(HDIO_GET_ADDRESS, IOC_R, MK_PTR(TYPE_INT))
+  IOCTL(HDIO_GET_BUSSTATE, IOC_R, MK_PTR(TYPE_INT))
   IOCTL(HDIO_DRIVE_CMD, IOC_R, MK_PTR(TYPE_INT))
   IOCTL(HDIO_SET_UNMASKINTR, 0, TYPE_INT)
   IOCTL(HDIO_SET_MULTCOUNT, 0, TYPE_INT)
@@ -449,6 +450,7 @@
   IOCTL(HDIO_SET_NICE, 0, TYPE_INT)
   IOCTL(HDIO_SET_WCACHE, 0, TYPE_INT)
   IOCTL(HDIO_SET_ACOUSTIC, 0, TYPE_INT)
+  IOCTL(HDIO_SET_BUSSTATE, 0, TYPE_INT)
   IOCTL(HDIO_SET_ADDRESS, 0, TYPE_INT)
 
   IOCTL(VFAT_IOCTL_READDIR_BOTH, IOC_R, MK_PTR(MK_ARRAY(MK_STRUCT(STRUCT_dirent), 2)))
linux-user/syscall_defs.h +2 -0
index aa9c6af..766d7b9 100644
@@ -1069,6 +1069,7 @@ struct target_format_descr {
 #define TARGET_HDIO_GET_WCACHE        0x030e  /* get write cache mode on|off */
 #define TARGET_HDIO_GET_ACOUSTIC      0x030f  /* get acoustic value */
 #define TARGET_HDIO_GET_ADDRESS       0x0310  /* get lba addressing modes */
+#define TARGET_HDIO_GET_BUSSTATE      0x031a  /* get hwif bus state */
 #define TARGET_HDIO_DRIVE_CMD         0x031f  /* execute a special drive command */
 
 /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */
@@ -1082,6 +1083,7 @@ struct target_format_descr {
 #define TARGET_HDIO_SET_NICE          0x0329  /* set nice flags */
 #define TARGET_HDIO_SET_WCACHE        0x032b  /* change write cache mode */
 #define TARGET_HDIO_SET_ACOUSTIC      0x032c  /* change acoustic behavior */
+#define TARGET_HDIO_SET_BUSSTATE      0x032d  /* set hwif bus state */
 #define TARGET_HDIO_SET_ADDRESS       0x032f  /* change lba addressing modes */
 
 /* loop ioctls */
Signature · 1 line
2.7.4
#11 lore raw

PATCH v4 11/12 linux-user: Add support for RNDRESEEDCRNG ioctl

In reply to Aleksandar Markovic

From: Aleksandar Markovic <[email protected]>

RNDRESEEDCRNG is a newer ioctl (added in kernel 4.17), and an "ifdef" guard is used for that reason in this patch.

---
 linux-user/ioctls.h       | 3 +++
 linux-user/syscall_defs.h | 1 +
 2 files changed, 4 insertions(+)
linux-user/ioctls.h +3 -0
index 3796ee6..5efa434 100644
@@ -259,6 +259,9 @@
   IOCTL(RNDADDTOENTCNT, IOC_W, MK_PTR(TYPE_INT))
   IOCTL(RNDZAPENTCNT, 0, TYPE_NULL)
   IOCTL(RNDCLEARPOOL, 0, TYPE_NULL)
+#ifdef RNDRESEEDCRNG
+  IOCTL(RNDRESEEDCRNG, 0, TYPE_NULL)
+#endif
 
   IOCTL(CDROMPAUSE, 0, TYPE_NULL)
   IOCTL(CDROMSTART, 0, TYPE_NULL)
linux-user/syscall_defs.h +1 -0
index 766d7b9..314a052 100644
@@ -850,6 +850,7 @@ struct target_pollfd {
 #define TARGET_RNDADDTOENTCNT  TARGET_IOW('R', 0x01, int)
 #define TARGET_RNDZAPENTCNT    TARGET_IO('R', 0x04)
 #define TARGET_RNDCLEARPOOL    TARGET_IO('R', 0x06)
+#define TARGET_RNDRESEEDCRNG   TARGET_IO('R', 0x07)
 
 /* From <linux/fs.h> */
 
Signature · 1 line
2.7.4
#12 lore raw

PATCH v4 12/12 linux-user: Add support for semtimedop() syscall

In reply to Aleksandar Markovic

From: Aleksandar Rikalo <[email protected]>

Add support for semtimedop() emulation. It is based on invocation of safe_semtimedop().

Conversion is left out of safe_semtimedop(), since other safe_xxx() usually don't contain similar conversions.

---
 linux-user/syscall.c | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
linux-user/syscall.c +40 -0
index ee80175..6825458 100644
@@ -6650,7 +6650,43 @@ static inline abi_long host_to_target_statx(struct target_statx *host_stx,
     return 0;
 }
 #endif
+#ifdef TARGET_NR_semtimedop
+static inline abi_long do_semtimedop(int semid, abi_long ptr, unsigned nsops,
+                                     abi_long timeout)
+{
+    struct sembuf *sops;
+    struct timespec ts, *pts;
+    abi_long ret;
+
+    if (timeout) {
+        pts = &ts;
+        if (target_to_host_timespec(pts, timeout)) {
+            return -TARGET_EFAULT;
+        }
+    } else {
+        pts = NULL;
+    }
 
+    sops = g_malloc(sizeof(struct sembuf) * nsops);
+    if (sops == NULL) {
+        return -TARGET_EFAULT;
+    }
+
+    if (target_to_host_sembuf(sops, ptr, nsops)) {
+        g_free(sops);
+        return -TARGET_EFAULT;
+    }
+
+#ifdef __NR_semtimedop
+    ret = get_errno(safe_semtimedop(semid, sops, nsops, pts));
+#else
+    ret = -TARGET_ENOSYS;
+#endif
+    g_free(sops);
+
+    return ret;
+}
+#endif
 
 /* ??? Using host futex calls even when target atomic operations
    are not really atomic probably breaks things.  However implementing
@@ -9194,6 +9230,10 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
     case TARGET_NR_semop:
         return do_semop(arg1, arg2, arg3);
 #endif
+#ifdef TARGET_NR_semtimedop
+    case TARGET_NR_semtimedop:
+        return do_semtimedop(arg1, arg2, arg3, arg4);
+#endif
 #ifdef TARGET_NR_semctl
     case TARGET_NR_semctl:
         return do_semctl(arg1, arg2, arg3, arg4);
Signature · 1 line
2.7.4
#13 lore raw

Re: [Qemu-devel] [EXTERNAL][PATCH for 4.2 v4 12/12] linux-user: Add support for semtimedop() syscall

Quoted 4 lines

From: Aleksandar Rikalo <[email protected]>

Add support for semtimedop() emulation. It is based on invocation of safe_semtimedop().

Hi, Laurent,

Aleksandar R. is considering submitting this part too:

linux-user/syscall.c +11 -0
index b5bc6e4..0e56b8d 100644
@@ -4194,6 +4194,17 @@ static abi_long do_ipc(CPUArchState *cpu_env,
     case IPCOP_shmctl:
         ret = do_shmctl(first, second, ptr);
         break;
+#ifdef __NR_ipc
+    case IPCOP_semtimedop: {
+        struct sembuf sops[nsops];
+        if (target_to_host_sembuf(first, ptr, second)) {
+            ret = -TARGET_EFAULT;
+        } else {
+            ret = get_errno(safe_ipc(IPCOP_semtimedop, first, second, 0, sops, 0));
+        }
+        break;
+    }
+#endif
     default:
 	gemu_log("Unsupported ipc call: %d (version %d)\n", call, version);
 	ret = -TARGET_ENOSYS;

Does this look fine to you?

Sincerely,
Aleksandar

#14 lore raw

Re: [Qemu-devel] [EXTERNAL][PATCH for 4.2 v4 12/12] linux-user: Add support for semtimedop() syscall

Le 31/07/2019 à 20:22, Aleksandar Markovic a écrit :

Quoted 18 lines
Quoted 4 lines

From: Aleksandar Rikalo <[email protected]>

Add support for semtimedop() emulation. It is based on invocation of safe_semtimedop().

Hi, Laurent,

Aleksandar R. is considering submitting this part too:

linux-user/syscall.c +1 -0
index b5bc6e4..0e56b8d 100644
@@ -4194,6 +4194,17 @@ static abi_long do_ipc(CPUArchState *cpu_env,
     case IPCOP_shmctl:
         ret = do_shmctl(first, second, ptr);
         break;
+#ifdef __NR_ipc

linux-user/syscall.c static abi_long do_ipc(CPUArchState *cpu_env, · line 4207

Quoted 10 lines
linux-user/syscall.c +10 -0
+    case IPCOP_semtimedop: {
+        struct sembuf sops[nsops];
+        if (target_to_host_sembuf(first, ptr, second)) {
+            ret = -TARGET_EFAULT;
+        } else {
+            ret = get_errno(safe_ipc(IPCOP_semtimedop, first, second, 0, sops, 0));
+        }
+        break;
+    }
+#endif

You should do something like that:

    case IPCOP_semtimedop
        ret = do_semtimedop( ... );
        break;

Thanks,
Laurent