Skip to contentSkip to conversation

ivshmem deprecation, qtests, typedefs and gnu99

GIT PULL Thomas Huth 4 participants 8 messages Jan 14, 2019 – Jan 15, 2019 Block layer

lore
Share & tools
lore
#1 lore raw

[Qemu-devel] [PULL v2 20/27] ui/console: Remove MouseTransformInfo from qemu/typedefs.h

In reply to Thomas Huth

From: Philippe Mathieu-Daudé <[email protected]>

Header files requiring MouseTransformInfo already include "ui/console.h".

To clean "qemu/typedefs.h", move the declaration to "ui/console.h" (removing the forward declaration).

---
 include/hw/devices.h    | 1 +
 include/qemu/typedefs.h | 1 -
 include/ui/console.h    | 4 ++--
 3 files changed, 3 insertions(+), 3 deletions(-)
include/hw/devices.h +1 -0
index 0e27feb..b5f1662 100644
@@ -4,6 +4,7 @@
 /* Devices that have nowhere better to go.  */
 
 #include "hw/hw.h"
+#include "ui/console.h"
 
 /* smc91c111.c */
 void smc91c111_init(NICInfo *, uint32_t, qemu_irq);
include/qemu/typedefs.h +0 -1
index 3a57dfd..38ec1fd 100644
@@ -51,7 +51,6 @@ typedef struct MigrationIncomingState MigrationIncomingState;
 typedef struct MigrationState MigrationState;
 typedef struct Monitor Monitor;
 typedef struct MonitorDef MonitorDef;
-typedef struct MouseTransformInfo MouseTransformInfo;
 typedef struct MSIMessage MSIMessage;
 typedef struct NetClientState NetClientState;
 typedef struct NetFilterState NetFilterState;
include/ui/console.h +2 -2
index 0a19037..aa9f975 100644
@@ -65,13 +65,13 @@ void qemu_remove_led_event_handler(QEMUPutLEDEntry *entry);
 
 void kbd_put_ledstate(int ledstate);
 
-struct MouseTransformInfo {
+typedef struct MouseTransformInfo {
     /* Touchscreen resolution */
     int x;
     int y;
     /* Calibration values as used/generated by tslib */
     int a[7];
-};
+} MouseTransformInfo;
 
 void hmp_mouse_set(Monitor *mon, const QDict *qdict);
 
Signature · 1 line
1.8.3.1
#2 lore raw

[Qemu-devel] [PULL v2 21/27] ui/console: Remove PixelFormat from qemu/typedefs.h

In reply to Thomas Huth

From: Philippe Mathieu-Daudé <[email protected]>

Header files requiring PixelFormat already include "ui/qemu-pixman.h".

To clean "qemu/typedefs.h", move the declaration to "ui/qemu-pixman.h" (removing the forward declaration).

---
 include/qemu/typedefs.h  |  1 -
 include/ui/console.h     | 10 ----------
 include/ui/qemu-pixman.h | 10 ++++++++++
 3 files changed, 10 insertions(+), 11 deletions(-)
include/qemu/typedefs.h +0 -1
index 38ec1fd..5d1a2d8 100644
@@ -71,7 +71,6 @@ typedef struct PCIExpressHost PCIExpressHost;
 typedef struct PCIHostDeviceAddress PCIHostDeviceAddress;
 typedef struct PCIHostState PCIHostState;
 typedef struct PCMachineState PCMachineState;
-typedef struct PixelFormat PixelFormat;
 typedef struct PostcopyDiscardState PostcopyDiscardState;
 typedef struct Property Property;
 typedef struct PropertyInfo PropertyInfo;
include/ui/console.h +0 -10
index aa9f975..fef900d 100644
@@ -121,16 +121,6 @@ struct QemuConsoleClass {
 
 #define QEMU_ALLOCATED_FLAG     0x01
 
-struct PixelFormat {
-    uint8_t bits_per_pixel;
-    uint8_t bytes_per_pixel;
-    uint8_t depth; /* color depth in bits */
-    uint32_t rmask, gmask, bmask, amask;
-    uint8_t rshift, gshift, bshift, ashift;
-    uint8_t rmax, gmax, bmax, amax;
-    uint8_t rbits, gbits, bbits, abits;
-};
-
 typedef struct DisplaySurface {
     pixman_format_code_t format;
     pixman_image_t *image;
include/ui/qemu-pixman.h +10 -0
index b7c82d1..0668109 100644
@@ -53,6 +53,16 @@
 
 /* -------------------------------------------------------------------- */
 
+typedef struct PixelFormat {
+    uint8_t bits_per_pixel;
+    uint8_t bytes_per_pixel;
+    uint8_t depth; /* color depth in bits */
+    uint32_t rmask, gmask, bmask, amask;
+    uint8_t rshift, gshift, bshift, ashift;
+    uint8_t rmax, gmax, bmax, amax;
+    uint8_t rbits, gbits, bbits, abits;
+} PixelFormat;
+
 PixelFormat qemu_pixelformat_from_pixman(pixman_format_code_t format);
 pixman_format_code_t qemu_default_pixman_format(int bpp, bool native_endian);
 pixman_format_code_t qemu_drm_format_to_pixman(uint32_t drm_format);
Signature · 1 line
1.8.3.1
#0 lore raw

Hi Peter!

The following changes since commit 7260438b7056469610ee166f7abe9ff8a26b8b16:

Merge remote-tracking branch 'remotes/palmer/tags/riscv-for-master-3.2-part2' into staging (2019-01-14 11:41:43 +0000)

are available in the git repository at:

https://gitlab.com/huth/qemu.git tags/pull-request-2019-01-14v2

for you to fetch changes up to 650db715681ad1a042705484776e1974f288f3d4:

tests/hexloader-test: Don't pass -nographic to the QEMU under test (2019-01-14 18:21:29 +0100)

----------------------------------------------------------------
- Remove deprecated "ivshmem" legacy device
- Bug fix for vhost-user-test
- Use more CONFIG Makefile switches for qtests
- Get rid of global_qtests in some more qtests
- typedef cleanups
- Fixes for compiling with Clang
- Force C standard to gnu99
----------------------------------------------------------------

Li Qiang (3):
tests: vhost-user-test: initialize 'fd' in chr_read
vhost-user: fix ioeventfd_enabled
util: check the return value of fcntl in qemu_set_{block, nonblock}

Peter Maydell (1):
tests/hexloader-test: Don't pass -nographic to the QEMU under test

Philippe Mathieu-Daudé (12):
hw/input/ps2: Remove PS2State from "qemu/typedefs.h" hw/pcmcia: Remove PCMCIACardState from "qemu/typedefs.h" hw/ide/ahci: Remove AllwinnerAHCIState from "qemu/typedefs.h" hw/i2c/smbus: Remove SMBusDevice from "qemu/typedefs.h" hw/bt: Remove HCIInfo from "qemu/typedefs.h" hw/char/serial: Remove SerialState from "qemu/typedefs.h" hw/i386: Remove PCMachineClass from "qemu/typedefs.h"
audio: Remove AudioState from "qemu/typedefs.h" ui/console: Remove QemuDmaBuf from "qemu/typedefs.h" ui/console: Remove DisplayState/DisplaySurface from "qemu/typedefs.h" ui/console: Remove MouseTransformInfo from qemu/typedefs.h ui/console: Remove PixelFormat from qemu/typedefs.h

Thomas Huth (11):
hw/misc/ivshmem: Remove deprecated "ivshmem" legacy device tests/Makefile: Use some more CONFIG switches for x86 tests tests/Makefile: Use some more CONFIG switches for ppc tests tests/endianesss: Make test independent of global_qtest tests/boot-order: Make test independent of global_qtest tests/pnv-xscom: Make test independent of global_qtest
linux-user: Fix compilation with clang 3.4
ppc: Move spapr-related prototypes from xics.h into a seperate header file
ppc: Fix duplicated typedefs to be able to compile with Clang in gnu99 mode
block: Work-around a bug in libiscsi 1.9.0 when used in gnu99 mode
configure: Force the C standard to gnu99

 audio/audio_int.h           |   4 +-
 block/iscsi.c               |   2 +
 configure                   |   5 +-
 docs/specs/ivshmem-spec.txt |   8 +-
 hw/i386/pc_piix.c           |   1 -
 hw/intc/xics_kvm.c          |   1 +
 hw/intc/xics_spapr.c        |   1 +
 hw/misc/ivshmem.c           | 210 +---------------------------
 hw/ppc/spapr_irq.c          |   1 +
 hw/virtio/vhost-user.c      |   2 +-
 include/hw/arm/pxa.h        |   1 +
 include/hw/char/serial.h    |   4 +-
 include/hw/devices.h        |   1 +
 include/hw/i2c/smbus.h      |   2 +
 include/hw/i386/pc.h        |   4 +-
 include/hw/ide/ahci.h       |   4 +-
 include/hw/input/ps2.h      |   2 +
 include/hw/pcmcia.h         |   4 +-
 include/hw/ppc/spapr.h      |   5 +-
 include/hw/ppc/spapr_xive.h |   2 -
 include/hw/ppc/xics.h       |   7 -
 include/hw/ppc/xics_spapr.h |  37 +++++
 include/qemu/compiler.h     |   4 +
 include/qemu/typedefs.h     |  13 --
 include/sysemu/bt.h         |   4 +-
 include/ui/console.h        |  24 ++--
 include/ui/qemu-pixman.h    |  10 ++
 linux-user/qemu.h           |   6 +-
 qemu-deprecated.texi        |   5 -
 scripts/device-crash-test   |   1 -
 target/ppc/cpu.h            |  13 +-
 tests/Makefile.include      |  22 +--
 tests/boot-order-test.c     |  59 ++++----
 tests/endianness-test.c     | 329 ++++++++++++++++++++++----------------------
 tests/hexloader-test.c      |   2 +-
 tests/ivshmem-test.c        |  67 ++++-----
 tests/pnv-xscom-test.c      |  29 ++--
 tests/vhost-user-test.c     |   2 +-
 util/oslib-posix.c          |   8 +-
 39 files changed, 363 insertions(+), 543 deletions(-)
 create mode 100644 include/hw/ppc/xics_spapr.h
#3 lore raw

[Qemu-devel] [PULL v2 25/27] block: Work-around a bug in libiscsi 1.9.0 when used in gnu99 mode

The header "scsi-lowlevel.h" of libiscsi 1.9.0 contains some bad "inline" prototype definitions which GCC refuses to compile in its gnu99 mode:

In file included from block/iscsi.c:52:0:
/usr/include/iscsi/scsi-lowlevel.h:810:13: error: inline function ‘scsi_set_uint16’ declared but never defined [-Werror]

 inline void scsi_set_uint16(unsigned char *c, uint16_t val);
             ^
/usr/include/iscsi/scsi-lowlevel.h:809:13: error: inline function
‘scsi_set_uint32’ declared but never defined [-Werror]
 inline void scsi_set_uint32(unsigned char *c, uint32_t val);
             ^

[...]

This has been fixed by upstream libiscsi in version 1.10.0 (see
https://github.com/sahlberg/libiscsi/commit/7692027d6c11 ), but since we still want to support 1.9.0 for CentOS 7 / RHEL7, we have to work-around the issue by redefining the "inline" keyword to use the old "gnu89" mode behavior via "gnu_inline" instead.

---
 block/iscsi.c | 2 ++
 1 file changed, 2 insertions(+)
block/iscsi.c +2 -0
index a7e8c1f..ff47320 100644
@@ -49,7 +49,9 @@
 /* Conflict between scsi/utils.h and libiscsi! :( */
 #define SCSI_XFER_NONE ISCSI_XFER_NONE
 #include <iscsi/iscsi.h>
+#define inline __attribute__((gnu_inline))  /* required for libiscsi v1.9.0 */
 #include <iscsi/scsi-lowlevel.h>
+#undef inline
 #undef SCSI_XFER_NONE
 QEMU_BUILD_BUG_ON((int)SCSI_XFER_NONE != (int)ISCSI_XFER_NONE);
 
Signature · 1 line
1.8.3.1
#4 lore raw
In reply to Thomas Huth
Quoted 15 lines · Thomas Huth

Hi Peter!

The following changes since commit 7260438b7056469610ee166f7abe9ff8a26b8b16:

Merge remote-tracking branch 'remotes/palmer/tags/riscv-for-master-3.2-part2' into staging (2019-01-14 11:41:43 +0000)

are available in the git repository at:

https://gitlab.com/huth/qemu.git tags/pull-request-2019-01-14v2

for you to fetch changes up to 650db715681ad1a042705484776e1974f288f3d4:

tests/hexloader-test: Don't pass -nographic to the QEMU under test (2019-01-14 18:21:29 +0100)

Quoted 9 lines

----------------------------------------------------------------
- Remove deprecated "ivshmem" legacy device
- Bug fix for vhost-user-test
- Use more CONFIG Makefile switches for qtests
- Get rid of global_qtests in some more qtests
- typedef cleanups
- Fixes for compiling with Clang
- Force C standard to gnu99
----------------------------------------------------------------

Hi; another compile failure on that ppc64 system, I'm afraid:

/home/pm215/qemu/qemu-seccomp.c:45:1: error: initializer element is not constant
};
^
/home/pm215/qemu/qemu-seccomp.c:45:1: error: (near initialization for ‘sched_setscheduler_arg[0]’)

(I did a quick check with 'make -k' and it looks like there aren't any more lurking after that one.)

The system libseccomp is libseccomp-2.3.1-3.el7.

thanks
-- PMM

#5 lore raw
Quoted 34 lines · Peter Maydell
Quoted 15 lines · Thomas Huth

Hi Peter!

The following changes since commit 7260438b7056469610ee166f7abe9ff8a26b8b16:

Merge remote-tracking branch 'remotes/palmer/tags/riscv-for-master-3.2-part2' into staging (2019-01-14 11:41:43 +0000)

are available in the git repository at:

https://gitlab.com/huth/qemu.git tags/pull-request-2019-01-14v2

for you to fetch changes up to 650db715681ad1a042705484776e1974f288f3d4:

tests/hexloader-test: Don't pass -nographic to the QEMU under test (2019-01-14 18:21:29 +0100)

Quoted 9 lines

----------------------------------------------------------------
- Remove deprecated "ivshmem" legacy device
- Bug fix for vhost-user-test
- Use more CONFIG Makefile switches for qtests
- Get rid of global_qtests in some more qtests
- typedef cleanups
- Fixes for compiling with Clang
- Force C standard to gnu99
----------------------------------------------------------------

Hi; another compile failure on that ppc64 system, I'm afraid:

/home/pm215/qemu/qemu-seccomp.c:45:1: error: initializer element is not constant
};
^
/home/pm215/qemu/qemu-seccomp.c:45:1: error: (near initialization for ‘sched_setscheduler_arg[0]’)

Quoted 4 lines

(I did a quick check with 'make -k' and it looks like there aren't any more lurking after that one.)

The system libseccomp is libseccomp-2.3.1-3.el7.

Darn, I think this time it is a compiler bug:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63567

It's only fixed in GCC >= v5.0 :-(

I see two options:

1) Expand the macro manually:

qemu-seccomp.c +1 -1
@@ -41,7 +41,7 @@ struct QemuSeccompSyscall {
 };
 
 const struct scmp_arg_cmp sched_setscheduler_arg[] = {
-    SCMP_A1(SCMP_CMP_NE, SCHED_IDLE)
+    { .arg = 1, .op = SCMP_CMP_NE, .datum_a = SCHED_IDLE }
 };
 

... then it compiles fine for me in gnu99 mode, too.

2) Scratch the whole idea with gnu99 again ...

Opinions?

Thomas

#6 lore raw
Quoted 63 lines · Thomas Huth
Quoted 34 lines · Peter Maydell
Quoted 15 lines · Thomas Huth

Hi Peter!

The following changes since commit 7260438b7056469610ee166f7abe9ff8a26b8b16:

Merge remote-tracking branch 'remotes/palmer/tags/riscv-for-master-3.2-part2' into staging (2019-01-14 11:41:43 +0000)

are available in the git repository at:

https://gitlab.com/huth/qemu.git tags/pull-request-2019-01-14v2

for you to fetch changes up to 650db715681ad1a042705484776e1974f288f3d4:

tests/hexloader-test: Don't pass -nographic to the QEMU under test (2019-01-14 18:21:29 +0100)

Quoted 9 lines

----------------------------------------------------------------
- Remove deprecated "ivshmem" legacy device
- Bug fix for vhost-user-test
- Use more CONFIG Makefile switches for qtests
- Get rid of global_qtests in some more qtests
- typedef cleanups
- Fixes for compiling with Clang
- Force C standard to gnu99
----------------------------------------------------------------

Hi; another compile failure on that ppc64 system, I'm afraid:

/home/pm215/qemu/qemu-seccomp.c:45:1: error: initializer element is not constant
};
^
/home/pm215/qemu/qemu-seccomp.c:45:1: error: (near initialization for ‘sched_setscheduler_arg[0]’)

Quoted 4 lines

(I did a quick check with 'make -k' and it looks like there aren't any more lurking after that one.)

The system libseccomp is libseccomp-2.3.1-3.el7.

Darn, I think this time it is a compiler bug:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63567

It's only fixed in GCC >= v5.0 :-(

I see two options:

1) Expand the macro manually:

qemu-seccomp.c +1 -1
@@ -41,7 +41,7 @@ struct QemuSeccompSyscall {
 };
 
 const struct scmp_arg_cmp sched_setscheduler_arg[] = {
-    SCMP_A1(SCMP_CMP_NE, SCHED_IDLE)
+    { .arg = 1, .op = SCMP_CMP_NE, .datum_a = SCHED_IDLE }
 };
 

... then it compiles fine for me in gnu99 mode, too.

Quoted 1 line

2) Scratch the whole idea with gnu99 again ...

I'd prefer 1, since I think its important for us to actually have a consistent compiler standard to target, even if we have to do some short terms hacks like the one you show. As long as a put a comment next to it, we can revert the hack when we eventually ditch support for the GCC <= 5.0

Also, I'd probably argue that the seccomp syntax without the macro is clearer to understand regardless :-)

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#7 lore raw
Quoted 64 lines · Daniel P. Berrangé
Quoted 63 lines · Thomas Huth
Quoted 34 lines · Peter Maydell
Quoted 15 lines · Thomas Huth

Hi Peter!

The following changes since commit 7260438b7056469610ee166f7abe9ff8a26b8b16:

Merge remote-tracking branch 'remotes/palmer/tags/riscv-for-master-3.2-part2' into staging (2019-01-14 11:41:43 +0000)

are available in the git repository at:

https://gitlab.com/huth/qemu.git tags/pull-request-2019-01-14v2

for you to fetch changes up to 650db715681ad1a042705484776e1974f288f3d4:

tests/hexloader-test: Don't pass -nographic to the QEMU under test (2019-01-14 18:21:29 +0100)

Quoted 9 lines

----------------------------------------------------------------
- Remove deprecated "ivshmem" legacy device
- Bug fix for vhost-user-test
- Use more CONFIG Makefile switches for qtests
- Get rid of global_qtests in some more qtests
- typedef cleanups
- Fixes for compiling with Clang
- Force C standard to gnu99
----------------------------------------------------------------

Hi; another compile failure on that ppc64 system, I'm afraid:

/home/pm215/qemu/qemu-seccomp.c:45:1: error: initializer element is not constant
};
^
/home/pm215/qemu/qemu-seccomp.c:45:1: error: (near initialization for ‘sched_setscheduler_arg[0]’)

Quoted 4 lines

(I did a quick check with 'make -k' and it looks like there aren't any more lurking after that one.)

The system libseccomp is libseccomp-2.3.1-3.el7.

Darn, I think this time it is a compiler bug:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63567

It's only fixed in GCC >= v5.0 :-(

I see two options:

1) Expand the macro manually:

qemu-seccomp.c +1 -1
@@ -41,7 +41,7 @@ struct QemuSeccompSyscall {
 };
 
 const struct scmp_arg_cmp sched_setscheduler_arg[] = {
-    SCMP_A1(SCMP_CMP_NE, SCHED_IDLE)
+    { .arg = 1, .op = SCMP_CMP_NE, .datum_a = SCHED_IDLE }
 };
 

... then it compiles fine for me in gnu99 mode, too.

Quoted 7 lines
Quoted 1 line

2) Scratch the whole idea with gnu99 again ...

I'd prefer 1, since I think its important for us to actually have a consistent compiler standard to target, even if we have to do some short terms hacks like the one you show. As long as a put a comment next to it, we can revert the hack when we eventually ditch support for the GCC <= 5.0

Yes, nailing down the language dialect is worth a few temporary hacks.

Quoted 2 lines

Also, I'd probably argue that the seccomp syntax without the macro is clearer to understand regardless :-)

Me too, except SCMP_A1 & friends come from /usr/include/seccomp.h.

Expanding the macro until we upgrade compilers feels tolerable. Any better ideas?