From 2c9dce0196883d76e8bcb7142b26ab7587ff3006 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 7 Jan 2021 15:57:18 +0100 Subject: [PATCH 01/20] meson: do not use CONFIG_VIRTFS CONFIG_VIRTFS is not anymore part of the config_host dictionary. Signed-off-by: Paolo Bonzini --- fsdev/meson.build | 2 +- tests/qtest/meson.build | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/fsdev/meson.build b/fsdev/meson.build index 7dd1cc9bfb..65455a179e 100644 --- a/fsdev/meson.build +++ b/fsdev/meson.build @@ -8,7 +8,7 @@ fsdev_ss.add(when: ['CONFIG_FSDEV_9P'], if_true: files( ), if_false: files('qemu-fsdev-dummy.c')) softmmu_ss.add_all(when: 'CONFIG_LINUX', if_true: fsdev_ss) -have_virtfs_proxy_helper = have_tools and libattr.found() and libcap_ng.found() and 'CONFIG_VIRTFS' in config_host +have_virtfs_proxy_helper = have_tools and libattr.found() and libcap_ng.found() and have_virtfs if have_virtfs_proxy_helper executable('virtfs-proxy-helper', files('virtfs-proxy-helper.c', '9p-marshal.c', '9p-iov-marshal.c'), diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index 6a67c538be..6ec09821d7 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -199,7 +199,9 @@ qos_test_ss.add( 'virtio-serial-test.c', 'vmxnet3-test.c', ) -qos_test_ss.add(when: 'CONFIG_VIRTFS', if_true: files('virtio-9p-test.c')) +if have_virtfs + qos_test_ss.add(files('virtio-9p-test.c')) +endif qos_test_ss.add(when: 'CONFIG_VHOST_USER', if_true: files('vhost-user-test.c')) tpmemu_files = ['tpm-emu.c', 'tpm-util.c', 'tpm-tests.c'] From 9102c968216460c27be1c476938c3e2d508f5fc7 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Sat, 19 Dec 2020 04:06:36 -0500 Subject: [PATCH 02/20] whpx: rename whp-dispatch to whpx-internal.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rename the file in preparation for moving more implementation-internal definitions to it. The build is still broken though. Signed-off-by: Paolo Bonzini Reviewed-by: Marc-André Lureau Message-Id: <20201219090637.1700900-2-pbonzini@redhat.com> --- target/i386/whpx/whpx-all.c | 5 +---- target/i386/whpx/whpx-apic.c | 2 +- target/i386/whpx/whpx-cpus.c | 4 +--- target/i386/whpx/{whp-dispatch.h => whpx-internal.h} | 6 +++--- 4 files changed, 6 insertions(+), 11 deletions(-) rename target/i386/whpx/{whp-dispatch.h => whpx-internal.h} (98%) diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index 3b824fc9d7..12f79e2cd6 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -26,13 +26,10 @@ #include "qapi/qapi-types-common.h" #include "qapi/qapi-visit-common.h" #include "migration/blocker.h" -#include "whp-dispatch.h" #include #include "whpx-cpus.h" - -#include -#include +#include "whpx-internal.h" #define HYPERV_APIC_BUS_FREQUENCY (200000000ULL) diff --git a/target/i386/whpx/whpx-apic.c b/target/i386/whpx/whpx-apic.c index b127a3cb8a..1d330bf749 100644 --- a/target/i386/whpx/whpx-apic.c +++ b/target/i386/whpx/whpx-apic.c @@ -18,7 +18,7 @@ #include "hw/pci/msi.h" #include "sysemu/hw_accel.h" #include "sysemu/whpx.h" -#include "whp-dispatch.h" +#include "whpx-internal.h" static void whpx_put_apic_state(APICCommonState *s, struct whpx_lapic_state *kapic) diff --git a/target/i386/whpx/whpx-cpus.c b/target/i386/whpx/whpx-cpus.c index d9bd5a2d36..f7e69881a3 100644 --- a/target/i386/whpx/whpx-cpus.c +++ b/target/i386/whpx/whpx-cpus.c @@ -15,11 +15,9 @@ #include "qemu/guest-random.h" #include "sysemu/whpx.h" +#include "whpx-internal.h" #include "whpx-cpus.h" -#include -#include - static void *whpx_cpu_thread_fn(void *arg) { CPUState *cpu = arg; diff --git a/target/i386/whpx/whp-dispatch.h b/target/i386/whpx/whpx-internal.h similarity index 98% rename from target/i386/whpx/whp-dispatch.h rename to target/i386/whpx/whpx-internal.h index cef5d848bd..e0a9ea1dce 100644 --- a/target/i386/whpx/whp-dispatch.h +++ b/target/i386/whpx/whpx-internal.h @@ -1,5 +1,5 @@ -#ifndef WHP_DISPATCH_H -#define WHP_DISPATCH_H +#ifndef WHP_INTERNAL_H +#define WHP_INTERNAL_H #include #include @@ -72,4 +72,4 @@ typedef enum WHPFunctionList { WINHV_PLATFORM_FNS_SUPPLEMENTAL } WHPFunctionList; -#endif /* WHP_DISPATCH_H */ +#endif /* WHP_INTERNAL_H */ From 84f4ef17ae9933e27699077a2840a9ea251ca38f Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Sat, 19 Dec 2020 04:06:37 -0500 Subject: [PATCH 03/20] whpx: move internal definitions to whpx-internal.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Only leave the external interface in sysemu/whpx.h. whpx_apic_in_platform is moved to a .c file because it needs whpx_state. Reported-by: Marc-André Lureau Signed-off-by: Paolo Bonzini Reviewed-by: Marc-André Lureau Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20201219090637.1700900-3-pbonzini@redhat.com> --- include/sysemu/whpx.h | 22 +--------------------- target/i386/whpx/whpx-all.c | 4 ++++ target/i386/whpx/whpx-internal.h | 18 ++++++++++++++++++ 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/include/sysemu/whpx.h b/include/sysemu/whpx.h index 9346fd92e9..8ca1c1c4ac 100644 --- a/include/sysemu/whpx.h +++ b/include/sysemu/whpx.h @@ -15,28 +15,8 @@ #ifdef CONFIG_WHPX -#include "whp-dispatch.h" - -struct whpx_state { - uint64_t mem_quota; - WHV_PARTITION_HANDLE partition; - bool kernel_irqchip_allowed; - bool kernel_irqchip_required; - bool apic_in_platform; -}; - -struct whpx_lapic_state { - struct { - uint32_t data; - uint32_t padding[3]; - } fields[256]; -}; - -extern struct whpx_state whpx_global; int whpx_enabled(void); - -void whpx_apic_get(DeviceState *s); -#define whpx_apic_in_platform() (whpx_global.apic_in_platform) +bool whpx_apic_in_platform(void); #else /* CONFIG_WHPX */ diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index 12f79e2cd6..985ceba8f8 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -1866,6 +1866,10 @@ int whpx_enabled(void) return whpx_allowed; } +bool whpx_apic_in_platform(void) { + return whpx_global.apic_in_platform; +} + static void whpx_accel_class_init(ObjectClass *oc, void *data) { AccelClass *ac = ACCEL_CLASS(oc); diff --git a/target/i386/whpx/whpx-internal.h b/target/i386/whpx/whpx-internal.h index e0a9ea1dce..8cfaaef141 100644 --- a/target/i386/whpx/whpx-internal.h +++ b/target/i386/whpx/whpx-internal.h @@ -5,6 +5,24 @@ #include #include +struct whpx_state { + uint64_t mem_quota; + WHV_PARTITION_HANDLE partition; + bool kernel_irqchip_allowed; + bool kernel_irqchip_required; + bool apic_in_platform; +}; + +struct whpx_lapic_state { + struct { + uint32_t data; + uint32_t padding[3]; + } fields[256]; +}; + +extern struct whpx_state whpx_global; +void whpx_apic_get(DeviceState *s); + #define WHV_E_UNKNOWN_CAPABILITY 0x80370300L #define LIST_WINHVPLATFORM_FUNCTIONS(X) \ From dc835398724ddfcb0b647388de30341613c992ca Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Thu, 7 Jan 2021 02:19:15 -0800 Subject: [PATCH 04/20] cirrus/msys2: Exit powershell with $LastExitCode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently if we don't exit with $LastExitCode manually, the cirrus would not report the build/testing failure. Signed-off-by: Yonggang Luo Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20210107101919.80-2-luoyonggang@gmail.com> Signed-off-by: Paolo Bonzini --- .cirrus.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.cirrus.yml b/.cirrus.yml index 3907e036da..68b8a8fa9c 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -137,5 +137,7 @@ windows_msys2_task: - C:\tools\msys64\usr\bin\bash.exe -lc "mkdir build" - C:\tools\msys64\usr\bin\bash.exe -lc "cd build && ../configure --python=python3" - C:\tools\msys64\usr\bin\bash.exe -lc "cd build && make -j8" + - exit $LastExitCode test_script: - C:\tools\msys64\usr\bin\bash.exe -lc "cd build && make V=1 check" + - exit $LastExitCode From 29c7ac489f8bf0619f2c25e1459994f6a5a38afe Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Thu, 7 Jan 2021 02:19:16 -0800 Subject: [PATCH 05/20] cirrus/msys2: Cache msys2 mingw in a better way. Signed-off-by: Yonggang Luo Message-Id: <20210107101919.80-3-luoyonggang@gmail.com> Signed-off-by: Paolo Bonzini --- .cirrus.yml | 117 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 68 insertions(+), 49 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 68b8a8fa9c..bc40a0550d 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -64,23 +64,61 @@ windows_msys2_task: CIRRUS_SHELL: powershell MSYS: winsymlinks:nativestrict MSYSTEM: MINGW64 + MSYS2_URL: https://github.com/msys2/msys2-installer/releases/download/2021-01-05/msys2-base-x86_64-20210105.sfx.exe + MSYS2_FINGERPRINT: 0 + MSYS2_PACKAGES: " + diffutils git grep make pkg-config sed + mingw-w64-x86_64-python + mingw-w64-x86_64-python-sphinx + mingw-w64-x86_64-toolchain + mingw-w64-x86_64-SDL2 + mingw-w64-x86_64-SDL2_image + mingw-w64-x86_64-gtk3 + mingw-w64-x86_64-glib2 + mingw-w64-x86_64-ninja + mingw-w64-x86_64-jemalloc + mingw-w64-x86_64-lzo2 + mingw-w64-x86_64-zstd + mingw-w64-x86_64-libjpeg-turbo + mingw-w64-x86_64-pixman + mingw-w64-x86_64-libgcrypt + mingw-w64-x86_64-libpng + mingw-w64-x86_64-libssh + mingw-w64-x86_64-libxml2 + mingw-w64-x86_64-snappy + mingw-w64-x86_64-libusb + mingw-w64-x86_64-usbredir + mingw-w64-x86_64-libtasn1 + mingw-w64-x86_64-nettle + mingw-w64-x86_64-cyrus-sasl + mingw-w64-x86_64-curl + mingw-w64-x86_64-gnutls + mingw-w64-x86_64-libnfs + " CHERE_INVOKING: 1 - setup_script: - - choco install -y --no-progress 7zip - - Write-Output $env:PATH msys2_cache: folder: C:\tools\archive reupload_on_changes: false - fingerprint_script: cat .cirrus.yml + # These env variables are used to generate fingerprint to trigger the cache procedure + # If wanna to force re-populate msys2, increase MSYS2_FINGERPRINT + fingerprint_script: + - | + echo $env:CIRRUS_TASK_NAME + echo $env:MSYS2_URL + echo $env:MSYS2_FINGERPRINT + echo $env:MSYS2_PACKAGES populate_script: - | - md C:\tools - md C:\tools\archive + md -Force C:\tools\archive\pkg $start_time = Get-Date + bitsadmin /transfer msys_download /dynamic /download /priority FOREGROUND $env:MSYS2_URL C:\tools\archive\base.exe + Write-Output "Download time taken: $((Get-Date).Subtract($start_time))" cd C:\tools - bitsadmin /transfer msys_download /dynamic /download /priority FOREGROUND https://github.com/msys2/msys2-installer/releases/download/2020-09-03/msys2-base-x86_64-20200903.sfx.exe C:\tools\base.exe - Write-Output "Download time taken: $((Get-Date).Subtract($start_time).Seconds) second(s)" - C:\tools\base.exe -y + C:\tools\archive\base.exe -y + del -Force C:\tools\archive\base.exe + Write-Output "Base install time taken: $((Get-Date).Subtract($start_time))" + $start_time = Get-Date + ((Get-Content -path C:\tools\msys64\etc\\post-install\\07-pacman-key.post -Raw) -replace '--refresh-keys', '--version') | Set-Content -Path C:\tools\msys64\etc\\post-install\\07-pacman-key.post C:\tools\msys64\usr\bin\bash.exe -lc "sed -i 's/^CheckSpace/#CheckSpace/g' /etc/pacman.conf" C:\tools\msys64\usr\bin\bash.exe -lc "export" @@ -90,49 +128,30 @@ windows_msys2_task: tasklist C:\tools\msys64\usr\bin\bash.exe -lc "mv -f /etc/pacman.conf.pacnew /etc/pacman.conf || true" C:\tools\msys64\usr\bin\bash.exe -lc "pacman --noconfirm -Suu --overwrite=*" - C:\tools\msys64\usr\bin\bash.exe -lc "pacman --noconfirm -S --needed \ - diffutils git grep make pkg-config sed \ - mingw-w64-x86_64-python \ - mingw-w64-x86_64-toolchain \ - mingw-w64-x86_64-SDL2 \ - mingw-w64-x86_64-SDL2_image \ - mingw-w64-x86_64-gtk3 \ - mingw-w64-x86_64-glib2 \ - mingw-w64-x86_64-ninja \ - mingw-w64-x86_64-jemalloc \ - mingw-w64-x86_64-lzo2 \ - mingw-w64-x86_64-zstd \ - mingw-w64-x86_64-libjpeg-turbo \ - mingw-w64-x86_64-pixman \ - mingw-w64-x86_64-libgcrypt \ - mingw-w64-x86_64-libpng \ - mingw-w64-x86_64-libssh \ - mingw-w64-x86_64-libxml2 \ - mingw-w64-x86_64-snappy \ - mingw-w64-x86_64-libusb \ - mingw-w64-x86_64-usbredir \ - mingw-w64-x86_64-libtasn1 \ - mingw-w64-x86_64-nettle \ - mingw-w64-x86_64-cyrus-sasl \ - mingw-w64-x86_64-curl \ - mingw-w64-x86_64-gnutls \ - mingw-w64-x86_64-libnfs \ - " - bitsadmin /transfer msys_download /dynamic /download /priority FOREGROUND ` - https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-python-sphinx-2.3.1-1-any.pkg.tar.xz ` - C:\tools\mingw-w64-x86_64-python-sphinx-2.3.1-1-any.pkg.tar.xz - C:\tools\msys64\usr\bin\bash.exe -lc "pacman --noconfirm -U /c/tools/mingw-w64-x86_64-python-sphinx-2.3.1-1-any.pkg.tar.xz" - del C:\tools\mingw-w64-x86_64-python-sphinx-2.3.1-1-any.pkg.tar.xz - C:\tools\msys64\usr\bin\bash.exe -lc "rm -rf /var/cache/pacman/pkg/*" - cd C:\tools\msys64 - echo "Start archive" - cmd /C "7z a -ttar . -so | 7z a -txz -simsys2-x86_64.tar C:\tools\archive\msys2-x86_64.tar.xz" + Write-Output "Core install time taken: $((Get-Date).Subtract($start_time))" + $start_time = Get-Date + + C:\tools\msys64\usr\bin\bash.exe -lc "pacman --noconfirm -S --needed $env:MSYS2_PACKAGES" + Write-Output "Package install time taken: $((Get-Date).Subtract($start_time))" + $start_time = Get-Date + + del -Force -ErrorAction SilentlyContinue C:\tools\msys64\etc\mtab + del -Force -ErrorAction SilentlyContinue C:\tools\msys64\dev\fd + del -Force -ErrorAction SilentlyContinue C:\tools\msys64\dev\stderr + del -Force -ErrorAction SilentlyContinue C:\tools\msys64\dev\stdin + del -Force -ErrorAction SilentlyContinue C:\tools\msys64\dev\stdout + del -Force -Recurse -ErrorAction SilentlyContinue C:\tools\msys64\var\cache\pacman\pkg + tar cf C:\tools\archive\msys64.tar -C C:\tools\ msys64 + + Write-Output "Package archive time taken: $((Get-Date).Subtract($start_time))" + del -Force -Recurse -ErrorAction SilentlyContinue c:\tools\msys64 install_script: - | + $start_time = Get-Date cd C:\tools - cmd /C "7z x C:\tools\archive\msys2-x86_64.tar.xz -so | 7z x -aoa -simsys2-x86_64.tar -ttar -omsys64" - C:\tools\msys64\usr\bin\bash.exe -lc "export" - + ls C:\tools\archive\msys64.tar + tar xf C:\tools\archive\msys64.tar + Write-Output "Extract msys2 time taken: $((Get-Date).Subtract($start_time))" script: - C:\tools\msys64\usr\bin\bash.exe -lc "mkdir build" - C:\tools\msys64\usr\bin\bash.exe -lc "cd build && ../configure --python=python3" From daee8de314fba4eaf1a9044602ce97ea7882f9b6 Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Thu, 7 Jan 2021 02:19:17 -0800 Subject: [PATCH 06/20] maintainers: Add me as Windows Hosted Continuous Integration maintainer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Yonggang Luo Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20210107101919.80-4-luoyonggang@gmail.com> Signed-off-by: Paolo Bonzini --- MAINTAINERS | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 4be087b88e..4d9df874a1 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3198,6 +3198,12 @@ S: Maintained F: .cirrus.yml W: https://cirrus-ci.com/github/qemu/qemu +Windows Hosted Continuous Integration +M: Yonggang Luo +S: Maintained +F: .cirrus.yml +W: https://cirrus-ci.com/github/qemu/qemu + GitLab Continuous Integration M: Thomas Huth M: Philippe Mathieu-Daudé From 9a46d044d86885e3301a5b5d62b744e8e2114a01 Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Thu, 7 Jan 2021 02:19:19 -0800 Subject: [PATCH 07/20] whpx: move whpx_lapic_state from header to c file This struct only used in whpx-apic.c, there is no need expose it in whpx.h. Signed-off-by: Yonggang Luo Message-Id: <20210107101919.80-6-luoyonggang@gmail.com> Signed-off-by: Paolo Bonzini --- target/i386/whpx/whpx-apic.c | 7 +++++++ target/i386/whpx/whpx-internal.h | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/target/i386/whpx/whpx-apic.c b/target/i386/whpx/whpx-apic.c index 1d330bf749..bba36f3ec9 100644 --- a/target/i386/whpx/whpx-apic.c +++ b/target/i386/whpx/whpx-apic.c @@ -20,6 +20,13 @@ #include "sysemu/whpx.h" #include "whpx-internal.h" +struct whpx_lapic_state { + struct { + uint32_t data; + uint32_t padding[3]; + } fields[256]; +}; + static void whpx_put_apic_state(APICCommonState *s, struct whpx_lapic_state *kapic) { diff --git a/target/i386/whpx/whpx-internal.h b/target/i386/whpx/whpx-internal.h index 8cfaaef141..908ababf6d 100644 --- a/target/i386/whpx/whpx-internal.h +++ b/target/i386/whpx/whpx-internal.h @@ -13,13 +13,6 @@ struct whpx_state { bool apic_in_platform; }; -struct whpx_lapic_state { - struct { - uint32_t data; - uint32_t padding[3]; - } fields[256]; -}; - extern struct whpx_state whpx_global; void whpx_apic_get(DeviceState *s); From cb7abd8319d19000b57ae6c5c474c2635db054c6 Mon Sep 17 00:00:00 2001 From: Chris Hofstaedtler Date: Wed, 30 Dec 2020 23:16:23 +0100 Subject: [PATCH 08/20] meson: fix Cocoa option in summary MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cocoa support was always shown as "no", even it if was enabled. Fixes: b4e312e953b ("configure: move cocoa option to Meson") Cc: Paolo Bonzini Cc: Peter Maydell Cc: Philippe Mathieu-Daudé Signed-off-by: Chris Hofstaedtler Message-Id: <20201230221623.60423-1-chris@hofstaedtler.name> Signed-off-by: Paolo Bonzini --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index e4db67ccf2..bd4ff3118b 100644 --- a/meson.build +++ b/meson.build @@ -2330,7 +2330,7 @@ summary_info += {'profiler': config_host.has_key('CONFIG_PROFILER')} summary_info += {'link-time optimization (LTO)': get_option('b_lto')} summary_info += {'static build': config_host.has_key('CONFIG_STATIC')} if targetos == 'darwin' - summary_info += {'Cocoa support': config_host.has_key('CONFIG_COCOA')} + summary_info += {'Cocoa support': cocoa.found()} endif # TODO: add back version summary_info += {'SDL support': sdl.found()} From 4cbf8efc5b894f9dd86867d7e3de8e8f190618c4 Mon Sep 17 00:00:00 2001 From: Maxim Levitsky Date: Thu, 17 Dec 2020 17:54:35 +0200 Subject: [PATCH 09/20] scripts/gdb: fix 'qemu coroutine' when users selects a non topmost stack frame The code that dumps the stack frame works like that: * save current registers * overwrite current registers (including rip/rsp) with coroutine snapshot in the jmpbuf * print backtrace * restore the saved registers. If the user has currently selected a non topmost stack frame in gdb, the above code will still restore the selected frame registers, but the gdb will then lose the selected frame index, which makes it impossible to switch back to frame 0, to continue debugging the executable. Therefore switch temporarily to the topmost frame of the stack for the above code. Signed-off-by: Maxim Levitsky Message-Id: <20201217155436.927320-2-mlevitsk@redhat.com> Signed-off-by: Paolo Bonzini --- scripts/qemugdb/coroutine.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/qemugdb/coroutine.py b/scripts/qemugdb/coroutine.py index db61389022..e1399211e6 100644 --- a/scripts/qemugdb/coroutine.py +++ b/scripts/qemugdb/coroutine.py @@ -70,6 +70,11 @@ def bt_jmpbuf(jmpbuf): regs = get_jmpbuf_regs(jmpbuf) old = dict() + # remember current stack frame and select the topmost + # so that register modifications don't wreck it + selected_frame = gdb.selected_frame() + gdb.newest_frame().select() + for i in regs: old[i] = gdb.parse_and_eval('(uint64_t)$%s' % i) @@ -81,6 +86,8 @@ def bt_jmpbuf(jmpbuf): for i in regs: gdb.execute('set $%s = %s' % (i, old[i])) + selected_frame.select() + def coroutine_to_jmpbuf(co): coroutine_pointer = co.cast(gdb.lookup_type('CoroutineUContext').pointer()) return coroutine_pointer['env']['__jmpbuf'] From b9a0de3773ff2cae858434d44ef04ee257025c76 Mon Sep 17 00:00:00 2001 From: Maxim Levitsky Date: Thu, 17 Dec 2020 17:54:36 +0200 Subject: [PATCH 10/20] scripts/gdb: implement 'qemu bt' This script first runs the regular gdb's 'bt' command, and then if we are in a coroutine it prints the coroutines backtraces in the order in which they were called. Signed-off-by: Maxim Levitsky Message-Id: <20201217155436.927320-3-mlevitsk@redhat.com> Signed-off-by: Paolo Bonzini --- scripts/qemu-gdb.py | 1 + scripts/qemugdb/coroutine.py | 28 +++++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/scripts/qemu-gdb.py b/scripts/qemu-gdb.py index e0bfa7b5a4..4d2a9f6c43 100644 --- a/scripts/qemu-gdb.py +++ b/scripts/qemu-gdb.py @@ -40,6 +40,7 @@ timers.TimersCommand() coroutine.CoroutineSPFunction() coroutine.CoroutinePCFunction() +coroutine.CoroutineBt() # Default to silently passing through SIGUSR1, because QEMU sends it # to itself a lot. diff --git a/scripts/qemugdb/coroutine.py b/scripts/qemugdb/coroutine.py index e1399211e6..7db46d4b68 100644 --- a/scripts/qemugdb/coroutine.py +++ b/scripts/qemugdb/coroutine.py @@ -88,8 +88,11 @@ def bt_jmpbuf(jmpbuf): selected_frame.select() +def co_cast(co): + return co.cast(gdb.lookup_type('CoroutineUContext').pointer()) + def coroutine_to_jmpbuf(co): - coroutine_pointer = co.cast(gdb.lookup_type('CoroutineUContext').pointer()) + coroutine_pointer = co_cast(co) return coroutine_pointer['env']['__jmpbuf'] @@ -107,6 +110,29 @@ class CoroutineCommand(gdb.Command): bt_jmpbuf(coroutine_to_jmpbuf(gdb.parse_and_eval(argv[0]))) +class CoroutineBt(gdb.Command): + '''Display backtrace including coroutine switches''' + def __init__(self): + gdb.Command.__init__(self, 'qemu bt', gdb.COMMAND_STACK, + gdb.COMPLETE_NONE) + + def invoke(self, arg, from_tty): + + gdb.execute("bt") + + if gdb.parse_and_eval("qemu_in_coroutine()") == False: + return + + co_ptr = gdb.parse_and_eval("qemu_coroutine_self()") + + while True: + co = co_cast(co_ptr) + co_ptr = co["base"]["caller"] + if co_ptr == 0: + break + gdb.write("Coroutine at " + str(co_ptr) + ":\n") + bt_jmpbuf(coroutine_to_jmpbuf(co_ptr)) + class CoroutineSPFunction(gdb.Function): def __init__(self): gdb.Function.__init__(self, 'qemu_coroutine_sp') From d533d6359b8015e2207bb7ca86330da2ef9c3ef8 Mon Sep 17 00:00:00 2001 From: Keqian Zhu Date: Wed, 6 Jan 2021 15:17:10 +0800 Subject: [PATCH 11/20] Docs/RCU: Correct sample code of qatomic_rcu_set Correct sample code to avoid confusing readers. Signed-off-by: Keqian Zhu Cc: qemu-trivial@nongnu.org Reviewed-by: Paolo Bonzini Reviewed-by: Peter Xu Message-Id: <20210106071710.15836-1-zhukeqian1@huawei.com> Signed-off-by: Paolo Bonzini --- docs/devel/rcu.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/devel/rcu.txt b/docs/devel/rcu.txt index cdf002edd8..2e6cc607a1 100644 --- a/docs/devel/rcu.txt +++ b/docs/devel/rcu.txt @@ -392,7 +392,7 @@ Instead, we store the size of the array with the array itself: /* Removal phase. */ old_array = global_array; - qatomic_rcu_set(&new_array->data, new_array); + qatomic_rcu_set(&global_array, new_array); synchronize_rcu(); /* Reclamation phase. */ From 3eacf70bb5a83e4775ad8003cbca63a40f70c8c2 Mon Sep 17 00:00:00 2001 From: Roman Bolshakov Date: Sat, 2 Jan 2021 15:52:13 +0300 Subject: [PATCH 12/20] meson: Propagate gnutls dependency crypto/tlscreds.h includes GnuTLS headers if CONFIG_GNUTLS is set, but GNUTLS_CFLAGS, that describe include path, are not propagated transitively to all users of crypto and build fails if GnuTLS headers reside in non-standard directory (which is a case for homebrew on Apple Silicon). Signed-off-by: Roman Bolshakov Message-Id: <20210102125213.41279-1-r.bolshakov@yadro.com> Signed-off-by: Paolo Bonzini --- block/meson.build | 2 +- io/meson.build | 2 +- meson.build | 5 +++-- storage-daemon/meson.build | 2 +- tests/meson.build | 6 +++--- ui/meson.build | 2 +- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/block/meson.build b/block/meson.build index d44c92ab04..eeaefe5809 100644 --- a/block/meson.build +++ b/block/meson.build @@ -40,7 +40,7 @@ block_ss.add(files( 'vmdk.c', 'vpc.c', 'write-threshold.c', -), zstd, zlib) +), zstd, zlib, gnutls) softmmu_ss.add(when: 'CONFIG_TCG', if_true: files('blkreplay.c')) diff --git a/io/meson.build b/io/meson.build index bcd8b1e737..bbcd3c53a4 100644 --- a/io/meson.build +++ b/io/meson.build @@ -12,4 +12,4 @@ io_ss.add(files( 'dns-resolver.c', 'net-listener.c', 'task.c', -)) +), gnutls) diff --git a/meson.build b/meson.build index bd4ff3118b..5e95dd6c93 100644 --- a/meson.build +++ b/meson.build @@ -1814,7 +1814,7 @@ blockdev_ss.add(files( 'blockdev-nbd.c', 'iothread.c', 'job-qmp.c', -)) +), gnutls) # os-posix.c contains POSIX-specific functions used by qemu-storage-daemon, # os-win32.c does not @@ -1970,6 +1970,7 @@ qmp = declare_dependency(link_whole: [libqmp]) libchardev = static_library('chardev', chardev_ss.sources() + genh, name_suffix: 'fa', + dependencies: [gnutls], build_by_default: false) chardev = declare_dependency(link_whole: libchardev) @@ -2188,7 +2189,7 @@ if have_tools qemu_io = executable('qemu-io', files('qemu-io.c'), dependencies: [block, qemuutil], install: true) qemu_nbd = executable('qemu-nbd', files('qemu-nbd.c'), - dependencies: [blockdev, qemuutil], install: true) + dependencies: [blockdev, qemuutil, gnutls], install: true) subdir('storage-daemon') subdir('contrib/rdmacm-mux') diff --git a/storage-daemon/meson.build b/storage-daemon/meson.build index c5adce81c3..68852f3d25 100644 --- a/storage-daemon/meson.build +++ b/storage-daemon/meson.build @@ -1,6 +1,6 @@ qsd_ss = ss.source_set() qsd_ss.add(files('qemu-storage-daemon.c')) -qsd_ss.add(blockdev, chardev, qmp, qom, qemuutil) +qsd_ss.add(blockdev, chardev, qmp, qom, qemuutil, gnutls) subdir('qapi') diff --git a/tests/meson.build b/tests/meson.build index 1fa068f27b..29ebaba48d 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -159,11 +159,11 @@ if have_block 'CONFIG_POSIX' in config_host tests += { 'test-crypto-tlscredsx509': ['crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c', - tasn1, crypto], + tasn1, crypto, gnutls], 'test-crypto-tlssession': ['crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c', 'crypto-tls-psk-helpers.c', - tasn1, crypto], + tasn1, crypto, gnutls], 'test-io-channel-tls': ['io-channel-helpers.c', 'crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c', - tasn1, io, crypto]} + tasn1, io, crypto, gnutls]} endif if 'CONFIG_AUTH_PAM' in config_host tests += {'test-authz-pam': [authz]} diff --git a/ui/meson.build b/ui/meson.build index 013258a01c..e6655c94a6 100644 --- a/ui/meson.build +++ b/ui/meson.build @@ -29,7 +29,7 @@ vnc_ss.add(files( 'vnc-ws.c', 'vnc-jobs.c', )) -vnc_ss.add(zlib, png, jpeg) +vnc_ss.add(zlib, png, jpeg, gnutls) vnc_ss.add(when: sasl, if_true: files('vnc-auth-sasl.c')) softmmu_ss.add_all(when: vnc, if_true: vnc_ss) softmmu_ss.add(when: vnc, if_false: files('vnc-stubs.c')) From eb8cb3d9dcfbcc74ebaabed4ef0d915eeffa4da1 Mon Sep 17 00:00:00 2001 From: Hannes Reinecke Date: Mon, 16 Nov 2020 19:31:12 +0100 Subject: [PATCH 13/20] virtio-scsi: trace events Add trace events for virtio command and response tracing. Signed-off-by: Hannes Reinecke Message-Id: <20201116183114.55703-2-hare@suse.de> Signed-off-by: Paolo Bonzini --- hw/scsi/trace-events | 9 +++++++++ hw/scsi/virtio-scsi.c | 30 +++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/hw/scsi/trace-events b/hw/scsi/trace-events index 9a4a60ca63..0e0aa9847d 100644 --- a/hw/scsi/trace-events +++ b/hw/scsi/trace-events @@ -294,6 +294,15 @@ lsi_awoken(void) "Woken by SIGP" lsi_reg_read(const char *name, int offset, uint8_t ret) "Read reg %s 0x%x = 0x%02x" lsi_reg_write(const char *name, int offset, uint8_t val) "Write reg %s 0x%x = 0x%02x" +# virtio-scsi.c +virtio_scsi_cmd_req(int lun, uint32_t tag, uint8_t cmd) "virtio_scsi_cmd_req lun=%u tag=0x%x cmd=0x%x" +virtio_scsi_cmd_resp(int lun, uint32_t tag, int response, uint8_t status) "virtio_scsi_cmd_resp lun=%u tag=0x%x response=%d status=0x%x" +virtio_scsi_tmf_req(int lun, uint32_t tag, int subtype) "virtio_scsi_tmf_req lun=%u tag=0x%x subtype=%d" +virtio_scsi_tmf_resp(int lun, uint32_t tag, int response) "virtio_scsi_tmf_resp lun=%u tag=0x%x response=%d" +virtio_scsi_an_req(int lun, uint32_t event_requested) "virtio_scsi_an_req lun=%u event_requested=0x%x" +virtio_scsi_an_resp(int lun, int response) "virtio_scsi_an_resp lun=%u response=%d" +virtio_scsi_event(int lun, int event, int reason) "virtio_scsi_event lun=%u event=%d reason=%d" + # scsi-disk.c scsi_disk_check_condition(uint32_t tag, uint8_t key, uint8_t asc, uint8_t ascq) "Command complete tag=0x%x sense=%d/%d/%d" scsi_disk_read_complete(uint32_t tag, size_t size) "Data ready tag=0x%x len=%zd" diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c index 3db9a8aae9..9690bc63c8 100644 --- a/hw/scsi/virtio-scsi.c +++ b/hw/scsi/virtio-scsi.c @@ -27,6 +27,7 @@ #include "scsi/constants.h" #include "hw/virtio/virtio-bus.h" #include "hw/virtio/virtio-access.h" +#include "trace.h" static inline int virtio_scsi_get_lun(uint8_t *lun) { @@ -239,7 +240,11 @@ static void virtio_scsi_cancel_notify(Notifier *notifier, void *data) notifier); if (--n->tmf_req->remaining == 0) { - virtio_scsi_complete_req(n->tmf_req); + VirtIOSCSIReq *req = n->tmf_req; + + trace_virtio_scsi_tmf_resp(virtio_scsi_get_lun(req->req.tmf.lun), + req->req.tmf.tag, req->resp.tmf.response); + virtio_scsi_complete_req(req); } g_free(n); } @@ -273,6 +278,9 @@ static int virtio_scsi_do_tmf(VirtIOSCSI *s, VirtIOSCSIReq *req) req->req.tmf.subtype = virtio_tswap32(VIRTIO_DEVICE(s), req->req.tmf.subtype); + trace_virtio_scsi_tmf_req(virtio_scsi_get_lun(req->req.tmf.lun), + req->req.tmf.tag, req->req.tmf.subtype); + switch (req->req.tmf.subtype) { case VIRTIO_SCSI_T_TMF_ABORT_TASK: case VIRTIO_SCSI_T_TMF_QUERY_TASK: @@ -429,11 +437,23 @@ static void virtio_scsi_handle_ctrl_req(VirtIOSCSI *s, VirtIOSCSIReq *req) virtio_scsi_bad_req(req); return; } else { + req->req.an.event_requested = + virtio_tswap32(VIRTIO_DEVICE(s), req->req.an.event_requested); + trace_virtio_scsi_an_req(virtio_scsi_get_lun(req->req.an.lun), + req->req.an.event_requested); req->resp.an.event_actual = 0; req->resp.an.response = VIRTIO_SCSI_S_OK; } } if (r == 0) { + if (type == VIRTIO_SCSI_T_TMF) + trace_virtio_scsi_tmf_resp(virtio_scsi_get_lun(req->req.tmf.lun), + req->req.tmf.tag, + req->resp.tmf.response); + else if (type == VIRTIO_SCSI_T_AN_QUERY || + type == VIRTIO_SCSI_T_AN_SUBSCRIBE) + trace_virtio_scsi_an_resp(virtio_scsi_get_lun(req->req.an.lun), + req->resp.an.response); virtio_scsi_complete_req(req); } else { assert(r == -EINPROGRESS); @@ -469,6 +489,10 @@ static void virtio_scsi_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq) static void virtio_scsi_complete_cmd_req(VirtIOSCSIReq *req) { + trace_virtio_scsi_cmd_resp(virtio_scsi_get_lun(req->req.cmd.lun), + req->req.cmd.tag, + req->resp.cmd.response, + req->resp.cmd.status); /* Sense data is not in req->resp and is copied separately * in virtio_scsi_command_complete. */ @@ -566,6 +590,8 @@ static int virtio_scsi_handle_cmd_req_prepare(VirtIOSCSI *s, VirtIOSCSIReq *req) return -EINVAL; } } + trace_virtio_scsi_cmd_req(virtio_scsi_get_lun(req->req.cmd.lun), + req->req.cmd.tag, req->req.cmd.cdb[0]); d = virtio_scsi_device_get(s, req->req.cmd.lun); if (!d) { @@ -767,6 +793,8 @@ void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev, } evt->lun[3] = dev->lun & 0xFF; } + trace_virtio_scsi_event(virtio_scsi_get_lun(evt->lun), event, reason); + virtio_scsi_complete_req(req); } From a23a6789c0a1187bfb2e117c9cdfb92f6fa357f0 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 7 Jan 2021 13:32:12 +0100 Subject: [PATCH 14/20] cocoa: do not enable coreaudio automatically Remove the automagic connection between --enable-cocoa and enabling coreaudio in audio_drv_list. It can be overridden anyway just by placing --enable-cocoa before --audio-drv-list. Signed-off-by: Paolo Bonzini --- configure | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/configure b/configure index 5860bdb77b..10f43d59fe 100755 --- a/configure +++ b/configure @@ -1149,9 +1149,7 @@ for opt do ;; --disable-cocoa) cocoa="disabled" ;; - --enable-cocoa) - cocoa="enabled" ; - audio_drv_list="coreaudio $(echo $audio_drv_list | sed s,coreaudio,,g)" + --enable-cocoa) cocoa="enabled" ;; --disable-system) softmmu="no" ;; From 5cb69566daa8081abb82a13403dcc0fffed02007 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 7 Jan 2021 13:46:32 +0100 Subject: [PATCH 15/20] gtk: remove CONFIG_GTK_GL CONFIG_GTK_GL is defined if OpenGL is present and GTK+ is 3.16 or newer. Since GTK+ 3.22 is the minimum supported version, just use CONFIG_OPENGL instead. Signed-off-by: Paolo Bonzini --- configure | 7 ------- meson.build | 1 - ui/gtk.c | 16 ++++++++-------- ui/meson.build | 3 +-- 4 files changed, 9 insertions(+), 18 deletions(-) diff --git a/configure b/configure index 10f43d59fe..f3877c2efd 100755 --- a/configure +++ b/configure @@ -415,7 +415,6 @@ cfi_debug="false" seccomp="auto" glusterfs="auto" gtk="$default_feature" -gtk_gl="no" tls_priority="NORMAL" gnutls="$default_feature" nettle="$default_feature" @@ -3626,9 +3625,6 @@ if test "$opengl" != "no" ; then opengl_cflags="$($pkg_config --cflags $opengl_pkgs)" opengl_libs="$($pkg_config --libs $opengl_pkgs)" opengl=yes - if test "$gtk" = "yes" && $pkg_config --exists "$gtkpackage >= 3.16"; then - gtk_gl="yes" - fi else if test "$opengl" = "yes" ; then feature_not_found "opengl" "Please install opengl (mesa) devel pkgs: $opengl_pkgs" @@ -5781,9 +5777,6 @@ if test "$gtk" = "yes" ; then echo "CONFIG_GTK=y" >> $config_host_mak echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak echo "GTK_LIBS=$gtk_libs" >> $config_host_mak - if test "$gtk_gl" = "yes" ; then - echo "CONFIG_GTK_GL=y" >> $config_host_mak - fi fi if test "$gio" = "yes" ; then echo "CONFIG_GIO=y" >> $config_host_mak diff --git a/meson.build b/meson.build index 5e95dd6c93..98930bca38 100644 --- a/meson.build +++ b/meson.build @@ -2338,7 +2338,6 @@ summary_info += {'SDL support': sdl.found()} summary_info += {'SDL image support': sdl_image.found()} # TODO: add back version summary_info += {'GTK support': config_host.has_key('CONFIG_GTK')} -summary_info += {'GTK GL support': config_host.has_key('CONFIG_GTK_GL')} summary_info += {'pixman': pixman.found()} # TODO: add back version summary_info += {'VTE support': config_host.has_key('CONFIG_VTE')} diff --git a/ui/gtk.c b/ui/gtk.c index a752aa22be..e8474456df 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -396,7 +396,7 @@ static void gd_update_full_redraw(VirtualConsole *vc) int ww, wh; ww = gdk_window_get_width(gtk_widget_get_window(area)); wh = gdk_window_get_height(gtk_widget_get_window(area)); -#if defined(CONFIG_GTK_GL) +#if defined(CONFIG_OPENGL) if (vc->gfx.gls && gtk_use_gl_area) { gtk_gl_area_queue_render(GTK_GL_AREA(vc->gfx.drawing_area)); return; @@ -625,7 +625,7 @@ static const DisplayChangeListenerOps dcl_ops = { /** DisplayState Callbacks (opengl version) **/ -#if defined(CONFIG_GTK_GL) +#if defined(CONFIG_OPENGL) static const DisplayChangeListenerOps dcl_gl_area_ops = { .dpy_name = "gtk-egl", @@ -644,7 +644,7 @@ static const DisplayChangeListenerOps dcl_gl_area_ops = { .dpy_gl_update = gd_gl_area_scanout_flush, }; -#endif /* CONFIG_GTK_GL */ +#endif /* CONFIG_OPENGL */ static const DisplayChangeListenerOps dcl_egl_ops = { .dpy_name = "gtk-egl", @@ -725,7 +725,7 @@ static void gd_set_ui_info(VirtualConsole *vc, gint width, gint height) dpy_set_ui_info(vc->gfx.dcl.con, &info); } -#if defined(CONFIG_GTK_GL) +#if defined(CONFIG_OPENGL) static gboolean gd_render_event(GtkGLArea *area, GdkGLContext *context, void *opaque) @@ -1865,7 +1865,7 @@ static void gd_connect_vc_gfx_signals(VirtualConsole *vc) { g_signal_connect(vc->gfx.drawing_area, "draw", G_CALLBACK(gd_draw_event), vc); -#if defined(CONFIG_GTK_GL) +#if defined(CONFIG_OPENGL) if (gtk_use_gl_area) { /* wire up GtkGlArea events */ g_signal_connect(vc->gfx.drawing_area, "render", @@ -1992,12 +1992,12 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s, VirtualConsole *vc, #if defined(CONFIG_OPENGL) if (display_opengl) { -#if defined(CONFIG_GTK_GL) +#if defined(CONFIG_OPENGL) if (gtk_use_gl_area) { vc->gfx.drawing_area = gtk_gl_area_new(); vc->gfx.dcl.ops = &dcl_gl_area_ops; } else -#endif /* CONFIG_GTK_GL */ +#endif /* CONFIG_OPENGL */ { vc->gfx.drawing_area = gtk_drawing_area_new(); /* @@ -2314,7 +2314,7 @@ static void early_gtk_display_init(DisplayOptions *opts) assert(opts->type == DISPLAY_TYPE_GTK); if (opts->has_gl && opts->gl != DISPLAYGL_MODE_OFF) { #if defined(CONFIG_OPENGL) -#if defined(CONFIG_GTK_GL) && defined(GDK_WINDOWING_WAYLAND) +#if defined(GDK_WINDOWING_WAYLAND) if (GDK_IS_WAYLAND_DISPLAY(gdk_display_get_default())) { gtk_use_gl_area = true; gtk_gl_area_init(); diff --git a/ui/meson.build b/ui/meson.build index e6655c94a6..bd2b920504 100644 --- a/ui/meson.build +++ b/ui/meson.build @@ -63,8 +63,7 @@ if config_host.has_key('CONFIG_GTK') gtk_ss = ss.source_set() gtk_ss.add(gtk, vte, pixman, files('gtk.c')) gtk_ss.add(when: [x11, 'CONFIG_X11'], if_true: files('x_keymap.c')) - gtk_ss.add(when: [opengl, 'CONFIG_OPENGL'], if_true: files('gtk-egl.c')) - gtk_ss.add(when: [opengl, 'CONFIG_GTK_GL'], if_true: files('gtk-gl-area.c')) + gtk_ss.add(when: [opengl, 'CONFIG_OPENGL'], if_true: files('gtk-egl.c', 'gtk-gl-area.c')) ui_modules += {'gtk' : gtk_ss} endif From 9d71037f4beb203e3fddfe78ac9d79ef34999796 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 7 Jan 2021 13:54:22 +0100 Subject: [PATCH 16/20] configure: move X11 detection to Meson For now move the logic verbatim. GTK+ actually has a hard requirement on X11 if gtk+x11 is present, but we will sort that out later. Signed-off-by: Paolo Bonzini --- configure | 14 ++------------ meson.build | 9 +++++---- ui/meson.build | 4 ++-- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/configure b/configure index f3877c2efd..ec0639387d 100755 --- a/configure +++ b/configure @@ -2759,14 +2759,6 @@ EOF fi fi -########################################## -# X11 probe -if $pkg_config --exists "x11"; then - have_x11=yes - x11_cflags=$($pkg_config --cflags x11) - x11_libs=$($pkg_config --libs x11) -fi - ########################################## # GTK probe @@ -5681,10 +5673,8 @@ fi if test "$module_upgrades" = "yes"; then echo "CONFIG_MODULE_UPGRADES=y" >> $config_host_mak fi -if test "$have_x11" = "yes" && test "$need_x11" = "yes"; then - echo "CONFIG_X11=y" >> $config_host_mak - echo "X11_CFLAGS=$x11_cflags" >> $config_host_mak - echo "X11_LIBS=$x11_libs" >> $config_host_mak +if test "$need_x11" = "yes"; then + echo "CONFIG_NEED_X11=y" >> $config_host_mak fi if test "$pipe2" = "yes" ; then echo "CONFIG_PIPE2=y" >> $config_host_mak diff --git a/meson.build b/meson.build index 98930bca38..e673c1578a 100644 --- a/meson.build +++ b/meson.build @@ -787,9 +787,9 @@ if 'CONFIG_VTE' in config_host link_args: config_host['VTE_LIBS'].split()) endif x11 = not_found -if 'CONFIG_X11' in config_host - x11 = declare_dependency(compile_args: config_host['X11_CFLAGS'].split(), - link_args: config_host['X11_LIBS'].split()) +if config_host.has_key('CONFIG_NEED_X11') + x11 = dependency('x11', method: 'pkg-config', required: false, + static: enable_static) endif vnc = not_found png = not_found @@ -1085,6 +1085,7 @@ config_host_data.set('CONFIG_STATX', has_statx) config_host_data.set('CONFIG_ZSTD', zstd.found()) config_host_data.set('CONFIG_FUSE', fuse.found()) config_host_data.set('CONFIG_FUSE_LSEEK', fuse_lseek.found()) +config_host_data.set('CONFIG_X11', x11.found()) config_host_data.set('CONFIG_CFI', get_option('cfi')) config_host_data.set('QEMU_VERSION', '"@0@"'.format(meson.project_version())) config_host_data.set('QEMU_VERSION_MAJOR', meson.project_version().split('.')[0]) @@ -1171,7 +1172,7 @@ host_kconfig = \ ('CONFIG_SPICE' in config_host ? ['CONFIG_SPICE=y'] : []) + \ ('CONFIG_IVSHMEM' in config_host ? ['CONFIG_IVSHMEM=y'] : []) + \ ('CONFIG_OPENGL' in config_host ? ['CONFIG_OPENGL=y'] : []) + \ - ('CONFIG_X11' in config_host ? ['CONFIG_X11=y'] : []) + \ + (x11.found() ? ['CONFIG_X11=y'] : []) + \ ('CONFIG_VHOST_USER' in config_host ? ['CONFIG_VHOST_USER=y'] : []) + \ ('CONFIG_VHOST_VDPA' in config_host ? ['CONFIG_VHOST_VDPA=y'] : []) + \ ('CONFIG_VHOST_KERNEL' in config_host ? ['CONFIG_VHOST_KERNEL=y'] : []) + \ diff --git a/ui/meson.build b/ui/meson.build index bd2b920504..cc764e1bd1 100644 --- a/ui/meson.build +++ b/ui/meson.build @@ -62,7 +62,7 @@ if config_host.has_key('CONFIG_GTK') gtk_ss = ss.source_set() gtk_ss.add(gtk, vte, pixman, files('gtk.c')) - gtk_ss.add(when: [x11, 'CONFIG_X11'], if_true: files('x_keymap.c')) + gtk_ss.add(when: x11, if_true: files('x_keymap.c')) gtk_ss.add(when: [opengl, 'CONFIG_OPENGL'], if_true: files('gtk-egl.c', 'gtk-gl-area.c')) ui_modules += {'gtk' : gtk_ss} endif @@ -77,7 +77,7 @@ if sdl.found() 'sdl2.c', )) sdl_ss.add(when: [opengl, 'CONFIG_OPENGL'], if_true: files('sdl2-gl.c')) - sdl_ss.add(when: [x11, 'CONFIG_X11'], if_true: files('x_keymap.c')) + sdl_ss.add(when: x11, if_true: files('x_keymap.c')) ui_modules += {'sdl' : sdl_ss} endif From 1b6954713fee49452077ebc09a8cf76b18cfe04e Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 7 Jan 2021 14:02:29 +0100 Subject: [PATCH 17/20] configure: move GTK+ detection to Meson This also allows removing CONFIG_NEED_X11, all the ingredients can be computed easily in meson.build. Signed-off-by: Paolo Bonzini --- configure | 55 ++++++----------------------------------------- meson.build | 29 ++++++++++++++++++------- meson_options.txt | 2 ++ ui/meson.build | 2 +- 4 files changed, 30 insertions(+), 58 deletions(-) diff --git a/configure b/configure index ec0639387d..d70448f495 100755 --- a/configure +++ b/configure @@ -414,7 +414,7 @@ cfi="false" cfi_debug="false" seccomp="auto" glusterfs="auto" -gtk="$default_feature" +gtk="auto" tls_priority="NORMAL" gnutls="$default_feature" nettle="$default_feature" @@ -1377,9 +1377,9 @@ for opt do --enable-uuid|--disable-uuid) echo "$0: $opt is obsolete, UUID support is always built" >&2 ;; - --disable-gtk) gtk="no" + --disable-gtk) gtk="disabled" ;; - --enable-gtk) gtk="yes" + --enable-gtk) gtk="enabled" ;; --tls-priority=*) tls_priority="$optarg" ;; @@ -2329,10 +2329,10 @@ if test "$cocoa" = "enabled"; then if test "$sdl" = "enabled"; then error_exit "Cocoa and SDL UIs cannot both be enabled at once" fi - if test "$gtk" = "yes"; then + if test "$gtk" = "enabled"; then error_exit "Cocoa and GTK UIs cannot both be enabled at once" fi - gtk=no + gtk=disabled sdl=disabled fi @@ -2759,31 +2759,6 @@ EOF fi fi -########################################## -# GTK probe - -if test "$gtk" != "no"; then - gtkpackage="gtk+-3.0" - gtkx11package="gtk+-x11-3.0" - gtkversion="3.22.0" - if $pkg_config --exists "$gtkpackage >= $gtkversion"; then - gtk_cflags=$($pkg_config --cflags $gtkpackage) - gtk_libs=$($pkg_config --libs $gtkpackage) - gtk_version=$($pkg_config --modversion $gtkpackage) - if $pkg_config --exists "$gtkx11package >= $gtkversion"; then - need_x11=yes - gtk_cflags="$gtk_cflags $x11_cflags" - gtk_libs="$gtk_libs $x11_libs" - fi - gtk="yes" - elif test "$gtk" = "yes"; then - feature_not_found "gtk" "Install gtk3-devel" - else - gtk="no" - fi -fi - - ########################################## # GNUTLS probe @@ -3640,16 +3615,6 @@ EOF fi fi -if test "$opengl" = "yes" && test "$have_x11" = "yes"; then - for target in $target_list; do - case $target in - lm32-softmmu) # milkymist-tmu2 requires X11 and OpenGL - need_x11=yes - ;; - esac - done -fi - ########################################## # libxml2 probe if test "$libxml2" != "no" ; then @@ -5673,9 +5638,6 @@ fi if test "$module_upgrades" = "yes"; then echo "CONFIG_MODULE_UPGRADES=y" >> $config_host_mak fi -if test "$need_x11" = "yes"; then - echo "CONFIG_NEED_X11=y" >> $config_host_mak -fi if test "$pipe2" = "yes" ; then echo "CONFIG_PIPE2=y" >> $config_host_mak fi @@ -5763,11 +5725,6 @@ fi if test "$bswap_h" = "yes" ; then echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak fi -if test "$gtk" = "yes" ; then - echo "CONFIG_GTK=y" >> $config_host_mak - echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak - echo "GTK_LIBS=$gtk_libs" >> $config_host_mak -fi if test "$gio" = "yes" ; then echo "CONFIG_GIO=y" >> $config_host_mak echo "GIO_CFLAGS=$gio_cflags" >> $config_host_mak @@ -6501,7 +6458,7 @@ NINJA=$ninja $meson setup \ -Dmalloc=$malloc -Dmalloc_trim=$malloc_trim -Dsparse=$sparse \ -Dkvm=$kvm -Dhax=$hax -Dwhpx=$whpx -Dhvf=$hvf \ -Dxen=$xen -Dxen_pci_passthrough=$xen_pci_passthrough -Dtcg=$tcg \ - -Dcocoa=$cocoa -Dmpath=$mpath -Dsdl=$sdl -Dsdl_image=$sdl_image \ + -Dcocoa=$cocoa -Dgtk=$gtk -Dmpath=$mpath -Dsdl=$sdl -Dsdl_image=$sdl_image \ -Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \ -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f -Dvirtiofsd=$virtiofsd \ -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt -Dbrlapi=$brlapi \ diff --git a/meson.build b/meson.build index e673c1578a..73d3cc5385 100644 --- a/meson.build +++ b/meson.build @@ -776,19 +776,31 @@ if 'CONFIG_OPENGL' in config_host opengl = declare_dependency(compile_args: config_host['OPENGL_CFLAGS'].split(), link_args: config_host['OPENGL_LIBS'].split()) endif + gtk = not_found -if 'CONFIG_GTK' in config_host - gtk = declare_dependency(compile_args: config_host['GTK_CFLAGS'].split(), - link_args: config_host['GTK_LIBS'].split()) +gtkx11 = not_found +if not get_option('gtk').auto() or have_system + gtk = dependency('gtk+-3.0', version: '>=3.22.0', + method: 'pkg-config', + required: get_option('gtk'), + static: enable_static) + if gtk.found() + gtkx11 = dependency('gtk+-x11-3.0', version: '>=3.22.0', + method: 'pkg-config', + required: false, + static: enable_static) + gtk = declare_dependency(dependencies: [gtk, gtkx11]) + endif endif + vte = not_found if 'CONFIG_VTE' in config_host vte = declare_dependency(compile_args: config_host['VTE_CFLAGS'].split(), link_args: config_host['VTE_LIBS'].split()) endif x11 = not_found -if config_host.has_key('CONFIG_NEED_X11') - x11 = dependency('x11', method: 'pkg-config', required: false, +if gtkx11.found() or 'lm32-softmmu' in target_dirs + x11 = dependency('x11', method: 'pkg-config', required: gtkx11.found(), static: enable_static) endif vnc = not_found @@ -1062,6 +1074,7 @@ if glusterfs.found() config_host_data.set('CONFIG_GLUSTERFS_FTRUNCATE_HAS_STAT', glusterfs_ftruncate_has_stat) config_host_data.set('CONFIG_GLUSTERFS_IOCB_HAS_STAT', glusterfs_iocb_has_stat) endif +config_host_data.set('CONFIG_GTK', gtk.found()) config_host_data.set('CONFIG_LIBATTR', have_old_libattr) config_host_data.set('CONFIG_LIBCAP_NG', libcap_ng.found()) config_host_data.set('CONFIG_LIBISCSI', libiscsi.found()) @@ -2230,7 +2243,7 @@ subdir('tools') subdir('pc-bios') subdir('docs') subdir('tests') -if 'CONFIG_GTK' in config_host +if gtk.found() subdir('po') endif @@ -2247,7 +2260,7 @@ if host_machine.system() == 'windows' if build_docs nsis_cmd += '-DCONFIG_DOCUMENTATION=y' endif - if 'CONFIG_GTK' in config_host + if gtk.found() nsis_cmd += '-DCONFIG_GTK=y' endif @@ -2338,7 +2351,7 @@ endif summary_info += {'SDL support': sdl.found()} summary_info += {'SDL image support': sdl_image.found()} # TODO: add back version -summary_info += {'GTK support': config_host.has_key('CONFIG_GTK')} +summary_info += {'GTK support': gtk.found()} summary_info += {'pixman': pixman.found()} # TODO: add back version summary_info += {'VTE support': config_host.has_key('CONFIG_VTE')} diff --git a/meson_options.txt b/meson_options.txt index 7948a8255c..72a3ca22d6 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -74,6 +74,8 @@ option('lzo', type : 'feature', value : 'auto', description: 'lzo compression support') option('rbd', type : 'feature', value : 'auto', description: 'Ceph block device driver') +option('gtk', type : 'feature', value : 'auto', + description: 'GTK+ user interface') option('sdl', type : 'feature', value : 'auto', description: 'SDL user interface') option('sdl_image', type : 'feature', value : 'auto', diff --git a/ui/meson.build b/ui/meson.build index cc764e1bd1..634fabab0d 100644 --- a/ui/meson.build +++ b/ui/meson.build @@ -57,7 +57,7 @@ if config_host.has_key('CONFIG_OPENGL_DMABUF') ui_modules += {'egl-headless' : egl_headless_ss} endif -if config_host.has_key('CONFIG_GTK') +if gtk.found() softmmu_ss.add(when: 'CONFIG_WIN32', if_true: files('win32-kbd-hook.c')) gtk_ss = ss.source_set() From c1ec49415c300cc539efdb88bb3f72078fb43c24 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 7 Jan 2021 14:04:00 +0100 Subject: [PATCH 18/20] configure: move Cocoa incompatibility checks to Meson The cocoa UI code currently assumes it is always the active UI and does not interact well with other UI frontend code. Move the relevant checks to Meson now that all other frontends have become Meson options. This way, SDL/GTK+/Cocoa can be parsed entirely by scripts/configure-parse-buildoptions.pl. Signed-off-by: Paolo Bonzini --- configure | 15 --------------- meson.build | 17 ++++++++++------- 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/configure b/configure index d70448f495..17aa595343 100755 --- a/configure +++ b/configure @@ -772,7 +772,6 @@ Darwin) QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS" QEMU_LDFLAGS="-arch x86_64 $QEMU_LDFLAGS" fi - cocoa="enabled" audio_drv_list="coreaudio try-sdl" audio_possible_drivers="coreaudio sdl" QEMU_LDFLAGS="-framework CoreFoundation -framework IOKit $QEMU_LDFLAGS" @@ -2322,20 +2321,6 @@ if test -z "$want_tools"; then fi ########################################## -# cocoa implies not SDL or GTK -# (the cocoa UI code currently assumes it is always the active UI -# and doesn't interact well with other UI frontend code) -if test "$cocoa" = "enabled"; then - if test "$sdl" = "enabled"; then - error_exit "Cocoa and SDL UIs cannot both be enabled at once" - fi - if test "$gtk" = "enabled"; then - error_exit "Cocoa and GTK UIs cannot both be enabled at once" - fi - gtk=disabled - sdl=disabled -fi - # Some versions of Mac OS X incorrectly define SIZE_MAX cat > $TMPC << EOF #include diff --git a/meson.build b/meson.build index 73d3cc5385..1f12c43765 100644 --- a/meson.build +++ b/meson.build @@ -169,7 +169,6 @@ version_res = [] coref = [] iokit = [] emulator_link_args = [] -cocoa = not_found hvf = not_found if targetos == 'windows' socket = cc.find_library('ws2_32') @@ -182,7 +181,6 @@ if targetos == 'windows' elif targetos == 'darwin' coref = dependency('appleframeworks', modules: 'CoreFoundation') iokit = dependency('appleframeworks', modules: 'IOKit') - cocoa = dependency('appleframeworks', modules: 'Cocoa', required: get_option('cocoa')) elif targetos == 'sunos' socket = [cc.find_library('socket'), cc.find_library('nsl'), @@ -256,9 +254,6 @@ if not have_xen_pci_passthrough and get_option('xen_pci_passthrough').enabled() error('Xen PCI passthrough requested but Xen not enabled') endif endif -if not cocoa.found() and get_option('cocoa').enabled() - error('Cocoa not available on this platform') -endif ################ # Dependencies # @@ -362,6 +357,14 @@ if not get_option('attr').disabled() endif endif +cocoa = dependency('appleframeworks', modules: 'Cocoa', required: get_option('cocoa')) +if cocoa.found() and get_option('sdl').enabled() + error('Cocoa and SDL cannot be enabled at the same time') +endif +if cocoa.found() and get_option('gtk').enabled() + error('Cocoa and GTK+ cannot be enabled at the same time') +endif + seccomp = not_found if not get_option('seccomp').auto() or have_system or have_tools seccomp = dependency('libseccomp', version: '>=2.3.0', @@ -647,7 +650,7 @@ if not get_option('brlapi').auto() or have_system endif sdl = not_found -if have_system +if not get_option('sdl').auto() or (have_system and not cocoa.found()) sdl = dependency('sdl2', required: get_option('sdl'), static: enable_static) sdl_image = not_found endif @@ -779,7 +782,7 @@ endif gtk = not_found gtkx11 = not_found -if not get_option('gtk').auto() or have_system +if not get_option('gtk').auto() or (have_system and not cocoa.found()) gtk = dependency('gtk+-3.0', version: '>=3.22.0', method: 'pkg-config', required: get_option('gtk'), From 835af8990c5ef4679a0cc44f0ee2582cfccbfc8d Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 8 Sep 2020 13:20:45 +0200 Subject: [PATCH 19/20] configure: quote command line arguments in config.status Make config.status generation a bit more robust. (The quote_sh function will also be reused to parse configure's command line arguments in an external script driven by Meson build option introspection). Signed-off-by: Paolo Bonzini --- configure | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 17aa595343..155dda124c 100755 --- a/configure +++ b/configure @@ -89,6 +89,10 @@ printf " '%s'" "$0" "$@" >> config.log echo >> config.log echo "#" >> config.log +quote_sh() { + printf "%s" "$1" | sed "s,','\\\\'',g; s,.*,'&'," +} + print_error() { (echo echo "ERROR: $1" @@ -6519,7 +6523,7 @@ preserve_env WINDRES printf "exec" >>config.status for i in "$0" "$@"; do - test "$i" = --skip-meson || printf " '%s'" "$i" >>config.status + test "$i" = --skip-meson || printf " %s" "$(quote_sh "$i")" >>config.status done echo ' "$@"' >>config.status chmod +x config.status From c117e5b11a21598205f1701a15965e825959d59f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Sun, 10 Jan 2021 00:34:27 +0100 Subject: [PATCH 20/20] target/i386: Use X86Seg enum for segment registers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the dedicated X86Seg enum type for segment registers. Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210109233427.749748-1-f4bug@amsat.org> Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/cpu.h | 4 ++-- target/i386/gdbstub.c | 2 +- target/i386/tcg/seg_helper.c | 8 ++++---- target/i386/tcg/translate.c | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/target/i386/cpu.h b/target/i386/cpu.h index af130512e2..d23a5b340a 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1807,7 +1807,7 @@ void cpu_sync_bndcs_hflags(CPUX86State *env); /* this function must always be used to load data in the segment cache: it synchronizes the hflags with the segment cache values */ static inline void cpu_x86_load_seg_cache(CPUX86State *env, - int seg_reg, unsigned int selector, + X86Seg seg_reg, unsigned int selector, target_ulong base, unsigned int limit, unsigned int flags) @@ -1896,7 +1896,7 @@ int cpu_x86_get_descr_debug(CPUX86State *env, unsigned int selector, /* cpu-exec.c */ /* the following helpers are only usable in user mode simulation as they can trigger unexpected exceptions */ -void cpu_x86_load_seg(CPUX86State *s, int seg_reg, int selector); +void cpu_x86_load_seg(CPUX86State *s, X86Seg seg_reg, int selector); void cpu_x86_fsave(CPUX86State *s, target_ulong ptr, int data32); void cpu_x86_frstor(CPUX86State *s, target_ulong ptr, int data32); void cpu_x86_fxsave(CPUX86State *s, target_ulong ptr); diff --git a/target/i386/gdbstub.c b/target/i386/gdbstub.c index 4a3de5f69d..41e265fc67 100644 --- a/target/i386/gdbstub.c +++ b/target/i386/gdbstub.c @@ -232,7 +232,7 @@ int x86_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n) return 0; } -static int x86_cpu_gdb_load_seg(X86CPU *cpu, int sreg, uint8_t *mem_buf) +static int x86_cpu_gdb_load_seg(X86CPU *cpu, X86Seg sreg, uint8_t *mem_buf) { CPUX86State *env = &cpu->env; uint16_t selector = ldl_p(mem_buf); diff --git a/target/i386/tcg/seg_helper.c b/target/i386/tcg/seg_helper.c index 5f2ee6aa7e..180d47f0e9 100644 --- a/target/i386/tcg/seg_helper.c +++ b/target/i386/tcg/seg_helper.c @@ -176,8 +176,8 @@ static inline void get_ss_esp_from_tss(CPUX86State *env, uint32_t *ss_ptr, } } -static void tss_load_seg(CPUX86State *env, int seg_reg, int selector, int cpl, - uintptr_t retaddr) +static void tss_load_seg(CPUX86State *env, X86Seg seg_reg, int selector, + int cpl, uintptr_t retaddr) { uint32_t e1, e2; int rpl, dpl; @@ -2098,7 +2098,7 @@ void helper_iret_real(CPUX86State *env, int shift) env->hflags2 &= ~HF2_NMI_MASK; } -static inline void validate_seg(CPUX86State *env, int seg_reg, int cpl) +static inline void validate_seg(CPUX86State *env, X86Seg seg_reg, int cpl) { int dpl; uint32_t e2; @@ -2623,7 +2623,7 @@ void helper_verw(CPUX86State *env, target_ulong selector1) } #if defined(CONFIG_USER_ONLY) -void cpu_x86_load_seg(CPUX86State *env, int seg_reg, int selector) +void cpu_x86_load_seg(CPUX86State *env, X86Seg seg_reg, int selector) { if (!(env->cr[0] & CR0_PE_MASK) || (env->eflags & VM_MASK)) { int dpl = (env->eflags & VM_MASK) ? 3 : 0; diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 11db2f3c8d..6a4c31f933 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -2287,13 +2287,13 @@ static void gen_cmovcc1(CPUX86State *env, DisasContext *s, MemOp ot, int b, } } -static inline void gen_op_movl_T0_seg(DisasContext *s, int seg_reg) +static inline void gen_op_movl_T0_seg(DisasContext *s, X86Seg seg_reg) { tcg_gen_ld32u_tl(s->T0, cpu_env, offsetof(CPUX86State,segs[seg_reg].selector)); } -static inline void gen_op_movl_seg_T0_vm(DisasContext *s, int seg_reg) +static inline void gen_op_movl_seg_T0_vm(DisasContext *s, X86Seg seg_reg) { tcg_gen_ext16u_tl(s->T0, s->T0); tcg_gen_st32_tl(s->T0, cpu_env, @@ -2303,7 +2303,7 @@ static inline void gen_op_movl_seg_T0_vm(DisasContext *s, int seg_reg) /* move T0 to seg_reg and compute if the CPU state may change. Never call this function with seg_reg == R_CS */ -static void gen_movl_seg_T0(DisasContext *s, int seg_reg) +static void gen_movl_seg_T0(DisasContext *s, X86Seg seg_reg) { if (s->pe && !s->vm86) { tcg_gen_trunc_tl_i32(s->tmp2_i32, s->T0);