From 5a358b39f52a28a84b380c1685c93010987b3412 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Thu, 27 Sep 2018 16:55:38 +0100 Subject: hw/display/qxl: Suppress clang-7 warning about misaligned atomic operation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If QEMU is compiled with clang-7 it results in the warning: hw/display/qxl.c:1884:19: error: misaligned or large atomic operation may incur significant performance penalty [-Werror,-Watomic-alignment] old_pending = atomic_fetch_or(&d->ram->int_pending, le_events); ^ This is because the Spice headers forgot to define the QXLRam struct with the '__aligned__(4)' attribute. clang 7 and newer will thus warn that the access here to int_pending might not be 4-aligned (because the QXLRam object d->ram points at might start at a misaligned address). In fact we set up d->ram in init_qxl_ram() so it always starts at a 4K boundary, so we know the atomic access here is OK. Newer Spice versions (with Spice commit beda5ec7a6848be20c0cac2a9a8ef2a41e8069c1) will fix the bug; for older Spice versions, work around it by telling the compiler explicitly that the alignment is OK using __builtin_assume_aligned(). Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Message-id: 20180927155538.699-1-peter.maydell@linaro.org Signed-off-by: Gerd Hoffmann --- include/qemu/compiler.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include') diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h index 5843812..bf47e7b 100644 --- a/include/qemu/compiler.h +++ b/include/qemu/compiler.h @@ -122,6 +122,15 @@ #ifndef __has_feature #define __has_feature(x) 0 /* compatibility with non-clang compilers */ #endif + +#ifndef __has_builtin +#define __has_builtin(x) 0 /* compatibility with non-clang compilers */ +#endif + +#if __has_builtin(__builtin_assume_aligned) || QEMU_GNUC_PREREQ(4, 7) +#define HAS_ASSUME_ALIGNED +#endif + /* Implement C11 _Generic via GCC builtins. Example: * * QEMU_GENERIC(x, (float, sinf), (long double, sinl), sin) (x) -- cgit v1.1 From edbc4b24bbb179fa9562d4e5313470f10569433c Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Fri, 5 Oct 2018 11:19:34 +0200 Subject: edid: fix vendor default "EMU" actually is "Emulex Corporation", so not a good idea to use that by default. Lets use the Red Hat vendor id instead, which is in line with the pci ids which are allocated from Red Hat vendor ids too. Vendor list is available from http://www.uefi.org/pnp_id_list Signed-off-by: Gerd Hoffmann Message-id: 20181005091934.12143-1-kraxel@redhat.com --- include/hw/display/edid.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/hw/display/edid.h b/include/hw/display/edid.h index bd51d26..bacf170 100644 --- a/include/hw/display/edid.h +++ b/include/hw/display/edid.h @@ -4,7 +4,7 @@ #include "hw/hw.h" typedef struct qemu_edid_info { - const char *vendor; + const char *vendor; /* http://www.uefi.org/pnp_id_list */ const char *name; const char *serial; uint32_t dpi; -- cgit v1.1