mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging
* first commit for Rust support * add CI job using Fedora + Rust nightly * fix detection of ATOMIC128 on x86_64 * fix compilation with Sphinx 8.1.0 # -----BEGIN PGP SIGNATURE----- # # iQFIBAABCAAyFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAmcJEKUUHHBib256aW5p # QHJlZGhhdC5jb20ACgkQv/vSX3jHroOSZQf+LlvZm9npHR6lZ9DEruhu/uf0c1gO # 9+dBJiKQ1OWopSQOqEgOsLL0J123Ls4V8O3tzZwIDuuRofCB2+wKswad6CHoydJx # 4p9rRXv6MLlnTqqGxemm/dPZqJ7+6L0poHoDKW+s7AgfVDshhj1RSbQfs8Ujh41F # f1sdi3DzopVWtK4CE+8/UeLy5Cxlixke9SKhYQrFHrdsANARP81gxQjczKApMc1z # v9qkrLtkM06VUyuvbPps7CHSHDpzx9mXcmkkPgLqLX9MfbCztzi44aVSaS9HYk5G # y54dSKdY7VJEuGhG916G+GMDJyow4nhT9Gk6tWtk63TQN5nExVsoZMOmdw== # =PFGL # -----END PGP SIGNATURE----- # gpg: Signature made Fri 11 Oct 2024 12:48:53 BST # gpg: using RSA key F13338574B662389866C7682BFFBD25F78C7AE83 # gpg: issuer "pbonzini@redhat.com" # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full] # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" [full] # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1 # Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83 * tag 'for-upstream' of https://gitlab.com/bonzini/qemu: docs: use consistent markup for footnotes docs: avoid footnotes consisting of just URLs docs: fix invalid footnote syntax gitlab-ci: add Rust-enabled CI job dockerfiles: add a Dockerfile using a nightly Rust toolchain meson: ensure -mcx16 is passed when detecting ATOMIC128 meson: define qemu_isa_flags meson: fix machine option for x86_version rust: add PL011 device model rust: add utility procedural macro crate scripts/archive-source: find directory name for subprojects rust: add crate to expose bindings and interfaces meson.build: add HAVE_GLIB_WITH_ALIGNED_ALLOC flag .gitattributes: add Rust diff and merge attributes rust: add bindgen step as a meson dependency configure, meson: detect Rust toolchain build-sys: Add rust feature option Require meson version 1.5.0 Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
@@ -2,3 +2,6 @@
|
||||
*.h.inc diff=c
|
||||
*.m diff=objc
|
||||
*.py diff=python
|
||||
*.rs diff=rust
|
||||
*.rs.inc diff=rust
|
||||
Cargo.lock diff=toml merge=binary
|
||||
|
||||
@@ -120,6 +120,19 @@ build-system-fedora:
|
||||
xtensa-softmmu m68k-softmmu riscv32-softmmu ppc-softmmu sparc64-softmmu
|
||||
MAKE_CHECK_ARGS: check-build
|
||||
|
||||
build-system-fedora-rust-nightly:
|
||||
extends:
|
||||
- .native_build_job_template
|
||||
- .native_build_artifact_template
|
||||
needs:
|
||||
job: amd64-fedora-rust-nightly-container
|
||||
variables:
|
||||
IMAGE: fedora-rust-nightly
|
||||
CONFIGURE_ARGS: --disable-docs --enable-rust
|
||||
TARGETS: aarch64-softmmu
|
||||
MAKE_CHECK_ARGS: check-build
|
||||
allow_failure: true
|
||||
|
||||
check-system-fedora:
|
||||
extends: .native_test_job_template
|
||||
needs:
|
||||
|
||||
@@ -27,3 +27,9 @@ python-container:
|
||||
extends: .container_job_template
|
||||
variables:
|
||||
NAME: python
|
||||
|
||||
amd64-fedora-rust-nightly-container:
|
||||
extends: .container_job_template
|
||||
variables:
|
||||
NAME: fedora-rust-nightly
|
||||
allow_failure: true
|
||||
|
||||
@@ -4,3 +4,4 @@ source accel/Kconfig
|
||||
source target/Kconfig
|
||||
source hw/Kconfig
|
||||
source semihosting/Kconfig
|
||||
source rust/Kconfig
|
||||
|
||||
@@ -52,3 +52,6 @@ config VFIO_USER_SERVER_ALLOWED
|
||||
|
||||
config HV_BALLOON_POSSIBLE
|
||||
bool
|
||||
|
||||
config HAVE_RUST
|
||||
bool
|
||||
|
||||
+21
@@ -1134,6 +1134,11 @@ F: include/hw/*/microbit*.h
|
||||
F: tests/qtest/microbit-test.c
|
||||
F: docs/system/arm/nrf.rst
|
||||
|
||||
ARM PL011 Rust device
|
||||
M: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
|
||||
S: Maintained
|
||||
F: rust/hw/char/pl011/
|
||||
|
||||
AVR Machines
|
||||
-------------
|
||||
|
||||
@@ -3286,6 +3291,13 @@ F: hw/core/register.c
|
||||
F: include/hw/register.h
|
||||
F: include/hw/registerfields.h
|
||||
|
||||
Rust
|
||||
M: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
|
||||
S: Maintained
|
||||
F: rust/qemu-api
|
||||
F: rust/qemu-api-macros
|
||||
F: rust/rustfmt.toml
|
||||
|
||||
SLIRP
|
||||
M: Samuel Thibault <samuel.thibault@ens-lyon.org>
|
||||
S: Maintained
|
||||
@@ -4183,6 +4195,15 @@ F: docs/sphinx/
|
||||
F: docs/_templates/
|
||||
F: docs/devel/docs.rst
|
||||
|
||||
Rust build system integration
|
||||
M: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
|
||||
S: Maintained
|
||||
F: scripts/rust/
|
||||
F: rust/.gitignore
|
||||
F: rust/Kconfig
|
||||
F: rust/meson.build
|
||||
F: rust/wrapper.h
|
||||
|
||||
Miscellaneous
|
||||
-------------
|
||||
Performance Tools and Tests
|
||||
|
||||
@@ -207,6 +207,8 @@ for opt do
|
||||
;;
|
||||
--objcc=*) objcc="$optarg"
|
||||
;;
|
||||
--rustc=*) RUSTC="$optarg"
|
||||
;;
|
||||
--cpu=*) cpu="$optarg"
|
||||
;;
|
||||
--extra-cflags=*)
|
||||
@@ -252,6 +254,8 @@ python=
|
||||
download="enabled"
|
||||
skip_meson=no
|
||||
use_containers="yes"
|
||||
rust="disabled"
|
||||
rust_target_triple=""
|
||||
gdb_bin=$(command -v "gdb-multiarch" || command -v "gdb")
|
||||
gdb_arches=""
|
||||
|
||||
@@ -310,6 +314,7 @@ objcopy="${OBJCOPY-${cross_prefix}objcopy}"
|
||||
ld="${LD-${cross_prefix}ld}"
|
||||
ranlib="${RANLIB-${cross_prefix}ranlib}"
|
||||
nm="${NM-${cross_prefix}nm}"
|
||||
readelf="${READELF-${cross_prefix}readelf}"
|
||||
strip="${STRIP-${cross_prefix}strip}"
|
||||
widl="${WIDL-${cross_prefix}widl}"
|
||||
windres="${WINDRES-${cross_prefix}windres}"
|
||||
@@ -317,6 +322,8 @@ windmc="${WINDMC-${cross_prefix}windmc}"
|
||||
pkg_config="${PKG_CONFIG-${cross_prefix}pkg-config}"
|
||||
sdl2_config="${SDL2_CONFIG-${cross_prefix}sdl2-config}"
|
||||
|
||||
rustc="${RUSTC-rustc}"
|
||||
|
||||
check_define() {
|
||||
cat > $TMPC <<EOF
|
||||
#if !defined($1)
|
||||
@@ -425,6 +432,7 @@ fi
|
||||
# Please keep it sorted and synchronized with meson.build's host_arch.
|
||||
host_arch=
|
||||
linux_arch=
|
||||
raw_cpu=$cpu
|
||||
case "$cpu" in
|
||||
aarch64)
|
||||
host_arch=aarch64
|
||||
@@ -658,6 +666,8 @@ for opt do
|
||||
;;
|
||||
--objcc=*)
|
||||
;;
|
||||
--rustc=*)
|
||||
;;
|
||||
--make=*)
|
||||
;;
|
||||
--install=*)
|
||||
@@ -777,8 +787,14 @@ for opt do
|
||||
;;
|
||||
--container-engine=*) container_engine="$optarg"
|
||||
;;
|
||||
--rust-target-triple=*) rust_target_triple="$optarg"
|
||||
;;
|
||||
--gdb=*) gdb_bin="$optarg"
|
||||
;;
|
||||
--enable-rust) rust=enabled
|
||||
;;
|
||||
--disable-rust) rust=disabled
|
||||
;;
|
||||
# everything else has the same name in configure and meson
|
||||
--*) meson_option_parse "$opt" "$optarg"
|
||||
;;
|
||||
@@ -881,6 +897,7 @@ Advanced options (experts only):
|
||||
at build time [$host_cc]
|
||||
--cxx=CXX use C++ compiler CXX [$cxx]
|
||||
--objcc=OBJCC use Objective-C compiler OBJCC [$objcc]
|
||||
--rustc=RUSTC use Rust compiler RUSTC [$rustc]
|
||||
--extra-cflags=CFLAGS append extra C compiler flags CFLAGS
|
||||
--extra-cxxflags=CXXFLAGS append extra C++ compiler flags CXXFLAGS
|
||||
--extra-objcflags=OBJCFLAGS append extra Objective C compiler flags OBJCFLAGS
|
||||
@@ -891,8 +908,9 @@ Advanced options (experts only):
|
||||
--python=PYTHON use specified python [$python]
|
||||
--ninja=NINJA use specified ninja [$ninja]
|
||||
--static enable static build [$static]
|
||||
--without-default-features default all --enable-* options to "disabled"
|
||||
--without-default-devices do not include any device that is not needed to
|
||||
--rust-target-triple=TRIPLE compilation target for Rust code [autodetect]
|
||||
--without-default-features default all --enable-* options to "disabled"
|
||||
--without-default-devices do not include any device that is not needed to
|
||||
start the emulator (only use if you are including
|
||||
desired devices in configs/devices/)
|
||||
--with-devices-ARCH=NAME override default configs/devices
|
||||
@@ -1166,6 +1184,132 @@ EOF
|
||||
fi
|
||||
fi
|
||||
|
||||
##########################################
|
||||
# detect rust triple
|
||||
|
||||
if test "$rust" != disabled && has "$rustc" && $rustc -vV > "${TMPDIR1}/${TMPB}.out"; then
|
||||
rust_host_triple=$(sed -n 's/^host: //p' "${TMPDIR1}/${TMPB}.out")
|
||||
else
|
||||
if test "$rust" = enabled; then
|
||||
error_exit "could not execute rustc binary \"$rustc\""
|
||||
fi
|
||||
rust=disabled
|
||||
fi
|
||||
if test "$rust" != disabled && test -z "$rust_target_triple"; then
|
||||
# arch and os generally matches between meson and rust
|
||||
rust_arch=$host_arch
|
||||
rust_os=$host_os
|
||||
rust_machine=unknown
|
||||
rust_osvariant=
|
||||
|
||||
# tweak rust_os if needed; also, machine and variant depend on the OS
|
||||
android=no
|
||||
case "$host_os" in
|
||||
darwin)
|
||||
# e.g. aarch64-apple-darwin
|
||||
rust_machine=apple
|
||||
;;
|
||||
|
||||
linux)
|
||||
# detect android/glibc/musl
|
||||
if check_define __ANDROID__; then
|
||||
rust_osvariant=android
|
||||
android=yes
|
||||
else
|
||||
cat > $TMPC << EOF
|
||||
#define _GNU_SOURCE
|
||||
#include <features.h>
|
||||
#ifndef __USE_GNU
|
||||
error using musl
|
||||
#endif
|
||||
EOF
|
||||
if compile_object; then
|
||||
rust_osvariant=gnu
|
||||
else
|
||||
rust_osvariant=musl
|
||||
fi
|
||||
fi
|
||||
|
||||
case "$host_arch" in
|
||||
arm)
|
||||
# e.g. arm-unknown-linux-gnueabi, arm-unknown-linux-gnueabihf
|
||||
write_c_skeleton
|
||||
compile_object
|
||||
if $READELF -A $TMPO | grep Tag_API_VFP_args: > /dev/null; then
|
||||
rust_osvariant=${rust_osvariant}eabihf
|
||||
else
|
||||
rust_osvariant=${rust_osvariant}eabi
|
||||
fi
|
||||
;;
|
||||
|
||||
mips64)
|
||||
# e.g. mips64-unknown-linux-gnuabi64
|
||||
rust_osvariant=${rust_osvariant}abi64
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
netbsd)
|
||||
# e.g. arm-unknown-netbsd-eabihf
|
||||
test "$host_arch" = arm && rust_osvariant=eabihf
|
||||
;;
|
||||
|
||||
sunos)
|
||||
rust_machine=pc
|
||||
rust_os=solaris
|
||||
;;
|
||||
|
||||
windows)
|
||||
# e.g. aarch64-pc-windows-gnullvm, x86_64-pc-windows-gnu (MSVC not supported)
|
||||
rust_machine=pc
|
||||
if test "$host_arch" = aarch64; then
|
||||
rust_osvariant=gnullvm
|
||||
else
|
||||
rust_osvariant=gnu
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# now tweak the architecture part, possibly based on pre-canonicalization --cpu
|
||||
case "$host_arch" in
|
||||
arm)
|
||||
# preserve ISA version (armv7 etc.) from $raw_cpu if passed via --cpu
|
||||
rust_arch=$raw_cpu
|
||||
test "$rust_arch" = arm && test "$rust_os" != linux && rust_arch=armv7
|
||||
;;
|
||||
|
||||
mips|mips64)
|
||||
# preserve ISA version (mipsisa64r6 etc.) and include endianness
|
||||
rust_arch=${raw_cpu%el}
|
||||
test "$bigendian" = no && rust_arch=${rust_arch}el
|
||||
;;
|
||||
|
||||
riscv32|riscv64)
|
||||
# e.g. riscv64gc-unknown-linux-gnu, but riscv64-linux-android
|
||||
test "$android" = no && rust_arch=${rust_arch}gc
|
||||
;;
|
||||
|
||||
sparc64)
|
||||
if test "$rust_os" = solaris; then
|
||||
rust_arch=sparcv9
|
||||
rust_machine=sun
|
||||
fi
|
||||
;;
|
||||
|
||||
x86_64)
|
||||
# e.g. x86_64-unknown-linux-gnux32
|
||||
test "$raw_cpu" = x32 && rust_osvariant=${rust_osvariant}x32
|
||||
;;
|
||||
esac
|
||||
|
||||
if test "$android" = yes; then
|
||||
# e.g. aarch64-linux-android
|
||||
rust_target_triple=$rust_arch-$rust_os-$rust_osvariant
|
||||
else
|
||||
rust_target_triple=$rust_arch-$rust_machine-$rust_os${rust_osvariant:+-$rust_osvariant}
|
||||
fi
|
||||
fi
|
||||
|
||||
##########################################
|
||||
# functions to probe cross compilers
|
||||
|
||||
@@ -1628,6 +1772,9 @@ if test "$container" != no; then
|
||||
echo "RUNC=$runc" >> $config_host_mak
|
||||
fi
|
||||
echo "SUBDIRS=$subdirs" >> $config_host_mak
|
||||
if test "$rust" != disabled; then
|
||||
echo "RUST_TARGET_TRIPLE=$rust_target_triple" >> $config_host_mak
|
||||
fi
|
||||
echo "PYTHON=$python" >> $config_host_mak
|
||||
echo "MKVENV_ENSUREGROUP=$mkvenv ensuregroup $mkvenv_online_flag" >> $config_host_mak
|
||||
echo "GENISOIMAGE=$genisoimage" >> $config_host_mak
|
||||
@@ -1764,12 +1911,20 @@ if test "$skip_meson" = no; then
|
||||
echo "c = [$(meson_quote $cc $CPU_CFLAGS)]" >> $cross
|
||||
test -n "$cxx" && echo "cpp = [$(meson_quote $cxx $CPU_CFLAGS)]" >> $cross
|
||||
test -n "$objcc" && echo "objc = [$(meson_quote $objcc $CPU_CFLAGS)]" >> $cross
|
||||
if test "$rust" != disabled; then
|
||||
if test "$rust_host_triple" != "$rust_target_triple"; then
|
||||
echo "rust = [$(meson_quote $rustc --target "$rust_target_triple")]" >> $cross
|
||||
else
|
||||
echo "rust = [$(meson_quote $rustc)]" >> $cross
|
||||
fi
|
||||
fi
|
||||
echo "ar = [$(meson_quote $ar)]" >> $cross
|
||||
echo "dlltool = [$(meson_quote $dlltool)]" >> $cross
|
||||
echo "nm = [$(meson_quote $nm)]" >> $cross
|
||||
echo "pkgconfig = [$(meson_quote $pkg_config)]" >> $cross
|
||||
echo "pkg-config = [$(meson_quote $pkg_config)]" >> $cross
|
||||
echo "ranlib = [$(meson_quote $ranlib)]" >> $cross
|
||||
echo "readelf = [$(meson_quote $readelf)]" >> $cross
|
||||
if has $sdl2_config; then
|
||||
echo "sdl2-config = [$(meson_quote $sdl2_config)]" >> $cross
|
||||
fi
|
||||
@@ -1799,6 +1954,9 @@ if test "$skip_meson" = no; then
|
||||
echo "# Automatically generated by configure - do not modify" > $native
|
||||
echo "[binaries]" >> $native
|
||||
echo "c = [$(meson_quote $host_cc)]" >> $native
|
||||
if test "$rust" != disabled; then
|
||||
echo "rust = [$(meson_quote $rustc)]" >> $cross
|
||||
fi
|
||||
mv $native config-meson.native
|
||||
meson_option_add --native-file
|
||||
meson_option_add config-meson.native
|
||||
@@ -1817,6 +1975,7 @@ if test "$skip_meson" = no; then
|
||||
test "$pie" = no && meson_option_add -Db_pie=false
|
||||
|
||||
# QEMU options
|
||||
test "$rust" != "auto" && meson_option_add "-Drust=$rust"
|
||||
test "$cfi" != false && meson_option_add "-Dcfi=$cfi" "-Db_lto=$cfi"
|
||||
test "$docs" != auto && meson_option_add "-Ddocs=$docs"
|
||||
test -n "${LIB_FUZZING_ENGINE+xxx}" && meson_option_add "-Dfuzzing_engine=$LIB_FUZZING_ENGINE"
|
||||
@@ -1901,3 +2060,10 @@ echo ' "$@"' >>config.status
|
||||
chmod +x config.status
|
||||
|
||||
rm -r "$TMPDIR1"
|
||||
|
||||
if test "$rust" != disabled; then
|
||||
echo '\nINFO: Rust bindings generation with `bindgen` might fail in some cases where'
|
||||
echo 'the detected `libclang` does not match the expected `clang` version/target. In'
|
||||
echo 'this case you must pass the path to `clang` and `libclang` to your build'
|
||||
echo 'command invocation using the environment variables CLANG_PATH and LIBCLANG_PATH'
|
||||
fi
|
||||
|
||||
@@ -204,7 +204,7 @@ They come in six kinds:
|
||||
before the second with respect to the other components of the system.
|
||||
Therefore, unlike ``smp_rmb()`` or ``qatomic_load_acquire()``,
|
||||
``smp_read_barrier_depends()`` can be just a compiler barrier on
|
||||
weakly-ordered architectures such as Arm or PPC[#]_.
|
||||
weakly-ordered architectures such as Arm or PPC\ [#alpha]_.
|
||||
|
||||
Note that the first load really has to have a _data_ dependency and not
|
||||
a control dependency. If the address for the second load is dependent
|
||||
@@ -212,7 +212,7 @@ They come in six kinds:
|
||||
than actually loading the address itself, then it's a _control_
|
||||
dependency and a full read barrier or better is required.
|
||||
|
||||
.. [#] The DEC Alpha is an exception, because ``smp_read_barrier_depends()``
|
||||
.. [#alpha] The DEC Alpha is an exception, because ``smp_read_barrier_depends()``
|
||||
needs a processor barrier. On strongly-ordered architectures such
|
||||
as x86 or s390, ``smp_rmb()`` and ``qatomic_load_acquire()`` can
|
||||
also be compiler barriers only.
|
||||
@@ -295,7 +295,7 @@ Acquire/release pairing and the *synchronizes-with* relation
|
||||
------------------------------------------------------------
|
||||
|
||||
Atomic operations other than ``qatomic_set()`` and ``qatomic_read()`` have
|
||||
either *acquire* or *release* semantics [#rmw]_. This has two effects:
|
||||
either *acquire* or *release* semantics\ [#rmw]_. This has two effects:
|
||||
|
||||
.. [#rmw] Read-modify-write operations can have both---acquire applies to the
|
||||
read part, and release to the write.
|
||||
|
||||
@@ -145,13 +145,13 @@ was installed in the ``site-packages`` directory of another interpreter,
|
||||
or with the wrong ``pip`` program.
|
||||
|
||||
If a package is available for the chosen interpreter, ``configure``
|
||||
prepares a small script that invokes it from the venv itself[#distlib]_.
|
||||
prepares a small script that invokes it from the venv itself\ [#distlib]_.
|
||||
If not, ``configure`` can also optionally install dependencies in the
|
||||
virtual environment with ``pip``, either from wheels in ``python/wheels``
|
||||
or by downloading the package with PyPI. Downloading can be disabled with
|
||||
``--disable-download``; and anyway, it only happens when a ``configure``
|
||||
option (currently, only ``--enable-docs``) is explicitly enabled but
|
||||
the dependencies are not present[#pip]_.
|
||||
the dependencies are not present\ [#pip]_.
|
||||
|
||||
.. [#distlib] The scripts are created based on the package's metadata,
|
||||
specifically the ``console_script`` entry points. This is the
|
||||
@@ -333,7 +333,7 @@ into each emulator:
|
||||
|
||||
``default-configs/targets/*.mak``
|
||||
These files mostly define symbols that appear in the ``*-config-target.h``
|
||||
file for each emulator [#cfgtarget]_. However, the ``TARGET_ARCH``
|
||||
file for each emulator\ [#cfgtarget]_. However, the ``TARGET_ARCH``
|
||||
and ``TARGET_BASE_ARCH`` will also be used to select the ``hw/`` and
|
||||
``target/`` subdirectories that are compiled into each target.
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ guest CPU state in case of a guest CPU exception. This is passed
|
||||
to ``cpu_restore_state()``. Therefore the value should either be 0,
|
||||
to indicate that the guest CPU state is already synchronized, or
|
||||
the result of ``GETPC()`` from the top level ``HELPER(foo)``
|
||||
function, which is a return address into the generated code [#gpc]_.
|
||||
function, which is a return address into the generated code\ [#gpc]_.
|
||||
|
||||
.. [#gpc] Note that ``GETPC()`` should be used with great care: calling
|
||||
it in other functions that are *not* the top level
|
||||
|
||||
@@ -99,9 +99,9 @@ members of the QEMU community, you should make arrangements to attend
|
||||
a `KeySigningParty <https://wiki.qemu.org/KeySigningParty>`__ (for
|
||||
example at KVM Forum) or make alternative arrangements to have your
|
||||
key signed by an attendee. Key signing requires meeting another
|
||||
community member **in person** [#]_ so please make appropriate
|
||||
community member **in person**\ [#2020]_ so please make appropriate
|
||||
arrangements.
|
||||
|
||||
.. [#] In recent pandemic times we have had to exercise some
|
||||
.. [#2020] In recent pandemic times we have had to exercise some
|
||||
flexibility here. Maintainers still need to sign their pull
|
||||
requests though.
|
||||
|
||||
@@ -44,7 +44,7 @@ Use-cases
|
||||
|
||||
The mapped-ram feature was designed for use cases where the migration
|
||||
stream will be directed to a file in the filesystem and not
|
||||
immediately restored on the destination VM [#]_. These could be
|
||||
immediately restored on the destination VM\ [#alternatives]_. These could be
|
||||
thought of as snapshots. We can further categorize them into live and
|
||||
non-live.
|
||||
|
||||
@@ -70,7 +70,7 @@ mapped-ram in this scenario is portability since background-snapshot
|
||||
depends on async dirty tracking (KVM_GET_DIRTY_LOG) which is not
|
||||
supported outside of Linux.
|
||||
|
||||
.. [#] While this same effect could be obtained with the usage of
|
||||
.. [#alternatives] While this same effect could be obtained with the usage of
|
||||
snapshots or the ``file:`` migration alone, mapped-ram provides
|
||||
a performance increase for VMs with larger RAM sizes (10s to
|
||||
100s of GiBs), specially if the VM has been stopped beforehand.
|
||||
|
||||
@@ -30,15 +30,20 @@ OS modules are generally written using low level languages such as C and
|
||||
low level assembly machine language. Writing test routines in a low level
|
||||
language makes things more cumbersome. These and other reasons makes using
|
||||
bios-bits very attractive for testing bioses. More details on the inspiration
|
||||
for developing biosbits and its real life uses can be found in [#a]_ and [#b]_.
|
||||
for developing biosbits and its real life uses were presented `at Plumbers
|
||||
in 2011 <Plumbers_>`__ and `at Linux.conf.au in 2012 <Linux.conf.au_>`__.
|
||||
|
||||
For QEMU, we maintain a fork of bios bits in gitlab along with all the
|
||||
dependent submodules `here <https://gitlab.com/qemu-project/biosbits-bits>`__.
|
||||
This fork contains numerous fixes, a newer acpica and changes specific to
|
||||
running these functional QEMU tests using bits. The author of this document
|
||||
is the sole maintainer of the QEMU fork of bios bits repository. For more
|
||||
information, please see author's `FOSDEM talk on this bios-bits based test
|
||||
framework <https://fosdem.org/2024/schedule/event/fosdem-2024-2262-exercising-qemu-generated-acpi-smbios-tables-using-biosbits-from-within-a-guest-vm-/>`__.
|
||||
For QEMU, we maintain a fork of bios bits in `gitlab`_, along with all
|
||||
the dependent submodules. This fork contains numerous fixes, a newer
|
||||
acpica and changes specific to running these functional QEMU tests using
|
||||
bits. The author of this document is the current maintainer of the QEMU
|
||||
fork of bios bits repository. For more information, please see `the
|
||||
author's FOSDEM presentation <FOSDEM_>`__ on this bios-bits based test framework.
|
||||
|
||||
.. _Plumbers: https://blog.linuxplumbersconf.org/2011/ocw/system/presentations/867/original/bits.pdf
|
||||
.. _Linux.conf.au: https://www.youtube.com/watch?v=36QIepyUuhg
|
||||
.. _gitlab: https://gitlab.com/qemu-project/biosbits-bits
|
||||
.. _FOSDEM: https://fosdem.org/2024/schedule/event/fosdem-2024-2262-exercising-qemu-generated-acpi-smbios-tables-using-biosbits-from-within-a-guest-vm-/
|
||||
|
||||
*********************************
|
||||
Description of the test framework
|
||||
@@ -148,8 +153,3 @@ Under ``tests/functional/`` as the root we have:
|
||||
|
||||
Author: Ani Sinha <anisinha@redhat.com>
|
||||
|
||||
References:
|
||||
-----------
|
||||
.. [#a] https://blog.linuxplumbersconf.org/2011/ocw/system/presentations/867/original/bits.pdf
|
||||
.. [#b] https://www.youtube.com/watch?v=36QIepyUuhg
|
||||
.. [#c] https://fosdem.org/2024/schedule/event/fosdem-2024-2262-exercising-qemu-generated-acpi-smbios-tables-using-biosbits-from-within-a-guest-vm-/
|
||||
|
||||
@@ -54,11 +54,11 @@ Data Register
|
||||
-------------
|
||||
|
||||
* Read/Write (writes ignored as of QEMU v2.4, but see the DMA interface)
|
||||
* Location: platform dependent (IOport [#]_ or MMIO)
|
||||
* Location: platform dependent (IOport\ [#placement]_ or MMIO)
|
||||
* Width: 8-bit (if IOport), 8/16/32/64-bit (if MMIO)
|
||||
* Endianness: string-preserving
|
||||
|
||||
.. [#]
|
||||
.. [#placement]
|
||||
On platforms where the data register is exposed as an IOport, its
|
||||
port number will always be one greater than the port number of the
|
||||
selector register. In other words, the two ports overlap, and can not
|
||||
|
||||
+12
-13
@@ -9,11 +9,12 @@ The consumption is reported via MSRs (model specific registers) like
|
||||
MSR_PKG_ENERGY_STATUS for the CPU package power domain. These MSRs are 64 bits
|
||||
registers that represent the accumulated energy consumption in micro Joules.
|
||||
|
||||
Thanks to the MSR Filtering patch [#a]_ not all MSRs are handled by KVM. Some
|
||||
of them can now be handled by the userspace (QEMU). It uses a mechanism called
|
||||
"MSR filtering" where a list of MSRs is given at init time of a VM to KVM so
|
||||
that a callback is put in place. The design of this patch uses only this
|
||||
mechanism for handling the MSRs between guest/host.
|
||||
Thanks to KVM's `MSR filtering <msr-filter-patch_>`__ functionality,
|
||||
not all MSRs are handled by KVM. Some of them can now be handled by the
|
||||
userspace (QEMU); a list of MSRs is given at VM creation time to KVM, and
|
||||
a userspace exit occurs when they are accessed.
|
||||
|
||||
.. _msr-filter-patch: https://patchwork.kernel.org/project/kvm/patch/20200916202951.23760-7-graf@amazon.com/
|
||||
|
||||
At the moment the following MSRs are involved:
|
||||
|
||||
@@ -92,9 +93,12 @@ found by the sysconf system call. A typical value of clock ticks per second is
|
||||
package has 4 cores, 400 ticks maximum can be scheduled on all the cores
|
||||
of the package for a period of 1 second.
|
||||
|
||||
The /proc/[pid]/stat [#b]_ is a sysfs file that can give the executed time of a
|
||||
process with the [pid] as the process ID. It gives the amount of ticks the
|
||||
process has been scheduled in userspace (utime) and kernel space (stime).
|
||||
`/proc/[pid]/stat <stat_>`__ is a procfs file that can give the executed
|
||||
time of a process with the [pid] as the process ID. It gives the amount
|
||||
of ticks the process has been scheduled in userspace (utime) and kernel
|
||||
space (stime).
|
||||
|
||||
.. _stat: https://man7.org/linux/man-pages/man5/proc.5.html
|
||||
|
||||
By reading those metrics for a thread, one can calculate the ratio of time the
|
||||
package has spent executing the thread.
|
||||
@@ -148,8 +152,3 @@ Current Limitations
|
||||
- Only the Package Power-Plane (MSR_PKG_ENERGY_STATUS) is reported at the
|
||||
moment.
|
||||
|
||||
References
|
||||
----------
|
||||
|
||||
.. [#a] https://patchwork.kernel.org/project/kvm/patch/20200916202951.23760-7-graf@amazon.com/
|
||||
.. [#b] https://man7.org/linux/man-pages/man5/proc.5.html
|
||||
|
||||
+20
-10
@@ -20,7 +20,8 @@ config ARM_VIRT
|
||||
select PCI_EXPRESS
|
||||
select PCI_EXPRESS_GENERIC_BRIDGE
|
||||
select PFLASH_CFI01
|
||||
select PL011 # UART
|
||||
select PL011 if !HAVE_RUST # UART
|
||||
select X_PL011_RUST if HAVE_RUST # UART
|
||||
select PL031 # RTC
|
||||
select PL061 # GPIO
|
||||
select GPIO_PWR
|
||||
@@ -73,7 +74,8 @@ config HIGHBANK
|
||||
select AHCI
|
||||
select ARM_TIMER # sp804
|
||||
select ARM_V7M
|
||||
select PL011 # UART
|
||||
select PL011 if !HAVE_RUST # UART
|
||||
select X_PL011_RUST if HAVE_RUST # UART
|
||||
select PL022 # SPI
|
||||
select PL031 # RTC
|
||||
select PL061 # GPIO
|
||||
@@ -86,7 +88,8 @@ config INTEGRATOR
|
||||
depends on TCG && ARM
|
||||
select ARM_TIMER
|
||||
select INTEGRATOR_DEBUG
|
||||
select PL011 # UART
|
||||
select PL011 if !HAVE_RUST # UART
|
||||
select X_PL011_RUST if HAVE_RUST # UART
|
||||
select PL031 # RTC
|
||||
select PL041 # audio
|
||||
select PL050 # keyboard/mouse
|
||||
@@ -104,7 +107,8 @@ config MUSCA
|
||||
default y
|
||||
depends on TCG && ARM
|
||||
select ARMSSE
|
||||
select PL011
|
||||
select PL011 if !HAVE_RUST # UART
|
||||
select X_PL011_RUST if HAVE_RUST # UART
|
||||
select PL031
|
||||
select SPLIT_IRQ
|
||||
select UNIMP
|
||||
@@ -169,7 +173,8 @@ config REALVIEW
|
||||
select WM8750 # audio codec
|
||||
select LSI_SCSI_PCI
|
||||
select PCI
|
||||
select PL011 # UART
|
||||
select PL011 if !HAVE_RUST # UART
|
||||
select X_PL011_RUST if HAVE_RUST # UART
|
||||
select PL031 # RTC
|
||||
select PL041 # audio codec
|
||||
select PL050 # keyboard/mouse
|
||||
@@ -194,7 +199,8 @@ config SBSA_REF
|
||||
select PCI_EXPRESS
|
||||
select PCI_EXPRESS_GENERIC_BRIDGE
|
||||
select PFLASH_CFI01
|
||||
select PL011 # UART
|
||||
select PL011 if !HAVE_RUST # UART
|
||||
select X_PL011_RUST if HAVE_RUST # UART
|
||||
select PL031 # RTC
|
||||
select PL061 # GPIO
|
||||
select USB_XHCI_SYSBUS
|
||||
@@ -218,7 +224,8 @@ config STELLARIS
|
||||
select ARM_V7M
|
||||
select CMSDK_APB_WATCHDOG
|
||||
select I2C
|
||||
select PL011 # UART
|
||||
select PL011 if !HAVE_RUST # UART
|
||||
select X_PL011_RUST if HAVE_RUST # UART
|
||||
select PL022 # SPI
|
||||
select PL061 # GPIO
|
||||
select SSD0303 # OLED display
|
||||
@@ -278,7 +285,8 @@ config VEXPRESS
|
||||
select ARM_TIMER # sp804
|
||||
select LAN9118
|
||||
select PFLASH_CFI01
|
||||
select PL011 # UART
|
||||
select PL011 if !HAVE_RUST # UART
|
||||
select X_PL011_RUST if HAVE_RUST # UART
|
||||
select PL041 # audio codec
|
||||
select PL181 # display
|
||||
select REALVIEW
|
||||
@@ -362,7 +370,8 @@ config RASPI
|
||||
default y
|
||||
depends on TCG && ARM
|
||||
select FRAMEBUFFER
|
||||
select PL011 # UART
|
||||
select PL011 if !HAVE_RUST # UART
|
||||
select X_PL011_RUST if HAVE_RUST # UART
|
||||
select SDHCI
|
||||
select USB_DWC2
|
||||
select BCM2835_SPI
|
||||
@@ -437,7 +446,8 @@ config XLNX_VERSAL
|
||||
select ARM_GIC
|
||||
select CPU_CLUSTER
|
||||
select DEVICE_TREE
|
||||
select PL011
|
||||
select PL011 if !HAVE_RUST # UART
|
||||
select X_PL011_RUST if HAVE_RUST # UART
|
||||
select CADENCE
|
||||
select VIRTIO_MMIO
|
||||
select UNIMP
|
||||
|
||||
+142
-16
@@ -1,4 +1,4 @@
|
||||
project('qemu', ['c'], meson_version: '>=1.1.0',
|
||||
project('qemu', ['c'], meson_version: '>=1.5.0',
|
||||
default_options: ['warning_level=1', 'c_std=gnu11', 'cpp_std=gnu++11', 'b_colorout=auto',
|
||||
'b_staticpic=false', 'stdsplit=false', 'optimization=2', 'b_pie=true'],
|
||||
version: files('VERSION'))
|
||||
@@ -70,6 +70,19 @@ if host_os == 'darwin' and \
|
||||
all_languages += ['objc']
|
||||
objc = meson.get_compiler('objc')
|
||||
endif
|
||||
have_rust = false
|
||||
if not get_option('rust').disabled() and add_languages('rust', required: get_option('rust'), native: false)
|
||||
rustc = meson.get_compiler('rust')
|
||||
have_rust = true
|
||||
if rustc.version().version_compare('<1.80.0')
|
||||
if get_option('rust').enabled()
|
||||
error('rustc version ' + rustc.version() + ' is unsupported: Please upgrade to at least 1.80.0')
|
||||
else
|
||||
warning('rustc version ' + rustc.version() + ' is unsupported: Disabling Rust compilation. Please upgrade to at least 1.80.0 to use Rust.')
|
||||
have_rust = false
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
dtrace = not_found
|
||||
stap = not_found
|
||||
@@ -322,6 +335,10 @@ elif host_os == 'windows'
|
||||
endif
|
||||
endif
|
||||
|
||||
# Choose instruction set (currently x86-only)
|
||||
|
||||
qemu_isa_flags = []
|
||||
|
||||
# __sync_fetch_and_and requires at least -march=i486. Many toolchains
|
||||
# use i686 as default anyway, but for those that don't, an explicit
|
||||
# specification is necessary
|
||||
@@ -338,7 +355,7 @@ if host_arch == 'i386' and not cc.links('''
|
||||
sfaa(&val);
|
||||
return val;
|
||||
}''')
|
||||
qemu_common_flags = ['-march=i486'] + qemu_common_flags
|
||||
qemu_isa_flags += ['-march=i486']
|
||||
endif
|
||||
|
||||
# Pick x86-64 baseline version
|
||||
@@ -354,29 +371,31 @@ if host_arch in ['i386', 'x86_64']
|
||||
else
|
||||
# present on basically all processors but technically not part of
|
||||
# x86-64-v1, so only include -mneeded for x86-64 version 2 and above
|
||||
qemu_common_flags = ['-mcx16'] + qemu_common_flags
|
||||
qemu_isa_flags += ['-mcx16']
|
||||
endif
|
||||
endif
|
||||
if get_option('x86_version') >= '2'
|
||||
qemu_common_flags = ['-mpopcnt'] + qemu_common_flags
|
||||
qemu_common_flags = cc.get_supported_arguments('-mneeded') + qemu_common_flags
|
||||
qemu_isa_flags += ['-mpopcnt']
|
||||
qemu_isa_flags += cc.get_supported_arguments('-mneeded')
|
||||
endif
|
||||
if get_option('x86_version') >= '3'
|
||||
qemu_common_flags = ['-mmovbe', '-mabm', '-mbmi1', '-mbmi2', '-mfma', '-mf16c'] + qemu_common_flags
|
||||
qemu_isa_flags += ['-mmovbe', '-mabm', '-mbmi', '-mbmi2', '-mfma', '-mf16c']
|
||||
endif
|
||||
|
||||
# add required vector instruction set (each level implies those below)
|
||||
if get_option('x86_version') == '1'
|
||||
qemu_common_flags = ['-msse2'] + qemu_common_flags
|
||||
qemu_isa_flags += ['-msse2']
|
||||
elif get_option('x86_version') == '2'
|
||||
qemu_common_flags = ['-msse4.2'] + qemu_common_flags
|
||||
qemu_isa_flags += ['-msse4.2']
|
||||
elif get_option('x86_version') == '3'
|
||||
qemu_common_flags = ['-mavx2'] + qemu_common_flags
|
||||
qemu_isa_flags += ['-mavx2']
|
||||
elif get_option('x86_version') == '4'
|
||||
qemu_common_flags = ['-mavx512f', '-mavx512bw', '-mavx512cd', '-mavx512dq', '-mavx512vl'] + qemu_common_flags
|
||||
qemu_isa_flags += ['-mavx512f', '-mavx512bw', '-mavx512cd', '-mavx512dq', '-mavx512vl']
|
||||
endif
|
||||
endif
|
||||
|
||||
qemu_common_flags = qemu_isa_flags + qemu_common_flags
|
||||
|
||||
if get_option('prefer_static')
|
||||
qemu_ldflags += get_option('b_pie') ? '-static-pie' : '-static'
|
||||
endif
|
||||
@@ -935,7 +954,9 @@ have_xen_pci_passthrough = get_option('xen_pci_passthrough') \
|
||||
################
|
||||
|
||||
# When bumping glib minimum version, please check also whether to increase
|
||||
# the _WIN32_WINNT setting in osdep.h according to the value from glib
|
||||
# the _WIN32_WINNT setting in osdep.h according to the value from glib.
|
||||
# You should also check if any of the glib.version() checks
|
||||
# below can also be removed.
|
||||
glib_req_ver = '>=2.66.0'
|
||||
glib_pc = dependency('glib-2.0', version: glib_req_ver, required: true,
|
||||
method: 'pkg-config')
|
||||
@@ -985,6 +1006,9 @@ glib = declare_dependency(dependencies: [glib_pc, gmodule],
|
||||
# TODO: remove this check and the corresponding workaround (qtree) when
|
||||
# the minimum supported glib is >= 2.75.3
|
||||
glib_has_gslice = glib.version().version_compare('<2.75.3')
|
||||
# Check whether glib has the aligned_alloc family of functions.
|
||||
# <https://docs.gtk.org/glib/func.aligned_alloc.html>
|
||||
glib_has_aligned_alloc = glib.version().version_compare('>=2.72.0')
|
||||
|
||||
# override glib dep to include the above refinements
|
||||
meson.override_dependency('glib-2.0', glib)
|
||||
@@ -2158,6 +2182,7 @@ endif
|
||||
|
||||
config_host_data = configuration_data()
|
||||
|
||||
config_host_data.set('CONFIG_HAVE_RUST', have_rust)
|
||||
audio_drivers_selected = []
|
||||
if have_system
|
||||
audio_drivers_available = {
|
||||
@@ -2516,6 +2541,7 @@ config_host_data.set('CONFIG_TIMERFD', cc.has_function('timerfd_create'))
|
||||
config_host_data.set('HAVE_COPY_FILE_RANGE', cc.has_function('copy_file_range'))
|
||||
config_host_data.set('HAVE_GETIFADDRS', cc.has_function('getifaddrs'))
|
||||
config_host_data.set('HAVE_GLIB_WITH_SLICE_ALLOCATOR', glib_has_gslice)
|
||||
config_host_data.set('HAVE_GLIB_WITH_ALIGNED_ALLOC', glib_has_aligned_alloc)
|
||||
config_host_data.set('HAVE_OPENPTY', cc.has_function('openpty', dependencies: util))
|
||||
config_host_data.set('HAVE_STRCHRNUL', cc.has_function('strchrnul'))
|
||||
config_host_data.set('HAVE_SYSTEM_FUNCTION', cc.has_function('system', prefix: '#include <stdlib.h>'))
|
||||
@@ -2806,7 +2832,7 @@ config_host_data.set('CONFIG_ATOMIC64', cc.links('''
|
||||
__atomic_exchange_n(&x, y, __ATOMIC_RELAXED);
|
||||
__atomic_fetch_add(&x, y, __ATOMIC_RELAXED);
|
||||
return 0;
|
||||
}'''))
|
||||
}''', args: qemu_isa_flags))
|
||||
|
||||
has_int128_type = cc.compiles('''
|
||||
__int128_t a;
|
||||
@@ -2840,7 +2866,7 @@ if has_int128_type
|
||||
__atomic_compare_exchange_n(&p[4], &p[5], p[6], 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED);
|
||||
return 0;
|
||||
}'''
|
||||
has_atomic128 = cc.links(atomic_test_128)
|
||||
has_atomic128 = cc.links(atomic_test_128, args: qemu_isa_flags)
|
||||
|
||||
config_host_data.set('CONFIG_ATOMIC128', has_atomic128)
|
||||
|
||||
@@ -2849,7 +2875,8 @@ if has_int128_type
|
||||
# without optimization enabled. Try again with optimizations locally
|
||||
# enabled for the function. See
|
||||
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107389
|
||||
has_atomic128_opt = cc.links('__attribute__((optimize("O1")))' + atomic_test_128)
|
||||
has_atomic128_opt = cc.links('__attribute__((optimize("O1")))' + atomic_test_128,
|
||||
args: qemu_isa_flags)
|
||||
config_host_data.set('CONFIG_ATOMIC128_OPT', has_atomic128_opt)
|
||||
|
||||
if not has_atomic128_opt
|
||||
@@ -2860,7 +2887,7 @@ if has_int128_type
|
||||
__sync_val_compare_and_swap_16(&x, y, x);
|
||||
return 0;
|
||||
}
|
||||
'''))
|
||||
''', args: qemu_isa_flags))
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
@@ -3097,7 +3124,8 @@ host_kconfig = \
|
||||
(host_os == 'linux' ? ['CONFIG_LINUX=y'] : []) + \
|
||||
(multiprocess_allowed ? ['CONFIG_MULTIPROCESS_ALLOWED=y'] : []) + \
|
||||
(vfio_user_server_allowed ? ['CONFIG_VFIO_USER_SERVER_ALLOWED=y'] : []) + \
|
||||
(hv_balloon ? ['CONFIG_HV_BALLOON_POSSIBLE=y'] : [])
|
||||
(hv_balloon ? ['CONFIG_HV_BALLOON_POSSIBLE=y'] : []) + \
|
||||
(have_rust ? ['CONFIG_HAVE_RUST=y'] : [])
|
||||
|
||||
ignored = [ 'TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_ARCH' ]
|
||||
|
||||
@@ -3491,6 +3519,7 @@ qom_ss = ss.source_set()
|
||||
system_ss = ss.source_set()
|
||||
specific_fuzz_ss = ss.source_set()
|
||||
specific_ss = ss.source_set()
|
||||
rust_devices_ss = ss.source_set()
|
||||
stub_ss = ss.source_set()
|
||||
trace_ss = ss.source_set()
|
||||
user_ss = ss.source_set()
|
||||
@@ -3877,6 +3906,74 @@ common_all = static_library('common',
|
||||
implicit_include_directories: false,
|
||||
dependencies: common_ss.all_dependencies())
|
||||
|
||||
if have_rust and have_system
|
||||
rustc_args = run_command(
|
||||
find_program('scripts/rust/rustc_args.py'),
|
||||
'--config-headers', meson.project_build_root() / 'config-host.h',
|
||||
capture : true,
|
||||
check: true).stdout().strip().split()
|
||||
rustc_args += ['-D', 'unsafe_op_in_unsafe_fn']
|
||||
bindgen_args = [
|
||||
'--disable-header-comment',
|
||||
'--raw-line', '// @generated',
|
||||
'--ctypes-prefix', 'core::ffi',
|
||||
'--formatter', 'rustfmt',
|
||||
'--generate-block',
|
||||
'--generate-cstr',
|
||||
'--impl-debug',
|
||||
'--merge-extern-blocks',
|
||||
'--no-doc-comments',
|
||||
'--use-core',
|
||||
'--with-derive-default',
|
||||
'--no-size_t-is-usize',
|
||||
'--no-layout-tests',
|
||||
'--no-prepend-enum-name',
|
||||
'--allowlist-file', meson.project_source_root() + '/include/.*',
|
||||
'--allowlist-file', meson.project_source_root() + '/.*',
|
||||
'--allowlist-file', meson.project_build_root() + '/.*'
|
||||
]
|
||||
c_enums = [
|
||||
'DeviceCategory',
|
||||
'GpioPolarity',
|
||||
'MachineInitPhase',
|
||||
'MemoryDeviceInfoKind',
|
||||
'MigrationPolicy',
|
||||
'MigrationPriority',
|
||||
'QEMUChrEvent',
|
||||
'QEMUClockType',
|
||||
'device_endian',
|
||||
'module_init_type',
|
||||
]
|
||||
foreach enum : c_enums
|
||||
bindgen_args += ['--rustified-enum', enum]
|
||||
endforeach
|
||||
c_bitfields = [
|
||||
'ClockEvent',
|
||||
'VMStateFlags',
|
||||
]
|
||||
foreach enum : c_bitfields
|
||||
bindgen_args += ['--bitfield-enum', enum]
|
||||
endforeach
|
||||
|
||||
# TODO: Remove this comment when the clang/libclang mismatch issue is solved.
|
||||
#
|
||||
# Rust bindings generation with `bindgen` might fail in some cases where the
|
||||
# detected `libclang` does not match the expected `clang` version/target. In
|
||||
# this case you must pass the path to `clang` and `libclang` to your build
|
||||
# command invocation using the environment variables CLANG_PATH and
|
||||
# LIBCLANG_PATH
|
||||
bindings_rs = import('rust').bindgen(
|
||||
input: 'rust/wrapper.h',
|
||||
dependencies: common_ss.all_dependencies(),
|
||||
output: 'bindings.rs',
|
||||
include_directories: include_directories('.', 'include'),
|
||||
bindgen_version: ['>=0.69.4'],
|
||||
args: bindgen_args,
|
||||
)
|
||||
subdir('rust')
|
||||
endif
|
||||
|
||||
|
||||
feature_to_c = find_program('scripts/feature_to_c.py')
|
||||
|
||||
if host_os == 'darwin'
|
||||
@@ -3970,6 +4067,29 @@ foreach target : target_dirs
|
||||
arch_srcs += target_specific.sources()
|
||||
arch_deps += target_specific.dependencies()
|
||||
|
||||
if have_rust and have_system
|
||||
target_rust = rust_devices_ss.apply(config_target, strict: false)
|
||||
crates = []
|
||||
foreach dep : target_rust.dependencies()
|
||||
crates += dep.get_variable('crate')
|
||||
endforeach
|
||||
if crates.length() > 0
|
||||
rlib_rs = custom_target('rust_' + target.underscorify() + '.rs',
|
||||
output: 'rust_' + target.underscorify() + '.rs',
|
||||
command: [find_program('scripts/rust/rust_root_crate.sh')] + crates,
|
||||
capture: true,
|
||||
build_by_default: true,
|
||||
build_always_stale: true)
|
||||
rlib = static_library('rust_' + target.underscorify(),
|
||||
rlib_rs,
|
||||
dependencies: target_rust.dependencies(),
|
||||
override_options: ['rust_std=2021', 'build.rust_std=2021'],
|
||||
rust_args: rustc_args,
|
||||
rust_abi: 'c')
|
||||
arch_deps += declare_dependency(link_whole: [rlib])
|
||||
endif
|
||||
endif
|
||||
|
||||
# allow using headers from the dependencies but do not include the sources,
|
||||
# because this emulator only needs those in "objects". For external
|
||||
# dependencies, the full dependency is included below in the executable.
|
||||
@@ -4308,6 +4428,12 @@ if 'objc' in all_languages
|
||||
else
|
||||
summary_info += {'Objective-C compiler': false}
|
||||
endif
|
||||
summary_info += {'Rust support': have_rust}
|
||||
if have_rust
|
||||
summary_info += {'rustc version': rustc.version()}
|
||||
summary_info += {'rustc': ' '.join(rustc.cmd_array())}
|
||||
summary_info += {'Rust target': config_host['RUST_TARGET_TRIPLE']}
|
||||
endif
|
||||
option_cflags = (get_option('debug') ? ['-g'] : [])
|
||||
if get_option('optimization') != 'plain'
|
||||
option_cflags += ['-O' + get_option('optimization')]
|
||||
|
||||
@@ -373,3 +373,6 @@ option('hexagon_idef_parser', type : 'boolean', value : true,
|
||||
|
||||
option('x86_version', type : 'combo', choices : ['0', '1', '2', '3', '4'], value: '1',
|
||||
description: 'tweak required x86_64 architecture version beyond compiler default')
|
||||
|
||||
option('rust', type: 'feature', value: 'auto',
|
||||
description: 'Rust support')
|
||||
|
||||
@@ -41,8 +41,8 @@ def main() -> int:
|
||||
parser.parse_args()
|
||||
|
||||
packages = {
|
||||
"meson==1.2.3":
|
||||
"4533a43c34548edd1f63a276a42690fce15bde9409bcf20c4b8fa3d7e4d7cac1",
|
||||
"meson==1.5.0":
|
||||
"52b34f4903b882df52ad0d533146d4b992c018ea77399f825579737672ae7b20",
|
||||
}
|
||||
|
||||
vendor_dir = Path(__file__, "..", "..", "wheels").resolve()
|
||||
|
||||
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user