From 9ad2ba6e8e7fc195d0dd0b76ab38bd2fceb1bdd4 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Sat, 14 Jan 2023 13:32:06 -1000 Subject: [PATCH 01/13] target/i386: Fix BZHI instruction We did not correctly handle N >= operand size. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1374 Signed-off-by: Richard Henderson Message-Id: <20230114233206.3118472-1-richard.henderson@linaro.org> Signed-off-by: Paolo Bonzini --- target/i386/tcg/emit.c.inc | 14 +++++++------- tests/tcg/i386/test-i386-bmi2.c | 3 +++ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/target/i386/tcg/emit.c.inc b/target/i386/tcg/emit.c.inc index e61ae9a2e9..0d01e13002 100644 --- a/target/i386/tcg/emit.c.inc +++ b/target/i386/tcg/emit.c.inc @@ -1147,20 +1147,20 @@ static void gen_BLSR(DisasContext *s, CPUX86State *env, X86DecodedInsn *decode) static void gen_BZHI(DisasContext *s, CPUX86State *env, X86DecodedInsn *decode) { MemOp ot = decode->op[0].ot; - TCGv bound; + TCGv bound = tcg_constant_tl(ot == MO_64 ? 63 : 31); + TCGv zero = tcg_constant_tl(0); + TCGv mone = tcg_constant_tl(-1); - tcg_gen_ext8u_tl(s->T1, cpu_regs[s->vex_v]); - bound = tcg_constant_tl(ot == MO_64 ? 63 : 31); + tcg_gen_ext8u_tl(s->T1, s->T1); /* * Note that since we're using BMILG (in order to get O * cleared) we need to store the inverse into C. */ - tcg_gen_setcond_tl(TCG_COND_LT, cpu_cc_src, s->T1, bound); - tcg_gen_movcond_tl(TCG_COND_GT, s->T1, s->T1, bound, bound, s->T1); + tcg_gen_setcond_tl(TCG_COND_LEU, cpu_cc_src, s->T1, bound); - tcg_gen_movi_tl(s->A0, -1); - tcg_gen_shl_tl(s->A0, s->A0, s->T1); + tcg_gen_shl_tl(s->A0, mone, s->T1); + tcg_gen_movcond_tl(TCG_COND_LEU, s->A0, s->T1, bound, s->A0, zero); tcg_gen_andc_tl(s->T0, s->T0, s->A0); gen_op_update1_cc(s); diff --git a/tests/tcg/i386/test-i386-bmi2.c b/tests/tcg/i386/test-i386-bmi2.c index 982d4abda4..0244df7987 100644 --- a/tests/tcg/i386/test-i386-bmi2.c +++ b/tests/tcg/i386/test-i386-bmi2.c @@ -123,6 +123,9 @@ int main(int argc, char *argv[]) { result = bzhiq(mask, 0x1f); assert(result == (mask & ~(-1 << 30))); + result = bzhiq(mask, 0x40); + assert(result == mask); + result = rorxq(0x2132435465768798, 8); assert(result == 0x9821324354657687); From 1248a15965b77f9b9b5d6efcd9138ae299fbc8c2 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 6 Feb 2023 11:20:37 +0100 Subject: [PATCH 02/13] meson: Avoid duplicates in generated config-poison.h again MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit eed56e9a89f "configure, meson: move config-poison.h to meson" lost a "| sort -u". Restore it. config-poison shrinks from ~4500 to ~700 lines when all targets are enabled. Signed-off-by: Markus Armbruster Reviewed-by: Alex Bennée Reviewed-by: Marc-André Lureau Reviewed-by: Philippe Mathieu-Daudé Tested-by: Alex Bennée Message-Id: <20230206102037.3621709-1-armbru@redhat.com> Signed-off-by: Paolo Bonzini --- scripts/make-config-poison.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/make-config-poison.sh b/scripts/make-config-poison.sh index d222a04304..1892854261 100755 --- a/scripts/make-config-poison.sh +++ b/scripts/make-config-poison.sh @@ -13,4 +13,4 @@ exec sed -n \ -e 's///' \ -e 's/ .*//' \ -e 's/^/#pragma GCC poison /p' \ - -e '}' "$@" + -e '}' "$@" | sort -u From 1b1be8d3cc57a6ad86c3a54fb2750adfae707ae3 Mon Sep 17 00:00:00 2001 From: John Snow Date: Mon, 20 Feb 2023 20:24:55 -0500 Subject: [PATCH 03/13] meson: stop looking for 'sphinx-build-3' Once upon a time, "sphinx-build" on certain RPM platforms invoked specifically a Python 2.x version, while "sphinx-build-3" was a distro shim for the Python 3.x version. These days, none of our supported platforms utilize a 2.x version, and those that still have 'sphinx-build-3' make it a symbolic link to 'sphinx-build'. Not searching for 'sphinx-build-3' will prefer pip/venv installed versions of sphinx if they're available. This adds an extremely convenient ability to test document building ability in QEMU across multiple versions of Sphinx for the purposes of compatibility testing. Signed-off-by: John Snow Message-Id: <20230221012456.2607692-6-jsnow@redhat.com> Signed-off-by: Paolo Bonzini --- docs/meson.build | 9 ++------- meson_options.txt | 2 +- scripts/meson-buildoptions.sh | 1 + 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/docs/meson.build b/docs/meson.build index bbcdccce68..bb72c10ea8 100644 --- a/docs/meson.build +++ b/docs/meson.build @@ -1,10 +1,5 @@ -if get_option('sphinx_build') == '' - sphinx_build = find_program(['sphinx-build-3', 'sphinx-build'], - required: get_option('docs')) -else - sphinx_build = find_program(get_option('sphinx_build'), - required: get_option('docs')) -endif +sphinx_build = find_program(get_option('sphinx_build'), + required: get_option('docs')) # Check if tools are available to build documentation. build_docs = false diff --git a/meson_options.txt b/meson_options.txt index 6b0900205e..fc9447d267 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -12,7 +12,7 @@ option('pkgversion', type : 'string', value : '', description: 'use specified string as sub-version of the package') option('smbd', type : 'string', value : '', description: 'Path to smbd for slirp networking') -option('sphinx_build', type : 'string', value : '', +option('sphinx_build', type : 'string', value : 'sphinx-build', description: 'Use specified sphinx-build for building document') option('iasl', type : 'string', value : '', description: 'Path to ACPI disassembler') diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index 5d969a94c0..009fab1515 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -55,6 +55,7 @@ meson_options_help() { printf "%s\n" ' --localstatedir=VALUE Localstate data directory [/var/local]' printf "%s\n" ' --mandir=VALUE Manual page directory [share/man]' printf "%s\n" ' --sphinx-build=VALUE Use specified sphinx-build for building document' + printf "%s\n" ' [sphinx-build]' printf "%s\n" ' --sysconfdir=VALUE Sysconf data directory [etc]' printf "%s\n" ' --tls-priority=VALUE Default TLS protocol/cipher priority string' printf "%s\n" ' [NORMAL]' From 462a65678e0fc15f924bf0f9f4d384fc18487b9b Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Fri, 10 Feb 2023 17:18:54 +0100 Subject: [PATCH 04/13] configure: protect against escaping venv when running Meson If neither --python nor --meson are specified, Meson's generated build.ninja will invoke Python script using the interpreter *that Meson itself is running under*; not the one identified by configure. This is only an issue if Meson's Python interpreter is not "the first one in the path", which is the one that is used if --python is not specified. A common case where this happen is when the "python3" binary comes from a virtual environment but Meson is not installed (with pip) in the virtual environment. In this case (presumably) whoever set up the venv wanted to use the venv's Python interpreter to build QEMU, while Meson might use a different one, for example an enterprise distro's older runtime. So, detect whether a virtual environment is setup, and if the virtual environment does not have Meson, use the meson submodule. Meson will then run under the virtual environment's Python interpreter. Reported-by: John Snow Signed-off-by: Paolo Bonzini --- configure | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/configure b/configure index cf6db3d551..a1912463c9 100755 --- a/configure +++ b/configure @@ -1044,11 +1044,24 @@ if ! $python -c 'import sys; sys.exit(sys.version_info < (3,6))'; then "Use --python=/path/to/python to specify a supported Python." fi -# Suppress writing compiled files -python="$python -B" +# Resolve PATH + suppress writing compiled files +python="$(command -v "$python") -B" + +has_meson() { + local python_dir=$(dirname "$python") + # PEP405: pyvenv.cfg is either adjacent to the Python executable + # or one directory above + if test -f $python_dir/pyvenv.cfg || test -f $python_dir/../pyvenv.cfg; then + # Ensure that Meson and Python come from the same virtual environment + test -x "$python_dir/meson" && + test "$(command -v meson)" -ef "$python_dir/meson" + else + has meson + fi +} if test -z "$meson"; then - if test "$explicit_python" = no && has meson && version_ge "$(meson --version)" 0.61.5; then + if test "$explicit_python" = no && has_meson && version_ge "$(meson --version)" 0.61.5; then meson=meson elif test "$git_submodules_action" != 'ignore' ; then meson=git From fee6d4124a470a541eeb51c59ee2b4aea09c6c49 Mon Sep 17 00:00:00 2001 From: John Snow Date: Fri, 10 Feb 2023 01:31:43 +0100 Subject: [PATCH 05/13] configure: Look for auxiliary Python installations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit At the moment, we look for just "python3" and "python", which is good enough almost all of the time. But ... if you are on a platform that uses an older Python by default and only offers a newer Python as an option, you'll have to specify --python=/usr/bin/foo every time. We can be kind and instead make a cursory attempt to locate a suitable Python binary ourselves, looking for the remaining well-known binaries. This configure loop will prefer, in order: 1. Whatever is specified in $PYTHON 2. python3 3. python 4. python3.11 down through python3.6 Notes: - Python virtual environment provides binaries for "python3", "python", and whichever version you used to create the venv, e.g. "python3.8". If configure is invoked from inside of a venv, this configure loop will not "break out" of that venv unless that venv is created using an explicitly non-suitable version of Python that we cannot use. - In the event that no suitable python is found, the first python found is the version used to generate the human-readable error message. - The error message isn't printed right away to allow later configuration code to pick up an explicitly configured python. Signed-off-by: John Snow Reviewed-by: Daniel P. Berrangé Signed-off-by: Paolo Bonzini --- configure | 63 ++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 46 insertions(+), 17 deletions(-) diff --git a/configure b/configure index a1912463c9..0e41c5e36c 100755 --- a/configure +++ b/configure @@ -592,20 +592,43 @@ esac : ${make=${MAKE-make}} -# We prefer python 3.x. A bare 'python' is traditionally -# python 2.x, but some distros have it as python 3.x, so -# we check that too -python= -explicit_python=no -for binary in "${PYTHON-python3}" python -do - if has "$binary" - then - python=$(command -v "$binary") - break - fi -done +check_py_version() { + # We require python >= 3.6. + # NB: a True python conditional creates a non-zero return code (Failure) + "$1" -c 'import sys; sys.exit(sys.version_info < (3,6))' +} + +python= +first_python= +if test -z "${PYTHON}"; then + explicit_python=no + # A bare 'python' is traditionally python 2.x, but some distros + # have it as python 3.x, so check in both places. + for binary in python3 python python3.11 python3.10 python3.9 python3.8 python3.7 python3.6; do + if has "$binary"; then + python=$(command -v "$binary") + if check_py_version "$python"; then + # This one is good. + first_python= + break + else + first_python=$python + fi + fi + done +else + # Same as above, but only check the environment variable. + has "${PYTHON}" || error_exit "The PYTHON environment variable does not point to an executable" + python=$(command -v "$PYTHON") + explicit_python=yes + if check_py_version "$python"; then + # This one is good. + first_python= + else + first_python=$first_python + fi +fi # Check for ancillary tools used in testing genisoimage= @@ -1030,16 +1053,22 @@ rm -f ./*/config-devices.mak.d if test -z "$python" then - error_exit "Python not found. Use --python=/path/to/python" + # If first_python is set, there was a binary somewhere even though + # it was not suitable. Use it for the error message. + if test -n "$first_python"; then + error_exit "Cannot use '$first_python', Python >= 3.6 is required." \ + "Use --python=/path/to/python to specify a supported Python." + else + error_exit "Python not found. Use --python=/path/to/python" + fi fi + if ! has "$make" then error_exit "GNU make ($make) not found" fi -# Note that if the Python conditional here evaluates True we will exit -# with status 1 which is a shell 'false' value. -if ! $python -c 'import sys; sys.exit(sys.version_info < (3,6))'; then +if ! check_py_version "$python"; then error_exit "Cannot use '$python', Python >= 3.6 is required." \ "Use --python=/path/to/python to specify a supported Python." fi From 586d3bb944b207873b2a1df269bf22748e38211c Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 9 Jan 2023 18:33:15 +0100 Subject: [PATCH 06/13] lcitool: update submodule MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Daniel P. Berrangé Signed-off-by: Paolo Bonzini --- tests/docker/dockerfiles/alpine.docker | 2 +- tests/docker/dockerfiles/fedora-win32-cross.docker | 1 + tests/docker/dockerfiles/fedora-win64-cross.docker | 1 + tests/lcitool/libvirt-ci | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/docker/dockerfiles/alpine.docker b/tests/docker/dockerfiles/alpine.docker index 4a569d82f6..66c499c097 100644 --- a/tests/docker/dockerfiles/alpine.docker +++ b/tests/docker/dockerfiles/alpine.docker @@ -61,7 +61,7 @@ RUN apk update && \ liburing-dev \ libusb-dev \ linux-pam-dev \ - llvm11 \ + llvm \ lttng-ust-dev \ lzo-dev \ make \ diff --git a/tests/docker/dockerfiles/fedora-win32-cross.docker b/tests/docker/dockerfiles/fedora-win32-cross.docker index b659c0b8a8..41769fc94a 100644 --- a/tests/docker/dockerfiles/fedora-win32-cross.docker +++ b/tests/docker/dockerfiles/fedora-win32-cross.docker @@ -79,6 +79,7 @@ RUN nosync dnf install -y \ mingw32-glib2 \ mingw32-gnutls \ mingw32-gtk3 \ + mingw32-libepoxy \ mingw32-libgcrypt \ mingw32-libjpeg-turbo \ mingw32-libpng \ diff --git a/tests/docker/dockerfiles/fedora-win64-cross.docker b/tests/docker/dockerfiles/fedora-win64-cross.docker index 0a404c15bf..46d5d05763 100644 --- a/tests/docker/dockerfiles/fedora-win64-cross.docker +++ b/tests/docker/dockerfiles/fedora-win64-cross.docker @@ -80,6 +80,7 @@ RUN nosync dnf install -y \ mingw64-glib2 \ mingw64-gnutls \ mingw64-gtk3 \ + mingw64-libepoxy \ mingw64-libgcrypt \ mingw64-libjpeg-turbo \ mingw64-libpng \ diff --git a/tests/lcitool/libvirt-ci b/tests/lcitool/libvirt-ci index 319a534c22..1c3e16cae3 160000 --- a/tests/lcitool/libvirt-ci +++ b/tests/lcitool/libvirt-ci @@ -1 +1 @@ -Subproject commit 319a534c220f53fc8670254cac25d6f662c82112 +Subproject commit 1c3e16cae38407d0782dc94080d1104106456fa4 From fa1ce1dda9206d11684427ad3ef0a9b51225d387 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 9 Feb 2023 12:24:26 +0100 Subject: [PATCH 07/13] docs/devel: update and clarify lcitool instructions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Shorten a bit the description of what libvirt-ci does, the name of the data files is not relevant at that point. However, the procedures to add new build prerequisites are lacking some information, particularly with respect to regenerating the output test files for lcitool's unit tests. While at it, also update the paths in the libvirt-ci repository. Reviewed-by: Daniel P. Berrangé Signed-off-by: Paolo Bonzini --- docs/devel/testing.rst | 70 +++++++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 31 deletions(-) diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst index e10c47b5a7..11c651ca08 100644 --- a/docs/devel/testing.rst +++ b/docs/devel/testing.rst @@ -429,49 +429,55 @@ using the ``lcitool`` program provided by the ``libvirt-ci`` project: https://gitlab.com/libvirt/libvirt-ci -In that project, there is a ``mappings.yml`` file defining the distro native -package names for a wide variety of third party projects. This is processed -in combination with a project defined list of build pre-requisites to determine -the list of native packages to install on each distribution. This can be used -to generate dockerfiles, VM package lists and Cirrus CI variables needed to -setup build environments across OS distributions with a consistent set of -packages present. - -When preparing a patch series that adds a new build pre-requisite to QEMU, -updates to various lcitool data files may be required. +``libvirt-ci`` contains an ``lcitool`` program as well as a list of +mappings to distribution package names for a wide variety of third +party projects. ``lcitool`` applies the mappings to a list of build +pre-requisites in ``tests/lcitool/projects/qemu.yml``, determines the +list of native packages to install on each distribution, and uses them +to generate build environments (dockerfiles and Cirrus CI variable files) +that are consistent across OS distribution. Adding new build pre-requisites ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +When preparing a patch series that adds a new build +pre-requisite to QEMU, the prerequisites should to be added to +``tests/lcitool/projects/qemu.yml`` in order to make the dependency +available in the CI build environments. + In the simple case where the pre-requisite is already known to ``libvirt-ci`` -the following steps are needed +the following steps are needed: * Edit ``tests/lcitool/projects/qemu.yml`` and add the pre-requisite * Run ``make lcitool-refresh`` to re-generate all relevant build environment manifests -In some cases ``libvirt-ci`` will not know about the build pre-requisite and -thus some extra preparation steps will be required first +It may be that ``libvirt-ci`` does not know about the new pre-requisite. +If that is the case, some extra preparation steps will be required +first to contribute the mapping to the ``libvirt-ci`` project: * Fork the ``libvirt-ci`` project on gitlab - * Edit the ``mappings.yml`` change to add an entry for the new build - prerequisite, listing its native package name on as many OS distros - as practical. + * Add an entry for the new build prerequisite to + ``lcitool/facts/mappings.yml``, listing its native package name on as + many OS distros as practical. Run ``python -m pytest --regenerate-output`` + and check that the changes are correct. - * Commit the ``mappings.yml`` change and submit a merge request to - the ``libvirt-ci`` project, noting in the description that this - is a new build pre-requisite desired for use with QEMU + * Commit the ``mappings.yml`` change together with the regenerated test + files, and submit a merge request to the ``libvirt-ci`` project. + Please note in the description that this is a new build pre-requisite + desired for use with QEMU. * CI pipeline will run to validate that the changes to ``mappings.yml`` are correct, by attempting to install the newly listed package on all OS distributions supported by ``libvirt-ci``. * Once the merge request is accepted, go back to QEMU and update - the ``libvirt-ci`` submodule to point to a commit that contains - the ``mappings.yml`` update. + the ``tests/lcitool/libvirt-ci`` submodule to point to a commit that + contains the ``mappings.yml`` update. Then add the prerequisite and + run ``make lcitool-refresh``. Adding new OS distros @@ -498,18 +504,20 @@ Assuming there is agreement to add a new OS distro then * Fork the ``libvirt-ci`` project on gitlab - * Add metadata under ``guests/lcitool/lcitool/ansible/group_vars/`` - for the new OS distro. There might be code changes required if - the OS distro uses a package format not currently known. The - ``libvirt-ci`` maintainers can advise on this when the issue - is file. + * Add metadata under ``lcitool/facts/targets/`` for the new OS + distro. There might be code changes required if the OS distro + uses a package format not currently known. The ``libvirt-ci`` + maintainers can advise on this when the issue is filed. - * Edit the ``mappings.yml`` change to update all the existing package - entries, providing details of the new OS distro + * Edit the ``lcitool/facts/mappings.yml`` change to add entries for + the new OS, listing the native package names for as many packages + as practical. Run ``python -m pytest --regenerate-output`` and + check that the changes are correct. - * Commit the ``mappings.yml`` change and submit a merge request to - the ``libvirt-ci`` project, noting in the description that this - is a new build pre-requisite desired for use with QEMU + * Commit the changes to ``lcitool/facts`` and the regenerated test + files, and submit a merge request to the ``libvirt-ci`` project. + Please note in the description that this is a new build pre-requisite + desired for use with QEMU * CI pipeline will run to validate that the changes to ``mappings.yml`` are correct, by attempting to install the newly listed package on From 32c0613113f0f5ab1eea05a05d6e52096e9bd11e Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Wed, 12 Oct 2022 18:20:44 +0200 Subject: [PATCH 08/13] ci, docker: update CentOS and OpenSUSE Python to non-EOL versions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Python 3.6 is at end-of-life. Update the libvirt-ci module to a version that supports overrides for targets and package mappings; this way, QEMU can use the newer versions provided by CentOS 8 (Python 3.8) and OpenSUSE 15.3 (Python 3.9). Reviewed-by: Daniel P. Berrangé Signed-off-by: Paolo Bonzini --- docs/devel/testing.rst | 6 ++ tests/docker/dockerfiles/centos8.docker | 22 +++--- tests/docker/dockerfiles/opensuse-leap.docker | 22 +++--- tests/docker/dockerfiles/ubuntu2004.docker | 2 +- tests/lcitool/mappings.yml | 77 +++++++++++++++++++ tests/lcitool/targets/centos-stream-8.yml | 3 + tests/lcitool/targets/opensuse-leap-153.yml | 3 + 7 files changed, 113 insertions(+), 22 deletions(-) create mode 100644 tests/lcitool/mappings.yml create mode 100644 tests/lcitool/targets/centos-stream-8.yml create mode 100644 tests/lcitool/targets/opensuse-leap-153.yml diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst index 11c651ca08..362a26698b 100644 --- a/docs/devel/testing.rst +++ b/docs/devel/testing.rst @@ -479,6 +479,12 @@ first to contribute the mapping to the ``libvirt-ci`` project: contains the ``mappings.yml`` update. Then add the prerequisite and run ``make lcitool-refresh``. +For enterprise distros that default to old, end-of-life versions of the +Python runtime, QEMU uses a separate set of mappings that work with more +recent versions. These can be found in ``tests/lcitool/mappings.yml``. +Modifying this file should not be necessary unless the new pre-requisite +is a Python library or tool. + Adding new OS distros ^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/docker/dockerfiles/centos8.docker b/tests/docker/dockerfiles/centos8.docker index fbc953c6dc..3c74be09a6 100644 --- a/tests/docker/dockerfiles/centos8.docker +++ b/tests/docker/dockerfiles/centos8.docker @@ -82,7 +82,6 @@ RUN dnf distro-sync -y && \ lzo-devel \ make \ mesa-libgbm-devel \ - meson \ ncurses-devel \ nettle-devel \ ninja-build \ @@ -94,13 +93,12 @@ RUN dnf distro-sync -y && \ pixman-devel \ pkgconfig \ pulseaudio-libs-devel \ - python3 \ - python3-PyYAML \ - python3-numpy \ - python3-pillow \ - python3-pip \ - python3-sphinx \ - python3-sphinx_rtd_theme \ + python38 \ + python38-PyYAML \ + python38-numpy \ + python38-pip \ + python38-setuptools \ + python38-wheel \ rdma-core-devel \ rpm \ sed \ @@ -128,8 +126,14 @@ RUN dnf distro-sync -y && \ ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/g++ && \ ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc +RUN /usr/bin/pip3.8 install \ + meson==0.63.2 \ + pillow \ + sphinx \ + sphinx-rtd-theme + 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" +ENV PYTHON "/usr/bin/python3.8" diff --git a/tests/docker/dockerfiles/opensuse-leap.docker b/tests/docker/dockerfiles/opensuse-leap.docker index 4b2c02d6ab..5b8dbf2b83 100644 --- a/tests/docker/dockerfiles/opensuse-leap.docker +++ b/tests/docker/dockerfiles/opensuse-leap.docker @@ -89,16 +89,9 @@ RUN zypper update -y && \ pam-devel \ pcre-devel-static \ pkgconfig \ - python3-Pillow \ - python3-PyYAML \ - python3-Sphinx \ - python3-base \ - python3-numpy \ - python3-opencv \ - python3-pip \ - python3-setuptools \ - python3-sphinx_rtd_theme \ - python3-wheel \ + python39-base \ + python39-pip \ + python39-setuptools \ rdma-core-devel \ rpm \ sed \ @@ -129,10 +122,15 @@ RUN zypper update -y && \ ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/g++ && \ ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc -RUN /usr/bin/pip3 install meson==0.56.0 +RUN /usr/bin/pip3.9 install \ + PyYAML \ + meson==0.63.2 \ + pillow \ + sphinx \ + sphinx-rtd-theme 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" +ENV PYTHON "/usr/bin/python3.9" diff --git a/tests/docker/dockerfiles/ubuntu2004.docker b/tests/docker/dockerfiles/ubuntu2004.docker index 13ab0b6887..5b27b89f1c 100644 --- a/tests/docker/dockerfiles/ubuntu2004.docker +++ b/tests/docker/dockerfiles/ubuntu2004.docker @@ -138,7 +138,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/g++ && \ ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc -RUN /usr/bin/pip3 install meson==0.56.0 +RUN /usr/bin/pip3 install meson==0.63.2 ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers" ENV LANG "en_US.UTF-8" diff --git a/tests/lcitool/mappings.yml b/tests/lcitool/mappings.yml new file mode 100644 index 0000000000..e4719e4551 --- /dev/null +++ b/tests/lcitool/mappings.yml @@ -0,0 +1,77 @@ +mappings: + flake8: + CentOSStream8: + OpenSUSELeap153: + + meson: + CentOSStream8: + OpenSUSELeap153: + + python3: + CentOSStream8: python38 + OpenSUSELeap153: python39-base + + python3-PyYAML: + CentOSStream8: python38-PyYAML + OpenSUSELeap153: + + python3-devel: + CentOSStream8: python38-devel + OpenSUSELeap153: python39-devel + + python3-docutils: + CentOSStream8: + OpenSUSELeap153: + + python3-numpy: + CentOSStream8: python38-numpy + OpenSUSELeap153: + + python3-opencv: + CentOSStream8: + OpenSUSELeap153: + + python3-pillow: + CentOSStream8: + OpenSUSELeap153: + + python3-pip: + CentOSStream8: python38-pip + OpenSUSELeap153: python39-pip + + python3-pillow: + CentOSStream8: + OpenSUSELeap153: + + python3-selinux: + CentOSStream8: + OpenSUSELeap153: + + python3-setuptools: + CentOSStream8: python38-setuptools + OpenSUSELeap153: python39-setuptools + + python3-sphinx: + CentOSStream8: + OpenSUSELeap153: + + python3-sphinx-rtd-theme: + CentOSStream8: + OpenSUSELeap153: + + python3-venv: + CentOSStream8: python38 + OpenSUSELeap153: python39-base + + python3-wheel: + CentOSStream8: python38-wheel + OpenSUSELeap153: python39-pip + +pypi_mappings: + # Request more recent version + meson: + default: meson==0.63.2 + + # Drop packages that need devel headers + python3-numpy: + OpenSUSELeap153: diff --git a/tests/lcitool/targets/centos-stream-8.yml b/tests/lcitool/targets/centos-stream-8.yml new file mode 100644 index 0000000000..6b11160fd1 --- /dev/null +++ b/tests/lcitool/targets/centos-stream-8.yml @@ -0,0 +1,3 @@ +paths: + pip3: /usr/bin/pip3.8 + python: /usr/bin/python3.8 diff --git a/tests/lcitool/targets/opensuse-leap-153.yml b/tests/lcitool/targets/opensuse-leap-153.yml new file mode 100644 index 0000000000..683016e007 --- /dev/null +++ b/tests/lcitool/targets/opensuse-leap-153.yml @@ -0,0 +1,3 @@ +paths: + pip3: /usr/bin/pip3.9 + python: /usr/bin/python3.9 From fc3b9dfacc4017aed8e2b010bc85f4dd50ca6e8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Thu, 19 Jan 2023 11:26:20 +0100 Subject: [PATCH 09/13] MAINTAINERS: Cover RCU documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Paolo Bonzini --- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index eb917e48c0..896e411918 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2812,6 +2812,8 @@ F: qapi/run-state.json Read, Copy, Update (RCU) M: Paolo Bonzini S: Maintained +F: docs/devel/lockcnt.txt +F: docs/devel/rcu.txt F: include/qemu/rcu*.h F: tests/unit/rcutorture.c F: tests/unit/test-rcu-*.c From c0728d4e3d23356691e4182eac54c67e1ca26618 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 27 Feb 2023 10:57:09 +0100 Subject: [PATCH 10/13] target/i386: add FSRM to TCG Fast short REP MOVS can be added to TCG, since a trivial translation of string operation is a good option for short lengths. Reviewed-by: Xiaoyao Li Signed-off-by: Paolo Bonzini --- target/i386/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 4d2b8d0444..34e2cead87 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -661,7 +661,7 @@ void x86_cpu_vendor_words2str(char *dst, uint32_t vendor1, #define TCG_7_0_ECX_FEATURES (CPUID_7_0_ECX_UMIP | CPUID_7_0_ECX_PKU | \ /* CPUID_7_0_ECX_OSPKE is dynamic */ \ CPUID_7_0_ECX_LA57 | CPUID_7_0_ECX_PKS | CPUID_7_0_ECX_VAES) -#define TCG_7_0_EDX_FEATURES 0 +#define TCG_7_0_EDX_FEATURES CPUID_7_0_EDX_FSRM #define TCG_7_1_EAX_FEATURES 0 #define TCG_APM_FEATURES 0 #define TCG_6_EAX_FEATURES CPUID_6_EAX_ARAT From 58794f644e43ef8e60ed05395c58099311c1fcd1 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 27 Feb 2023 10:55:46 +0100 Subject: [PATCH 11/13] target/i386: add FZRM, FSRS, FSRC These are three more markers for string operation optimizations. They can all be added to TCG, whose string operations are more or less as fast as they can be for short lengths. Reviewed-by: Xiaoyao Li Signed-off-by: Paolo Bonzini --- target/i386/cpu.c | 7 ++++--- target/i386/cpu.h | 7 +++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 34e2cead87..26ec6e9da7 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -662,7 +662,8 @@ void x86_cpu_vendor_words2str(char *dst, uint32_t vendor1, /* CPUID_7_0_ECX_OSPKE is dynamic */ \ CPUID_7_0_ECX_LA57 | CPUID_7_0_ECX_PKS | CPUID_7_0_ECX_VAES) #define TCG_7_0_EDX_FEATURES CPUID_7_0_EDX_FSRM -#define TCG_7_1_EAX_FEATURES 0 +#define TCG_7_1_EAX_FEATURES (CPUID_7_1_EAX_FZRM | CPUID_7_1_EAX_FSRS | \ + CPUID_7_1_EAX_FSRC) #define TCG_APM_FEATURES 0 #define TCG_6_EAX_FEATURES CPUID_6_EAX_ARAT #define TCG_XSAVE_FEATURES (CPUID_XSAVE_XSAVEOPT | CPUID_XSAVE_XGETBV1) @@ -872,8 +873,8 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { .feat_names = { NULL, NULL, NULL, NULL, "avx-vnni", "avx512-bf16", NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, + NULL, NULL, "fzrm", "fsrs", + "fsrc", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, diff --git a/target/i386/cpu.h b/target/i386/cpu.h index d4bc19577a..e0703feb5e 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -900,6 +900,13 @@ uint64_t x86_cpu_get_supported_feature_word(FeatureWord w, #define CPUID_7_1_EAX_AVX_VNNI (1U << 4) /* AVX512 BFloat16 Instruction */ #define CPUID_7_1_EAX_AVX512_BF16 (1U << 5) +/* Fast Zero REP MOVS */ +#define CPUID_7_1_EAX_FZRM (1U << 10) +/* Fast Short REP STOS */ +#define CPUID_7_1_EAX_FSRS (1U << 11) +/* Fast Short REP CMPS/SCAS */ +#define CPUID_7_1_EAX_FSRC (1U << 12) + /* XFD Extend Feature Disabled */ #define CPUID_D_1_EAX_XFD (1U << 4) From 3023c9b4d1092eb27a523c08d9e78cbaec67b59b Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 27 Feb 2023 10:41:46 +0100 Subject: [PATCH 12/13] target/i386: KVM: allow fast string operations if host supports them These are just a flag that documents the performance characteristic of an instruction; it needs no hypervisor support. So include them even if KVM does not show them. In particular, FZRM/FSRS/FSRC have only been added very recently, but they are available on Sapphire Rapids processors. Reviewed-by: Xiaoyao Li Signed-off-by: Paolo Bonzini --- target/i386/kvm/kvm.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index 5870301991..d18bd2f3e8 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -352,7 +352,7 @@ uint32_t kvm_arch_get_supported_cpuid(KVMState *s, uint32_t function, { struct kvm_cpuid2 *cpuid; uint32_t ret = 0; - uint32_t cpuid_1_edx; + uint32_t cpuid_1_edx, unused; uint64_t bitmask; cpuid = get_supported_cpuid(s); @@ -399,10 +399,20 @@ uint32_t kvm_arch_get_supported_cpuid(KVMState *s, uint32_t function, } else if (function == 6 && reg == R_EAX) { ret |= CPUID_6_EAX_ARAT; /* safe to allow because of emulated APIC */ } else if (function == 7 && index == 0 && reg == R_EBX) { + /* Not new instructions, just an optimization. */ + uint32_t ebx; + host_cpuid(7, 0, &unused, &ebx, &unused, &unused); + ret |= ebx & CPUID_7_0_EBX_ERMS; + if (host_tsx_broken()) { ret &= ~(CPUID_7_0_EBX_RTM | CPUID_7_0_EBX_HLE); } } else if (function == 7 && index == 0 && reg == R_EDX) { + /* Not new instructions, just an optimization. */ + uint32_t edx; + host_cpuid(7, 0, &unused, &unused, &unused, &edx); + ret |= edx & CPUID_7_0_EDX_FSRM; + /* * Linux v4.17-v4.20 incorrectly return ARCH_CAPABILITIES on SVM hosts. * We can detect the bug by checking if MSR_IA32_ARCH_CAPABILITIES is @@ -411,6 +421,11 @@ uint32_t kvm_arch_get_supported_cpuid(KVMState *s, uint32_t function, if (!has_msr_arch_capabs) { ret &= ~CPUID_7_0_EDX_ARCH_CAPABILITIES; } + } else if (function == 7 && index == 1 && reg == R_EAX) { + /* Not new instructions, just an optimization. */ + uint32_t eax; + host_cpuid(7, 1, &eax, &unused, &unused, &unused); + ret |= eax & (CPUID_7_1_EAX_FZRM | CPUID_7_1_EAX_FSRS | CPUID_7_1_EAX_FSRC); } else if (function == 0xd && index == 0 && (reg == R_EAX || reg == R_EDX)) { /* From 7eb061b06e97af9a8da7f31b839d78997ae737fc Mon Sep 17 00:00:00 2001 From: "Wang, Lei" Date: Thu, 11 Aug 2022 22:57:51 -0700 Subject: [PATCH 13/13] i386: Add new CPU model SapphireRapids The new CPU model mostly inherits features from Icelake-Server, while adding new features: - AMX (Advance Matrix eXtensions) - Bus Lock Debug Exception and new instructions: - AVX VNNI (Vector Neural Network Instruction): - VPDPBUS: Multiply and Add Unsigned and Signed Bytes - VPDPBUSDS: Multiply and Add Unsigned and Signed Bytes with Saturation - VPDPWSSD: Multiply and Add Signed Word Integers - VPDPWSSDS: Multiply and Add Signed Integers with Saturation - FP16: Replicates existing AVX512 computational SP (FP32) instructions using FP16 instead of FP32 for ~2X performance gain - SERIALIZE: Provide software with a simple way to force the processor to complete all modifications, faster, allowed in all privilege levels and not causing an unconditional VM exit - TSX Suspend Load Address Tracking: Allows programmers to choose which memory accesses do not need to be tracked in the TSX read set - AVX512_BF16: Vector Neural Network Instructions supporting BFLOAT16 inputs and conversion instructions from IEEE single precision - fast zero-length MOVSB (KVM doesn't support yet) - fast short STOSB (KVM doesn't support yet) - fast short CMPSB, SCASB (KVM doesn't support yet) Features that may be added in future versions: - CET (virtualization support hasn't been merged) Signed-off-by: Wang, Lei Reviewed-by: Robert Hoo Message-Id: <20220812055751.14553-1-lei4.wang@intel.com> Reviewed-by: Xiaoyao Li Signed-off-by: Paolo Bonzini --- target/i386/cpu.c | 133 +++++++++++++++++++++++++++++++++++++++++++++- target/i386/cpu.h | 4 ++ 2 files changed, 135 insertions(+), 2 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 26ec6e9da7..4bad3d41d3 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -3468,6 +3468,135 @@ static const X86CPUDefinition builtin_x86_defs[] = { { /* end of list */ } } }, + { + .name = "SapphireRapids", + .level = 0x20, + .vendor = CPUID_VENDOR_INTEL, + .family = 6, + .model = 143, + .stepping = 4, + /* + * please keep the ascending order so that we can have a clear view of + * bit position of each feature. + */ + .features[FEAT_1_EDX] = + CPUID_FP87 | CPUID_VME | CPUID_DE | CPUID_PSE | CPUID_TSC | + CPUID_MSR | CPUID_PAE | CPUID_MCE | CPUID_CX8 | CPUID_APIC | + CPUID_SEP | CPUID_MTRR | CPUID_PGE | CPUID_MCA | CPUID_CMOV | + CPUID_PAT | CPUID_PSE36 | CPUID_CLFLUSH | CPUID_MMX | CPUID_FXSR | + CPUID_SSE | CPUID_SSE2, + .features[FEAT_1_ECX] = + CPUID_EXT_SSE3 | CPUID_EXT_PCLMULQDQ | CPUID_EXT_SSSE3 | + CPUID_EXT_FMA | CPUID_EXT_CX16 | CPUID_EXT_PCID | CPUID_EXT_SSE41 | + CPUID_EXT_SSE42 | CPUID_EXT_X2APIC | CPUID_EXT_MOVBE | + CPUID_EXT_POPCNT | CPUID_EXT_TSC_DEADLINE_TIMER | CPUID_EXT_AES | + CPUID_EXT_XSAVE | CPUID_EXT_AVX | CPUID_EXT_F16C | CPUID_EXT_RDRAND, + .features[FEAT_8000_0001_EDX] = + CPUID_EXT2_SYSCALL | CPUID_EXT2_NX | CPUID_EXT2_PDPE1GB | + CPUID_EXT2_RDTSCP | CPUID_EXT2_LM, + .features[FEAT_8000_0001_ECX] = + CPUID_EXT3_LAHF_LM | CPUID_EXT3_ABM | CPUID_EXT3_3DNOWPREFETCH, + .features[FEAT_8000_0008_EBX] = + CPUID_8000_0008_EBX_WBNOINVD, + .features[FEAT_7_0_EBX] = + CPUID_7_0_EBX_FSGSBASE | CPUID_7_0_EBX_BMI1 | CPUID_7_0_EBX_HLE | + CPUID_7_0_EBX_AVX2 | CPUID_7_0_EBX_SMEP | CPUID_7_0_EBX_BMI2 | + CPUID_7_0_EBX_ERMS | CPUID_7_0_EBX_INVPCID | CPUID_7_0_EBX_RTM | + CPUID_7_0_EBX_AVX512F | CPUID_7_0_EBX_AVX512DQ | + CPUID_7_0_EBX_RDSEED | CPUID_7_0_EBX_ADX | CPUID_7_0_EBX_SMAP | + CPUID_7_0_EBX_AVX512IFMA | CPUID_7_0_EBX_CLFLUSHOPT | + CPUID_7_0_EBX_CLWB | CPUID_7_0_EBX_AVX512CD | CPUID_7_0_EBX_SHA_NI | + CPUID_7_0_EBX_AVX512BW | CPUID_7_0_EBX_AVX512VL, + .features[FEAT_7_0_ECX] = + CPUID_7_0_ECX_AVX512_VBMI | CPUID_7_0_ECX_UMIP | CPUID_7_0_ECX_PKU | + CPUID_7_0_ECX_AVX512_VBMI2 | CPUID_7_0_ECX_GFNI | + CPUID_7_0_ECX_VAES | CPUID_7_0_ECX_VPCLMULQDQ | + CPUID_7_0_ECX_AVX512VNNI | CPUID_7_0_ECX_AVX512BITALG | + CPUID_7_0_ECX_AVX512_VPOPCNTDQ | CPUID_7_0_ECX_LA57 | + CPUID_7_0_ECX_RDPID | CPUID_7_0_ECX_BUS_LOCK_DETECT, + .features[FEAT_7_0_EDX] = + CPUID_7_0_EDX_FSRM | CPUID_7_0_EDX_SERIALIZE | + CPUID_7_0_EDX_TSX_LDTRK | CPUID_7_0_EDX_AMX_BF16 | + CPUID_7_0_EDX_AVX512_FP16 | CPUID_7_0_EDX_AMX_TILE | + CPUID_7_0_EDX_AMX_INT8 | CPUID_7_0_EDX_SPEC_CTRL | + CPUID_7_0_EDX_ARCH_CAPABILITIES | CPUID_7_0_EDX_SPEC_CTRL_SSBD, + .features[FEAT_ARCH_CAPABILITIES] = + MSR_ARCH_CAP_RDCL_NO | MSR_ARCH_CAP_IBRS_ALL | + MSR_ARCH_CAP_SKIP_L1DFL_VMENTRY | MSR_ARCH_CAP_MDS_NO | + MSR_ARCH_CAP_PSCHANGE_MC_NO | MSR_ARCH_CAP_TAA_NO, + .features[FEAT_XSAVE] = + CPUID_XSAVE_XSAVEOPT | CPUID_XSAVE_XSAVEC | + CPUID_XSAVE_XGETBV1 | CPUID_XSAVE_XSAVES | CPUID_D_1_EAX_XFD, + .features[FEAT_6_EAX] = + CPUID_6_EAX_ARAT, + .features[FEAT_7_1_EAX] = + CPUID_7_1_EAX_AVX_VNNI | CPUID_7_1_EAX_AVX512_BF16 | + CPUID_7_1_EAX_FZRM | CPUID_7_1_EAX_FSRS | CPUID_7_1_EAX_FSRC, + .features[FEAT_VMX_BASIC] = + MSR_VMX_BASIC_INS_OUTS | MSR_VMX_BASIC_TRUE_CTLS, + .features[FEAT_VMX_ENTRY_CTLS] = + VMX_VM_ENTRY_LOAD_DEBUG_CONTROLS | VMX_VM_ENTRY_IA32E_MODE | + VMX_VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL | + VMX_VM_ENTRY_LOAD_IA32_PAT | VMX_VM_ENTRY_LOAD_IA32_EFER, + .features[FEAT_VMX_EPT_VPID_CAPS] = + MSR_VMX_EPT_EXECONLY | + MSR_VMX_EPT_PAGE_WALK_LENGTH_4 | MSR_VMX_EPT_PAGE_WALK_LENGTH_5 | + MSR_VMX_EPT_WB | MSR_VMX_EPT_2MB | MSR_VMX_EPT_1GB | + MSR_VMX_EPT_INVEPT | MSR_VMX_EPT_AD_BITS | + MSR_VMX_EPT_INVEPT_SINGLE_CONTEXT | MSR_VMX_EPT_INVEPT_ALL_CONTEXT | + MSR_VMX_EPT_INVVPID | MSR_VMX_EPT_INVVPID_SINGLE_ADDR | + MSR_VMX_EPT_INVVPID_SINGLE_CONTEXT | + MSR_VMX_EPT_INVVPID_ALL_CONTEXT | + MSR_VMX_EPT_INVVPID_SINGLE_CONTEXT_NOGLOBALS, + .features[FEAT_VMX_EXIT_CTLS] = + VMX_VM_EXIT_SAVE_DEBUG_CONTROLS | + VMX_VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL | + VMX_VM_EXIT_ACK_INTR_ON_EXIT | VMX_VM_EXIT_SAVE_IA32_PAT | + VMX_VM_EXIT_LOAD_IA32_PAT | VMX_VM_EXIT_SAVE_IA32_EFER | + VMX_VM_EXIT_LOAD_IA32_EFER | VMX_VM_EXIT_SAVE_VMX_PREEMPTION_TIMER, + .features[FEAT_VMX_MISC] = + MSR_VMX_MISC_STORE_LMA | MSR_VMX_MISC_ACTIVITY_HLT | + MSR_VMX_MISC_VMWRITE_VMEXIT, + .features[FEAT_VMX_PINBASED_CTLS] = + VMX_PIN_BASED_EXT_INTR_MASK | VMX_PIN_BASED_NMI_EXITING | + VMX_PIN_BASED_VIRTUAL_NMIS | VMX_PIN_BASED_VMX_PREEMPTION_TIMER | + VMX_PIN_BASED_POSTED_INTR, + .features[FEAT_VMX_PROCBASED_CTLS] = + VMX_CPU_BASED_VIRTUAL_INTR_PENDING | + VMX_CPU_BASED_USE_TSC_OFFSETING | VMX_CPU_BASED_HLT_EXITING | + VMX_CPU_BASED_INVLPG_EXITING | VMX_CPU_BASED_MWAIT_EXITING | + VMX_CPU_BASED_RDPMC_EXITING | VMX_CPU_BASED_RDTSC_EXITING | + VMX_CPU_BASED_CR3_LOAD_EXITING | VMX_CPU_BASED_CR3_STORE_EXITING | + VMX_CPU_BASED_CR8_LOAD_EXITING | VMX_CPU_BASED_CR8_STORE_EXITING | + VMX_CPU_BASED_TPR_SHADOW | VMX_CPU_BASED_VIRTUAL_NMI_PENDING | + VMX_CPU_BASED_MOV_DR_EXITING | VMX_CPU_BASED_UNCOND_IO_EXITING | + VMX_CPU_BASED_USE_IO_BITMAPS | VMX_CPU_BASED_MONITOR_TRAP_FLAG | + VMX_CPU_BASED_USE_MSR_BITMAPS | VMX_CPU_BASED_MONITOR_EXITING | + VMX_CPU_BASED_PAUSE_EXITING | + VMX_CPU_BASED_ACTIVATE_SECONDARY_CONTROLS, + .features[FEAT_VMX_SECONDARY_CTLS] = + VMX_SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES | + VMX_SECONDARY_EXEC_ENABLE_EPT | VMX_SECONDARY_EXEC_DESC | + VMX_SECONDARY_EXEC_RDTSCP | + VMX_SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE | + VMX_SECONDARY_EXEC_ENABLE_VPID | VMX_SECONDARY_EXEC_WBINVD_EXITING | + VMX_SECONDARY_EXEC_UNRESTRICTED_GUEST | + VMX_SECONDARY_EXEC_APIC_REGISTER_VIRT | + VMX_SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY | + VMX_SECONDARY_EXEC_RDRAND_EXITING | + VMX_SECONDARY_EXEC_ENABLE_INVPCID | + VMX_SECONDARY_EXEC_ENABLE_VMFUNC | VMX_SECONDARY_EXEC_SHADOW_VMCS | + VMX_SECONDARY_EXEC_RDSEED_EXITING | VMX_SECONDARY_EXEC_ENABLE_PML | + VMX_SECONDARY_EXEC_XSAVES, + .features[FEAT_VMX_VMFUNC] = + MSR_VMX_VMFUNC_EPT_SWITCHING, + .xlevel = 0x80000008, + .model_id = "Intel Xeon Processor (SapphireRapids)", + .versions = (X86CPUVersionDefinition[]) { + { .version = 1 }, + { /* end of list */ }, + }, + }, { .name = "Denverton", .level = 21, @@ -5623,7 +5752,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count, break; } case 0x1D: { - /* AMX TILE */ + /* AMX TILE, for now hardcoded for Sapphire Rapids*/ *eax = 0; *ebx = 0; *ecx = 0; @@ -5644,7 +5773,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count, break; } case 0x1E: { - /* AMX TMUL */ + /* AMX TMUL, for now hardcoded for Sapphire Rapids */ *eax = 0; *ebx = 0; *ecx = 0; diff --git a/target/i386/cpu.h b/target/i386/cpu.h index e0703feb5e..41777fb4b0 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -881,10 +881,14 @@ uint64_t x86_cpu_get_supported_feature_word(FeatureWord w, #define CPUID_7_0_EDX_TSX_LDTRK (1U << 16) /* Architectural LBRs */ #define CPUID_7_0_EDX_ARCH_LBR (1U << 19) +/* AMX_BF16 instruction */ +#define CPUID_7_0_EDX_AMX_BF16 (1U << 22) /* AVX512_FP16 instruction */ #define CPUID_7_0_EDX_AVX512_FP16 (1U << 23) /* AMX tile (two-dimensional register) */ #define CPUID_7_0_EDX_AMX_TILE (1U << 24) +/* AMX_INT8 instruction */ +#define CPUID_7_0_EDX_AMX_INT8 (1U << 25) /* Speculation Control */ #define CPUID_7_0_EDX_SPEC_CTRL (1U << 26) /* Single Thread Indirect Branch Predictors */