]> git.proxmox.com Git - mirror_qemu.git/log
mirror_qemu.git
20 months agoMerge tag 'char-pull-request' of https://gitlab.com/marcandre.lureau/qemu into staging
Stefan Hajnoczi [Thu, 29 Sep 2022 18:12:00 +0000 (14:12 -0400)]
Merge tag 'char-pull-request' of https://gitlab.com/marcandre.lureau/qemu into staging

chardev related patches

# -----BEGIN PGP SIGNATURE-----
#
# iQJQBAABCAA6FiEEh6m9kz+HxgbSdvYt2ujhCXWWnOUFAmM1evIcHG1hcmNhbmRy
# ZS5sdXJlYXVAcmVkaGF0LmNvbQAKCRDa6OEJdZac5evvD/49HQuMxsHaTvXSLPxi
# Bkv9W8cHSEOuAVsgizrd3Z/AEx8MMsZLprtGttYpQN4041aBbyDG7PR1PirVibe7
# s5uuqq2LB85dCkrPyiTkfGosbnndDy+VH9ZH+vS6CMKHYRSwpRjYUoKt5e75JhtP
# RefwFihkVyr3HbsD6SKjB8lV25yw2tQB6BizTedaNmM6ZSmX/TRtes1JgeK3l5jD
# 7hQVqqEAJ6YvZnpg070Om43sae7j0yoW7Dg45DVViQNJeRG/0rwBKAbUZuLzs9lH
# hMjqlUW+It7Q7DvkkoLO6DiBsIceeZneZ3XHnv0/OrXDILS2ZWRnm2+qKJp75fub
# TXFafZX3RIn8ZL6Lw4uz/tsX5CllzuiT/2EO2/CzFIaGESi8Y5eFL3xku7tDWzq8
# EtsAehQeHOvNU/mw8Z1hPEozcPMFUY9eUPF7vPRHPV+g+YI+UlrZCFGcJaZpspeP
# h3rUXInftMHHocr/LvI9DMEzgHjOZrDqjECSavp1nHrGbRLfBl/1QNPql1cZJ+H/
# XDygo1x/QVlEkTaBWqcMFifgqJ7xvHPDQd6rvIbBYwUUWU1B79UKON0i6WOMk7A6
# vjsJz7Sk+cJMOMwc76w+qd0mRauWkcfiS08Y4g+4HksymZev5OeGNuuDfI6zwfFt
# T21TIS/c0zmcNU1sgXB6U2VTiw==
# =pMT6
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 29 Sep 2022 07:01:06 EDT
# gpg:                using RSA key 87A9BD933F87C606D276F62DDAE8E10975969CE5
# gpg:                issuer "marcandre.lureau@redhat.com"
# gpg: Good signature from "Marc-André Lureau <marcandre.lureau@redhat.com>" [full]
# gpg:                 aka "Marc-André Lureau <marcandre.lureau@gmail.com>" [full]
# Primary key fingerprint: 87A9 BD93 3F87 C606 D276  F62D DAE8 E109 7596 9CE5

* tag 'char-pull-request' of https://gitlab.com/marcandre.lureau/qemu:
  vhost-user: Call qemu_socketpair() instead of socketpair()
  oslib-posix: Introduce qemu_socketpair()
  chardev: fix segfault in finalize
  serial: Allow unaligned i/o access
  msmouse: Add pnp data
  msmouse: Use fifo8 instead of array
  chardev: src buffer const for write functions
  msmouse: Handle mouse reset

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
20 months agovhost-user: Call qemu_socketpair() instead of socketpair()
Guoyi Tu [Tue, 23 Aug 2022 07:50:40 +0000 (15:50 +0800)]
vhost-user: Call qemu_socketpair() instead of socketpair()

As the close-on-exec flags is not set on the file descriptors returned
by socketpair() at default, the fds will survive across exec' function.

In the case that exec' function get invoked, such as the live-update feature
which is been developing, it will cause fd leaks.

To address this problem, we should call qemu_socketpair() to create an pair of
connected sockets with the close-on-exec flag set.

Signed-off-by: Guoyi Tu <tugy@chinatelecom.cn>
Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <7002b12a5fb0a30cd878e14e07da61c36da72913.1661240709.git.tugy@chinatelecom.cn>

20 months agooslib-posix: Introduce qemu_socketpair()
Guoyi Tu [Tue, 23 Aug 2022 07:50:39 +0000 (15:50 +0800)]
oslib-posix: Introduce qemu_socketpair()

qemu_socketpair() will create a pair of connected sockets
with FD_CLOEXEC set

Signed-off-by: Guoyi Tu <tugy@chinatelecom.cn>
Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <17fa1eff729eeabd9a001f4639abccb127ceec81.1661240709.git.tugy@chinatelecom.cn>

20 months agochardev: fix segfault in finalize
Maksim Davydov [Thu, 25 Aug 2022 16:52:47 +0000 (19:52 +0300)]
chardev: fix segfault in finalize

If finalize chardev-msmouse or chardev-wctable is called immediately after
init it cases QEMU to crash with segfault. This happens because of
QTAILQ_REMOVE in qemu_input_handler_unregister tries to dereference
NULL pointer.
For instance, this error can be reproduced via `qom-list-properties`
command.

Signed-off-by: Maksim Davydov <davydov-max@yandex-team.ru>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Message-Id: <20220825165247.33704-1-davydov-max@yandex-team.ru>

20 months agoserial: Allow unaligned i/o access
Arwed Meyer [Sun, 11 Sep 2022 18:18:40 +0000 (20:18 +0200)]
serial: Allow unaligned i/o access

Unaligned i/o access on serial UART works on real PCs.
This is used for example by FreeDOS CTMouse driver. Without this it
can't reset and detect serial mice.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/77
Signed-off-by: Arwed Meyer <arwed.meyer@gmx.de>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220911181840.8933-6-arwed.meyer@gmx.de>

20 months agomsmouse: Add pnp data
Arwed Meyer [Sun, 11 Sep 2022 18:18:39 +0000 (20:18 +0200)]
msmouse: Add pnp data

Make msmouse send serial pnp data.
Enables you to see nice qemu device name in Win9x.

Signed-off-by: Arwed Meyer <arwed.meyer@gmx.de>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220911181840.8933-5-arwed.meyer@gmx.de>

20 months agomsmouse: Use fifo8 instead of array
Arwed Meyer [Sun, 11 Sep 2022 18:18:38 +0000 (20:18 +0200)]
msmouse: Use fifo8 instead of array

Make use of fifo8 functions instead of implementing own fifo code.
This makes the code more readable and reduces risk of bugs.

Signed-off-by: Arwed Meyer <arwed.meyer@gmx.de>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220911181840.8933-4-arwed.meyer@gmx.de>

20 months agochardev: src buffer const for write functions
Arwed Meyer [Sun, 11 Sep 2022 18:18:37 +0000 (20:18 +0200)]
chardev: src buffer const for write functions

Make source buffers const for char be write functions.
This allows using buffers returned by fifo as buf parameter and source buffer
should not be changed by write functions anyway.

Signed-off-by: Arwed Meyer <arwed.meyer@gmx.de>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220911181840.8933-3-arwed.meyer@gmx.de>

20 months agomsmouse: Handle mouse reset
Arwed Meyer [Sun, 11 Sep 2022 18:18:36 +0000 (20:18 +0200)]
msmouse: Handle mouse reset

Detect mouse reset via RTS or DTR line:
Don't send or process anything while in reset.
When coming out of reset, send ID sequence first thing.
This allows msmouse to be detected by common mouse drivers.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/77
Signed-off-by: Arwed Meyer <arwed.meyer@gmx.de>
Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220911181840.8933-2-arwed.meyer@gmx.de>

20 months agoMerge tag 'pull-request-2022-09-28' of https://gitlab.com/thuth/qemu into staging
Stefan Hajnoczi [Wed, 28 Sep 2022 21:04:11 +0000 (17:04 -0400)]
Merge tag 'pull-request-2022-09-28' of https://gitlab.com/thuth/qemu into staging

* Fixes for qtests and unit tests to be more portable to non-POSIX platforms

# -----BEGIN PGP SIGNATURE-----
#
# iQJFBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmMz9MQRHHRodXRoQHJl
# ZGhhdC5jb20ACgkQLtnXdP5wLbVUKRAAnubo/wtHqjxg/yVO68odX2LFI2koligA
# LcEAnhGkVJ/Pe/+Qo9yVbcOY6k6xfGQU3VIipqvLEwPAdSF0E43EJxlImBNm8/Zq
# MggjNoepXRhdFGULONSmSNm7HJykLH/CHdmBjPLrbpkTCwWG1gg64xP9fI+b8mGf
# vST0ADuYloLDA9J45UbC33AD+9dQsy2GeOs8X99O6ysKF3htEqMD3vBdqKiJSwgT
# 2c7UqySGECn6kMHl7iAdipRNUghSgzpUe8LcH4jP7Y1XnoB3zwC/+VrOVwFESI6y
# LVFsC8u7cEKKSYunoowfQTgHvYbCuSdrDqljy17NE5qRMziKMTnhXaQNR5wtBKNt
# HZxvc082P/QDFdBYYY3MIjB27r/I6x0t6Xl4IVwLz7bK0xfHFF8Ba2Lr57/2RTc/
# SMPDxGrMicTPnPDU/Cw5VROMmw0OC/tVpJMGo1VjVnNESo581RAMApyzkWiUyfZj
# ktKd+4ihmqrBXcZHVjKbIufa6eKNuktlkfv72dnJY4XoUlDHlbDYaVuknybZmxWK
# 9/CDVDG72s5Cqm+M47Q56IagVVZwIGrUP0u3j3h/v0rnHZehY8Qzr3SLEfeqmUb6
# nP7MP+ItZFZtMITdvXb3OtyeVuM0ZSw8kt+/evpvC9zB6FjgYl/e5FppsO0HxB/O
# PeeV43Bk270=
# =n+FM
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 28 Sep 2022 03:16:20 EDT
# gpg:                using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5
# gpg:                issuer "thuth@redhat.com"
# gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full]
# gpg:                 aka "Thomas Huth <thuth@redhat.com>" [full]
# gpg:                 aka "Thomas Huth <huth@tuxfamily.org>" [full]
# gpg:                 aka "Thomas Huth <th.huth@posteo.de>" [unknown]
# Primary key fingerprint: 27B8 8847 EEE0 2501 18F3  EAB9 2ED9 D774 FE70 2DB5

* tag 'pull-request-2022-09-28' of https://gitlab.com/thuth/qemu: (37 commits)
  docs/devel: testing: Document writing portable test cases
  tests/qtest: boot-serial-test: Close the serial file before starting QEMU
  tests/qtest: vhost-user-test: Avoid using hardcoded /tmp
  tests/qtest: qmp-test: Avoid using hardcoded /tmp
  tests/qtest: pflash-cfi02-test: Avoid using hardcoded /tmp
  tests/qtest: hd-geo-test: Avoid using hardcoded /tmp
  tests/x86: Move common code to function in device-plug-test
  .gitlab-ci.d/windows.yml: Display meson test logs
  tests/qtest: migration-test: Skip running some TLS cases for win32
  tests/qtest: libqtest: Replace the call to close a socket with closesocket()
  tests/qtest: microbit-test: Fix socket access for win32
  tests/qtest: virtio-net-failover: Disable migration tests for win32
  tests/qtest: ide-test: Open file in binary mode
  tests/qtest: migration-test: Disable IO redirection for win32
  tests/qtest: bios-tables-test: Adapt the case for win32
  tests/qtest: {ahci, ide}-test: Use relative path for temporary files for win32
  tests/qtest: libqtest: Exclude the *_fds APIs for win32
  tests/qtest: libqtest: Adapt global_qtest declaration for win32
  tests/qtest: qmp-test: Skip running test_qmp_oob for win32
  tests/qtest: Build test-filter-{mirror, redirector} cases for posix only
  ...

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
20 months agoMerge tag 'linux-user-for-7.2-pull-request' of https://gitlab.com/laurent_vivier...
Stefan Hajnoczi [Wed, 28 Sep 2022 21:03:54 +0000 (17:03 -0400)]
Merge tag 'linux-user-for-7.2-pull-request' of https://gitlab.com/laurent_vivier/qemu into staging

linux-user pull request 20220928-v2

use 'max' instead of 'qemu32' / 'qemu64'
add  pidfd_open(), pidfd_send_signal() and pidfd_getfd()
Improve madvise(MADV_DONTNEED)
futex syscal rework
strace improvement
HP/PA fixes and improvement
Misc fixes

# -----BEGIN PGP SIGNATURE-----
#
# iQJGBAABCAAwFiEEzS913cjjpNwuT1Fz8ww4vT8vvjwFAmM0riISHGxhdXJlbnRA
# dml2aWVyLmV1AAoJEPMMOL0/L748gH4P/2wesXJKPMY2zQzP3Rld4iyefoPGG/Yp
# mdq59BbjO2jQMR8GBss/nl9l84cIzzkYRQIogaKsjljtZYm/OO5xRefqrzJY6apD
# eidxv20dAVjuaXHAIdGhbFlxot1ctExbZs9atB4uj5DWxfYGD6e/stoBy5/pSmr4
# M5EbGHhyrRI7tRbHGtVQVvG6AT6XGE0pT9tzT5JLaApF8UPMkgJwmez16PNWvcMm
# v8GEvKm/vEVS8CCpzLV4kfwVeo3f54VAOrEBDi29ph2Yo50IA21k8BvoRZaSp+Kn
# G6TMnnly/DkMspAs5EOVfat+kv3TziNNdDH7EnVU1vV1yTDdZgW/1204Uy/JY0Pw
# WotwAFuO9FYeHKmjY0CfnIIZZHYZpDYUOZ8M6dESD/O0EjoB8LMf5p9cbYlze4DE
# csJZCsVcz19HDv6QZXi5mvvDcJ83B2IDb8/PUAzSc0n62lXL9qjYD0wdb0QsLdAT
# I25qLDge1HCmQfCIKcaoHYvE0pDmvkF6ftuQUXLtIwtaV0Z/N5wDf2PEHikjOYHM
# gD2izz23/2wQx6KP/9ZNnCJ5QEBkEgm5wpHncsvjzSzi1uIdNlHyzJJwGTAcc5qZ
# hOeoJ7dT0D6g0BGnvOdg2W/bDx18KW65mNDxE4d+W0uzn0YmQtArk2YsnhKQNO46
# 12/0ltPFnSV/
# =DIzQ
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 28 Sep 2022 16:27:14 EDT
# gpg:                using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C
# gpg:                issuer "laurent@vivier.eu"
# gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full]
# gpg:                 aka "Laurent Vivier <laurent@vivier.eu>" [full]
# gpg:                 aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [full]
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C

* tag 'linux-user-for-7.2-pull-request' of https://gitlab.com/laurent_vivier/qemu: (37 commits)
  linux-user: Add parameters of getrandom() syscall for strace
  linux-user: Lock log around strace
  linux-user: Update print_futex_op
  linux-user: Implement PI futexes
  linux-user: Convert signal number for FUTEX_FD
  linux-user: Implement FUTEX_WAKE_BITSET
  linux-user: Sink call to do_safe_futex
  linux-user: Combine do_futex and do_futex_time64
  linux-user: Set ELF_BASE_PLATFORM for MIPS
  linux-user: Introduce stubs for ELF AT_BASE_PLATFORM
  linux-user/s390x: Save/restore fpc when handling a signal
  linux-user: Don't assume 0 is not a valid host timer_t value
  linux-user: fix bug about missing signum convert of sigqueue
  linux-user/hppa: Fix setup_sigcontext()
  linux-user/hppa: Allow PROT_GROWSUP and PROT_GROWSDOWN in mprotect()
  linux-user/hppa: Increase guest stack size to 80MB for hppa target
  linux-user/hppa: Drop stack guard page on hppa target
  linux-user/hppa: Add signal trampoline for hppa target
  linux-user: Add proper strace format strings for getdents()/getdents64()
  linux-user: Fix TARGET_PROT_SEM for XTENSA
  ...

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
20 months agoMerge tag 'vfio-updates-20220927.1' of https://gitlab.com/alex.williamson/qemu into...
Stefan Hajnoczi [Wed, 28 Sep 2022 21:03:40 +0000 (17:03 -0400)]
Merge tag 'vfio-updates-20220927.1' of https://gitlab.com/alex.williamson/qemu into staging

VFIO updates 2022-09-27

 * Fix initial values for migration state (Kunkun Jiang)

 * Fix a use-after-free error path (Alex Williamson)

# -----BEGIN PGP SIGNATURE-----
#
# iQJPBAABCAA5FiEEQvbATlQL0amee4qQI5ubbjuwiyIFAmMzXKwbHGFsZXgud2ls
# bGlhbXNvbkByZWRoYXQuY29tAAoJECObm247sIsiOv8QAKJstXXq92FxT+wBXt0Q
# wnMJjE1hvCHXki7FfPSRPmVgoMppWD1vhr7TajeOkidtqnX48V863/RGZfxX+oQU
# bEPPT6QaWnYhagslrRjIj4R+5O5N6rY9A2zzpG2vv1x9qv8r9WLicKvwjzinTgAp
# PyU9Ajgu2OUpD6O64iXIeD2MnfblSN3N+bBvZ7alDifFC1D8CfX9D3X76bdERC6X
# LFEenZ/3ZwZh46z1xv4v3opI2aBp9oh1gca9NKc/jUKg11AuswhmmUSmb+lVDDnt
# UBNTqgHtnGBfAMcxQ1cA6AtRvtwwneJkQC4nkUmOEWuMImUEhTQw7vcTpDFFyHzz
# dcYRjioHu15EmuHeP/W+139fnGeCDpr1/XJcJ2avUp/9oNeRDsAi4w/lEHXHv5Rm
# KHuXSIswC/6+dgvdOwRw2OlbzX5KjSVlqXJia+QexEliCxpcs8OYEJ7ZgRdFCO8t
# unWssLs7x1O40J7cngnyT8addLGwbwExrJggpG70suSQB5mMIJzNIVanUpUkzy2g
# 9kAwW3fTUXqW7O+2RYbjFUoY0yR1eHO8EExiPHyO3hxCDNjglwpM20C4M7fs3Eo6
# /1zwagtjxblsWTPK9dOsq3y4yoXlhX+0EpM9PYPV8OleayTRyhS7O/FzHmqpJNlt
# G524RusuIU+xNwUTEKgFFHgm
# =5YPM
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 27 Sep 2022 16:27:24 EDT
# gpg:                using RSA key 42F6C04E540BD1A99E7B8A90239B9B6E3BB08B22
# gpg:                issuer "alex.williamson@redhat.com"
# gpg: Good signature from "Alex Williamson <alex.williamson@redhat.com>" [full]
# gpg:                 aka "Alex Williamson <alex@shazbot.org>" [full]
# gpg:                 aka "Alex Williamson <alwillia@redhat.com>" [full]
# gpg:                 aka "Alex Williamson <alex.l.williamson@gmail.com>" [full]
# Primary key fingerprint: 42F6 C04E 540B D1A9 9E7B  8A90 239B 9B6E 3BB0 8B22

* tag 'vfio-updates-20220927.1' of https://gitlab.com/alex.williamson/qemu:
  vfio/common: Fix vfio_iommu_type1_info use after free
  vfio/migration: Fix incorrect initialization value for parameters in VFIOMigration

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
20 months agoMerge tag 'pull-xen-20220927' of https://xenbits.xen.org/git-http/people/aperard...
Stefan Hajnoczi [Wed, 28 Sep 2022 21:03:31 +0000 (17:03 -0400)]
Merge tag 'pull-xen-20220927' of https://xenbits.xen.org/git-http/people/aperard/qemu-dm into staging

Xen patch

- Xen PCI passthrough fix for Atomic Ops requests

# -----BEGIN PGP SIGNATURE-----
#
# iQEzBAABCgAdFiEE+AwAYwjiLP2KkueYDPVXL9f7Va8FAmMy/BUACgkQDPVXL9f7
# Va/EWwf+OYEesPbMD9IWvMAgtbuqK8Q/u+YwX8bviiWsBHdGT/Egut/AKBcdmVo0
# 68erlvsXBlffhT5kw6FtWHPrIMsDA+tos/q4pM7w4IJUsz+RKV/1IYT1pQ92XPP1
# RgxJyMCmVrKadqnDvVE9wAn8NeK3t75Lq5QWhN4cpWDWSSUXta90dlu8QefnrguA
# tTmdgneoDUjBhimpy4LgoWBeBqnAMdN05A0dcGcsTSjptj/GsylwSbbbkGivsaDl
# OH23Lk4I6dBhqGo0bEi/LpuPZ44BsuY6NHUlZixbWZl+PxneePdiEd+6YjEWNAZU
# kx2XEm0hQXYxUZDk+fvHCVZP3Y/b1g==
# =cDzP
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 27 Sep 2022 09:35:17 EDT
# gpg:                using RSA key F80C006308E22CFD8A92E7980CF5572FD7FB55AF
# gpg: Can't check signature: No public key

* tag 'pull-xen-20220927' of https://xenbits.xen.org/git-http/people/aperard/qemu-dm:
  hw/xen: set pci Atomic Ops requests for passthrough device

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
20 months agolinux-user: Add parameters of getrandom() syscall for strace
Helge Deller [Tue, 27 Sep 2022 09:35:38 +0000 (11:35 +0200)]
linux-user: Add parameters of getrandom() syscall for strace

Signed-off-by: Helge Deller <deller@gmx.de>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20220927093538.8954-2-deller@gmx.de>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
20 months agovfio/common: Fix vfio_iommu_type1_info use after free
Alex Williamson [Thu, 15 Sep 2022 17:18:27 +0000 (11:18 -0600)]
vfio/common: Fix vfio_iommu_type1_info use after free

On error, vfio_get_iommu_info() frees and clears *info, but
vfio_connect_container() continues to use the pointer regardless
of the return value.  Restructure the code such that a failure
of this function triggers an error and clean up the remainder of
the function, including updating an outdated comment that had
drifted from its relevant line of code and using host page size
for a default for better compatibility on non-4KB systems.

Reported-by: Nicolin Chen <nicolinc@nvidia.com>
Link: https://lore.kernel.org/all/20220910004245.2878-1-nicolinc@nvidia.com/
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
Tested-by: Nicolin Chen <nicolinc@nvidia.com>
Link: https://lore.kernel.org/r/166326219630.3388898.12882473157184946072.stgit@omen
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
20 months agovfio/migration: Fix incorrect initialization value for parameters in VFIOMigration
Kunkun Jiang [Mon, 11 Jul 2022 01:46:51 +0000 (09:46 +0800)]
vfio/migration: Fix incorrect initialization value for parameters in VFIOMigration

The structure VFIOMigration of a VFIODevice is allocated and initialized
in vfio_migration_init(). "device_state" and "vm_running" are initialized
to 0, indicating that VFIO device is_STOP and VM is not-running. The
initialization value is incorrect. According to the agreement, default
state of VFIO device is _RUNNING. And if a VFIO device is hot-plugged
while the VM is running, "vm_running" should be 1. This patch fixes it.

Fixes: 02a7e71b1e5b ("vfio: Add VM state change handler to know state of VM")
Signed-off-by: Kunkun Jiang <jiangkunkun@huawei.com>
Link: https://lore.kernel.org/r/20220711014651.1327-1-jiangkunkun@huawei.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
20 months agodocs/devel: testing: Document writing portable test cases
Bin Meng [Tue, 27 Sep 2022 11:06:32 +0000 (19:06 +0800)]
docs/devel: testing: Document writing portable test cases

Update the best practices of how to write portable test cases that
can be built and run successfully on both Linux and Windows hosts.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220927110632.1973965-55-bmeng.cn@gmail.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
20 months agotests/qtest: boot-serial-test: Close the serial file before starting QEMU
Bin Meng [Tue, 27 Sep 2022 11:06:17 +0000 (19:06 +0800)]
tests/qtest: boot-serial-test: Close the serial file before starting QEMU

This qtest executable created a serial chardev file to be passed to
the QEMU executable. The serial file was created by g_file_open_tmp(),
which internally opens the file with FILE_SHARE_WRITE security attribute
on Windows. Based on [1], there is only one case that allows the first
call to CreateFile() with GENERIC_READ & FILE_SHARE_WRITE, and second
call to CreateFile() with GENERIC_WRITE & FILE_SHARE_READ. All other
combinations require FILE_SHARE_WRITE in the second call. But there is
no way for the second call (in this case the QEMU executable) to know
what combination was passed to the first call, unless FILE_SHARE_WRITE
is passed to the second call.

Two processes shouldn't share the same file for writing with a chardev.
Let's close the serial file before starting QEMU.

[1] https://docs.microsoft.com/en-us/windows/win32/fileio/creating-and-opening-files

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Message-Id: <20220927110632.1973965-40-bmeng.cn@gmail.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
20 months agotests/qtest: vhost-user-test: Avoid using hardcoded /tmp
Bin Meng [Tue, 27 Sep 2022 11:05:56 +0000 (19:05 +0800)]
tests/qtest: vhost-user-test: Avoid using hardcoded /tmp

This case was written to use hardcoded /tmp directory for temporary
files. Update to use g_dir_make_tmp() for a portable implementation.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Message-Id: <20220927110632.1973965-19-bmeng.cn@gmail.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
20 months agotests/qtest: qmp-test: Avoid using hardcoded /tmp
Bin Meng [Tue, 27 Sep 2022 11:05:54 +0000 (19:05 +0800)]
tests/qtest: qmp-test: Avoid using hardcoded /tmp

This case was written to use hardcoded /tmp directory for temporary
files. Update to use g_dir_make_tmp() for a portable implementation.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Message-Id: <20220927110632.1973965-17-bmeng.cn@gmail.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
20 months agotests/qtest: pflash-cfi02-test: Avoid using hardcoded /tmp
Bin Meng [Tue, 27 Sep 2022 11:05:53 +0000 (19:05 +0800)]
tests/qtest: pflash-cfi02-test: Avoid using hardcoded /tmp

This case was written to use hardcoded /tmp directory for temporary
files. Update to use g_file_open_tmp() for a portable implementation.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Message-Id: <20220927110632.1973965-16-bmeng.cn@gmail.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
20 months agotests/qtest: hd-geo-test: Avoid using hardcoded /tmp
Bin Meng [Tue, 27 Sep 2022 11:05:50 +0000 (19:05 +0800)]
tests/qtest: hd-geo-test: Avoid using hardcoded /tmp

This case was written to use hardcoded /tmp directory for temporary
files. Update to use g_file_open_tmp() for a portable implementation.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Message-Id: <20220927110632.1973965-13-bmeng.cn@gmail.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
20 months agotests/x86: Move common code to function in device-plug-test
Michael Labiuk [Tue, 20 Sep 2022 10:48:36 +0000 (13:48 +0300)]
tests/x86: Move common code to function in device-plug-test

Move common code for device removing to function.

Signed-off-by: Michael Labiuk <michael.labiuk@virtuozzo.com>
Message-Id: <20220920104842.605530-2-michael.labiuk@virtuozzo.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
20 months ago.gitlab-ci.d/windows.yml: Display meson test logs
Bin Meng [Sun, 25 Sep 2022 11:30:30 +0000 (19:30 +0800)]
.gitlab-ci.d/windows.yml: Display meson test logs

When CI fails we don't know what causes the failure. Displaying the
meson test logs can be helpful.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20220925113032.1949844-53-bmeng.cn@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
20 months agotests/qtest: migration-test: Skip running some TLS cases for win32
Bin Meng [Sun, 25 Sep 2022 11:30:28 +0000 (19:30 +0800)]
tests/qtest: migration-test: Skip running some TLS cases for win32

Some migration test cases use TLS to communicate, but they fail on
Windows with the following error messages:

  qemu-system-x86_64: TLS handshake failed: Insufficient credentials for that request.
  qemu-system-x86_64: TLS handshake failed: Error in the pull function.
  query-migrate shows failed migration: TLS handshake failed: Error in the pull function.

Disable them temporarily.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Message-Id: <20220925113032.1949844-51-bmeng.cn@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
20 months agotests/qtest: libqtest: Replace the call to close a socket with closesocket()
Bin Meng [Sun, 25 Sep 2022 11:30:23 +0000 (19:30 +0800)]
tests/qtest: libqtest: Replace the call to close a socket with closesocket()

close() is a *nix function. It works on any file descriptor, and
sockets in *nix are an example of a file descriptor.

closesocket() is a Windows-specific function, which works only
specifically with sockets. Sockets on Windows do not use *nix-style
file descriptors, and socket() returns a handle to a kernel object
instead, so it must be closed with closesocket().

In QEMU there is already a logic to handle such platform difference
in os-posix.h and os-win32.h, that:

  * closesocket maps to close on POSIX
  * closesocket maps to a wrapper that calls the real closesocket()
    on Windows

Replace the call to close a socket with closesocket() instead.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220925113032.1949844-46-bmeng.cn@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
20 months agotests/qtest: microbit-test: Fix socket access for win32
Bin Meng [Sun, 25 Sep 2022 11:30:22 +0000 (19:30 +0800)]
tests/qtest: microbit-test: Fix socket access for win32

Sockets on Windows do not use *nix-style file descriptors, so
write()/read()/close() do not work on Windows.

Switch over to use send()/recv()/closesocket() which work with
sockets on all platforms.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220925113032.1949844-45-bmeng.cn@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
20 months agotests/qtest: virtio-net-failover: Disable migration tests for win32
Xuzhou Cheng [Sun, 25 Sep 2022 11:30:19 +0000 (19:30 +0800)]
tests/qtest: virtio-net-failover: Disable migration tests for win32

These tests use the exec migration protocol, which is unsupported
on Windows as of today. Disable these tests for now.

Signed-off-by: Xuzhou Cheng <xuzhou.cheng@windriver.com>
Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220925113032.1949844-42-bmeng.cn@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
20 months agotests/qtest: ide-test: Open file in binary mode
Xuzhou Cheng [Sun, 25 Sep 2022 11:30:18 +0000 (19:30 +0800)]
tests/qtest: ide-test: Open file in binary mode

By default Windows opens file in text mode, while a POSIX compliant
implementation treats text files and binary files the same.

The fopen() 'mode' string can include the letter 'b' to indicate
binary mode shall be used. POSIX spec says the character 'b' shall
have no effect, but is allowed for ISO C standard conformance.
Let's add the letter 'b' which works on both POSIX and Windows.

Signed-off-by: Xuzhou Cheng <xuzhou.cheng@windriver.com>
Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220925113032.1949844-41-bmeng.cn@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
20 months agotests/qtest: migration-test: Disable IO redirection for win32
Bin Meng [Sun, 25 Sep 2022 11:30:17 +0000 (19:30 +0800)]
tests/qtest: migration-test: Disable IO redirection for win32

On Windows the QEMU executable is created via CreateProcess() and
IO redirection does not work, so don't bother adding IO redirection
to the command line.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220925113032.1949844-40-bmeng.cn@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
20 months agotests/qtest: bios-tables-test: Adapt the case for win32
Bin Meng [Sun, 25 Sep 2022 11:30:16 +0000 (19:30 +0800)]
tests/qtest: bios-tables-test: Adapt the case for win32

Single quotes in the arguments (oem_id='CRASH ') are not removed in
the Windows environment before it is passed to the QEMU executable.
The space in the argument causes the "-acpitable" option parser to
think that all of its parameters are done, hence it complains:

  '-acpitable' requires one of 'data' or 'file'

Change to use double quotes which works fine on all platforms.

Also /dev/null does not work on win32, and nul should be used.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <20220925113032.1949844-39-bmeng.cn@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
20 months agotests/qtest: {ahci, ide}-test: Use relative path for temporary files for win32
Bin Meng [Sun, 25 Sep 2022 11:30:15 +0000 (19:30 +0800)]
tests/qtest: {ahci, ide}-test: Use relative path for temporary files for win32

These test cases uses "blkdebug:path/to/config:path/to/image" for
testing. On Windows, absolute file paths contain the delimiter ':'
which causes the blkdebug filename parser fail to parse filenames.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20220925113032.1949844-38-bmeng.cn@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
20 months agotests/qtest: libqtest: Exclude the *_fds APIs for win32
Bin Meng [Sun, 25 Sep 2022 11:30:12 +0000 (19:30 +0800)]
tests/qtest: libqtest: Exclude the *_fds APIs for win32

libqmp.c::qmp_fd_vsend_fds() is not available on Windows, hence any
APIs in libqtest that call libqmp.c::qmp_fd_vsend_fds() should be
excluded for win32 too. This includes the following:

  * qtest_qmp_vsend_fds()
  * qtest_vqmp_fds()
  * qtest_qmp_fds()
  * qtest_qmp_add_client()

Note qtest_qmp_vsend() was wrongly written to call qmp_fd_vsend_fds()
previously, but it should call the non fds version API qmp_fd_vsend().

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220925113032.1949844-35-bmeng.cn@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
20 months agotests/qtest: libqtest: Adapt global_qtest declaration for win32
Xuzhou Cheng [Sun, 25 Sep 2022 11:30:10 +0000 (19:30 +0800)]
tests/qtest: libqtest: Adapt global_qtest declaration for win32

Commit dd2107497275 ("tests/libqtest: Use libqtest-single.h in tests that require global_qtest")
moved global_qtest to libqtest-single.h, by declaring global_qtest
attribute to be common and weak.

This trick unfortunately does not work on Windows, and building
qtest test cases results in multiple definition errors of the weak
symbol global_qtest, as Windows PE does not have the concept of
the so-called weak symbol like ELF in the *nix world.

However Windows does provide a trick to declare a variable to be
a common symbol, via __declspec(selectany) [1]. It does not provide
the "strong override weak" effect but we don't need it in our use
case anyway. So let's use it for win32.

[1] https://docs.microsoft.com/en-us/cpp/cpp/selectany

Signed-off-by: Xuzhou Cheng <xuzhou.cheng@windriver.com>
Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20220925113032.1949844-33-bmeng.cn@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
20 months agotests/qtest: qmp-test: Skip running test_qmp_oob for win32
Bin Meng [Sun, 25 Sep 2022 11:30:08 +0000 (19:30 +0800)]
tests/qtest: qmp-test: Skip running test_qmp_oob for win32

The test_qmp_oob test case calls mkfifo() which does not exist on
win32. Exclude it.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20220925113032.1949844-31-bmeng.cn@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
20 months agotests/qtest: Build test-filter-{mirror, redirector} cases for posix only
Bin Meng [Sun, 25 Sep 2022 11:30:07 +0000 (19:30 +0800)]
tests/qtest: Build test-filter-{mirror, redirector} cases for posix only

The test-filter-{mirror,redirector} cases use socketpair() API that
is only available on POSIX and should only be built for POSIX.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220925113032.1949844-30-bmeng.cn@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
20 months agotests/qtest: Skip running virtio-net-test cases that require socketpair() for win32
Bin Meng [Sun, 25 Sep 2022 11:30:06 +0000 (19:30 +0800)]
tests/qtest: Skip running virtio-net-test cases that require socketpair() for win32

Some of the virtio-net-test test cases require socketpair() to do the
test setup. Skip them for win32.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220925113032.1949844-29-bmeng.cn@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
20 months agotests: vhost-user-bridge: Avoid using hardcoded /tmp
Bin Meng [Sun, 25 Sep 2022 11:30:02 +0000 (19:30 +0800)]
tests: vhost-user-bridge: Avoid using hardcoded /tmp

This case was written to use hardcoded /tmp directory for temporary
files. Update to use g_file_open_tmp() for a portable implementation.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220925113032.1949844-25-bmeng.cn@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
20 months agotests/unit: test-qga: Avoid using hardcoded /tmp
Bin Meng [Sun, 25 Sep 2022 11:30:01 +0000 (19:30 +0800)]
tests/unit: test-qga: Avoid using hardcoded /tmp

This case was written to use hardcoded /tmp directory for temporary
files. Update to use g_get_tmp_dir() for a portable implementation.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220925113032.1949844-24-bmeng.cn@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
20 months agotests/unit: test-image-locking: Avoid using hardcoded /tmp
Bin Meng [Sun, 25 Sep 2022 11:30:00 +0000 (19:30 +0800)]
tests/unit: test-image-locking: Avoid using hardcoded /tmp

This case was written to use hardcoded /tmp directory for temporary
files. Update to use g_file_open_tmp() for a portable implementation.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220925113032.1949844-23-bmeng.cn@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
20 months agotests/qtest: libqtest: Avoid using hardcoded /tmp
Bin Meng [Sun, 25 Sep 2022 11:29:59 +0000 (19:29 +0800)]
tests/qtest: libqtest: Avoid using hardcoded /tmp

The qtest library was written to use hardcoded /tmp directory for
temporary files. Update to use g_get_tmp_dir() and g_dir_make_tmp()
for a portable implementation.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220925113032.1949844-22-bmeng.cn@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
20 months agotests/qtest: virtio-scsi-test: Avoid using hardcoded /tmp
Bin Meng [Sun, 25 Sep 2022 11:29:58 +0000 (19:29 +0800)]
tests/qtest: virtio-scsi-test: Avoid using hardcoded /tmp

This case was written to use hardcoded /tmp directory for temporary
files. Update to use g_file_open_tmp() for a portable implementation.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220925113032.1949844-21-bmeng.cn@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
20 months agotests/qtest: virtio-blk-test: Avoid using hardcoded /tmp
Bin Meng [Sun, 25 Sep 2022 11:29:57 +0000 (19:29 +0800)]
tests/qtest: virtio-blk-test: Avoid using hardcoded /tmp

This case was written to use hardcoded /tmp directory for temporary
files. Update to use g_file_open_tmp() for a portable implementation.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220925113032.1949844-20-bmeng.cn@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
20 months agotests/qtest: vhost-user-blk-test: Avoid using hardcoded /tmp
Bin Meng [Sun, 25 Sep 2022 11:29:55 +0000 (19:29 +0800)]
tests/qtest: vhost-user-blk-test: Avoid using hardcoded /tmp

This case was written to use hardcoded /tmp directory for temporary
files. Update to use g_get_tmp_dir() for a portable implementation.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220925113032.1949844-18-bmeng.cn@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
20 months agotests/qtest: ide-test: Avoid using hardcoded /tmp
Bin Meng [Sun, 25 Sep 2022 11:29:51 +0000 (19:29 +0800)]
tests/qtest: ide-test: Avoid using hardcoded /tmp

This case was written to use hardcoded /tmp directory for temporary
files. Update to use g_file_open_tmp() for a portable implementation.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220925113032.1949844-14-bmeng.cn@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
20 months agotests/qtest: virtio_blk_fuzz: Avoid using hardcoded /tmp
Bin Meng [Sun, 25 Sep 2022 11:29:49 +0000 (19:29 +0800)]
tests/qtest: virtio_blk_fuzz: Avoid using hardcoded /tmp

This case was written to use hardcoded /tmp directory for temporary
files. Update to use g_file_open_tmp() for a portable implementation.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220925113032.1949844-12-bmeng.cn@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
20 months agotests/qtest: generic_fuzz: Avoid using hardcoded /tmp
Bin Meng [Sun, 25 Sep 2022 11:29:48 +0000 (19:29 +0800)]
tests/qtest: generic_fuzz: Avoid using hardcoded /tmp

This case was written to use hardcoded /tmp directory for temporary
files. Update to use g_dir_make_tmp() for a portable implementation.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220925113032.1949844-11-bmeng.cn@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
20 months agotests/qtest: fdc-test: Avoid using hardcoded /tmp
Bin Meng [Sun, 25 Sep 2022 11:29:47 +0000 (19:29 +0800)]
tests/qtest: fdc-test: Avoid using hardcoded /tmp

This case was written to use hardcoded /tmp directory for temporary
files. Update to use g_file_open_tmp() for a portable implementation.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220925113032.1949844-10-bmeng.cn@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
20 months agotests/qtest: cxl-test: Avoid using hardcoded /tmp
Bin Meng [Sun, 25 Sep 2022 11:29:46 +0000 (19:29 +0800)]
tests/qtest: cxl-test: Avoid using hardcoded /tmp

This case was written to use hardcoded /tmp directory for temporary
files. Update to use g_dir_make_tmp() for a portable implementation.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220925113032.1949844-9-bmeng.cn@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
20 months agotests/qtest: boot-serial-test: Avoid using hardcoded /tmp
Bin Meng [Sun, 25 Sep 2022 11:29:45 +0000 (19:29 +0800)]
tests/qtest: boot-serial-test: Avoid using hardcoded /tmp

This case was written to use hardcoded /tmp directory for temporary
files. Update to use g_file_open_tmp() for a portable implementation.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20220925113032.1949844-8-bmeng.cn@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
20 months agotests/qtest: aspeed_smc-test: Avoid using hardcoded /tmp
Bin Meng [Sun, 25 Sep 2022 11:29:44 +0000 (19:29 +0800)]
tests/qtest: aspeed_smc-test: Avoid using hardcoded /tmp

This case was written to use hardcoded /tmp directory for temporary
files. Update to use g_file_open_tmp() for a portable implementation.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Message-Id: <20220925113032.1949844-7-bmeng.cn@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
20 months agotests/qtest: ahci-test: Avoid using hardcoded /tmp
Bin Meng [Sun, 25 Sep 2022 11:29:43 +0000 (19:29 +0800)]
tests/qtest: ahci-test: Avoid using hardcoded /tmp

This case was written to use hardcoded /tmp directory for temporary
files. Update to use g_file_open_tmp() for a portable implementation.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20220925113032.1949844-6-bmeng.cn@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
20 months agotests/qtest: i440fx-test: Rewrite create_blob_file() to be portable
Bin Meng [Sun, 25 Sep 2022 11:29:39 +0000 (19:29 +0800)]
tests/qtest: i440fx-test: Rewrite create_blob_file() to be portable

Previously request_{bios, pflash} cases were skipped on win32, mainly
due to create_blob_file() calling mmap() which does not exist on win32.
This rewirtes create_blob_file() to be portable, so that we can enable
these cases on Windows.

Suggested-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20220925113032.1949844-2-bmeng.cn@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
20 months agoMerge tag 'net-pull-request' of https://github.com/jasowang/qemu into staging
Stefan Hajnoczi [Tue, 27 Sep 2022 15:08:36 +0000 (11:08 -0400)]
Merge tag 'net-pull-request' of https://github.com/jasowang/qemu into staging

# -----BEGIN PGP SIGNATURE-----
# Version: GnuPG v1
#
# iQEcBAABAgAGBQJjMqL9AAoJEO8Ells5jWIRUKcH/iNuJpxMXG18pGteBiTu3/ut
# KRR9u1nLZZXA2/02NTOYnrrHcplFQkEBXNHaEintWfctKHIP/llY8LDVriDFM+6N
# 4PzwLGLe7R9S7rfgt/xMDY0nFESFph5XyVTCxAAUm3Exhm8vIg1FM8Tep8lW/taW
# pliDa0K/9pQAfIN+eCnMUtH2JUttak8RwvAg5rXBg7XUx48ZTQn1o7aYYTPOAC2v
# RWkX0BKc7FVK5maAhe6Ugrcf6v4R2mDIAvnr+Anvo67SfgFZ5MtCllr0liJ4h3Vd
# +/PlsBDJotvht3QZVva1tn1Jk5rhN8N8lZbVOuMsklU/tX3Xrj99HJNETLXks2k=
# =82t6
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 27 Sep 2022 03:15:09 EDT
# gpg:                using RSA key EF04965B398D6211
# gpg: Good signature from "Jason Wang (Jason Wang on RedHat) <jasowang@redhat.com>" [full]
# Primary key fingerprint: 215D 46F4 8246 689E C77F  3562 EF04 965B 398D 6211

* tag 'net-pull-request' of https://github.com/jasowang/qemu:
  virtio: del net client if net_init_tap_one failed
  vdpa: Allow MQ feature in SVQ
  virtio-net: Update virtio-net curr_queue_pairs in vdpa backends
  vdpa: validate MQ CVQ commands
  vdpa: Add vhost_vdpa_net_load_mq
  vdpa: extract vhost_vdpa_net_load_mac from vhost_vdpa_net_load
  vdpa: Make VhostVDPAState cvq_cmd_in_buffer control ack type
  e1000e: set RX desc status with DD flag in a separate operation

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
20 months agoMerge tag 'm68k-for-7.2-pull-request' of https://github.com/vivier/qemu-m68k into...
Stefan Hajnoczi [Tue, 27 Sep 2022 15:07:52 +0000 (11:07 -0400)]
Merge tag 'm68k-for-7.2-pull-request' of https://github.com/vivier/qemu-m68k into staging

M68k pull request 20220927

Align bootinfo tags
fix move from sr

# -----BEGIN PGP SIGNATURE-----
#
# iQJGBAABCAAwFiEEzS913cjjpNwuT1Fz8ww4vT8vvjwFAmMyl5ESHGxhdXJlbnRA
# dml2aWVyLmV1AAoJEPMMOL0/L748JGIQAK2xK/DCWCphFWIo9ywhRPupOJb4rEXO
# JqhBBmmVx+OZcl/MPsHyQlGuvjustB/K8ZojqII50+ZeVG2ECj9lHn+nBBbU3pXT
# bVkV5FWTFMvbxXpfePbZ9wrWZACVPMchEyswOu8scvsH+N9yP8ZrqNBi/MlNQaYR
# RCLdHfIUJ43U/KvsOgQxNb2O+ag7wlmPbSk2cuRmGi/cYBHsKRD+kbLp6l5vTqYn
# 0n/sNVo0HEL6kl3/IOUKNMpgadcIvoAMsJ8TzXarHfBRbN8baCEeO+Evlc1wkgQE
# pB00jx4cyLX0KOlGhM3H7ezqRDdPJkf2nmlFlQ4Of2YE949ZWN9F27CoeptLeyrF
# 7UP8MQjumibd6nq8SJSGEN8iMjRLYiTYlRTUeOe18ofoa2JTOeqhfDzWAoVl1XTi
# SA/3VmdAW7k18C4Wkm6VnrZDVs6RU60bWlyjLJ9lyc6798dG9eeDZMzNhRgOaKib
# J/w6+UKo0T4auEG7iOu2rt9uIWD0MJHXIYqoUYoKrRR6pwWbXQ0syljNMz2WT1y7
# kHoyC7moc5a7VTnKY41DGtZwsl0nqwSNsln+BCSwIAj2DjLkUMEZOUV9Lz9BMsEz
# RyKKbdVX7iEPQYzKbztdx02sM4E3jEczh1tHOcHxPxF1wsgc1BTP2xNUzUi7ijac
# MUJ9HMT++X9i
# =u4p1
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 27 Sep 2022 02:26:25 EDT
# gpg:                using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C
# gpg:                issuer "laurent@vivier.eu"
# gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full]
# gpg:                 aka "Laurent Vivier <laurent@vivier.eu>" [full]
# gpg:                 aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [full]
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C

* tag 'm68k-for-7.2-pull-request' of https://github.com/vivier/qemu-m68k:
  m68k: align bootinfo strings and data to 4 bytes
  target/m68k: use M68K_FEATURE_MOVEFROMSR_PRIV feature for move_from_sr privilege check
  target/m68k: increase size of m68k CPU features from uint32_t to uint64_t

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
20 months agoMerge tag 'pull-request-2022-09-26' of https://gitlab.com/thuth/qemu into staging
Stefan Hajnoczi [Tue, 27 Sep 2022 15:06:52 +0000 (11:06 -0400)]
Merge tag 'pull-request-2022-09-26' of https://gitlab.com/thuth/qemu into staging

* Fix emulation of the LZRF instruction
* Fix "noexec" TCG test on s390x
* Implement SHA-512 and random number generator instructions
* Support for zPCI interpretation on s390x hosts
* Removal of the "slirp" submodule

# -----BEGIN PGP SIGNATURE-----
#
# iQJFBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmMx26URHHRodXRoQHJl
# ZGhhdC5jb20ACgkQLtnXdP5wLbUaOw/7Bu1ghYJyzjR8raXSzOP8KmyltKb0s0zd
# rFpagZCeBiNGHAL2IaKHc3vw+oFy/TTWhrFLt+imDo2swDIIAWCb/bY2/snKX4c8
# feF0io7JTdNCWvS/9ng6qL/fGSNM6V2osYyN5fEm46DM7gC3GlAu5vP2TCVoIifw
# AXDANd6XngoCAFBdixGNi0yxAmiLCou/1S+lJ7hCbx1oICPPTrzuGBwyQ+IELJOD
# DUGFb+Dl4z+tv8OYRhdvoSTCz75IhsAXeny2+coffvW70BDSyhzIAtVeo2azVGvT
# aOVRJt+g7H/mJ0vH20M/7pakdwvHs3zciw5oHUJSsEW1HzsqNgl+AEEUzXivipaN
# LYp5//klqjjAu12hFQbzmbhD/vUw2+8mRgbJdKOz7rSrZ/K8f+jqIbbU5r8t1oyy
# BqLo2i0EVBfAomzbHMD/kmrumiSNIlfSDwScAoIKAO6P3oy/Sg2twMhPlFRWAnI0
# 46dQS1rLuU0nV4tMCAQoXxRxjQXytCOhaF9G+qe9ogLufHG+Uy+j3IeunyAUl9GR
# EcnRB0GFjWfZKeUsR9qev2pvgOZXeg4u+wpjGM7pmfpZw89nBqCj0UVAthXlSKoz
# ru3HcuBJTBtxwYkSCsPMEDCk/FhJN0D+N205qg+6SY28R57WjTPFLvZPRmhkH03E
# jN8rurLISAM=
# =FeSy
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon 26 Sep 2022 13:04:37 EDT
# gpg:                using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5
# gpg:                issuer "thuth@redhat.com"
# gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full]
# gpg:                 aka "Thomas Huth <thuth@redhat.com>" [full]
# gpg:                 aka "Thomas Huth <huth@tuxfamily.org>" [full]
# gpg:                 aka "Thomas Huth <th.huth@posteo.de>" [unknown]
# Primary key fingerprint: 27B8 8847 EEE0 2501 18F3  EAB9 2ED9 D774 FE70 2DB5

* tag 'pull-request-2022-09-26' of https://gitlab.com/thuth/qemu:
  Remove the slirp submodule (i.e. compile only with an external libslirp)
  s390x/s390-virtio-ccw: add zpcii-disable machine property
  s390x/pci: reflect proper maxstbl for groups of interpreted devices
  s390x/pci: let intercept devices have separate PCI groups
  s390x/pci: enable adapter event notification for interpreted devices
  s390x/pci: don't fence interpreted devices without MSI-X
  s390x/pci: enable for load/store interpretation
  s390x/pci: add routine to get host function handle from CLP info
  Update linux headers to v6.0-rc4
  configure: Add -Wno-gnu-variable-sized-type-not-at-end
  target/s390x: support PRNO_TRNG instruction
  target/s390x: support SHA-512 extensions
  linux-user/host/s390: Add vector instructions to host_signal_write()
  s390x/tcg: Fix opcode for lzrf

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
20 months agohw/xen: set pci Atomic Ops requests for passthrough device
Ruili Ji [Tue, 6 Sep 2022 06:09:41 +0000 (14:09 +0800)]
hw/xen: set pci Atomic Ops requests for passthrough device

Make guest os access pci device control 2 reg for passthrough device
as struct XenPTRegInfo described in the file hw/xen/xen_pt.h.
/* reg read only field mask (ON:RO/ROS, OFF:other) */
uint32_t ro_mask;
/* reg emulate field mask (ON:emu, OFF:passthrough) */
uint32_t emu_mask;

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1196
Signed-off-by: Aaron Liu <Aaron.Liu@amd.com>
Signed-off-by: Ruili Ji <ruili.ji@amd.com>
Message-ID: <BL1PR12MB599341DC55BA53FE588DE14E9B7E9@BL1PR12MB5993.namprd12.prod.outlook.com>
Reviewed-by: Paul Durrant <paul@xen.org>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
20 months agoMerge tag 'kraxel-20220927-pull-request' of https://gitlab.com/kraxel/qemu into staging
Stefan Hajnoczi [Tue, 27 Sep 2022 11:59:26 +0000 (07:59 -0400)]
Merge tag 'kraxel-20220927-pull-request' of https://gitlab.com/kraxel/qemu into staging

usb: make usbnet work with xhci.
audio: add sndio backend.
misc bugfixes for console, xhci, audio, ati-vga and virtio-gpu.

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCgAdFiEEoDKM/7k6F6eZAf59TLbY7tPocTgFAmMyse8ACgkQTLbY7tPo
# cTiLrRAAltoyd++jsmhg2wXuJsfekfec3kOro7T+eSznDWfBRvm7VxJ+gswYBYga
# HbEkHjII0yPbOP9WDMhhHx33g2nYdbhDLPKXHdK8MjHTTPxtYP7XmsWkEVpuuzTx
# WqeYvGSmUri6QOUz7fd07IhiBT1aQvUQ/vWQ6OhyRVPy41bR8kIbGx3iV0JDxWvz
# n3xUZALGLz3QAM0lXRzXPYT9JB/RqdbpMM35HNTpN9/xaZmgFWsyuQXSSm61pTtb
# PS+lILDPjgZeYsfsZRyhZaSZrp2f6WOGm1ZdtSM0rvmRKezOzYnG8fm4fqZQLYSj
# nrAqUs38sKaM71a3QbpXhDjbv4cpj0K3iSNLmlUq4pgvPiMgwPlgSwwCGlkNDaRo
# IA1KON1pMH2A5vvtXEUt5RTkbXxHAAKPdpl5sS6kgbs7dgoKDqzaIPFQELam259Z
# 9nbMBqz/d6gm2CFT5ogrY0q511IC5hWtsmbQZkOZeBd5SvhvyJ59DIabFDcw05fG
# ixZVapewXYtzFUde2lb8X5qyneUVeGY5D2OJ2uUykHgR2Qz4d3CjXlhnRkLIkMcd
# Uu6N1LTkjyuuB86BoTSZxk0iz94OvmyDiXpqwmRaCGcdnTOTj0dKrbRrtHdC2vCo
# cBpUAIdyJvDJSm0X8ZWvvv1sMJCAJ7lofFf/P/jUKlacC2ipgXQ=
# =QBLK
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 27 Sep 2022 04:18:55 EDT
# gpg:                using RSA key A0328CFFB93A17A79901FE7D4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full]
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>" [full]
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full]
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* tag 'kraxel-20220927-pull-request' of https://gitlab.com/kraxel/qemu: (24 commits)
  virtio-gpu: update scanout if there is any area covered by the rect
  hw/display/ati_2d: Fix buffer overflow in ati_2d_blt (CVE-2021-3638)
  audio: remove abort() in audio_bug()
  Revert "audio: Log context for audio bug"
  audio: Add sndio backend
  usbnet: Report link-up via interrupt endpoint in CDC-ECM mode
  usbnet: Detect short packets as sent by the xHCI controller
  usbnet: Accept mandatory USB_CDC_SET_ETHERNET_PACKET_FILTER request
  usbnet: Add missing usb_wakeup() call in usbnet_receive()
  hcd-xhci: drop operation with secondary stream arrays enabled
  usb/msd: add usb_msd_fatal_error() and fix guest-triggerable assert
  usb/msd: move usb_msd_packet_complete()
  hcd-ohci: Drop ohci_service_iso_td() if ed->head & OHCI_DPTR_MASK is zero
  hw/usb/hcd-xhci: Check whether DMA accesses fail
  ui/console: fix three double frees in png_save()
  ui/vdagent: fix serial reset of guest agent
  ui/clipboard: reset the serial state on reset
  ui/vdagent: always reset the clipboard serial on caps
  ui/clipboard: fix serial priority
  ui: add some vdagent related traces
  ...

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
20 months agoMerge tag 'pull-riscv-to-apply-20220927' of https://github.com/alistair23/qemu into...
Stefan Hajnoczi [Tue, 27 Sep 2022 11:56:56 +0000 (07:56 -0400)]
Merge tag 'pull-riscv-to-apply-20220927' of https://github.com/alistair23/qemu into staging

Second RISC-V PR for QEMU 7.2

* Fixup typos and register addresses for Ibex SPI
* Cleanup the RISC-V virt machine documentation
* Remove the sideleg and sedeleg CSR macros
* Fix the CSR check for cycle{h}, instret{h}, time{h}, hpmcounter3-31{h}
* Remove fixed numbering from GDB xml feature files
* Allow setting the resetvec for the OpenTitan machine
* Check the correct exception cause in vector GDB stub
* Fix inheritance of SiFiveEState
* Improvements to the RISC-V debugger spec
* Simplify some vector code

# -----BEGIN PGP SIGNATURE-----
#
# iQEzBAABCAAdFiEE9sSsRtSTSGjTuM6PIeENKd+XcFQFAmMymHIACgkQIeENKd+X
# cFQPxwf8DhYeJ+Ctsi9/fFTIHLAE3ciZ15Hf/BJGc5maeVGupYG64+9Cs0fGX4bY
# CBlmE5xqn8hanEQXTQxmbC3AoNyykRV+arUrdawlUrJR5hQy/PNVq4yTxFPHcEjJ
# bOsQxkMvMzZiWbJfG8SZObXfFZ+6HjWd2qjbCUwyVAa5mWDHsuPy22/RDcaR9KSV
# Sb217kNIY3a2WkDUrY84zqOfks3NDFA1GuCge7EcQGV9iPxH06KO3ANpGvCE/31i
# FnfA9qUu7ts+ls2lSj+2ARsZUzMciZuC3ggTRYIKbyf0QNTK6fILuzlMPPvf0ORZ
# vbq8rSTDPrWzmrLskba1jADbWPtiXA==
# =b3zl
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 27 Sep 2022 02:30:10 EDT
# gpg:                using RSA key F6C4AC46D4934868D3B8CE8F21E10D29DF977054
# gpg: Good signature from "Alistair Francis <alistair@alistair23.me>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: F6C4 AC46 D493 4868 D3B8  CE8F 21E1 0D29 DF97 7054

* tag 'pull-riscv-to-apply-20220927' of https://github.com/alistair23/qemu: (22 commits)
  target/riscv: rvv-1.0: vf[w]redsum distinguish between ordered/unordered
  target/riscv: rvv-1.0: Simplify vfwredsum code
  target/riscv: debug: Add initial support of type 6 trigger
  target/riscv: debug: Check VU/VS modes for type 2 trigger
  target/riscv: debug: Create common trigger actions function
  target/riscv: debug: Introduce tinfo CSR
  target/riscv: debug: Restrict the range of tselect value can be written
  target/riscv: debug: Introduce tdata1, tdata2, and tdata3 CSRs
  target/riscv: debug: Introduce build_tdata1() to build tdata1 register content
  target/riscv: debug: Determine the trigger type from tdata1.type
  hw/riscv/sifive_e: Fix inheritance of SiFiveEState
  target/riscv: Check the correct exception cause in vector GDB stub
  hw/riscv: opentitan: Expose the resetvec as a SoC property
  hw/riscv: opentitan: Fixup resetvec
  target/riscv: Set the CPU resetvec directly
  target/riscv: remove fixed numbering from GDB xml feature files
  target/riscv: remove fflags, frm, and fcsr from riscv-*-fpu.xml
  target/riscv: fix csr check for cycle{h}, instret{h}, time{h}, hpmcounter3-31{h}
  target/riscv: Remove sideleg and sedeleg
  docs/system: clean up code escape for riscv virt platform
  ...

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
20 months agolinux-user: Lock log around strace
Richard Henderson [Mon, 29 Aug 2022 02:10:05 +0000 (19:10 -0700)]
linux-user: Lock log around strace

Do not allow syscall arguments to be interleaved between threads.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20220829021006.67305-8-richard.henderson@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
20 months agolinux-user: Update print_futex_op
Richard Henderson [Mon, 29 Aug 2022 02:10:04 +0000 (19:10 -0700)]
linux-user: Update print_futex_op

Use a table for the names; print unknown values in hex,
since the value contains flags.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220829021006.67305-7-richard.henderson@linaro.org>
[lv: update print_futex() according to
"linux-user: Show timespec on strace for futex()"]
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
20 months agolinux-user: Implement PI futexes
Richard Henderson [Mon, 29 Aug 2022 02:10:03 +0000 (19:10 -0700)]
linux-user: Implement PI futexes

Define the missing FUTEX_* constants in syscall_defs.h

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20220829021006.67305-6-richard.henderson@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
20 months agolinux-user: Convert signal number for FUTEX_FD
Richard Henderson [Mon, 29 Aug 2022 02:10:02 +0000 (19:10 -0700)]
linux-user: Convert signal number for FUTEX_FD

The val argument to FUTEX_FD is a signal number.  Convert to match
the host, as it will be converted back when the signal is delivered.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20220829021006.67305-5-richard.henderson@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
20 months agolinux-user: Implement FUTEX_WAKE_BITSET
Richard Henderson [Mon, 29 Aug 2022 02:10:01 +0000 (19:10 -0700)]
linux-user: Implement FUTEX_WAKE_BITSET

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20220829021006.67305-4-richard.henderson@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
20 months agolinux-user: Sink call to do_safe_futex
Richard Henderson [Mon, 29 Aug 2022 02:10:00 +0000 (19:10 -0700)]
linux-user: Sink call to do_safe_futex

Leave only the argument adjustments within the shift,
and sink the actual syscall to the end.  Sink the
timespec conversion as well, as there will be more users.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20220829021006.67305-3-richard.henderson@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
20 months agolinux-user: Combine do_futex and do_futex_time64
Richard Henderson [Mon, 29 Aug 2022 02:09:59 +0000 (19:09 -0700)]
linux-user: Combine do_futex and do_futex_time64

Pass a boolean to select between time32 and time64.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20220829021006.67305-2-richard.henderson@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
20 months agolinux-user: Set ELF_BASE_PLATFORM for MIPS
Jiaxun Yang [Wed, 3 Aug 2022 10:30:09 +0000 (11:30 +0100)]
linux-user: Set ELF_BASE_PLATFORM for MIPS

Match most appropriate base platform string based on insn_flags.
Logic is aligned with aligned with set_isa() from
arch/mips/kernel/cpu-probe.c in Linux kernel.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20220803103009.95972-3-jiaxun.yang@flygoat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
20 months agolinux-user: Introduce stubs for ELF AT_BASE_PLATFORM
Jiaxun Yang [Wed, 3 Aug 2022 10:30:08 +0000 (11:30 +0100)]
linux-user: Introduce stubs for ELF AT_BASE_PLATFORM

AT_BASE_PLATFORM is a elf auxiliary vector pointing to a string
to pass some architecture information.
See getauxval(3) man-page.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20220803103009.95972-2-jiaxun.yang@flygoat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
20 months agolinux-user/s390x: Save/restore fpc when handling a signal
Ilya Leoshkevich [Wed, 17 Aug 2022 12:39:02 +0000 (14:39 +0200)]
linux-user/s390x: Save/restore fpc when handling a signal

Linux kernel does this in fpregs_store() and fpregs_load(), so
qemu-user should do this as well.

Found by running valgrind's none/tests/s390x/test_sig.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220817123902.585623-1-iii@linux.ibm.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
20 months agolinux-user: Don't assume 0 is not a valid host timer_t value
Peter Maydell [Mon, 25 Jul 2022 11:00:35 +0000 (12:00 +0100)]
linux-user: Don't assume 0 is not a valid host timer_t value

For handling guest POSIX timers, we currently use an array
g_posix_timers[], whose entries are a host timer_t value, or 0 for
"this slot is unused".  When the guest calls the timer_create syscall
we look through the array for a slot containing 0, and use that for
the new timer.

This scheme assumes that host timer_t values can never be zero.  This
is unfortunately not a valid assumption -- for some host libc
versions, timer_t values are simply indexes starting at 0.  When
using this kind of host libc, the effect is that the first and second
timers end up sharing a slot, and so when the guest tries to operate
on the first timer it changes the second timer instead.

Rework the timer allocation code, so that:
 * the 'slot in use' indication uses a separate array from the
   host timer_t array
 * we grab the free slot atomically, to avoid races when multiple
   threads call timer_create simultaneously
 * releasing an allocated slot is abstracted out into a new
   free_host_timer_slot() function called in the correct places

This fixes:
 * problems on hosts where timer_t 0 is valid
 * the FIXME in next_free_host_timer() about locking
 * bugs in the error paths in timer_create where we forgot to release
   the slot we grabbed, or forgot to free the host timer

Reported-by: Jon Alduan <jon.alduan@gmail.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20220725110035.1273441-1-peter.maydell@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
20 months agolinux-user: fix bug about missing signum convert of sigqueue
fanwenjie [Wed, 31 Aug 2022 03:55:25 +0000 (11:55 +0800)]
linux-user: fix bug about missing signum convert of sigqueue

Fixes: 66fb9763af ("basic signal handling")
Fixes: cf8b8bfc50 ("linux-user: add support for rt_tgsigqueueinfo() system call")
Signed-off-by: fanwenjie <fanwj@mail.ustc.edu.cn>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
20 months agolinux-user/hppa: Fix setup_sigcontext()
Helge Deller [Sat, 24 Sep 2022 11:45:01 +0000 (13:45 +0200)]
linux-user/hppa: Fix setup_sigcontext()

We don't emulate a preemptive kernel on this level, and the hppa architecture
doesn't allow context switches on the gateway page. So we always have to return
to sc_iaoq[] and not to gr[31].
This fixes the remaining random segfaults which still occured.

Signed-off-by: Helge Deller <deller@gmx.de>
Message-Id: <20220924114501.21767-8-deller@gmx.de>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
20 months agolinux-user/hppa: Allow PROT_GROWSUP and PROT_GROWSDOWN in mprotect()
Helge Deller [Sat, 24 Sep 2022 11:45:00 +0000 (13:45 +0200)]
linux-user/hppa: Allow PROT_GROWSUP and PROT_GROWSDOWN in mprotect()

The hppa platform uses an upwards-growing stack and required in Linux
kernels < 5.18 an executable stack for signal processing.  For that some
executables and libraries are marked to have an executable stack, for
which glibc uses the mprotect() syscall to mark the stack like this:
 mprotect(xfa000000,4096,PROT_EXEC|PROT_READ|PROT_WRITE|PROT_GROWSUP).

Currently qemu will return -TARGET_EINVAL for this syscall because of the
checks in validate_prot_to_pageflags(), which doesn't allow the
PROT_GROWSUP or PROT_GROWSDOWN flags and thus triggers this error in the
guest:
 error while loading shared libraries: libc.so.6: cannot enable executable stack as shared object requires: Invalid argument

Allow mprotect() to handle both flags and thus fix the guest.
The glibc tst-execstack testcase can be used to reproduce the issue.

Signed-off-by: Helge Deller <deller@gmx.de>
Message-Id: <20220924114501.21767-7-deller@gmx.de>
[lvivier: s/elif TARGET_HPPA/elif defined(TARGET_HPPA)/]
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
20 months agolinux-user/hppa: Increase guest stack size to 80MB for hppa target
Helge Deller [Sat, 24 Sep 2022 11:44:59 +0000 (13:44 +0200)]
linux-user/hppa: Increase guest stack size to 80MB for hppa target

The hppa target requires a much bigger stack than many other targets,
and the Linux kernel allocates 80 MB by default for it.

This patch increases the guest stack for hppa to 80MB, and prevents
that this default stack size gets reduced by a lower stack limit on the
host.

Since the stack grows upwards on hppa, the stack_limit value marks the
upper boundary of the stack. Fix the output of /proc/self/maps (in the
guest) to show the [stack] marker on the correct memory area.

Signed-off-by: Helge Deller <deller@gmx.de>
Message-Id: <20220924114501.21767-6-deller@gmx.de>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
20 months agolinux-user/hppa: Drop stack guard page on hppa target
Helge Deller [Sat, 24 Sep 2022 11:44:58 +0000 (13:44 +0200)]
linux-user/hppa: Drop stack guard page on hppa target

The stack-overflow check when building the "grep" debian package fails
on the debian hppa target. Reason is, that the guard page at the top
of the stack (which is added by qemu) prevents the fault handler in the
grep program to properly detect the stack overflow.

The Linux kernel on a physical machine doesn't install a guard page
either, so drop it and as such fix the build of "grep".

Signed-off-by: Helge Deller <deller@gmx.de>
Message-Id: <20220924114501.21767-5-deller@gmx.de>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
20 months agolinux-user/hppa: Add signal trampoline for hppa target
Helge Deller [Sat, 24 Sep 2022 11:44:57 +0000 (13:44 +0200)]
linux-user/hppa: Add signal trampoline for hppa target

In Linux kernel v5.18 the vDSO for signal trampoline was added.
This code mimiks the bare minimum of this vDSO and thus avoids that the
parisc emulation needs executable stacks.

Signed-off-by: Helge Deller <deller@gmx.de>
Message-Id: <20220924114501.21767-4-deller@gmx.de>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
20 months agolinux-user: Add proper strace format strings for getdents()/getdents64()
Helge Deller [Sat, 24 Sep 2022 11:44:56 +0000 (13:44 +0200)]
linux-user: Add proper strace format strings for getdents()/getdents64()

Signed-off-by: Helge Deller <deller@gmx.de>
Message-Id: <20220924114501.21767-3-deller@gmx.de>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
20 months agolinux-user: Fix TARGET_PROT_SEM for XTENSA
Helge Deller [Sat, 24 Sep 2022 11:44:55 +0000 (13:44 +0200)]
linux-user: Fix TARGET_PROT_SEM for XTENSA

The xtensa platform has a value of 0x10 for PROT_SEM.

Signed-off-by: Helge Deller <deller@gmx.de>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20220924114501.21767-2-deller@gmx.de>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
20 months agotests/tcg/linux-test: Add linux-madvise test
Ilya Leoshkevich [Tue, 6 Sep 2022 00:08:39 +0000 (02:08 +0200)]
tests/tcg/linux-test: Add linux-madvise test

Add a test that checks madvise(MADV_DONTNEED) behavior with anonymous
and file mappings in order to prevent regressions.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220906000839.1672934-6-iii@linux.ibm.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
20 months agolinux-user: Passthrough MADV_DONTNEED for certain file mappings
Ilya Leoshkevich [Tue, 6 Sep 2022 00:08:38 +0000 (02:08 +0200)]
linux-user: Passthrough MADV_DONTNEED for certain file mappings

This is a follow-up for commit 892a4f6a750a ("linux-user: Add partial
support for MADV_DONTNEED"), which added passthrough for anonymous
mappings. File mappings can be handled in a similar manner.

In order to do that, mark pages, for which mmap() was passed through,
with PAGE_PASSTHROUGH, and then allow madvise() passthrough for these
pages. Drop the explicit PAGE_ANON check, since anonymous mappings are
expected to have PAGE_PASSTHROUGH anyway.

Add PAGE_PASSTHROUGH to PAGE_STICKY in order to keep it on mprotect().

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220725125043.43048-1-iii@linux.ibm.com>
Message-Id: <20220906000839.1672934-5-iii@linux.ibm.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
20 months agolinux-user: Implement stracing madvise()
Ilya Leoshkevich [Tue, 6 Sep 2022 00:08:37 +0000 (02:08 +0200)]
linux-user: Implement stracing madvise()

The default implementation has several problems: the first argument is
not displayed as a pointer, making it harder to grep; the third
argument is not symbolized; and there are several extra unused
arguments.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220906000839.1672934-4-iii@linux.ibm.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
20 months agolinux-user: Fix madvise(MADV_DONTNEED) on alpha
Ilya Leoshkevich [Tue, 6 Sep 2022 00:08:36 +0000 (02:08 +0200)]
linux-user: Fix madvise(MADV_DONTNEED) on alpha

MADV_DONTNEED has a different value on alpha, compared to all the other
architectures. Fix by using TARGET_MADV_DONTNEED instead of
MADV_DONTNEED.

Fixes: 892a4f6a750a ("linux-user: Add partial support for MADV_DONTNEED")
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220906000839.1672934-3-iii@linux.ibm.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
20 months agolinux-user: Provide MADV_* definitions
Ilya Leoshkevich [Tue, 6 Sep 2022 00:08:35 +0000 (02:08 +0200)]
linux-user: Provide MADV_* definitions

Provide MADV_* definitions using target_mman.h header, similar to what
kernel does. Most architectures use the same values, with the exception
of alpha and hppa.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220906000839.1672934-2-iii@linux.ibm.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
20 months agolinux-user: Show timespec on strace for futex()
Helge Deller [Sun, 18 Sep 2022 19:45:53 +0000 (21:45 +0200)]
linux-user: Show timespec on strace for futex()

Signed-off-by: Helge Deller <deller@gmx.de>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20220918194555.83535-11-deller@gmx.de>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
20 months agolinux-user: Add strace for clock_nanosleep()
Helge Deller [Sun, 18 Sep 2022 19:45:52 +0000 (21:45 +0200)]
linux-user: Add strace for clock_nanosleep()

Signed-off-by: Helge Deller <deller@gmx.de>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20220918194555.83535-10-deller@gmx.de>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
20 months agolinux-user/hppa: Set TASK_UNMAPPED_BASE to 0xfa000000 for hppa arch
Helge Deller [Sun, 18 Sep 2022 19:45:51 +0000 (21:45 +0200)]
linux-user/hppa: Set TASK_UNMAPPED_BASE to 0xfa000000 for hppa arch

On the parisc architecture the stack grows upwards.
Move the TASK_UNMAPPED_BASE to high memory area as it's done by the
kernel on physical machines.

Signed-off-by: Helge Deller <deller@gmx.de>
Message-Id: <20220918194555.83535-9-deller@gmx.de>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
20 months agolinux-user: Fix strace of chmod() if mode == 0
Helge Deller [Sun, 18 Sep 2022 19:45:50 +0000 (21:45 +0200)]
linux-user: Fix strace of chmod() if mode == 0

If the mode parameter of chmod() is zero, this value isn't shown
when stracing a program:
    chmod("filename",)
This patch fixes it up to show the zero-value as well:
    chmod("filename",000)

Signed-off-by: Helge Deller <deller@gmx.de>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20220918194555.83535-8-deller@gmx.de>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
20 months agolinux-user/hppa: Dump IIR on register dump
Helge Deller [Sun, 18 Sep 2022 19:45:49 +0000 (21:45 +0200)]
linux-user/hppa: Dump IIR on register dump

Include the IIR register (which holds the opcode of the failing
instruction) when dumping the hppa registers.

Signed-off-by: Helge Deller <deller@gmx.de>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20220918194555.83535-7-deller@gmx.de>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
20 months agolinux-user/hppa: Use EXCP_DUMP() to show enhanced debug info
Helge Deller [Sun, 18 Sep 2022 19:45:48 +0000 (21:45 +0200)]
linux-user/hppa: Use EXCP_DUMP() to show enhanced debug info

Enhance the hppa linux-user cpu_loop() to show more debugging info
on hard errors.

Signed-off-by: Helge Deller <deller@gmx.de>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20220918194555.83535-6-deller@gmx.de>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
20 months agolinux-user: Log failing executable in EXCP_DUMP()
Helge Deller [Sun, 18 Sep 2022 19:45:47 +0000 (21:45 +0200)]
linux-user: Log failing executable in EXCP_DUMP()

Enhance the EXCP_DUMP() macro to print out the failing program too.
During debugging it's sometimes hard to track down the actual failing
program if you are e.g. building a whole debian package.

Signed-off-by: Helge Deller <deller@gmx.de>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20220918194555.83535-5-deller@gmx.de>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
20 months agolinux-user: Add pidfd_open(), pidfd_send_signal() and pidfd_getfd() syscalls
Helge Deller [Sun, 18 Sep 2022 19:45:46 +0000 (21:45 +0200)]
linux-user: Add pidfd_open(), pidfd_send_signal() and pidfd_getfd() syscalls

I noticed those were missing when running the glib2.0 testsuite.
Add the syscalls including the strace output.

Signed-off-by: Helge Deller <deller@gmx.de>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20220918194555.83535-4-deller@gmx.de>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
20 months agolinux-user: Add missing clock_gettime64() syscall strace
Helge Deller [Sun, 18 Sep 2022 19:45:45 +0000 (21:45 +0200)]
linux-user: Add missing clock_gettime64() syscall strace

Allow linux-user to strace the clock_gettime64() syscall.
This syscall is used a lot on 32-bit guest architectures which use newer
glibc versions.

Signed-off-by: Helge Deller <deller@gmx.de>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20220918194555.83535-3-deller@gmx.de>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
20 months agolinux-user: Add missing signals in strace output
Helge Deller [Sun, 18 Sep 2022 19:45:44 +0000 (21:45 +0200)]
linux-user: Add missing signals in strace output

Some of the guest signal numbers are currently not converted to
their representative names in the strace output, e.g. SIGVTALRM.

This patch introduces a smart way to generate and keep in sync the
host-to-guest and guest-to-host signal conversion tables for usage in
the qemu signal and strace code. This ensures that any signals
will now show up in both tables.

There is no functional change in this patch - with the exception that yet
missing signal names now show up in the strace code too.

Signed-off-by: Helge Deller <deller@gmx.de>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20220918194555.83535-2-deller@gmx.de>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
20 months agovirtio: del net client if net_init_tap_one failed
lu zhipeng [Fri, 23 Sep 2022 15:50:46 +0000 (23:50 +0800)]
virtio: del net client if net_init_tap_one failed

If the net tap initializes successful, but failed during
network card hot-plugging, the net-tap will remains,
so cleanup.

Signed-off-by: lu zhipeng <luzhipeng@cestc.cn>
Signed-off-by: Jason Wang <jasowang@redhat.com>
20 months agovdpa: Allow MQ feature in SVQ
Eugenio Pérez [Tue, 6 Sep 2022 15:07:19 +0000 (17:07 +0200)]
vdpa: Allow MQ feature in SVQ

Finally enable SVQ with MQ feature.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
20 months agovirtio-net: Update virtio-net curr_queue_pairs in vdpa backends
Eugenio Pérez [Tue, 6 Sep 2022 15:07:18 +0000 (17:07 +0200)]
virtio-net: Update virtio-net curr_queue_pairs in vdpa backends

It was returned as error before. Instead of it, simply update the
corresponding field so qemu can send it in the migration data.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Acked-by: Si-Wei Liu <si-wei.liu@oracle.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
20 months agovdpa: validate MQ CVQ commands
Eugenio Pérez [Tue, 6 Sep 2022 15:07:17 +0000 (17:07 +0200)]
vdpa: validate MQ CVQ commands

So we are sure we can update the device model properly before sending to
the device.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
20 months agovdpa: Add vhost_vdpa_net_load_mq
Eugenio Pérez [Tue, 6 Sep 2022 15:07:16 +0000 (17:07 +0200)]
vdpa: Add vhost_vdpa_net_load_mq

Same way as with the MAC, restore the expected number of queues at
device's start.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
20 months agovdpa: extract vhost_vdpa_net_load_mac from vhost_vdpa_net_load
Eugenio Pérez [Tue, 6 Sep 2022 15:07:15 +0000 (17:07 +0200)]
vdpa: extract vhost_vdpa_net_load_mac from vhost_vdpa_net_load

Since there may be many commands we need to issue to load the NIC
state, let's split them in individual functions

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
20 months agovdpa: Make VhostVDPAState cvq_cmd_in_buffer control ack type
Eugenio Pérez [Tue, 6 Sep 2022 15:07:14 +0000 (17:07 +0200)]
vdpa: Make VhostVDPAState cvq_cmd_in_buffer control ack type

This allows to simplify the code. Rename to status while we're at it.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>