Compare commits

...
Author SHA1 Message Date
Richard Henderson 698104725e Update version for v10.2.0 release
Signed-off-by: Richard Henderson <[email protected]>
2025-12-23 14:44:07 +11:00
Richard Henderson bb7fc1543f Update version for v10.2.0-rc4 release
Signed-off-by: Richard Henderson <[email protected]>
2025-12-18 06:46:27 +11:00
Richard Henderson 8208694e56 Merge tag 'pull-error-2025-12-17' of https://repo.or.cz/qemu/armbru into staging
Error reporting patches for 2025-12-17

# -----BEGIN PGP SIGNATURE-----
#
# iQJGBAABCAAwFiEENUvIs9frKmtoZ05fOHC0AOuRhlMFAmlCbUQSHGFybWJydUBy
# ZWRoYXQuY29tAAoJEDhwtADrkYZTsFsP/0UmrBVT+q57USh2V0+YJkcWdHiu+qOO
# nVQewpTiKFePbJUF2d7gBuFJKd2m4rcRrAjAR93gSEmn1z8YUkNkynCvkxZ9awMj
# G2fjDFNTu0P9Ypgs1l7zv4VXKqa3L0Fe/SGjpma2ytOAH/sGJ7ziWsKeRsv3V3Fn
# QHp5OlInPWWVRYoLPDhd5Hf1lcs2lcA6t821kFhad8ejlSydiTFeEoAIPyo+yeu/
# U2FvsMJeTLdU3SuI8iO0tuJSI5TmqxmX2wHOP6QUFPAs/reLEtvbH6dCePGTXzLK
# BjJEBxXVAL5aGTWMSA+7j+a85Lzn0wXbWxqdAXYBzHvQaoESmnQUsogUaM1OASJI
# Zoxk89amoDI+oFwQjTbfpjFaSIR0ZsiqTEgeJOOOeJFgpfGwxt2cBDDcfa0qO4YD
# ATpudTJLkyTgLTftAOKC0D8WiOqyVFRbfdUgeysx01tbJAwhJkZ/P5PfTz2zBsq1
# HWYuW4o5tpbeXQbEoFqlvQLj/LvhqM1s49AzOwZoD6A4d1WFKPlaciKbpsGPHely
# lp40XTKDOj/BgpDptcLCH5hetjnZZKdTaNBDMyIM26wBvofuF1yfvm3NtNfCt/yR
# ZRkA0MbK3/YGoZHEHqp3ps53G+mbnzHTbqelsex9W7K2yNzkBENkwzRy0ouFvSAa
# tC7Za9gt7FIe
# =2A+h
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 17 Dec 2025 07:43:48 PM AEDT
# gpg:                using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653
# gpg:                issuer "[email protected]"
# gpg: Good signature from "Markus Armbruster <[email protected]>" [unknown]
# gpg:                 aka "Markus Armbruster <[email protected]>" [unknown]
# gpg: WARNING: The key's User ID is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* tag 'pull-error-2025-12-17' of https://repo.or.cz/qemu/armbru:
  qdev: fix error handling in set_uint64_checkmask

Signed-off-by: Richard Henderson <[email protected]>
2025-12-18 05:10:46 +11:00
Zesen Liu 00829ae384 qdev: fix error handling in set_uint64_checkmask
When specifying lbr_fmt=VALUE in cpu options with an invalid VALUE, error_setg() gets triggered twice, causing an assertion failure in error_setv() which requires *errp to be NULL, preventing meaningful error messages from being displayed.

Fix this by checking visit_type_uint64()'s return value and returning early on failure, consistent with other property setters like set_string().

Fixes: 18c22d7112 (qdev-properties: Add a new macro with bitmask check for uint64_t property)
Cc: [email protected]
Signed-off-by: Zesen Liu <[email protected]>
Message-ID: <[email protected]>
Reviewed-by: Markus Armbruster <[email protected]>
[Add Fixes: and Cc:]
Signed-off-by: Markus Armbruster <[email protected]>
2025-12-17 09:23:38 +01:00
Richard Henderson 7154e4df40 Merge tag 'pull-glibc-20251216' of https://github.com/legoater/qemu into staging
Fix const qualifier build errors with recent glibc

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEEoPZlSPBIlev+awtgUaNDx8/77KEFAmlBXyEACgkQUaNDx8/7
# 7KHemxAAjOKuYG7LCZv6iPd0ezgErAyKuIDstgNn4x3KKA75sfEMJZINwLBaTXcy
# l/DWOoZP3s9ciMJTBY1JdgkbVJ1LDDsf94rTUbZoNjrOocNSXypHNpVbYxuw3Ntf
# vBhQ8gOdR62Ny/2ndmF525L0ir0pGd9lgy9I9fnZ2xQO6QxklInaJjfw8In0+l+t
# mf1sUW8ltSWZs1tWpGaEUKnEyxs2iFYP83yvPSs1O0WAgPSBqPkLIkHp+QJJcdUV
# f5IPfXPWrbgbjkSLyo8EbYwmegTHcXdSEvQxOm3hnSN+0HCMd5oTNcKbjdTaTcgk
# DaUl39PJ09CB24orNMXEZakD7p3lFBVB5Yfr87dDujILTtpPtKAVZMt+X/b0chqj
# g43L3m5pqu34zMWvGDOSgU+8azip11Wy4MG/yWsgMKVXMAPBf3oOunZVkQY/dqeI
# eqX1Hvh7qXHcinuZKAKBefPUqKyoaOKDk3PtUVjW1p4iLC3f5MMOl4SKe8R/hKoe
# xRz+SAcS8TJgrcnaKm1mMUDnqXorHb0IxUYCc/i0CVNJsVclmGI5rwLRMwEDAIIy
# GOfMHMFUhtFzhVC+tbIcAe8QDnrzR6hvxBvEeunZ/lZtTjtlSPyZklRqKEpXjU4i
# ME1Vj6wRIpI9jb5fcJCFy+ZTxQ94c8T8mHsXMfTSWcZzUlFC1/s=
# =rEBR
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 17 Dec 2025 12:31:13 AM AEDT
# gpg:                using RSA key A0F66548F04895EBFE6B0B6051A343C7CFFBECA1
# gpg: Good signature from "Cédric Le Goater <[email protected]>" [full]
# gpg:                 aka "Cédric Le Goater <[email protected]>" [full]

* tag 'pull-glibc-20251216' of https://github.com/legoater/qemu:
  gdbstub: Fix const qualifier build errors with recent glibc
  monitor: Fix const qualifier build errors with recent glibc
  tests/vhost-user-bridge.c: Fix const qualifier build errors with recent glibc
  i386: Fix const qualifier build errors with recent glibc

Signed-off-by: Richard Henderson <[email protected]>
2025-12-17 02:38:19 +11:00
Cédric Le Goater d7e1df7699 gdbstub: Fix const qualifier build errors with recent glibc
A recent change in glibc 2.42.9000 [1] changes the return type of
strstr() and other string functions to be 'const char *' when the
input is a 'const char *'. This breaks the build in :

../gdbstub/user.c:322:21: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
  322 |     pid_placeholder = strstr(path, "%d");
      |                     ^
Fix this by changing the type of the variables that store the result
of these functions to 'const char *'.

[1] https://sourceware.org/git/?p=glibc.git;a=commit;h=cd748a63ab1a7ae846175c532a3daab341c62690

Reviewed-by: Thomas Huth <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Link: https://lore.kernel.org/qemu-devel/[email protected]
Signed-off-by: Cédric Le Goater <[email protected]>
2025-12-16 14:28:30 +01:00
Cédric Le Goater dfe87815ba monitor: Fix const qualifier build errors with recent glibc
A recent change in glibc 2.42.9000 [1] changes the return type of
strchr() and other string functions to be 'const char *' when the
input is a 'const char *'. This breaks the build in :

../monitor/hmp.c:589:7: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
  589 |     p = strchr(type, ':');
      |       ^

Fix this by changing the type of the variables that store the result
of these functions to 'const char *'.

[1] https://sourceware.org/git/?p=glibc.git;a=commit;h=cd748a63ab1a7ae846175c532a3daab341c62690

Reviewed-by: Thomas Huth <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Link: https://lore.kernel.org/qemu-devel/[email protected]
Signed-off-by: Cédric Le Goater <[email protected]>
2025-12-16 14:28:30 +01:00
Cédric Le Goater e37a0d514a tests/vhost-user-bridge.c: Fix const qualifier build errors with recent glibc
A recent change in glibc 2.42.9000 [1] changes the return type of
strstr() and other string functions to be 'const char *' when the
input is a 'const char *'. This breaks the build in :

../tests/vhost-user-bridge.c: In function ‘vubr_parse_host_port’:
../tests/vhost-user-bridge.c:749:15: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
  749 |     char *p = strchr(buf, ':');
      |               ^~~~~~

Fix this by using the glib g_strsplit() routine instead of strdup().

[1] https://sourceware.org/git/?p=glibc.git;a=commit;h=cd748a63ab1a7ae846175c532a3daab341c62690

Suggested-by: Peter Maydell <[email protected]>
Acked-by: Yodel Eldar <[email protected]>
Tested-by: Yodel Eldar <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Link: https://lore.kernel.org/qemu-devel/[email protected]
Signed-off-by: Cédric Le Goater <[email protected]>
2025-12-16 14:28:30 +01:00
Cédric Le Goater 2f5c96d534 i386: Fix const qualifier build errors with recent glibc
A recent change in glibc 2.42.9000 [1] changes the return type of
strstr() and other string functions to be 'const char *' when the
input is a 'const char *'. This breaks the build in :

  ../hw/i386/x86-common.c:827:11: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
  827 |     vmode = strstr(kernel_cmdline, "vga=");
      |           ^

Fix this by changing the type of the variables that store the result
of these functions to 'const char *'.

[1] https://sourceware.org/git/?p=glibc.git;a=commit;h=cd748a63ab1a7ae846175c532a3daab341c62690

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Link: https://lore.kernel.org/qemu-devel/[email protected]
Signed-off-by: Cédric Le Goater <[email protected]>
2025-12-16 14:28:30 +01:00
Richard Henderson 6472244e1b Merge tag 'for-upstream' of https://repo.or.cz/qemu/kevin into staging
Block layer patches

- Fix crash due to BDS use after free during shutdown (in particular
  while migration is running)
- iotests: Fix a typo that made a check to prevent overwriting a file
  ineffective

# -----BEGIN PGP SIGNATURE-----
#
# iQJFBAABCgAvFiEE3D3rFZqa+V09dFb+fwmycsiPL9YFAmlAQOARHGt3b2xmQHJl
# ZGhhdC5jb20ACgkQfwmycsiPL9YNCBAAqoWuOIdybhv44cLtrl3DZWHZnt1XbYvT
# xSUWI9fQQM6WLI1gAHXzl4awsTz0yZzc7KSyYPXdoub3A5D2LoFl4kJKXDzubAwr
# YP1Zmg6UWfaKfxkM42FV07xV8K4kvD11jMTimuYql6uFpzXZILwIPjl10ifdjwYg
# /5c9HUct+y28CdmvFYyt5B0lxJq2VSgLPjqyF7yltzKglirqBcvc1YbMoXfiN4JY
# tSvUHIiiJft839QbG1jrt5spl2xhORP6N7woqlgSiTeGKpPavp9nkWFPZO01QmkU
# la6/vgFZZPCgZOlmt0lVMWy5UsWqKb0voOzi3QvDpGYNie+85JmI4OEOXtsKQvDw
# 7EV+JaMtE72sjO35ruFo1KlapuFbM3yyJ97OpwpRuua1oCRXSyLYQMr5RvDO4rqf
# sdSJw/h+VZ524ydza3d/kj8qlzXkOhEo2WidBQCRRMpI8va4+IcMwHB8ZuthU3LZ
# MfOoEo4XayCQRUhFslHb6Y870Wsi3TxZCZ/fxpWqrCsxz5U5mNyUWoQHVdsofT6j
# WrzeA5ibt1GOC42dif0178PhdowFQHySz1wDbxUEO4yKIo3ziQbH95aUmcT3hYuI
# 17pSQegCA2EOCEzUXdD09qXSotJz7a+aKjiQ3hDxK7a1JokC9O4hvAwSbgOPsxCd
# BbKwOhhsSM4=
# =zBtX
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 16 Dec 2025 04:09:52 AM AEDT
# gpg:                using RSA key DC3DEB159A9AF95D3D7456FE7F09B272C88F2FD6
# gpg:                issuer "[email protected]"
# gpg: Good signature from "Kevin Wolf <[email protected]>" [unknown]
# gpg: WARNING: The key's User ID is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: DC3D EB15 9A9A F95D 3D74  56FE 7F09 B272 C88F 2FD6

* tag 'for-upstream' of https://repo.or.cz/qemu/kevin:
  block: Fix BDS use after free during shutdown
  tests/qemu-iotests: Fix check for existing file in _require_disk_usage()

Signed-off-by: Richard Henderson <[email protected]>
2025-12-16 11:01:52 +11:00
Richard Henderson a69964ff96 Merge tag 'block-pull-request' of https://gitlab.com/stefanha/qemu into staging
Pull request

- Hanna's fix a regression that hangs the userspace NVMe block driver.

# -----BEGIN PGP SIGNATURE-----
#
# iQEzBAABCgAdFiEEhpWov9P5fNqsNXdanKSrs4Grc8gFAmlAIbcACgkQnKSrs4Gr
# c8iuqgf/VV2OPXW2t56uzuUmf+220pnRAaaGLw7atuWmaRJQ8/tHZU23Vxbu7JtX
# ZLJfObJaoGHpCeWCFJ3RccsPabf19hsDIJyki9U6f2+B+OutWLlmcp2uLtQJ8FNw
# 2jMYSuT6XsCnm6VF3UIegDBTh6lvjyjDUVNAsWeiV6wHE61Oj3RD4joif52hx5uE
# xcDPii9fiF8S9tD3CKDGxR8fw7olFXiG2ojxqRZklZuHM6SfFHespWeTr9voLfgL
# maBJO3qyS6YFH1mFuIJvvCykGN2EI6tT1nlQw8et3oUGF+GN45yqLcK12/b7lWKF
# jTE8RCPCswFD4FF3eXJpcZRysi988A==
# =Jx5T
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 16 Dec 2025 01:56:55 AM AEDT
# gpg:                using RSA key 8695A8BFD3F97CDAAC35775A9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <[email protected]>" [unknown]
# gpg:                 aka "Stefan Hajnoczi <[email protected]>" [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: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* tag 'block-pull-request' of https://gitlab.com/stefanha/qemu:
  Revert "nvme: Fix coroutine waking"

Signed-off-by: Richard Henderson <[email protected]>
2025-12-16 11:01:26 +11:00
Kevin Wolf 307bc43095 block: Fix BDS use after free during shutdown
During shutdown, blockdev_close_all_bdrv_states() drops any block node
references that are still owned by the monitor (i.e. the user). However,
in doing so, it forgot to also remove the node from monitor_bdrv_states
(which qmp_blockdev_del() correctly does), which means that later calls
of bdrv_first()/bdrv_next() will still return the (now stale) pointer to
the node.

Usually there is no such call after this point, but in some cases it can
happen. In the reported case, there was an ongoing migration, and the
migration thread wasn't shut down yet: migration_shutdown() called by
qemu_cleanup() doesn't actually wait for the migration to be shut down,
but may just move it to MIGRATION_STATUS_CANCELLING. The next time
migration_iteration_finish() runs, it sees the status and tries to
re-activate all block devices that migration may have previously
inactivated. This is where bdrv_first()/bdrv_next() get called and the
access to the already freed node happens.

It is debatable if migration_shutdown() should really return before
migration has settled, but leaving a dangling pointer in the list of
monitor-owned block nodes is clearly a bug either way and fixing it
solves the immediate problem, so fix it.

Cc: [email protected]
Reported-by: Thomas Huth <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
Message-ID: <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Tested-by: Thomas Huth <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
2025-12-15 17:31:08 +01:00
Hanna Czenczek b002acacc1 Revert "nvme: Fix coroutine waking"
This reverts commit 0f142cbd91.

Said commit changed the replay_bh_schedule_oneshot_event() in
nvme_rw_cb() to aio_co_wake(), allowing the request coroutine to be
entered directly (instead of only being scheduled for later execution).
This can cause the device to become stalled like so:

It is possible that after completion the request coroutine goes on to
submit another request without yielding, e.g. a flush after a write to
emulate FUA.  This will likely cause a nested nvme_process_completion()
call because nvme_rw_cb() itself is called from there.

(After submitting a request, we invoke nvme_process_completion() through
defer_call(); but the fact that nvme_process_completion() ran in the
first place indicates that we are not in a call-deferring section, so
defer_call() will call nvme_process_completion() immediately.)

If this inner nvme_process_completion() loop then processes any
completions, it will write the final completion queue (CQ) head index to
the CQ head doorbell, and subsequently execution will return to the
outer nvme_process_completion() loop.  Even if this loop now finds no
further completions, it still processed at least one completion before,
or it would not have called the nvme_rw_cb() which led to nesting.
Therefore, it will now write the exact same CQ head index value to the
doorbell, which effectively is an unrecoverable error[1].

Therefore, nesting of nvme_process_completion() does not work at this
point.  Reverting said commit removes the nesting (by scheduling the
request coroutine instead of entering it immediately), and so fixes the
stall.

On the downside, reverting said commit breaks multiqueue for nvme, but
better to have single-queue working than neither.  For 11.0, we will
have a solution that makes both work.

A side note: There is a comment in nvme_process_completion() above
qemu_bh_schedule() that claims nesting works, as long as it is done
through the completion_bh.  I am quite sure that is not true, for two
reasons:
- The problem described above, which is even worse when going through
  nvme_process_completion_bh() because that function unconditionally
  writes to the CQ head doorbell,
- nvme_process_completion_bh() never takes q->lock, so
  nvme_process_completion() unlocking it will likely abort.

Given the lack of reports of such aborts, I believe that completion_bh
simply is unused in practice.

[1] See the NVMe Base Specification revision 2.3, page 180, figure 152:
    “Invalid Doorbell Write Value: A host attempted to write an invalid
    doorbell value. Some possible causes of this error are: [...] the
    value written is the same as the previously written doorbell value.”

    To even be notified of this error, we would need to send an
    Asynchronous Event Request to the admin queue (p. 178ff), which we
    don’t do, and then to handle it, we would need to delete and
    recreate the queue (p. 88, section 3.3.1.2 Queue Usage).

Cc: [email protected]
Reported-by: Lukáš Doktor <[email protected]>
Tested-by: Lukáš Doktor <[email protected]>
Signed-off-by: Hanna Czenczek <[email protected]>
Message-id: [email protected]
Signed-off-by: Stefan Hajnoczi <[email protected]>
2025-12-15 09:50:41 -05:00
Thomas Huth ab0065e36a tests/qemu-iotests: Fix check for existing file in _require_disk_usage()
Looks like the "$" has been forgotten here to get the contents of
the FILENAME variable.

Fixes: c49dda7254 ("iotests: Filter out ZFS in several tests")
Signed-off-by: Thomas Huth <[email protected]>
Message-ID: <[email protected]>
Reviewed-by: Laurent Vivier <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Kevin Wolf <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
2025-12-10 17:40:34 +01:00
Richard Henderson 9c23f2a7b0 Update version for v10.2.0-rc3 release
Signed-off-by: Richard Henderson <[email protected]>
2025-12-09 16:44:49 -06:00
Richard Henderson bf0e7b068b Merge tag 'hw-misc-20251209' of https://github.com/philmd/qemu into staging
Misc HW / migration / typo fixes

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEE+qvnXhKRciHc/Wuy4+MsLN6twN4FAmk4gN0ACgkQ4+MsLN6t
# wN6wPw/9EiBPEumIFhsGQZdB4pZZBgjBgOilkazeVaitWwfjhZGWTB6l5O0+aEmH
# jCeK2AAUZEashB/CrGI9irQ8Zli/CGgzV8/pF25AHDnDFyhCwR2czxeVDiZtMmcE
# tOYfjqs57/85r0OiQHHzqgp7w25p/p0Toz5g9GR+7Wu8xFi5SkHVM2gblSViz9ks
# JY+RLnQN4KKessqFKwGJb/m6cnBUWTf3DCscD/j+Crb9OI3WQpz2DsbQaZ06NHR7
# hlPzQ05taMhIqh6OdRAGqGS7Mud+eQ58k9qkYGuSBUkuBoJ/3/EqHJXQ4blZt9IN
# reJ6EtN+xYTT+BGBhIXmAtIVERzyk1MF99hgUZJW0RDuE4Ioa7Omp5bnv82Yensz
# UledFAMrGpX25SlJG2oNGnqZTYnCYoQnRQTB90AlaluJqHSpSgBBoJyfukjKQDVa
# NmL+sJOthonvGsydJP8IYfmcBUC1AzmXFxzN+/xZOSJe1qmSh1kUaehsbyytdd/C
# tgyav8DsvxXR8rfYBX5bSml8pAKL5pSD0DYJD3LCyvRoC0SnYROFU1kaUfMpPA+/
# H1r0RO5Lzkcub1JW253gA89GfrK0Y7ShMtoJ+GBivH/cK+ZYT4uEAZajcgUi5kJJ
# FSWz/sNxOJ03s3CWQhlPOEnkLQ41/1+eqbLpmWceRIAfOmmXE00=
# =vcUd
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 09 Dec 2025 02:04:45 PM CST
# gpg:                using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE
# gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <[email protected]>" [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: FAAB E75E 1291 7221 DCFD  6BB2 E3E3 2C2C DEAD C0DE

* tag 'hw-misc-20251209' of https://github.com/philmd/qemu:
  Revert "hw/net/virtio-net: make VirtIONet.vlans an array instead of a pointer"
  Revert "migration/vmstate: remove VMSTATE_BUFFER_POINTER_UNSAFE macro"
  Fix const qualifier build errors with recent glibc
  scripts/nsis.py: Tell makensis that WoA is 64 bit
  hw/pci: Fix typo in documentation
  migration: Fix order of function arguments
  vhost: Always initialize cached vring data
  scripts: fix broken error path in modinfo-collect.py
  hw/9pfs: Correct typo
  osdep: Undefine FSCALE definition to fix Solaris builds

Signed-off-by: Richard Henderson <[email protected]>
2025-12-09 15:08:46 -06:00
Philippe Mathieu-Daudé efd6b3d176 Revert "hw/net/virtio-net: make VirtIONet.vlans an array instead of a pointer"
Per https://lore.kernel.org/qemu-devel/[email protected]/:

Loading a VM state taken with v10.1.2 or older doesn't work anymore,
using the script [*] we get:

  kvm: VQ 1 size 0x100 < last_avail_idx 0x9 - used_idx 0x3e30
  kvm: load of migration failed: Operation not permitted: error while loading state for instance 0x0 of device '0000:00:13.0/virtio-net': Failed to load element of type virtio for virtio: -1
  qemu-system-x86_64: Missing section footer for 0000:00:13.0/virtio-net
  qemu-system-x86_64: Section footer error, section_id: 41

[*]:

  #!/bin/bash
  rm /tmp/disk.qcow2
  args="
    -netdev type=tap,id=net1,ifname=tap104i1,script=/usr/libexec/qemu-server/pve-bridge,downscript=/usr/libexec/qemu-server/pve-bridgedown,vhost=on
    -device virtio-net-pci,mac=BC:24:11:32:3C:69,netdev=net1,bus=pci.0,addr=0x13,id=net1
    -machine type=pc-i440fx-10.1
  "
  $1/qemu-img create -f qcow2 /tmp/disk.qcow2 1G
  $1/qemu-system-x86_64 --qmp stdio --blockdev qcow2,node-name=node0,file.driver=file,file.filename=/tmp/disk.qcow2 $args <<EOF
  {"execute": "qmp_capabilities"}
  {"execute": "snapshot-save", "arguments": { "job-id": "save0", "tag": "snap", "vmstate": "node0", "devices": ["node0"] } }
  {"execute": "quit"}
  EOF
  $2/qemu-system-x86_64 --qmp stdio --blockdev qcow2,node-name=node0,file.driver=file,file.filename=/tmp/disk.qcow2 $args -loadvm snap

This reverts commit 3a9cd2a4a1.

Reported-by: Fiona Ebner <[email protected]>
Suggested-by: Fiona Ebner <[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
2025-12-09 21:00:15 +01:00
Philippe Mathieu-Daudé 0d42e48c73 Revert "migration/vmstate: remove VMSTATE_BUFFER_POINTER_UNSAFE macro"
Next commit will re-use VMSTATE_BUFFER_POINTER_UNSAFE().

This reverts commit 58341158d0.

Suggested-by: Fiona Ebner <[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
2025-12-09 21:00:15 +01:00
Cédric Le Goater 326e620fc0 Fix const qualifier build errors with recent glibc
A recent change in glibc 2.42.9000 [1] changes the return type of
strstr() and other string functions to be 'const char *' when the
input is a 'const char *'.

This breaks the build in various files with errors such as :

  error: initialization discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
    208 |         char *pidstr = strstr(filename, "%");
        |                        ^~~~~~

Fix this by changing the type of the variables that store the result
of these functions to 'const char *'.

[1] https://sourceware.org/git/?p=glibc.git;a=commit;h=cd748a63ab1a7ae846175c532a3daab341c62690

Signed-off-by: Cédric Le Goater <[email protected]>
Reviewed-by: Laurent Vivier <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-ID: <[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
2025-12-09 21:00:15 +01:00
Stefan Weil e742b7bdc2 scripts/nsis.py: Tell makensis that WoA is 64 bit
This fixes some settings like the default installation path
for the QEMU installation on Windows on ARM (WoA).

Signed-off-by: Stefan Weil <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-ID: <[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
2025-12-09 20:56:14 +01:00
Stefan Weil 4fdff25625 hw/pci: Fix typo in documentation
Signed-off-by: Stefan Weil <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Laurent Vivier <[email protected]>
Message-ID: <[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
2025-12-09 20:56:14 +01:00
Stefan Weil 0bc6fa2446 migration: Fix order of function arguments
This fixes a compiler error when higher warning levels are enabled:

../migration/postcopy-ram.c: In function ‘postcopy_temp_pages_setup’:
../migration/postcopy-ram.c:1483:50: error: ‘g_malloc0_n’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Werror=calloc-transposed-args]
 1483 |     mis->postcopy_tmp_pages = g_malloc0_n(sizeof(PostcopyTmpPage), channels);
      |                                                  ^~~~~~~~~~~~~~~
../migration/postcopy-ram.c:1483:50: note: earlier argument should specify number of elements, later size of each element

Avoid also a related int/unsigned mismatch by fixing the type of
two local variables.

Signed-off-by: Stefan Weil <[email protected]>
Reviewed-by: Laurent Vivier <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-ID: <[email protected]>
[PMD: Replace g_malloc0_n() by g_new0()]
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Acked-by: Peter Xu <[email protected]>
Message-Id: <[email protected]>
2025-12-09 20:56:06 +01:00
Hanna Czenczek 46228925ed vhost: Always initialize cached vring data
vhost_virtqueue_start() can exit early if the descriptor ring address is
0, assuming the virtqueue isn’t ready to start.

In this case, all cached vring information (size, physical address,
pointer) is left as-is.  This is OK at first startup, when that info is
still initialized to 0, but after a reset, it will retain old (outdated)
information.

vhost_virtqueue_start() must make sure these values are (re-)set
properly before exiting.

(When using an IOMMU, these outdated values can stall the device:
vhost_dev_start() deliberately produces an IOMMU miss event for each
used vring.  If used_phys contains an outdated value, the resulting
lookup may fail, forcing the device to be stopped.)

Cc: [email protected]
Signed-off-by: Hanna Czenczek <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-ID: <[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
2025-12-09 20:48:39 +01:00
Denis V. Lunev 8062bfd517 scripts: fix broken error path in modinfo-collect.py
sys.stderr.print is dropped long ago and should not be used. Official
replacement is sys.stderr.write

The problem has been found debugging building on some fancy platform
derived from Debian.

Signed-off-by: Denis V. Lunev <[email protected]>
CC: John Snow <[email protected]>
CC: Cleber Rosa <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-ID: <[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
2025-12-09 20:48:36 +01:00
Alano Song 93332c90bf hw/9pfs: Correct typo
Correct comment typo in xen_9pfs_bh()

Signed-off-by: Alano Song <[email protected]>
Reviewed-by: Christian Schoenebeck <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Message-ID: <[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
2025-12-09 20:42:59 +01:00
Philippe Mathieu-Daudé df3b304605 osdep: Undefine FSCALE definition to fix Solaris builds
Solaris defines FSCALE in <sys/param.h>:

  301 /*
  302  * Scale factor for scaled integers used to count
  303  * %cpu time and load averages.
  304  */
  305 #define FSHIFT  8               /* bits to right of fixed binary point */
  306 #define FSCALE  (1<<FSHIFT)

When emulating the SVE FSCALE instruction, we defines the same name
in decodetree format in target/arm/tcg/sve.decode:

  1129:FSCALE          01100101 .. 00 1001 100 ... ..... .....    @rdn_pg_rm

This leads to a definition clash:

  In file included from ../target/arm/tcg/translate-sve.c:21:
  ../target/arm/tcg/translate.h:875:17: error: pasting "trans_" and "(" does not give a valid preprocessing token
    875 |     static bool trans_##NAME(DisasContext *s, arg_##NAME *a) \
        |                 ^~~~~~
  ../target/arm/tcg/translate-sve.c:4205:5: note: in expansion of macro 'TRANS_FEAT'
   4205 |     TRANS_FEAT(NAME, FEAT, gen_gvec_fpst_arg_zpzz, name##_zpzz_fns[a->esz], a)
        |     ^~~~~~~~~~
  ../target/arm/tcg/translate-sve.c:4249:1: note: in expansion of macro 'DO_ZPZZ_FP'
   4249 | DO_ZPZZ_FP(FSCALE, aa64_sve, sve_fscalbn)
        | ^~~~~~~~~~
  ../target/arm/tcg/translate-sve.c:4249:12: error: expected declaration specifiers or '...' before numeric constant
   4249 | DO_ZPZZ_FP(FSCALE, aa64_sve, sve_fscalbn)
        |            ^~~~~~
  ../target/arm/tcg/translate.h:875:25: note: in definition of macro 'TRANS_FEAT'
    875 |     static bool trans_##NAME(DisasContext *s, arg_##NAME *a) \
        |                         ^~~~
  ../target/arm/tcg/translate-sve.c:4249:1: note: in expansion of macro 'DO_ZPZZ_FP'
   4249 | DO_ZPZZ_FP(FSCALE, aa64_sve, sve_fscalbn)
        | ^~~~~~~~~~
  ../target/arm/tcg/translate.h:875:47: error: pasting "arg_" and "(" does not give a valid preprocessing token
    875 |     static bool trans_##NAME(DisasContext *s, arg_##NAME *a) \
        |                                               ^~~~
  ../target/arm/tcg/translate-sve.c:4205:5: note: in expansion of macro 'TRANS_FEAT'
   4205 |     TRANS_FEAT(NAME, FEAT, gen_gvec_fpst_arg_zpzz, name##_zpzz_fns[a->esz], a)
        |     ^~~~~~~~~~
  ../target/arm/tcg/translate-sve.c:4249:1: note: in expansion of macro 'DO_ZPZZ_FP'
   4249 | DO_ZPZZ_FP(FSCALE, aa64_sve, sve_fscalbn)
        | ^~~~~~~~~~
  In file included from ../target/arm/tcg/translate-sve.c💯
  libqemu-aarch64-softmmu.a.p/decode-sve.c.inc:1227:13: warning: 'trans_FSCALE' used but never defined
   1227 | static bool trans_FSCALE(DisasContext *ctx, arg_FSCALE *a);
        |             ^~~~~~~~~~~~
  ../target/arm/tcg/translate-sve.c:4249:30: warning: 'sve_fscalbn_zpzz_fns' defined but not used [-Wunused-const-variable=]
   4249 | DO_ZPZZ_FP(FSCALE, aa64_sve, sve_fscalbn)
        |                              ^~~~~~~~~~~
  ../target/arm/tcg/translate-sve.c:4201:42: note: in definition of macro 'DO_ZPZZ_FP'
   4201 |     static gen_helper_gvec_4_ptr * const name##_zpzz_fns[4] = { \
        |                                          ^~~~

As a kludge, undefine it globally in <qemu/osdep.h>.

Suggested-by: Richard Henderson <[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-Id: <[email protected]>
2025-12-09 20:42:53 +01:00
Richard Henderson 17313df879 Merge tag 'pull-10.2-more-final-fixes-091225-1' of https://gitlab.com/stsquad/qemu into staging
a few Arm HVF and TCG bug fixes:

  - don't re-use TCG only PSCI code in HVF
  - fix deadlock in HVF when shutting down (#3228)
  - fix corruption of register state from PSCI (#3228)
  - properly prioritise PC alignment faults (#3233)

# -----BEGIN PGP SIGNATURE-----
#
# iQEzBAABCgAdFiEEZoWumedRZ7yvyN81+9DbCVqeKkQFAmk4TeQACgkQ+9DbCVqe
# KkSJJAf/QEn6KTwZ9vBr3wbsXEptvZgjImjDo0ywg+9lxZCqTTfX62HFai9229I/
# ALf3uzO0QwRUzz7peNk4F0tHVCrA1X6jQDezChcFFv2Y+FH+xufK1JbzlroYLdWE
# Jn2bc6pkOCHYvs6X6HIefDUCU9k2LLxH1udpm1DyHEdf19MkI/nb4FIgE2fQ9630
# W/Wv+Bg+s1TeIb9hhJy5jrcbJQ6u/VzIlqrT9PVWe8XLpqJd2Ib+lOZp2mIlQyi4
# /ady0yC1i6hSNZSHDJek6TUMC5Np6HYYyrzGxGuOoVizk9zWPvLoWjx8nxsmG8tB
# jR8BuMJ46hWL9fzL7bJ4PNKHoBF7lg==
# =X9n6
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 09 Dec 2025 10:27:16 AM CST
# gpg:                using RSA key 6685AE99E75167BCAFC8DF35FBD0DB095A9E2A44
# gpg: Good signature from "Alex Bennée (Master Work Key) <[email protected]>" [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: 6685 AE99 E751 67BC AFC8  DF35 FBD0 DB09 5A9E 2A44

* tag 'pull-10.2-more-final-fixes-091225-1' of https://gitlab.com/stsquad/qemu:
  target/arm: handle unaligned PC during tlb probe
  target/arm: make HV_EXIT_REASON_CANCELED leave hvf_arch_vcpu_exec
  target/arm: ensure PSCI register updates are flushed
  Revert "target/arm: Re-use arm_is_psci_call() in HVF"

Signed-off-by: Richard Henderson <[email protected]>
2025-12-09 11:56:07 -06:00
Alex Bennée dd77ef99aa target/arm: handle unaligned PC during tlb probe
PC alignment faults have priority over instruction aborts and we have
code to deal with this in the translation front-ends. However during
tb_lookup we can see a potentially faulting probe which doesn't get a
MemOp set. If the page isn't available this results in
EC_INSNABORT (0x20) instead of EC_PCALIGNMENT (0x22).

As there is no easy way to set the appropriate MemOp in the
instruction fetch probe path lets just detect it in
arm_cpu_tlb_fill_align() ahead of the main alignment check. We also
teach arm_deliver_fault to deliver the right syndrome for
MMU_INST_FETCH alignment issues.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3233
Tested-by: Jessica Clarke <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-ID: <[email protected]>
Signed-off-by: Alex Bennée <[email protected]>
2025-12-09 16:21:56 +00:00
Alex Bennée d100193724 target/arm: make HV_EXIT_REASON_CANCELED leave hvf_arch_vcpu_exec
Without this we can spin tightly in the main HVF dispatch loop and
never release the lock long enough. As a result the HMP never gets to
run and shutting down the system deadlocks.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3228
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-ID: <[email protected]>
Signed-off-by: Alex Bennée <[email protected]>
2025-12-09 16:21:35 +00:00
Alex Bennée 2a425aae0b target/arm: ensure PSCI register updates are flushed
When we handle a host call we report state back to the caller via
registers. Set vcpu_dirty to indicate QEMU is currently the reference
and hoist the flush_cpu_state() and make the call unconditional.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3228
Tested-by: Christian Stussak <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-ID: <[email protected]>
Signed-off-by: Alex Bennée <[email protected]>
2025-12-09 16:21:35 +00:00
Alex Bennée c22e943ea1 Revert "target/arm: Re-use arm_is_psci_call() in HVF"
This breaks a pure HVF (--disable-tcg) build because the fallback stub
will always report false.

This reverts commit 4695daacc0.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Christian Stussak <[email protected]>
Message-ID: <[email protected]>
Signed-off-by: Alex Bennée <[email protected]>
2025-12-09 16:21:35 +00:00
Richard Henderson 2257f52a97 Merge tag 'pull-10.2-final-fixes-051225-2' of https://gitlab.com/stsquad/qemu into staging
Final fixes for 10.2 (gitlab, testing, docker, docs, plugins)

 - drop out of date --disable-pie workaround for aarch64 custom job
 - remove explicit pxe-test from build with no libslirp
 - update the FreeBSD test image
 - don't try and run check-tcg tests we haven't built qemu for
 - skip iotests which need crypto if we haven't got support
 - transition debian-all-test-cross to lcitool
 - update build env documentation to refer to lcitool
 - update MAINTAINERS entry for custom runners
 - ensure discon plugins can read registers
 - fix a bug on uftrace symbol helper script
 - deprecate the fby35 machine

# -----BEGIN PGP SIGNATURE-----
#
# iQEzBAABCgAdFiEEZoWumedRZ7yvyN81+9DbCVqeKkQFAmkzAAsACgkQ+9DbCVqe
# KkSCmAf/e5bJGX4GJhNBV9OwBahjDx0U+oCPUCQwH5E7KgUbvBKMd2e+icgjoPnF
# mAA+SVk1wlqi/EPywqMWIcYTNSwg1ZKkqxQwKnzjlinzshk5Q3Rd8CkIUCDE+i6B
# Cn5HXNMxAHwJZXi2ftOUm2wvb5p4NgahbtKUkEAsYvVWgHF+gQ+1KrpbKze2+Mzk
# 707c2zf0/8mcNl7GZDc7ti6MXEmlejR46UTsKz6u12hGTHjN13UDa+yQXqpot5y7
# blUxwneXo7zdxB6EnGgvArzZQh8o0fOo0zWoC5GDKrbdLIrBVxhXYoWCqgaQv7h7
# v5HhMvzq7obIa+qRnjRzUO68MT1rcw==
# =e46t
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 05 Dec 2025 09:53:47 AM CST
# gpg:                using RSA key 6685AE99E75167BCAFC8DF35FBD0DB095A9E2A44
# gpg: Good signature from "Alex Bennée (Master Work Key) <[email protected]>" [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: 6685 AE99 E751 67BC AFC8  DF35 FBD0 DB09 5A9E 2A44

* tag 'pull-10.2-final-fixes-051225-2' of https://gitlab.com/stsquad/qemu:
  aspeed: Deprecate the fby35 machine
  contrib/plugins/uftrace_symbols.py: unbreak --no-prefix-symbols
  plugins/core: allow reading of registers during discon events
  MAINTAINERS: update the custom runner entries
  docs/devel: Correct typo
  docs/devel: update build environment setup documentation
  tests/docker: drop --disable-[tools|system] from all-test-cross
  tests/docker: transition debian-all-test-cross to lcitool
  tests/lcitool: add bzip2 to the minimal dependency list
  tests/qemu-iotests: Check for a functional "secret" object before using it
  tests/tcg: honour the available QEMU binaries when running check-tcg
  gitlab-ci.d/cirrus: Update the FreeBSD job to v14.3
  gitlab: drop explicit pxe-test from the build-tci job
  gitlab: drop --disable-pie from aarch64-all-linux-static build

Signed-off-by: Richard Henderson <[email protected]>
2025-12-05 12:38:37 -06:00
Richard Henderson 47b6038187 Merge tag 'pull-tcg-20251205' of https://gitlab.com/rth7680/qemu into staging
tcg: fixes for tci
host: fixes for 128-bit atomics

# -----BEGIN PGP SIGNATURE-----
#
# iQFRBAABCgA7FiEEekgeeIaLTbaoWgXAZN846K9+IV8FAmkzBDEdHHJpY2hhcmQu
# aGVuZGVyc29uQGxpbmFyby5vcmcACgkQZN846K9+IV/YMggAgY0+rpQulo7k+fEo
# RP7cLweKSu8aahFvt304qyNGAWlGzBQwJSKWUfFyyMxh6FhO9iEsjkodArjDcK/J
# fou3pz4UmU/feMwVxFuRpCDEEKgpcpxgwj7XJFh96L4VFZ8OrHeuPG5KU5IA/vyy
# eHIzU8M50rejmKCmOL8FDGshWZdXkrgBp3ShIlqlVEb9HpuSFrti0Wh2euVUV67Y
# xG1F4iU5RVNW8OcGz5asLgwaNB7pK/v/FVDxR9rEAoiM9gZhV912fkogmVXTniTk
# rjTYR0k6d49EZ3+M4sUx2v2Nl+6O4wGUFWERU4vHmtUpv1F1UjqxOE3JWDeU2L0c
# 3q9k2Q==
# =M1lm
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 05 Dec 2025 10:11:29 AM CST
# gpg:                using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F
# gpg:                issuer "[email protected]"
# gpg: Good signature from "Richard Henderson <[email protected]>" [ultimate]

* tag 'pull-tcg-20251205' of https://gitlab.com/rth7680/qemu:
  include/aarch64/host: Fix atomic16_fetch_{and,or}
  include/generic/host: Fix atomic128-cas.h.inc for Int128 structure
  tcg/tci: Disable -Wundef FFI_GO_CLOSURES warning
  tcg: Remove duplicate test from plugin_gen_mem_callbacks
  tcg/tci: Introduce INDEX_op_tci_qemu_{ld,st}_rrr
  tcg: Zero extend 32-bit addresses for TCI

Signed-off-by: Richard Henderson <[email protected]>
2025-12-05 10:20:51 -06:00
Cédric Le Goater 704db3e250 aspeed: Deprecate the fby35 machine
There are no functional tests for the 'fby35' machine which makes
harder to determine when something becomes deprecated or unused.

The 'fby35' machine was originally added as an example of a multi-SoC
system, with the expectation the models would evolve over time in an
heterogeneous system. This hasn't happened and no public firmware is
available to boot it. It can be replaced by the 'ast2700fc', another
multi-SoC machine based on the newer AST2700 SoCs which are excepted
to receive better support in the future.

Cc: Peter Delevoryas <[email protected]>
Signed-off-by: Cédric Le Goater <[email protected]>
Message-ID: <[email protected]>
Signed-off-by: Alex Bennée <[email protected]>
2025-12-05 15:37:18 +00:00
Sönke Holz fa2580f574 contrib/plugins/uftrace_symbols.py: unbreak --no-prefix-symbols
Since 8a545a336d, `name` is unbound if --no-prefix-symbols is passed,
causing this script to break when that option is set.

Signed-off-by: Sönke Holz <[email protected]>
Reviewed-by: Pierrick Bouvier <[email protected]>
Message-ID: <[email protected]>
Signed-off-by: Alex Bennée <[email protected]>
2025-12-05 15:26:39 +00:00
Alex Bennée 81c5a3f867 plugins/core: allow reading of registers during discon events
We have protections that prevent callbacks that didn't declare
themselves as wanting to access registers. However for discontinuities
the system state is fully rectified so they should always be able to
read the register values.

a1688bc86c (plugins: add hooks for new discontinuity related callbacks)

Reviewed-by: Pierrick Bouvier <[email protected]>
Cc: Julian Ganz <[email protected]>
Reviewed-by: Julian Ganz <[email protected]>
Message-ID: <[email protected]>
Signed-off-by: Alex Bennée <[email protected]>
2025-12-05 15:26:19 +00:00
Alex Bennée ee6a482e9c MAINTAINERS: update the custom runner entries
Fix a number of issues:

  - update the ubuntu references to 24.0
  - add the s390x and ppc64le yml files
  - replace Works on Arm with Linaro
  - Also mention IBM (s390x) and OSUL (ppc64le) as HW hosts

Reviewed-by: Thomas Huth <[email protected]>
Message-ID: <[email protected]>
Signed-off-by: Alex Bennée <[email protected]>
2025-12-05 15:26:19 +00:00
Alano Song 23a5e2584e docs/devel: Correct typo
Correct typo in atomics.rst

Signed-off-by: Alano Song <[email protected]>
Reviewed-by: Christian Schoenebeck <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
[AJB: fixed author entry]
Message-ID: <[email protected]>
Signed-off-by: Alex Bennée <[email protected]>
2025-12-05 15:26:19 +00:00
Alex Bennée 6f365f185a docs/devel: update build environment setup documentation
Bring `libvirt-ci` front and centre when discussing dependencies for
QEMU. While we are at it:

  - drop links to additional instructions (libvirt is more upto date)
  - compress pkg installs into a table
  - call out distro/upstream dep difference in a proper note

Message-ID: <[email protected]>
Signed-off-by: Alex Bennée <[email protected]>
2025-12-05 15:26:19 +00:00
Alex Bennée 0b50ff0c0a tests/docker: drop --disable-[tools|system] from all-test-cross
We use this container to build system images in CI which do not honour
QEMU_CONFIGURE_OPTS. Drop the --disables from the container so
developers don not need to jump through hoops trying to replicate that
on their workstations.

Reviewed-by: Thomas Huth <[email protected]>
Message-ID: <[email protected]>
Signed-off-by: Alex Bennée <[email protected]>
2025-12-05 15:26:19 +00:00
Alex Bennée 2addcefd69 tests/docker: transition debian-all-test-cross to lcitool
While we are at it bump up to debian-13. As we use this container in
the CI runs this also has the benefit of ensuring our qemu-minimal
dependencies project really has just what we need to build a basic
QEMU.

We add a few extra packages so we can build with clang as well as what
we need to probe for the available cross-compilers in the image.

Message-ID: <[email protected]>
Signed-off-by: Alex Bennée <[email protected]>
2025-12-05 15:26:19 +00:00
Alex Bennée 7cffc86162 tests/lcitool: add bzip2 to the minimal dependency list
You cannot build any softmmu targets without it by default unless you
build with --disable-install-blobs.

Reviewed-by: Thomas Huth <[email protected]>
Message-ID: <[email protected]>
Signed-off-by: Alex Bennée <[email protected]>
2025-12-05 15:26:19 +00:00
Thomas Huth a55d610bac tests/qemu-iotests: Check for a functional "secret" object before using it
QEMU iotests 049, 134 and 158 are currently failing if you compiled
QEMU without the crypto libraries. Thus make sure that the "secret"
object is really usable and skip the tests otherwise.

Reported-by: Alex Bennée <[email protected]>
Signed-off-by: Thomas Huth <[email protected]>
Message-ID: <[email protected]>
Signed-off-by: Alex Bennée <[email protected]>
2025-12-05 15:26:06 +00:00
Alex Bennée 7242e51517 tests/tcg: honour the available QEMU binaries when running check-tcg
Currently configure can identify all the targets that have
cross-compilers available from the supplied target-list. By default
this is the default_target_list which is all possible targets we can
build.

At the same time the target list passed to meson is filtered down
depending on various factors including not building 64 bit targets on
32 bit hosts. As a result make check-tcg will erroneously attempt to
run tests for which we haven't built a QEMU.

Solve this by filtering the final list of TCG_TEST_TARGETS based on
what actually was configured by meson. Rename the variable that
configure spits out to TCG_TESTS_WITH_COMPILERS for clarity and to
avoid larger churn in the Makefile.

Message-ID: <[email protected]>
Signed-off-by: Alex Bennée <[email protected]>
2025-12-05 15:25:51 +00:00
Michael Tokarev 7e71b8e7f2 gitlab-ci.d/cirrus: Update the FreeBSD job to v14.3
The FreeBSD 14.2 job fails since the image disappeared
from the cloud.  We already bumped FreeBSD image to 14.3
in tests/vm in c8958b7eb4 (part of v10.1.0).

Signed-off-by: Michael Tokarev <[email protected]>
Reviewed-by: Alex Bennée <[email protected]>
Tested-by: Alex Bennée <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Message-ID: <[email protected]>
Signed-off-by: Alex Bennée <[email protected]>
2025-12-05 15:25:39 +00:00
Alex Bennée 56a4ba5f88 gitlab: drop explicit pxe-test from the build-tci job
This needs libslirp to run and as debian-all-test-cross will soon be
based on qemu-minimal we won't have it in a few commits.

Reviewed-by: Thomas Huth <[email protected]>
Message-ID: <[email protected]>
Signed-off-by: Alex Bennée <[email protected]>
2025-12-05 15:16:07 +00:00
Alex Bennée ca49625616 gitlab: drop --disable-pie from aarch64-all-linux-static build
Since we have upgraded to 24.04 with its new libc we no longer need
this workaround.

Link: https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1987438
Suggested-by: Michael Tokarev <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Message-ID: <[email protected]>
Signed-off-by: Alex Bennée <[email protected]>
2025-12-05 15:16:07 +00:00
Richard Henderson ff633bc5d5 include/aarch64/host: Fix atomic16_fetch_{and,or}
The tmp[lh] variables were defined as inputs to the
asm rather than outputs, which meant that the compiler
rightly diagnosed uninitialized inputs.

Reported-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2025-12-05 07:50:15 -06:00
Richard Henderson 6833615bfd include/generic/host: Fix atomic128-cas.h.inc for Int128 structure
Use the Int128Alias structure more when we need to convert
between Int128 and __int128_t, when Int128 is a struct.

Fixes the build on aarch64 host with TCI, which forces
the use of the struct.

Reported-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2025-12-05 07:50:15 -06:00
Richard Henderson 8c00f56fca tcg/tci: Disable -Wundef FFI_GO_CLOSURES warning
Since we build TCI with FFI (commit 22f15579fa "tcg: Build ffi data
structures for helpers") we get on Darwin:

  In file included from ../../tcg/tci.c:22:
  In file included from include/tcg/helper-info.h:13:
  /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/ffi/ffi.h:483:5: warning: 'FFI_GO_CLOSURES' is not defined, evaluates to 0 [-Wundef]
    483 | #if FFI_GO_CLOSURES
        |     ^
  1 warning generated.

This was fixed in upstream libffi in 2023, but not backported to MacOSX.
Simply disable the warning locally.

Reported-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2025-12-05 07:50:15 -06:00
Richard Henderson 93fa829344 tcg: Remove duplicate test from plugin_gen_mem_callbacks
All callers have already tested tcg_ctx->plugin_insn.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2025-12-05 07:50:15 -06:00
Richard Henderson 92cf74baf4 tcg/tci: Introduce INDEX_op_tci_qemu_{ld,st}_rrr
Since d182123974, the number of bits in a MemOpIdx tops out at 17.
which won't fit in the TCI rrm format, thus an assertion failure.
Introduce new opcodes that take the MemOpIdx from a register, as
we already do for qemu_ld2 and qemu_st2.

Fixes: d182123974 ("include/exec/memopidx: Adjust for 32 mmu indexes")
Tested-by: Alex Bennée <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2025-12-05 07:50:15 -06:00
Richard Henderson 41706d3e72 tcg: Zero extend 32-bit addresses for TCI
For native code generation, zero-extending 32-bit addresses for
the slow path helpers happens in tcg_out_{ld,st}_helper_args,
but there isn't really a slow path for TCI, so that didn't happen.

Make the extension for TCI explicit in the opcode stream,
much like we already do for plugins and atomic helpers.

Cc: [email protected]
Fixes: 24e46e6c9d ("accel/tcg: Widen tcg-ldst.h addresses to uint64_t")
Signed-off-by: Richard Henderson <[email protected]>
2025-12-05 07:50:15 -06:00
Richard Henderson 864814f71b Merge tag 'for-upstream' of https://repo.or.cz/qemu/kevin into staging
Block layer patches

- SCSI passthrough: Fix errors on temporarily suspended dm-multipath

# -----BEGIN PGP SIGNATURE-----
#
# iQJFBAABCgAvFiEE3D3rFZqa+V09dFb+fwmycsiPL9YFAmkxxnERHGt3b2xmQHJl
# ZGhhdC5jb20ACgkQfwmycsiPL9YH0Q//QWDBVYFM+3+OW2cXXj9BmWS1xEUmq4L2
# DVkOOOHx2U7SxRvSlCo+4l9Lo4P3+tHimm+ApqEgWES4MOGZG1qCE1gnfA6tvNaR
# qkq67DoZ9VShiP5FQwyhXkAUm4cPHFFb8ZIpqc8sH1LGxcoA7hq7bI32RzGsiE3U
# pyOD+11z4ARQYqU/YRF8fKqTqwudhgVSIJInBcUCYzuIaUjxl4ZjHxvjRdFMQc2F
# OIhJVNAOJ4cpvPspmAmTrwKFU81xjX6ymIqHenjX+ZJ3QtSLtuPaDDYJdGmXu8F9
# Me9OMnZfP4lu4I6L5kO2JpVAnzHppUSUsJcescs1q+dsqhGCR+tPgPUsYCmMlro5
# yoMIxCdAX7aAWI2wjg4TjYrYNI3FRB9+IL2qqHvW2cthkA6C6Ef+/26EIEkMGzsN
# rAqyjHa8Bo64JPdW8PUyeg+N27qf9ZwSut8KFR/++hM+sHbm2SImSgqJ+WepgYKx
# gIzsXGOOeVQUdbCGXfwzhnzGbOLZMg4nUZDTSnHVvNF/JfdJsgxkm//zFll6PJcH
# 3vF7XiA+RoBSea5WiWBaBPWDvDaxsRrkOE/j1GQ/GM8vt6ZK+qplPMBMihXOyfE2
# KS9RwNzhgOAl0XrRpmTVLTLPvZocd9g7XTFiicxIFqJNoMrPNWBSmKEibDMbD5jP
# eo87nHrXS0s=
# =H7YD
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 04 Dec 2025 11:35:45 AM CST
# gpg:                using RSA key DC3DEB159A9AF95D3D7456FE7F09B272C88F2FD6
# gpg:                issuer "[email protected]"
# gpg: Good signature from "Kevin Wolf <[email protected]>" [unknown]
# gpg: WARNING: The key's User ID is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: DC3D EB15 9A9A F95D 3D74  56FE 7F09 B272 C88F 2FD6

* tag 'for-upstream' of https://repo.or.cz/qemu/kevin:
  file-posix: Handle suspended dm-multipath better for SG_IO

Signed-off-by: Richard Henderson <[email protected]>
2025-12-04 13:37:46 -06:00
Kevin Wolf 2c3165a1a6 file-posix: Handle suspended dm-multipath better for SG_IO
When introducing DM_MPATH_PROBE_PATHS, we already anticipated that
dm-multipath devices might be suspended for a short time when the DM
tables are reloaded and that they return -EAGAIN in this case. We then
wait for a millisecond and retry.

However, meanwhile it has also turned out that libmpathpersist (which is
used by qemu-pr-helper) may need to perform more complex recovery
operations to get reservations back to expected state if a path failure
happened in the middle of a PR operation. In this case, the device is
suspended for a longer time compared to the case we originally expected.

This patch changes hdev_co_ioctl() to treat -EAGAIN separately so that
it doesn't result in an immediate failure if the device is suspended for
more than 1ms, and moves to incremental backoff to cover both quick and
slow cases without excessive delays.

Buglink: https://issues.redhat.com/browse/RHEL-121543
Signed-off-by: Kevin Wolf <[email protected]>
Message-ID: <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
2025-12-04 18:34:15 +01:00
Richard Henderson 1053bb627c Merge tag 'pull-vfio-20251203' of https://github.com/legoater/qemu into staging
vfio queue:

* Fix vfio-user issues reported by Coverity
* Update vfio-user documentation

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEEoPZlSPBIlev+awtgUaNDx8/77KEFAmkwTlYACgkQUaNDx8/7
# 7KH1zQ/9F0aJd70NcJnJ/RDzFf1bKPxzZ+EzIhlU2nhXPL9T5ewaYqf03+Rbir4J
# 0xckidngEmRqcH/L/A5tD1hxuu14i5yOHmuAO3RC7K1pC/lWT4ifqMDihFByRuNb
# 4LsQn4qEaZ8FGFQ8GszyjW4Dgeee3Xf+glt8BlP08ZFdJM7SHHFFGt75jWBMV2If
# gqYcDe/0iGKTI86If8UGfWLzqiW5LlEpsK/3NVHhDXgLEFxdF4km+XVyZoc0nzwt
# 3ezuKBUTtt1MAtgqTbL7HRlwOK4ui0SN+s6dDAc15HcS9VczFprVYfxeR1k172oJ
# 0ofSgjFjDQTGPZYSk1V2LZ+0uYsU8dn8MI3rlmBG44ABqNzQA7Tj+QCkAuaPbYA6
# iyTqQa2gui8pH7X7dj0MUXn8URBRHKYY/WuajTpvSsFsIRbXi13CXYhyYvR9+yoB
# PvTBjIsmVxFXdDg0yxZbhhRwHvRmlpgR78Aif5Jps7c6mppSL8i4e2PPmchVzTj2
# e/W8ASkvyDyeiBG5qhdsv2bagZGKEBab3PSmmIyq3sJ0OmtOj9L3mdZ5r66c+SiA
# QmtA5BIoj5K9LwOxTgEfBAzIQ8lMpMaBjS5jZbSGKklH343kDtSg8d3PGCym5SrN
# 3cUkU/PzhZX0YA6ywloodsQKgCwE6xbOK3LAbHwv8wcKQyHLkf4=
# =9ERW
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 03 Dec 2025 08:51:02 AM CST
# gpg:                using RSA key A0F66548F04895EBFE6B0B6051A343C7CFFBECA1
# gpg: Good signature from "Cédric Le Goater <[email protected]>" [full]
# gpg:                 aka "Cédric Le Goater <[email protected]>" [full]

* tag 'pull-vfio-20251203' of https://github.com/legoater/qemu:
  vfio-user: recycle msg on failure
  vfio-user: simplify vfio_user_recv_one()
  vfio-user: refactor out header handling
  vfio-user: clarify partial message handling
  vfio-user: simplify vfio_user_process()
  docs/interop/vfio-user: update protocol specification

Signed-off-by: Richard Henderson <[email protected]>
2025-12-04 10:45:41 -06:00
John Levon 23c586abf2 vfio-user: recycle msg on failure
If we fail to read an incoming request, recycle the message.

Resolves: Coverity CID 1611807
Resolves: Coverity CID 1611808
Signed-off-by: John Levon <[email protected]>
Reviewed-by: Mark Cave-Ayland <[email protected]>
Link: https://lore.kernel.org/qemu-devel/[email protected]
Signed-off-by: Cédric Le Goater <[email protected]>
2025-12-03 15:07:47 +01:00
John Levon 0df8baec95 vfio-user: simplify vfio_user_recv_one()
This function was unnecessarily difficult to understand due to the
separate handling of request and reply messages. Use common code for
both where we can.

Signed-off-by: John Levon <[email protected]>
Reviewed-by: Mark Cave-Ayland <[email protected]>
Link: https://lore.kernel.org/qemu-devel/[email protected]
Signed-off-by: Cédric Le Goater <[email protected]>
2025-12-03 15:07:47 +01:00
John Levon 7b884e2a27 vfio-user: refactor out header handling
Simplify vfio_user_recv_one() by moving the header handling out to a
helper function.

Signed-off-by: John Levon <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Link: https://lore.kernel.org/qemu-devel/[email protected]
Signed-off-by: Cédric Le Goater <[email protected]>
2025-12-03 15:07:47 +01:00
John Levon 356c7b1752 vfio-user: clarify partial message handling
Improve a comment for this.

Signed-off-by: John Levon <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Reviewed-by: Mark Cave-Ayland <[email protected]>
Link: https://lore.kernel.org/qemu-devel/[email protected]
Signed-off-by: Cédric Le Goater <[email protected]>
2025-12-03 15:07:47 +01:00
John Levon a8731f691d vfio-user: simplify vfio_user_process()
It can figure out if it's a reply by itself, rather than passing that
information in.

Signed-off-by: John Levon <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Reviewed-by: Mark Cave-Ayland <[email protected]>
Link: https://lore.kernel.org/qemu-devel/[email protected]
Signed-off-by: Cédric Le Goater <[email protected]>
2025-12-03 15:07:47 +01:00
John Levon 1f3b34e403 docs/interop/vfio-user: update protocol specification
Refresh the protocol specification to the latest version implemented by
libvfio-user. All changes are backward compatible.

Note that QEMU client itself does not yet implement these extensions,
but as this is now the canonical specification, it needs to be kept up
to date.

Signed-off-by: John Levon <[email protected]>
Link: https://lore.kernel.org/qemu-devel/[email protected]
Signed-off-by: Cédric Le Goater <[email protected]>
2025-12-03 15:07:47 +01:00
Richard Henderson 05f36f7c05 Update version for v10.2.0-rc2 release
Signed-off-by: Richard Henderson <[email protected]>
2025-12-02 20:09:51 -08:00
Richard Henderson 423ac96729 Merge tag 'pull-error-2025-12-02' of https://repo.or.cz/qemu/armbru into staging
Error reporting patches for 2025-12-02

# -----BEGIN PGP SIGNATURE-----
#
# iQJGBAABCAAwFiEENUvIs9frKmtoZ05fOHC0AOuRhlMFAmkunlkSHGFybWJydUBy
# ZWRoYXQuY29tAAoJEDhwtADrkYZTXQUP+QHhID4XE1DuYaGeE2WaLH6JBf4LuNGZ
# ReZjDtRR8imt2qwUJ9oxp2RQ1SCwnKFMKYsHnfA/DzCRw1tQNMeiwaWNFpGn/X5I
# m9Xrkh3Xr2BAK6NP+0LjrkfFSQ8ybj2tAe/MUPlpyt0Ig3OMwek6qbp8yEax4BKD
# UdKAjYn86CXfcthRa95NZ/aktcL+lYs00jRE/yKtL37cY4HvyzTVI+KP1KBPEtLR
# tcg42/nsbcv3UJrMQDovopP8XbuTKAX+ed9mIw6pEaQSZ8ktiaiX6Dc1IbfUnDPL
# ZHKSqqtr9TWvIST8NDuIglo4X+1grnHP/7742ZNANiGmHqM4s+I6nNfSR94HF9YR
# c69iu9jsbEBk4t6RellgrM+zPjOQi+EPeXyHghjO179KdjYvJFNOwI9lgiE6GZiV
# 5eZX3BKYiylxkKAbKIsNQn71PCLdLhMjk0OB03+kX16Z9vrNm37cyR6L9mHlEjk8
# u+e+dv8bjDPqD467hSw8Cf1Z9wSugjzt4I6+5OnqPFPYONzBTrpESH7XtWwgZyKK
# Tcr2DB/S7JWgZz8EIUWo41frNdTZsjNwLHbODHtv/KkPA5vlCLkHbz/vPxUcrobo
# atMXFNx9NazKtrOOpfc9pioCEpDNXLlfEJ8jbE+pIAwHDvuedSaXjvTicIAwQ6qA
# Bojn8eZPwWP2
# =OrYZ
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 02 Dec 2025 12:07:53 AM PST
# gpg:                using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653
# gpg:                issuer "[email protected]"
# gpg: Good signature from "Markus Armbruster <[email protected]>" [unknown]
# gpg:                 aka "Markus Armbruster <[email protected]>" [unknown]
# gpg: WARNING: The key's User ID is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* tag 'pull-error-2025-12-02' of https://repo.or.cz/qemu/armbru:
  kvm: Fix kvm_vm_ioctl() and kvm_device_ioctl() return value
  migration: Fix double-free on error path

Signed-off-by: Richard Henderson <[email protected]>
2025-12-02 04:41:17 -08:00
Richard Henderson 13432ee4c6 Merge tag 'accel-20251201' of https://github.com/philmd/qemu into staging
Accelerators patches queue

- Fix HVF/x86 build

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEE+qvnXhKRciHc/Wuy4+MsLN6twN4FAmkt+X0ACgkQ4+MsLN6t
# wN4YvhAApOrEtlWbMrUIeeHTc8bHMGPi62IEITR299NTtI9vTJLFMq0+tyvUBVLx
# QA2yX0sRmEnlVwIgCA6f4hTYEuoFrSkpOzK3Qojs1tO488m9GymWPMwnUcNEhH9a
# ny7csR01m5rS2Jb6dV3pY8oMddwrVyT5n9rzdi65a6Sq6RAYvMcl0mbYM163qMNY
# nPBj9PnRG3QFk0/YqBpQ9uhjMXw/s8wVYQ4eJI87rWB7QqBPeiFQTyAG4MicATQM
# 06LYinS4ZGUSQoRUNr3oKa6dtvI11C+JUql2mUPnZfT1muebF6EbzeQ7tTE7Vds2
# /fqRO3dBlyePipbgkFH1/PpKoRKMv9GDVcOpjebtKIBlxH+II0ps7c2GMNbOFNuu
# HBHcJOAxKGLrcj5PembcGNJlSzzta8UJixlJ5JBXwgjd9qr8QaNeq2XbJ1gBpRiy
# qjZi4vbG5dW2cfcgjeRDKBw188Lh26QxkKjWiTaREXjW4AJttexvDuzXaSPCc2aI
# 2fAKqclZNCCOfHymJSpAhgKMOlmXRmoTeZX2+mszRZJVt3zp2MR2pjn5ihR7L8wc
# fes7XjF/GngdbSryLDt3I/N8pNgxZZVQ1qWS/Qxi6m7D5xWPR7FBkDhk47+miNfr
# QulbRWGSC3AyE3Agy1Hfj0s6zi1tZ0D4lmU9VY/ucFWWxCSt1SQ=
# =QV0k
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon 01 Dec 2025 12:24:29 PM PST
# gpg:                using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE
# gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <[email protected]>" [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: FAAB E75E 1291 7221 DCFD  6BB2 E3E3 2C2C DEAD C0DE

* tag 'accel-20251201' of https://github.com/philmd/qemu:
  accel/hvf: Fix i386 HVF compilation failures

Signed-off-by: Richard Henderson <[email protected]>
2025-12-02 04:40:54 -08:00
Markus Armbruster 88be119fb1 kvm: Fix kvm_vm_ioctl() and kvm_device_ioctl() return value
These functions wrap ioctl().  When ioctl() fails, it sets @errno.
The wrappers then return that @errno negated.

Except they call accel_ioctl_end() between calling ioctl() and reading
@errno.  accel_ioctl_end() can clobber @errno, e.g. when a futex()
system call fails.  Seems unlikely, but it's a bug all the same.

Fix by retrieving @errno before calling accel_ioctl_end().

Fixes: a27dd2de68 (KVM: keep track of running ioctls)
Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-ID: <[email protected]>
2025-12-02 07:46:21 +01:00
Markus Armbruster c1116b1d73 migration: Fix double-free on error path
Fixes: ffaa1b50a8 (migration: Use warn_reportf_err() where appropriate)
Resolves: Coverity CID 1643463
Signed-off-by: Markus Armbruster <[email protected]>
Message-ID: <[email protected]>
Acked-by: Peter Xu <[email protected]>
2025-12-02 07:45:45 +01:00
Nguyen Dinh Phi 3bee93b9ab accel/hvf: Fix i386 HVF compilation failures
Recent changes introduced build errors in the i386 HVF backend:

 - ../accel/hvf/hvf-accel-ops.c:163:17: error: no member named 'guest_debug_enabled' in 'struct AccelCPUState'
   163 |     cpu->accel->guest_debug_enabled = false;

 - ../accel/hvf/hvf-accel-ops.c:151:51
   error: no member named 'unblock_ipi_mask' in 'struct AccelCPUState'

 - ../target/i386/hvf/hvf.c:736:5
   error: use of undeclared identifier 'rip'

 - ../target/i386/hvf/hvf.c:737:5
   error: use of undeclared identifier 'env'

This patch corrects the field usage and move identifier to correct
function ensuring successful compilation of the i386 HVF backend.

These issues were caused by:

Fixes: 2ad756383e (“accel/hvf: Restrict ARM-specific fields of AccelCPUState”)
Fixes: 2a21c92447 (“target/i386/hvf: Factor hvf_handle_vmexit() out”)

Signed-off-by: Nguyen Dinh Phi <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <[email protected]>
[PMD: Keep setting vcpu_dirty on AArch64]
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Nguyen Dinh Phi <[email protected]>
Message-Id: <[email protected]>
2025-12-01 21:21:16 +01:00
Richard Henderson 66ec38b6fa Merge tag 'pull-target-arm-20251201' of https://gitlab.com/pm215/qemu into staging
target-arm queue:
 * fix assertion in translation of BRA
 * update soon-to-break URL in docs

# -----BEGIN PGP SIGNATURE-----
#
# iQJNBAABCAA3FiEE4aXFk81BneKOgxXPPCUl7RQ2DN4FAmktvZIZHHBldGVyLm1h
# eWRlbGxAbGluYXJvLm9yZwAKCRA8JSXtFDYM3oXTD/9xAonxt5RnYxHZI1R5MjKV
# BbK+SuxgF6muimBU0J+bL/rEK6+J6FKupOxb/GgSB3Mxb9TQVw4GmKIvOyWrx4vF
# YvFFAngJOd4SPqk4HzAssODyxtl0VOr8pdtQlPlH0Irr0Wv6zv3/1YbwMFjq1LMG
# MQP8ZGsl+eOHlqF9xrDeHzpzwF+RzXBzCB88c+4pMluAWRz2eaotk8NorP+iDWuH
# ZX3SOOPc03xhdT3EZABHidrZxObevKfV7PMeKrtOgjwcXF9BfiW8bvn1U5jo7u7D
# WnxrMGqLjotLykIThRJyt4jf89XzkRSSwlgKHXPuohNsZCJdozNoiuKw07Woufsg
# 2xYRDtXDGmOF2utek5p6ejOXT7zg+jbdvZ9kdTW3dpa0BGtV93WeAr7z7onOmaxL
# S3Ri6aT1PKwFK1wRNnbuoS/plrTfH4PG9HXLRImNUGg1DsCmqte9vblZyP7g3mQT
# BmXLnel7nwL9Q7XIzGUcHhv2R6EFOspZueUmF8NsOtJSgq5q1JV2itRNmfELBy+r
# NJKKozazl+1XttB3cCsOQjgRQfTA4H3BGip0U0iPPjd3rSX0hunyhdk+WBXiAJJJ
# pU2fcHLu0M2NFlgLYvWXwf7WgNQV5jqBZ7IxuU/ERjvfOTOJYsFAjCbVOq7eIqmR
# EJolrloUG74w68K44PUHvQ==
# =VFmC
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon 01 Dec 2025 08:08:50 AM PST
# gpg:                using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE
# gpg:                issuer "[email protected]"
# gpg: Good signature from "Peter Maydell <[email protected]>" [unknown]
# gpg:                 aka "Peter Maydell <[email protected]>" [unknown]
# gpg:                 aka "Peter Maydell <[email protected]>" [unknown]
# gpg:                 aka "Peter Maydell <[email protected]>" [unknown]
# gpg: WARNING: The key's User ID is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83  15CF 3C25 25ED 1436 0CDE

* tag 'pull-target-arm-20251201' of https://gitlab.com/pm215/qemu:
  docs/devel: Update URL for make-pullreq script
  target/arm: Fix assert on BRA.

Signed-off-by: Richard Henderson <[email protected]>
2025-12-01 12:08:52 -08:00
Peter Maydell ebb625262c docs/devel: Update URL for make-pullreq script
In the submitting-a-pull-request docs, we have a link to the
make-pullreq script which might be useful for maintainers.  The
canonical git repo for this script has moved; update the link.

Cc: [email protected]
Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Message-id: [email protected]
2025-12-01 09:39:46 +00:00
Harald van Dijk 7248dab3c9 target/arm: Fix assert on BRA.
trans_BRA does

    gen_a64_set_pc(s, dst);
    set_btype_for_br(s, a->rn);

gen_a64_set_pc does

    s->pc_save = -1;

set_btype_for_br (if aa64_bti is enabled and the register is not x16 or
x17) does

    gen_pc_plus_diff(s, pc, 0);

gen_pc_plus_diff does

    assert(s->pc_save != -1);

Hence, this assert is getting hit. We need to call set_btype_for_br
before gen_a64_set_pc, and there is nothing in set_btype_for_br that
depends on gen_a64_set_pc having already been called, so this commit
simply swaps the calls.

(The commit message for 64678fc45d says that set_brtype_for_br()
must be "moved after" get_a64_set_pc(), but this is a mistake in
the commit message -- the actual changes in that commit move
set_brtype_for_br() *before* get_a64_set_pc() and this is necessary
to avoid the assert.)

Cc: [email protected]
Fixes: 64678fc45d ("target/arm: Fix BTI versus CF_PCREL")
Signed-off-by: Harald van Dijk <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: [email protected]
[PMM: added note about 64678fc45d to commit message]
Signed-off-by: Peter Maydell <[email protected]>
2025-12-01 09:36:40 +00:00
62 changed files with 1191 additions and 406 deletions

No files matched your search

+1 -3
View File
@@ -656,14 +656,12 @@ build-tci:
--target-list="$(for tg in $TARGETS; do echo -n ${tg}'-softmmu '; done)"
|| { cat config.log meson-logs/meson-log.txt && exit 1; }
- make -j"$JOBS"
- make tests/qtest/boot-serial-test tests/qtest/cdrom-test tests/qtest/pxe-test
- make tests/qtest/boot-serial-test tests/qtest/cdrom-test
- for tg in $TARGETS ; do
export QTEST_QEMU_BINARY="./qemu-system-${tg}" ;
./tests/qtest/boot-serial-test || exit 1 ;
./tests/qtest/cdrom-test || exit 1 ;
done
- QTEST_QEMU_BINARY="./qemu-system-x86_64" ./tests/qtest/pxe-test
- QTEST_QEMU_BINARY="./qemu-system-s390x" ./tests/qtest/pxe-test -m slow
- make check-tcg
# Check our reduced build configurations
+1 -1
View File
@@ -37,7 +37,7 @@ x64-freebsd-14-build:
NAME: freebsd-14
CIRRUS_VM_INSTANCE_TYPE: freebsd_instance
CIRRUS_VM_IMAGE_SELECTOR: image_family
CIRRUS_VM_IMAGE_NAME: freebsd-14-2
CIRRUS_VM_IMAGE_NAME: freebsd-14-3
CIRRUS_VM_CPUS: 8
CIRRUS_VM_RAM: 8G
UPDATE_COMMAND: pkg update; pkg upgrade -y
@@ -41,9 +41,7 @@
ubuntu-24.04-aarch64-all-linux-static:
extends: .ubuntu_aarch64_template
variables:
# Disable -static-pie due to build error with system libc:
# https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1987438
CONFIGURE_ARGS: --enable-debug --static --disable-system --disable-pie
CONFIGURE_ARGS: --enable-debug --static --disable-system
MAKE_CHECK_ARGS: check-tcg
ubuntu-24.04-aarch64-all:
+4 -3
View File
@@ -4444,12 +4444,13 @@ R: Philippe Mathieu-Daudé <[email protected]>
S: Maintained
F: tests/tcg/Makefile.target
GitLab custom runner (Works On Arm Sponsored)
GitLab custom runners (HW sponsored by Linaro, OSOUL and IBM)
M: Alex Bennée <[email protected]>
M: Philippe Mathieu-Daudé <[email protected]>
S: Maintained
F: .gitlab-ci.d/custom-runners/ubuntu-22.04-aarch64.yml
F: .gitlab-ci.d/custom-runners/ubuntu-22.04-aarch32.yml
F: .gitlab-ci.d/custom-runners/ubuntu-24.04-aarch64.yml
F: .gitlab-ci.d/custom-runners/ubuntu-24.04-s390x.yml
F: .gitlab-ci.d/custom-runners/debian-13-ppc64le.yml
Documentation
-------------
+1 -1
View File
@@ -1 +1 @@
10.1.91
10.2.0
+2 -3
View File
@@ -148,10 +148,11 @@ static int hvf_init_vcpu(CPUState *cpu)
sigact.sa_handler = dummy_signal;
sigaction(SIG_IPI, &sigact, NULL);
#ifdef __aarch64__
pthread_sigmask(SIG_BLOCK, NULL, &cpu->accel->unblock_ipi_mask);
sigdelset(&cpu->accel->unblock_ipi_mask, SIG_IPI);
cpu->accel->guest_debug_enabled = false;
#ifdef __aarch64__
r = hv_vcpu_create(&cpu->accel->fd,
(hv_vcpu_exit_t **)&cpu->accel->exit, NULL);
#else
@@ -160,8 +161,6 @@ static int hvf_init_vcpu(CPUState *cpu)
assert_hvf_ok(r);
cpu->vcpu_dirty = true;
cpu->accel->guest_debug_enabled = false;
return hvf_arch_init_vcpu(cpu);
}
+2 -2
View File
@@ -3373,10 +3373,10 @@ int kvm_vm_ioctl(KVMState *s, unsigned long type, ...)
trace_kvm_vm_ioctl(type, arg);
accel_ioctl_begin();
ret = ioctl(s->vmfd, type, arg);
accel_ioctl_end();
if (ret == -1) {
ret = -errno;
}
accel_ioctl_end();
return ret;
}
@@ -3413,10 +3413,10 @@ int kvm_device_ioctl(int fd, unsigned long type, ...)
trace_kvm_device_ioctl(fd, type, arg);
accel_ioctl_begin();
ret = ioctl(fd, type, arg);
accel_ioctl_end();
if (ret == -1) {
ret = -errno;
}
accel_ioctl_end();
return ret;
}
+1 -1
View File
@@ -211,7 +211,7 @@ static size_t tpm_passthrough_get_buffer_size(TPMBackend *tb)
static int tpm_passthrough_open_sysfs_cancel(TPMPassthruState *tpm_pt)
{
int fd = -1;
char *dev;
const char *dev;
char path[PATH_MAX];
if (tpm_pt->options->cancel_path) {
+34 -22
View File
@@ -4288,25 +4288,8 @@ hdev_open_Mac_error:
static bool coroutine_fn sgio_path_error(int ret, sg_io_hdr_t *io_hdr)
{
if (ret < 0) {
switch (ret) {
case -ENODEV:
return true;
case -EAGAIN:
/*
* The device is probably suspended. This happens while the dm table
* is reloaded, e.g. because a path is added or removed. This is an
* operation that should complete within 1ms, so just wait a bit and
* retry.
*
* If the device was suspended for another reason, we'll wait and
* retry SG_IO_MAX_RETRIES times. This is a tolerable delay before
* we return an error and potentially stop the VM.
*/
qemu_co_sleep_ns(QEMU_CLOCK_REALTIME, 1000000);
return true;
default:
return false;
}
/* Path errors sometimes result in -ENODEV */
return ret == -ENODEV;
}
if (io_hdr->host_status != SCSI_HOST_OK) {
@@ -4375,6 +4358,7 @@ hdev_co_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
{
BDRVRawState *s = bs->opaque;
RawPosixAIOData acb;
uint64_t eagain_sleep_ns = 1 * SCALE_MS;
int retries = SG_IO_MAX_RETRIES;
int ret;
@@ -4403,9 +4387,37 @@ hdev_co_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
},
};
do {
ret = raw_thread_pool_submit(handle_aiocb_ioctl, &acb);
} while (req == SG_IO && retries-- && hdev_co_ioctl_sgio_retry(&acb, ret));
retry:
ret = raw_thread_pool_submit(handle_aiocb_ioctl, &acb);
if (req == SG_IO && s->use_mpath) {
if (ret == -EAGAIN && eagain_sleep_ns < NANOSECONDS_PER_SECOND) {
/*
* If this is a multipath device, it is probably suspended.
*
* This can happen while the dm table is reloaded, e.g. because a
* path is added or removed. This is an operation that should
* complete within 1ms, so just wait a bit and retry.
*
* There are also some cases in which libmpathpersist must recover
* from path failure during its operation, which can leave the
* device suspended for a bit longer while the library brings back
* reservations into the expected state.
*
* Use increasing delays to cover both cases without waiting
* excessively, and stop after a bit more than a second (1023 ms).
* This is a tolerable delay before we return an error and
* potentially stop the VM.
*/
qemu_co_sleep_ns(QEMU_CLOCK_REALTIME, eagain_sleep_ns);
eagain_sleep_ns *= 2;
goto retry;
}
/* Even for ret == 0, the SG_IO header can contain an error */
if (retries-- && hdev_co_ioctl_sgio_retry(&acb, ret)) {
goto retry;
}
}
return ret;
}
+27 -29
View File
@@ -1200,36 +1200,26 @@ fail:
typedef struct {
Coroutine *co;
bool skip_yield;
int ret;
AioContext *ctx;
} NVMeCoData;
static void nvme_rw_cb_bh(void *opaque)
{
NVMeCoData *data = opaque;
qemu_coroutine_enter(data->co);
}
/* Put into NVMeRequest.cb, so runs in the BDS's main AioContext */
static void nvme_rw_cb(void *opaque, int ret)
{
NVMeCoData *data = opaque;
data->ret = ret;
if (data->co == qemu_coroutine_self()) {
/*
* Fast path: We are inside of the request coroutine (through
* nvme_submit_command, nvme_deferred_fn, nvme_process_completion).
* We can set data->skip_yield here to keep the coroutine from
* yielding, and then we don't need to schedule a BH to wake it.
*/
data->skip_yield = true;
} else {
/*
* Safe to call: The case where we run in the request coroutine is
* handled above, so we must be independent of it; and without
* skip_yield set, the coroutine will yield.
* No need to release NVMeQueuePair.lock (we are called without it
* held). (Note: If we enter the coroutine here, @data will
* probably be dangling once aio_co_wake() returns.)
*/
aio_co_wake(data->co);
if (!data->co) {
/* The rw coroutine hasn't yielded, don't try to enter. */
return;
}
replay_bh_schedule_oneshot_event(data->ctx, nvme_rw_cb_bh, data);
}
static coroutine_fn int nvme_co_prw_aligned(BlockDriverState *bs,
@@ -1253,7 +1243,7 @@ static coroutine_fn int nvme_co_prw_aligned(BlockDriverState *bs,
.cdw12 = cpu_to_le32(cdw12),
};
NVMeCoData data = {
.co = qemu_coroutine_self(),
.ctx = bdrv_get_aio_context(bs),
.ret = -EINPROGRESS,
};
@@ -1270,7 +1260,9 @@ static coroutine_fn int nvme_co_prw_aligned(BlockDriverState *bs,
return r;
}
nvme_submit_command(ioq, req, &cmd, nvme_rw_cb, &data);
if (!data.skip_yield) {
data.co = qemu_coroutine_self();
while (data.ret == -EINPROGRESS) {
qemu_coroutine_yield();
}
@@ -1366,7 +1358,7 @@ static coroutine_fn int nvme_co_flush(BlockDriverState *bs)
.nsid = cpu_to_le32(s->nsid),
};
NVMeCoData data = {
.co = qemu_coroutine_self(),
.ctx = bdrv_get_aio_context(bs),
.ret = -EINPROGRESS,
};
@@ -1374,7 +1366,9 @@ static coroutine_fn int nvme_co_flush(BlockDriverState *bs)
req = nvme_get_free_req(ioq);
assert(req);
nvme_submit_command(ioq, req, &cmd, nvme_rw_cb, &data);
if (!data.skip_yield) {
data.co = qemu_coroutine_self();
if (data.ret == -EINPROGRESS) {
qemu_coroutine_yield();
}
@@ -1415,7 +1409,7 @@ static coroutine_fn int nvme_co_pwrite_zeroes(BlockDriverState *bs,
};
NVMeCoData data = {
.co = qemu_coroutine_self(),
.ctx = bdrv_get_aio_context(bs),
.ret = -EINPROGRESS,
};
@@ -1435,7 +1429,9 @@ static coroutine_fn int nvme_co_pwrite_zeroes(BlockDriverState *bs,
assert(req);
nvme_submit_command(ioq, req, &cmd, nvme_rw_cb, &data);
if (!data.skip_yield) {
data.co = qemu_coroutine_self();
while (data.ret == -EINPROGRESS) {
qemu_coroutine_yield();
}
@@ -1463,7 +1459,7 @@ static int coroutine_fn nvme_co_pdiscard(BlockDriverState *bs,
};
NVMeCoData data = {
.co = qemu_coroutine_self(),
.ctx = bdrv_get_aio_context(bs),
.ret = -EINPROGRESS,
};
@@ -1508,7 +1504,9 @@ static int coroutine_fn nvme_co_pdiscard(BlockDriverState *bs,
trace_nvme_dsm(s, offset, bytes);
nvme_submit_command(ioq, req, &cmd, nvme_rw_cb, &data);
if (!data.skip_yield) {
data.co = qemu_coroutine_self();
while (data.ret == -EINPROGRESS) {
qemu_coroutine_yield();
}
+1 -1
View File
@@ -1089,7 +1089,7 @@ vmdk_open_vmdk4(BlockDriverState *bs, BdrvChild *file, int flags,
static int vmdk_parse_description(const char *desc, const char *opt_name,
char *buf, int buf_size)
{
char *opt_pos, *opt_end;
const char *opt_pos, *opt_end;
const char *end = desc + strlen(desc);
opt_pos = strstr(desc, opt_name);
+1 -1
View File
@@ -1826,7 +1826,7 @@ cluster_was_modified(BDRVVVFATState *s, uint32_t cluster_num)
static const char* get_basename(const char* path)
{
char* basename = strrchr(path, '/');
const char *basename = strrchr(path, '/');
if (basename == NULL)
return path;
else
+1
View File
@@ -686,6 +686,7 @@ void blockdev_close_all_bdrv_states(void)
GLOBAL_STATE_CODE();
QTAILQ_FOREACH_SAFE(bs, &monitor_bdrv_states, monitor_list, next_bs) {
QTAILQ_REMOVE(&monitor_bdrv_states, bs, monitor_list);
bdrv_unref(bs);
}
}
Vendored
+3 -3
View File
@@ -1801,7 +1801,7 @@ if test "$plugins" = "yes" ; then
fi
echo "PYTHON=$python" >> tests/tcg/$config_host_mak
tcg_tests_targets=
tcg_tests_with_compilers=
for target in $target_list; do
arch=${target%%-*}
@@ -1852,12 +1852,12 @@ for target in $target_list; do
fi
echo "run-tcg-tests-$target: $qemu\$(EXESUF)" >> Makefile.prereqs
tcg_tests_targets="$tcg_tests_targets $target"
tcg_tests_with_compilers="$tcg_tests_with_compilers $target"
fi
done
if test "$tcg" = "enabled"; then
echo "TCG_TESTS_TARGETS=$tcg_tests_targets" >> $config_host_mak
echo "TCG_TESTS_WITH_COMPILERS=$tcg_tests_with_compilers" >> $config_host_mak
fi
if test "$skip_meson" = no; then
+2
View File
@@ -98,6 +98,8 @@ class BinaryFile:
size = f'{s.size:{addrx}}'
if prefix_symbols:
name = f'{binary_name}:{s.name}'
else:
name = s.name
print(addr, size, 'T', name, file=sym_file)
def generate_debug_file(self):
+12 -1
View File
@@ -308,13 +308,24 @@ I2C devices connected to the board can be defined via the QEMU command
line.
Arm ``fp5280g2-bmc`` machine (since 10.2)
'''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''
The ``fp5280g2-bmc`` machine does not rely on any specific device
models, it can be replaced by the ``ast2500-evb`` machine using the
``fmc-model`` option to specify the flash type. The I2C devices
connected to the board can be defined via the QEMU command line.
Arm ``fby35`` machine (since 10.2)
''''''''''''''''''''''''''''''''''
The ``fby35`` machine was originally added as an example of a
multi-SoC system, with the expectation the models would evolve over
time in an heterogeneous system. This hasn't happened and no public
firmware is available to boot it. It can be replaced by the
``ast2700fc``, another multi-SoC machine based on the newer AST2700
SoCs which are excepted to receive better support in the future.
RISC-V default machine option (since 10.0)
''''''''''''''''''''''''''''''''''''''''''
+2 -2
View File
@@ -266,7 +266,7 @@ Splitting a loop can also be useful to reduce the number of barriers:
| n = 0; | smp_mb_release(); |
| for (i = 0; i < 10; i++) { | for (i = 0; i < 10; i++) |
| qatomic_store_release(&a[i], false); | qatomic_set(&a[i], false); |
| smp_mb(); | smb_mb(); |
| smp_mb(); | smp_mb(); |
| n += qatomic_read(&b[i]); | n = 0; |
| } | for (i = 0; i < 10; i++) |
| | n += qatomic_read(&b[i]); |
@@ -283,7 +283,7 @@ as well) ``smp_wmb()``:
| | smp_mb_release(); |
| for (i = 0; i < 10; i++) { | for (i = 0; i < 10; i++) |
| qatomic_store_release(&a[i], false); | qatomic_set(&a[i], false); |
| qatomic_store_release(&b[i], false); | smb_wmb(); |
| qatomic_store_release(&b[i], false); | smp_wmb(); |
| } | for (i = 0; i < 10; i++) |
| | qatomic_set(&b[i], false); |
+------------------------------------------+----------------------------------+
+84 -37
View File
@@ -4,55 +4,103 @@
Setup build environment
=======================
QEMU uses a lot of dependencies on the host system. glib2 is used everywhere in
the code base, and most of the other dependencies are optional.
QEMU uses a lot of dependencies on the host system a large number of
which are optional. At a minimum we expect to have a system C library
(usually glibc but others can work), the glib2 library (used heavily
in the code base) and a few other core libraries for interfacing with
code modules and system build descriptions.
We present here simple instructions to enable native builds on most popular
systems.
We use the ``libvirt-ci`` project to handle the mapping of
dependencies to a wide variety output formats including system install
scripts. For example:
You can find additional instructions on `QEMU wiki <https://wiki.qemu.org/>`_:
.. code-block:: bash
- `Linux <https://wiki.qemu.org/Hosts/Linux>`_
- `MacOS <https://wiki.qemu.org/Hosts/Mac>`_
- `Windows <https://wiki.qemu.org/Hosts/W32>`_
- `BSD <https://wiki.qemu.org/Hosts/BSD>`_
# THIS FILE WAS AUTO-GENERATED
#
# $ lcitool buildenvscript debian-13 ./tests/lcitool/projects/qemu-minimal.yml
#
# https://gitlab.com/libvirt/libvirt-ci
Note: Installing dependencies using your package manager build dependencies may
miss out on deps that have been newly introduced in qemu.git. In more, it misses
deps the distribution has decided to exclude.
function install_buildenv() {
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get dist-upgrade -y
apt-get install --no-install-recommends -y \
bash \
bc \
bison \
bzip2 \
ca-certificates \
ccache \
findutils \
flex \
gcc \
git \
libc6-dev \
libfdt-dev \
libffi-dev \
libglib2.0-dev \
libpixman-1-dev \
locales \
make \
meson \
ninja-build \
pkgconf \
python3 \
python3-venv \
sed \
tar
sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen
dpkg-reconfigure locales
rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED
dpkg-query --showformat '${Package}_${Version}_${Architecture}\n' --show > /packages.txt
mkdir -p /usr/libexec/ccache-wrappers
ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc
ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc
}
Linux
-----
export CCACHE_WRAPPERSDIR="/usr/libexec/ccache-wrappers"
export LANG="en_US.UTF-8"
export MAKE="/usr/bin/make"
export NINJA="/usr/bin/ninja"
export PYTHON="/usr/bin/python3"
Fedora
++++++
If you instead select the ``qemu.yml`` project file you will get all
the dependencies that the project can use.
::
Using you system package manager
--------------------------------
sudo dnf update && sudo dnf builddep qemu
.. note::
Debian/Ubuntu
+++++++++++++
Installing dependencies using your package manager build dependencies may
miss out on deps that have been newly introduced in qemu.git. It
also misses deps the distribution has decided to exclude.
You first need to enable `Sources List <https://wiki.debian.org/SourcesList>`_.
Then, use apt to install dependencies:
Systems with Package Managers
+++++++++++++++++++++++++++++
::
.. list-table:: Package Manager Commands
:widths: 10 50 40
:header-rows: 1
sudo apt update && sudo apt build-dep qemu
MacOS
-----
You first need to install `Homebrew <https://brew.sh/>`_. Then, use it to
install dependencies:
::
brew update && brew install $(brew deps --include-build qemu)
* - System
- Command
- Notes
* - Fedora
- ``sudo dnf update && sudo dnf builddep qemu``
-
* - Debian/Ubuntu
- ``sudo apt update && sudo apt build-dep qemu``
- Must enable `Sources List
<https://wiki.debian.org/SourcesList>`_ first
* - MacOS
- ``brew update && brew install $(brew deps --include-build qemu)``
- Using `Homebrew <https://brew.sh/>`_.
Windows
-------
+++++++
You first need to install `MSYS2 <https://www.msys2.org/>`_.
MSYS2 offers `different environments <https://www.msys2.org/docs/environments/>`_.
@@ -104,7 +152,7 @@ build QEMU in MSYS2 itself.
makepkg --syncdeps --nobuild PKGBUILD || true
Build on windows-aarch64
++++++++++++++++++++++++
~~~~~~~~~~~~~~~~~~~~~~~~
When trying to cross compile meson for x86_64 using UCRT64 or MINGW64 env,
configure will run into an error because the cpu detected is not correct.
@@ -115,4 +163,3 @@ and force a cross compilation (with empty prefix).
::
./configure --cpu=x86_64 --cross-prefix=
+1 -1
View File
@@ -67,7 +67,7 @@ subject tag is "PULL SUBSYSTEM s390/block/whatever" rather than just
pull requests that should be applied to master.
You might be interested in the `make-pullreq
<https://git.linaro.org/people/peter.maydell/misc-scripts.git/tree/make-pullreq>`__
<https://gitlab.com/pm215/misc-scripts/-/blob/master/make-pullreq>`__
script which automates some of this process for you and includes a few
sanity checks. Note that you must edit it to configure it suitably for
your local situation!
+504 -46
View File
@@ -76,7 +76,7 @@ structures used in the ``ioctl()`` implementation. Messages derived from the
``ioctl()`` will have a name derived from the ``ioctl()`` command name. E.g., the
``VFIO_DEVICE_GET_INFO`` ``ioctl()`` command becomes a
``VFIO_USER_DEVICE_GET_INFO`` message. The purpose of this reuse is to share as
much code as feasible with the ``ioctl()`` implementation``.
much code as feasible with the ``ioctl()`` implementation.
Connection Initiation
^^^^^^^^^^^^^^^^^^^^^
@@ -201,12 +201,32 @@ A server can serve:
1) one or more clients, and/or
2) one or more virtual devices, belonging to one or more clients.
The current protocol specification requires a dedicated socket per
client/server connection. It is a server-side implementation detail whether a
single server handles multiple virtual devices from the same or multiple
clients. The location of the socket is implementation-specific. Multiplexing
clients, devices, and servers over the same socket is not supported in this
version of the protocol.
The current protocol specification requires dedicated sockets per
client/server connection. Commands in the client-to-server direction are
handled on the main communication socket which the client connects to, and
replies to these commands are passed on the same socket. Commands sent in the
other direction from the server to the client as well as their corresponding
replies can optionally be passed across a separate socket, which is set up
during negotiation (AF_UNIX servers just pass the file descriptor).
Using separate sockets for each command channel avoids introducing an
artificial point of synchronization between the channels. This simplifies
implementations since it obviates the need to demultiplex incoming messages
into commands and replies and interleave command handling and reply processing.
Note that it is still illegal for implementations to stall command or reply
processing indefinitely while waiting for replies on the other channel, as this
may lead to deadlocks. However, since incoming commands and requests arrive on
different sockets, it's possible to meet this requirement e.g. by running two
independent request processing threads that can internally operate
synchronously. It is expected that this is simpler to implement than fully
asynchronous message handling code. Implementations may still choose a fully
asynchronous, event-based design for other reasons, and the protocol fully
supports it.
It is a server-side implementation detail whether a single server handles
multiple virtual devices from the same or multiple clients. The location of the
socket is implementation-specific. Multiplexing clients, devices, and servers
over the same socket is not supported in this version of the protocol.
Authentication
--------------
@@ -364,6 +384,9 @@ Name Command Request Direction
``VFIO_USER_DMA_WRITE`` 12 server -> client
``VFIO_USER_DEVICE_RESET`` 13 client -> server
``VFIO_USER_REGION_WRITE_MULTI`` 15 client -> server
``VFIO_USER_DEVICE_FEATURE`` 16 client -> server
``VFIO_USER_MIG_DATA_READ`` 17 client -> server
``VFIO_USER_MIG_DATA_WRITE`` 18 client -> server
====================================== ========= =================
Header
@@ -486,45 +509,48 @@ format:
Capabilities:
+--------------------+---------+------------------------------------------------+
| Name | Type | Description |
+====================+=========+================================================+
| max_msg_fds | number | Maximum number of file descriptors that can be |
| | | received by the sender in one message. |
| | | Optional. If not specified then the receiver |
| | | must assume a value of ``1``. |
+--------------------+---------+------------------------------------------------+
| max_data_xfer_size | number | Maximum ``count`` for data transfer messages; |
| | | see `Read and Write Operations`_. Optional, |
| | | with a default value of 1048576 bytes. |
+--------------------+---------+------------------------------------------------+
| pgsizes | number | Page sizes supported in DMA map operations |
| | | or'ed together. Optional, with a default value |
| | | of supporting only 4k pages. |
+--------------------+---------+------------------------------------------------+
| max_dma_maps | number | Maximum number DMA map windows that can be |
| | | valid simultaneously. Optional, with a |
| | | value of 65535 (64k-1). |
+--------------------+---------+------------------------------------------------+
| migration | object | Migration capability parameters. If missing |
| | | then migration is not supported by the sender. |
+--------------------+---------+------------------------------------------------+
| write_multiple | boolean | ``VFIO_USER_REGION_WRITE_MULTI`` messages |
| | | are supported if the value is ``true``. |
+--------------------+---------+------------------------------------------------+
+--------------------+---------+-----------------------------------------------+
| Name | Type | Description |
+====================+=========+===============================================+
| max_msg_fds | number | Maximum number of file descriptors that can |
| | | be received by the sender in one message. |
| | | Optional. If not specified then the receiver |
| | | must assume a value of ``1``. |
+--------------------+---------+-----------------------------------------------+
| max_data_xfer_size | number | Maximum ``count`` for data transfer messages; |
| | | see `Read and Write Operations`_. Optional, |
| | | with a default value of 1048576 bytes. |
+--------------------+---------+-----------------------------------------------+
| max_dma_maps | number | Maximum number DMA map windows that can be |
| | | valid simultaneously. Optional, with a |
| | | value of 65535 (64k-1). |
+--------------------+---------+-----------------------------------------------+
| pgsizes | number | Page sizes supported in DMA map operations |
| | | or'ed together. Optional, with a default |
| | | value of supporting only 4k pages. |
+--------------------+---------+-----------------------------------------------+
| twin_socket | object | Parameters for twin-socket mode, which |
| | | handles server-to-client commands and their |
| | | replies on a separate socket. Optional. |
+--------------------+---------+-----------------------------------------------+
| write_multiple | boolean | ``VFIO_USER_REGION_WRITE_MULTI`` messages |
| | | are supported if the value is ``true``. |
+--------------------+---------+-----------------------------------------------+
The migration capability contains the following name/value pairs:
The ``twin_socket`` capability object holds these name/value pairs:
+-----------------+--------+--------------------------------------------------+
| Name | Type | Description |
+=================+========+==================================================+
| pgsize | number | Page size of dirty pages bitmap. The smallest |
| | | between the client and the server is used. |
+-----------------+--------+--------------------------------------------------+
| max_bitmap_size | number | Maximum bitmap size in ``VFIO_USER_DIRTY_PAGES`` |
| | | and ``VFIO_DMA_UNMAP`` messages. Optional, |
| | | with a default value of 256MB. |
+-----------------+--------+--------------------------------------------------+
+-----------+---------+--------------------------------------------------------+
| Name | Type | Description |
+===========+=========+========================================================+
| supported | boolean | Indicates whether the sender supports twin-socket |
| | | mode. Optional, defaults to false. |
+-----------+---------+--------------------------------------------------------+
| fd_index | number | Specifies an index in the file descriptor array |
| | | included with the message. The designated file |
| | | descriptor is a socket which is to be used for the |
| | | server-to-client command channel. Optional, only valid |
| | | in the reply message. |
+-----------+---------+--------------------------------------------------------+
Reply
^^^^^
@@ -532,6 +558,38 @@ Reply
The same message format is used in the server's reply with the semantics
described above.
If and only if the client has indicated support for twin-socket mode by setting
``twin_socket.supported`` to true in its capabilities, the server may optionally
set up a separate command channel for server-to-client commands and their
replies. The server enables twin-socket mode as follows:
* Create a fresh socket pair.
* Keep the server end of the socket pair and pass the client end in the file
descriptor array included with the reply message.
* Set ``twin_socket.supported`` to true in the reply.
* Indicate the index in the file descriptor array by the
``twin_socket.fd_index`` capability field in the reply, so the client can
identify the correct file descriptor to use.
A client requesting twin-socket mode must examine the ``twin_socket`` capability
in the reply:
* If ``twin_socket.supported`` is false, the field is missing, or the entire
``twin_socket`` object is absent, the server does not support twin-socket mode
or decided not to enable it. The client can choose whether it wants to proceed
without twin-socket mode, or close the connection if not.
* If ``twin_socket.supported`` is true and ``twin_socket.fd_index`` is present
and refers to a valid file descriptor, twin-socket mode negotiation has
succeeded. The client monitors the provided file descriptor for commands from
the server.
* Otherwise, the reply from the server is inconsistent. The client must abort
and close the connection since it is potentially unable to receive commands
from the server.
The twin-socket feature is optional, so some servers may not support it.
However, for server implementations that do send server-to-client commands it is
strongly recommended to implement twin-socket support.
``VFIO_USER_DMA_MAP``
---------------------
@@ -1335,7 +1393,9 @@ Reply
-----------------------
If the client has not shared mappable memory, the server can use this message to
read from guest memory.
read from guest memory. This message and its reply are passed over the separate
server-to-client socket if twin-socket mode has been negotiated during
connection setup.
Request
^^^^^^^
@@ -1373,7 +1433,9 @@ Reply
-----------------------
If the client has not shared mappable memory, the server can use this message to
write to guest memory.
write to guest memory. This message and its reply are passed over the separate
server-to-client socket if twin-socket mode has been negotiated during
connection setup.
Request
^^^^^^^
@@ -1466,6 +1528,402 @@ Reply
* *wr_cnt* is the number of device writes completed.
``VFIO_USER_DEVICE_FEATURE``
----------------------------
This command is analogous to ``VFIO_DEVICE_FEATURE``. It is used to get, set, or
probe feature data of the device.
Request
^^^^^^^
The request payload for this message is a structure of the following format.
+-------+--------+--------------------------------+
| Name | Offset | Size |
+=======+========+================================+
| argsz | 0 | 4 |
+-------+--------+--------------------------------+
| flags | 4 | 4 |
+-------+--------+--------------------------------+
| | +---------+---------------------------+ |
| | | Bit | Definition | |
| | +=========+===========================+ |
| | | 0 to 15 | Feature index | |
| | +---------+---------------------------+ |
| | | 16 | VFIO_DEVICE_FEATURE_GET | |
| | +---------+---------------------------+ |
| | | 17 | VFIO_DEVICE_FEATURE_SET | |
| | +---------+---------------------------+ |
| | | 18 | VFIO_DEVICE_FEATURE_PROBE | |
| | +---------+---------------------------+ |
+-------+--------+--------------------------------+
| data | 8 | variable |
+-------+--------+--------------------------------+
* *argsz* is the maximum size of the reply payload.
* *flags* defines the action to be performed by the server and upon which
feature:
* The feature index consists of the least significant 16 bits of the flags
field, and can be accessed using the ``VFIO_DEVICE_FEATURE_MASK`` bit mask.
* ``VFIO_DEVICE_FEATURE_GET`` instructs the server to get the data for the
given feature.
* ``VFIO_DEVICE_FEATURE_SET`` instructs the server to set the feature data to
that given in the ``data`` field of the payload.
* ``VFIO_DEVICE_FEATURE_PROBE`` instructs the server to probe for feature
support. If ``VFIO_DEVICE_FEATURE_GET`` and/or ``VFIO_DEVICE_FEATURE_SET``
are also set, the probe will only return success if all of the indicated
methods are supported.
``VFIO_DEVICE_FEATURE_GET`` and ``VFIO_DEVICE_FEATURE_SET`` are mutually
exclusive, except for use with ``VFIO_DEVICE_FEATURE_PROBE``.
* *data* is specific to the particular feature. It is not used for probing.
This part of the request is analogous to VFIO's ``struct vfio_device_feature``.
Reply
^^^^^
The reply payload must be the same as the request payload for setting or
probing a feature. For getting a feature's data, the data is added in the data
section and its length is added to ``argsz``.
Device Features
^^^^^^^^^^^^^^^
The only device features supported by vfio-user are those related to migration,
although this may change in the future. They are a subset of those supported in
the VFIO implementation of the Linux kernel.
+----------------------------------------+---------------+
| Name | Feature Index |
+========================================+===============+
| VFIO_DEVICE_FEATURE_MIGRATION | 1 |
+----------------------------------------+---------------+
| VFIO_DEVICE_FEATURE_MIG_DEVICE_STATE | 2 |
+----------------------------------------+---------------+
| VFIO_DEVICE_FEATURE_DMA_LOGGING_START | 6 |
+----------------------------------------+---------------+
| VFIO_DEVICE_FEATURE_DMA_LOGGING_STOP | 7 |
+----------------------------------------+---------------+
| VFIO_DEVICE_FEATURE_DMA_LOGGING_REPORT | 8 |
+----------------------------------------+---------------+
``VFIO_DEVICE_FEATURE_MIGRATION``
"""""""""""""""""""""""""""""""""
This feature indicates that the device can support the migration API through
``VFIO_DEVICE_FEATURE_MIG_DEVICE_STATE``. If ``GET`` succeeds, the ``RUNNING``
and ``ERROR`` states are always supported. Support for additional states is
indicated via the flags field; at least ``VFIO_MIGRATION_STOP_COPY`` must be
set.
There is no data field of the request message.
The data field of the reply message is structured as follows:
+-------+--------+---------------------------+
| Name | Offset | Size |
+=======+========+===========================+
| flags | 0 | 8 |
+-------+--------+---------------------------+
| | +-----+--------------------------+ |
| | | Bit | Definition | |
| | +=====+==========================+ |
| | | 0 | VFIO_MIGRATION_STOP_COPY | |
| | +-----+--------------------------+ |
| | | 1 | VFIO_MIGRATION_P2P | |
| | +-----+--------------------------+ |
| | | 2 | VFIO_MIGRATION_PRE_COPY | |
| | +-----+--------------------------+ |
+-------+--------+---------------------------+
These flags are interpreted in the same way as VFIO.
``VFIO_DEVICE_FEATURE_MIG_DEVICE_STATE``
""""""""""""""""""""""""""""""""""""""""
Upon ``VFIO_DEVICE_FEATURE_SET``, execute a migration state change on the VFIO
device. The new state is supplied in ``device_state``. The state transition must
fully complete before the reply is sent.
The data field of the reply message, as well as the ``SET`` request message, is
structured as follows:
+--------------+--------+------+
| Name | Offset | Size |
+==============+========+======+
| device_state | 0 | 4 |
+--------------+--------+------+
| data_fd | 4 | 4 |
+--------------+--------+------+
* *device_state* is the current state of the device (for ``GET``) or the
state to transition to (for ``SET``). It is defined by the
``vfio_device_mig_state`` enum as detailed below. These states are the states
of the device migration Finite State Machine.
+--------------------------------+-------+---------------------------------------------------------------------+
| Name | State | Description |
+================================+=======+=====================================================================+
| VFIO_DEVICE_STATE_ERROR | 0 | The device has failed and must be reset. |
+--------------------------------+-------+---------------------------------------------------------------------+
| VFIO_DEVICE_STATE_STOP | 1 | The device does not change the internal or external state. |
+--------------------------------+-------+---------------------------------------------------------------------+
| VFIO_DEVICE_STATE_RUNNING | 2 | The device is running normally. |
+--------------------------------+-------+---------------------------------------------------------------------+
| VFIO_DEVICE_STATE_STOP_COPY | 3 | The device internal state can be read out. |
+--------------------------------+-------+---------------------------------------------------------------------+
| VFIO_DEVICE_STATE_RESUMING | 4 | The device is stopped and is loading a new internal state. |
+--------------------------------+-------+---------------------------------------------------------------------+
| VFIO_DEVICE_STATE_RUNNING_P2P | 5 | (not used in vfio-user) |
+--------------------------------+-------+---------------------------------------------------------------------+
| VFIO_DEVICE_STATE_PRE_COPY | 6 | The device is running normally but tracking internal state changes. |
+--------------------------------+-------+---------------------------------------------------------------------+
| VFIO_DEVICE_STATE_PRE_COPY_P2P | 7 | (not used in vfio-user) |
+--------------------------------+-------+---------------------------------------------------------------------+
* *data_fd* is unused in vfio-user, as the ``VFIO_USER_MIG_DATA_READ`` and
``VFIO_USER_MIG_DATA_WRITE`` messages are used instead for migration data
transport.
Direct State Transitions
""""""""""""""""""""""""
The device migration FSM is a Mealy machine, so actions are taken upon the arcs
between FSM states. The following transitions need to be supported by the
server, a subset of those defined in ``<linux/vfio.h>``
(``enum vfio_device_mig_state``).
* ``RUNNING -> STOP``, ``STOP_COPY -> STOP``: Stop the operation of the device.
The ``STOP_COPY`` arc terminates the data transfer session.
* ``RESUMING -> STOP``: Terminate the data transfer session. Complete processing
of the migration data. Stop the operation of the device. If the delivered data
is found to be incomplete, inconsistent, or otherwise invalid, fail the
``SET`` command and optionally transition to the ``ERROR`` state.
* ``PRE_COPY -> RUNNING``: Terminate the data transfer session. The device is
now fully operational.
* ``STOP -> RUNNING``: Start the operation of the device.
* ``RUNNING -> PRE_COPY``, ``STOP -> STOP_COPY``: Begin the process of saving
the device state. The device operation is unchanged, but data transfer begins.
``PRE_COPY`` and ``STOP_COPY`` are referred to as the "saving group" of
states.
* ``PRE_COPY -> STOP_COPY``: Continue to transfer migration data, but stop
device operation.
* ``STOP -> RESUMING``: Start the process of restoring the device state. The
internal device state may be changed to prepare the device to receive the
migration data.
The ``STOP_COPY -> PRE_COPY`` transition is explicitly not allowed and should
return an error if requested.
``ERROR`` cannot be specified as a device state, but any transition request can
be failed and then move the state into ``ERROR`` if the server was unable to
execute the requested arc AND was unable to restore the device into any valid
state. To recover from ``ERROR``, ``VFIO_USER_DEVICE_RESET`` must be used to
return back to ``RUNNING``.
If ``PRE_COPY`` is not supported, arcs touching it are removed.
Complex State Transitions
"""""""""""""""""""""""""
The remaining possible transitions are to be implemented as combinations of the
above FSM arcs. As there are multiple paths, the path should be selected based
on the following rules:
* Select the shortest path.
* The path cannot have saving group states as interior arcs, only start/end
states.
``VFIO_DEVICE_FEATURE_DMA_LOGGING_START`` / ``VFIO_DEVICE_FEATURE_DMA_LOGGING_STOP``
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Upon ``VFIO_DEVICE_FEATURE_SET``, start/stop DMA logging. These features can
also be probed to determine whether the device supports DMA logging.
When DMA logging is started, a range of IOVAs to monitor is provided and the
device can optimize its logging to cover only the IOVA range given. Only DMA
writes are logged.
The data field of the ``SET`` request is structured as follows:
+------------+--------+----------+
| Name | Offset | Size |
+============+========+==========+
| page_size | 0 | 8 |
+------------+--------+----------+
| num_ranges | 8 | 4 |
+------------+--------+----------+
| reserved | 12 | 4 |
+------------+--------+----------+
| ranges | 16 | variable |
+------------+--------+----------+
* *page_size* hints what tracking granularity the device should try to achieve.
If the device cannot do the hinted page size then it's the driver's choice
which page size to pick based on its support. On output the device will return
the page size it selected.
* *num_ranges* is the number of IOVA ranges to monitor. A value of zero
indicates that all writes should be logged.
* *ranges* is an array of ``vfio_user_device_feature_dma_logging_range``
entries:
+--------+--------+------+
| Name | Offset | Size |
+========+========+======+
| iova | 0 | 8 |
+--------+--------+------+
| length | 8 | 8 |
+--------+--------+------+
* *iova* is the base IO virtual address
* *length* is the length of the range to log
Upon success, the response data field will be the same as the request, unless
the page size was changed, in which case this will be reflected in the response.
``VFIO_DEVICE_FEATURE_DMA_LOGGING_REPORT``
""""""""""""""""""""""""""""""""""""""""""
Upon ``VFIO_DEVICE_FEATURE_GET``, returns the dirty bitmap for a specific IOVA
range. This operation is only valid if logging of dirty pages has been
previously started by setting ``VFIO_DEVICE_FEATURE_DMA_LOGGING_START``.
The data field of the request is structured as follows:
+-----------+--------+------+
| Name | Offset | Size |
+===========+========+======+
| iova | 0 | 8 |
+-----------+--------+------+
| length | 8 | 8 |
+-----------+--------+------+
| page_size | 16 | 8 |
+-----------+--------+------+
* *iova* is the base IO virtual address
* *length* is the length of the range
* *page_size* is the unit of granularity of the bitmap, and must be a power of
two. It doesn't have to match the value given to
``VFIO_DEVICE_FEATURE_DMA_LOGGING_START`` because the driver will format its
internal logging to match the reporting page size possibly by replicating bits
if the internal page size is lower than requested
The data field of the response is identical, except with the bitmap added on
the end at offset 24.
The bitmap is an array of u64s that holds the output bitmap, with 1 bit
reporting a *page_size* unit of IOVA. The bits outside of the requested range
must be zero.
The mapping of IOVA to bits is given by:
``bitmap[(addr - iova)/page_size] & (1ULL << (addr % 64))``
``VFIO_USER_MIG_DATA_READ``
---------------------------
This command is used to read data from the source migration server while it is
in a saving group state (``PRE_COPY`` or ``STOP_COPY``).
This command, and ``VFIO_USER_MIG_DATA_WRITE``, are used in place of the
``data_fd`` file descriptor in ``<linux/vfio.h>``
(``struct vfio_device_feature_mig_state``) to enable all data transport to use
the single already-established UNIX socket. Hence, the migration data is
treated like a stream, so the client must continue reading until no more
migration data remains.
Request
^^^^^^^
The request payload for this message is a structure of the following format.
+-------+--------+------+
| Name | Offset | Size |
+=======+========+======+
| argsz | 0 | 4 |
+-------+--------+------+
| size | 4 | 4 |
+-------+--------+------+
* *argsz* is the maximum size of the reply payload.
* *size* is the size of the migration data to read.
Reply
^^^^^
The reply payload for this message is a structure of the following format.
+-------+--------+----------+
| Name | Offset | Size |
+=======+========+==========+
| argsz | 0 | 4 |
+-------+--------+----------+
| size | 4 | 4 |
+-------+--------+----------+
| data | 8 | variable |
+-------+--------+----------+
* *argsz* is the size of the above structure, including the size of the data.
* *size* indicates the size of returned migration data. If this is less than the
requested size, there is no more migration data to read.
* *data* contains the migration data.
``VFIO_USER_MIG_DATA_WRITE``
----------------------------
This command is used to write data to the destination migration server while it
is in the ``RESUMING`` state.
As above, this replaces the ``data_fd`` file descriptor for transport of
migration data, and as such, the migration data is treated like a stream.
Request
^^^^^^^
The request payload for this message is a structure of the following format.
+-------+--------+----------+
| Name | Offset | Size |
+=======+========+==========+
| argsz | 0 | 4 |
+-------+--------+----------+
| size | 4 | 4 |
+-------+--------+----------+
| data | 8 | variable |
+-------+--------+----------+
* *argsz* is the maximum size of the reply payload.
* *size* is the size of the migration data to be written.
* *data* contains the migration data.
Reply
^^^^^
There is no reply payload for this message.
Appendices
==========
+1 -1
View File
@@ -362,7 +362,7 @@ static const char *get_feature_xml(const char *p, const char **newp,
* qXfer:features:read:ANNEX:OFFSET,LENGTH'
* ^p ^newp
*/
char *term = strchr(p, ':');
const char *term = strchr(p, ':');
*newp = term + 1;
len = term - p;
+1 -1
View File
@@ -317,7 +317,7 @@ static bool gdb_accept_socket(int gdb_fd)
static int gdbserver_open_socket(const char *path, Error **errp)
{
g_autoptr(GString) buf = g_string_new("");
char *pid_placeholder;
const char *pid_placeholder;
pid_placeholder = strstr(path, "%d");
if (pid_placeholder != NULL) {
@@ -67,9 +67,9 @@ static inline Int128 atomic16_fetch_and(Int128 *ptr, Int128 new)
"stlxp %w[tmp], %[tmpl], %[tmph], %[mem]\n\t"
"cbnz %w[tmp], 0b"
: [mem] "+m"(*ptr), [tmp] "=&r"(tmp),
[oldl] "=&r"(oldl), [oldh] "=&r"(oldh)
: [newl] "r"(newl), [newh] "r"(newh),
[tmpl] "r"(tmpl), [tmph] "r"(tmph)
[oldl] "=&r"(oldl), [oldh] "=&r"(oldh),
[tmpl] "=&r"(tmpl), [tmph] "=&r"(tmph)
: [newl] "r"(newl), [newh] "r"(newh)
: "memory");
return int128_make128(oldl, oldh);
@@ -87,9 +87,9 @@ static inline Int128 atomic16_fetch_or(Int128 *ptr, Int128 new)
"stlxp %w[tmp], %[tmpl], %[tmph], %[mem]\n\t"
"cbnz %w[tmp], 0b"
: [mem] "+m"(*ptr), [tmp] "=&r"(tmp),
[oldl] "=&r"(oldl), [oldh] "=&r"(oldh)
: [newl] "r"(newl), [newh] "r"(newh),
[tmpl] "r"(tmpl), [tmph] "r"(tmph)
[oldl] "=&r"(oldl), [oldh] "=&r"(oldh),
[tmpl] "=&r"(tmpl), [tmph] "=&r"(tmph)
: [newl] "r"(newl), [newh] "r"(newh)
: "memory");
return int128_make128(oldl, oldh);
+15 -9
View File
@@ -34,39 +34,45 @@ static inline Int128 ATTRIBUTE_ATOMIC128_OPT
atomic16_xchg(Int128 *ptr, Int128 new)
{
__int128_t *ptr_align = __builtin_assume_aligned(ptr, 16);
Int128 old = *ptr_align;
Int128Alias o, n;
while (!__atomic_compare_exchange_n(ptr_align, &old, new, true,
n.s = new;
o.i = *ptr_align;
while (!__atomic_compare_exchange_n(ptr_align, &o.i, n.i, true,
__ATOMIC_SEQ_CST, 0)) {
continue;
}
return old;
return o.s;
}
static inline Int128 ATTRIBUTE_ATOMIC128_OPT
atomic16_fetch_and(Int128 *ptr, Int128 val)
{
__int128_t *ptr_align = __builtin_assume_aligned(ptr, 16);
Int128 old = *ptr_align;
Int128Alias o, v;
while (!__atomic_compare_exchange_n(ptr_align, &old, old & val, true,
v.s = val;
o.i = *ptr_align;
while (!__atomic_compare_exchange_n(ptr_align, &o.i, o.i & v.i, true,
__ATOMIC_SEQ_CST, 0)) {
continue;
}
return old;
return o.s;
}
static inline Int128 ATTRIBUTE_ATOMIC128_OPT
atomic16_fetch_or(Int128 *ptr, Int128 val)
{
__int128_t *ptr_align = __builtin_assume_aligned(ptr, 16);
Int128 old = *ptr_align;
Int128Alias o, v;
while (!__atomic_compare_exchange_n(ptr_align, &old, old | val, true,
v.s = val;
o.i = *ptr_align;
while (!__atomic_compare_exchange_n(ptr_align, &o.i, o.i | v.i, true,
__ATOMIC_SEQ_CST, 0)) {
continue;
}
return old;
return o.s;
}
# define HAVE_CMPXCHG128 1
#elif defined(CONFIG_CMPXCHG128)
+1 -1
View File
@@ -310,7 +310,7 @@ static void xen_9pfs_bh(void *opaque)
again:
wait = ring->co != NULL && qemu_coroutine_entered(ring->co);
/* paired with the smb_wmb barriers in xen_9pfs_init_in_iov_from_pdu */
/* paired with the smp_wmb barriers in xen_9pfs_init_in_iov_from_pdu */
smp_rmb();
if (wait) {
cpu_relax();
+1
View File
@@ -175,6 +175,7 @@ static void fby35_class_init(ObjectClass *oc, const void *data)
MachineClass *mc = MACHINE_CLASS(oc);
mc->desc = "Meta Platforms fby35";
mc->deprecation_reason = "For a multi-soc machine, use 'ast2700fc' instead";
mc->init = fby35_init;
mc->no_floppy = 1;
mc->no_cdrom = 1;
+3 -1
View File
@@ -494,7 +494,9 @@ static void set_uint64_checkmask(Object *obj, Visitor *v, const char *name,
const Property *prop = opaque;
uint64_t *ptr = object_field_prop_ptr(obj, prop);
visit_type_uint64(v, name, ptr, errp);
if (!visit_type_uint64(v, name, ptr, errp)) {
return;
}
if (*ptr & ~prop->bitmask) {
error_setg(errp, "Property value for '%s' has bits outside mask '0x%" PRIx64 "'",
name, prop->bitmask);
+1 -1
View File
@@ -654,7 +654,7 @@ void x86_load_linux(X86MachineState *x86ms,
uint8_t header[8192], *setup, *kernel;
hwaddr real_addr, prot_addr, cmdline_addr, initrd_addr = 0;
FILE *f;
char *vmode;
const char *vmode;
MachineState *machine = MACHINE(x86ms);
struct setup_data *setup_data;
const char *kernel_filename = machine->kernel_filename;
+5 -4
View File
@@ -986,7 +986,7 @@ static void virtio_net_set_features(VirtIODevice *vdev,
virtio_has_feature_ex(vdev->guest_features_ex,
VIRTIO_NET_F_CTRL_VLAN)) {
bool vlan = virtio_has_feature_ex(features, VIRTIO_NET_F_CTRL_VLAN);
memset(n->vlans, vlan ? 0 : 0xff, sizeof(n->vlans));
memset(n->vlans, vlan ? 0 : 0xff, MAX_VLAN >> 3);
}
if (virtio_has_feature_ex(features, VIRTIO_NET_F_STANDBY)) {
@@ -3598,8 +3598,7 @@ static const VMStateDescription vmstate_virtio_net_device = {
* buffer; hold onto your endiannesses; it's actually used as a bitmap
* but based on the uint.
*/
VMSTATE_BUFFER_UNSAFE(vlans, VirtIONet, 0,
sizeof(typeof_field(VirtIONet, vlans))),
VMSTATE_BUFFER_POINTER_UNSAFE(vlans, VirtIONet, 0, MAX_VLAN >> 3),
VMSTATE_WITH_TMP(VirtIONet, struct VirtIONetMigTmp,
vmstate_virtio_net_has_vnet),
VMSTATE_UINT8(mac_table.multi_overflow, VirtIONet),
@@ -4017,7 +4016,8 @@ static void virtio_net_device_realize(DeviceState *dev, Error **errp)
n->mac_table.macs = g_malloc0(MAC_TABLE_ENTRIES * ETH_ALEN);
memset(n->vlans, 0xff, sizeof(n->vlans));
n->vlans = g_malloc0(MAX_VLAN >> 3);
memset(n->vlans, 0xff, MAX_VLAN >> 3);
nc = qemu_get_queue(n->nic);
nc->rxfilter_notify_enabled = 1;
@@ -4066,6 +4066,7 @@ static void virtio_net_device_unrealize(DeviceState *dev)
n->netclient_type = NULL;
g_free(n->mac_table.macs);
g_free(n->vlans);
if (n->failover) {
qobject_unref(n->primary_opts);
+114 -92
View File
@@ -147,8 +147,7 @@ VFIOUserFDs *vfio_user_getfds(int numfds)
/*
* Process a received message.
*/
static void vfio_user_process(VFIOUserProxy *proxy, VFIOUserMsg *msg,
bool isreply)
static void vfio_user_process(VFIOUserProxy *proxy, VFIOUserMsg *msg)
{
/*
@@ -157,7 +156,7 @@ static void vfio_user_process(VFIOUserProxy *proxy, VFIOUserMsg *msg,
*
* Requests get queued for the BH.
*/
if (isreply) {
if ((msg->hdr->flags & VFIO_USER_TYPE) == VFIO_USER_REPLY) {
msg->complete = true;
if (msg->type == VFIO_MSG_WAIT) {
qemu_cond_signal(&msg->cv);
@@ -187,7 +186,6 @@ static int vfio_user_complete(VFIOUserProxy *proxy, Error **errp)
{
VFIOUserMsg *msg = proxy->part_recv;
size_t msgleft = proxy->recv_left;
bool isreply;
char *data;
int ret;
@@ -214,13 +212,67 @@ static int vfio_user_complete(VFIOUserProxy *proxy, Error **errp)
*/
proxy->part_recv = NULL;
proxy->recv_left = 0;
isreply = (msg->hdr->flags & VFIO_USER_TYPE) == VFIO_USER_REPLY;
vfio_user_process(proxy, msg, isreply);
vfio_user_process(proxy, msg);
/* return positive value */
return 1;
}
static int vfio_user_recv_hdr(VFIOUserProxy *proxy, Error **errp,
VFIOUserHdr *hdr, int **fdp, size_t *numfdp,
bool *isreply)
{
struct iovec iov = {
.iov_base = hdr,
.iov_len = sizeof(*hdr),
};
int ret;
/*
* Read header
*/
ret = qio_channel_readv_full(proxy->ioc, &iov, 1, fdp, numfdp, 0,
errp);
if (ret == QIO_CHANNEL_ERR_BLOCK) {
return ret;
}
if (ret < 0) {
error_setg_errno(errp, errno, "failed to read header");
return -1;
} else if (ret == 0) {
error_setg(errp, "failed to read header: EOF");
return -1;
} else if (ret < sizeof(*hdr)) {
error_setg(errp, "short read of header");
return -1;
}
/*
* Validate header
*/
if (hdr->size < sizeof(*hdr)) {
error_setg(errp, "bad header size");
return -1;
}
switch (hdr->flags & VFIO_USER_TYPE) {
case VFIO_USER_REQUEST:
*isreply = false;
break;
case VFIO_USER_REPLY:
*isreply = true;
break;
default:
error_setg(errp, "unknown message type");
return -1;
}
trace_vfio_user_recv_hdr(proxy->sockname, hdr->id, hdr->command, hdr->size,
hdr->flags);
return 0;
}
/*
* Receive and process one incoming message.
*
@@ -229,19 +281,14 @@ static int vfio_user_complete(VFIOUserProxy *proxy, Error **errp)
*/
static int vfio_user_recv_one(VFIOUserProxy *proxy, Error **errp)
{
VFIOUserMsg *msg = NULL;
g_autofree int *fdp = NULL;
VFIOUserFDs *reqfds;
VFIOUserHdr hdr;
struct iovec iov = {
.iov_base = &hdr,
.iov_len = sizeof(hdr),
};
VFIOUserMsg *msg = NULL;
bool isreply = false;
int i, ret;
size_t msgleft, numfds = 0;
size_t msgleft = 0;
size_t numfds = 0;
char *data = NULL;
char *buf = NULL;
VFIOUserHdr hdr;
int i, ret;
/*
* Complete any partial reads
@@ -260,49 +307,17 @@ static int vfio_user_recv_one(VFIOUserProxy *proxy, Error **errp)
/* else fall into reading another msg */
}
/*
* Read header
*/
ret = qio_channel_readv_full(proxy->ioc, &iov, 1, &fdp, &numfds, 0,
errp);
if (ret == QIO_CHANNEL_ERR_BLOCK) {
return ret;
}
/* read error or other side closed connection */
if (ret <= 0) {
goto fatal;
}
if (ret < sizeof(hdr)) {
error_setg(errp, "short read of header");
ret = vfio_user_recv_hdr(proxy, errp, &hdr, &fdp, &numfds, &isreply);
if (ret < 0) {
if (ret == QIO_CHANNEL_ERR_BLOCK) {
return ret;
}
goto fatal;
}
/*
* Validate header
*/
if (hdr.size < sizeof(VFIOUserHdr)) {
error_setg(errp, "bad header size");
goto fatal;
}
switch (hdr.flags & VFIO_USER_TYPE) {
case VFIO_USER_REQUEST:
isreply = false;
break;
case VFIO_USER_REPLY:
isreply = true;
break;
default:
error_setg(errp, "unknown message type");
goto fatal;
}
trace_vfio_user_recv_hdr(proxy->sockname, hdr.id, hdr.command, hdr.size,
hdr.flags);
/*
* For replies, find the matching pending request.
* For requests, reap incoming FDs.
* Find the matching request if this is a reply, or initialize a new
* server->client request.
*/
if (isreply) {
QTAILQ_FOREACH(msg, &proxy->pending, next) {
@@ -316,56 +331,52 @@ static int vfio_user_recv_one(VFIOUserProxy *proxy, Error **errp)
}
QTAILQ_REMOVE(&proxy->pending, msg, next);
/*
* Process any received FDs
*/
if (numfds != 0) {
if (msg->fds == NULL || msg->fds->recv_fds < numfds) {
error_setg(errp, "unexpected FDs");
goto err;
}
msg->fds->recv_fds = numfds;
memcpy(msg->fds->fds, fdp, numfds * sizeof(int));
}
} else {
if (numfds != 0) {
reqfds = vfio_user_getfds(numfds);
memcpy(reqfds->fds, fdp, numfds * sizeof(int));
} else {
reqfds = NULL;
}
}
/*
* Put the whole message into a single buffer.
*/
if (isreply) {
if (hdr.size > msg->rsize) {
error_setg(errp, "reply larger than recv buffer");
goto err;
}
*msg->hdr = hdr;
data = (char *)msg->hdr + sizeof(hdr);
} else {
void *buf;
if (hdr.size > proxy->max_xfer_size + sizeof(VFIOUserDMARW)) {
error_setg(errp, "vfio_user_recv request larger than max");
goto err;
}
buf = g_malloc0(hdr.size);
memcpy(buf, &hdr, sizeof(hdr));
data = buf + sizeof(hdr);
msg = vfio_user_getmsg(proxy, (VFIOUserHdr *)buf, reqfds);
msg = vfio_user_getmsg(proxy, buf, NULL);
msg->type = VFIO_MSG_REQ;
}
*msg->hdr = hdr;
data = (char *)msg->hdr + sizeof(hdr);
if (numfds != 0) {
if (msg->type == VFIO_MSG_REQ) {
msg->fds = vfio_user_getfds(numfds);
} else {
if (msg->fds == NULL || msg->fds->recv_fds < numfds) {
error_setg(errp, "unexpected FDs in reply");
goto err;
}
msg->fds->recv_fds = numfds;
}
memcpy(msg->fds->fds, fdp, numfds * sizeof(int));
}
/*
* Read rest of message.
* Read rest of message into the data buffer.
*/
msgleft = hdr.size - sizeof(hdr);
while (msgleft > 0) {
ret = qio_channel_read(proxy->ioc, data, msgleft, errp);
/* prepare to complete read on next iternation */
/*
* We'll complete this read on the next go around; keep track of the
* partial message until then.
*/
if (ret == QIO_CHANNEL_ERR_BLOCK) {
proxy->part_recv = msg;
proxy->recv_left = msgleft;
@@ -381,7 +392,7 @@ static int vfio_user_recv_one(VFIOUserProxy *proxy, Error **errp)
data += ret;
}
vfio_user_process(proxy, msg, isreply);
vfio_user_process(proxy, msg);
return 0;
/*
@@ -401,11 +412,22 @@ err:
for (i = 0; i < numfds; i++) {
close(fdp[i]);
}
if (isreply && msg != NULL) {
/* force an error to keep sending thread from hanging */
vfio_user_set_error(msg->hdr, EINVAL);
msg->complete = true;
qemu_cond_signal(&msg->cv);
if (msg != NULL) {
if (msg->type == VFIO_MSG_REQ) {
/*
* Clean up the request message on failure. Change type back to
* NOWAIT to free.
*/
msg->type = VFIO_MSG_NOWAIT;
vfio_user_recycle(proxy, msg);
} else {
/*
* Report an error back to the sender. Sender will recycle msg.
*/
vfio_user_set_error(msg->hdr, EINVAL);
msg->complete = true;
qemu_cond_signal(&msg->cv);
}
}
return -1;
}
+23 -15
View File
@@ -1261,7 +1261,7 @@ int vhost_virtqueue_start(struct vhost_dev *dev,
BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev)));
VirtioBusState *vbus = VIRTIO_BUS(qbus);
VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(vbus);
hwaddr s, l, a;
hwaddr l;
int r;
int vhost_vq_index = dev->vhost_ops->vhost_get_vq_index(dev, idx);
struct vhost_vring_file file = {
@@ -1272,8 +1272,17 @@ int vhost_virtqueue_start(struct vhost_dev *dev,
};
struct VirtQueue *vvq = virtio_get_queue(vdev, idx);
a = virtio_queue_get_desc_addr(vdev, idx);
if (a == 0) {
vq->desc_size = virtio_queue_get_desc_size(vdev, idx);
vq->desc_phys = virtio_queue_get_desc_addr(vdev, idx);
vq->desc = NULL;
vq->avail_size = virtio_queue_get_avail_size(vdev, idx);
vq->avail_phys = virtio_queue_get_avail_addr(vdev, idx);
vq->avail = NULL;
vq->used_size = virtio_queue_get_used_size(vdev, idx);
vq->used_phys = virtio_queue_get_used_addr(vdev, idx);
vq->used = NULL;
if (vq->desc_phys == 0) {
/* Queue might not be ready for start */
return 0;
}
@@ -1301,24 +1310,23 @@ int vhost_virtqueue_start(struct vhost_dev *dev,
}
}
vq->desc_size = s = l = virtio_queue_get_desc_size(vdev, idx);
vq->desc_phys = a;
vq->desc = vhost_memory_map(dev, a, &l, false);
if (!vq->desc || l != s) {
l = vq->desc_size;
vq->desc = vhost_memory_map(dev, vq->desc_phys, &l, false);
if (!vq->desc || l != vq->desc_size) {
r = -ENOMEM;
goto fail_alloc_desc;
}
vq->avail_size = s = l = virtio_queue_get_avail_size(vdev, idx);
vq->avail_phys = a = virtio_queue_get_avail_addr(vdev, idx);
vq->avail = vhost_memory_map(dev, a, &l, false);
if (!vq->avail || l != s) {
l = vq->avail_size;
vq->avail = vhost_memory_map(dev, vq->avail_phys, &l, false);
if (!vq->avail || l != vq->avail_size) {
r = -ENOMEM;
goto fail_alloc_avail;
}
vq->used_size = s = l = virtio_queue_get_used_size(vdev, idx);
vq->used_phys = a = virtio_queue_get_used_addr(vdev, idx);
vq->used = vhost_memory_map(dev, a, &l, true);
if (!vq->used || l != s) {
l = vq->used_size;
vq->used = vhost_memory_map(dev, vq->used_phys, &l, true);
if (!vq->used || l != vq->used_size) {
r = -ENOMEM;
goto fail_alloc_used;
}
+1 -1
View File
@@ -751,7 +751,7 @@ int pci_iommu_register_iotlb_notifier(PCIDevice *dev, uint32_t pasid,
/**
* pci_iommu_unregister_iotlb_notifier: unregister a notifier that has been
* registerd with pci_iommu_register_iotlb_notifier.
* registered with pci_iommu_register_iotlb_notifier.
*
* Returns 0 on success, or a negative errno otherwise.
*
+1 -1
View File
@@ -202,7 +202,7 @@ struct VirtIONet {
uint8_t uni_overflow;
uint8_t *macs;
} mac_table;
uint32_t vlans[MAX_VLAN];
uint32_t *vlans;
virtio_net_conf net_conf;
NICConf nic_conf;
DeviceState *qdev;
+9
View File
@@ -727,6 +727,15 @@ extern const VMStateInfo vmstate_info_qlist;
.offset = offsetof(_state, _field), \
}
#define VMSTATE_BUFFER_POINTER_UNSAFE(_field, _state, _version, _size) { \
.name = (stringify(_field)), \
.version_id = (_version), \
.size = (_size), \
.info = &vmstate_info_buffer, \
.flags = VMS_BUFFER | VMS_POINTER, \
.offset = offsetof(_state, _field), \
}
/* Allocate a temporary of type 'tmp_type', set tmp->parent to _state
* and execute the vmsd on the temporary. Note that we're working with
* the whole of _state here, not a field within it.
+6
View File
@@ -141,6 +141,12 @@ QEMU_EXTERN_C int daemon(int, int);
#undef ELF_DATA
#undef ELF_ARCH
/*
* Avoid conflict with Solaris FSCALE definition from <sys/param.h> header,
* but we might as well do this unconditionally.
*/
#undef FSCALE
#ifdef CONFIG_IOVEC
#include <sys/uio.h>
#endif
+12
View File
@@ -10,7 +10,19 @@
#define TCG_HELPER_INFO_H
#ifdef CONFIG_TCG_INTERPRETER
/*
* MacOSX 15 uses an old version of libffi which contains
* #if FFI_GO_CLOSURES
* but does not define that in <ffitarget.h>, included from <ffi.h>.
* This was fixed upstream with
* https://github.com/libffi/libffi/commit/c23e9a1c
* We don't care about go closures one way or the other;
* just suppress the warning.
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wundef"
#include <ffi.h>
#pragma GCC diagnostic pop
#endif
#include "tcg-target-reg-bits.h"
+1 -1
View File
@@ -450,7 +450,7 @@ static void multifd_send_set_error(Error *err)
*/
static void migration_ioc_shutdown_gracefully(QIOChannel *ioc)
{
g_autoptr(Error) local_err = NULL;
Error *local_err = NULL;
if (!migration_has_failed(migrate_get_current()) &&
object_dynamic_cast((Object *)ioc, TYPE_QIO_CHANNEL_TLS)) {
+3 -2
View File
@@ -1467,7 +1467,8 @@ retry:
static int postcopy_temp_pages_setup(MigrationIncomingState *mis)
{
PostcopyTmpPage *tmp_page;
int err, i, channels;
int err;
unsigned i, channels;
void *temp_page;
if (migrate_postcopy_preempt()) {
@@ -1479,7 +1480,7 @@ static int postcopy_temp_pages_setup(MigrationIncomingState *mis)
}
channels = mis->postcopy_channels;
mis->postcopy_tmp_pages = g_malloc0_n(sizeof(PostcopyTmpPage), channels);
mis->postcopy_tmp_pages = g_new0(PostcopyTmpPage, channels);
for (i = 0; i < channels; i++) {
tmp_page = &mis->postcopy_tmp_pages[i];
+3 -2
View File
@@ -577,10 +577,11 @@ static const char *get_command_name(const char *cmdline,
* Read key of 'type' into 'key' and return the current
* 'type' pointer.
*/
static char *key_get_info(const char *type, char **key)
static const char *key_get_info(const char *type, char **key)
{
size_t len;
char *p, *str;
const char *p;
char *str;
if (*type == ',') {
type++;
+2
View File
@@ -119,6 +119,7 @@ static void plugin_vcpu_cb__discon(CPUState *cpu,
struct qemu_plugin_cb *cb, *next;
uint64_t to = cpu->cc->get_pc(cpu);
qemu_plugin_set_cb_flags(cpu, QEMU_PLUGIN_CB_RW_REGS);
if (cpu->cpu_index < plugin.num_vcpus) {
/* iterate safely; plugins might uninstall themselves at any time */
QLIST_FOREACH_SAFE_RCU(cb, &plugin.cb_lists[ev], entry, next) {
@@ -127,6 +128,7 @@ static void plugin_vcpu_cb__discon(CPUState *cpu,
func(cb->ctx->id, cpu->cpu_index, type, from, to);
}
}
qemu_plugin_set_cb_flags(cpu, QEMU_PLUGIN_CB_NO_REGS);
}
/*
+4 -3
View File
@@ -403,7 +403,8 @@ static bool build_guest_fsinfo_for_pci_dev(char const *syspath,
int i, offset, nhosts = 0, pcilen;
GuestPCIAddress *pciaddr = disk->pci_controller;
bool has_ata = false, has_host = false, has_tgt = false;
char *p, *driver = NULL;
const char *p;
char *driver = NULL;
bool ret = false;
p = strstr(syspath, "/devices/pci");
@@ -543,7 +544,7 @@ static bool build_guest_fsinfo_for_nonpci_virtio(char const *syspath,
Error **errp)
{
unsigned int tgt[3];
char *p;
const char *p;
if (!strstr(syspath, "/virtio") || !strstr(syspath, "/block")) {
g_debug("Unsupported virtio device '%s'", syspath);
@@ -575,7 +576,7 @@ static bool build_guest_fsinfo_for_ccw_dev(char const *syspath,
Error **errp)
{
unsigned int cssid, ssid, subchno, devno;
char *p;
const char *p;
p = strstr(syspath, "/devices/css");
if (!p || sscanf(p + 12, "%*x/%x.%x.%x/%*x.%*x.%x/",
+1 -1
View File
@@ -41,7 +41,7 @@ def main(args):
for obj in args:
entry = compile_commands.get(obj, None)
if not entry:
sys.stderr.print('modinfo: Could not find object file', obj)
sys.stderr.write(f'modinfo: Could not find object file {obj}')
sys.exit(1)
src = entry['file']
if not src.endswith('.c'):
+1 -1
View File
@@ -114,7 +114,7 @@ def main():
"-DSRCDIR=" + args.srcdir,
"-DBINDIR=" + destdir + prefix,
]
if args.cpu == "x86_64":
if args.cpu == "aarch64" or args.cpu == "x86_64":
makensis += ["-DW64"]
makensis += ["-DDLLDIR=" + dlldir]
+8 -3
View File
@@ -1935,13 +1935,14 @@ static int hvf_handle_exception(CPUState *cpu, hv_vcpu_exit_exception_t *excp)
break;
case EC_AA64_HVC:
cpu_synchronize_state(cpu);
if (arm_is_psci_call(arm_cpu, EXCP_HVC)) {
if (arm_cpu->psci_conduit == QEMU_PSCI_CONDUIT_HVC) {
/* Do NOT advance $pc for HVC */
if (!hvf_handle_psci_call(cpu)) {
trace_hvf_unknown_hvc(env->pc, env->xregs[0]);
/* SMCCC 1.3 section 5.2 says every unknown SMCCC call returns -1 */
env->xregs[0] = -1;
}
cpu->vcpu_dirty = true;
} else {
trace_hvf_unknown_hvc(env->pc, env->xregs[0]);
hvf_raise_exception(cpu, EXCP_UDEF, syn_uncategorized(), 1);
@@ -1949,7 +1950,7 @@ static int hvf_handle_exception(CPUState *cpu, hv_vcpu_exit_exception_t *excp)
break;
case EC_AA64_SMC:
cpu_synchronize_state(cpu);
if (arm_is_psci_call(arm_cpu, EXCP_SMC)) {
if (arm_cpu->psci_conduit == QEMU_PSCI_CONDUIT_SMC) {
/* Secure Monitor Call exception, we need to advance $pc */
advance_pc = true;
@@ -1958,6 +1959,7 @@ static int hvf_handle_exception(CPUState *cpu, hv_vcpu_exit_exception_t *excp)
/* SMCCC 1.3 section 5.2 says every unknown SMCCC call returns -1 */
env->xregs[0] = -1;
}
cpu->vcpu_dirty = true;
} else {
trace_hvf_unknown_smc(env->xregs[0]);
hvf_raise_exception(cpu, EXCP_UDEF, syn_uncategorized(), 1);
@@ -1980,10 +1982,12 @@ static int hvf_handle_exception(CPUState *cpu, hv_vcpu_exit_exception_t *excp)
error_report("0x%llx: unhandled exception ec=0x%x", env->pc, ec);
}
/* flush any changed cpu state back to HVF */
flush_cpu_state(cpu);
if (advance_pc) {
uint64_t pc;
flush_cpu_state(cpu);
r = hv_vcpu_get_reg(cpu->accel->fd, HV_REG_PC, &pc);
assert_hvf_ok(r);
@@ -2016,6 +2020,7 @@ static int hvf_handle_vmexit(CPUState *cpu, hv_vcpu_exit_t *exit)
break;
case HV_EXIT_REASON_CANCELED:
/* we got kicked, no exit to process */
ret = -1;
break;
default:
g_assert_not_reached();
+16 -5
View File
@@ -250,7 +250,11 @@ void arm_deliver_fault(ARMCPU *cpu, vaddr addr,
fsr = compute_fsr_fsc(env, fi, target_el, mmu_idx, &fsc);
if (access_type == MMU_INST_FETCH) {
syn = syn_insn_abort(same_el, fi->ea, fi->s1ptw, fsc);
if (fi->type == ARMFault_Alignment) {
syn = syn_pcalignment();
} else {
syn = syn_insn_abort(same_el, fi->ea, fi->s1ptw, fsc);
}
exc = EXCP_PREFETCH_ABORT;
} else {
bool gcs = regime_is_gcs(core_to_arm_mmu_idx(env, mmu_idx));
@@ -346,11 +350,18 @@ bool arm_cpu_tlb_fill_align(CPUState *cs, CPUTLBEntryFull *out, vaddr address,
}
/*
* Per R_XCHFJ, alignment fault not due to memory type has
* highest precedence. Otherwise, walk the page table and
* and collect the page description.
* PC alignment faults should be dealt with at translation time
* but we also need to catch them while being probed.
*
* Then per R_XCHFJ, alignment fault not due to memory type take
* precedence. Otherwise, walk the page table and and collect the
* page description.
*
*/
if (address & ((1 << memop_alignment_bits(memop)) - 1)) {
if (access_type == MMU_INST_FETCH && !cpu->env.thumb &&
(address & 3)) {
fi->type = ARMFault_Alignment;
} else if (address & ((1 << memop_alignment_bits(memop)) - 1)) {
fi->type = ARMFault_Alignment;
} else if (!get_phys_addr(&cpu->env, address, access_type, memop,
core_to_arm_mmu_idx(&cpu->env, mmu_idx),
+1 -1
View File
@@ -1916,8 +1916,8 @@ static bool trans_BRA(DisasContext *s, arg_bra *a)
return false;
}
dst = auth_branch_target(s, cpu_reg(s,a->rn), cpu_reg_sp(s, a->rm), !a->m);
gen_a64_set_pc(s, dst);
set_btype_for_br(s, a->rn);
gen_a64_set_pc(s, dst);
s->base.is_jmp = DISAS_JUMP;
return true;
}
+2 -4
View File
@@ -728,7 +728,8 @@ static int hvf_handle_vmexit(CPUState *cpu)
uint64_t exit_qual = rvmcs(cpu->accel->fd, VMCS_EXIT_QUALIFICATION);
uint32_t ins_len = (uint32_t)rvmcs(cpu->accel->fd,
VMCS_EXIT_INSTRUCTION_LENGTH);
CPUX86State *env = &x86_cpu->env;
uint64_t rip = 0;
uint64_t idtvec_info = rvmcs(cpu->accel->fd, VMCS_IDT_VECTORING_INFO);
int ret = 0;
@@ -966,10 +967,7 @@ static int hvf_handle_vmexit(CPUState *cpu)
int hvf_arch_vcpu_exec(CPUState *cpu)
{
X86CPU *x86_cpu = X86_CPU(cpu);
CPUX86State *env = &x86_cpu->env;
int ret = 0;
uint64_t rip = 0;
if (hvf_process_events(cpu)) {
return EXCP_HLT;
+72 -24
View File
@@ -135,6 +135,30 @@ static void tcg_gen_req_mo(TCGBar type)
}
}
static TCGTemp *tci_extend_addr(TCGTemp *addr)
{
#ifdef CONFIG_TCG_INTERPRETER
/*
* 64-bit interpreter requires 64-bit addresses.
* Compare to the extension performed by tcg_out_{ld,st}_helper_args
* for native code generation.
*/
if (TCG_TARGET_REG_BITS == 64 && tcg_ctx->addr_type == TCG_TYPE_I32) {
TCGv_i64 temp = tcg_temp_ebb_new_i64();
tcg_gen_extu_i32_i64(temp, temp_tcgv_i32(addr));
return tcgv_i64_temp(temp);
}
#endif
return addr;
}
static void maybe_free_addr(TCGTemp *addr, TCGTemp *copy)
{
if (addr != copy) {
tcg_temp_free_internal(copy);
}
}
/* Only required for loads, where value might overlap addr. */
static TCGv_i64 plugin_maybe_preserve_addr(TCGTemp *addr)
{
@@ -158,23 +182,21 @@ static void
plugin_gen_mem_callbacks(TCGv_i64 copy_addr, TCGTemp *orig_addr, MemOpIdx oi,
enum qemu_plugin_mem_rw rw)
{
if (tcg_ctx->plugin_insn != NULL) {
qemu_plugin_meminfo_t info = make_plugin_meminfo(oi, rw);
qemu_plugin_meminfo_t info = make_plugin_meminfo(oi, rw);
if (tcg_ctx->addr_type == TCG_TYPE_I32) {
if (!copy_addr) {
copy_addr = tcg_temp_ebb_new_i64();
tcg_gen_extu_i32_i64(copy_addr, temp_tcgv_i32(orig_addr));
}
if (tcg_ctx->addr_type == TCG_TYPE_I32) {
if (!copy_addr) {
copy_addr = tcg_temp_ebb_new_i64();
tcg_gen_extu_i32_i64(copy_addr, temp_tcgv_i32(orig_addr));
}
tcg_gen_plugin_mem_cb(copy_addr, info);
tcg_temp_free_i64(copy_addr);
} else {
if (copy_addr) {
tcg_gen_plugin_mem_cb(copy_addr, info);
tcg_temp_free_i64(copy_addr);
} else {
if (copy_addr) {
tcg_gen_plugin_mem_cb(copy_addr, info);
tcg_temp_free_i64(copy_addr);
} else {
tcg_gen_plugin_mem_cb(temp_tcgv_i64(orig_addr), info);
}
tcg_gen_plugin_mem_cb(temp_tcgv_i64(orig_addr), info);
}
}
}
@@ -234,6 +256,7 @@ static void tcg_gen_qemu_ld_i32_int(TCGv_i32 val, TCGTemp *addr,
MemOp orig_memop;
MemOpIdx orig_oi, oi;
TCGv_i64 copy_addr;
TCGTemp *addr_new;
tcg_gen_req_mo(TCG_MO_LD_LD | TCG_MO_ST_LD);
orig_memop = memop = tcg_canonicalize_memop(memop, 0, 0);
@@ -248,10 +271,12 @@ static void tcg_gen_qemu_ld_i32_int(TCGv_i32 val, TCGTemp *addr,
oi = make_memop_idx(memop, idx);
}
addr_new = tci_extend_addr(addr);
copy_addr = plugin_maybe_preserve_addr(addr);
gen_ldst1(INDEX_op_qemu_ld, TCG_TYPE_I32, tcgv_i32_temp(val), addr, oi);
gen_ldst1(INDEX_op_qemu_ld, TCG_TYPE_I32, tcgv_i32_temp(val), addr_new, oi);
plugin_gen_mem_callbacks_i32(val, copy_addr, addr, orig_oi,
QEMU_PLUGIN_MEM_R);
maybe_free_addr(addr, addr_new);
if ((orig_memop ^ memop) & MO_BSWAP) {
switch (orig_memop & MO_SIZE) {
@@ -282,6 +307,7 @@ static void tcg_gen_qemu_st_i32_int(TCGv_i32 val, TCGTemp *addr,
{
TCGv_i32 swap = NULL;
MemOpIdx orig_oi, oi;
TCGTemp *addr_new;
tcg_gen_req_mo(TCG_MO_LD_ST | TCG_MO_ST_ST);
memop = tcg_canonicalize_memop(memop, 0, 1);
@@ -304,8 +330,10 @@ static void tcg_gen_qemu_st_i32_int(TCGv_i32 val, TCGTemp *addr,
oi = make_memop_idx(memop, idx);
}
gen_ldst1(INDEX_op_qemu_st, TCG_TYPE_I32, tcgv_i32_temp(val), addr, oi);
addr_new = tci_extend_addr(addr);
gen_ldst1(INDEX_op_qemu_st, TCG_TYPE_I32, tcgv_i32_temp(val), addr_new, oi);
plugin_gen_mem_callbacks_i32(val, NULL, addr, orig_oi, QEMU_PLUGIN_MEM_W);
maybe_free_addr(addr, addr_new);
if (swap) {
tcg_temp_free_i32(swap);
@@ -326,6 +354,7 @@ static void tcg_gen_qemu_ld_i64_int(TCGv_i64 val, TCGTemp *addr,
MemOp orig_memop;
MemOpIdx orig_oi, oi;
TCGv_i64 copy_addr;
TCGTemp *addr_new;
if (TCG_TARGET_REG_BITS == 32 && (memop & MO_SIZE) < MO_64) {
tcg_gen_qemu_ld_i32_int(TCGV_LOW(val), addr, idx, memop);
@@ -350,10 +379,12 @@ static void tcg_gen_qemu_ld_i64_int(TCGv_i64 val, TCGTemp *addr,
oi = make_memop_idx(memop, idx);
}
addr_new = tci_extend_addr(addr);
copy_addr = plugin_maybe_preserve_addr(addr);
gen_ld_i64(val, addr, oi);
gen_ld_i64(val, addr_new, oi);
plugin_gen_mem_callbacks_i64(val, copy_addr, addr, orig_oi,
QEMU_PLUGIN_MEM_R);
maybe_free_addr(addr, addr_new);
if ((orig_memop ^ memop) & MO_BSWAP) {
int flags = (orig_memop & MO_SIGN
@@ -388,6 +419,7 @@ static void tcg_gen_qemu_st_i64_int(TCGv_i64 val, TCGTemp *addr,
{
TCGv_i64 swap = NULL;
MemOpIdx orig_oi, oi;
TCGTemp *addr_new;
if (TCG_TARGET_REG_BITS == 32 && (memop & MO_SIZE) < MO_64) {
tcg_gen_qemu_st_i32_int(TCGV_LOW(val), addr, idx, memop);
@@ -418,8 +450,10 @@ static void tcg_gen_qemu_st_i64_int(TCGv_i64 val, TCGTemp *addr,
oi = make_memop_idx(memop, idx);
}
gen_st_i64(val, addr, oi);
addr_new = tci_extend_addr(addr);
gen_st_i64(val, addr_new, oi);
plugin_gen_mem_callbacks_i64(val, NULL, addr, orig_oi, QEMU_PLUGIN_MEM_W);
maybe_free_addr(addr, addr_new);
if (swap) {
tcg_temp_free_i64(swap);
@@ -530,6 +564,7 @@ static void tcg_gen_qemu_ld_i128_int(TCGv_i128 val, TCGTemp *addr,
{
MemOpIdx orig_oi;
TCGv_i64 ext_addr = NULL;
TCGTemp *addr_new;
check_max_alignment(memop_alignment_bits(memop));
tcg_gen_req_mo(TCG_MO_LD_LD | TCG_MO_ST_LD);
@@ -557,8 +592,10 @@ static void tcg_gen_qemu_ld_i128_int(TCGv_i128 val, TCGTemp *addr,
hi = TCGV128_HIGH(val);
}
addr_new = tci_extend_addr(addr);
gen_ldst2(INDEX_op_qemu_ld2, TCG_TYPE_I128, tcgv_i64_temp(lo),
tcgv_i64_temp(hi), addr, oi);
tcgv_i64_temp(hi), addr_new, oi);
maybe_free_addr(addr, addr_new);
if (need_bswap) {
tcg_gen_bswap64_i64(lo, lo);
@@ -586,7 +623,9 @@ static void tcg_gen_qemu_ld_i128_int(TCGv_i128 val, TCGTemp *addr,
y = TCGV128_LOW(val);
}
gen_ld_i64(x, addr, make_memop_idx(mop[0], idx));
addr_new = tci_extend_addr(addr);
gen_ld_i64(x, addr_new, make_memop_idx(mop[0], idx));
maybe_free_addr(addr, addr_new);
if (need_bswap) {
tcg_gen_bswap64_i64(x, x);
@@ -602,7 +641,9 @@ static void tcg_gen_qemu_ld_i128_int(TCGv_i128 val, TCGTemp *addr,
addr_p8 = tcgv_i64_temp(t);
}
gen_ld_i64(y, addr_p8, make_memop_idx(mop[1], idx));
addr_new = tci_extend_addr(addr_p8);
gen_ld_i64(y, addr_new, make_memop_idx(mop[1], idx));
maybe_free_addr(addr_p8, addr_new);
tcg_temp_free_internal(addr_p8);
if (need_bswap) {
@@ -636,6 +677,7 @@ static void tcg_gen_qemu_st_i128_int(TCGv_i128 val, TCGTemp *addr,
{
MemOpIdx orig_oi;
TCGv_i64 ext_addr = NULL;
TCGTemp *addr_new;
check_max_alignment(memop_alignment_bits(memop));
tcg_gen_req_mo(TCG_MO_ST_LD | TCG_MO_ST_ST);
@@ -666,8 +708,10 @@ static void tcg_gen_qemu_st_i128_int(TCGv_i128 val, TCGTemp *addr,
hi = TCGV128_HIGH(val);
}
addr_new = tci_extend_addr(addr);
gen_ldst2(INDEX_op_qemu_st2, TCG_TYPE_I128,
tcgv_i64_temp(lo), tcgv_i64_temp(hi), addr, oi);
tcgv_i64_temp(lo), tcgv_i64_temp(hi), addr_new, oi);
maybe_free_addr(addr, addr_new);
if (need_bswap) {
tcg_temp_free_i64(lo);
@@ -694,7 +738,9 @@ static void tcg_gen_qemu_st_i128_int(TCGv_i128 val, TCGTemp *addr,
x = b;
}
gen_st_i64(x, addr, make_memop_idx(mop[0], idx));
addr_new = tci_extend_addr(addr);
gen_st_i64(x, addr_new, make_memop_idx(mop[0], idx));
maybe_free_addr(addr, addr_new);
if (tcg_ctx->addr_type == TCG_TYPE_I32) {
TCGv_i32 t = tcg_temp_ebb_new_i32();
@@ -706,13 +752,15 @@ static void tcg_gen_qemu_st_i128_int(TCGv_i128 val, TCGTemp *addr,
addr_p8 = tcgv_i64_temp(t);
}
addr_new = tci_extend_addr(addr_p8);
if (b) {
tcg_gen_bswap64_i64(b, y);
gen_st_i64(b, addr_p8, make_memop_idx(mop[1], idx));
gen_st_i64(b, addr_new, make_memop_idx(mop[1], idx));
tcg_temp_free_i64(b);
} else {
gen_st_i64(y, addr_p8, make_memop_idx(mop[1], idx));
gen_st_i64(y, addr_new, make_memop_idx(mop[1], idx));
}
maybe_free_addr(addr_p8, addr_new);
tcg_temp_free_internal(addr_p8);
} else {
if (tcg_ctx->addr_type == TCG_TYPE_I32) {
+19
View File
@@ -794,12 +794,24 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
taddr = regs[r1];
regs[r0] = tci_qemu_ld(env, taddr, oi, tb_ptr);
break;
case INDEX_op_tci_qemu_ld_rrr:
tci_args_rrr(insn, &r0, &r1, &r2);
taddr = regs[r1];
oi = regs[r2];
regs[r0] = tci_qemu_ld(env, taddr, oi, tb_ptr);
break;
case INDEX_op_qemu_st:
tci_args_rrm(insn, &r0, &r1, &oi);
taddr = regs[r1];
tci_qemu_st(env, taddr, regs[r0], oi, tb_ptr);
break;
case INDEX_op_tci_qemu_st_rrr:
tci_args_rrr(insn, &r0, &r1, &r2);
taddr = regs[r1];
oi = regs[r2];
tci_qemu_st(env, taddr, regs[r0], oi, tb_ptr);
break;
case INDEX_op_qemu_ld2:
tcg_debug_assert(TCG_TARGET_REG_BITS == 32);
@@ -1050,6 +1062,13 @@ int print_insn_tci(bfd_vma addr, disassemble_info *info)
op_name, str_r(r0), str_r(r1), oi);
break;
case INDEX_op_tci_qemu_ld_rrr:
case INDEX_op_tci_qemu_st_rrr:
tci_args_rrr(insn, &r0, &r1, &r2);
info->fprintf_func(info->stream, "%-12s %s, %s, %s",
op_name, str_r(r0), str_r(r1), str_r(r2));
break;
case INDEX_op_qemu_ld2:
case INDEX_op_qemu_st2:
tci_args_rrrr(insn, &r0, &r1, &r2, &r3);
+2
View File
@@ -13,3 +13,5 @@ DEF(tci_rotl32, 1, 2, 0, TCG_OPF_NOT_PRESENT)
DEF(tci_rotr32, 1, 2, 0, TCG_OPF_NOT_PRESENT)
DEF(tci_setcond32, 1, 2, 1, TCG_OPF_NOT_PRESENT)
DEF(tci_movcond32, 1, 2, 1, TCG_OPF_NOT_PRESENT)
DEF(tci_qemu_ld_rrr, 1, 2, 0, TCG_OPF_NOT_PRESENT)
DEF(tci_qemu_st_rrr, 0, 3, 0, TCG_OPF_NOT_PRESENT)
+12 -2
View File
@@ -1188,7 +1188,12 @@ static const TCGOutOpStore outop_st = {
static void tgen_qemu_ld(TCGContext *s, TCGType type, TCGReg data,
TCGReg addr, MemOpIdx oi)
{
tcg_out_op_rrm(s, INDEX_op_qemu_ld, data, addr, oi);
if (oi & ~0xffff) {
tcg_out_movi(s, TCG_TYPE_I32, TCG_REG_TMP, oi);
tcg_out_op_rrr(s, INDEX_op_tci_qemu_ld_rrr, data, addr, TCG_REG_TMP);
} else {
tcg_out_op_rrm(s, INDEX_op_qemu_ld, data, addr, oi);
}
}
static const TCGOutOpQemuLdSt outop_qemu_ld = {
@@ -1213,7 +1218,12 @@ static const TCGOutOpQemuLdSt2 outop_qemu_ld2 = {
static void tgen_qemu_st(TCGContext *s, TCGType type, TCGReg data,
TCGReg addr, MemOpIdx oi)
{
tcg_out_op_rrm(s, INDEX_op_qemu_st, data, addr, oi);
if (oi & ~0xffff) {
tcg_out_movi(s, TCG_TYPE_I32, TCG_REG_TMP, oi);
tcg_out_op_rrr(s, INDEX_op_tci_qemu_st_rrr, data, addr, TCG_REG_TMP);
} else {
tcg_out_op_rrm(s, INDEX_op_qemu_st, data, addr, oi);
}
}
static const TCGOutOpQemuLdSt outop_qemu_st = {
+9
View File
@@ -37,6 +37,15 @@ export SRC_PATH
SPEED = quick
# TCG_TESTS_WITH_COMPILERS represents the test targets we have cross compiler
# support for, CONFIGURED_TEST_TARGETS it what meson has finally
# configured having rejected stuff we can't build.
CONFIGURED_TCG_TARGETS=$(patsubst %-config-target.h, %, $(wildcard *-config-target.h))
# This is the intersection of what tests we can build and is configured
TCG_TESTS_TARGETS=$(filter $(CONFIGURED_TCG_TARGETS), $(TCG_TESTS_WITH_COMPILERS))
# Per guest TCG tests
BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(TCG_TESTS_TARGETS))
CLEAN_TCG_TARGET_RULES=$(patsubst %,clean-tcg-tests-%, $(TCG_TESTS_TARGETS))
@@ -1,77 +1,97 @@
# THIS FILE WAS AUTO-GENERATED
#
# Docker all cross-compiler target (tests only)
# $ lcitool dockerfile --layers all debian-13 qemu-minimal
#
# While the normal cross builds take care to setup proper multiarch
# build environments which can cross build QEMU this just installs the
# basic compilers for as many targets as possible. We shall use this
# to build and run linux-user tests on GitLab
#
FROM docker.io/library/debian:12-slim
# https://gitlab.com/libvirt/libvirt-ci
# Duplicate deb line as deb-src
RUN sed -in "s/Types: deb/Types: deb deb-src/g" /etc/apt/sources.list.d/debian.sources
FROM docker.io/library/debian:13-slim
RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get install -y eatmydata && \
eatmydata apt-get dist-upgrade -y && \
apt build-dep -yy --arch-only qemu
eatmydata apt-get install --no-install-recommends -y \
bash \
bc \
bison \
bzip2 \
ca-certificates \
ccache \
findutils \
flex \
gcc \
git \
libc6-dev \
libfdt-dev \
libffi-dev \
libglib2.0-dev \
libpixman-1-dev \
locales \
make \
ninja-build \
pkgconf \
python3 \
python3-pip \
python3-setuptools \
python3-venv \
python3-wheel \
sed \
tar && \
eatmydata apt-get autoremove -y && \
eatmydata apt-get autoclean -y && \
sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \
dpkg-reconfigure locales && \
rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED && \
dpkg-query --showformat '${Package}_${Version}_${Architecture}\n' --show > /packages.txt && \
mkdir -p /usr/libexec/ccache-wrappers && \
ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc && \
ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc
# Add extra build tools and as many cross compilers as we can for testing
RUN /usr/bin/pip3 install meson==1.8.1
ENV CCACHE_WRAPPERSDIR="/usr/libexec/ccache-wrappers"
ENV LANG="en_US.UTF-8"
ENV MAKE="/usr/bin/make"
ENV NINJA="/usr/bin/ninja"
ENV PYTHON="/usr/bin/python3"
# extras for cross and alternate toolchains
RUN DEBIAN_FRONTEND=noninteractive eatmydata \
apt install -y --no-install-recommends \
bison \
ccache \
clang \
dpkg-dev \
flex \
gcc \
git \
libclang-rt-dev \
ninja-build \
python3-pip \
python3-setuptools \
python3-tomli \
python3-venv \
python3-wheel
# All the generally available compilers
apt install -y --no-install-recommends \
clang\
dpkg-dev\
libclang-rt-dev
ENV AVAILABLE_COMPILERS gcc-aarch64-linux-gnu \
libc6-dev-arm64-cross \
gcc-arm-linux-gnueabihf \
libc6-dev-armhf-cross \
gcc-mips-linux-gnu \
libc6-dev-mips-cross \
gcc-mips64-linux-gnuabi64 \
libc6-dev-mips64-cross \
gcc-mips64el-linux-gnuabi64 \
libc6-dev-mips64el-cross \
gcc-mipsel-linux-gnu \
libc6-dev-mipsel-cross \
gcc-powerpc64le-linux-gnu \
libc6-dev-ppc64el-cross \
gcc-riscv64-linux-gnu \
libc6-dev-riscv64-cross \
gcc-s390x-linux-gnu \
libc6-dev-s390x-cross
libc6-dev-arm64-cross \
gcc-arm-linux-gnueabihf \
libc6-dev-armhf-cross \
gcc-mips-linux-gnu \
libc6-dev-mips-cross \
gcc-mips64-linux-gnuabi64 \
libc6-dev-mips64-cross \
gcc-mips64el-linux-gnuabi64 \
libc6-dev-mips64el-cross \
gcc-mipsel-linux-gnu \
libc6-dev-mipsel-cross \
gcc-powerpc64le-linux-gnu \
libc6-dev-ppc64el-cross \
gcc-riscv64-linux-gnu \
libc6-dev-riscv64-cross \
gcc-s390x-linux-gnu \
libc6-dev-s390x-cross
RUN if dpkg-architecture -e amd64; then \
export AVAILABLE_COMPILERS="${AVAILABLE_COMPILERS} gcc-hppa-linux-gnu libc6-dev-hppa-cross"; \
export AVAILABLE_COMPILERS="${AVAILABLE_COMPILERS} gcc-m68k-linux-gnu libc6-dev-m68k-cross"; \
export AVAILABLE_COMPILERS="${AVAILABLE_COMPILERS} gcc-powerpc-linux-gnu libc6-dev-powerpc-cross"; \
export AVAILABLE_COMPILERS="${AVAILABLE_COMPILERS} gcc-powerpc64-linux-gnu libc6-dev-ppc64-cross"; \
export AVAILABLE_COMPILERS="${AVAILABLE_COMPILERS} gcc-sparc64-linux-gnu libc6-dev-sparc64-cross"; \
fi && \
DEBIAN_FRONTEND=noninteractive eatmydata \
apt install -y --no-install-recommends \
${AVAILABLE_COMPILERS} && \
dpkg-query --showformat '${Package}_${Version}_${Architecture}\n' --show > /packages.txt
ENV QEMU_CONFIGURE_OPTS --disable-system --disable-docs --disable-tools
fi && \
DEBIAN_FRONTEND=noninteractive eatmydata \
apt install -y --no-install-recommends \
${AVAILABLE_COMPILERS} && \
dpkg-query --showformat '${Package}_${Version}_${Architecture}' --show > /packages.txt
ENV QEMU_CONFIGURE_OPTS --disable-docs
ENV DEF_TARGET_LIST aarch64-linux-user,arm-linux-user,hppa-linux-user,i386-linux-user,m68k-linux-user,mips-linux-user,mips64-linux-user,mips64el-linux-user,mipsel-linux-user,ppc-linux-user,ppc64-linux-user,ppc64le-linux-user,riscv64-linux-user,s390x-linux-user,sparc64-linux-user
# As a final step configure the user (if env is defined)
ENV MAKE /usr/bin/make
ARG USER
ARG UID
RUN if [ "${USER}" ]; then \
+1
View File
@@ -4,6 +4,7 @@ packages:
- bash
- bc
- bison
- bzip2
- ccache
- findutils
- flex
+49
View File
@@ -161,6 +161,46 @@ ubuntu2204_rust_extras = [
'RUN cargo install bindgen-cli\n',
]
debian_all_test_cross_compilers = [
"# extras for cross and alternate toolchains\n",
"RUN DEBIAN_FRONTEND=noninteractive eatmydata \\\n",
" apt install -y --no-install-recommends \\\n",
" clang\\\n",
" dpkg-dev\\\n",
" libclang-rt-dev\n",
"ENV AVAILABLE_COMPILERS gcc-aarch64-linux-gnu \\\n",
" libc6-dev-arm64-cross \\\n",
" gcc-arm-linux-gnueabihf \\\n",
" libc6-dev-armhf-cross \\\n",
" gcc-mips-linux-gnu \\\n",
" libc6-dev-mips-cross \\\n",
" gcc-mips64-linux-gnuabi64 \\\n",
" libc6-dev-mips64-cross \\\n",
" gcc-mips64el-linux-gnuabi64 \\\n",
" libc6-dev-mips64el-cross \\\n",
" gcc-mipsel-linux-gnu \\\n",
" libc6-dev-mipsel-cross \\\n",
" gcc-powerpc64le-linux-gnu \\\n",
" libc6-dev-ppc64el-cross \\\n",
" gcc-riscv64-linux-gnu \\\n",
" libc6-dev-riscv64-cross \\\n",
" gcc-s390x-linux-gnu \\\n",
" libc6-dev-s390x-cross\n",
"RUN if dpkg-architecture -e amd64; then \\\n",
" export AVAILABLE_COMPILERS=\"${AVAILABLE_COMPILERS} gcc-hppa-linux-gnu libc6-dev-hppa-cross\"; \\\n",
" export AVAILABLE_COMPILERS=\"${AVAILABLE_COMPILERS} gcc-m68k-linux-gnu libc6-dev-m68k-cross\"; \\\n",
" export AVAILABLE_COMPILERS=\"${AVAILABLE_COMPILERS} gcc-powerpc-linux-gnu libc6-dev-powerpc-cross\"; \\\n",
" export AVAILABLE_COMPILERS=\"${AVAILABLE_COMPILERS} gcc-powerpc64-linux-gnu libc6-dev-ppc64-cross\"; \\\n",
" export AVAILABLE_COMPILERS=\"${AVAILABLE_COMPILERS} gcc-sparc64-linux-gnu libc6-dev-sparc64-cross\"; \\\n",
"fi && \\\n",
"DEBIAN_FRONTEND=noninteractive eatmydata \\\n",
"apt install -y --no-install-recommends \\\n",
"${AVAILABLE_COMPILERS} && \\\n",
"dpkg-query --showformat '${Package}_${Version}_${Architecture}' --show > /packages.txt\n",
"ENV QEMU_CONFIGURE_OPTS --disable-docs\n",
"ENV DEF_TARGET_LIST aarch64-linux-user,arm-linux-user,hppa-linux-user,i386-linux-user,m68k-linux-user,mips-linux-user,mips64-linux-user,mips64el-linux-user,mipsel-linux-user,ppc-linux-user,ppc64-linux-user,ppc64le-linux-user,riscv64-linux-user,s390x-linux-user,sparc64-linux-user\n",
]
def cross_build(prefix, targets):
conf = "ENV QEMU_CONFIGURE_OPTS=--cross-prefix=%s\n" % (prefix)
targets = "ENV DEF_TARGET_LIST=%s\n" % (targets)
@@ -256,6 +296,15 @@ try:
# https://github.com/mesonbuild/meson/pull/14991
enable_rust=False)
# We also generate some docker files with minimal dependencies and
# as many cross-compilers as Debian will package for building TCG
# tests.
generate_dockerfile("debian-all-test-cross", "debian-13",
project="qemu-minimal",
enable_rust=False,
trailer="".join(debian_all_test_cross_compilers))
#
# Cirrus packages lists for GitLab
#
+2
View File
@@ -39,6 +39,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
_supported_fmt qcow2
_supported_proto file
_require_secret
filter_test_dir()
{
+1
View File
@@ -39,6 +39,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
_supported_fmt qcow qcow2
_supported_proto file
_require_secret
size=128M
+1
View File
@@ -39,6 +39,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
_supported_fmt qcow qcow2
_supported_proto file
_require_secret
size=128M
+15 -1
View File
@@ -1008,7 +1008,7 @@ _require_disk_usage()
else
FILENAME="$TEST_IMG_FILE"
fi
if [ -e "FILENAME" ]; then
if [ -e "$FILENAME" ]; then
echo "unwilling to overwrite existing file"
exit 1
fi
@@ -1053,6 +1053,20 @@ _require_one_device_of()
_notrun "$* not available"
}
_require_secret()
{
if [ -e "$TEST_IMG" ]; then
echo "unwilling to overwrite existing file"
exit 1
fi
if $QEMU_IMG create -f $IMGFMT --object secret,id=sec0,data=123 \
-o encryption=on,encrypt.key-secret=sec0 "$TEST_IMG" 1M 2>&1 \
| grep "Unsupported cipher" ; then
_notrun "missing cipher support"
fi
rm -f "$TEST_IMG"
}
_qcow2_dump_header()
{
if [[ "$1" == "--no-filter-compression" ]]; then
+4 -6
View File
@@ -746,14 +746,12 @@ vubr_run(VubrDev *dev)
static int
vubr_parse_host_port(const char **host, const char **port, const char *buf)
{
char *p = strchr(buf, ':');
if (!p) {
g_auto(GStrv) tokens = g_strsplit(buf, ":", 2);
if (!tokens[0] || !tokens[1]) {
return -1;
}
*p = '\0';
*host = strdup(buf);
*port = strdup(p + 1);
*host = g_steal_pointer(&tokens[0]);
*port = g_steal_pointer(&tokens[1]);
return 0;
}
+1 -1
View File
@@ -418,7 +418,7 @@ err_out:
void sendkey_completion(ReadLineState *rs, int nb_args, const char *str)
{
int i;
char *sep;
const char *sep;
size_t len;
if (nb_args != 2) {
+1 -1
View File
@@ -203,7 +203,7 @@ static ValidFilenameTemplateResult
valid_filename_template(const char *filename, bool per_thread, Error **errp)
{
if (filename) {
char *pidstr = strstr(filename, "%");
const char *pidstr = strstr(filename, "%");
if (pidstr) {
/* We only accept one %d, no other format strings */