hw/arm: add experimental iPhone 5 A6 platform
This commit is contained in:
+13
@@ -0,0 +1,13 @@
|
||||
#
|
||||
# Common b4 settings that can be used to send patches to QEMU upstream.
|
||||
# https://b4.docs.kernel.org/
|
||||
#
|
||||
|
||||
[b4]
|
||||
send-series-to = [email protected]
|
||||
send-auto-to-cmd = echo
|
||||
send-auto-cc-cmd = scripts/get_maintainer.pl --noroles --norolestats --nogit --nogit-fallback
|
||||
am-perpatch-check-cmd = scripts/checkpatch.pl -q --terse --no-summary --mailback -
|
||||
prep-perpatch-check-cmd = scripts/checkpatch.pl -q --terse --no-summary --mailback -
|
||||
searchmask = https://lore.kernel.org/qemu-devel/?x=m&t=1&q=%s
|
||||
linkmask = https://lore.kernel.org/qemu-devel/%s
|
||||
@@ -0,0 +1,2 @@
|
||||
((c-mode . ((c-file-style . "stroustrup")
|
||||
(indent-tabs-mode . nil))))
|
||||
@@ -0,0 +1,62 @@
|
||||
# EditorConfig is a file format and collection of text editor plugins
|
||||
# for maintaining consistent coding styles between different editors
|
||||
# and IDEs. Most popular editors support this either natively or via
|
||||
# plugin.
|
||||
#
|
||||
# Check https://editorconfig.org for details.
|
||||
#
|
||||
# Emacs: you need https://github.com/10sr/editorconfig-custom-majormode-el
|
||||
# to automatically enable the appropriate major-mode for your files
|
||||
# that aren't already caught by your existing config.
|
||||
#
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
charset = utf-8
|
||||
|
||||
[*.mak]
|
||||
indent_style = tab
|
||||
indent_size = 8
|
||||
emacs_mode = makefile
|
||||
|
||||
[Makefile*]
|
||||
indent_style = tab
|
||||
indent_size = 8
|
||||
emacs_mode = makefile
|
||||
|
||||
[*.{c,h,c.inc,h.inc}]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
emacs_mode = c
|
||||
|
||||
[*.sh]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[*.{s,S}]
|
||||
indent_style = tab
|
||||
indent_size = 8
|
||||
emacs_mode = asm
|
||||
|
||||
[*.{vert,frag}]
|
||||
emacs_mode = glsl
|
||||
|
||||
[*.json]
|
||||
indent_style = space
|
||||
emacs_mode = python
|
||||
|
||||
# by default follow QEMU's style
|
||||
[*.pl]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
emacs_mode = perl
|
||||
|
||||
# but user kernel "style" for imported scripts
|
||||
[scripts/{get_maintainer.pl,checkpatch.pl}]
|
||||
indent_style = tab
|
||||
indent_size = 8
|
||||
emacs_mode = perl
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
"VIM settings to match QEMU coding style. They are activated by adding the
|
||||
"following settings (without the " symbol) as last two lines in $HOME/.vimrc:
|
||||
"set secure
|
||||
"set exrc
|
||||
set expandtab
|
||||
set shiftwidth=4
|
||||
set smarttab
|
||||
@@ -0,0 +1,8 @@
|
||||
# GDB may have ./.gdbinit loading disabled by default. In that case you can
|
||||
# follow the instructions it prints. They boil down to adding the following to
|
||||
# your home directory's ~/.gdbinit file:
|
||||
#
|
||||
# add-auto-load-safe-path /path/to/qemu/.gdbinit
|
||||
|
||||
# Load QEMU-specific sub-commands and settings
|
||||
source scripts/qemu-gdb.py
|
||||
@@ -0,0 +1,21 @@
|
||||
#
|
||||
# List of code-formatting clean ups the git blame can ignore
|
||||
#
|
||||
# git blame --ignore-revs-file .git-blame-ignore-revs
|
||||
#
|
||||
# or
|
||||
#
|
||||
# git config blame.ignoreRevsFile .git-blame-ignore-revs
|
||||
#
|
||||
|
||||
# gdbstub: clean-up indents
|
||||
ad9e4585b3c7425759d3eea697afbca71d2c2082
|
||||
|
||||
# e1000e: fix code style
|
||||
0eadd56bf53ab196a16d492d7dd31c62e1c24c32
|
||||
|
||||
# target/riscv: coding style fixes
|
||||
8c7feddddd9218b407792120bcfda0347ed16205
|
||||
|
||||
# replace TABs with spaces
|
||||
48805df9c22a0700fba4b3b548fafaa21726ca68
|
||||
@@ -0,0 +1,9 @@
|
||||
*.c.inc diff=c
|
||||
*.h.inc diff=c
|
||||
*.m diff=objc
|
||||
*.py diff=python
|
||||
*.rs diff=rust
|
||||
*.rs.inc diff=rust
|
||||
Cargo.lock diff=toml merge=binary
|
||||
|
||||
*.patch -text -whitespace
|
||||
@@ -0,0 +1,30 @@
|
||||
# Configuration for Repo Lockdown - https://github.com/dessant/repo-lockdown
|
||||
|
||||
name: 'Repo Lockdown'
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: opened
|
||||
|
||||
permissions:
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
action:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: dessant/repo-lockdown@v2
|
||||
with:
|
||||
pr-comment: |
|
||||
Thank you for your interest in the QEMU project.
|
||||
|
||||
This repository is a read-only mirror of the project's repostories hosted
|
||||
on https://gitlab.com/qemu-project/qemu.git.
|
||||
The project does not process merge requests filed on GitHub.
|
||||
|
||||
QEMU welcomes contributions of code (either fixing bugs or adding new
|
||||
functionality). However, we get a lot of patches, and so we have some
|
||||
guidelines about contributing on the project website:
|
||||
https://www.qemu.org/contribute/
|
||||
lock-pr: true
|
||||
close-pr: true
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/GNUmakefile
|
||||
/build/
|
||||
/target/
|
||||
/firmware/
|
||||
/windows/QemuA6Ude/build/
|
||||
/windows/QemuA6Ude/cert/
|
||||
/windows/QemuA6Ude/package/
|
||||
/windows/QemuA6UsbBridge/build/
|
||||
/windows/QemuA6Ude/*.log
|
||||
/.cache/
|
||||
/.vscode/
|
||||
*.pyc
|
||||
.sdk
|
||||
.stgit-*
|
||||
.git-submodule-status
|
||||
.clang-format
|
||||
.gdb_history
|
||||
cscope.*
|
||||
tags
|
||||
TAGS
|
||||
GPATH
|
||||
GRTAGS
|
||||
GTAGS
|
||||
*~
|
||||
*.ast_raw
|
||||
*.depend_raw
|
||||
*.swp
|
||||
*.patch
|
||||
*.gcov
|
||||
@@ -0,0 +1,184 @@
|
||||
|
||||
variables:
|
||||
# On stable branches this is changed by later rules. Should also
|
||||
# be overridden per pipeline if running pipelines concurrently
|
||||
# for different branches in contributor forks.
|
||||
QEMU_CI_CONTAINER_TAG: latest
|
||||
|
||||
# For purposes of CI rules, upstream is the gitlab.com/qemu-project
|
||||
# namespace. When testing CI, it might be usefult to override this
|
||||
# to point to a fork repo
|
||||
QEMU_CI_UPSTREAM: qemu-project
|
||||
|
||||
# The order of rules defined here is critically important.
|
||||
# They are evaluated in order and first match wins.
|
||||
#
|
||||
# Thus we group them into a number of stages, ordered from
|
||||
# most restrictive to least restrictive
|
||||
#
|
||||
# For pipelines running for stable "staging-X.Y" branches
|
||||
# we must override QEMU_CI_CONTAINER_TAG
|
||||
#
|
||||
.base_job_template:
|
||||
variables:
|
||||
# Each script line from will be in a collapsible section in the job output
|
||||
# and show the duration of each line.
|
||||
FF_SCRIPT_SECTIONS: 1
|
||||
# The project has a fairly fat GIT repo so we try and avoid bringing in things
|
||||
# we don't need. The --filter options avoid blobs and tree references we aren't going to use
|
||||
# and we also avoid fetching tags.
|
||||
GIT_FETCH_EXTRA_FLAGS: --filter=blob:none --filter=tree:0 --no-tags --prune --quiet
|
||||
# Ensure docker.py / tests/docker/Makefile.include always displays stdout
|
||||
# from any docker commands to aid debugging of failures
|
||||
DOCKER_V: 1
|
||||
|
||||
interruptible: true
|
||||
|
||||
rules:
|
||||
#############################################################
|
||||
# Stage 1: exclude scenarios where we definitely don't
|
||||
# want jobs to run
|
||||
#############################################################
|
||||
|
||||
# Never run jobs upstream on stable branch, staging branch jobs already ran
|
||||
- if: '$CI_PROJECT_NAMESPACE == $QEMU_CI_UPSTREAM && $CI_COMMIT_BRANCH =~ /^stable-/'
|
||||
when: never
|
||||
|
||||
# Never run jobs upstream on tags, staging branch jobs already ran
|
||||
- if: '$CI_PROJECT_NAMESPACE == $QEMU_CI_UPSTREAM && $CI_COMMIT_TAG'
|
||||
when: never
|
||||
|
||||
# Scheduled jobs should explicitly enable the run in their job rules
|
||||
- if: '$CI_PIPELINE_SOURCE == "schedule"'
|
||||
when: never
|
||||
|
||||
# macOS jobs can't run in forks until gitlab opens up runner availability
|
||||
# to all tiers https://gitlab.com/groups/gitlab-org/-/work_items/8267
|
||||
- if: '$QEMU_JOB_MACOS == "1" && $CI_PROJECT_NAMESPACE != $QEMU_CI_UPSTREAM'
|
||||
when: never
|
||||
|
||||
# Publishing jobs should only run on the default branch in upstream
|
||||
- if: '$QEMU_JOB_PUBLISH == "1" && $CI_PROJECT_NAMESPACE == $QEMU_CI_UPSTREAM && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
|
||||
when: never
|
||||
|
||||
# Non-publishing jobs should only run on staging branches in upstream
|
||||
- if: '$QEMU_JOB_PUBLISH != "1" && $CI_PROJECT_NAMESPACE == $QEMU_CI_UPSTREAM && $CI_COMMIT_BRANCH !~ /staging/'
|
||||
when: never
|
||||
|
||||
# Jobs only intended for forks should always be skipped on upstream
|
||||
- if: '$QEMU_JOB_ONLY_FORKS == "1" && $CI_PROJECT_NAMESPACE == $QEMU_CI_UPSTREAM'
|
||||
when: never
|
||||
|
||||
# Forks don't get pipelines unless QEMU_CI=1 or QEMU_CI=2 is set
|
||||
- if: '$QEMU_CI != "1" && $QEMU_CI != "2" && $CI_PROJECT_NAMESPACE != $QEMU_CI_UPSTREAM'
|
||||
when: never
|
||||
|
||||
|
||||
#############################################################
|
||||
# Stage 2: fine tune execution of jobs in specific scenarios
|
||||
# where the catch all logic is inappropriate
|
||||
#############################################################
|
||||
|
||||
# Optional jobs should not be run unless manually triggered
|
||||
- if: '$QEMU_JOB_OPTIONAL && $CI_PROJECT_NAMESPACE == $QEMU_CI_UPSTREAM && $CI_COMMIT_BRANCH =~ /staging-[[:digit:]]+\.[[:digit:]]/'
|
||||
when: manual
|
||||
allow_failure: true
|
||||
variables:
|
||||
QEMU_CI_CONTAINER_TAG: $CI_COMMIT_REF_SLUG
|
||||
|
||||
- if: '$QEMU_JOB_OPTIONAL'
|
||||
when: manual
|
||||
allow_failure: true
|
||||
|
||||
# Skipped jobs should not be run unless manually triggered
|
||||
- if: '$QEMU_JOB_SKIPPED && $CI_PROJECT_NAMESPACE == $QEMU_CI_UPSTREAM && $CI_COMMIT_BRANCH =~ /staging-[[:digit:]]+\.[[:digit:]]/'
|
||||
when: manual
|
||||
allow_failure: true
|
||||
variables:
|
||||
QEMU_CI_CONTAINER_TAG: $CI_COMMIT_REF_SLUG
|
||||
|
||||
- if: '$QEMU_JOB_SKIPPED'
|
||||
when: manual
|
||||
allow_failure: true
|
||||
|
||||
# Functional jobs can be manually started in forks
|
||||
- if: '$QEMU_JOB_FUNCTIONAL && $QEMU_CI_FUNCTIONAL != "1" && $CI_PROJECT_NAMESPACE != $QEMU_CI_UPSTREAM'
|
||||
when: manual
|
||||
allow_failure: true
|
||||
|
||||
|
||||
#############################################################
|
||||
# Stage 3: catch all logic applying to any job not matching
|
||||
# an earlier criteria
|
||||
#############################################################
|
||||
|
||||
# Forks pipeline jobs don't start automatically unless
|
||||
# QEMU_CI=2 is set
|
||||
- if: '$QEMU_CI != "2" && $CI_PROJECT_NAMESPACE != $QEMU_CI_UPSTREAM'
|
||||
when: manual
|
||||
|
||||
# Upstream pipeline jobs start automatically unless told not to
|
||||
# by setting QEMU_CI=1
|
||||
- if: '$QEMU_CI == "1" && $CI_PROJECT_NAMESPACE == $QEMU_CI_UPSTREAM && $CI_COMMIT_BRANCH =~ /staging-[[:digit:]]+\.[[:digit:]]/'
|
||||
when: manual
|
||||
variables:
|
||||
QEMU_CI_CONTAINER_TAG: $CI_COMMIT_REF_SLUG
|
||||
|
||||
- if: '$QEMU_CI == "1" && $CI_PROJECT_NAMESPACE == $QEMU_CI_UPSTREAM'
|
||||
when: manual
|
||||
|
||||
# Jobs can run if any jobs they depend on were successful
|
||||
- if: '$CI_PROJECT_NAMESPACE == $QEMU_CI_UPSTREAM && $CI_COMMIT_BRANCH =~ /staging-[[:digit:]]+\.[[:digit:]]/'
|
||||
when: on_success
|
||||
variables:
|
||||
QEMU_CI_CONTAINER_TAG: $CI_COMMIT_REF_SLUG
|
||||
|
||||
- when: on_success
|
||||
|
||||
# Any job running meson should capture meson logs
|
||||
# by default. Some jobs might override the artifacts
|
||||
# to capture further files
|
||||
.base_meson_job_template:
|
||||
extends: .base_job_template
|
||||
artifacts:
|
||||
name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
|
||||
when: always
|
||||
expire_in: 7 days
|
||||
paths:
|
||||
- build/meson-logs
|
||||
- ci-runner-env
|
||||
reports:
|
||||
junit: build/meson-logs/*.junit.xml
|
||||
before_script:
|
||||
- source scripts/ci/gitlab-ci-section
|
||||
- section_start setup "Pre-script setup"
|
||||
- JOBS=$(expr $(nproc) + 1)
|
||||
# Prevent logs (if any) from prior build job artifacts
|
||||
# from being duplicated in the new job artifacts
|
||||
- rm -f build/meson-logs/*
|
||||
- mkdir -p ci-runner-env
|
||||
- test -f /packages.txt && cp /packages.txt ci-runner-env/packages.txt
|
||||
- cp /proc/mounts ci-runner-env/mounts.txt
|
||||
- cp /proc/cpuinfo ci-runner-env/cpuinfo.txt
|
||||
- cp /proc/meminfo ci-runner-env/meminfo.txt
|
||||
- ls -l /dev > ci-runner-env/devices.txt
|
||||
- uname -a > ci-runner-env/kernel.txt
|
||||
- id -a > ci-runner-env/user.txt
|
||||
- printenv | sort > ci-runner-env/environ.txt
|
||||
- section_end setup
|
||||
|
||||
.base_meson_ccache_job_template:
|
||||
extends: .base_meson_job_template
|
||||
cache:
|
||||
paths:
|
||||
- ccache
|
||||
key: "$CI_JOB_NAME"
|
||||
when: always
|
||||
script:
|
||||
- export CCACHE_BASEDIR="$(pwd)"
|
||||
- export CCACHE_DIR="$CCACHE_BASEDIR/ccache"
|
||||
- export CCACHE_MAXSIZE="500M"
|
||||
- export PATH="$CCACHE_WRAPPERSDIR:$PATH"
|
||||
- ccache --zero-stats
|
||||
after_script:
|
||||
- ccache --show-stats
|
||||
@@ -0,0 +1,133 @@
|
||||
|
||||
.native_build_job_template:
|
||||
extends: .base_meson_ccache_job_template
|
||||
stage: build
|
||||
image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG
|
||||
script:
|
||||
- !reference [.base_meson_ccache_job_template, script]
|
||||
- du -sh .git
|
||||
- mkdir build
|
||||
- cd build
|
||||
- section_start configure "Running configure"
|
||||
- ../configure --enable-werror --disable-docs --enable-fdt=system
|
||||
--disable-debug-info
|
||||
${TARGETS:+--target-list="$TARGETS"}
|
||||
$CONFIGURE_ARGS ||
|
||||
{ cat config.log meson-logs/meson-log.txt && exit 1; }
|
||||
- if test -n "$LD_JOBS";
|
||||
then
|
||||
pyvenv/bin/meson configure . -Dbackend_max_links="$LD_JOBS" ;
|
||||
fi || exit 1;
|
||||
- section_end configure
|
||||
- section_start build "Building QEMU"
|
||||
- $MAKE -j"$JOBS"
|
||||
- section_end build
|
||||
- section_start test "Running tests"
|
||||
- if test -n "$MAKE_CHECK_ARGS";
|
||||
then
|
||||
$MAKE -j"$JOBS" $MAKE_CHECK_ARGS ;
|
||||
fi
|
||||
- section_end test
|
||||
|
||||
# We jump some hoops in common_test_job_template to avoid
|
||||
# rebuilding all the object files we skip in the artifacts
|
||||
.native_build_artifact_template:
|
||||
artifacts:
|
||||
when: on_success
|
||||
expire_in: 2 days
|
||||
paths:
|
||||
- build
|
||||
- .git-submodule-status
|
||||
- ci-runner-env
|
||||
exclude:
|
||||
- build/**/*.p
|
||||
- build/**/*.a.p
|
||||
- build/**/*.c.o
|
||||
- build/**/*.c.o.d
|
||||
|
||||
.common_test_job_template:
|
||||
extends: .base_meson_job_template
|
||||
stage: test
|
||||
image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG
|
||||
artifacts:
|
||||
name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
|
||||
when: always
|
||||
expire_in: 7 days
|
||||
paths:
|
||||
- build/meson-logs
|
||||
- build/tests/functional/*/*/*.log
|
||||
reports:
|
||||
junit: build/meson-logs/*.junit.xml
|
||||
script:
|
||||
- source scripts/ci/gitlab-ci-section
|
||||
- section_start buildenv "Setting up to run tests"
|
||||
- scripts/git-submodule.sh update roms/SLOF
|
||||
- build/pyvenv/bin/meson subprojects download $(cd build/subprojects && echo *)
|
||||
- cd build
|
||||
- find . -type f -exec touch {} +
|
||||
# Avoid recompiling by hiding ninja with NINJA=":"
|
||||
# We also have to pre-cache the functional tests manually in this case
|
||||
- if [ "x${QEMU_TEST_CACHE_DIR}" != "x" ]; then
|
||||
$MAKE precache-functional ;
|
||||
fi
|
||||
- section_end buildenv
|
||||
- section_start test "Running tests"
|
||||
# doctests need all the compilation artifacts
|
||||
- $MAKE NINJA=":" MTESTARGS="--no-suite doc" $MAKE_CHECK_ARGS
|
||||
- section_end test
|
||||
|
||||
.native_test_job_template:
|
||||
extends: .common_test_job_template
|
||||
|
||||
.functional_test_job_template:
|
||||
extends: .common_test_job_template
|
||||
cache:
|
||||
key: "${CI_JOB_NAME}-cache"
|
||||
paths:
|
||||
- ${CI_PROJECT_DIR}/functional-cache
|
||||
policy: pull-push
|
||||
before_script:
|
||||
- export QEMU_TEST_ALLOW_UNTRUSTED_CODE=1
|
||||
- export QEMU_TEST_CACHE_DIR=${CI_PROJECT_DIR}/functional-cache
|
||||
# Prevent logs from the build job that run earlier
|
||||
# from being duplicated in the test job artifacts
|
||||
- rm -f build/meson-logs/*
|
||||
artifacts:
|
||||
name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
|
||||
when: always
|
||||
expire_in: 7 days
|
||||
paths:
|
||||
- build/meson-logs
|
||||
- build/tests/functional/*/*/*.log
|
||||
- ci-runner-env
|
||||
reports:
|
||||
junit: build/meson-logs/*.junit.xml
|
||||
after_script:
|
||||
- cd build
|
||||
- du -chs ${CI_PROJECT_DIR}/*-cache
|
||||
variables:
|
||||
QEMU_JOB_FUNCTIONAL: 1
|
||||
QEMU_TEST_ALLOW_UNTRUSTED_CODE: 1
|
||||
QEMU_TEST_CACHE_DIR: ${CI_PROJECT_DIR}/functional-cache
|
||||
|
||||
.wasm_build_job_template:
|
||||
extends: .base_meson_job_template
|
||||
stage: build
|
||||
image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG
|
||||
script:
|
||||
- du -sh .git
|
||||
- mkdir build
|
||||
- cd build
|
||||
- section_start configure "Running configure"
|
||||
- emconfigure ../configure --disable-docs
|
||||
${TARGETS:+--target-list="$TARGETS"}
|
||||
$CONFIGURE_ARGS ||
|
||||
{ cat config.log meson-logs/meson-log.txt && exit 1; }
|
||||
- if test -n "$LD_JOBS";
|
||||
then
|
||||
pyvenv/bin/meson configure . -Dbackend_max_links="$LD_JOBS" ;
|
||||
fi || exit 1;
|
||||
- section_end configure
|
||||
- section_start build "Building QEMU"
|
||||
- emmake make -j"$JOBS"
|
||||
- section_end build
|
||||
@@ -0,0 +1,799 @@
|
||||
include:
|
||||
- local: '/.gitlab-ci.d/buildtest-template.yml'
|
||||
|
||||
build-system-alpine:
|
||||
extends:
|
||||
- .native_build_job_template
|
||||
- .native_build_artifact_template
|
||||
needs:
|
||||
- job: amd64-alpine-container
|
||||
variables:
|
||||
IMAGE: alpine
|
||||
TARGETS: avr-softmmu loongarch64-softmmu mips64-softmmu mipsel-softmmu
|
||||
MAKE_CHECK_ARGS: check-build
|
||||
CONFIGURE_ARGS: --enable-docs --enable-trace-backends=log,simple,syslog
|
||||
|
||||
check-system-alpine:
|
||||
extends: .native_test_job_template
|
||||
needs:
|
||||
- job: build-system-alpine
|
||||
artifacts: true
|
||||
variables:
|
||||
IMAGE: alpine
|
||||
MAKE_CHECK_ARGS: check-unit check-qtest
|
||||
|
||||
functional-system-alpine:
|
||||
extends: .functional_test_job_template
|
||||
needs:
|
||||
- job: build-system-alpine
|
||||
artifacts: true
|
||||
variables:
|
||||
IMAGE: alpine
|
||||
MAKE_CHECK_ARGS: check-functional
|
||||
|
||||
build-system-ubuntu:
|
||||
extends:
|
||||
- .native_build_job_template
|
||||
- .native_build_artifact_template
|
||||
needs:
|
||||
- job: amd64-ubuntu2404-container
|
||||
variables:
|
||||
IMAGE: ubuntu2404
|
||||
CONFIGURE_ARGS: --enable-docs --enable-rust
|
||||
TARGETS: alpha-softmmu microblaze-softmmu mips64el-softmmu
|
||||
MAKE_CHECK_ARGS: check-build
|
||||
|
||||
check-system-ubuntu:
|
||||
extends: .native_test_job_template
|
||||
needs:
|
||||
- job: build-system-ubuntu
|
||||
artifacts: true
|
||||
variables:
|
||||
IMAGE: ubuntu2404
|
||||
MAKE_CHECK_ARGS: check
|
||||
|
||||
functional-system-ubuntu:
|
||||
extends: .functional_test_job_template
|
||||
needs:
|
||||
- job: build-system-ubuntu
|
||||
artifacts: true
|
||||
variables:
|
||||
IMAGE: ubuntu2404
|
||||
MAKE_CHECK_ARGS: check-functional
|
||||
|
||||
build-system-debian:
|
||||
extends:
|
||||
- .native_build_job_template
|
||||
- .native_build_artifact_template
|
||||
needs:
|
||||
- job: amd64-debian-container
|
||||
variables:
|
||||
IMAGE: debian
|
||||
CONFIGURE_ARGS: --with-coroutine=sigaltstack --enable-rust
|
||||
TARGETS: arm-softmmu hexagon-softmmu i386-softmmu riscv64-softmmu
|
||||
sh4eb-softmmu sparc-softmmu xtensa-softmmu
|
||||
MAKE_CHECK_ARGS: check-build
|
||||
|
||||
check-system-debian:
|
||||
extends: .native_test_job_template
|
||||
needs:
|
||||
- job: build-system-debian
|
||||
artifacts: true
|
||||
variables:
|
||||
IMAGE: debian
|
||||
MAKE_CHECK_ARGS: check
|
||||
|
||||
functional-system-debian:
|
||||
extends: .functional_test_job_template
|
||||
needs:
|
||||
- job: build-system-debian
|
||||
artifacts: true
|
||||
variables:
|
||||
IMAGE: debian
|
||||
MAKE_CHECK_ARGS: check-functional
|
||||
|
||||
crash-test-debian:
|
||||
extends: .native_test_job_template
|
||||
needs:
|
||||
- job: build-system-debian
|
||||
artifacts: true
|
||||
variables:
|
||||
IMAGE: debian
|
||||
script:
|
||||
- cd build
|
||||
- ./run scripts/device-crash-test -q --tcg-only ./qemu-system-i386
|
||||
|
||||
build-system-fedora:
|
||||
extends:
|
||||
- .native_build_job_template
|
||||
- .native_build_artifact_template
|
||||
needs:
|
||||
- job: amd64-fedora-container
|
||||
variables:
|
||||
IMAGE: fedora
|
||||
CONFIGURE_ARGS: --disable-gcrypt --enable-nettle --enable-docs --enable-crypto-afalg --enable-rust
|
||||
TARGETS: mips-softmmu
|
||||
xtensa-softmmu m68k-softmmu riscv32-softmmu ppc-softmmu sparc64-softmmu
|
||||
MAKE_CHECK_ARGS: check-build check-doc
|
||||
|
||||
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 --enable-strict-rust-lints
|
||||
TARGETS: aarch64-softmmu
|
||||
MAKE_CHECK_ARGS: check-build check-doc
|
||||
|
||||
allow_failure: true
|
||||
|
||||
check-system-fedora:
|
||||
extends: .native_test_job_template
|
||||
needs:
|
||||
- job: build-system-fedora
|
||||
artifacts: true
|
||||
variables:
|
||||
IMAGE: fedora
|
||||
MAKE_CHECK_ARGS: check
|
||||
|
||||
functional-system-fedora:
|
||||
extends: .functional_test_job_template
|
||||
needs:
|
||||
- job: build-system-fedora
|
||||
artifacts: true
|
||||
variables:
|
||||
IMAGE: fedora
|
||||
MAKE_CHECK_ARGS: check-functional
|
||||
|
||||
crash-test-fedora:
|
||||
extends: .native_test_job_template
|
||||
needs:
|
||||
- job: build-system-fedora
|
||||
artifacts: true
|
||||
variables:
|
||||
IMAGE: fedora
|
||||
script:
|
||||
- cd build
|
||||
- ./run scripts/device-crash-test -q ./qemu-system-ppc
|
||||
- ./run scripts/device-crash-test -q ./qemu-system-riscv32
|
||||
|
||||
build-system-centos:
|
||||
extends:
|
||||
- .native_build_job_template
|
||||
- .native_build_artifact_template
|
||||
needs:
|
||||
- job: amd64-centos9-container
|
||||
variables:
|
||||
IMAGE: centos9
|
||||
CONFIGURE_ARGS: --disable-nettle --enable-gcrypt --enable-vfio-user-server
|
||||
--enable-modules --enable-trace-backends=dtrace --enable-docs
|
||||
TARGETS: ppc64-softmmu or1k-softmmu s390x-softmmu
|
||||
x86_64-softmmu rx-softmmu sh4-softmmu
|
||||
MAKE_CHECK_ARGS: check-build
|
||||
|
||||
|
||||
# NB: block-XXX jobs use 'centos' since that is the build
|
||||
# job that provides the x86_64-softmmu. Some I/O tests
|
||||
# are currently buggy and blindly assume characteristics
|
||||
# of x86 (such as PCIe) causing failures with other arches
|
||||
|
||||
block:
|
||||
extends: .native_test_job_template
|
||||
needs:
|
||||
- job: build-system-centos
|
||||
artifacts: true
|
||||
variables:
|
||||
IMAGE: centos9
|
||||
MAKE_CHECK_ARGS: "check-block-$FORMAT"
|
||||
parallel:
|
||||
matrix:
|
||||
- FORMAT: [luks, nbd, parallels, qcow2, qed, raw, vdi, vhdx, vmdk, vpc]
|
||||
|
||||
# Previous QEMU release. Used for cross-version migration tests.
|
||||
build-previous-qemu:
|
||||
extends: .native_build_job_template
|
||||
artifacts:
|
||||
when: on_success
|
||||
expire_in: 2 days
|
||||
paths:
|
||||
- build-previous/qemu-bundle
|
||||
- build-previous/qemu-system-aarch64
|
||||
- build-previous/qemu-system-x86_64
|
||||
- build-previous/tests/qtest/migration-test
|
||||
- build-previous/scripts
|
||||
needs:
|
||||
- job: amd64-opensuse-leap-container
|
||||
variables:
|
||||
IMAGE: opensuse-leap
|
||||
TARGETS: x86_64-softmmu aarch64-softmmu
|
||||
# Override the default flags as we need more to grab the old version
|
||||
GIT_FETCH_EXTRA_FLAGS: --prune --quiet
|
||||
before_script:
|
||||
- source scripts/ci/gitlab-ci-section
|
||||
# Skip if this series contains the release bump commit. During the
|
||||
# release process there might be a window of commits when the
|
||||
# version tag is not yet present in the remote and git fetch would
|
||||
# fail.
|
||||
- if grep -q "\.0$" VERSION; then exit 0; fi
|
||||
- export QEMU_PREV_VERSION="$(sed 's/\([0-9.]*\)\.[0-9]*/v\1.0/' VERSION)"
|
||||
- git remote add upstream https://gitlab.com/qemu-project/qemu
|
||||
- git fetch upstream refs/tags/$QEMU_PREV_VERSION:refs/tags/$QEMU_PREV_VERSION
|
||||
- git checkout $QEMU_PREV_VERSION
|
||||
after_script:
|
||||
- mv build build-previous
|
||||
|
||||
.migration-compat-common:
|
||||
extends: .common_test_job_template
|
||||
needs:
|
||||
- job: build-previous-qemu
|
||||
- job: build-system-opensuse
|
||||
# The old QEMU could have bugs unrelated to migration that are
|
||||
# already fixed in the current development branch, so this test
|
||||
# might fail.
|
||||
allow_failure: true
|
||||
variables:
|
||||
IMAGE: opensuse-leap
|
||||
MAKE_CHECK_ARGS: check-build
|
||||
script:
|
||||
# Skip for round release numbers, this job is only relevant for
|
||||
# testing a development tree.
|
||||
- if grep -q "\.0$" VERSION; then exit 0; fi
|
||||
# Use the migration-tests from the older QEMU tree. This avoids
|
||||
# testing an old QEMU against new features/tests that it is not
|
||||
# compatible with.
|
||||
- cd build-previous
|
||||
# old to new
|
||||
- QTEST_QEMU_BINARY_SRC=./qemu-system-${TARGET}
|
||||
QTEST_QEMU_BINARY=../build/qemu-system-${TARGET} ./tests/qtest/migration-test
|
||||
# new to old
|
||||
- QTEST_QEMU_BINARY_DST=./qemu-system-${TARGET}
|
||||
QTEST_QEMU_BINARY=../build/qemu-system-${TARGET} ./tests/qtest/migration-test
|
||||
|
||||
# This job needs to be disabled until we can have an aarch64 CPU model that
|
||||
# will both (1) support both KVM and TCG, and (2) provide a stable ABI.
|
||||
# Currently only "-cpu max" can provide (1), however it doesn't guarantee
|
||||
# (2). Mark this test skipped until later.
|
||||
migration-compat-aarch64:
|
||||
extends: .migration-compat-common
|
||||
variables:
|
||||
TARGET: aarch64
|
||||
QEMU_JOB_SKIPPED: 1
|
||||
|
||||
migration-compat-x86_64:
|
||||
extends: .migration-compat-common
|
||||
variables:
|
||||
TARGET: x86_64
|
||||
|
||||
check-system-centos:
|
||||
extends: .native_test_job_template
|
||||
needs:
|
||||
- job: build-system-centos
|
||||
artifacts: true
|
||||
variables:
|
||||
IMAGE: centos9
|
||||
MAKE_CHECK_ARGS: check
|
||||
|
||||
functional-system-centos:
|
||||
extends: .functional_test_job_template
|
||||
needs:
|
||||
- job: build-system-centos
|
||||
artifacts: true
|
||||
variables:
|
||||
IMAGE: centos9
|
||||
MAKE_CHECK_ARGS: check-functional
|
||||
|
||||
build-system-opensuse:
|
||||
extends:
|
||||
- .native_build_job_template
|
||||
- .native_build_artifact_template
|
||||
needs:
|
||||
- job: amd64-opensuse-leap-container
|
||||
variables:
|
||||
IMAGE: opensuse-leap
|
||||
TARGETS: s390x-softmmu x86_64-softmmu aarch64-softmmu
|
||||
MAKE_CHECK_ARGS: check-build
|
||||
|
||||
check-system-opensuse:
|
||||
extends: .native_test_job_template
|
||||
needs:
|
||||
- job: build-system-opensuse
|
||||
artifacts: true
|
||||
variables:
|
||||
IMAGE: opensuse-leap
|
||||
MAKE_CHECK_ARGS: check
|
||||
|
||||
functional-system-opensuse:
|
||||
extends: .functional_test_job_template
|
||||
needs:
|
||||
- job: build-system-opensuse
|
||||
artifacts: true
|
||||
variables:
|
||||
IMAGE: opensuse-leap
|
||||
MAKE_CHECK_ARGS: check-functional
|
||||
|
||||
#
|
||||
# Flaky tests. We don't run these by default and they are allow fail
|
||||
# but often the CI system is the only way to trigger the failures.
|
||||
#
|
||||
|
||||
build-system-flaky:
|
||||
extends:
|
||||
- .native_build_job_template
|
||||
- .native_build_artifact_template
|
||||
needs:
|
||||
- job: amd64-debian-container
|
||||
variables:
|
||||
IMAGE: debian
|
||||
QEMU_JOB_OPTIONAL: 1
|
||||
TARGETS: aarch64-softmmu arm-softmmu mips64el-softmmu
|
||||
ppc64-softmmu rx-softmmu s390x-softmmu sh4-softmmu x86_64-softmmu
|
||||
MAKE_CHECK_ARGS: check-build
|
||||
|
||||
functional-system-flaky:
|
||||
extends: .functional_test_job_template
|
||||
needs:
|
||||
- job: build-system-flaky
|
||||
artifacts: true
|
||||
allow_failure: true
|
||||
variables:
|
||||
IMAGE: debian
|
||||
MAKE_CHECK_ARGS: check-functional
|
||||
QEMU_JOB_OPTIONAL: 1
|
||||
QEMU_TEST_FLAKY_TESTS: 1
|
||||
|
||||
# This jobs explicitly disable TCG (--disable-tcg), KVM is detected by
|
||||
# the configure script. The container doesn't contain Xen headers so
|
||||
# Xen accelerator is not detected / selected. As result it build the
|
||||
# i386-softmmu and x86_64-softmmu with KVM being the single accelerator
|
||||
# available.
|
||||
# Also use a different coroutine implementation (which is only really of
|
||||
# interest to KVM users, i.e. with TCG disabled)
|
||||
build-tcg-disabled:
|
||||
extends: .native_build_job_template
|
||||
needs:
|
||||
- job: amd64-centos9-container
|
||||
variables:
|
||||
IMAGE: centos9
|
||||
script:
|
||||
- mkdir build
|
||||
- cd build
|
||||
- ../configure --disable-tcg --audio-drv-list="" --with-coroutine=ucontext
|
||||
--disable-docs --disable-sdl --disable-gtk --disable-vnc
|
||||
|| { cat config.log meson-logs/meson-log.txt && exit 1; }
|
||||
- make -j"$JOBS"
|
||||
- make check-unit
|
||||
- make check-qapi-schema
|
||||
- make distclean
|
||||
|
||||
build-user:
|
||||
extends: .native_build_job_template
|
||||
needs:
|
||||
- job: amd64-debian-user-cross-container
|
||||
variables:
|
||||
IMAGE: debian-all-test-cross
|
||||
CONFIGURE_ARGS: --disable-tools --disable-system
|
||||
--target-list-exclude=alpha-linux-user,sh4-linux-user
|
||||
MAKE_CHECK_ARGS: check-tcg
|
||||
|
||||
build-user-static:
|
||||
extends: .native_build_job_template
|
||||
needs:
|
||||
- job: amd64-debian-user-cross-container
|
||||
variables:
|
||||
IMAGE: debian-all-test-cross
|
||||
CONFIGURE_ARGS: --disable-tools --disable-system --static
|
||||
MAKE_CHECK_ARGS: check-tcg
|
||||
|
||||
build-user-hexagon:
|
||||
extends: .native_build_job_template
|
||||
needs:
|
||||
- job: hexagon-cross-container
|
||||
variables:
|
||||
IMAGE: debian-hexagon-cross
|
||||
TARGETS: hexagon-linux-user
|
||||
CONFIGURE_ARGS: --disable-tools --disable-docs --enable-debug-tcg
|
||||
MAKE_CHECK_ARGS: check-tcg
|
||||
|
||||
# Build the softmmu targets we have check-tcg tests and compilers in
|
||||
# our omnibus all-test-cross container. Those targets that haven't got
|
||||
# Debian cross compiler support need to use special containers.
|
||||
build-some-softmmu:
|
||||
extends: .native_build_job_template
|
||||
needs:
|
||||
- job: amd64-debian-user-cross-container
|
||||
variables:
|
||||
IMAGE: debian-all-test-cross
|
||||
CONFIGURE_ARGS: --disable-tools --enable-debug
|
||||
TARGETS: arm-softmmu aarch64-softmmu i386-softmmu riscv64-softmmu
|
||||
s390x-softmmu x86_64-softmmu
|
||||
MAKE_CHECK_ARGS: check-tcg
|
||||
|
||||
build-loongarch64:
|
||||
extends: .native_build_job_template
|
||||
needs:
|
||||
- job: loongarch-debian-cross-container
|
||||
variables:
|
||||
IMAGE: debian-loongarch-cross
|
||||
CONFIGURE_ARGS: --disable-tools --enable-debug
|
||||
TARGETS: loongarch64-linux-user loongarch64-softmmu
|
||||
MAKE_CHECK_ARGS: check-tcg
|
||||
|
||||
# We build tricore in a very minimal tricore only container
|
||||
build-tricore-softmmu:
|
||||
extends: .native_build_job_template
|
||||
needs:
|
||||
- job: tricore-debian-cross-container
|
||||
variables:
|
||||
IMAGE: debian-tricore-cross
|
||||
CONFIGURE_ARGS: --disable-tools --disable-fdt --enable-debug
|
||||
TARGETS: tricore-softmmu
|
||||
MAKE_CHECK_ARGS: check-tcg
|
||||
|
||||
clang-system:
|
||||
extends: .native_build_job_template
|
||||
needs:
|
||||
- job: amd64-fedora-container
|
||||
variables:
|
||||
IMAGE: fedora
|
||||
CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-ubsan
|
||||
--extra-cflags=-fno-sanitize-recover=undefined
|
||||
TARGETS: alpha-softmmu arm-softmmu m68k-softmmu mips64-softmmu s390x-softmmu
|
||||
MAKE_CHECK_ARGS: check-qtest check-tcg
|
||||
|
||||
clang-user:
|
||||
extends: .native_build_job_template
|
||||
needs:
|
||||
- job: amd64-debian-user-cross-container
|
||||
timeout: 70m
|
||||
variables:
|
||||
IMAGE: debian-all-test-cross
|
||||
CONFIGURE_ARGS: --cc=clang --cxx=clang++ --disable-system --enable-ubsan
|
||||
--target-list-exclude=alpha-linux-user,microblazeel-linux-user,aarch64_be-linux-user,i386-linux-user,m68k-linux-user,mipsn32el-linux-user,xtensaeb-linux-user
|
||||
--extra-cflags=-fno-sanitize-recover=undefined
|
||||
MAKE_CHECK_ARGS: check-unit check-tcg
|
||||
|
||||
# Set LD_JOBS=1 because this requires LTO and ld consumes a large amount of memory.
|
||||
# On gitlab runners, default value sometimes end up calling 2 lds concurrently and
|
||||
# triggers an Out-Of-Memory error
|
||||
#
|
||||
# Since slirp callbacks are used in QEMU Timers, we cannot use libslirp with
|
||||
# CFI builds, and thus have to disable it here.
|
||||
#
|
||||
# Split in three sets of build/check/functional to limit the execution time
|
||||
# of each job
|
||||
build-cfi-aarch64:
|
||||
extends:
|
||||
- .native_build_job_template
|
||||
- .native_build_artifact_template
|
||||
needs:
|
||||
- job: amd64-fedora-container
|
||||
variables:
|
||||
LD_JOBS: 1
|
||||
AR: llvm-ar
|
||||
IMAGE: fedora
|
||||
CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-cfi
|
||||
--enable-safe-stack --disable-slirp
|
||||
TARGETS: aarch64-softmmu
|
||||
MAKE_CHECK_ARGS: check-build
|
||||
# FIXME: This job is often failing, likely due to out-of-memory problems in
|
||||
# the constrained containers of the shared runners. Thus this is marked as
|
||||
# skipped until the situation has been solved.
|
||||
QEMU_JOB_SKIPPED: 1
|
||||
timeout: 90m
|
||||
|
||||
check-cfi-aarch64:
|
||||
extends: .native_test_job_template
|
||||
needs:
|
||||
- job: build-cfi-aarch64
|
||||
artifacts: true
|
||||
variables:
|
||||
IMAGE: fedora
|
||||
MAKE_CHECK_ARGS: check
|
||||
|
||||
functional-cfi-aarch64:
|
||||
extends: .functional_test_job_template
|
||||
needs:
|
||||
- job: build-cfi-aarch64
|
||||
artifacts: true
|
||||
variables:
|
||||
IMAGE: fedora
|
||||
MAKE_CHECK_ARGS: check-functional
|
||||
|
||||
build-cfi-ppc64-s390x:
|
||||
extends:
|
||||
- .native_build_job_template
|
||||
- .native_build_artifact_template
|
||||
needs:
|
||||
- job: amd64-fedora-container
|
||||
variables:
|
||||
LD_JOBS: 1
|
||||
AR: llvm-ar
|
||||
IMAGE: fedora
|
||||
CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-cfi
|
||||
--enable-safe-stack --disable-slirp
|
||||
TARGETS: ppc64-softmmu s390x-softmmu
|
||||
MAKE_CHECK_ARGS: check-build
|
||||
# FIXME: This job is often failing, likely due to out-of-memory problems in
|
||||
# the constrained containers of the shared runners. Thus this is marked as
|
||||
# skipped until the situation has been solved.
|
||||
QEMU_JOB_SKIPPED: 1
|
||||
timeout: 80m
|
||||
|
||||
check-cfi-ppc64-s390x:
|
||||
extends: .native_test_job_template
|
||||
needs:
|
||||
- job: build-cfi-ppc64-s390x
|
||||
artifacts: true
|
||||
variables:
|
||||
IMAGE: fedora
|
||||
MAKE_CHECK_ARGS: check
|
||||
|
||||
functional-cfi-ppc64-s390x:
|
||||
extends: .functional_test_job_template
|
||||
needs:
|
||||
- job: build-cfi-ppc64-s390x
|
||||
artifacts: true
|
||||
variables:
|
||||
IMAGE: fedora
|
||||
MAKE_CHECK_ARGS: check-functional
|
||||
|
||||
build-cfi-x86_64:
|
||||
extends:
|
||||
- .native_build_job_template
|
||||
- .native_build_artifact_template
|
||||
needs:
|
||||
- job: amd64-fedora-container
|
||||
variables:
|
||||
LD_JOBS: 1
|
||||
AR: llvm-ar
|
||||
IMAGE: fedora
|
||||
CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-cfi
|
||||
--enable-safe-stack --disable-slirp
|
||||
TARGETS: x86_64-softmmu
|
||||
MAKE_CHECK_ARGS: check-build
|
||||
timeout: 70m
|
||||
|
||||
check-cfi-x86_64:
|
||||
extends: .native_test_job_template
|
||||
needs:
|
||||
- job: build-cfi-x86_64
|
||||
artifacts: true
|
||||
variables:
|
||||
IMAGE: fedora
|
||||
MAKE_CHECK_ARGS: check
|
||||
|
||||
functional-cfi-x86_64:
|
||||
extends: .functional_test_job_template
|
||||
needs:
|
||||
- job: build-cfi-x86_64
|
||||
artifacts: true
|
||||
variables:
|
||||
IMAGE: fedora
|
||||
MAKE_CHECK_ARGS: check-functional
|
||||
|
||||
tsan-build:
|
||||
extends: .native_build_job_template
|
||||
needs:
|
||||
- job: amd64-ubuntu2404-container
|
||||
variables:
|
||||
IMAGE: ubuntu2404
|
||||
CONFIGURE_ARGS: --enable-tsan --cc=clang --cxx=clang++
|
||||
--enable-trace-backends=ust --disable-slirp
|
||||
TARGETS: x86_64-softmmu ppc64-softmmu riscv64-softmmu x86_64-linux-user
|
||||
# Remove when we switch to a distro with clang >= 18
|
||||
# https://github.com/google/sanitizers/issues/1716
|
||||
MAKE: setarch -R make
|
||||
|
||||
# gcov is a GCC features
|
||||
gcov:
|
||||
extends: .native_build_job_template
|
||||
needs:
|
||||
- job: amd64-ubuntu2404-container
|
||||
timeout: 80m
|
||||
variables:
|
||||
IMAGE: ubuntu2404
|
||||
CONFIGURE_ARGS: --enable-gcov
|
||||
TARGETS: aarch64-softmmu ppc64-softmmu s390x-softmmu x86_64-softmmu
|
||||
MAKE_CHECK_ARGS: check-unit check-softfloat
|
||||
after_script:
|
||||
- cd build
|
||||
- gcovr --xml-pretty --exclude-unreachable-branches --print-summary
|
||||
-o coverage.xml --root ${CI_PROJECT_DIR} . *.p
|
||||
coverage: /^\s*lines:\s*\d+.\d+\%/
|
||||
artifacts:
|
||||
name: ${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA}
|
||||
when: always
|
||||
expire_in: 2 days
|
||||
paths:
|
||||
- build/meson-logs
|
||||
reports:
|
||||
junit: build/meson-logs/*.junit.xml
|
||||
coverage_report:
|
||||
coverage_format: cobertura
|
||||
path: build/coverage.xml
|
||||
|
||||
build-oss-fuzz:
|
||||
extends: .native_build_job_template
|
||||
needs:
|
||||
- job: amd64-fedora-container
|
||||
variables:
|
||||
IMAGE: fedora
|
||||
script:
|
||||
- mkdir build-oss-fuzz
|
||||
- export LSAN_OPTIONS=suppressions=scripts/lsan_suppressions.txt
|
||||
- CC="clang" CXX="clang++" CFLAGS="-fsanitize=address"
|
||||
./scripts/oss-fuzz/build.sh
|
||||
- export ASAN_OPTIONS="fast_unwind_on_malloc=0"
|
||||
- failures=0
|
||||
- for fuzzer in $(find ./build-oss-fuzz/DEST_DIR/ -executable -type f
|
||||
| grep -v slirp); do
|
||||
grep "LLVMFuzzerTestOneInput" ${fuzzer} > /dev/null 2>&1 || continue ;
|
||||
echo Testing ${fuzzer} ... ;
|
||||
"${fuzzer}" -runs=1 -seed=1 || { echo "FAILED:"" ${fuzzer} exit code is $?"; failures=$(($failures+1)); };
|
||||
done
|
||||
- echo "Number of failures:"" $failures"
|
||||
- test $failures = 0
|
||||
|
||||
build-tci:
|
||||
extends: .native_build_job_template
|
||||
needs:
|
||||
- job: amd64-debian-user-cross-container
|
||||
variables:
|
||||
IMAGE: debian-all-test-cross
|
||||
script:
|
||||
- TARGETS="aarch64 arm hppa m68k microblaze ppc64 s390x x86_64"
|
||||
- mkdir build
|
||||
- cd build
|
||||
- ../configure --enable-tcg-interpreter --disable-kvm --disable-docs --disable-gtk --disable-vnc
|
||||
--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
|
||||
- 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
|
||||
- make check-tcg
|
||||
|
||||
# Check our reduced build configurations
|
||||
build-without-defaults:
|
||||
extends: .native_build_job_template
|
||||
needs:
|
||||
- job: amd64-centos9-container
|
||||
variables:
|
||||
IMAGE: centos9
|
||||
CONFIGURE_ARGS:
|
||||
--without-default-devices
|
||||
--without-default-features
|
||||
--disable-fdt
|
||||
--disable-pie
|
||||
--disable-qom-cast-debug
|
||||
--disable-strip
|
||||
--target-list-exclude=aarch64-softmmu,mips64-softmmu,mipsel-softmmu,ppc64-softmmu,sh4el-softmmu,xtensa-softmmu,x86_64-softmmu
|
||||
MAKE_CHECK_ARGS: check
|
||||
|
||||
build-libvhost-user:
|
||||
extends: .base_job_template
|
||||
stage: build
|
||||
image: $CI_REGISTRY_IMAGE/qemu/fedora:$QEMU_CI_CONTAINER_TAG
|
||||
needs:
|
||||
- job: amd64-fedora-container
|
||||
script:
|
||||
- mkdir subprojects/libvhost-user/build
|
||||
- cd subprojects/libvhost-user/build
|
||||
- meson
|
||||
- ninja
|
||||
|
||||
# No targets are built here, just tools, docs, and unit tests. This
|
||||
# also feeds into the eventual documentation deployment steps later
|
||||
build-tools-and-docs-debian:
|
||||
extends:
|
||||
- .native_build_job_template
|
||||
- .native_build_artifact_template
|
||||
needs:
|
||||
- job: amd64-debian-container
|
||||
# when running on 'master' we use pre-existing container
|
||||
optional: true
|
||||
variables:
|
||||
IMAGE: debian
|
||||
MAKE_CHECK_ARGS: check-unit ctags TAGS cscope
|
||||
CONFIGURE_ARGS: --disable-system --disable-user --enable-docs --enable-tools
|
||||
QEMU_JOB_PUBLISH: 1
|
||||
|
||||
# Prepare for GitLab pages deployment. Anything copied into the
|
||||
# "public" directory will be deployed to $USER.gitlab.io/$PROJECT
|
||||
#
|
||||
# GitLab publishes from any branch that triggers a CI pipeline
|
||||
#
|
||||
# For the main repo we don't want to publish from 'staging'
|
||||
# since that content may not be pushed, nor do we wish to
|
||||
# publish from 'stable-NNN' branches as that content is outdated.
|
||||
# Thus we restrict to just the default branch
|
||||
#
|
||||
# For contributor forks we want to publish from any repo so
|
||||
# that users can see the results of their commits, regardless
|
||||
# of what topic branch they're currently using
|
||||
pages:
|
||||
extends: .base_job_template
|
||||
image: $CI_REGISTRY_IMAGE/qemu/debian:$QEMU_CI_CONTAINER_TAG
|
||||
stage: test
|
||||
needs:
|
||||
- job: build-tools-and-docs-debian
|
||||
script:
|
||||
- mkdir -p public
|
||||
# HTML-ised source tree
|
||||
- make gtags
|
||||
# We unset variables to work around a bug in some htags versions
|
||||
# which causes it to fail when the environment is large
|
||||
- CI_COMMIT_MESSAGE= CI_COMMIT_TAG_MESSAGE= CI_COMMIT_DESCRIPTION= htags
|
||||
-anT --tree-view=filetree -m qemu_init
|
||||
-t "Welcome to the QEMU sourcecode"
|
||||
- mv HTML public/src
|
||||
# Project documentation
|
||||
- make -C build install DESTDIR=$(pwd)/temp-install
|
||||
- mv temp-install/usr/local/share/doc/qemu/* public/
|
||||
artifacts:
|
||||
when: on_success
|
||||
paths:
|
||||
- public
|
||||
variables:
|
||||
QEMU_JOB_PUBLISH: 1
|
||||
|
||||
coverity:
|
||||
image: $CI_REGISTRY_IMAGE/qemu/fedora:$QEMU_CI_CONTAINER_TAG
|
||||
stage: build
|
||||
allow_failure: true
|
||||
timeout: 3h
|
||||
needs:
|
||||
- job: amd64-fedora-container
|
||||
optional: true
|
||||
before_script:
|
||||
- dnf install -y curl wget file
|
||||
script:
|
||||
# would be nice to cancel the job if over quota (https://gitlab.com/gitlab-org/gitlab/-/issues/256089)
|
||||
# for example:
|
||||
# curl --request POST --header "PRIVATE-TOKEN: $CI_JOB_TOKEN" "${CI_SERVER_URL}/api/v4/projects/${CI_PROJECT_ID}/jobs/${CI_JOB_ID}/cancel
|
||||
- 'scripts/coverity-scan/run-coverity-scan --check-upload-only || { exitcode=$?; if test $exitcode = 1; then
|
||||
exit 0;
|
||||
else
|
||||
exit $exitcode;
|
||||
fi; };
|
||||
scripts/coverity-scan/run-coverity-scan --update-tools-only > update-tools.log 2>&1 || { cat update-tools.log; exit 1; };
|
||||
scripts/coverity-scan/run-coverity-scan --no-update-tools'
|
||||
rules:
|
||||
- if: '$COVERITY_TOKEN == null'
|
||||
when: never
|
||||
- if: '$COVERITY_EMAIL == null'
|
||||
when: never
|
||||
# Never included on upstream pipelines, except for schedules
|
||||
- if: '$CI_PROJECT_NAMESPACE == $QEMU_CI_UPSTREAM && $CI_PIPELINE_SOURCE == "schedule"'
|
||||
when: on_success
|
||||
- if: '$CI_PROJECT_NAMESPACE == $QEMU_CI_UPSTREAM'
|
||||
when: never
|
||||
# Forks don't get any pipeline unless QEMU_CI=1 or QEMU_CI=2 is set
|
||||
- if: '$QEMU_CI != "1" && $QEMU_CI != "2"'
|
||||
when: never
|
||||
# Always manual on forks even if $QEMU_CI == "2"
|
||||
- when: manual
|
||||
|
||||
build-wasm64-64bit:
|
||||
extends: .wasm_build_job_template
|
||||
timeout: 2h
|
||||
needs:
|
||||
- job: wasm64-emsdk-cross-container
|
||||
variables:
|
||||
IMAGE: emsdk-wasm64-cross
|
||||
CONFIGURE_ARGS: --static --cpu=wasm64 --disable-tools --enable-debug --enable-tcg-interpreter
|
||||
|
||||
build-wasm64-32bit:
|
||||
extends: .wasm_build_job_template
|
||||
timeout: 2h
|
||||
needs:
|
||||
- job: wasm64-emsdk-cross-container
|
||||
variables:
|
||||
IMAGE: emsdk-wasm64-cross
|
||||
CONFIGURE_ARGS: --static --cpu=wasm64 --wasm64-32bit-address-limit --disable-tools --enable-debug --enable-tcg-interpreter
|
||||
Executable
+96
@@ -0,0 +1,96 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# check-dco.py: validate all commits are signed off
|
||||
#
|
||||
# Copyright (C) 2020 Red Hat, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
import os
|
||||
import os.path
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
namespace = "qemu-project"
|
||||
if len(sys.argv) >= 2:
|
||||
namespace = sys.argv[1]
|
||||
|
||||
cwd = os.getcwd()
|
||||
reponame = os.path.basename(cwd)
|
||||
repourl = "https://gitlab.com/%s/%s.git" % (namespace, reponame)
|
||||
|
||||
print(f"adding upstream git repo @ {repourl}")
|
||||
subprocess.check_call(["git", "remote", "add", "check-dco", repourl])
|
||||
subprocess.check_call(["git", "fetch", "--refetch", "check-dco", "master"])
|
||||
|
||||
ancestor = subprocess.check_output(["git", "merge-base",
|
||||
"check-dco/master", "HEAD"],
|
||||
universal_newlines=True)
|
||||
|
||||
ancestor = ancestor.strip()
|
||||
|
||||
subprocess.check_call(["git", "remote", "rm", "check-dco"])
|
||||
|
||||
errors = False
|
||||
|
||||
print("\nChecking for 'Signed-off-by: NAME <EMAIL>' " +
|
||||
"on all commits since %s...\n" % ancestor)
|
||||
|
||||
log = subprocess.check_output(["git", "log", "--format=%H %s",
|
||||
ancestor + "..."],
|
||||
universal_newlines=True)
|
||||
|
||||
if log == "":
|
||||
commits = []
|
||||
else:
|
||||
commits = [[c[0:40], c[41:]] for c in log.strip().split("\n")]
|
||||
|
||||
for sha, subject in commits:
|
||||
|
||||
msg = subprocess.check_output(["git", "show", "-s", sha],
|
||||
universal_newlines=True)
|
||||
lines = msg.strip().split("\n")
|
||||
|
||||
print("🔍 %s %s" % (sha, subject))
|
||||
sob = False
|
||||
for line in lines:
|
||||
if "Signed-off-by:" in line:
|
||||
sob = True
|
||||
if "localhost" in line:
|
||||
print(" ❌ FAIL: bad email in %s" % line)
|
||||
errors = True
|
||||
|
||||
if not sob:
|
||||
print(" ❌ FAIL missing Signed-off-by tag")
|
||||
errors = True
|
||||
|
||||
if errors:
|
||||
print("""
|
||||
|
||||
❌ ERROR: One or more commits are missing a valid Signed-off-By tag.
|
||||
|
||||
|
||||
This project requires all contributors to assert that their contributions
|
||||
are provided in compliance with the terms of the Developer's Certificate
|
||||
of Origin 1.1 (DCO):
|
||||
|
||||
https://developercertificate.org/
|
||||
|
||||
To indicate acceptance of the DCO every commit must have a tag
|
||||
|
||||
Signed-off-by: YOUR NAME <EMAIL>
|
||||
|
||||
where "YOUR NAME" is your commonly known identity in the context
|
||||
of the community.
|
||||
|
||||
This can be achieved by passing the "-s" flag to the "git commit" command.
|
||||
|
||||
To bulk update all commits on current branch "git rebase" can be used:
|
||||
|
||||
git rebase -i master -x 'git commit --amend --no-edit -s'
|
||||
|
||||
""")
|
||||
|
||||
sys.exit(1)
|
||||
|
||||
sys.exit(0)
|
||||
Executable
+55
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# check-patch.py: run checkpatch.pl across all commits in a branch
|
||||
#
|
||||
# Copyright (C) 2020 Red Hat, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
import os
|
||||
import os.path
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
namespace = "qemu-project"
|
||||
if len(sys.argv) >= 2:
|
||||
namespace = sys.argv[1]
|
||||
|
||||
cwd = os.getcwd()
|
||||
reponame = os.path.basename(cwd)
|
||||
repourl = "https://gitlab.com/%s/%s.git" % (namespace, reponame)
|
||||
|
||||
print(f"adding upstream git repo @ {repourl}")
|
||||
# GitLab CI environment does not give us any direct info about the
|
||||
# base for the user's branch. We thus need to figure out a common
|
||||
# ancestor between the user's branch and current git master.
|
||||
subprocess.check_call(["git", "remote", "add", "check-patch", repourl])
|
||||
subprocess.check_call(["git", "fetch", "--refetch", "check-patch", "master"])
|
||||
|
||||
ancestor = subprocess.check_output(["git", "merge-base",
|
||||
"check-patch/master", "HEAD"],
|
||||
universal_newlines=True)
|
||||
|
||||
ancestor = ancestor.strip()
|
||||
|
||||
log = subprocess.check_output(["git", "log", "--format=%H %s",
|
||||
ancestor + "..."],
|
||||
universal_newlines=True)
|
||||
|
||||
subprocess.check_call(["git", "remote", "rm", "check-patch"])
|
||||
|
||||
if log == "":
|
||||
print("\nNo commits since %s, skipping checks\n" % ancestor)
|
||||
sys.exit(0)
|
||||
|
||||
errors = False
|
||||
|
||||
print("\nChecking all commits since %s...\n" % ancestor, flush=True)
|
||||
|
||||
ret = subprocess.run(["scripts/checkpatch.pl", "--terse", ancestor + "..."])
|
||||
|
||||
if ret.returncode != 0:
|
||||
print(" ❌ FAIL one or more commits failed scripts/checkpatch.pl")
|
||||
sys.exit(1)
|
||||
|
||||
sys.exit(0)
|
||||
Executable
+71
@@ -0,0 +1,71 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# check-units.py: check the number of compilation units and identify
|
||||
# those that are rebuilt multiple times
|
||||
#
|
||||
# Copyright (C) 2025 Linaro Ltd.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
from os import access, R_OK, path
|
||||
from sys import exit
|
||||
import json
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
from collections import Counter
|
||||
|
||||
|
||||
def extract_build_units(cc_path):
|
||||
"""
|
||||
Extract the build units and their counds from compile_commands.json file.
|
||||
|
||||
Returns:
|
||||
Hash table of ["unit"] = count
|
||||
"""
|
||||
|
||||
j = json.load(open(cc_path, 'r'))
|
||||
files = [f['file'] for f in j]
|
||||
build_units = Counter(files)
|
||||
|
||||
return build_units
|
||||
|
||||
|
||||
def analyse_units(build_units, top_n):
|
||||
"""
|
||||
Analyse the build units and report stats and the top 10 rebuilds
|
||||
"""
|
||||
|
||||
print(f"Total source files: {len(build_units.keys())}")
|
||||
print(f"Total build units: {sum(units.values())}")
|
||||
|
||||
# Create a sorted list by number of rebuilds
|
||||
sorted_build_units = sorted(build_units.items(),
|
||||
key=lambda item: item[1],
|
||||
reverse=True)
|
||||
|
||||
print("Most rebuilt units:")
|
||||
for unit, count in sorted_build_units[:top_n]:
|
||||
print(f" {unit} built {count} times")
|
||||
|
||||
print("Least rebuilt units:")
|
||||
for unit, count in sorted_build_units[-10:]:
|
||||
print(f" {unit} built {count} times")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(
|
||||
description="analyse number of build units in compile_commands.json")
|
||||
parser.add_argument("cc_path", type=Path, default=None,
|
||||
help="Path to compile_commands.json")
|
||||
parser.add_argument("-n", type=int, default=20,
|
||||
help="Dump the top <n> entries")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if path.isfile(args.cc_path) and access(args.cc_path, R_OK):
|
||||
units = extract_build_units(args.cc_path)
|
||||
analyse_units(units, args.n)
|
||||
exit(0)
|
||||
else:
|
||||
print(f"{args.cc_path} doesn't exist or isn't readable")
|
||||
exit(1)
|
||||
@@ -0,0 +1,12 @@
|
||||
include:
|
||||
- local: '/.gitlab-ci.d/container-template.yml'
|
||||
|
||||
amd64-centos9-container:
|
||||
extends: .container_job_template
|
||||
variables:
|
||||
NAME: centos9
|
||||
|
||||
amd64-fedora-container:
|
||||
extends: .container_job_template
|
||||
variables:
|
||||
NAME: fedora
|
||||
@@ -0,0 +1,68 @@
|
||||
amd64-debian-cross-container:
|
||||
extends: .container_job_template
|
||||
stage: containers
|
||||
variables:
|
||||
NAME: debian-amd64-cross
|
||||
|
||||
amd64-debian-user-cross-container:
|
||||
extends: .container_job_template
|
||||
stage: containers
|
||||
variables:
|
||||
NAME: debian-all-test-cross
|
||||
|
||||
arm64-debian-cross-container:
|
||||
extends: .container_job_template
|
||||
stage: containers
|
||||
variables:
|
||||
NAME: debian-arm64-cross
|
||||
|
||||
hexagon-cross-container:
|
||||
extends: .container_job_template
|
||||
stage: containers
|
||||
variables:
|
||||
NAME: debian-hexagon-cross
|
||||
|
||||
loongarch-debian-cross-container:
|
||||
extends: .container_job_template
|
||||
stage: containers
|
||||
variables:
|
||||
NAME: debian-loongarch-cross
|
||||
|
||||
ppc64el-debian-cross-container:
|
||||
extends: .container_job_template
|
||||
stage: containers
|
||||
variables:
|
||||
NAME: debian-ppc64el-cross
|
||||
|
||||
riscv64-debian-cross-container:
|
||||
extends: .container_job_template
|
||||
stage: containers
|
||||
variables:
|
||||
NAME: debian-riscv64-cross
|
||||
|
||||
s390x-debian-cross-container:
|
||||
extends: .container_job_template
|
||||
stage: containers
|
||||
variables:
|
||||
NAME: debian-s390x-cross
|
||||
|
||||
tricore-debian-cross-container:
|
||||
extends: .container_job_template
|
||||
stage: containers
|
||||
variables:
|
||||
NAME: debian-tricore-cross
|
||||
|
||||
xtensa-debian-cross-container:
|
||||
extends: .container_job_template
|
||||
variables:
|
||||
NAME: debian-xtensa-cross
|
||||
|
||||
win64-fedora-cross-container:
|
||||
extends: .container_job_template
|
||||
variables:
|
||||
NAME: fedora-win64-cross
|
||||
|
||||
wasm64-emsdk-cross-container:
|
||||
extends: .container_job_template
|
||||
variables:
|
||||
NAME: emsdk-wasm64-cross
|
||||
@@ -0,0 +1,25 @@
|
||||
.container_job_template:
|
||||
extends: .base_job_template
|
||||
image: docker:latest
|
||||
stage: containers
|
||||
services:
|
||||
- docker:dind
|
||||
before_script:
|
||||
- export TAG="$CI_REGISTRY_IMAGE/qemu/$NAME:$QEMU_CI_CONTAINER_TAG"
|
||||
# Always ':latest' because we always use upstream as a common cache source
|
||||
- export COMMON_TAG="$CI_REGISTRY/qemu-project/qemu/qemu/$NAME:latest"
|
||||
- docker login $CI_REGISTRY -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD"
|
||||
- until docker info; do sleep 1; done
|
||||
script:
|
||||
- echo "TAG:$TAG"
|
||||
- echo "COMMON_TAG:$COMMON_TAG"
|
||||
- docker build --tag "$TAG" --cache-from "$TAG" --cache-from "$COMMON_TAG"
|
||||
--build-arg BUILDKIT_INLINE_CACHE=1 --provenance=false
|
||||
-f "tests/docker/dockerfiles/$NAME.docker" "."
|
||||
- docker push "$TAG"
|
||||
after_script:
|
||||
- docker logout
|
||||
rules:
|
||||
# because we want to enable this for scheduled runs we also have to replicate the normal rules
|
||||
- if: '$CI_PIPELINE_SOURCE == "schedule" && $CI_PROJECT_NAMESPACE == $QEMU_CI_UPSTREAM'
|
||||
- !reference [.base_job_template, rules]
|
||||
@@ -0,0 +1,70 @@
|
||||
include:
|
||||
- local: '/.gitlab-ci.d/container-core.yml'
|
||||
- local: '/.gitlab-ci.d/container-cross.yml'
|
||||
|
||||
amd64-alpine-container:
|
||||
extends: .container_job_template
|
||||
variables:
|
||||
NAME: alpine
|
||||
|
||||
amd64-debian-container:
|
||||
extends: .container_job_template
|
||||
stage: containers
|
||||
variables:
|
||||
NAME: debian
|
||||
|
||||
amd64-ubuntu2404-container:
|
||||
extends: .container_job_template
|
||||
variables:
|
||||
NAME: ubuntu2404
|
||||
|
||||
amd64-opensuse-leap-container:
|
||||
extends: .container_job_template
|
||||
variables:
|
||||
NAME: opensuse-leap
|
||||
|
||||
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
|
||||
|
||||
# this scheduled job will trigger all the containers to build
|
||||
weekly-container-builds:
|
||||
extends: .container_job_template
|
||||
allow_failure: true
|
||||
needs:
|
||||
# core
|
||||
- amd64-centos9-container
|
||||
- amd64-fedora-container
|
||||
# cross
|
||||
- amd64-debian-cross-container
|
||||
- amd64-debian-user-cross-container
|
||||
- arm64-debian-cross-container
|
||||
- hexagon-cross-container
|
||||
- loongarch-debian-cross-container
|
||||
- ppc64el-debian-cross-container
|
||||
- riscv64-debian-cross-container
|
||||
- s390x-debian-cross-container
|
||||
- tricore-debian-cross-container
|
||||
- xtensa-debian-cross-container
|
||||
- win64-fedora-cross-container
|
||||
- wasm64-emsdk-cross-container
|
||||
# containers
|
||||
- amd64-alpine-container
|
||||
- amd64-debian-container
|
||||
- amd64-ubuntu2404-container
|
||||
- amd64-opensuse-leap-container
|
||||
- python-container
|
||||
- amd64-fedora-rust-nightly-container
|
||||
script:
|
||||
- apk -U add make bash skopeo
|
||||
- make docker-verify V=1 DOCKER_DEFAULT_REGISTRY=$CI_REGISTRY_IMAGE
|
||||
rules:
|
||||
# this only ever runes as a scheduled build
|
||||
- if: '$CI_PIPELINE_SOURCE == "schedule"'
|
||||
@@ -0,0 +1,86 @@
|
||||
.cross_system_build_job:
|
||||
extends: .base_meson_ccache_job_template
|
||||
stage: build
|
||||
image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG
|
||||
timeout: 80m
|
||||
script:
|
||||
- !reference [.base_meson_ccache_job_template, script]
|
||||
- mkdir build
|
||||
- cd build
|
||||
- section_start configure "Running configure"
|
||||
- ../configure --enable-werror --disable-docs --enable-fdt=system
|
||||
--disable-user $QEMU_CONFIGURE_OPTS $EXTRA_CONFIGURE_OPTS
|
||||
--target-list-exclude="arm-softmmu
|
||||
i386-softmmu microblaze-softmmu mips-softmmu mipsel-softmmu
|
||||
mips64-softmmu ppc-softmmu riscv32-softmmu sh4-softmmu
|
||||
sparc-softmmu xtensa-softmmu $CROSS_SKIP_TARGETS"
|
||||
- section_end configure
|
||||
- section_start build "Building QEMU"
|
||||
- make -j"$JOBS" all check-build
|
||||
- section_end build
|
||||
- section_start test "Running tests"
|
||||
- if test -n "$MAKE_CHECK_ARGS";
|
||||
then
|
||||
$MAKE -j"$JOBS" $MAKE_CHECK_ARGS ;
|
||||
fi
|
||||
- section_end test
|
||||
- section_start installer "Building the installer"
|
||||
- if grep -q "EXESUF=.exe" config-host.mak;
|
||||
then make installer;
|
||||
version="$(git describe --match v[0-9]* 2>/dev/null || git rev-parse --short HEAD)";
|
||||
mv -v qemu-setup*.exe qemu-setup-${version}.exe;
|
||||
fi
|
||||
- section_end installer
|
||||
|
||||
# Job to cross-build specific accelerators.
|
||||
#
|
||||
# Set the $ACCEL variable to select the specific accelerator (default to
|
||||
# KVM), and set extra options (such disabling other accelerators) via the
|
||||
# $EXTRA_CONFIGURE_OPTS variable.
|
||||
.cross_accel_build_job:
|
||||
extends: .base_meson_ccache_job_template
|
||||
stage: build
|
||||
image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG
|
||||
timeout: 60m
|
||||
script:
|
||||
- !reference [.base_meson_ccache_job_template, script]
|
||||
- mkdir build
|
||||
- cd build
|
||||
- section_start configure "Running configure"
|
||||
- ../configure --enable-werror --disable-docs $QEMU_CONFIGURE_OPTS
|
||||
--disable-tools --enable-${ACCEL:-kvm} $EXTRA_CONFIGURE_OPTS
|
||||
- section_end configure
|
||||
- section_start build "Building QEMU"
|
||||
- make -j"$JOBS" all check-build
|
||||
- section_end build
|
||||
- section_start test "Running tests"
|
||||
- if test -n "$MAKE_CHECK_ARGS";
|
||||
then
|
||||
$MAKE -j"$JOBS" $MAKE_CHECK_ARGS ;
|
||||
fi
|
||||
- section_end test
|
||||
|
||||
.cross_user_build_job:
|
||||
extends: .base_meson_ccache_job_template
|
||||
stage: build
|
||||
image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG
|
||||
script:
|
||||
- !reference [.base_meson_ccache_job_template, script]
|
||||
- mkdir build
|
||||
- cd build
|
||||
- section_start configure "Running configure"
|
||||
- ../configure --enable-werror --disable-docs $QEMU_CONFIGURE_OPTS
|
||||
--disable-system --target-list-exclude="aarch64_be-linux-user
|
||||
alpha-linux-user m68k-linux-user microblazeel-linux-user
|
||||
or1k-linux-user ppc-linux-user sparc-linux-user
|
||||
xtensa-linux-user $CROSS_SKIP_TARGETS"
|
||||
- section_end configure
|
||||
- section_start build "Building QEMU"
|
||||
- make -j"$JOBS" all check-build
|
||||
- section_end build
|
||||
- section_start test "Running tests"
|
||||
- if test -n "$MAKE_CHECK_ARGS";
|
||||
then
|
||||
$MAKE -j"$JOBS" $MAKE_CHECK_ARGS ;
|
||||
fi
|
||||
- section_end test
|
||||
@@ -0,0 +1,124 @@
|
||||
include:
|
||||
- local: '/.gitlab-ci.d/crossbuild-template.yml'
|
||||
|
||||
cross-arm64-system:
|
||||
extends: .cross_system_build_job
|
||||
needs:
|
||||
- job: arm64-debian-cross-container
|
||||
variables:
|
||||
IMAGE: debian-arm64-cross
|
||||
|
||||
cross-arm64-user:
|
||||
extends: .cross_user_build_job
|
||||
needs:
|
||||
- job: arm64-debian-cross-container
|
||||
variables:
|
||||
IMAGE: debian-arm64-cross
|
||||
|
||||
cross-arm64-kvm-only:
|
||||
extends: .cross_accel_build_job
|
||||
needs:
|
||||
- job: arm64-debian-cross-container
|
||||
variables:
|
||||
IMAGE: debian-arm64-cross
|
||||
EXTRA_CONFIGURE_OPTS: --disable-tcg --without-default-features
|
||||
|
||||
cross-ppc64el-system:
|
||||
extends: .cross_system_build_job
|
||||
needs:
|
||||
- job: ppc64el-debian-cross-container
|
||||
variables:
|
||||
IMAGE: debian-ppc64el-cross
|
||||
|
||||
cross-ppc64el-user:
|
||||
extends: .cross_user_build_job
|
||||
needs:
|
||||
- job: ppc64el-debian-cross-container
|
||||
variables:
|
||||
IMAGE: debian-ppc64el-cross
|
||||
|
||||
cross-ppc64el-kvm-only:
|
||||
extends: .cross_accel_build_job
|
||||
needs:
|
||||
- job: ppc64el-debian-cross-container
|
||||
variables:
|
||||
IMAGE: debian-ppc64el-cross
|
||||
EXTRA_CONFIGURE_OPTS: --disable-tcg --without-default-devices
|
||||
|
||||
cross-riscv64-system:
|
||||
extends: .cross_system_build_job
|
||||
needs:
|
||||
- job: riscv64-debian-cross-container
|
||||
variables:
|
||||
IMAGE: debian-riscv64-cross
|
||||
|
||||
cross-riscv64-user:
|
||||
extends: .cross_user_build_job
|
||||
needs:
|
||||
- job: riscv64-debian-cross-container
|
||||
variables:
|
||||
IMAGE: debian-riscv64-cross
|
||||
|
||||
cross-riscv64-kvm-only:
|
||||
extends: .cross_accel_build_job
|
||||
needs:
|
||||
- job: riscv64-debian-cross-container
|
||||
variables:
|
||||
IMAGE: debian-riscv64-cross
|
||||
EXTRA_CONFIGURE_OPTS: --disable-tcg --without-default-features
|
||||
|
||||
cross-s390x-system:
|
||||
extends: .cross_system_build_job
|
||||
needs:
|
||||
- job: s390x-debian-cross-container
|
||||
variables:
|
||||
IMAGE: debian-s390x-cross
|
||||
|
||||
cross-s390x-user:
|
||||
extends: .cross_user_build_job
|
||||
needs:
|
||||
- job: s390x-debian-cross-container
|
||||
variables:
|
||||
IMAGE: debian-s390x-cross
|
||||
|
||||
cross-s390x-kvm-only:
|
||||
extends: .cross_accel_build_job
|
||||
needs:
|
||||
- job: s390x-debian-cross-container
|
||||
variables:
|
||||
IMAGE: debian-s390x-cross
|
||||
EXTRA_CONFIGURE_OPTS: --disable-tcg --enable-trace-backends=ftrace
|
||||
|
||||
cross-win64-system:
|
||||
extends: .cross_system_build_job
|
||||
needs:
|
||||
- job: win64-fedora-cross-container
|
||||
variables:
|
||||
IMAGE: fedora-win64-cross
|
||||
EXTRA_CONFIGURE_OPTS: --enable-fdt=internal --disable-plugins
|
||||
CROSS_SKIP_TARGETS: alpha-softmmu avr-softmmu hppa-softmmu
|
||||
m68k-softmmu microblaze-softmmu
|
||||
or1k-softmmu rx-softmmu sh4eb-softmmu sparc64-softmmu
|
||||
tricore-softmmu xtensaeb-softmmu
|
||||
artifacts:
|
||||
when: on_success
|
||||
paths:
|
||||
- build/qemu-setup*.exe
|
||||
|
||||
cross-amd64-xen-only:
|
||||
extends: .cross_accel_build_job
|
||||
needs:
|
||||
- job: amd64-debian-cross-container
|
||||
variables:
|
||||
IMAGE: debian-amd64-cross
|
||||
ACCEL: xen
|
||||
EXTRA_CONFIGURE_OPTS: --disable-tcg --disable-kvm
|
||||
|
||||
cross-arm64-xen-only:
|
||||
extends: .cross_accel_build_job
|
||||
needs:
|
||||
- job: arm64-debian-cross-container
|
||||
variables:
|
||||
IMAGE: debian-arm64-cross
|
||||
ACCEL: xen
|
||||
EXTRA_CONFIGURE_OPTS: --disable-tcg --disable-kvm
|
||||
@@ -0,0 +1,34 @@
|
||||
# The CI jobs defined here require GitLab runners installed and
|
||||
# registered on machines that match their operating system names,
|
||||
# versions and architectures. This is in contrast to the other CI
|
||||
# jobs that are intended to run on GitLab's "shared" runners.
|
||||
|
||||
# Different than the default approach on "shared" runners, based on
|
||||
# containers, the custom runners have no such *requirement*, as those
|
||||
# jobs should be capable of running on operating systems with no
|
||||
# compatible container implementation, or no support from
|
||||
# gitlab-runner. To avoid problems that gitlab-runner can cause while
|
||||
# reusing the GIT repository, let's enable the clone strategy, which
|
||||
# guarantees a fresh repository on each job run.
|
||||
|
||||
# All custom runners can extend this template to upload the testlog
|
||||
# data as an artifact and also feed the junit report
|
||||
.custom_runner_template:
|
||||
extends: .base_job_template
|
||||
variables:
|
||||
GIT_STRATEGY: clone
|
||||
GIT_FETCH_EXTRA_FLAGS: --no-tags --prune --quiet
|
||||
artifacts:
|
||||
name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
|
||||
expire_in: 7 days
|
||||
when: always
|
||||
paths:
|
||||
- build/build.ninja
|
||||
- build/meson-logs
|
||||
reports:
|
||||
junit: build/meson-logs/*.junit.xml
|
||||
|
||||
include:
|
||||
- local: '/.gitlab-ci.d/custom-runners/ubuntu-24.04-s390x.yml'
|
||||
- local: '/.gitlab-ci.d/custom-runners/ubuntu-24.04-aarch64.yml'
|
||||
- local: '/.gitlab-ci.d/custom-runners/debian-13-ppc64le.yml'
|
||||
@@ -0,0 +1,45 @@
|
||||
# All jobs should run successfully in an environment setup by the
|
||||
# scripts/ci/setup/build-environment.yml task:
|
||||
# "Install basic packages to build QEMU on Ubuntu/Debian"
|
||||
|
||||
.debian_ppc64le_template:
|
||||
extends: .custom_runner_template
|
||||
needs: []
|
||||
stage: build
|
||||
tags:
|
||||
- debian_13
|
||||
- ppc64le
|
||||
rules:
|
||||
- if: '$CI_PROJECT_NAMESPACE == $QEMU_CI_UPSTREAM && $CI_COMMIT_BRANCH =~ /^staging/'
|
||||
- if: '$QEMU_CI != "1" && $QEMU_CI != "2" && $CI_PROJECT_NAMESPACE != $QEMU_CI_UPSTREAM'
|
||||
when: never
|
||||
- if: '$PPC64LE_RUNNER_AVAILABLE && $CI_PIPELINE_SOURCE != "schedule" && $QEMU_CI == "1"'
|
||||
when: manual
|
||||
- if: '$PPC64LE_RUNNER_AVAILABLE && $CI_PIPELINE_SOURCE != "schedule"'
|
||||
before_script:
|
||||
- source scripts/ci/gitlab-ci-section
|
||||
- section_start setup "Pre-script setup"
|
||||
- JOBS=$(expr $(nproc) - 2)
|
||||
- section_end setup
|
||||
script:
|
||||
- mkdir build
|
||||
- cd build
|
||||
- section_start configure "Running configure"
|
||||
- ../configure $CONFIGURE_ARGS ||
|
||||
{ cat config.log meson-logs/meson-log.txt && exit 1; }
|
||||
- section_end configure
|
||||
- section_start build "Building QEMU"
|
||||
- make --output-sync -j"$JOBS"
|
||||
- section_end build
|
||||
- section_start test "Running tests"
|
||||
- if test -n "$MAKE_CHECK_ARGS";
|
||||
then
|
||||
make -j"$JOBS" $MAKE_CHECK_ARGS ;
|
||||
fi
|
||||
- section_end test
|
||||
|
||||
debian-13-ppc64le-default:
|
||||
extends: .debian_ppc64le_template
|
||||
variables:
|
||||
# qtest currently fails: https://gitlab.com/qemu-project/qemu/-/issues/3207
|
||||
MAKE_CHECK_ARGS: check-unit check-tcg check-softfloat
|
||||
@@ -0,0 +1,90 @@
|
||||
# All ubuntu-24.04 jobs should run successfully in an environment
|
||||
# setup by the scripts/ci/setup/ubuntu/build-environment.yml task
|
||||
# "Install basic packages to build QEMU on Ubuntu 24.04"
|
||||
|
||||
.ubuntu_aarch64_template:
|
||||
extends: .custom_runner_template
|
||||
needs: []
|
||||
stage: build
|
||||
tags:
|
||||
- ubuntu_24.04
|
||||
- aarch64
|
||||
rules:
|
||||
- if: '$CI_PROJECT_NAMESPACE == "qemu-project" && $CI_COMMIT_BRANCH =~ /^staging/'
|
||||
- if: '$QEMU_CI != "1" && $QEMU_CI != "2" && $CI_PROJECT_NAMESPACE != $QEMU_CI_UPSTREAM'
|
||||
when: never
|
||||
- if: '$AARCH64_RUNNER_AVAILABLE && $CI_PIPELINE_SOURCE != "schedule" && $QEMU_CI == "1"'
|
||||
when: manual
|
||||
- if: '$AARCH64_RUNNER_AVAILABLE && $CI_PIPELINE_SOURCE != "schedule"'
|
||||
before_script:
|
||||
- source scripts/ci/gitlab-ci-section
|
||||
- section_start setup "Pre-script setup"
|
||||
- JOBS=$(expr $(nproc) - 4)
|
||||
- section_end setup
|
||||
script:
|
||||
- mkdir build
|
||||
- cd build
|
||||
- section_start configure "Running configure"
|
||||
- ../configure $CONFIGURE_ARGS ||
|
||||
{ cat config.log meson-logs/meson-log.txt && exit 1; }
|
||||
- section_end configure
|
||||
- section_start build "Building QEMU"
|
||||
- make --output-sync -j"$JOBS"
|
||||
- section_end build
|
||||
- section_start test "Running tests"
|
||||
- if test -n "$MAKE_CHECK_ARGS";
|
||||
then
|
||||
make -j"$JOBS" $MAKE_CHECK_ARGS ;
|
||||
fi
|
||||
- section_end test
|
||||
|
||||
ubuntu-24.04-aarch64-all-linux-static:
|
||||
extends: .ubuntu_aarch64_template
|
||||
variables:
|
||||
CONFIGURE_ARGS: --enable-debug --static --disable-system
|
||||
MAKE_CHECK_ARGS: check-tcg
|
||||
|
||||
ubuntu-24.04-aarch64-all:
|
||||
extends: .ubuntu_aarch64_template
|
||||
variables:
|
||||
MAKE_CHECK_ARGS: check
|
||||
allow_failure: true
|
||||
when: manual
|
||||
|
||||
ubuntu-24.04-aarch64-without-defaults:
|
||||
extends: .ubuntu_aarch64_template
|
||||
variables:
|
||||
CONFIGURE_ARGS: --disable-user --without-default-devices --without-default-features
|
||||
MAKE_CHECK_ARGS: check
|
||||
allow_failure: true
|
||||
when: manual
|
||||
|
||||
ubuntu-24.04-aarch64-alldbg:
|
||||
extends: .ubuntu_aarch64_template
|
||||
variables:
|
||||
CONFIGURE_ARGS: --enable-debug
|
||||
MAKE_CHECK_ARGS: check-tcg
|
||||
|
||||
ubuntu-24.04-aarch64-clang:
|
||||
extends: .ubuntu_aarch64_template
|
||||
variables:
|
||||
CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-ubsan
|
||||
MAKE_CHECK_ARGS: check
|
||||
allow_failure: true
|
||||
when: manual
|
||||
|
||||
ubuntu-24.04-aarch64-tci:
|
||||
extends: .ubuntu_aarch64_template
|
||||
variables:
|
||||
CONFIGURE_ARGS: --enable-tcg-interpreter
|
||||
MAKE_CHECK_ARGS: check
|
||||
allow_failure: true
|
||||
when: manual
|
||||
|
||||
ubuntu-24.04-aarch64-notcg:
|
||||
extends: .ubuntu_aarch64_template
|
||||
variables:
|
||||
CONFIGURE_ARGS: --disable-tcg --with-devices-aarch64=minimal
|
||||
MAKE_CHECK_ARGS: check
|
||||
allow_failure: true
|
||||
when: manual
|
||||
@@ -0,0 +1,89 @@
|
||||
# All ubuntu-24.04 jobs should run successfully in an environment
|
||||
# setup by the scripts/ci/setup/ubuntu/build-environment.yml task
|
||||
# "Install basic packages to build QEMU on Ubuntu 24.04"
|
||||
|
||||
.ubuntu_s390x_template:
|
||||
extends: .custom_runner_template
|
||||
needs: []
|
||||
stage: build
|
||||
tags:
|
||||
- ubuntu_24.04
|
||||
- s390x
|
||||
rules:
|
||||
- if: '$CI_PROJECT_NAMESPACE == $QEMU_CI_UPSTREAM && $CI_COMMIT_BRANCH =~ /^staging/'
|
||||
- if: '$QEMU_CI != "1" && $QEMU_CI != "2" && $CI_PROJECT_NAMESPACE != $QEMU_CI_UPSTREAM'
|
||||
when: never
|
||||
- if: '$S390X_RUNNER_AVAILABLE && $CI_PIPELINE_SOURCE != "schedule" && $QEMU_CI == "1"'
|
||||
when: manual
|
||||
- if: '$S390X_RUNNER_AVAILABLE && $CI_PIPELINE_SOURCE != "schedule"'
|
||||
before_script:
|
||||
- source scripts/ci/gitlab-ci-section
|
||||
- section_start setup "Pre-script setup"
|
||||
- JOBS=$(expr $(nproc) - 1)
|
||||
- section_end setup
|
||||
script:
|
||||
- mkdir build
|
||||
- cd build
|
||||
- section_start configure "Running configure"
|
||||
- ../configure $CONFIGURE_ARGS ||
|
||||
{ cat config.log meson-logs/meson-log.txt; exit 1; }
|
||||
- section_end configure
|
||||
- section_start build "Building QEMU"
|
||||
- make --output-sync -j"$JOBS"
|
||||
- section_end build
|
||||
- section_start test "Running tests"
|
||||
- if test -n "$MAKE_CHECK_ARGS";
|
||||
then
|
||||
make -j"$JOBS" $MAKE_CHECK_ARGS ;
|
||||
fi
|
||||
- section_end test
|
||||
|
||||
ubuntu-24.04-s390x-all-linux:
|
||||
extends: .ubuntu_s390x_template
|
||||
needs: []
|
||||
variables:
|
||||
CONFIGURE_ARGS: --enable-debug --disable-system --disable-tools --disable-docs
|
||||
MAKE_CHECK_ARGS: check-tcg check
|
||||
|
||||
ubuntu-24.04-s390x-all-system:
|
||||
extends: .ubuntu_s390x_template
|
||||
needs: []
|
||||
variables:
|
||||
CONFIGURE_ARGS: --disable-user
|
||||
MAKE_CHECK_ARGS: check
|
||||
allow_failure: true
|
||||
|
||||
ubuntu-24.04-s390x-alldbg:
|
||||
extends: .ubuntu_s390x_template
|
||||
needs: []
|
||||
variables:
|
||||
CONFIGURE_ARGS: --enable-debug
|
||||
MAKE_CHECK_ARGS: check
|
||||
allow_failure: true
|
||||
when: manual
|
||||
|
||||
ubuntu-24.04-s390x-clang:
|
||||
extends: .ubuntu_s390x_template
|
||||
needs: []
|
||||
variables:
|
||||
CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-ubsan
|
||||
MAKE_CHECK_ARGS: check
|
||||
allow_failure: true
|
||||
when: manual
|
||||
|
||||
ubuntu-24.04-s390x-tci:
|
||||
extends: .ubuntu_s390x_template
|
||||
needs: []
|
||||
variables:
|
||||
CONFIGURE_ARGS: --enable-tcg-interpreter
|
||||
allow_failure: true
|
||||
when: manual
|
||||
|
||||
ubuntu-24.04-s390x-notcg:
|
||||
extends: .ubuntu_s390x_template
|
||||
needs: []
|
||||
variables:
|
||||
CONFIGURE_ARGS: --disable-tcg
|
||||
MAKE_CHECK_ARGS: check
|
||||
allow_failure: true
|
||||
when: manual
|
||||
@@ -0,0 +1,16 @@
|
||||
# THIS FILE WAS AUTO-GENERATED
|
||||
#
|
||||
# $ lcitool variables macos-14 qemu
|
||||
#
|
||||
# https://gitlab.com/libvirt/libvirt-ci
|
||||
|
||||
CCACHE='/opt/homebrew/bin/ccache'
|
||||
CPAN_PKGS=''
|
||||
CROSS_PKGS=''
|
||||
MAKE='/opt/homebrew/bin/gmake'
|
||||
NINJA='/opt/homebrew/bin/ninja'
|
||||
PACKAGING_COMMAND='brew'
|
||||
PIP3='/opt/homebrew/bin/pip3'
|
||||
PKGS='bash bc bindgen bison bzip2 capstone ccache cmocka coreutils ctags curl dbus diffutils dtc flex gcovr gettext git glib gnu-sed gnutls gtk+3 gtk-vnc jemalloc jpeg-turbo json-c libcbor libepoxy libffi libgcrypt libiscsi libnfs libpng libslirp libssh libtasn1 libusb llvm lzo make meson mtools ncurses nettle ninja pixman pkg-config python-setuptools python3 rpm2cpio rust sdl2 sdl2_image snappy socat sparse spice-protocol swtpm tesseract usbredir vde vte3 vulkan-tools xorriso zlib zstd'
|
||||
PYPI_PKGS='sphinx sphinx-rtd-theme tomli'
|
||||
PYTHON='/opt/homebrew/bin/python3'
|
||||
@@ -0,0 +1,66 @@
|
||||
.macos_job_template:
|
||||
extends: .base_meson_job_template
|
||||
stage: build
|
||||
tags:
|
||||
- saas-macos-large-m2pro
|
||||
needs: []
|
||||
timeout: 80m
|
||||
artifacts:
|
||||
name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
|
||||
expire_in: 7 days
|
||||
paths:
|
||||
- build/meson-logs/
|
||||
- build/tests/tcg/
|
||||
reports:
|
||||
junit: build/meson-logs/*.junit.xml
|
||||
when: always
|
||||
before_script:
|
||||
- set -o allexport
|
||||
- source .gitlab-ci.d/macos-14.vars
|
||||
- set +o allexport
|
||||
- export PATH="$PATH_EXTRA:$PATH"
|
||||
- export PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
|
||||
- brew update
|
||||
- brew install $PKGS
|
||||
- brew install arm-none-eabi-gcc aarch64-elf-gcc i686-elf-gcc x86_64-elf-gcc
|
||||
- if test -n "$PYPI_PKGS" ; then PYLIB=$($PYTHON -c 'import sysconfig; print(sysconfig.get_path("stdlib"))'); rm -f $PYLIB/EXTERNALLY-MANAGED; $PIP3 install --break-system-packages $PYPI_PKGS ; fi
|
||||
script:
|
||||
- mkdir build
|
||||
- cd build
|
||||
- ../configure --enable-werror $CONFIGURE_ARGS || { cat config.log meson-logs/meson-log.txt; exit 1; }
|
||||
- $MAKE -j$(sysctl -n hw.ncpu)
|
||||
- for TARGET in $TEST_TARGETS ; do $MAKE $TARGET ; done
|
||||
|
||||
aarch64-macos-15-build:
|
||||
extends: .macos_job_template
|
||||
image: macos-15-xcode-16
|
||||
variables:
|
||||
QEMU_JOB_MACOS: 1
|
||||
NAME: macos-15
|
||||
PATH_EXTRA: /opt/homebrew/gettext/bin
|
||||
PKG_CONFIG_PATH: /opt/homebrew/curl/lib/pkgconfig:/opt/homebrew/ncurses/lib/pkgconfig:/opt/homebrew/readline/lib/pkgconfig
|
||||
CONFIGURE_ARGS:
|
||||
--target-list=aarch64-softmmu,arm-softmmu,i386-softmmu,x86_64-softmmu
|
||||
--cross-prefix-aarch64=aarch64-elf-
|
||||
--cross-prefix-arm=arm-none-eabi-
|
||||
--cross-prefix-i386=i686-elf-
|
||||
--cross-prefix-x86_64=x86_64-elf-
|
||||
--disable-plugins
|
||||
TEST_TARGETS: check-unit check-tcg
|
||||
|
||||
aarch64-macos-26-build:
|
||||
extends: .macos_job_template
|
||||
image: macos-26-xcode-26
|
||||
variables:
|
||||
QEMU_JOB_MACOS: 1
|
||||
NAME: macos-26
|
||||
DYLD_LIBRARY_PATH: /opt/homebrew/opt/expat/lib/
|
||||
PATH_EXTRA: /opt/homebrew/gettext/bin
|
||||
PKG_CONFIG_PATH: /opt/homebrew/curl/lib/pkgconfig:/opt/homebrew/ncurses/lib/pkgconfig:/opt/homebrew/readline/lib/pkgconfig
|
||||
CONFIGURE_ARGS:
|
||||
--target-list=aarch64-softmmu,i386-softmmu,x86_64-softmmu
|
||||
--cross-prefix-aarch64=aarch64-elf-
|
||||
--cross-prefix-i386=i686-elf-
|
||||
--cross-prefix-x86_64=x86_64-elf-
|
||||
--disable-plugins
|
||||
TEST_TARGETS: check-unit check-tcg
|
||||
@@ -0,0 +1,20 @@
|
||||
# This file contains the set of jobs run by the QEMU project:
|
||||
# https://gitlab.com/qemu-project/qemu/-/pipelines
|
||||
|
||||
variables:
|
||||
RUNNER_TAG: ""
|
||||
|
||||
default:
|
||||
tags:
|
||||
- $RUNNER_TAG
|
||||
|
||||
include:
|
||||
- local: '/.gitlab-ci.d/base.yml'
|
||||
- local: '/.gitlab-ci.d/stages.yml'
|
||||
- local: '/.gitlab-ci.d/containers.yml'
|
||||
- local: '/.gitlab-ci.d/crossbuilds.yml'
|
||||
- local: '/.gitlab-ci.d/buildtest.yml'
|
||||
- local: '/.gitlab-ci.d/static_checks.yml'
|
||||
- local: '/.gitlab-ci.d/custom-runners.yml'
|
||||
- local: '/.gitlab-ci.d/windows.yml'
|
||||
- local: '/.gitlab-ci.d/macos.yml'
|
||||
@@ -0,0 +1,7 @@
|
||||
# Currently we have two build stages after our containers are built:
|
||||
# - build (for traditional build and test or first stage build)
|
||||
# - test (for test stages, using build artefacts from a build stage)
|
||||
stages:
|
||||
- containers
|
||||
- build
|
||||
- test
|
||||
@@ -0,0 +1,94 @@
|
||||
check-patch:
|
||||
extends: .base_job_template
|
||||
stage: build
|
||||
image: python:3.10-alpine
|
||||
needs: []
|
||||
script:
|
||||
- .gitlab-ci.d/check-patch.py
|
||||
variables:
|
||||
GIT_DEPTH: 1000
|
||||
QEMU_JOB_ONLY_FORKS: 1
|
||||
before_script:
|
||||
- apk -U add git perl
|
||||
allow_failure: true
|
||||
|
||||
check-dco:
|
||||
extends: .base_job_template
|
||||
stage: build
|
||||
image: python:3.10-alpine
|
||||
needs: []
|
||||
script: .gitlab-ci.d/check-dco.py
|
||||
variables:
|
||||
GIT_DEPTH: 1000
|
||||
before_script:
|
||||
- apk -U add git
|
||||
|
||||
check-python-minreqs:
|
||||
extends: .base_job_template
|
||||
stage: test
|
||||
image: $CI_REGISTRY_IMAGE/qemu/python:$QEMU_CI_CONTAINER_TAG
|
||||
script:
|
||||
- make -C python check-minreqs
|
||||
variables:
|
||||
GIT_DEPTH: 1
|
||||
needs:
|
||||
- job: python-container
|
||||
|
||||
check-python-tox:
|
||||
extends: .base_job_template
|
||||
stage: test
|
||||
image: $CI_REGISTRY_IMAGE/qemu/python:$QEMU_CI_CONTAINER_TAG
|
||||
script:
|
||||
- make -C python check-tox
|
||||
variables:
|
||||
GIT_DEPTH: 1
|
||||
QEMU_TOX_EXTRA_ARGS: --skip-missing-interpreters=false
|
||||
QEMU_JOB_OPTIONAL: 1
|
||||
needs:
|
||||
- job: python-container
|
||||
|
||||
check-rust-tools-nightly:
|
||||
extends: .base_job_template
|
||||
stage: test
|
||||
image: $CI_REGISTRY_IMAGE/qemu/fedora-rust-nightly:$QEMU_CI_CONTAINER_TAG
|
||||
script:
|
||||
- source scripts/ci/gitlab-ci-section
|
||||
- section_start test "Running Rust code checks"
|
||||
- cd build
|
||||
- pyvenv/bin/meson devenv -w ../ ${CARGO-cargo} fmt --check
|
||||
- make clippy
|
||||
- make rustdoc
|
||||
- section_end test
|
||||
variables:
|
||||
GIT_DEPTH: 1
|
||||
allow_failure: true
|
||||
needs:
|
||||
- job: build-system-fedora-rust-nightly
|
||||
artifacts: true
|
||||
artifacts:
|
||||
when: on_success
|
||||
expire_in: 2 days
|
||||
paths:
|
||||
- target/doc
|
||||
|
||||
check-build-units:
|
||||
extends: .base_job_template
|
||||
stage: build
|
||||
image: $CI_REGISTRY_IMAGE/qemu/debian:$QEMU_CI_CONTAINER_TAG
|
||||
needs:
|
||||
- job: amd64-debian-container
|
||||
before_script:
|
||||
- source scripts/ci/gitlab-ci-section
|
||||
- section_start setup "Install Tools"
|
||||
- apt install --assume-yes --no-install-recommends jq
|
||||
- section_end setup
|
||||
script:
|
||||
- mkdir build
|
||||
- cd build
|
||||
- section_start configure "Running configure"
|
||||
- ../configure
|
||||
- cd ..
|
||||
- section_end configure
|
||||
- section_start analyse "Analyse"
|
||||
- .gitlab-ci.d/check-units.py build/compile_commands.json
|
||||
- section_end analyse
|
||||
@@ -0,0 +1,117 @@
|
||||
msys2-64bit:
|
||||
extends: .base_job_template
|
||||
tags:
|
||||
- saas-windows-medium-amd64
|
||||
cache:
|
||||
key: "$CI_JOB_NAME"
|
||||
paths:
|
||||
- msys64/var/cache
|
||||
- ccache
|
||||
when: always
|
||||
needs: []
|
||||
stage: build
|
||||
timeout: 100m
|
||||
variables:
|
||||
# Select the "64 bit, gcc and MSVCRT" MSYS2 environment
|
||||
MSYSTEM: MINGW64
|
||||
# This feature doesn't (currently) work with PowerShell, it stops
|
||||
# the echo'ing of commands being run and doesn't show any timing
|
||||
FF_SCRIPT_SECTIONS: 0
|
||||
CONFIGURE_ARGS: --disable-system --enable-tools -Ddebug=false -Doptimization=0 --enable-rust
|
||||
# The Windows git is a bit older so override the default
|
||||
GIT_FETCH_EXTRA_FLAGS: --no-tags --prune --quiet
|
||||
artifacts:
|
||||
name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
|
||||
expire_in: 7 days
|
||||
paths:
|
||||
- build/meson-logs
|
||||
- build/cache-log.txt
|
||||
reports:
|
||||
junit: build/meson-logs/*.junit.xml
|
||||
before_script:
|
||||
- Write-Output "Acquiring msys2.exe installer at $(Get-Date -Format u)"
|
||||
- If ( !(Test-Path -Path msys64\var\cache ) ) {
|
||||
mkdir msys64\var\cache
|
||||
}
|
||||
- Invoke-WebRequest
|
||||
"https://repo.msys2.org/distrib/msys2-x86_64-latest.sfx.exe.sig"
|
||||
-outfile "msys2.exe.sig"
|
||||
- if ( Test-Path -Path msys64\var\cache\msys2.exe.sig ) {
|
||||
Write-Output "Cached installer sig" ;
|
||||
if ( ((Get-FileHash msys2.exe.sig).Hash -ne (Get-FileHash msys64\var\cache\msys2.exe.sig).Hash) ) {
|
||||
Write-Output "Mis-matched installer sig, new installer download required" ;
|
||||
Remove-Item -Path msys64\var\cache\msys2.exe.sig ;
|
||||
if ( Test-Path -Path msys64\var\cache\msys2.exe ) {
|
||||
Remove-Item -Path msys64\var\cache\msys2.exe
|
||||
}
|
||||
} else {
|
||||
Write-Output "Matched installer sig, cached installer still valid"
|
||||
}
|
||||
} else {
|
||||
Write-Output "No cached installer sig, new installer download required" ;
|
||||
if ( Test-Path -Path msys64\var\cache\msys2.exe ) {
|
||||
Remove-Item -Path msys64\var\cache\msys2.exe
|
||||
}
|
||||
}
|
||||
- if ( !(Test-Path -Path msys64\var\cache\msys2.exe ) ) {
|
||||
Write-Output "Fetching latest installer" ;
|
||||
Invoke-WebRequest
|
||||
"https://repo.msys2.org/distrib/msys2-x86_64-latest.sfx.exe"
|
||||
-outfile "msys64\var\cache\msys2.exe" ;
|
||||
Copy-Item -Path msys2.exe.sig -Destination msys64\var\cache\msys2.exe.sig
|
||||
} else {
|
||||
Write-Output "Using cached installer"
|
||||
}
|
||||
- Write-Output "Invoking msys2.exe installer at $(Get-Date -Format u)"
|
||||
- msys64\var\cache\msys2.exe -y
|
||||
- ((Get-Content -path .\msys64\etc\\post-install\\07-pacman-key.post -Raw)
|
||||
-replace '--refresh-keys', '--version') |
|
||||
Set-Content -Path ${CI_PROJECT_DIR}\msys64\etc\\post-install\\07-pacman-key.post
|
||||
- .\msys64\usr\bin\bash -lc "sed -i 's/^CheckSpace/#CheckSpace/g' /etc/pacman.conf"
|
||||
- .\msys64\usr\bin\bash -lc 'pacman --noconfirm -Syuu' # Core update
|
||||
- .\msys64\usr\bin\bash -lc 'pacman --noconfirm -Syuu' # Normal update
|
||||
- taskkill /F /FI "MODULES eq msys-2.0.dll"
|
||||
script:
|
||||
- Write-Output "Installing mingw packages at $(Get-Date -Format u)"
|
||||
- .\msys64\usr\bin\bash -lc "pacman -Sy --noconfirm --needed
|
||||
bison diffutils flex
|
||||
git grep make sed
|
||||
mingw-w64-x86_64-binutils
|
||||
mingw-w64-x86_64-ca-certificates
|
||||
mingw-w64-x86_64-ccache
|
||||
mingw-w64-x86_64-curl-winssl
|
||||
mingw-w64-x86_64-gcc
|
||||
mingw-w64-x86_64-glib2
|
||||
mingw-w64-x86_64-libnfs
|
||||
mingw-w64-x86_64-libssh
|
||||
mingw-w64-x86_64-ninja
|
||||
mingw-w64-x86_64-pixman
|
||||
mingw-w64-x86_64-pkgconf
|
||||
mingw-w64-x86_64-python
|
||||
mingw-w64-x86_64-python-certifi
|
||||
mingw-w64-x86_64-python-setuptools
|
||||
mingw-w64-x86_64-python-wheel
|
||||
mingw-w64-x86_64-rust
|
||||
mingw-w64-x86_64-rust-bindgen
|
||||
mingw-w64-x86_64-zstd"
|
||||
- .\msys64\usr\bin\bash -lc "pacman -Sc --noconfirm"
|
||||
- Write-Output "Running build at $(Get-Date -Format u)"
|
||||
- $env:JOBS = $(.\msys64\usr\bin\bash -lc nproc)
|
||||
- $env:CHERE_INVOKING = 'yes' # Preserve the current working directory
|
||||
- $env:MSYS = 'winsymlinks:native' # Enable native Windows symlink
|
||||
- $env:CCACHE_BASEDIR = "$env:CI_PROJECT_DIR"
|
||||
- $env:CCACHE_DIR = "$env:CCACHE_BASEDIR/ccache"
|
||||
- $env:CCACHE_MAXSIZE = "180M"
|
||||
- $env:CCACHE_DEPEND = 1 # cache misses are too expensive with preprocessor mode
|
||||
- $env:CC = "ccache gcc"
|
||||
- $env:LIBCLANG_PATH = Join-Path -Path $PWD.Path -ChildPath "msys64/mingw64/bin"
|
||||
- mkdir build
|
||||
- cd build
|
||||
- ..\msys64\usr\bin\bash -lc "ccache --zero-stats"
|
||||
- ..\msys64\usr\bin\bash -lc "../configure $CONFIGURE_ARGS"
|
||||
- ..\msys64\usr\bin\bash -lc "make -j$env:JOBS"
|
||||
- ..\msys64\usr\bin\bash -lc "make check MTESTARGS='$TEST_ARGS' || { cat meson-logs/testlog.txt; exit 1; } ;"
|
||||
- ..\msys64\usr\bin\bash -lc "ls -lR /var/cache > cache-log.txt"
|
||||
- ..\msys64\usr\bin\bash -lc "du -sh ."
|
||||
- ..\msys64\usr\bin\bash -lc "ccache --show-stats"
|
||||
- Write-Output "Finished build at $(Get-Date -Format u)"
|
||||
@@ -0,0 +1,24 @@
|
||||
#
|
||||
# This is the GitLab CI configuration file for the mainstream QEMU
|
||||
# project: https://gitlab.com/qemu-project/qemu/-/pipelines
|
||||
#
|
||||
# !!! DO NOT ADD ANY NEW CONFIGURATION TO THIS FILE !!!
|
||||
#
|
||||
# Only documentation or comments is accepted.
|
||||
#
|
||||
# To use a different set of jobs than the mainstream QEMU project,
|
||||
# you need to set the location of your custom yml file at "custom CI/CD
|
||||
# configuration path", on your GitLab CI namespace:
|
||||
# https://docs.gitlab.com/ee/ci/pipelines/settings.html#custom-cicd-configuration-path
|
||||
#
|
||||
# ----------------------------------------------------------------------
|
||||
#
|
||||
# QEMU CI jobs are based on templates. Some templates provide
|
||||
# user-configurable options, modifiable via configuration variables.
|
||||
#
|
||||
# See https://qemu-project.gitlab.io/qemu/devel/ci.html#custom-ci-cd-variables
|
||||
# for more information.
|
||||
#
|
||||
|
||||
include:
|
||||
- local: '/.gitlab-ci.d/qemu-project.yml'
|
||||
@@ -0,0 +1,93 @@
|
||||
# This file is auto-generated by scripts/gitlab-map-update
|
||||
#
|
||||
# This GitLab map associates GitLab account handles
|
||||
# with real names, in order to allow mapping from
|
||||
# MAINTAINERS entries. The format of entries is
|
||||
#
|
||||
# {gitlab-handle}<tab>{real name}
|
||||
#
|
||||
# Manual overrides must be placed in .gitlab-map-manual
|
||||
TaoTang Tao Tang
|
||||
a1xndr Alexander Bulekov
|
||||
adi-g15-ibm Aditya Gupta
|
||||
agraf Alexander Graf
|
||||
alex.williamson Alex Williamson
|
||||
aliang1 Aihua Liang
|
||||
alistair23 Alistair Francis
|
||||
anisinha Ani Sinha
|
||||
anthony-linaro Anthony Roberts
|
||||
anthonyper Anthony PERARD
|
||||
berrange Daniel P. Berrangé
|
||||
birkelund Klaus Jensen
|
||||
bonzini Paolo Bonzini
|
||||
brian-cain Brian Cain
|
||||
bsdimp Warner Losh
|
||||
cborntra Christian Borntraeger
|
||||
chao23.liu Chao Liu (Zevorn)
|
||||
cleber.gnu Cleber Rosa
|
||||
clegoate Cédric Le Goater
|
||||
cohuck Cornelia Huck
|
||||
cota_ Emilio Cota
|
||||
dagrh Dr. David Alan Gilbert
|
||||
danielhb Daniel Henrique Barboza
|
||||
davidhildenbrand David Hildenbrand
|
||||
dgibson dgibson
|
||||
dwmw2 David Woodhouse
|
||||
eauger1 Eric Auger
|
||||
ebblake Eric Blake
|
||||
edgar.iglesias Edgar E. Iglesias
|
||||
ehabkost Eduardo Habkost
|
||||
eldondev Eldon
|
||||
epilys Manos Pitsidianakis
|
||||
famzheng Fam Zheng
|
||||
farosas Fabiano Rosas
|
||||
gautammenghani Gautam Menghani
|
||||
gkurz Greg Kurz
|
||||
gusbromero Gustavo Romero
|
||||
harshpb Harsh Prateek Bora
|
||||
hdeller Helge Deller
|
||||
hreitz Hanna Czenczek
|
||||
imammedo Igor Mammedov
|
||||
jasowang Jason Wang
|
||||
jmacarthur Jim MacArthur
|
||||
jsnow John Snow
|
||||
juan.quintela Juan Quintela
|
||||
kbastian-qemu Bastian Koppelmann
|
||||
kmwolf Kevin Wolf
|
||||
kostyanf14 Kostiantyn Kostiuk
|
||||
kraxel Gerd Hoffmann
|
||||
lbmeng Bin Meng
|
||||
legoater Cédric Le Goater
|
||||
lvivier Laurent Vivier
|
||||
lygstate Yonggang Luo
|
||||
maciejsszmigiero Maciej S. Szmigiero
|
||||
marcandre.lureau Marc-André Lureau
|
||||
marcandre.lureau-rh Marc-André Lureau
|
||||
mauromatteo.cascella Mauro Matteo Cascella
|
||||
mcayland Mark Cave-Ayland
|
||||
mdroth Michael Roth
|
||||
mediouni-m M. Mediouni
|
||||
mjt0k Michael Tokarev
|
||||
mstredhat MST
|
||||
npiggin npiggin
|
||||
p-b-o Pierrick Bouvier
|
||||
pauldzim Paul Zimmerman
|
||||
peterx Peter Xu
|
||||
philmd Philippe Mathieu-Daudé
|
||||
pierrick.bouvier Pierrick Bouvier
|
||||
pipo.sk Peter Krempa
|
||||
pkrempa Peter Krempa (work)
|
||||
pm215 Peter Maydell
|
||||
qemu-janitor Qemu Janitor
|
||||
rathc Chinmay Rath
|
||||
rth7680 Richard Henderson
|
||||
schoenebeck Christian Schoenebeck
|
||||
sgarzarella Stefano Garzarella
|
||||
sstabellini Stefano Stabellini
|
||||
stefanberger Stefan Berger
|
||||
stefanha Stefan Hajnoczi
|
||||
stsquad Alex Bennée
|
||||
stweil Stefan Weil
|
||||
thuth Thomas Huth
|
||||
vsementsov Vladimir Sementsov-Ogievskiy
|
||||
xcancerberox Joaquin de Andres
|
||||
@@ -0,0 +1,18 @@
|
||||
# This GitLab map associates GitLab account handles
|
||||
# with real names, in order to allow mapping from
|
||||
# MAINTAINERS entries. The format of entries is
|
||||
#
|
||||
# {gitlab-handle}<tab>{real name}
|
||||
#
|
||||
# This file is manually written, to augment the
|
||||
# auto-generated data in .gitlab-map-auto. This
|
||||
# is needed where a GitLab account real name does
|
||||
# not exactly match the MAINTAINERS file real
|
||||
# name.
|
||||
#
|
||||
berrange Daniel P. Berrange
|
||||
dgibson David Gibson
|
||||
hreitz Hanna Reitz
|
||||
mstredhat Michael S. Tsirkin
|
||||
npiggin Nicholas Piggin
|
||||
mediouni-m Mohamed Mediouni
|
||||
@@ -0,0 +1,75 @@
|
||||
<!--
|
||||
This is the upstream QEMU issue tracker.
|
||||
|
||||
If you are able to, it will greatly facilitate bug triage if you attempt
|
||||
to reproduce the problem with the latest qemu.git master built from
|
||||
source. See https://www.qemu.org/download/#source for instructions on
|
||||
how to do this.
|
||||
|
||||
QEMU generally supports the last two releases advertised on
|
||||
https://www.qemu.org/. Problems with distro-packaged versions of QEMU
|
||||
older than this should be reported to the distribution instead.
|
||||
|
||||
See https://www.qemu.org/contribute/report-a-bug/ for additional
|
||||
guidance.
|
||||
|
||||
If this is a security issue, ensure this ticket is marked 'confidential'
|
||||
before submission. See https://www.qemu.org/contribute/security-process/
|
||||
for additional guidance
|
||||
-->
|
||||
|
||||
## Host environment
|
||||
- Operating system: <!-- Windows 10 21H1, Fedora 37, etc. -->
|
||||
- OS/kernel version: <!-- For POSIX hosts, use `uname -a` -->
|
||||
- Architecture: <!-- x86, ARM, s390x, etc. -->
|
||||
- QEMU flavor: <!-- qemu-system-x86_64, qemu-aarch64, qemu-img, etc. -->
|
||||
- QEMU version: <!-- e.g. `qemu-system-x86_64 --version` -->
|
||||
- QEMU command line:
|
||||
<!--
|
||||
Give the smallest, complete command line that exhibits the problem.
|
||||
|
||||
If you are using libvirt, virsh, or vmm, you can likely find the QEMU
|
||||
command line arguments in /var/log/libvirt/qemu/$GUEST.log.
|
||||
-->
|
||||
```
|
||||
./qemu-system-x86_64 -M q35 -m 4096 -enable-kvm -hda fedora32.qcow2
|
||||
```
|
||||
|
||||
## Emulated/Virtualized environment
|
||||
- Operating system: <!-- Windows 10 21H1, Fedora 37, etc. -->
|
||||
- OS/kernel version: <!-- For POSIX guests, use `uname -a`. -->
|
||||
- Architecture: <!-- x86, ARM, s390x, etc. -->
|
||||
|
||||
|
||||
## Description of problem
|
||||
<!-- Describe the problem, including any error/crash messages seen. -->
|
||||
|
||||
|
||||
## Steps to reproduce
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
|
||||
<!--
|
||||
Note: if this issue was discovered with the assistance of automated
|
||||
tooling LLM, static analysis, fuzzers), the reporter must disclose
|
||||
that in the description. The steps to reproduce, and any other findings,
|
||||
must be fully validated by the user of the tool prior to submission.
|
||||
-->
|
||||
|
||||
## Additional information
|
||||
|
||||
<!--
|
||||
Attach logs, stack traces, screenshots, etc. Compress the files if necessary.
|
||||
If using libvirt, libvirt logs and XML domain information may be relevant.
|
||||
|
||||
If attaching binary test cases you should describe where they were obtained
|
||||
from, preferably linking to the original source. We greatly prefer test cases in
|
||||
the form of source code that can be audited before compiling by the engineer.
|
||||
-->
|
||||
|
||||
<!--
|
||||
The line below ensures that proper tags are added to the issue.
|
||||
Please do not remove it.
|
||||
-->
|
||||
/label ~"kind::Bug"
|
||||
@@ -0,0 +1,32 @@
|
||||
<!--
|
||||
This is the upstream QEMU issue tracker.
|
||||
|
||||
Please note that QEMU, like most open source projects, relies on
|
||||
contributors who have motivation, skills and available time to work on
|
||||
implementing particular features.
|
||||
|
||||
Feature requests can be helpful for determining demand and interest, but
|
||||
they are not a guarantee that a contributor will volunteer to implement
|
||||
it. We welcome and encourage even draft patches to implement a feature
|
||||
be sent to the mailing list where it can be discussed and developed
|
||||
further by the community.
|
||||
|
||||
Thank you for your interest in helping us to make QEMU better!
|
||||
-->
|
||||
|
||||
## Goal
|
||||
<!-- Describe the final result you want to achieve. Avoid design specifics. -->
|
||||
|
||||
|
||||
## Technical details
|
||||
<!-- Describe technical details, design specifics, suggestions, versions, etc. -->
|
||||
|
||||
|
||||
## Additional information
|
||||
<!-- Patch or branch references, any other useful information -->
|
||||
|
||||
<!--
|
||||
The line below ensures that proper tags are added to the issue.
|
||||
Please do not remove it.
|
||||
-->
|
||||
/label ~"kind::Feature Request"
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
[submodule "roms/seabios"]
|
||||
path = roms/seabios
|
||||
url = https://gitlab.com/qemu-project/seabios.git/
|
||||
[submodule "roms/SLOF"]
|
||||
path = roms/SLOF
|
||||
url = https://gitlab.com/qemu-project/SLOF.git
|
||||
[submodule "roms/ipxe"]
|
||||
path = roms/ipxe
|
||||
url = https://gitlab.com/qemu-project/ipxe.git
|
||||
[submodule "roms/openbios"]
|
||||
path = roms/openbios
|
||||
url = https://gitlab.com/qemu-project/openbios.git
|
||||
[submodule "roms/qemu-palcode"]
|
||||
path = roms/qemu-palcode
|
||||
url = https://gitlab.com/qemu-project/qemu-palcode.git
|
||||
[submodule "roms/u-boot"]
|
||||
path = roms/u-boot
|
||||
# upstream is https://github.com/u-boot/u-boot
|
||||
url = https://gitlab.com/qemu-project/u-boot.git
|
||||
[submodule "roms/skiboot"]
|
||||
path = roms/skiboot
|
||||
url = https://gitlab.com/qemu-project/skiboot.git
|
||||
[submodule "roms/QemuMacDrivers"]
|
||||
path = roms/QemuMacDrivers
|
||||
url = https://gitlab.com/qemu-project/QemuMacDrivers.git
|
||||
[submodule "roms/seabios-hppa"]
|
||||
path = roms/seabios-hppa
|
||||
url = https://gitlab.com/qemu-project/seabios-hppa.git
|
||||
[submodule "roms/u-boot-sam460ex"]
|
||||
path = roms/u-boot-sam460ex
|
||||
# upstream is https://github.com/zbalaton/u-boot-sam460ex
|
||||
url = https://gitlab.com/qemu-project/u-boot-sam460ex.git
|
||||
[submodule "roms/edk2"]
|
||||
path = roms/edk2
|
||||
url = https://gitlab.com/qemu-project/edk2.git
|
||||
[submodule "roms/opensbi"]
|
||||
path = roms/opensbi
|
||||
url = https://gitlab.com/qemu-project/opensbi.git
|
||||
[submodule "roms/qboot"]
|
||||
path = roms/qboot
|
||||
url = https://gitlab.com/qemu-project/qboot.git
|
||||
[submodule "roms/vbootrom"]
|
||||
path = roms/vbootrom
|
||||
url = https://gitlab.com/qemu-project/vbootrom.git
|
||||
[submodule "tests/lcitool/libvirt-ci"]
|
||||
path = tests/lcitool/libvirt-ci
|
||||
url = https://gitlab.com/libvirt/libvirt-ci.git
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
#
|
||||
# Common git-publish profiles that can be used to send patches to QEMU upstream.
|
||||
#
|
||||
# See https://github.com/stefanha/git-publish for more information
|
||||
#
|
||||
[gitpublishprofile "default"]
|
||||
base = origin/master
|
||||
to = [email protected]
|
||||
cccmd = scripts/get_maintainer.pl --noroles --norolestats --nogit --nogit-fallback 2>/dev/null
|
||||
|
||||
[gitpublishprofile "rfc"]
|
||||
base = origin/master
|
||||
prefix = RFC PATCH
|
||||
to = [email protected]
|
||||
cccmd = scripts/get_maintainer.pl --noroles --norolestats --nogit --nogit-fallback 2>/dev/null
|
||||
|
||||
[gitpublishprofile "stable"]
|
||||
base = origin/master
|
||||
to = [email protected]
|
||||
cc = [email protected]
|
||||
cccmd = scripts/get_maintainer.pl --noroles --norolestats --nogit --nogit-fallback 2>/dev/null
|
||||
|
||||
[gitpublishprofile "trivial"]
|
||||
base = origin/master
|
||||
to = [email protected]
|
||||
cc = [email protected]
|
||||
cccmd = scripts/get_maintainer.pl --noroles --norolestats --nogit --nogit-fallback 2>/dev/null
|
||||
|
||||
[gitpublishprofile "block"]
|
||||
base = origin/master
|
||||
to = [email protected]
|
||||
cc = [email protected]
|
||||
cccmd = scripts/get_maintainer.pl --noroles --norolestats --nogit --nogit-fallback 2>/dev/null
|
||||
|
||||
[gitpublishprofile "arm"]
|
||||
base = origin/master
|
||||
to = [email protected]
|
||||
cc = [email protected]
|
||||
cccmd = scripts/get_maintainer.pl --noroles --norolestats --nogit --nogit-fallback 2>/dev/null
|
||||
|
||||
[gitpublishprofile "s390"]
|
||||
base = origin/master
|
||||
to = [email protected]
|
||||
cc = [email protected]
|
||||
cccmd = scripts/get_maintainer.pl --noroles --norolestats --nogit --nogit-fallback 2>/dev/null
|
||||
|
||||
[gitpublishprofile "ppc"]
|
||||
base = origin/master
|
||||
to = [email protected]
|
||||
cc = [email protected]
|
||||
cccmd = scripts/get_maintainer.pl --noroles --norolestats --nogit --nogit-fallback 2>/dev/null
|
||||
@@ -0,0 +1,249 @@
|
||||
# This mailmap fixes up author names/addresses.
|
||||
#
|
||||
# If you are adding to this file consider if a similar change needs to
|
||||
# be made to contrib/gitdm/aliases. They are not however completely
|
||||
# analogous. .mailmap is concerned with fixing up damaged author
|
||||
# fields where as the gitdm equivalent is more concerned with making
|
||||
# sure multiple email addresses get mapped onto the same author.
|
||||
#
|
||||
# From man git-shortlog the forms are:
|
||||
#
|
||||
# Proper Name <[email protected]>
|
||||
# <[email protected]> <[email protected]>
|
||||
# Proper Name <[email protected]> <[email protected]>
|
||||
# Proper Name <[email protected]> Commit Name <[email protected]>
|
||||
#
|
||||
|
||||
# The first section translates weird addresses from the original git import
|
||||
# into proper addresses so that they are counted properly by git shortlog.
|
||||
Andrzej Zaborowski <[email protected]> balrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>
|
||||
Anthony Liguori <[email protected]> aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>
|
||||
Aurelien Jarno <[email protected]> aurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>
|
||||
Blue Swirl <[email protected]> blueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>
|
||||
Edgar E. Iglesias <[email protected]> edgar_igl <edgar_igl@c046a42c-6fe2-441c-8c8c-71466251a162>
|
||||
Fabrice Bellard <[email protected]> bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>
|
||||
Jocelyn Mayer <[email protected]> j_mayer <j_mayer@c046a42c-6fe2-441c-8c8c-71466251a162>
|
||||
Paul Brook <[email protected]> pbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>
|
||||
Thiemo Seufer <[email protected]> ths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>
|
||||
malc <[email protected]> malc <malc@c046a42c-6fe2-441c-8c8c-71466251a162>
|
||||
|
||||
# Corrupted Author fields
|
||||
Aaron Larson <[email protected]> [email protected]
|
||||
Andreas Färber <[email protected]> Andreas Färber <andreas.faerber>
|
||||
fanwenjie <[email protected]> [email protected] <[email protected]>
|
||||
Jason Wang <[email protected]> Jason Wang <jasowang>
|
||||
Jason Wang <[email protected]> Jason Wang <[email protected]>
|
||||
Marek Dolata <[email protected]> [email protected] <[email protected]>
|
||||
Michael Ellerman <[email protected]> [email protected] <[email protected]>
|
||||
Nick Hudson <[email protected]> [email protected] <[email protected]>
|
||||
Ryan Zhang <[email protected]> Ryan Zhang <mailto>
|
||||
Timothée Cocault <[email protected]> [email protected] <[email protected]>
|
||||
Stefan Weil <[email protected]> <[email protected]>
|
||||
Stefan Weil <[email protected]> Stefan Weil <stefan@kiwi.(none)>
|
||||
Zhongyao Chen <[email protected]> [email protected] <[email protected]>
|
||||
|
||||
# There is also a:
|
||||
# (no author) <(no author)@c046a42c-6fe2-441c-8c8c-71466251a162>
|
||||
# for the cvs2svn initialization commit e63c3dc74bf.
|
||||
|
||||
# Next, translate a few commits where mailman rewrote the From: line due
|
||||
# to strict SPF and DMARC. Usually, our build process should be flagging
|
||||
# commits like these before maintainer merges; if you find the need to add
|
||||
# a line here, please also report a bug against the part of the build
|
||||
# process that let the mis-attribution slip through in the first place.
|
||||
#
|
||||
# If the mailing list munges your emails, use:
|
||||
# git config sendemail.from '"Your Name" <[email protected]>'
|
||||
# the use of "" in that line will differ from the typically unquoted
|
||||
# 'git config user.name', which in turn is sufficient for 'git send-email'
|
||||
# to add an extra From: line in the body of your email that takes
|
||||
# precedence over any munged From: in the mail's headers.
|
||||
# See https://lists.openembedded.org/g/openembedded-core/message/166515
|
||||
# and https://lists.gnu.org/archive/html/qemu-devel/2023-09/msg06784.html
|
||||
Ed Swierk <[email protected]> Ed Swierk via Qemu-devel <[email protected]>
|
||||
Ian McKellar <[email protected]> Ian McKellar via Qemu-devel <[email protected]>
|
||||
Julia Suvorova <[email protected]> Julia Suvorova via Qemu-devel <[email protected]>
|
||||
Justin Terry (VM) <[email protected]> Justin Terry (VM) via Qemu-devel <[email protected]>
|
||||
Stefan Weil <[email protected]> Stefan Weil via <[email protected]>
|
||||
Stefan Weil <[email protected]> Stefan Weil via <[email protected]>
|
||||
Andrey Drobyshev <[email protected]> Andrey Drobyshev via <[email protected]>
|
||||
BALATON Zoltan <[email protected]> BALATON Zoltan via <[email protected]>
|
||||
Denis V. Lunev <[email protected]> Denis V. Lunev via <[email protected]>
|
||||
|
||||
# Next, replace old addresses by a more recent one.
|
||||
Akihiko Odaki <[email protected]> <[email protected]>
|
||||
Akihiko Odaki <[email protected]> <[email protected]>
|
||||
Aleksandar Markovic <[email protected]> <[email protected]>
|
||||
Aleksandar Markovic <[email protected]> <[email protected]>
|
||||
Aleksandar Markovic <[email protected]> <[email protected]>
|
||||
Aleksandar Rikalo <[email protected]> <[email protected]>
|
||||
Aleksandar Rikalo <[email protected]> <[email protected]>
|
||||
Alex Williamson <[email protected]> <[email protected]>
|
||||
Alexander Graf <[email protected]> <[email protected]>
|
||||
Andrew Jones <[email protected]> <[email protected]>
|
||||
Andrew Jones <[email protected]> <[email protected]>
|
||||
Ani Sinha <[email protected]> <[email protected]>
|
||||
Anthony Liguori <[email protected]> Anthony Liguori <[email protected]>
|
||||
Brian Cain <[email protected]> <[email protected]>
|
||||
Brian Cain <[email protected]> <[email protected]>
|
||||
Christian Borntraeger <[email protected]> <[email protected]>
|
||||
Damien Hedde <[email protected]> <[email protected]>
|
||||
Daniel Henrique Barboza <[email protected]> <[email protected]>
|
||||
Daniel Henrique Barboza <[email protected]> <[email protected]>
|
||||
Daniel Henrique Barboza <[email protected]> <[email protected]>
|
||||
David Hildenbrand <[email protected]> <[email protected]>
|
||||
Filip Bozuta <[email protected]> <[email protected]>
|
||||
Frederic Konrad <[email protected]> <[email protected]>
|
||||
Frederic Konrad <[email protected]> <[email protected]>
|
||||
Greg Kurz <[email protected]> <[email protected]>
|
||||
Huacai Chen <[email protected]> <[email protected]>
|
||||
Huacai Chen <[email protected]> <[email protected]>
|
||||
James Hogan <[email protected]> <[email protected]>
|
||||
Juan Quintela <[email protected]> <[email protected]>
|
||||
Leif Lindholm <[email protected]> <[email protected]>
|
||||
Leif Lindholm <[email protected]> <[email protected]>
|
||||
Leif Lindholm <[email protected]> <[email protected]>
|
||||
Luc Michel <[email protected]> <[email protected]>
|
||||
Luc Michel <[email protected]> <[email protected]>
|
||||
Luc Michel <[email protected]> <[email protected]>
|
||||
Nina Schoetterl-Glausch <[email protected]> <[email protected]>
|
||||
Radoslaw Biernacki <[email protected]> <[email protected]>
|
||||
Paul Brook <[email protected]> <[email protected]>
|
||||
Paul Burton <[email protected]> <[email protected]>
|
||||
Paul Burton <[email protected]> <[email protected]>
|
||||
Paul Burton <[email protected]> <[email protected]>
|
||||
Paul Burton <[email protected]> <[email protected]>
|
||||
Philippe Mathieu-Daudé <[email protected]> <[email protected]>
|
||||
Philippe Mathieu-Daudé <[email protected]> <[email protected]>
|
||||
Philippe Mathieu-Daudé <[email protected]> <[email protected]>
|
||||
Philippe Mathieu-Daudé <[email protected]> <[email protected]>
|
||||
Pierrick Bouvier <[email protected]> <[email protected]>
|
||||
Roman Bolshakov <[email protected]> <[email protected]>
|
||||
Sriram Yagnaraman <[email protected]> <[email protected]>
|
||||
Stefan Brankovic <[email protected]> <[email protected]>
|
||||
Stefan Weil <[email protected]> Stefan Weil <[email protected]>
|
||||
Song Gao <[email protected]> <[email protected]>
|
||||
Taylor Simpson <[email protected]> <[email protected]>
|
||||
Yongbok Kim <[email protected]> <[email protected]>
|
||||
Alexander Mikhalitsyn <[email protected]> <[email protected]>
|
||||
|
||||
# Also list preferred name forms where people have changed their
|
||||
# git author config, or had utf8/latin1 encoding issues.
|
||||
Aaron Lindsay <[email protected]>
|
||||
Aaron Larson <[email protected]>
|
||||
Alexey Gerasimenko <[email protected]>
|
||||
Alex Chen <[email protected]>
|
||||
Alex Ivanov <[email protected]>
|
||||
Andreas Färber <[email protected]>
|
||||
Bandan Das <[email protected]>
|
||||
Benjamin MARSILI <[email protected]>
|
||||
Benoît Canet <[email protected]>
|
||||
Benoît Canet <[email protected]>
|
||||
Benoît Canet <[email protected]>
|
||||
Boqun Feng <[email protected]>
|
||||
Boqun Feng <[email protected]>
|
||||
Brad Smith <[email protected]>
|
||||
Brijesh Singh <[email protected]>
|
||||
Brilly Wu <[email protected]>
|
||||
Cédric Vincent <[email protected]>
|
||||
CheneyLin <[email protected]>
|
||||
Chen Gang <[email protected]>
|
||||
Chen Gang <[email protected]>
|
||||
Chen Gang <[email protected]>
|
||||
Chen Wei-Ren <[email protected]>
|
||||
Christophe Lyon <[email protected]>
|
||||
Clément Mathieu--Drif <[email protected]>
|
||||
Collin L. Walling <[email protected]>
|
||||
Daniel P. Berrangé <[email protected]>
|
||||
Eduardo Otubo <[email protected]>
|
||||
Erik Smit <[email protected]>
|
||||
Fabrice Desclaux <[email protected]>
|
||||
Fernando Luis Vázquez Cao <[email protected]>
|
||||
Fernando Luis Vázquez Cao <[email protected]>
|
||||
Gautham R. Shenoy <[email protected]>
|
||||
Gautham R. Shenoy <[email protected]>
|
||||
Gonglei (Arei) <[email protected]>
|
||||
Guang Wang <[email protected]>
|
||||
Haibin Zhang <[email protected]>
|
||||
Hailiang Zhang <[email protected]>
|
||||
Hanna Reitz <[email protected]> <[email protected]>
|
||||
Hervé Poussineau <[email protected]>
|
||||
Hyman Huang <[email protected]>
|
||||
Jakub Jermář <[email protected]>
|
||||
Jakub Jermář <[email protected]>
|
||||
Jean-Christophe Dubois <[email protected]>
|
||||
Jindřich Makovička <[email protected]>
|
||||
John Arbuckle <[email protected]>
|
||||
Juha Riihimäki <[email protected]>
|
||||
Juha Riihimäki <[email protected]>
|
||||
Jun Li <[email protected]>
|
||||
Laurent Vivier <[email protected]>
|
||||
Leandro Lupori <[email protected]>
|
||||
Li Guang <[email protected]>
|
||||
Liming Wang <[email protected]>
|
||||
linzhecheng <[email protected]>
|
||||
Liran Schour <[email protected]>
|
||||
Liu Yu <[email protected]>
|
||||
Liu Yu <[email protected]>
|
||||
Li Zhang <[email protected]>
|
||||
Li Zhang <[email protected]>
|
||||
Lluís Vilanova <[email protected]>
|
||||
Lluís Vilanova <[email protected]>
|
||||
Longpeng (Mike) <[email protected]>
|
||||
Luc Michel <[email protected]>
|
||||
Luc Michel <[email protected]>
|
||||
Marc Marí <[email protected]>
|
||||
Marc Marí <[email protected]>
|
||||
Michael Avdienko <[email protected]>
|
||||
Michael S. Tsirkin <[email protected]>
|
||||
Munkyu Im <[email protected]>
|
||||
Nicholas Bellinger <[email protected]>
|
||||
Nicholas Thomas <[email protected]>
|
||||
Nikunj A Dadhania <[email protected]>
|
||||
Orit Wasserman <[email protected]>
|
||||
Paolo Bonzini <[email protected]>
|
||||
Pan Nengyuan <[email protected]>
|
||||
Pavel Dovgaluk <[email protected]>
|
||||
Pavel Dovgaluk <[email protected]>
|
||||
Pavel Dovgaluk <[email protected]>
|
||||
Peter Chubb <[email protected]>
|
||||
Peter Crosthwaite <[email protected]>
|
||||
Peter Crosthwaite <[email protected]>
|
||||
Peter Crosthwaite <[email protected]>
|
||||
Prasad J Pandit <[email protected]>
|
||||
Prasad J Pandit <[email protected]>
|
||||
Qiao Nuohan <[email protected]>
|
||||
Reimar Döffinger <[email protected]>
|
||||
Remy Noel <[email protected]>
|
||||
Roger Pau Monné <[email protected]>
|
||||
Shin'ichiro Kawasaki <[email protected]>
|
||||
Shin'ichiro Kawasaki <[email protected]>
|
||||
Sochin Jiang <[email protected]>
|
||||
Stefan Berger <[email protected]> <[email protected]>
|
||||
Takashi Yoshii <[email protected]>
|
||||
Thomas Huth <[email protected]>
|
||||
Thomas Knych <[email protected]>
|
||||
Timothy Baldwin <[email protected]>
|
||||
Tony Nguyen <[email protected]>
|
||||
Venkateswararao Jujjuri <[email protected]>
|
||||
Vibi Sreenivasan <[email protected]>
|
||||
Vijaya Kumar K <[email protected]>
|
||||
Vijaya Kumar K <[email protected]>
|
||||
Vijay Kumar <[email protected]>
|
||||
Vijay Kumar <[email protected]>
|
||||
Wang Guang <[email protected]>
|
||||
Wenchao Xia <[email protected]>
|
||||
Wenshuang Ma <[email protected]>
|
||||
Xiaoqiang Zhao <[email protected]>
|
||||
Xinhua Cao <[email protected]>
|
||||
Xiong Zhang <[email protected]>
|
||||
Yin Yin <[email protected]>
|
||||
Yu-Chen Lin <[email protected]>
|
||||
Yu-Chen Lin <[email protected]> <[email protected]>
|
||||
YunQiang Su <[email protected]>
|
||||
YunQiang Su <[email protected]>
|
||||
Yuri Pudgorodskiy <[email protected]>
|
||||
Zhengui Li <[email protected]>
|
||||
Zhenwei Pi <[email protected]>
|
||||
Zhenwei Pi <[email protected]>
|
||||
Zhuang Yanying <[email protected]>
|
||||
+299
@@ -0,0 +1,299 @@
|
||||
---
|
||||
# Note: this file is still unused. It serves as a documentation for the
|
||||
# Patchew configuration in case patchew.org disappears or has to be
|
||||
# reinstalled.
|
||||
#
|
||||
# Patchew configuration is available to project administrators at
|
||||
# https://patchew.org/api/v1/projects/1/config/ and can be configured
|
||||
# to YAML using the following Python script:
|
||||
#
|
||||
# import json
|
||||
# import sys
|
||||
# import ruamel.yaml
|
||||
#
|
||||
# json_str = sys.stdin.read()
|
||||
# yaml = ruamel.yaml.YAML()
|
||||
# yaml.explicit_start = True
|
||||
# data = json.loads(json_str, object_pairs_hook=ruamel.yaml.comments.CommentedMap)
|
||||
# ruamel.yaml.scalarstring.walk_tree(data)
|
||||
# yaml.dump(data, sys.stdout)
|
||||
|
||||
email:
|
||||
notifications:
|
||||
timeouts:
|
||||
event: TestingReport
|
||||
enabled: true
|
||||
to_user: false
|
||||
reply_subject: true
|
||||
set_reply_to: true
|
||||
in_reply_to: true
|
||||
reply_to_all: false
|
||||
subject_template: none
|
||||
to: [email protected]
|
||||
cc: ''
|
||||
body_template: |
|
||||
{% if not is_timeout %} {{ cancel }} {% endif %}
|
||||
|
||||
Test '{{ test }}' timeout, log:
|
||||
|
||||
{{ log }}
|
||||
ENOSPC:
|
||||
event: TestingReport
|
||||
enabled: true
|
||||
to_user: false
|
||||
reply_subject: false
|
||||
set_reply_to: false
|
||||
in_reply_to: true
|
||||
reply_to_all: false
|
||||
subject_template: Out of space error
|
||||
to: [email protected]
|
||||
cc: ''
|
||||
body_template: |
|
||||
{% if passed %}
|
||||
{{ cancel }}
|
||||
{% endif %}
|
||||
|
||||
{% if 'No space left on device' in log %}
|
||||
Tester {{ tester }} out of space when running {{ test }}
|
||||
|
||||
{{ log }}
|
||||
{% else %}
|
||||
{{ cancel }}
|
||||
{% endif %}
|
||||
FailureShort:
|
||||
event: TestingReport
|
||||
enabled: true
|
||||
to_user: false
|
||||
reply_subject: true
|
||||
set_reply_to: true
|
||||
in_reply_to: true
|
||||
reply_to_all: true
|
||||
subject_template: Testing failed
|
||||
to: ''
|
||||
cc: ''
|
||||
body_template: |
|
||||
{% if passed or not obj.message_id or is_timeout %}
|
||||
{{ cancel }}
|
||||
{% endif %}
|
||||
{% if 'No space left on device' in log %}
|
||||
{{ cancel }}
|
||||
{% endif %}
|
||||
Patchew URL: https://patchew.org/QEMU/{{ obj.message_id }}/
|
||||
|
||||
{% ansi2text log as logtext %}
|
||||
{% if test == "checkpatch" %}
|
||||
Hi,
|
||||
|
||||
This series seems to have some coding style problems. See output below for
|
||||
more information:
|
||||
|
||||
{{ logtext }}
|
||||
{% elif test == "docker-mingw@fedora" or test == "docker-quick@centos8" or test == "asan" %}
|
||||
Hi,
|
||||
|
||||
This series failed the {{ test }} build test. Please find the testing commands and
|
||||
their output below. If you have Docker installed, you can probably reproduce it
|
||||
locally.
|
||||
|
||||
{% lines_between logtext start="^=== TEST SCRIPT BEGIN ===$" stop="^=== TEST SCRIPT END ===$" %}
|
||||
{% lines_between logtext start="^=== OUTPUT BEGIN ===$" stop="=== OUTPUT END ===$" as output %}
|
||||
{% grep_C output regex="\b(FAIL|XPASS|ERROR|WARN|error:|warning:)" n=3 %}
|
||||
{% elif test == "s390x" or test == "FreeBSD" or test == "ppcle" or test == "ppcbe" %}
|
||||
Hi,
|
||||
|
||||
This series failed build test on {{test}} host. Please find the details below.
|
||||
|
||||
{% lines_between logtext start="^=== TEST SCRIPT BEGIN ===$" stop="^=== TEST SCRIPT END ===$" %}
|
||||
{% lines_between logtext start="^=== OUTPUT BEGIN ===$" stop="=== OUTPUT END ===$" as output %}
|
||||
{% grep_C output regex="\b(FAIL|XPASS|ERROR|WARN|error:|warning:)" n=3 %}
|
||||
{% else %}
|
||||
{{ cancel }}
|
||||
{% endif %}
|
||||
|
||||
The full log is available at
|
||||
{{ log_url }}.
|
||||
---
|
||||
Email generated automatically by Patchew [https://patchew.org/].
|
||||
Please send your feedback to [email protected]
|
||||
testing:
|
||||
tests:
|
||||
asan:
|
||||
enabled: true
|
||||
requirements: docker
|
||||
timeout: 3600
|
||||
script: |
|
||||
#!/bin/bash
|
||||
time make docker-test-debug@fedora TARGET_LIST=x86_64-softmmu J=14 NETWORK=1
|
||||
docker-quick@centos8:
|
||||
enabled: false
|
||||
requirements: docker,x86_64
|
||||
timeout: 3600
|
||||
script: |
|
||||
#!/bin/bash
|
||||
time make docker-test-quick@centos8 SHOW_ENV=1 J=14 NETWORK=1
|
||||
checkpatch:
|
||||
enabled: true
|
||||
requirements: ''
|
||||
timeout: 600
|
||||
script: |
|
||||
#!/bin/bash
|
||||
git rev-parse base > /dev/null || exit 0
|
||||
./scripts/checkpatch.pl --mailback base..
|
||||
docker-mingw@fedora:
|
||||
enabled: true
|
||||
requirements: docker,x86_64
|
||||
timeout: 3600
|
||||
script: |
|
||||
#! /bin/bash
|
||||
test "$(uname -m)" = "x86_64"
|
||||
ppcle:
|
||||
enabled: false
|
||||
requirements: ppcle
|
||||
timeout: 3600
|
||||
script: |
|
||||
#!/bin/bash
|
||||
# Testing script will be invoked under the git checkout with
|
||||
# HEAD pointing to a commit that has the patches applied on top of "base"
|
||||
# branch
|
||||
set -e
|
||||
CC=$HOME/bin/cc
|
||||
INSTALL=$PWD/install
|
||||
BUILD=$PWD/build
|
||||
mkdir -p $BUILD $INSTALL
|
||||
SRC=$PWD
|
||||
cd $BUILD
|
||||
$SRC/configure --cc=$CC --prefix=$INSTALL
|
||||
make -j4
|
||||
# XXX: we need reliable clean up
|
||||
# make check -j4 V=1
|
||||
make install
|
||||
|
||||
echo
|
||||
echo "=== ENV ==="
|
||||
env
|
||||
|
||||
echo
|
||||
echo "=== PACKAGES ==="
|
||||
rpm -qa
|
||||
ppcbe:
|
||||
enabled: false
|
||||
requirements: ppcbe
|
||||
timeout: 3600
|
||||
script: |
|
||||
#!/bin/bash
|
||||
# Testing script will be invoked under the git checkout with
|
||||
# HEAD pointing to a commit that has the patches applied on top of "base"
|
||||
# branch
|
||||
set -e
|
||||
CC=$HOME/bin/cc
|
||||
INSTALL=$PWD/install
|
||||
BUILD=$PWD/build
|
||||
mkdir -p $BUILD $INSTALL
|
||||
SRC=$PWD
|
||||
cd $BUILD
|
||||
$SRC/configure --cc=$CC --prefix=$INSTALL
|
||||
make -j4
|
||||
# XXX: we need reliable clean up
|
||||
# make check -j4 V=1
|
||||
make install
|
||||
|
||||
echo
|
||||
echo "=== ENV ==="
|
||||
env
|
||||
|
||||
echo
|
||||
echo "=== PACKAGES ==="
|
||||
rpm -qa
|
||||
FreeBSD:
|
||||
enabled: true
|
||||
requirements: qemu-x86,x86_64,git
|
||||
timeout: 3600
|
||||
script: |
|
||||
#!/bin/bash
|
||||
# Testing script will be invoked under the git checkout with
|
||||
# HEAD pointing to a commit that has the patches applied on top of "base"
|
||||
# branch
|
||||
if qemu-system-x86_64 --help >/dev/null 2>&1; then
|
||||
QEMU=qemu-system-x86_64
|
||||
elif /usr/libexec/qemu-kvm --help >/dev/null 2>&1; then
|
||||
QEMU=/usr/libexec/qemu-kvm
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
make vm-build-freebsd J=21 QEMU=$QEMU
|
||||
exit 0
|
||||
docker-clang@ubuntu:
|
||||
enabled: true
|
||||
requirements: docker,x86_64
|
||||
timeout: 3600
|
||||
script: |
|
||||
#!/bin/bash
|
||||
time make docker-test-clang@ubuntu SHOW_ENV=1 J=14 NETWORK=1
|
||||
s390x:
|
||||
enabled: true
|
||||
requirements: s390x
|
||||
timeout: 3600
|
||||
script: |
|
||||
#!/bin/bash
|
||||
# Testing script will be invoked under the git checkout with
|
||||
# HEAD pointing to a commit that has the patches applied on top of "base"
|
||||
# branch
|
||||
set -e
|
||||
CC=$HOME/bin/cc
|
||||
INSTALL=$PWD/install
|
||||
BUILD=$PWD/build
|
||||
mkdir -p $BUILD $INSTALL
|
||||
SRC=$PWD
|
||||
cd $BUILD
|
||||
$SRC/configure --cc=$CC --prefix=$INSTALL
|
||||
make -j4
|
||||
# XXX: we need reliable clean up
|
||||
# make check -j4 V=1
|
||||
make install
|
||||
|
||||
echo
|
||||
echo "=== ENV ==="
|
||||
env
|
||||
|
||||
echo
|
||||
echo "=== PACKAGES ==="
|
||||
rpm -qa
|
||||
requirements:
|
||||
x86_64:
|
||||
script: |
|
||||
#! /bin/bash
|
||||
test "$(uname -m)" = "x86_64"
|
||||
qemu-x86:
|
||||
script: |
|
||||
#!/bin/bash
|
||||
if qemu-system-x86_64 --help >/dev/null 2>&1; then
|
||||
:
|
||||
elif /usr/libexec/qemu-kvm --help >/dev/null 2>&1; then
|
||||
:
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
ppcle:
|
||||
script: |
|
||||
#!/bin/bash
|
||||
test "$(uname -m)" = "ppc64le"
|
||||
ppcbe:
|
||||
script: |
|
||||
#!/bin/bash
|
||||
test "$(uname -m)" = "ppc64"
|
||||
git:
|
||||
script: |
|
||||
#! /bin/bash
|
||||
git config user.name > /dev/null 2>&1
|
||||
docker:
|
||||
script: |
|
||||
#!/bin/bash
|
||||
docker ps || sudo -n docker ps
|
||||
s390x:
|
||||
script: |
|
||||
#!/bin/bash
|
||||
test "$(uname -m)" = "s390x"
|
||||
git:
|
||||
push_to: [email protected]:patchew-project/qemu
|
||||
public_repo: https://github.com/patchew-project/qemu
|
||||
url_template: https://github.com/patchew-project/qemu/tree/%t
|
||||
@@ -0,0 +1,23 @@
|
||||
# .readthedocs.yml
|
||||
# Read the Docs configuration file
|
||||
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
|
||||
|
||||
# Required
|
||||
version: 2
|
||||
|
||||
# Set the version of Python and other tools you might need
|
||||
build:
|
||||
os: ubuntu-22.04
|
||||
tools:
|
||||
python: "3.11"
|
||||
|
||||
# Build documentation in the docs/ directory with Sphinx
|
||||
sphinx:
|
||||
configuration: docs/conf.py
|
||||
|
||||
# We recommend specifying your dependencies to enable reproducible builds:
|
||||
# https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
|
||||
python:
|
||||
install:
|
||||
- requirements: docs/requirements.txt
|
||||
|
||||
+240
@@ -0,0 +1,240 @@
|
||||
os: linux
|
||||
dist: jammy
|
||||
language: c
|
||||
compiler:
|
||||
- gcc
|
||||
cache:
|
||||
# There is one cache per branch and compiler version.
|
||||
# characteristics of each job are used to identify the cache:
|
||||
# - OS name (currently only linux)
|
||||
# - OS distribution (e.g. "jammy" for Linux)
|
||||
# - Names and values of visible environment variables set in .travis.yml or Settings panel
|
||||
timeout: 1200
|
||||
ccache: true
|
||||
pip: true
|
||||
|
||||
|
||||
# The channel name "irc.oftc.net#qemu" is encrypted against qemu/qemu
|
||||
# to prevent IRC notifications from forks. This was created using:
|
||||
# $ travis encrypt -r "qemu/qemu" "irc.oftc.net#qemu"
|
||||
notifications:
|
||||
irc:
|
||||
channels:
|
||||
- secure: "F7GDRgjuOo5IUyRLqSkmDL7kvdU4UcH3Lm/W2db2JnDHTGCqgEdaYEYKciyCLZ57vOTsTsOgesN8iUT7hNHBd1KWKjZe9KDTZWppWRYVwAwQMzVeSOsbbU4tRoJ6Pp+3qhH1Z0eGYR9ZgKYAoTumDFgSAYRp4IscKS8jkoedOqM="
|
||||
on_success: change
|
||||
on_failure: always
|
||||
|
||||
|
||||
env:
|
||||
global:
|
||||
- SRC_DIR=".."
|
||||
- BUILD_DIR="build"
|
||||
- BASE_CONFIG="--disable-docs --disable-tools"
|
||||
- TEST_BUILD_CMD=""
|
||||
- TEST_CMD="make check V=1"
|
||||
# This is broadly a list of "mainline" system targets which have support across the major distros
|
||||
- MAIN_SYSTEM_TARGETS="aarch64-softmmu,mips64-softmmu,ppc64-softmmu,riscv64-softmmu,s390x-softmmu,x86_64-softmmu"
|
||||
- CCACHE_SLOPPINESS="include_file_ctime,include_file_mtime"
|
||||
- CCACHE_MAXSIZE=1G
|
||||
- G_MESSAGES_DEBUG=error
|
||||
|
||||
|
||||
git:
|
||||
# we want to do this ourselves
|
||||
submodules: false
|
||||
|
||||
# Common first phase for all steps
|
||||
# We no longer use nproc to calculate jobs:
|
||||
# https://travis-ci.community/t/nproc-reports-32-cores-on-arm64/5851
|
||||
before_install:
|
||||
- if command -v ccache ; then ccache --zero-stats ; fi
|
||||
- export JOBS=3
|
||||
- echo "=== Using ${JOBS} simultaneous jobs ==="
|
||||
|
||||
# Configure step - may be overridden
|
||||
before_script:
|
||||
- mkdir -p ${BUILD_DIR} && cd ${BUILD_DIR}
|
||||
- ${SRC_DIR}/configure ${BASE_CONFIG} ${CONFIG} || { cat config.log meson-logs/meson-log.txt && exit 1; }
|
||||
|
||||
# Main build & test - rarely overridden - controlled by TEST_CMD
|
||||
script:
|
||||
- BUILD_RC=0 && make -j${JOBS} || BUILD_RC=$?
|
||||
- |
|
||||
if [ "$BUILD_RC" -eq 0 ] && [ -n "$TEST_BUILD_CMD" ]; then
|
||||
${TEST_BUILD_CMD} || BUILD_RC=$?
|
||||
else
|
||||
$(exit $BUILD_RC);
|
||||
fi
|
||||
- |
|
||||
if [ "$BUILD_RC" -eq 0 ] ; then
|
||||
${TEST_CMD} ;
|
||||
else
|
||||
$(exit $BUILD_RC);
|
||||
fi
|
||||
after_script:
|
||||
- df -h
|
||||
- if command -v ccache ; then ccache --show-stats ; fi
|
||||
|
||||
|
||||
jobs:
|
||||
include:
|
||||
|
||||
- name: "[ppc64] Clang check-tcg"
|
||||
arch: ppc64le
|
||||
compiler: clang
|
||||
addons:
|
||||
apt_packages:
|
||||
- libaio-dev
|
||||
- libattr1-dev
|
||||
- libbrlapi-dev
|
||||
- libcacard-dev
|
||||
- libcap-ng-dev
|
||||
- libfdt-dev
|
||||
- libgcrypt20-dev
|
||||
- libgnutls28-dev
|
||||
- libgtk-3-dev
|
||||
- libiscsi-dev
|
||||
- liblttng-ust-dev
|
||||
- libncurses5-dev
|
||||
- libnfs-dev
|
||||
- libpixman-1-dev
|
||||
- libpng-dev
|
||||
- librados-dev
|
||||
- libsdl2-dev
|
||||
- libseccomp-dev
|
||||
- liburcu-dev
|
||||
- libusb-1.0-0-dev
|
||||
- libvdeplug-dev
|
||||
- libvte-2.91-dev
|
||||
- ninja-build
|
||||
- python3-tomli
|
||||
# Tests dependencies
|
||||
- genisoimage
|
||||
env:
|
||||
- TEST_CMD="make check check-tcg V=1"
|
||||
- CONFIG="--disable-containers --enable-fdt=system
|
||||
--target-list=ppc64-softmmu,ppc64le-linux-user"
|
||||
|
||||
- name: "[s390x] GCC check-tcg"
|
||||
arch: s390x
|
||||
addons:
|
||||
apt_packages:
|
||||
- libaio-dev
|
||||
- libattr1-dev
|
||||
- libbrlapi-dev
|
||||
- libcacard-dev
|
||||
- libcap-ng-dev
|
||||
- libfdt-dev
|
||||
- libgcrypt20-dev
|
||||
- libgnutls28-dev
|
||||
- libgtk-3-dev
|
||||
- libiscsi-dev
|
||||
- liblttng-ust-dev
|
||||
- libncurses5-dev
|
||||
- libnfs-dev
|
||||
- libpixman-1-dev
|
||||
- libpng-dev
|
||||
- librados-dev
|
||||
- libsdl2-dev
|
||||
- libseccomp-dev
|
||||
- liburcu-dev
|
||||
- libusb-1.0-0-dev
|
||||
- libvdeplug-dev
|
||||
- libvte-2.91-dev
|
||||
- ninja-build
|
||||
- python3-tomli
|
||||
# Tests dependencies
|
||||
- genisoimage
|
||||
env:
|
||||
- TEST_CMD="make check check-tcg V=1"
|
||||
- CONFIG="--disable-containers
|
||||
--target-list=hppa-softmmu,mips64-softmmu,ppc64-softmmu,riscv64-softmmu,s390x-softmmu,x86_64-softmmu"
|
||||
script:
|
||||
- BUILD_RC=0 && make -j${JOBS} || BUILD_RC=$?
|
||||
- |
|
||||
if [ "$BUILD_RC" -eq 0 ] ; then
|
||||
mv pc-bios/s390-ccw/*.img qemu-bundle/usr/local/share/qemu ;
|
||||
${TEST_CMD} ;
|
||||
else
|
||||
$(exit $BUILD_RC);
|
||||
fi
|
||||
|
||||
- name: "[s390x] Clang (other-system)"
|
||||
arch: s390x
|
||||
compiler: clang
|
||||
addons:
|
||||
apt_packages:
|
||||
- libaio-dev
|
||||
- libattr1-dev
|
||||
- libcacard-dev
|
||||
- libcap-ng-dev
|
||||
- libfdt-dev
|
||||
- libgnutls28-dev
|
||||
- libiscsi-dev
|
||||
- liblttng-ust-dev
|
||||
- liblzo2-dev
|
||||
- libncurses-dev
|
||||
- libnfs-dev
|
||||
- libpixman-1-dev
|
||||
- libsdl2-dev
|
||||
- libsdl2-image-dev
|
||||
- libseccomp-dev
|
||||
- libsnappy-dev
|
||||
- libzstd-dev
|
||||
- nettle-dev
|
||||
- ninja-build
|
||||
- python3-tomli
|
||||
# Tests dependencies
|
||||
- genisoimage
|
||||
env:
|
||||
- CONFIG="--disable-containers --audio-drv-list=sdl --disable-user
|
||||
--target-list=arm-softmmu,avr-softmmu,microblaze-softmmu,sh4eb-softmmu,sparc64-softmmu,xtensaeb-softmmu"
|
||||
|
||||
- name: "[s390x] GCC (user)"
|
||||
arch: s390x
|
||||
addons:
|
||||
apt_packages:
|
||||
- libgcrypt20-dev
|
||||
- libglib2.0-dev
|
||||
- libgnutls28-dev
|
||||
- ninja-build
|
||||
- flex
|
||||
- bison
|
||||
- python3-tomli
|
||||
env:
|
||||
- TEST_CMD="make check check-tcg V=1"
|
||||
- CONFIG="--disable-containers --disable-system"
|
||||
|
||||
- name: "[s390x] Clang (disable-tcg)"
|
||||
arch: s390x
|
||||
compiler: clang
|
||||
addons:
|
||||
apt_packages:
|
||||
- libaio-dev
|
||||
- libattr1-dev
|
||||
- libbrlapi-dev
|
||||
- libcacard-dev
|
||||
- libcap-ng-dev
|
||||
- libfdt-dev
|
||||
- libgcrypt20-dev
|
||||
- libgnutls28-dev
|
||||
- libgtk-3-dev
|
||||
- libiscsi-dev
|
||||
- liblttng-ust-dev
|
||||
- libncurses5-dev
|
||||
- libnfs-dev
|
||||
- libpixman-1-dev
|
||||
- libpng-dev
|
||||
- librados-dev
|
||||
- libsdl2-dev
|
||||
- libseccomp-dev
|
||||
- liburcu-dev
|
||||
- libusb-1.0-0-dev
|
||||
- libvdeplug-dev
|
||||
- libvte-2.91-dev
|
||||
- ninja-build
|
||||
- python3-tomli
|
||||
env:
|
||||
- TEST_CMD="make check-unit"
|
||||
- CONFIG="--disable-containers --disable-tcg --enable-kvm --disable-tools
|
||||
--enable-fdt=system --host-cc=clang --cxx=clang++"
|
||||
+111
@@ -0,0 +1,111 @@
|
||||
# iPhone 5 / Apple A6 sur QEMU Windows natif
|
||||
|
||||
## État actuel
|
||||
|
||||
- QEMU `arm-softmmu` est compilé en PE Win64 natif avec MSYS2 MinGW64. WSL n’est pas utilisé.
|
||||
- La machine `iphone5` exécute la SecureROM A6 `iBoot-1145.3` de 65 536 octets.
|
||||
- Les fusibles exposent `CPID:8950`, `CPRV:20` et `CPFM:03`.
|
||||
- L’UART A6 est relié à la console QEMU (`Ctrl+A`, puis `C` pour le moniteur ; `Ctrl+A`, puis `X` pour quitter).
|
||||
- Le contrôleur USB OTG, son EP0, les DMA et l’IRQ 11 permettent à la SecureROM de terminer son énumération DFU.
|
||||
- Le descripteur produit par cette SecureROM annonce `VID=05AC, PID=1229`. La façade Windows le normalise vers le PID DFU public `1227`, attendu par `libirecovery`.
|
||||
- Le pilote KMDF/UDE `QemuA6Ude.sys` crée un véritable enfant PnP `USB\VID_05AC&PID_1227` sous Windows.
|
||||
- `QemuA6UsbBridge.exe` relaie les contrôles DFU entre le pilote et QEMU sur `127.0.0.1:26050`.
|
||||
- Un test externe `DFU_GETSTATE` a traversé le socket, le modèle OTG et la SecureROM, puis a renvoyé `dfuIDLE` (`2`).
|
||||
- `idevicerestore.exe` et `libirecovery` restent d’origine et ne sont pas patchés.
|
||||
|
||||
Le paquet pilote signé en mode test est généré localement dans
|
||||
`windows\QemuA6Ude\package` ; les clés, certificats et binaires générés ne sont
|
||||
pas versionnés.
|
||||
|
||||
## Construction Windows native
|
||||
|
||||
QEMU se configure depuis un terminal MSYS2 MinGW64 :
|
||||
|
||||
```sh
|
||||
./configure --target-list=arm-softmmu
|
||||
ninja -C build qemu-system-arm.exe
|
||||
```
|
||||
|
||||
Le pilote UDE nécessite Visual Studio 2022 Build Tools et le WDK avec UDE. Si
|
||||
le WDK n'est pas installé à son emplacement standard, définir
|
||||
`QA6_WDK_ROOT` vers sa racine (celle qui contient `Include`, `bin` et `tools`).
|
||||
Depuis PowerShell :
|
||||
|
||||
```powershell
|
||||
.\windows\QemuA6Ude\prepare-package.ps1
|
||||
.\windows\QemuA6UsbBridge\build-bridge.ps1 -Configuration Release
|
||||
```
|
||||
|
||||
## Première installation du pilote
|
||||
|
||||
La signature d’un pilote noyau local exige le mode de signature test Windows. Cette opération modifie le BCD et demande un redémarrage. Depuis un PowerShell administrateur :
|
||||
|
||||
```powershell
|
||||
.\windows\QemuA6Ude\enable-test-mode.ps1
|
||||
Restart-Computer
|
||||
```
|
||||
|
||||
Après le redémarrage, toujours en administrateur :
|
||||
|
||||
```powershell
|
||||
.\windows\QemuA6Ude\install-driver.ps1
|
||||
```
|
||||
|
||||
Si Secure Boot bloque `testsigning`, il faut le désactiver dans l’UEFI. Le script d’installation importe uniquement le certificat public de test puis crée le contrôleur racine `Root\QemuA6Ude` avec `devcon`.
|
||||
|
||||
## Lancement normal
|
||||
|
||||
Depuis PowerShell à la racine :
|
||||
|
||||
```powershell
|
||||
.\Run-iPhone5.ps1 -SkipBuild
|
||||
```
|
||||
|
||||
Le mode USB Windows est actif par défaut. Le lanceur démarre le pont en arrière-plan, garde l’UART dans la console et écrit les échanges USB dans `build\a6-usb-bridge.log`.
|
||||
|
||||
Vérification dans un second PowerShell :
|
||||
|
||||
```powershell
|
||||
pnputil /enum-devices /connected /class USB
|
||||
& 'C:\msys64\mingw64\bin\idevicerestore.exe' -d 'iPhone_4.0_32bit_10.3.4_14G61_Restore.ipsw'
|
||||
```
|
||||
|
||||
Pour conserver l’ancien injecteur DFU interne, fournir directement une image :
|
||||
|
||||
```powershell
|
||||
.\Run-iPhone5.ps1 -DfuImagePath '.\build\firmware\iBSS.iphone5.RELEASE.dfu' -Trace
|
||||
```
|
||||
|
||||
Pour démarrer sans façade USB Windows :
|
||||
|
||||
```powershell
|
||||
.\Run-iPhone5.ps1 -NoWindowsUsb
|
||||
```
|
||||
|
||||
## Prochain jalon
|
||||
|
||||
Une fois l’énumération PnP confirmée, l’IPSW iOS 10.3.4 sera envoyé par l’`idevicerestore` original. La SecureROM vérifiera l’iBSS ; après son exécution, il faudra modéliser les périphériques supplémentaires utilisés par iBSS/iBEC et gérer sa réénumération USB Recovery pour atteindre iBoot.
|
||||
|
||||
## Reprise sur macOS
|
||||
|
||||
Le fork QEMU et l’injecteur DFU interne sont portables. Sur macOS, installez les
|
||||
dépendances QEMU, configurez `arm-softmmu`, puis compilez :
|
||||
|
||||
```sh
|
||||
./configure --target-list=arm-softmmu
|
||||
ninja -C build qemu-system-arm
|
||||
```
|
||||
|
||||
Placez ensuite le dump dans `firmware/s5l8950x-secure-rom.bin`, puis lancez :
|
||||
|
||||
```sh
|
||||
./Run-iPhone5-macOS.sh
|
||||
```
|
||||
|
||||
Pour charger l’iBSS extrait de l’IPSW sans dépendre d’un périphérique USB hôte :
|
||||
|
||||
```sh
|
||||
DFU_IMAGE="$PWD/firmware/iBSS.n41.RELEASE.dfu" ./Run-iPhone5-macOS.sh
|
||||
```
|
||||
|
||||
La façade UDE est propre à Windows. Faire apparaître le téléphone comme un vrai périphérique USB sur macOS demanderait une extension DriverKit signée ; ce n’est donc pas un raccourci par rapport au chemin UDE déjà construit.
|
||||
@@ -0,0 +1,338 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
<https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
+501
@@ -0,0 +1,501 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
<https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
Generated
+485
@@ -0,0 +1,485 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.98"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487"
|
||||
|
||||
[[package]]
|
||||
name = "attrs"
|
||||
version = "0.2.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "60e397c905850173fdc02285fe7f94f1b0c3ff55ff6e103efbe98074d80601c4"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitfield-struct"
|
||||
version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3ca6739863c590881f038d033a146c51ddae239186a4327014839fd864f44ed5"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bits"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"qemu_macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bql"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"util-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cfg-expr"
|
||||
version = "0.20.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fb693542bcafa528e198be0ebd9d3632ca5b7c93dbe7237460e199910835997c"
|
||||
dependencies = [
|
||||
"smallvec",
|
||||
"target-lexicon",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "chardev"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bql",
|
||||
"chardev-sys",
|
||||
"common",
|
||||
"glib-sys",
|
||||
"migration",
|
||||
"qom",
|
||||
"util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "chardev-sys"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"common",
|
||||
"glib-sys",
|
||||
"qom-sys",
|
||||
"util-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "common"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"qemu_macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "equivalent"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
|
||||
|
||||
[[package]]
|
||||
name = "foreign"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2292704c239c26962ac5c32d53057c442ca5a2bf017fca5c95c342271058e4c2"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"rustc_version",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "glib-sys"
|
||||
version = "0.21.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d09d3d0fddf7239521674e57b0465dfbd844632fec54f059f7f56112e3f927e1"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"system-deps",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.17.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
||||
|
||||
[[package]]
|
||||
name = "hpet"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bql",
|
||||
"common",
|
||||
"hwcore",
|
||||
"migration",
|
||||
"qom",
|
||||
"system",
|
||||
"trace",
|
||||
"util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hwcore"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bql",
|
||||
"chardev",
|
||||
"common",
|
||||
"glib-sys",
|
||||
"hwcore-sys",
|
||||
"migration",
|
||||
"qemu_macros",
|
||||
"qom",
|
||||
"util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hwcore-sys"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"chardev-sys",
|
||||
"common",
|
||||
"glib-sys",
|
||||
"migration-sys",
|
||||
"qom-sys",
|
||||
"util-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "2.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9"
|
||||
dependencies = [
|
||||
"equivalent",
|
||||
"hashbrown",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.189"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"
|
||||
|
||||
[[package]]
|
||||
name = "migration"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bql",
|
||||
"common",
|
||||
"glib-sys",
|
||||
"migration-sys",
|
||||
"qemu_macros",
|
||||
"util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "migration-sys"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"common",
|
||||
"glib-sys",
|
||||
"util-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pkg-config"
|
||||
version = "0.3.34"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548"
|
||||
|
||||
[[package]]
|
||||
name = "pl011"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bitfield-struct",
|
||||
"bits",
|
||||
"bql",
|
||||
"chardev",
|
||||
"common",
|
||||
"glib-sys",
|
||||
"hwcore",
|
||||
"migration",
|
||||
"qom",
|
||||
"system",
|
||||
"trace",
|
||||
"util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "probe"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "136558b6e1ebaecc92755d0ffaf9421f519531bed30cc2ad23b22cb00965cc5e"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.95"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "qemu_macros"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"attrs",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "qom"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bql",
|
||||
"common",
|
||||
"glib-sys",
|
||||
"migration",
|
||||
"qemu_macros",
|
||||
"qom-sys",
|
||||
"util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "qom-sys"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"util-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.47"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc_version"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92"
|
||||
dependencies = [
|
||||
"semver",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "1.0.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd"
|
||||
|
||||
[[package]]
|
||||
name = "serde_core"
|
||||
version = "1.0.228"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.228"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_spanned"
|
||||
version = "1.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26"
|
||||
dependencies = [
|
||||
"serde_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.15.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.104"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "system"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bql",
|
||||
"common",
|
||||
"glib-sys",
|
||||
"hwcore",
|
||||
"migration",
|
||||
"qom",
|
||||
"system-sys",
|
||||
"util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "system-deps"
|
||||
version = "7.0.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "396a35feb67335377e0251fcbc1092fc85c484bd4e3a7a54319399da127796e7"
|
||||
dependencies = [
|
||||
"cfg-expr",
|
||||
"heck",
|
||||
"pkg-config",
|
||||
"toml",
|
||||
"version-compare",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "system-sys"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"common",
|
||||
"glib-sys",
|
||||
"hwcore-sys",
|
||||
"migration-sys",
|
||||
"qom-sys",
|
||||
"util-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "target-lexicon"
|
||||
version = "0.13.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca"
|
||||
|
||||
[[package]]
|
||||
name = "tests"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bql",
|
||||
"chardev",
|
||||
"common",
|
||||
"hwcore",
|
||||
"migration",
|
||||
"qom",
|
||||
"system",
|
||||
"util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "1.1.4+spec-1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3aace63f4bbcdfc2c965b059de67119c89c4017a70d633be6c104910f67056f5"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"serde_core",
|
||||
"serde_spanned",
|
||||
"toml_datetime",
|
||||
"toml_parser",
|
||||
"toml_writer",
|
||||
"winnow",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_datetime"
|
||||
version = "1.1.1+spec-1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7"
|
||||
dependencies = [
|
||||
"serde_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_parser"
|
||||
version = "1.1.3+spec-1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1d38ac1cf9b95face32296c0a3ede1fdc270627c9d9c02a7274dd6d960dc4d56"
|
||||
dependencies = [
|
||||
"winnow",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_writer"
|
||||
version = "1.1.2+spec-1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7d56353a2a665ad0f41a421187180aab746c8c325620617ad883a99a1cbe66d2"
|
||||
|
||||
[[package]]
|
||||
name = "trace"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"probe",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
|
||||
|
||||
[[package]]
|
||||
name = "util"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"common",
|
||||
"foreign",
|
||||
"glib-sys",
|
||||
"libc",
|
||||
"util-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "util-sys"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "version-compare"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "03c2856837ef78f57382f06b2b8563a2f512f7185d732608fd9176cb3b8edf0e"
|
||||
|
||||
[[package]]
|
||||
name = "winnow"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81"
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
[workspace]
|
||||
resolver = "2"
|
||||
members = [
|
||||
"rust/hw/char/pl011",
|
||||
"rust/hw/timer/hpet",
|
||||
"rust/tests",
|
||||
]
|
||||
|
||||
[workspace.package]
|
||||
edition = "2021"
|
||||
homepage = "https://www.qemu.org"
|
||||
license = "GPL-2.0-or-later"
|
||||
repository = "https://gitlab.com/qemu-project/qemu/"
|
||||
# don't forget to update docs/devel/rust.rst msrv
|
||||
rust-version = "1.83.0"
|
||||
authors = ["The QEMU Project Developers <[email protected]>"]
|
||||
|
||||
[workspace.dependencies]
|
||||
anyhow = "~1.0"
|
||||
foreign = "~0.4.0"
|
||||
libc = "0.2.162"
|
||||
glib-sys = { version = "0.21.2", features = ["v2_66"] }
|
||||
|
||||
[workspace.lints.rust]
|
||||
unexpected_cfgs = { level = "deny", check-cfg = ['cfg(MESON)'] }
|
||||
|
||||
# Occasionally, we may need to silence warnings and clippy lints that
|
||||
# were only introduced in newer Rust compiler versions. Do not croak
|
||||
# in that case; a CI job with rust_strict_lints == true disables this
|
||||
# and ensures that we do not have misspelled allow() attributes.
|
||||
unknown_lints = "allow"
|
||||
|
||||
# Prohibit code that is forbidden in Rust 2024
|
||||
unsafe_op_in_unsafe_fn = "deny"
|
||||
|
||||
[workspace.lints.rustdoc]
|
||||
private_intra_doc_links = "allow"
|
||||
|
||||
broken_intra_doc_links = "deny"
|
||||
invalid_html_tags = "deny"
|
||||
invalid_rust_codeblocks = "deny"
|
||||
bare_urls = "deny"
|
||||
unescaped_backticks = "deny"
|
||||
redundant_explicit_links = "deny"
|
||||
|
||||
[workspace.lints.clippy]
|
||||
# default-warn lints
|
||||
result_unit_err = "allow"
|
||||
manual_checked_ops = "deny"
|
||||
should_implement_trait = "deny"
|
||||
# can be for a reason, e.g. in callbacks
|
||||
unused_self = "allow"
|
||||
# common in device crates
|
||||
upper_case_acronyms = "allow"
|
||||
|
||||
# default-allow lints
|
||||
as_ptr_cast_mut = "deny"
|
||||
as_underscore = "deny"
|
||||
assertions_on_result_states = "deny"
|
||||
bool_to_int_with_if = "deny"
|
||||
cast_lossless = "deny"
|
||||
dbg_macro = "deny"
|
||||
debug_assert_with_mut_call = "deny"
|
||||
derive_partial_eq_without_eq = "deny"
|
||||
doc_markdown = "deny"
|
||||
empty_structs_with_brackets = "deny"
|
||||
ignored_unit_patterns = "deny"
|
||||
implicit_clone = "deny"
|
||||
macro_use_imports = "deny"
|
||||
missing_safety_doc = "deny"
|
||||
mut_mut = "deny"
|
||||
needless_bitwise_bool = "deny"
|
||||
needless_pass_by_ref_mut = "deny"
|
||||
needless_update = "deny"
|
||||
no_effect_underscore_binding = "deny"
|
||||
option_option = "deny"
|
||||
or_fun_call = "deny"
|
||||
ptr_as_ptr = "deny"
|
||||
ptr_cast_constness = "deny"
|
||||
pub_underscore_fields = "deny"
|
||||
redundant_clone = "deny"
|
||||
redundant_closure_for_method_calls = "deny"
|
||||
redundant_else = "deny"
|
||||
redundant_pub_crate = "deny"
|
||||
ref_binding_to_reference = "deny"
|
||||
ref_option_ref = "deny"
|
||||
return_self_not_must_use = "deny"
|
||||
same_name_method = "deny"
|
||||
semicolon_inside_block = "deny"
|
||||
shadow_unrelated = "deny"
|
||||
significant_drop_in_scrutinee = "deny"
|
||||
significant_drop_tightening = "deny"
|
||||
suspicious_operation_groupings = "deny"
|
||||
transmute_ptr_to_ptr = "deny"
|
||||
transmute_undefined_repr = "deny"
|
||||
type_repetition_in_bounds = "deny"
|
||||
uninlined_format_args = "deny"
|
||||
used_underscore_binding = "deny"
|
||||
|
||||
# nice to have, but cannot be enabled yet
|
||||
#wildcard_imports = "deny" # still have many bindings::* imports
|
||||
|
||||
# these may have false positives
|
||||
enum_variant_names = "allow"
|
||||
#option_if_let_else = "deny"
|
||||
cognitive_complexity = "deny"
|
||||
@@ -0,0 +1,8 @@
|
||||
source Kconfig.host
|
||||
source backends/Kconfig
|
||||
source accel/Kconfig
|
||||
source dump/Kconfig
|
||||
source target/Kconfig
|
||||
source hw/Kconfig
|
||||
source semihosting/Kconfig
|
||||
source rust/Kconfig
|
||||
@@ -0,0 +1,66 @@
|
||||
# These are "proxy" symbols used to pass config-host.mak values
|
||||
# down to Kconfig. See also kconfig_external_symbols in
|
||||
# meson.build: these two need to be kept in sync.
|
||||
|
||||
config LINUX
|
||||
bool
|
||||
|
||||
config LIBCBOR
|
||||
bool
|
||||
|
||||
config GNUTLS
|
||||
bool
|
||||
|
||||
config OPENGL
|
||||
bool
|
||||
|
||||
config X11
|
||||
bool
|
||||
|
||||
config PIXMAN
|
||||
bool
|
||||
|
||||
config SPICE
|
||||
bool
|
||||
|
||||
config IVSHMEM
|
||||
bool
|
||||
|
||||
config TPM
|
||||
bool
|
||||
|
||||
config FDT
|
||||
bool
|
||||
|
||||
config VHOST_USER
|
||||
bool
|
||||
|
||||
config VHOST_VDPA
|
||||
bool
|
||||
|
||||
config VHOST_KERNEL
|
||||
bool
|
||||
|
||||
config VIRTFS
|
||||
bool
|
||||
|
||||
config MULTIPROCESS_ALLOWED
|
||||
bool
|
||||
imply MULTIPROCESS
|
||||
|
||||
config FUZZ
|
||||
bool
|
||||
select SPARSE_MEM
|
||||
|
||||
config VFIO_USER_SERVER_ALLOWED
|
||||
bool
|
||||
imply VFIO_USER_SERVER
|
||||
|
||||
config HV_BALLOON_POSSIBLE
|
||||
bool
|
||||
|
||||
config HAVE_RUST
|
||||
bool
|
||||
|
||||
config MAC_PVG
|
||||
bool
|
||||
@@ -0,0 +1,27 @@
|
||||
The QEMU distribution includes both the QEMU emulator and
|
||||
various firmware files. These are separate programs that are
|
||||
distributed together for our users' convenience, and they have
|
||||
separate licenses.
|
||||
|
||||
The following points clarify the license of the QEMU emulator:
|
||||
|
||||
1) The QEMU emulator as a whole is released under the GNU General
|
||||
Public License, version 2.
|
||||
|
||||
2) Parts of the QEMU emulator have specific licenses which are compatible
|
||||
with the GNU General Public License, version 2. Hence each source file
|
||||
contains its own licensing information. Source files with no licensing
|
||||
information are released under the GNU General Public License, version
|
||||
2 or (at your option) any later version.
|
||||
|
||||
As of July 2013, contributions under version 2 of the GNU General Public
|
||||
License (and no later version) are only accepted for the following files
|
||||
or directories: bsd-user/, linux-user/, hw/vfio/, hw/xen/xen_pt*.
|
||||
|
||||
3) The Tiny Code Generator (TCG) is mostly under the BSD or MIT licenses;
|
||||
but some parts may be GPLv2 or other licenses. Again, see the
|
||||
specific licensing information in each source file.
|
||||
|
||||
4) QEMU is a trademark of Fabrice Bellard.
|
||||
|
||||
Fabrice Bellard and the QEMU team
|
||||
+4764
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,339 @@
|
||||
# Makefile for QEMU.
|
||||
|
||||
ifneq ($(words $(subst :, ,$(CURDIR))), 1)
|
||||
$(error main directory cannot contain spaces nor colons)
|
||||
endif
|
||||
|
||||
# Always point to the root of the build tree (needs GNU make).
|
||||
BUILD_DIR=$(CURDIR)
|
||||
|
||||
# Before including a proper config-host.mak, assume we are in the source tree
|
||||
SRC_PATH=.
|
||||
|
||||
# Don't use implicit rules or variables
|
||||
# we have explicit rules for everything
|
||||
MAKEFLAGS += -rR
|
||||
|
||||
SHELL = bash -o pipefail
|
||||
|
||||
# Usage: $(call quiet-command,command and args,"NAME","args to print")
|
||||
# This will run "command and args", and either:
|
||||
# if V=1 just print the whole command and args
|
||||
# otherwise print the 'quiet' output in the format " NAME args to print"
|
||||
# NAME should be a short name of the command, 7 letters or fewer.
|
||||
# If called with only a single argument, will print nothing in quiet mode.
|
||||
quiet-command-run = $(if $(V),,$(if $2,printf " %-7s %s\n" $2 $3 && ))$1
|
||||
quiet-@ = $(if $(V),,@)
|
||||
quiet-command = $(quiet-@)$(call quiet-command-run,$1,$2,$3)
|
||||
|
||||
UNCHECKED_GOALS := TAGS gtags cscope ctags dist \
|
||||
help check-help print-% \
|
||||
docker docker-% lcitool-refresh vm-help vm-test vm-build-%
|
||||
|
||||
all:
|
||||
.PHONY: all clean distclean recurse-all dist msi FORCE
|
||||
|
||||
# Don't try to regenerate Makefile or configure
|
||||
# We don't generate any of them
|
||||
Makefile: ;
|
||||
configure: ;
|
||||
|
||||
# All following code might depend on configuration variables
|
||||
ifneq ($(wildcard config-host.mak),)
|
||||
include config-host.mak
|
||||
|
||||
include Makefile.prereqs
|
||||
Makefile.prereqs: config-host.mak
|
||||
|
||||
# 0. ensure the build tree is okay
|
||||
|
||||
# Check that we're not trying to do an out-of-tree build from
|
||||
# a tree that's been used for an in-tree build.
|
||||
ifneq ($(realpath $(SRC_PATH)),$(realpath .))
|
||||
ifneq ($(wildcard $(SRC_PATH)/config-host.mak),)
|
||||
$(error This is an out of tree build but your source tree ($(SRC_PATH)) \
|
||||
seems to have been used for an in-tree build. You can fix this by running \
|
||||
"$(MAKE) distclean && rm -rf *-linux-user *-softmmu" in your source tree)
|
||||
endif
|
||||
endif
|
||||
|
||||
# force a rerun of configure if config-host.mak is too old or corrupted
|
||||
ifeq ($(MESON),)
|
||||
.PHONY: config-host.mak
|
||||
x := $(shell rm -rf meson-private meson-info meson-logs)
|
||||
endif
|
||||
ifeq ($(NINJA),)
|
||||
.PHONY: config-host.mak
|
||||
x := $(shell rm -rf meson-private meson-info meson-logs)
|
||||
else
|
||||
export NINJA
|
||||
endif
|
||||
ifeq ($(wildcard build.ninja),)
|
||||
.PHONY: config-host.mak
|
||||
x := $(shell rm -rf meson-private meson-info meson-logs)
|
||||
endif
|
||||
ifeq ($(origin prefix),file)
|
||||
.PHONY: config-host.mak
|
||||
x := $(shell rm -rf meson-private meson-info meson-logs)
|
||||
endif
|
||||
|
||||
# 1. ensure config-host.mak is up-to-date
|
||||
config-host.mak: $(SRC_PATH)/configure $(SRC_PATH)/scripts/meson-buildoptions.sh \
|
||||
$(SRC_PATH)/pythondeps.toml $(SRC_PATH)/VERSION
|
||||
@echo config-host.mak is out-of-date, running configure
|
||||
@if test -f meson-private/coredata.dat; then \
|
||||
./config.status --skip-meson; \
|
||||
else \
|
||||
./config.status; \
|
||||
fi
|
||||
|
||||
# 2. meson.stamp exists if meson has run at least once (so ninja reconfigure
|
||||
# works), but otherwise never needs to be updated
|
||||
|
||||
meson-private/coredata.dat: meson.stamp
|
||||
meson.stamp: config-host.mak
|
||||
@touch meson.stamp
|
||||
|
||||
# 3. ensure meson-generated build files are up-to-date
|
||||
|
||||
ninja-cmd-goals =
|
||||
|
||||
ifneq ($(NINJA),)
|
||||
Makefile.ninja: build.ninja
|
||||
$(quiet-@){ \
|
||||
echo 'ninja-targets = \'; \
|
||||
$(NINJA) -t targets all | sed 's/:.*//; $$!s/$$/ \\/'; \
|
||||
echo 'build-files = \'; \
|
||||
$(NINJA) -t query build.ninja | sed -n '1,/^ input:/d; /^ outputs:/q; s/$$/ \\/p'; \
|
||||
} > $@.tmp && mv $@.tmp $@
|
||||
-include Makefile.ninja
|
||||
endif
|
||||
|
||||
ifneq ($(MESON),)
|
||||
# The path to meson always points to pyvenv/bin/meson, but the absolute
|
||||
# paths could change. In that case, force a regeneration of build.ninja.
|
||||
# Note that this invocation of $(NINJA), just like when Make rebuilds
|
||||
# Makefiles, does not include -n.
|
||||
build.ninja: build.ninja.stamp
|
||||
$(build-files):
|
||||
build.ninja.stamp: meson.stamp $(build-files)
|
||||
@if test "$$(cat build.ninja.stamp)" = "$(MESON)" && test -n "$(NINJA)"; then \
|
||||
$(NINJA) build.ninja; \
|
||||
else \
|
||||
echo "$(MESON) setup --reconfigure $(SRC_PATH)"; \
|
||||
$(MESON) setup --reconfigure $(SRC_PATH); \
|
||||
fi && echo "$(MESON)" > $@
|
||||
|
||||
Makefile.mtest: build.ninja scripts/mtest2make.py
|
||||
$(MESON) introspect --targets --tests --benchmarks | $(PYTHON) scripts/mtest2make.py > $@
|
||||
-include Makefile.mtest
|
||||
|
||||
.PHONY: update-buildoptions
|
||||
all update-buildoptions: $(SRC_PATH)/scripts/meson-buildoptions.sh
|
||||
$(SRC_PATH)/scripts/meson-buildoptions.sh: $(SRC_PATH)/meson_options.txt $(SRC_PATH)/scripts/meson-buildoptions.py
|
||||
$(MESON) introspect --buildoptions $(SRC_PATH)/meson.build | $(PYTHON) \
|
||||
scripts/meson-buildoptions.py > $@.tmp && mv $@.tmp $@
|
||||
endif
|
||||
|
||||
# 4. Rules to bridge to other makefiles
|
||||
|
||||
ifneq ($(NINJA),)
|
||||
# Filter out long options to avoid flags like --no-print-directory which
|
||||
# may result in false positive match for MAKE.n
|
||||
MAKE.n = $(findstring n,$(firstword $(filter-out --%,$(MAKEFLAGS))))
|
||||
MAKE.k = $(findstring k,$(firstword $(filter-out --%,$(MAKEFLAGS))))
|
||||
MAKE.q = $(findstring q,$(firstword $(filter-out --%,$(MAKEFLAGS))))
|
||||
MAKE.nq = $(if $(word 2, $(MAKE.n) $(MAKE.q)),nq)
|
||||
NINJAFLAGS = \
|
||||
$(if $V,-v) \
|
||||
$(if $(MAKE.n), -n) \
|
||||
$(if $(MAKE.k), -k0) \
|
||||
$(filter-out -j, \
|
||||
$(or $(filter -l% -j%, $(MAKEFLAGS)), \
|
||||
$(if $(filter --jobserver-auth=%, $(MAKEFLAGS)),, -j1))) \
|
||||
-d keepdepfile
|
||||
ninja-cmd-goals += $(or $(MAKECMDGOALS), all)
|
||||
ninja-cmd-goals += $(foreach g, $(MAKECMDGOALS), $(.ninja-goals.$g))
|
||||
|
||||
makefile-targets := build.ninja ctags TAGS cscope dist clean
|
||||
# "ninja -t targets" also lists all prerequisites. If build system
|
||||
# files are marked as PHONY, however, Make will always try to execute
|
||||
# "ninja build.ninja".
|
||||
ninja-targets := $(filter-out $(build-files) $(makefile-targets), $(ninja-targets))
|
||||
.PHONY: $(ninja-targets) run-ninja
|
||||
$(ninja-targets): run-ninja
|
||||
|
||||
# Use "| cat" to give Ninja a more "make-y" output. Use "+" to bypass the
|
||||
# --output-sync line.
|
||||
run-ninja: config-host.mak
|
||||
ifneq ($(filter $(ninja-targets), $(ninja-cmd-goals)),)
|
||||
+$(if $(MAKE.nq),@:,$(quiet-@)$(NINJA) $(NINJAFLAGS) \
|
||||
$(sort $(filter $(ninja-targets), $(ninja-cmd-goals))) | cat)
|
||||
endif
|
||||
endif
|
||||
|
||||
else # config-host.mak does not exist
|
||||
ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
|
||||
$(error Please call configure before running make)
|
||||
endif
|
||||
endif # config-host.mak does not exist
|
||||
|
||||
SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory --quiet)
|
||||
|
||||
include $(SRC_PATH)/tests/Makefile.include
|
||||
|
||||
all: recurse-all
|
||||
|
||||
SUBDIR_RULES=$(foreach t, all clean distclean, $(addsuffix /$(t), $(SUBDIRS)))
|
||||
.PHONY: $(SUBDIR_RULES)
|
||||
$(SUBDIR_RULES):
|
||||
$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V="$(V)" TARGET_DIR="$(dir $@)" $(notdir $@),)
|
||||
|
||||
.PHONY: recurse-all recurse-clean
|
||||
recurse-all: $(addsuffix /all, $(SUBDIRS))
|
||||
recurse-clean: $(addsuffix /clean, $(SUBDIRS))
|
||||
recurse-distclean: $(addsuffix /distclean, $(SUBDIRS))
|
||||
|
||||
######################################################################
|
||||
|
||||
clean: recurse-clean
|
||||
-$(quiet-@)test -f build.ninja && $(NINJA) $(NINJAFLAGS) -t clean || :
|
||||
-$(quiet-@)test -f build.ninja && $(NINJA) $(NINJAFLAGS) clean-ctlist || :
|
||||
find . \( -name '*.so' -o -name '*.dll' -o \
|
||||
-name '*.[oda]' -o -name '*.gcno' \) -type f \
|
||||
! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-aarch64.a \
|
||||
! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-arm.a \
|
||||
-exec rm {} +
|
||||
rm -f TAGS cscope.* *~ */*~
|
||||
@$(MAKE) -Ctests/qemu-iotests clean
|
||||
|
||||
VERSION = $(shell cat $(SRC_PATH)/VERSION)
|
||||
|
||||
dist: qemu-$(VERSION).tar.xz
|
||||
|
||||
qemu-%.tar.xz:
|
||||
$(SRC_PATH)/scripts/make-release "$(SRC_PATH)" "$(patsubst qemu-%.tar.xz,%,$@)"
|
||||
|
||||
distclean: clean recurse-distclean
|
||||
-$(quiet-@)test -f build.ninja && $(NINJA) $(NINJAFLAGS) -t clean -g || :
|
||||
rm -f config-host.mak Makefile.prereqs
|
||||
rm -f tests/tcg/*/config-target.mak tests/tcg/config-host.mak
|
||||
rm -f config.status
|
||||
rm -f roms/seabios/config.mak
|
||||
rm -f qemu-plugins-ld.symbols qemu-plugins-ld64.symbols
|
||||
rm -f *-config-target.h *-config-devices.mak *-config-devices.h
|
||||
rm -rf meson-private meson-logs meson-info compile_commands.json
|
||||
rm -f Makefile.ninja Makefile.mtest build.ninja.stamp meson.stamp
|
||||
rm -f config.log
|
||||
rm -f linux-headers/asm
|
||||
rm -Rf .sdk qemu-bundle
|
||||
|
||||
find-src-path = find "$(SRC_PATH)" -path "$(SRC_PATH)/meson" -prune -o \
|
||||
-path "$(SRC_PATH)/.pc" -prune -o \
|
||||
-type l -prune -o \( -name "*.[chsS]" -o -name "*.[ch].inc" \)
|
||||
|
||||
.PHONY: ctags
|
||||
ctags:
|
||||
$(call quiet-command, \
|
||||
rm -f "$(SRC_PATH)/"tags, \
|
||||
"CTAGS", "Remove old tags")
|
||||
$(call quiet-command, \
|
||||
$(find-src-path) -exec ctags \
|
||||
-f "$(SRC_PATH)/"tags --append {} +, \
|
||||
"CTAGS", "Re-index $(SRC_PATH)")
|
||||
|
||||
.PHONY: gtags
|
||||
gtags:
|
||||
$(call quiet-command, \
|
||||
rm -f "$(SRC_PATH)/"GTAGS; \
|
||||
rm -f "$(SRC_PATH)/"GRTAGS; \
|
||||
rm -f "$(SRC_PATH)/"GPATH, \
|
||||
"GTAGS", "Remove old $@ files")
|
||||
$(call quiet-command, \
|
||||
(cd $(SRC_PATH) && \
|
||||
$(find-src-path) -print | gtags -f -), \
|
||||
"GTAGS", "Re-index $(SRC_PATH)")
|
||||
|
||||
.PHONY: TAGS
|
||||
TAGS:
|
||||
$(call quiet-command, \
|
||||
rm -f "$(SRC_PATH)/"TAGS, \
|
||||
"TAGS", "Remove old $@")
|
||||
$(call quiet-command, \
|
||||
$(find-src-path) -exec etags \
|
||||
-f "$(SRC_PATH)/"TAGS --append {} +, \
|
||||
"TAGS", "Re-index $(SRC_PATH)")
|
||||
|
||||
.PHONY: cscope
|
||||
cscope:
|
||||
$(call quiet-command, \
|
||||
rm -f "$(SRC_PATH)/"cscope.* , \
|
||||
"cscope", "Remove old $@ files")
|
||||
$(call quiet-command, \
|
||||
($(find-src-path) -print | sed -e 's,^\./,,' \
|
||||
> "$(SRC_PATH)/cscope.files"), \
|
||||
"cscope", "Create file list")
|
||||
$(call quiet-command, \
|
||||
cscope -b -i"$(SRC_PATH)/cscope.files" \
|
||||
-f"$(SRC_PATH)"/cscope.out, \
|
||||
"cscope", "Re-index $(SRC_PATH)")
|
||||
|
||||
# Needed by "meson install"
|
||||
export DESTDIR
|
||||
|
||||
include $(SRC_PATH)/tests/lcitool/Makefile.include
|
||||
include $(SRC_PATH)/tests/docker/Makefile.include
|
||||
include $(SRC_PATH)/tests/vm/Makefile.include
|
||||
|
||||
print-help-run = printf " %-30s - %s\\n" "$1" "$2"
|
||||
print-help = @$(call print-help-run,$1,$2)
|
||||
|
||||
.PHONY: update-linux-vdso
|
||||
update-linux-vdso:
|
||||
@for m in $(SRC_PATH)/linux-user/*/Makefile.vdso; do \
|
||||
$(MAKE) $(SUBDIR_MAKEFLAGS) -C $$(dirname $$m) -f Makefile.vdso \
|
||||
SRC_PATH=$(SRC_PATH) BUILD_DIR=$(BUILD_DIR); \
|
||||
done
|
||||
|
||||
.PHONY: help
|
||||
help:
|
||||
@echo 'Generic targets:'
|
||||
$(call print-help,all,Build all)
|
||||
$(call print-help,dir/file.o,Build specified target only)
|
||||
$(call print-help,install,Install QEMU, documentation and tools)
|
||||
$(call print-help,ctags/gtags/TAGS,Generate tags file for editors)
|
||||
$(call print-help,cscope,Generate cscope index)
|
||||
$(call print-help,sparse,Run sparse on the QEMU source)
|
||||
@echo ''
|
||||
@echo 'Cleaning targets:'
|
||||
$(call print-help,clean,Remove most generated files but keep the config)
|
||||
$(call print-help,distclean,Remove all generated files)
|
||||
$(call print-help,dist,Build a distributable tarball)
|
||||
@echo ''
|
||||
@echo 'Linux-user targets:'
|
||||
$(call print-help,update-linux-vdso,Build linux-user vdso images)
|
||||
@echo ''
|
||||
@echo 'Test targets:'
|
||||
$(call print-help,check,Run all tests (check-help for details))
|
||||
$(call print-help,bench,Run all benchmarks)
|
||||
$(call print-help,lcitool-help,Help about targets for managing build environment manifests)
|
||||
$(call print-help,docker-help,Help about targets running tests inside containers)
|
||||
$(call print-help,vm-help,Help about targets running tests inside VM)
|
||||
@echo ''
|
||||
@echo 'Documentation targets:'
|
||||
$(call print-help,html man,Build documentation in specified format)
|
||||
@echo ''
|
||||
ifneq ($(filter msi, $(ninja-targets)),)
|
||||
@echo 'Windows targets:'
|
||||
$(call print-help,installer,Build NSIS-based installer for QEMU)
|
||||
$(call print-help,msi,Build MSI-based installer for qemu-ga)
|
||||
@echo ''
|
||||
endif
|
||||
$(call print-help,$(MAKE) [targets],(quiet build, default))
|
||||
$(call print-help,$(MAKE) V=1 [targets],(verbose build))
|
||||
|
||||
# will delete the target of a rule if commands exit with a nonzero exit status
|
||||
.DELETE_ON_ERROR:
|
||||
|
||||
print-%:
|
||||
@echo '$*=$($*)'
|
||||
+171
@@ -0,0 +1,171 @@
|
||||
===========
|
||||
QEMU README
|
||||
===========
|
||||
|
||||
QEMU is a generic and open source machine & userspace emulator and
|
||||
virtualizer.
|
||||
|
||||
QEMU is capable of emulating a complete machine in software without any
|
||||
need for hardware virtualization support. By using dynamic translation,
|
||||
it achieves very good performance. QEMU can also integrate with the Xen
|
||||
and KVM hypervisors to provide emulated hardware while allowing the
|
||||
hypervisor to manage the CPU. With hypervisor support, QEMU can achieve
|
||||
near native performance for CPUs. When QEMU emulates CPUs directly it is
|
||||
capable of running operating systems made for one machine (e.g. an ARMv7
|
||||
board) on a different machine (e.g. an x86_64 PC board).
|
||||
|
||||
QEMU is also capable of providing userspace API virtualization for Linux
|
||||
and BSD kernel interfaces. This allows binaries compiled against one
|
||||
architecture ABI (e.g. the Linux PPC64 ABI) to be run on a host using a
|
||||
different architecture ABI (e.g. the Linux x86_64 ABI). This does not
|
||||
involve any hardware emulation, simply CPU and syscall emulation.
|
||||
|
||||
QEMU aims to fit into a variety of use cases. It can be invoked directly
|
||||
by users wishing to have full control over its behaviour and settings.
|
||||
It also aims to facilitate integration into higher level management
|
||||
layers, by providing a stable command line interface and monitor API.
|
||||
It is commonly invoked indirectly via the libvirt library when using
|
||||
open source applications such as oVirt, OpenStack and virt-manager.
|
||||
|
||||
QEMU as a whole is released under the GNU General Public License,
|
||||
version 2. For full licensing details, consult the LICENSE file.
|
||||
|
||||
|
||||
Documentation
|
||||
=============
|
||||
|
||||
Documentation can be found hosted online at
|
||||
`<https://www.qemu.org/documentation/>`_. The documentation for the
|
||||
current development version that is available at
|
||||
`<https://www.qemu.org/docs/master/>`_ is generated from the ``docs/``
|
||||
folder in the source tree, and is built by `Sphinx
|
||||
<https://www.sphinx-doc.org/en/master/>`_.
|
||||
|
||||
|
||||
Building
|
||||
========
|
||||
|
||||
QEMU is multi-platform software intended to be buildable on all modern
|
||||
Linux platforms, OS-X, Win32 (via the Mingw64 toolchain) and a variety
|
||||
of other UNIX targets. The simple steps to build QEMU are:
|
||||
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
../configure
|
||||
make
|
||||
|
||||
Additional information can also be found online via the QEMU website:
|
||||
|
||||
* `<https://wiki.qemu.org/Hosts/Linux>`_
|
||||
* `<https://wiki.qemu.org/Hosts/Mac>`_
|
||||
* `<https://wiki.qemu.org/Hosts/W32>`_
|
||||
|
||||
|
||||
Submitting patches
|
||||
==================
|
||||
|
||||
The QEMU source code is maintained under the GIT version control system.
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
git clone https://gitlab.com/qemu-project/qemu.git
|
||||
|
||||
When submitting patches, one common approach is to use 'git
|
||||
format-patch' and/or 'git send-email' to format & send the mail to the
|
||||
[email protected] mailing list. All patches submitted must contain
|
||||
a 'Signed-off-by' line from the author. Patches should follow the
|
||||
guidelines set out in the `style section
|
||||
<https://www.qemu.org/docs/master/devel/style.html>`_ of
|
||||
the Developers Guide.
|
||||
|
||||
Additional information on submitting patches can be found online via
|
||||
the QEMU website:
|
||||
|
||||
* `<https://wiki.qemu.org/Contribute/SubmitAPatch>`_
|
||||
* `<https://wiki.qemu.org/Contribute/TrivialPatches>`_
|
||||
|
||||
The QEMU website is also maintained under source control.
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
git clone https://gitlab.com/qemu-project/qemu-web.git
|
||||
|
||||
* `<https://www.qemu.org/2017/02/04/the-new-qemu-website-is-up/>`_
|
||||
|
||||
A 'git-publish' utility was created to make above process less
|
||||
cumbersome, and is highly recommended for making regular contributions,
|
||||
or even just for sending consecutive patch series revisions. It also
|
||||
requires a working 'git send-email' setup, and by default doesn't
|
||||
automate everything, so you may want to go through the above steps
|
||||
manually for once.
|
||||
|
||||
For installation instructions, please go to:
|
||||
|
||||
* `<https://github.com/stefanha/git-publish>`_
|
||||
|
||||
The workflow with 'git-publish' is:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
$ git checkout master -b my-feature
|
||||
$ # work on new commits, add your 'Signed-off-by' lines to each
|
||||
$ git publish
|
||||
|
||||
Your patch series will be sent and tagged as my-feature-v1 if you need to refer
|
||||
back to it in the future.
|
||||
|
||||
Sending v2:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
$ git checkout my-feature # same topic branch
|
||||
$ # making changes to the commits (using 'git rebase', for example)
|
||||
$ git publish
|
||||
|
||||
Your patch series will be sent with 'v2' tag in the subject and the git tip
|
||||
will be tagged as my-feature-v2.
|
||||
|
||||
Bug reporting
|
||||
=============
|
||||
|
||||
The QEMU project uses GitLab issues to track bugs. Bugs
|
||||
found when running code built from QEMU git or upstream released sources
|
||||
should be reported via:
|
||||
|
||||
* `<https://gitlab.com/qemu-project/qemu/-/issues>`_
|
||||
|
||||
If using QEMU via an operating system vendor pre-built binary package, it
|
||||
is preferable to report bugs to the vendor's own bug tracker first. If
|
||||
the bug is also known to affect latest upstream code, it can also be
|
||||
reported via GitLab.
|
||||
|
||||
For additional information on bug reporting consult:
|
||||
|
||||
* `<https://wiki.qemu.org/Contribute/ReportABug>`_
|
||||
|
||||
|
||||
ChangeLog
|
||||
=========
|
||||
|
||||
For version history and release notes, please visit
|
||||
`<https://wiki.qemu.org/ChangeLog/>`_ or look at the git history for
|
||||
more detailed information.
|
||||
|
||||
|
||||
Contact
|
||||
=======
|
||||
|
||||
The QEMU community can be contacted in a number of ways, with the two
|
||||
main methods being email and IRC:
|
||||
|
||||
* `<mailto:[email protected]>`_
|
||||
* `<https://lists.nongnu.org/mailman/listinfo/qemu-devel>`_
|
||||
* #qemu on irc.oftc.net
|
||||
|
||||
Information on additional methods of contacting the community can be
|
||||
found online via the QEMU website:
|
||||
|
||||
* `<https://wiki.qemu.org/Contribute/StartHere>`_
|
||||
Executable
+47
@@ -0,0 +1,47 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
||||
qemu_bin=${QEMU_BIN:-"$script_dir/build/qemu-system-arm"}
|
||||
rom_path=${ROM_PATH:-"$script_dir/firmware/s5l8950x-secure-rom.bin"}
|
||||
dfu_image=${DFU_IMAGE:-}
|
||||
|
||||
if [ ! -x "$qemu_bin" ]; then
|
||||
echo "QEMU introuvable: $qemu_bin" >&2
|
||||
echo "Configurez ce dépôt avec --target-list=arm-softmmu puis compilez-le." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "$rom_path" ]; then
|
||||
echo "SecureROM introuvable: $rom_path" >&2
|
||||
echo "Placez votre dump A6 de 65536 octets dans firmware/s5l8950x-secure-rom.bin." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set -- \
|
||||
-machine iphone5 \
|
||||
-bios "$rom_path" \
|
||||
-no-reboot \
|
||||
-no-shutdown \
|
||||
-display none \
|
||||
-serial mon:stdio
|
||||
|
||||
if [ -n "$dfu_image" ]; then
|
||||
if [ ! -f "$dfu_image" ]; then
|
||||
echo "Image DFU introuvable: $dfu_image" >&2
|
||||
exit 1
|
||||
fi
|
||||
set -- "$@" -global "s5l8950x-usb-otg.dfu-image=$dfu_image"
|
||||
fi
|
||||
|
||||
echo "QEMU macOS : $qemu_bin"
|
||||
echo "SecureROM : $rom_path"
|
||||
if [ -n "$dfu_image" ]; then
|
||||
echo "Image DFU : $dfu_image"
|
||||
echo "Injection DFU interne active."
|
||||
else
|
||||
echo "La SecureROM attend en dfuIDLE."
|
||||
fi
|
||||
echo "UART A6 : cette console (Ctrl+A C = moniteur, Ctrl+A X = quitter)"
|
||||
|
||||
exec "$qemu_bin" "$@"
|
||||
+171
@@ -0,0 +1,171 @@
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[string]$RomPath = (Join-Path $PSScriptRoot 'firmware\s5l8950x-secure-rom.bin'),
|
||||
[Alias('IbootPath')]
|
||||
[string]$DfuImagePath,
|
||||
[string]$MsysRoot = 'C:\msys64',
|
||||
[ValidateRange(1024, 65535)]
|
||||
[int]$UsbBridgePort = 26050,
|
||||
[switch]$NoWindowsUsb,
|
||||
[switch]$SkipBuild,
|
||||
[switch]$Trace,
|
||||
[switch]$Paused
|
||||
)
|
||||
|
||||
Set-StrictMode -Version Latest
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
if ([Environment]::OSVersion.Platform -ne [PlatformID]::Win32NT) {
|
||||
throw 'Ce lanceur requiert Windows natif.'
|
||||
}
|
||||
|
||||
$qemuSource = $PSScriptRoot
|
||||
$buildDir = Join-Path $qemuSource 'build'
|
||||
$mingwBin = Join-Path $MsysRoot 'mingw64\bin'
|
||||
$msysBin = Join-Path $MsysRoot 'usr\bin'
|
||||
$ninja = Join-Path $mingwBin 'ninja.exe'
|
||||
$qemu = Join-Path $buildDir 'qemu-system-arm.exe'
|
||||
$buildTemp = Join-Path $buildDir 'tmp'
|
||||
$bridge = Join-Path $PSScriptRoot 'windows\QemuA6UsbBridge\build\Release\x64\QemuA6UsbBridge.exe'
|
||||
$bridgeBuild = Join-Path $PSScriptRoot 'windows\QemuA6UsbBridge\build-bridge.ps1'
|
||||
$bridgeStdout = Join-Path $buildDir 'a6-usb-bridge.log'
|
||||
$bridgeStderr = Join-Path $buildDir 'a6-usb-bridge-error.log'
|
||||
|
||||
if (-not (Test-Path -LiteralPath $RomPath -PathType Leaf)) {
|
||||
throw "SecureROM introuvable : $RomPath"
|
||||
}
|
||||
|
||||
$rom = Get-Item -LiteralPath $RomPath
|
||||
if ($rom.Length -ne 0x10000) {
|
||||
throw "La SecureROM doit faire exactement 65536 octets (taille actuelle : $($rom.Length))."
|
||||
}
|
||||
|
||||
$dfuImage = $null
|
||||
if ($DfuImagePath) {
|
||||
if (-not (Test-Path -LiteralPath $DfuImagePath -PathType Leaf)) {
|
||||
throw "Image DFU/iBSS introuvable : $DfuImagePath"
|
||||
}
|
||||
$dfuImage = Get-Item -LiteralPath $DfuImagePath
|
||||
if ($dfuImage.Length -eq 0) {
|
||||
throw "L'image DFU/iBSS est vide : $($dfuImage.FullName)"
|
||||
}
|
||||
}
|
||||
|
||||
$windowsUsb = -not $NoWindowsUsb -and $null -eq $dfuImage
|
||||
|
||||
$env:Path = "$mingwBin;$msysBin;$env:Path"
|
||||
|
||||
if (-not $SkipBuild) {
|
||||
if (-not (Test-Path -LiteralPath $ninja -PathType Leaf)) {
|
||||
throw "Ninja MinGW64 introuvable : $ninja"
|
||||
}
|
||||
if (-not (Test-Path -LiteralPath (Join-Path $msysBin 'sort.exe') -PathType Leaf)) {
|
||||
throw "Les outils MSYS2 sont incomplets : $msysBin"
|
||||
}
|
||||
if (-not (Test-Path -LiteralPath (Join-Path $buildDir 'build.ninja') -PathType Leaf)) {
|
||||
throw "Le dossier qemu\build n'est pas configure. Configurez QEMU depuis MSYS2 MinGW64 avec --target-list=arm-softmmu."
|
||||
}
|
||||
|
||||
[IO.Directory]::CreateDirectory($buildTemp) | Out-Null
|
||||
$env:TMP = $buildTemp
|
||||
$env:TEMP = $buildTemp
|
||||
$env:TMPDIR = $buildTemp
|
||||
|
||||
& $ninja -C $buildDir qemu-system-arm.exe
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "La compilation QEMU a echoue avec le code $LASTEXITCODE."
|
||||
}
|
||||
}
|
||||
|
||||
if (-not (Test-Path -LiteralPath $qemu -PathType Leaf)) {
|
||||
throw "Binaire QEMU introuvable : $qemu"
|
||||
}
|
||||
|
||||
$machines = & $qemu -machine help 2>&1
|
||||
if ($LASTEXITCODE -ne 0 -or -not ($machines -match '^iphone5\s')) {
|
||||
throw 'Ce binaire QEMU ne contient pas la machine iphone5.'
|
||||
}
|
||||
|
||||
$qemuArgs = @(
|
||||
'-machine', 'iphone5',
|
||||
'-bios', $rom.FullName,
|
||||
'-no-reboot',
|
||||
'-no-shutdown'
|
||||
)
|
||||
|
||||
if ($dfuImage) {
|
||||
$qemuArgs += @(
|
||||
'-global',
|
||||
"s5l8950x-usb-otg.dfu-image=$($dfuImage.FullName)"
|
||||
)
|
||||
}
|
||||
|
||||
if ($windowsUsb) {
|
||||
$qemuArgs += @(
|
||||
'-chardev', "socket,id=a6usb,host=127.0.0.1,port=$UsbBridgePort,server=on,wait=off",
|
||||
'-global', 's5l8950x-usb-otg.usb-bridge=a6usb'
|
||||
)
|
||||
}
|
||||
|
||||
if ($Paused) {
|
||||
$qemuArgs += @('-S', '-display', 'none', '-serial', 'null', '-monitor', 'stdio')
|
||||
} else {
|
||||
# UART0 is connected explicitly to this native Windows console. The
|
||||
# monitor is multiplexed on the same chardev (Ctrl+A C toggles it).
|
||||
$qemuArgs += @('-display', 'none', '-serial', 'mon:stdio')
|
||||
}
|
||||
|
||||
if ($Trace) {
|
||||
$tracePath = Join-Path $buildDir 'a6-boot.log'
|
||||
$qemuArgs += @(
|
||||
'-d', 'in_asm,cpu_reset,guest_errors,unimp',
|
||||
'-D', $tracePath
|
||||
)
|
||||
Write-Host "Trace QEMU : $tracePath"
|
||||
}
|
||||
|
||||
Write-Host "QEMU Windows natif : $qemu"
|
||||
Write-Host "SecureROM : $($rom.FullName)"
|
||||
if ($dfuImage) {
|
||||
Write-Host "Image DFU/iBSS : $($dfuImage.FullName)"
|
||||
}
|
||||
if ($windowsUsb) {
|
||||
if (-not (Test-Path -LiteralPath $bridge -PathType Leaf)) {
|
||||
& $bridgeBuild -Configuration Release
|
||||
}
|
||||
Write-Host 'USB Windows : Apple DFU VID_05AC&PID_1227 via UDE'
|
||||
Write-Host "Pont QEMU : 127.0.0.1:$UsbBridgePort"
|
||||
Write-Host "Journal pont USB : $bridgeStdout"
|
||||
}
|
||||
if (-not $Paused) {
|
||||
if ($dfuImage) {
|
||||
Write-Host 'Le cable USB et le transfert DFU sont simules en interne.'
|
||||
} elseif ($windowsUsb) {
|
||||
Write-Host 'Windows voit le téléphone DFU virtuel ; idevicerestore reste inchangé.'
|
||||
} else {
|
||||
Write-Host 'Recovery et cable USB sont simulés : la ROM attend en mode DFU.'
|
||||
}
|
||||
Write-Host 'UART A6 : cette console (Ctrl+A C = moniteur)'
|
||||
Write-Host 'Utilisez Ctrl+A puis X pour quitter.'
|
||||
}
|
||||
|
||||
$bridgeProcess = $null
|
||||
$exitCode = 1
|
||||
try {
|
||||
if ($windowsUsb) {
|
||||
$bridgeProcess = Start-Process -FilePath $bridge `
|
||||
-ArgumentList @('127.0.0.1', $UsbBridgePort.ToString()) `
|
||||
-WindowStyle Hidden -PassThru `
|
||||
-RedirectStandardOutput $bridgeStdout `
|
||||
-RedirectStandardError $bridgeStderr
|
||||
}
|
||||
|
||||
& $qemu @qemuArgs
|
||||
$exitCode = $LASTEXITCODE
|
||||
} finally {
|
||||
if ($null -ne $bridgeProcess -and -not $bridgeProcess.HasExited) {
|
||||
Stop-Process -Id $bridgeProcess.Id
|
||||
$bridgeProcess.WaitForExit()
|
||||
}
|
||||
}
|
||||
exit $exitCode
|
||||
@@ -0,0 +1,26 @@
|
||||
config WHPX
|
||||
bool
|
||||
|
||||
config NVMM
|
||||
bool
|
||||
|
||||
config HVF
|
||||
bool
|
||||
|
||||
config TCG
|
||||
bool
|
||||
|
||||
config KVM
|
||||
bool
|
||||
|
||||
config MSHV
|
||||
bool
|
||||
|
||||
config NITRO
|
||||
bool
|
||||
|
||||
config XEN
|
||||
bool
|
||||
select FSDEV_9P if VIRTFS
|
||||
select PCI_EXPRESS_GENERIC_BRIDGE
|
||||
select XEN_BUS
|
||||
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
* Lock to inhibit accelerator ioctls
|
||||
*
|
||||
* Copyright (c) 2022 Red Hat Inc.
|
||||
*
|
||||
* Author: Emanuele Giuseppe Esposito <[email protected]>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/lockcnt.h"
|
||||
#include "qemu/thread.h"
|
||||
#include "qemu/main-loop.h"
|
||||
#include "hw/core/cpu.h"
|
||||
#include "system/accel-blocker.h"
|
||||
|
||||
static QemuLockCnt accel_in_ioctl_lock;
|
||||
static QemuEvent accel_in_ioctl_event;
|
||||
|
||||
void accel_blocker_init(void)
|
||||
{
|
||||
qemu_lockcnt_init(&accel_in_ioctl_lock);
|
||||
qemu_event_init(&accel_in_ioctl_event, false);
|
||||
}
|
||||
|
||||
void accel_ioctl_begin(void)
|
||||
{
|
||||
if (likely(bql_locked())) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* block if lock is taken in kvm_ioctl_inhibit_begin() */
|
||||
qemu_lockcnt_inc(&accel_in_ioctl_lock);
|
||||
}
|
||||
|
||||
void accel_ioctl_end(void)
|
||||
{
|
||||
if (likely(bql_locked())) {
|
||||
return;
|
||||
}
|
||||
|
||||
qemu_lockcnt_dec(&accel_in_ioctl_lock);
|
||||
/* change event to SET. If event was BUSY, wake up all waiters */
|
||||
qemu_event_set(&accel_in_ioctl_event);
|
||||
}
|
||||
|
||||
void accel_cpu_ioctl_begin(CPUState *cpu)
|
||||
{
|
||||
if (unlikely(bql_locked())) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* block if lock is taken in kvm_ioctl_inhibit_begin() */
|
||||
qemu_lockcnt_inc(&cpu->in_ioctl_lock);
|
||||
}
|
||||
|
||||
void accel_cpu_ioctl_end(CPUState *cpu)
|
||||
{
|
||||
if (unlikely(bql_locked())) {
|
||||
return;
|
||||
}
|
||||
|
||||
qemu_lockcnt_dec(&cpu->in_ioctl_lock);
|
||||
/* change event to SET. If event was BUSY, wake up all waiters */
|
||||
qemu_event_set(&accel_in_ioctl_event);
|
||||
}
|
||||
|
||||
static bool accel_has_to_wait(void)
|
||||
{
|
||||
CPUState *cpu;
|
||||
bool needs_to_wait = false;
|
||||
|
||||
CPU_FOREACH(cpu) {
|
||||
if (qemu_lockcnt_count(&cpu->in_ioctl_lock)) {
|
||||
/* exit the ioctl, if vcpu is running it */
|
||||
qemu_cpu_kick(cpu);
|
||||
needs_to_wait = true;
|
||||
}
|
||||
}
|
||||
|
||||
return needs_to_wait || qemu_lockcnt_count(&accel_in_ioctl_lock);
|
||||
}
|
||||
|
||||
void accel_ioctl_inhibit_begin(void)
|
||||
{
|
||||
CPUState *cpu;
|
||||
|
||||
/*
|
||||
* We allow to inhibit only when holding the BQL, so we can identify
|
||||
* when an inhibitor wants to issue an ioctl easily.
|
||||
*/
|
||||
g_assert(bql_locked());
|
||||
|
||||
/* Block further invocations of the ioctls outside the BQL. */
|
||||
CPU_FOREACH(cpu) {
|
||||
qemu_lockcnt_lock(&cpu->in_ioctl_lock);
|
||||
}
|
||||
qemu_lockcnt_lock(&accel_in_ioctl_lock);
|
||||
|
||||
/* Keep waiting until there are running ioctls */
|
||||
while (true) {
|
||||
|
||||
/* Reset event to FREE. */
|
||||
qemu_event_reset(&accel_in_ioctl_event);
|
||||
|
||||
if (accel_has_to_wait()) {
|
||||
/*
|
||||
* If event is still FREE, and there are ioctls still in progress,
|
||||
* wait.
|
||||
*
|
||||
* If an ioctl finishes before qemu_event_wait(), it will change
|
||||
* the event state to SET. This will prevent qemu_event_wait() from
|
||||
* blocking, but it's not a problem because if other ioctls are
|
||||
* still running the loop will iterate once more and reset the event
|
||||
* status to FREE so that it can wait properly.
|
||||
*
|
||||
* If an ioctls finishes while qemu_event_wait() is blocking, then
|
||||
* it will be waken up, but also here the while loop makes sure
|
||||
* to re-enter the wait if there are other running ioctls.
|
||||
*/
|
||||
qemu_event_wait(&accel_in_ioctl_event);
|
||||
} else {
|
||||
/* No ioctl is running */
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void accel_ioctl_inhibit_end(void)
|
||||
{
|
||||
CPUState *cpu;
|
||||
|
||||
qemu_lockcnt_unlock(&accel_in_ioctl_lock);
|
||||
CPU_FOREACH(cpu) {
|
||||
qemu_lockcnt_unlock(&cpu->in_ioctl_lock);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
/*
|
||||
* QEMU accel class, components common to system emulation and user mode
|
||||
*
|
||||
* Copyright (c) 2003-2008 Fabrice Bellard
|
||||
* Copyright (c) 2014 Red Hat Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/accel.h"
|
||||
#include "qemu/target-info.h"
|
||||
#include "accel/accel-ops.h"
|
||||
#include "accel/accel-cpu.h"
|
||||
#include "accel/accel-cpu-ops.h"
|
||||
#include "accel-internal.h"
|
||||
|
||||
/* Lookup AccelClass from opt_name. Returns NULL if not found */
|
||||
AccelClass *accel_find(const char *opt_name)
|
||||
{
|
||||
char *class_name = g_strdup_printf(ACCEL_CLASS_NAME("%s"), opt_name);
|
||||
AccelClass *ac = ACCEL_CLASS(module_object_class_by_name(class_name));
|
||||
g_free(class_name);
|
||||
return ac;
|
||||
}
|
||||
|
||||
/* Return the name of the current accelerator */
|
||||
const char *current_accel_name(void)
|
||||
{
|
||||
AccelClass *ac = ACCEL_GET_CLASS(current_accel());
|
||||
|
||||
return ac->name;
|
||||
}
|
||||
|
||||
static void accel_init_cpu_int_aux(ObjectClass *klass, void *opaque)
|
||||
{
|
||||
CPUClass *cc = CPU_CLASS(klass);
|
||||
AccelCPUClass *accel_cpu = opaque;
|
||||
|
||||
cc->accel_cpu = accel_cpu;
|
||||
if (accel_cpu->cpu_class_init) {
|
||||
accel_cpu->cpu_class_init(cc);
|
||||
}
|
||||
}
|
||||
|
||||
/* initialize the arch-specific accel CpuClass interfaces */
|
||||
static void accel_init_cpu_interfaces(AccelClass *ac)
|
||||
{
|
||||
const char *ac_name; /* AccelClass name */
|
||||
char *acc_name; /* AccelCPUClass name */
|
||||
ObjectClass *acc; /* AccelCPUClass */
|
||||
const char *cpu_resolving_type = target_cpu_type();
|
||||
|
||||
ac_name = object_class_get_name(OBJECT_CLASS(ac));
|
||||
g_assert(ac_name != NULL);
|
||||
|
||||
acc_name = g_strdup_printf("%s-%s", ac_name, cpu_resolving_type);
|
||||
acc = object_class_by_name(acc_name);
|
||||
g_free(acc_name);
|
||||
|
||||
if (acc) {
|
||||
object_class_foreach(accel_init_cpu_int_aux,
|
||||
cpu_resolving_type, false, acc);
|
||||
}
|
||||
}
|
||||
|
||||
void accel_init_interfaces(AccelClass *ac)
|
||||
{
|
||||
accel_init_ops_interfaces(ac);
|
||||
accel_init_cpu_interfaces(ac);
|
||||
}
|
||||
|
||||
bool accel_supports_guest_debug(AccelState *accel)
|
||||
{
|
||||
return accel->gdbstub.sstep_flags & SSTEP_ENABLE;
|
||||
}
|
||||
|
||||
void accel_cpu_instance_init(CPUState *cpu)
|
||||
{
|
||||
if (cpu->cc->accel_cpu && cpu->cc->accel_cpu->cpu_instance_init) {
|
||||
cpu->cc->accel_cpu->cpu_instance_init(cpu);
|
||||
}
|
||||
}
|
||||
|
||||
bool accel_cpu_common_realize(CPUState *cpu, Error **errp)
|
||||
{
|
||||
AccelState *accel = current_accel();
|
||||
AccelClass *acc = ACCEL_GET_CLASS(accel);
|
||||
|
||||
/* target specific realization */
|
||||
if (cpu->cc->accel_cpu
|
||||
&& cpu->cc->accel_cpu->cpu_target_realize
|
||||
&& !cpu->cc->accel_cpu->cpu_target_realize(cpu, errp)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* generic realization */
|
||||
if (acc->cpu_common_realize && !acc->cpu_common_realize(cpu, errp)) {
|
||||
return false;
|
||||
}
|
||||
if (acc->ops
|
||||
&& acc->ops->cpu_target_realize
|
||||
&& !acc->ops->cpu_target_realize(cpu, errp)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void accel_cpu_common_unrealize(CPUState *cpu)
|
||||
{
|
||||
AccelState *accel = current_accel();
|
||||
AccelClass *acc = ACCEL_GET_CLASS(accel);
|
||||
|
||||
/* generic unrealization */
|
||||
if (acc->cpu_common_unrealize) {
|
||||
acc->cpu_common_unrealize(cpu);
|
||||
}
|
||||
}
|
||||
|
||||
static const TypeInfo accel_types[] = {
|
||||
{
|
||||
.name = TYPE_ACCEL,
|
||||
.parent = TYPE_OBJECT,
|
||||
.class_size = sizeof(AccelClass),
|
||||
.instance_size = sizeof(AccelState),
|
||||
.abstract = true,
|
||||
},
|
||||
};
|
||||
|
||||
DEFINE_TYPES(accel_types)
|
||||
|
||||
static void register_accel_target_type(void)
|
||||
{
|
||||
g_autofree char *name = g_strconcat("accel-", target_cpu_type(), NULL);
|
||||
const TypeInfo accel_cpu_type = {
|
||||
.name = name,
|
||||
.parent = TYPE_OBJECT,
|
||||
.abstract = true,
|
||||
.class_size = sizeof(AccelCPUClass),
|
||||
};
|
||||
|
||||
type_register_static(&accel_cpu_type);
|
||||
}
|
||||
|
||||
type_init(register_accel_target_type);
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* QEMU accel internal functions
|
||||
*
|
||||
* Copyright 2021 SUSE LLC
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
||||
* See the COPYING file in the top-level directory.
|
||||
*/
|
||||
|
||||
#ifndef ACCEL_INTERNAL_H
|
||||
#define ACCEL_INTERNAL_H
|
||||
|
||||
#include "qemu/accel.h"
|
||||
|
||||
void accel_init_ops_interfaces(AccelClass *ac);
|
||||
|
||||
#endif /* ACCEL_SYSTEM_H */
|
||||
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* Accelerated irqchip abstraction
|
||||
*
|
||||
* Copyright Microsoft, Corp. 2025
|
||||
*
|
||||
* Authors: Ziqiao Zhou <[email protected]>
|
||||
* Magnus Kulke <[email protected]>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "hw/pci/msi.h"
|
||||
|
||||
#include "system/kvm.h"
|
||||
#include "system/mshv.h"
|
||||
#include "system/accel-irq.h"
|
||||
|
||||
int accel_irqchip_add_msi_route(AccelRouteChange *c, int vector, PCIDevice *dev)
|
||||
{
|
||||
if (mshv_msi_via_irqfd_enabled()) {
|
||||
return mshv_irqchip_add_msi_route(c, vector, dev);
|
||||
}
|
||||
if (kvm_enabled()) {
|
||||
return kvm_irqchip_add_msi_route(c, vector, dev);
|
||||
}
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
int accel_irqchip_update_msi_route(int vector, MSIMessage msg, PCIDevice *dev)
|
||||
{
|
||||
if (mshv_msi_via_irqfd_enabled()) {
|
||||
return mshv_irqchip_update_msi_route(vector, msg, dev);
|
||||
}
|
||||
if (kvm_enabled()) {
|
||||
return kvm_irqchip_update_msi_route(kvm_state, vector, msg, dev);
|
||||
}
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
void accel_irqchip_commit_route_changes(AccelRouteChange *c)
|
||||
{
|
||||
if (c->changes) {
|
||||
accel_irqchip_commit_routes();
|
||||
c->changes = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void accel_irqchip_commit_routes(void)
|
||||
{
|
||||
if (mshv_msi_via_irqfd_enabled()) {
|
||||
mshv_irqchip_commit_routes(mshv_state);
|
||||
}
|
||||
if (kvm_enabled()) {
|
||||
kvm_irqchip_commit_routes(kvm_state);
|
||||
}
|
||||
}
|
||||
|
||||
void accel_irqchip_release_virq(int virq)
|
||||
{
|
||||
if (mshv_msi_via_irqfd_enabled()) {
|
||||
mshv_irqchip_release_virq(mshv_state, virq);
|
||||
}
|
||||
if (kvm_enabled()) {
|
||||
kvm_irqchip_release_virq(kvm_state, virq);
|
||||
}
|
||||
}
|
||||
|
||||
int accel_irqchip_add_irqfd_notifier_gsi(EventNotifier *n, EventNotifier *rn,
|
||||
int virq)
|
||||
{
|
||||
if (mshv_msi_via_irqfd_enabled()) {
|
||||
return mshv_irqchip_add_irqfd_notifier_gsi(n, rn, virq);
|
||||
}
|
||||
if (kvm_enabled()) {
|
||||
return kvm_irqchip_add_irqfd_notifier_gsi(kvm_state, n, rn, virq);
|
||||
}
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
int accel_irqchip_remove_irqfd_notifier_gsi(EventNotifier *n, int virq)
|
||||
{
|
||||
if (mshv_msi_via_irqfd_enabled()) {
|
||||
return mshv_irqchip_remove_irqfd_notifier_gsi(n, virq);
|
||||
}
|
||||
if (kvm_enabled()) {
|
||||
return kvm_irqchip_remove_irqfd_notifier_gsi(kvm_state, n, virq);
|
||||
}
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
inline AccelRouteChange accel_irqchip_begin_route_changes(void)
|
||||
{
|
||||
if (mshv_msi_via_irqfd_enabled()) {
|
||||
return (AccelRouteChange) {
|
||||
.accel = ACCEL(mshv_state),
|
||||
.changes = 0,
|
||||
};
|
||||
}
|
||||
if (kvm_enabled()) {
|
||||
return (AccelRouteChange) {
|
||||
.accel = ACCEL(kvm_state),
|
||||
.changes = 0,
|
||||
};
|
||||
}
|
||||
error_report("can't initiate route change, no accel irqchip available");
|
||||
abort();
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* QMP commands related to accelerators
|
||||
*
|
||||
* Copyright (c) Linaro
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/accel.h"
|
||||
#include "qapi/type-helpers.h"
|
||||
#include "qapi/qapi-commands-accelerator.h"
|
||||
#include "accel/accel-ops.h"
|
||||
#include "accel/accel-cpu-ops.h"
|
||||
#include "hw/core/cpu.h"
|
||||
|
||||
HumanReadableText *qmp_x_accel_stats(Error **errp)
|
||||
{
|
||||
AccelState *accel = current_accel();
|
||||
AccelClass *acc = ACCEL_GET_CLASS(accel);
|
||||
g_autoptr(GString) buf = g_string_new("");
|
||||
|
||||
if (acc->get_stats) {
|
||||
acc->get_stats(accel, buf);
|
||||
}
|
||||
if (acc->ops->get_vcpu_stats) {
|
||||
CPUState *cpu;
|
||||
|
||||
CPU_FOREACH(cpu) {
|
||||
acc->ops->get_vcpu_stats(cpu, buf);
|
||||
}
|
||||
}
|
||||
|
||||
return human_readable_text_from_str(buf);
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* QEMU accel class, system emulation components
|
||||
*
|
||||
* Copyright (c) 2003-2008 Fabrice Bellard
|
||||
* Copyright (c) 2014 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/accel.h"
|
||||
#include "qom/compat-properties.h"
|
||||
#include "qapi/qapi-commands-accelerator.h"
|
||||
#include "monitor/monitor.h"
|
||||
#include "hw/core/boards.h"
|
||||
#include "hw/core/cpu.h"
|
||||
#include "accel/accel-ops.h"
|
||||
#include "accel/accel-cpu-ops.h"
|
||||
#include "system/cpus.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "accel-internal.h"
|
||||
|
||||
int accel_init_machine(AccelState *accel, MachineState *ms)
|
||||
{
|
||||
AccelClass *acc = ACCEL_GET_CLASS(accel);
|
||||
int ret;
|
||||
ms->accelerator = accel;
|
||||
*(acc->allowed) = true;
|
||||
ret = acc->init_machine(accel, ms);
|
||||
if (ret < 0) {
|
||||
ms->accelerator = NULL;
|
||||
*(acc->allowed) = false;
|
||||
object_unref(OBJECT(accel));
|
||||
} else {
|
||||
object_set_accelerator_compat_props(acc->compat_props);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
AccelState *current_accel(void)
|
||||
{
|
||||
return current_machine->accelerator;
|
||||
}
|
||||
|
||||
void accel_setup_post(MachineState *ms)
|
||||
{
|
||||
AccelState *accel = ms->accelerator;
|
||||
AccelClass *acc = ACCEL_GET_CLASS(accel);
|
||||
if (acc->setup_post) {
|
||||
acc->setup_post(accel);
|
||||
}
|
||||
}
|
||||
|
||||
void accel_pre_resume(MachineState *ms, bool step_pending)
|
||||
{
|
||||
AccelState *accel = ms->accelerator;
|
||||
AccelClass *acc = ACCEL_GET_CLASS(accel);
|
||||
if (acc->pre_resume_vm) {
|
||||
acc->pre_resume_vm(accel, step_pending);
|
||||
}
|
||||
}
|
||||
|
||||
/* initialize the arch-independent accel operation interfaces */
|
||||
void accel_init_ops_interfaces(AccelClass *ac)
|
||||
{
|
||||
const char *ac_name;
|
||||
char *ops_name;
|
||||
ObjectClass *oc;
|
||||
AccelOpsClass *ops;
|
||||
|
||||
ac_name = object_class_get_name(OBJECT_CLASS(ac));
|
||||
g_assert(ac_name != NULL);
|
||||
|
||||
ops_name = g_strdup_printf("%s" ACCEL_OPS_SUFFIX, ac_name);
|
||||
oc = module_object_class_by_name(ops_name);
|
||||
if (!oc) {
|
||||
error_report("fatal: could not load module for type '%s'", ops_name);
|
||||
exit(1);
|
||||
}
|
||||
g_free(ops_name);
|
||||
/*
|
||||
* all accelerators need to define ops, providing at least a mandatory
|
||||
* non-NULL create_vcpu_thread operation.
|
||||
*/
|
||||
ops = ACCEL_OPS_CLASS(oc);
|
||||
ac->ops = ops;
|
||||
if (ops->ops_init) {
|
||||
ops->ops_init(ac);
|
||||
}
|
||||
cpus_register_accel(ops);
|
||||
}
|
||||
|
||||
static void accel_ops_class_init(ObjectClass *oc, const void *data)
|
||||
{
|
||||
monitor_register_hmp_info_hrt("accel", qmp_x_accel_stats);
|
||||
}
|
||||
|
||||
static const TypeInfo accel_ops_type_info = {
|
||||
.name = TYPE_ACCEL_OPS,
|
||||
.parent = TYPE_OBJECT,
|
||||
.abstract = true,
|
||||
.class_size = sizeof(AccelOpsClass),
|
||||
.class_init = accel_ops_class_init,
|
||||
};
|
||||
|
||||
static void accel_system_register_types(void)
|
||||
{
|
||||
type_register_static(&accel_ops_type_info);
|
||||
}
|
||||
type_init(accel_system_register_types);
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* QEMU accel class, user-mode components
|
||||
*
|
||||
* Copyright 2021 SUSE LLC
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
||||
* See the COPYING file in the top-level directory.
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/accel.h"
|
||||
#include "accel-internal.h"
|
||||
|
||||
void accel_init_ops_interfaces(AccelClass *ac)
|
||||
{
|
||||
/* nothing */
|
||||
}
|
||||
|
||||
AccelState *current_accel(void)
|
||||
{
|
||||
static AccelState *accel;
|
||||
|
||||
if (!accel) {
|
||||
AccelClass *ac = accel_find("tcg");
|
||||
|
||||
g_assert(ac != NULL);
|
||||
accel = ACCEL(object_new_with_class(OBJECT_CLASS(ac)));
|
||||
}
|
||||
return accel;
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Dummy cpu thread code
|
||||
*
|
||||
* Copyright IBM, Corp. 2011
|
||||
*
|
||||
* Authors:
|
||||
* Anthony Liguori <[email protected]>
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
||||
* See the COPYING file in the top-level directory.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/rcu.h"
|
||||
#include "system/cpus.h"
|
||||
#include "qemu/guest-random.h"
|
||||
#include "qemu/main-loop.h"
|
||||
#include "hw/core/cpu.h"
|
||||
#include "accel/dummy-cpus.h"
|
||||
|
||||
static void *dummy_cpu_thread_fn(void *arg)
|
||||
{
|
||||
CPUState *cpu = arg;
|
||||
|
||||
rcu_register_thread();
|
||||
|
||||
bql_lock();
|
||||
qemu_thread_get_self(cpu->thread);
|
||||
cpu->thread_id = qemu_get_thread_id();
|
||||
current_cpu = cpu;
|
||||
|
||||
#ifndef _WIN32
|
||||
sigset_t waitset;
|
||||
int r;
|
||||
|
||||
sigemptyset(&waitset);
|
||||
sigaddset(&waitset, SIG_IPI);
|
||||
#endif
|
||||
|
||||
/* signal CPU creation */
|
||||
cpu_thread_signal_created(cpu);
|
||||
qemu_guest_random_seed_thread_part2(cpu->random_seed);
|
||||
|
||||
do {
|
||||
qemu_process_cpu_events(cpu);
|
||||
bql_unlock();
|
||||
#ifndef _WIN32
|
||||
do {
|
||||
int sig;
|
||||
r = sigwait(&waitset, &sig);
|
||||
} while (r == -1 && (errno == EAGAIN || errno == EINTR));
|
||||
if (r == -1) {
|
||||
perror("sigwait");
|
||||
exit(1);
|
||||
}
|
||||
#else
|
||||
qemu_sem_wait(&cpu->sem);
|
||||
#endif
|
||||
bql_lock();
|
||||
} while (!cpu->unplug);
|
||||
|
||||
bql_unlock();
|
||||
rcu_unregister_thread();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void dummy_start_vcpu_thread(CPUState *cpu)
|
||||
{
|
||||
char thread_name[VCPU_THREAD_NAME_SIZE];
|
||||
|
||||
snprintf(thread_name, VCPU_THREAD_NAME_SIZE, "CPU %d/DUMMY",
|
||||
cpu->cpu_index);
|
||||
qemu_thread_create(cpu->thread, thread_name, dummy_cpu_thread_fn, cpu,
|
||||
QEMU_THREAD_JOINABLE);
|
||||
#ifdef _WIN32
|
||||
qemu_sem_init(&cpu->sem, 0);
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Dummy cpu thread code
|
||||
*
|
||||
* Copyright IBM, Corp. 2011
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef ACCEL_DUMMY_CPUS_H
|
||||
#define ACCEL_DUMMY_CPUS_H
|
||||
|
||||
void dummy_start_vcpu_thread(CPUState *cpu);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.hypervisor</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,391 @@
|
||||
/*
|
||||
* Copyright 2008 IBM Corporation
|
||||
* 2008 Red Hat, Inc.
|
||||
* Copyright 2011 Intel Corporation
|
||||
* Copyright 2016 Veertu, Inc.
|
||||
* Copyright 2017 The Android Open Source Project
|
||||
*
|
||||
* QEMU Hypervisor.framework support
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of version 2 of the GNU General Public
|
||||
* License as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This file contain code under public domain from the hvdos project:
|
||||
* https://github.com/mist64/hvdos
|
||||
*
|
||||
* Parts Copyright (c) 2011 NetApp, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/guest-random.h"
|
||||
#include "qemu/main-loop.h"
|
||||
#include "qemu/queue.h"
|
||||
#include "gdbstub/enums.h"
|
||||
#include "exec/cpu-common.h"
|
||||
#include "hw/core/cpu.h"
|
||||
#include "accel/accel-cpu-ops.h"
|
||||
#include "system/cpus.h"
|
||||
#include "system/hvf.h"
|
||||
#include "system/hvf_int.h"
|
||||
#include <mach/mach_time.h>
|
||||
|
||||
HVFState *hvf_state;
|
||||
|
||||
static void do_hvf_cpu_synchronize_state(CPUState *cpu, run_on_cpu_data arg)
|
||||
{
|
||||
if (!cpu->vcpu_dirty) {
|
||||
hvf_arch_get_registers(cpu);
|
||||
cpu->vcpu_dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
static void hvf_cpu_synchronize_state(CPUState *cpu)
|
||||
{
|
||||
if (!cpu->vcpu_dirty) {
|
||||
run_on_cpu(cpu, do_hvf_cpu_synchronize_state, RUN_ON_CPU_NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static void do_hvf_cpu_synchronize_set_dirty(CPUState *cpu,
|
||||
run_on_cpu_data arg)
|
||||
{
|
||||
/* QEMU state is the reference, push it to HVF now and on next entry */
|
||||
cpu->vcpu_dirty = true;
|
||||
}
|
||||
|
||||
static void hvf_cpu_synchronize_post_reset(CPUState *cpu)
|
||||
{
|
||||
run_on_cpu(cpu, do_hvf_cpu_synchronize_set_dirty, RUN_ON_CPU_NULL);
|
||||
}
|
||||
|
||||
static void hvf_cpu_synchronize_post_init(CPUState *cpu)
|
||||
{
|
||||
run_on_cpu(cpu, do_hvf_cpu_synchronize_set_dirty, RUN_ON_CPU_NULL);
|
||||
}
|
||||
|
||||
static void hvf_cpu_synchronize_pre_loadvm(CPUState *cpu)
|
||||
{
|
||||
run_on_cpu(cpu, do_hvf_cpu_synchronize_set_dirty, RUN_ON_CPU_NULL);
|
||||
}
|
||||
|
||||
static void dummy_signal(int sig)
|
||||
{
|
||||
}
|
||||
|
||||
static void do_hvf_get_vcpu_exec_time(CPUState *cpu, run_on_cpu_data arg)
|
||||
{
|
||||
int r = hv_vcpu_get_exec_time(cpu->accel->fd, arg.host_ptr);
|
||||
assert_hvf_ok(r);
|
||||
}
|
||||
|
||||
static void hvf_vcpu_destroy(CPUState *cpu)
|
||||
{
|
||||
hv_return_t ret = hv_vcpu_destroy(cpu->accel->fd);
|
||||
assert_hvf_ok(ret);
|
||||
|
||||
hvf_arch_vcpu_destroy(cpu);
|
||||
g_free(cpu->accel);
|
||||
cpu->accel = NULL;
|
||||
}
|
||||
|
||||
static int hvf_init_vcpu(CPUState *cpu)
|
||||
{
|
||||
int r;
|
||||
|
||||
cpu->accel = g_new0(AccelCPUState, 1);
|
||||
|
||||
/* init cpu signals */
|
||||
struct sigaction sigact;
|
||||
|
||||
memset(&sigact, 0, sizeof(sigact));
|
||||
sigact.sa_handler = dummy_signal;
|
||||
sigaction(SIG_IPI, &sigact, NULL);
|
||||
|
||||
#ifdef __aarch64__
|
||||
cpu->accel->guest_debug_enabled = false;
|
||||
|
||||
r = hv_vcpu_create(&cpu->accel->fd,
|
||||
(hv_vcpu_exit_t **)&cpu->accel->exit, NULL);
|
||||
#else
|
||||
r = hv_vcpu_create(&cpu->accel->fd, HV_VCPU_DEFAULT);
|
||||
#endif
|
||||
assert_hvf_ok(r);
|
||||
cpu->vcpu_dirty = true;
|
||||
|
||||
return hvf_arch_init_vcpu(cpu);
|
||||
}
|
||||
|
||||
/*
|
||||
* The HVF-specific vCPU thread function. This one should only run when the host
|
||||
* CPU supports the VMX "unrestricted guest" feature.
|
||||
*/
|
||||
static void *hvf_cpu_thread_fn(void *arg)
|
||||
{
|
||||
CPUState *cpu = arg;
|
||||
|
||||
int r;
|
||||
|
||||
assert(hvf_enabled());
|
||||
|
||||
rcu_register_thread();
|
||||
|
||||
bql_lock();
|
||||
qemu_thread_get_self(cpu->thread);
|
||||
|
||||
cpu->thread_id = qemu_get_thread_id();
|
||||
current_cpu = cpu;
|
||||
|
||||
hvf_init_vcpu(cpu);
|
||||
|
||||
/* signal CPU creation */
|
||||
cpu_thread_signal_created(cpu);
|
||||
qemu_guest_random_seed_thread_part2(cpu->random_seed);
|
||||
|
||||
do {
|
||||
qemu_process_cpu_events(cpu);
|
||||
if (cpu_can_run(cpu)) {
|
||||
r = hvf_arch_vcpu_exec(cpu);
|
||||
if (r == EXCP_DEBUG) {
|
||||
cpu_handle_guest_debug(cpu);
|
||||
}
|
||||
}
|
||||
} while (!cpu->unplug || cpu_can_run(cpu));
|
||||
|
||||
hvf_vcpu_destroy(cpu);
|
||||
cpu_thread_signal_destroyed(cpu);
|
||||
bql_unlock();
|
||||
rcu_unregister_thread();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void hvf_start_vcpu_thread(CPUState *cpu)
|
||||
{
|
||||
char thread_name[VCPU_THREAD_NAME_SIZE];
|
||||
|
||||
/*
|
||||
* HVF currently does not support TCG, and only runs in
|
||||
* unrestricted-guest mode.
|
||||
*/
|
||||
assert(hvf_enabled());
|
||||
|
||||
snprintf(thread_name, VCPU_THREAD_NAME_SIZE, "CPU %d/HVF",
|
||||
cpu->cpu_index);
|
||||
qemu_thread_create(cpu->thread, thread_name, hvf_cpu_thread_fn,
|
||||
cpu, QEMU_THREAD_JOINABLE);
|
||||
}
|
||||
|
||||
struct hvf_sw_breakpoint *hvf_find_sw_breakpoint(CPUState *cpu, vaddr pc)
|
||||
{
|
||||
struct hvf_sw_breakpoint *bp;
|
||||
|
||||
QTAILQ_FOREACH(bp, &hvf_state->hvf_sw_breakpoints, entry) {
|
||||
if (bp->pc == pc) {
|
||||
return bp;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int hvf_sw_breakpoints_active(CPUState *cpu)
|
||||
{
|
||||
return !QTAILQ_EMPTY(&hvf_state->hvf_sw_breakpoints);
|
||||
}
|
||||
|
||||
static void do_hvf_update_guest_debug(CPUState *cpu, run_on_cpu_data arg)
|
||||
{
|
||||
hvf_arch_update_guest_debug(cpu);
|
||||
}
|
||||
|
||||
int hvf_update_guest_debug(CPUState *cpu)
|
||||
{
|
||||
run_on_cpu(cpu, do_hvf_update_guest_debug, RUN_ON_CPU_NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hvf_insert_gdbstub_breakpoint(CPUState *cpu, GdbBreakpointType type,
|
||||
vaddr addr, vaddr len)
|
||||
{
|
||||
struct hvf_sw_breakpoint *bp;
|
||||
int err;
|
||||
|
||||
if (type == GDB_BREAKPOINT_SW) {
|
||||
bp = hvf_find_sw_breakpoint(cpu, addr);
|
||||
if (bp) {
|
||||
bp->use_count++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bp = g_new(struct hvf_sw_breakpoint, 1);
|
||||
bp->pc = addr;
|
||||
bp->use_count = 1;
|
||||
err = hvf_arch_insert_sw_breakpoint(cpu, bp);
|
||||
if (err) {
|
||||
g_free(bp);
|
||||
return err;
|
||||
}
|
||||
|
||||
QTAILQ_INSERT_HEAD(&hvf_state->hvf_sw_breakpoints, bp, entry);
|
||||
} else {
|
||||
err = hvf_arch_insert_gdbstub_hw_breakpoint(addr, len, type);
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
CPU_FOREACH(cpu) {
|
||||
err = hvf_update_guest_debug(cpu);
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hvf_remove_gdbstub_breakpoint(CPUState *cpu, GdbBreakpointType type,
|
||||
vaddr addr, vaddr len)
|
||||
{
|
||||
struct hvf_sw_breakpoint *bp;
|
||||
int err;
|
||||
|
||||
if (type == GDB_BREAKPOINT_SW) {
|
||||
bp = hvf_find_sw_breakpoint(cpu, addr);
|
||||
if (!bp) {
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
if (bp->use_count > 1) {
|
||||
bp->use_count--;
|
||||
return 0;
|
||||
}
|
||||
|
||||
err = hvf_arch_remove_sw_breakpoint(cpu, bp);
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
|
||||
QTAILQ_REMOVE(&hvf_state->hvf_sw_breakpoints, bp, entry);
|
||||
g_free(bp);
|
||||
} else {
|
||||
err = hvf_arch_remove_gdbstub_hw_breakpoint(addr, len, type);
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
CPU_FOREACH(cpu) {
|
||||
err = hvf_update_guest_debug(cpu);
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void hvf_remove_all_gdbstub_breakpoints(CPUState *cpu)
|
||||
{
|
||||
struct hvf_sw_breakpoint *bp, *next;
|
||||
CPUState *tmpcpu;
|
||||
|
||||
QTAILQ_FOREACH_SAFE(bp, &hvf_state->hvf_sw_breakpoints, entry, next) {
|
||||
if (hvf_arch_remove_sw_breakpoint(cpu, bp) != 0) {
|
||||
/* Try harder to find a CPU that currently sees the breakpoint. */
|
||||
CPU_FOREACH(tmpcpu)
|
||||
{
|
||||
if (hvf_arch_remove_sw_breakpoint(tmpcpu, bp) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
QTAILQ_REMOVE(&hvf_state->hvf_sw_breakpoints, bp, entry);
|
||||
g_free(bp);
|
||||
}
|
||||
hvf_arch_remove_all_gdbstub_hw_breakpoints();
|
||||
|
||||
CPU_FOREACH(cpu) {
|
||||
hvf_update_guest_debug(cpu);
|
||||
}
|
||||
}
|
||||
|
||||
static void hvf_get_vcpu_stats(CPUState *cpu, GString *buf)
|
||||
{
|
||||
uint64_t time_mach; /* units of mach_absolute_time() */
|
||||
|
||||
run_on_cpu(cpu, do_hvf_get_vcpu_exec_time, RUN_ON_CPU_HOST_PTR(&time_mach));
|
||||
|
||||
mach_timebase_info_data_t timebase;
|
||||
mach_timebase_info(&timebase);
|
||||
uint64_t time_ns = time_mach * timebase.numer / timebase.denom;
|
||||
|
||||
g_string_append_printf(buf, "HVF cumulative execution time: %llu.%.3llus\n",
|
||||
time_ns / 1000000000,
|
||||
(time_ns % 1000000000) / 1000000);
|
||||
}
|
||||
|
||||
static void hvf_accel_ops_class_init(ObjectClass *oc, const void *data)
|
||||
{
|
||||
AccelOpsClass *ops = ACCEL_OPS_CLASS(oc);
|
||||
|
||||
ops->cpu_target_realize = hvf_arch_cpu_realize;
|
||||
|
||||
ops->create_vcpu_thread = hvf_start_vcpu_thread;
|
||||
ops->kick_vcpu_thread = hvf_kick_vcpu_thread;
|
||||
ops->handle_interrupt = generic_handle_interrupt;
|
||||
|
||||
ops->synchronize_post_reset = hvf_cpu_synchronize_post_reset;
|
||||
ops->synchronize_post_init = hvf_cpu_synchronize_post_init;
|
||||
ops->synchronize_state = hvf_cpu_synchronize_state;
|
||||
ops->synchronize_pre_loadvm = hvf_cpu_synchronize_pre_loadvm;
|
||||
|
||||
ops->insert_gdbstub_breakpoint = hvf_insert_gdbstub_breakpoint;
|
||||
ops->remove_gdbstub_breakpoint = hvf_remove_gdbstub_breakpoint;
|
||||
ops->remove_all_gdbstub_breakpoints = hvf_remove_all_gdbstub_breakpoints;
|
||||
ops->update_guest_debug = hvf_update_guest_debug;
|
||||
|
||||
ops->get_vcpu_stats = hvf_get_vcpu_stats;
|
||||
};
|
||||
|
||||
static const TypeInfo hvf_accel_ops_type = {
|
||||
.name = ACCEL_OPS_NAME("hvf"),
|
||||
|
||||
.parent = TYPE_ACCEL_OPS,
|
||||
.class_init = hvf_accel_ops_class_init,
|
||||
.abstract = true,
|
||||
};
|
||||
|
||||
static void hvf_accel_ops_register_types(void)
|
||||
{
|
||||
type_register_static(&hvf_accel_ops_type);
|
||||
}
|
||||
|
||||
type_init(hvf_accel_ops_register_types);
|
||||
@@ -0,0 +1,299 @@
|
||||
/*
|
||||
* QEMU Hypervisor.framework support
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2. See
|
||||
* the COPYING file in the top-level directory.
|
||||
*
|
||||
* Contributions after 2012-01-13 are licensed under the terms of the
|
||||
* GNU GPL, version 2 or (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qapi/qapi-visit-common.h"
|
||||
#include "accel/accel-ops.h"
|
||||
#include "exec/cpu-common.h"
|
||||
#include "system/address-spaces.h"
|
||||
#include "system/memory.h"
|
||||
#include "system/hvf.h"
|
||||
#include "system/hvf_int.h"
|
||||
#include "hw/core/cpu.h"
|
||||
#include "hw/core/boards.h"
|
||||
#include "trace.h"
|
||||
|
||||
bool hvf_allowed;
|
||||
bool hvf_kernel_irqchip;
|
||||
bool hvf_nested_virt;
|
||||
static bool hvf_kernel_irqchip_override;
|
||||
|
||||
void hvf_nested_virt_enable(bool nested_virt)
|
||||
{
|
||||
hvf_nested_virt = nested_virt;
|
||||
}
|
||||
|
||||
const char *hvf_return_string(hv_return_t ret)
|
||||
{
|
||||
switch (ret) {
|
||||
case HV_SUCCESS: return "HV_SUCCESS";
|
||||
case HV_ERROR: return "HV_ERROR";
|
||||
case HV_BUSY: return "HV_BUSY";
|
||||
case HV_BAD_ARGUMENT: return "HV_BAD_ARGUMENT";
|
||||
case HV_NO_RESOURCES: return "HV_NO_RESOURCES";
|
||||
case HV_NO_DEVICE: return "HV_NO_DEVICE";
|
||||
case HV_UNSUPPORTED: return "HV_UNSUPPORTED";
|
||||
case HV_DENIED: return "HV_DENIED";
|
||||
default: return "[unknown hv_return value]";
|
||||
}
|
||||
}
|
||||
|
||||
void assert_hvf_ok_impl(hv_return_t ret, const char *file, unsigned int line,
|
||||
const char *exp)
|
||||
{
|
||||
if (ret == HV_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
|
||||
error_report("Error: %s = %s (0x%x, at %s:%u)",
|
||||
exp, hvf_return_string(ret), ret, file, line);
|
||||
|
||||
abort();
|
||||
}
|
||||
|
||||
static void do_hv_vm_protect(hwaddr start, size_t size,
|
||||
hv_memory_flags_t flags)
|
||||
{
|
||||
intptr_t page_mask = qemu_real_host_page_mask();
|
||||
hv_return_t ret;
|
||||
|
||||
trace_hvf_vm_protect(start, size, flags,
|
||||
flags & HV_MEMORY_READ ? 'R' : '-',
|
||||
flags & HV_MEMORY_WRITE ? 'W' : '-',
|
||||
flags & HV_MEMORY_EXEC ? 'X' : '-');
|
||||
g_assert(!((uintptr_t)start & ~page_mask));
|
||||
g_assert(!(size & ~page_mask));
|
||||
|
||||
ret = hv_vm_protect(start, size, flags);
|
||||
assert_hvf_ok(ret);
|
||||
}
|
||||
|
||||
void hvf_protect_clean_range(hwaddr addr, size_t size)
|
||||
{
|
||||
do_hv_vm_protect(addr, size, HV_MEMORY_READ | HV_MEMORY_EXEC);
|
||||
}
|
||||
|
||||
void hvf_unprotect_dirty_range(hwaddr addr, size_t size)
|
||||
{
|
||||
do_hv_vm_protect(addr, size,
|
||||
HV_MEMORY_READ | HV_MEMORY_WRITE | HV_MEMORY_EXEC);
|
||||
}
|
||||
|
||||
static void hvf_set_phys_mem(MemoryRegionSection *section, bool add)
|
||||
{
|
||||
MemoryRegion *area = section->mr;
|
||||
bool writable = !area->readonly && !area->rom_device;
|
||||
hv_memory_flags_t flags;
|
||||
uint64_t page_size = qemu_real_host_page_size();
|
||||
uint64_t gpa = section->offset_within_address_space;
|
||||
uint64_t size = int128_get64(section->size);
|
||||
hv_return_t ret;
|
||||
void *mem;
|
||||
|
||||
if (!memory_region_is_ram(area)) {
|
||||
if (writable) {
|
||||
return;
|
||||
} else if (!memory_region_is_romd(area)) {
|
||||
/*
|
||||
* If the memory device is not in romd_mode, then we actually want
|
||||
* to remove the hvf memory slot so all accesses will trap.
|
||||
*/
|
||||
add = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!QEMU_IS_ALIGNED(size, page_size) ||
|
||||
!QEMU_IS_ALIGNED(gpa, page_size)) {
|
||||
/* Not page aligned, so we can not map as RAM */
|
||||
add = false;
|
||||
}
|
||||
|
||||
if (!add) {
|
||||
trace_hvf_vm_unmap(gpa, size);
|
||||
ret = hv_vm_unmap(gpa, size);
|
||||
assert_hvf_ok(ret);
|
||||
return;
|
||||
}
|
||||
|
||||
flags = HV_MEMORY_READ | HV_MEMORY_EXEC | (writable ? HV_MEMORY_WRITE : 0);
|
||||
mem = memory_region_get_ram_ptr(area) + section->offset_within_region;
|
||||
|
||||
trace_hvf_vm_map(gpa, size, mem, flags,
|
||||
flags & HV_MEMORY_READ ? 'R' : '-',
|
||||
flags & HV_MEMORY_WRITE ? 'W' : '-',
|
||||
flags & HV_MEMORY_EXEC ? 'X' : '-');
|
||||
ret = hv_vm_map(mem, gpa, size, flags);
|
||||
assert_hvf_ok(ret);
|
||||
}
|
||||
|
||||
static void hvf_log_start(MemoryListener *listener,
|
||||
MemoryRegionSection *section, int old, int new)
|
||||
{
|
||||
assert(new != 0);
|
||||
if (old == 0) {
|
||||
hvf_protect_clean_range(section->offset_within_address_space,
|
||||
int128_get64(section->size));
|
||||
}
|
||||
}
|
||||
|
||||
static void hvf_log_stop(MemoryListener *listener,
|
||||
MemoryRegionSection *section, int old, int new)
|
||||
{
|
||||
assert(old != 0);
|
||||
if (new == 0) {
|
||||
hvf_unprotect_dirty_range(section->offset_within_address_space,
|
||||
int128_get64(section->size));
|
||||
}
|
||||
}
|
||||
|
||||
static void hvf_log_clear(MemoryListener *listener,
|
||||
MemoryRegionSection *section)
|
||||
{
|
||||
/*
|
||||
* The dirty page bits within section are being cleared.
|
||||
* Some number of those pages may have been dirtied and
|
||||
* the write permission enabled. Reset the range read-only.
|
||||
*/
|
||||
hvf_protect_clean_range(section->offset_within_address_space,
|
||||
int128_get64(section->size));
|
||||
}
|
||||
|
||||
static void hvf_region_add(MemoryListener *listener,
|
||||
MemoryRegionSection *section)
|
||||
{
|
||||
hvf_set_phys_mem(section, true);
|
||||
}
|
||||
|
||||
static void hvf_region_del(MemoryListener *listener,
|
||||
MemoryRegionSection *section)
|
||||
{
|
||||
hvf_set_phys_mem(section, false);
|
||||
}
|
||||
|
||||
static MemoryListener hvf_memory_listener = {
|
||||
.name = "hvf",
|
||||
.priority = MEMORY_LISTENER_PRIORITY_ACCEL,
|
||||
.region_add = hvf_region_add,
|
||||
.region_del = hvf_region_del,
|
||||
.log_start = hvf_log_start,
|
||||
.log_stop = hvf_log_stop,
|
||||
.log_clear = hvf_log_clear,
|
||||
};
|
||||
|
||||
static int hvf_accel_init(AccelState *as, MachineState *ms)
|
||||
{
|
||||
hv_return_t ret;
|
||||
HVFState *s = HVF_STATE(as);
|
||||
int pa_range = 36;
|
||||
MachineClass *mc = MACHINE_GET_CLASS(ms);
|
||||
|
||||
|
||||
if (mc->get_physical_address_range) {
|
||||
pa_range = mc->get_physical_address_range(ms,
|
||||
hvf_arch_get_default_ipa_bit_size(), hvf_arch_get_max_ipa_bit_size());
|
||||
if (pa_range < 0) {
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
if (mc->get_kernel_irqchip_default) {
|
||||
bool kernel_irqchip_default = mc->get_kernel_irqchip_default(ms);
|
||||
if (!hvf_kernel_irqchip_override) {
|
||||
hvf_kernel_irqchip = kernel_irqchip_default;
|
||||
}
|
||||
}
|
||||
|
||||
ret = hvf_arch_vm_create(ms, (uint32_t)pa_range);
|
||||
if (ret == HV_DENIED) {
|
||||
error_report("Could not access HVF. Is the executable signed"
|
||||
" with com.apple.security.hypervisor entitlement?");
|
||||
exit(1);
|
||||
}
|
||||
assert_hvf_ok(ret);
|
||||
|
||||
as->gdbstub.sstep_flags = SSTEP_ENABLE | SSTEP_NOIRQ;
|
||||
|
||||
QTAILQ_INIT(&s->hvf_sw_breakpoints);
|
||||
|
||||
hvf_state = s;
|
||||
memory_listener_register(&hvf_memory_listener, &address_space_memory);
|
||||
|
||||
return hvf_arch_init();
|
||||
}
|
||||
|
||||
static void hvf_set_kernel_irqchip(Object *obj, Visitor *v,
|
||||
const char *name, void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
OnOffSplit mode;
|
||||
|
||||
hvf_kernel_irqchip_override = true;
|
||||
if (!visit_type_OnOffSplit(v, name, &mode, errp)) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (mode) {
|
||||
case ON_OFF_SPLIT_ON:
|
||||
#ifdef HOST_X86_64
|
||||
/* macOS 12 onwards exposes an HVF virtual APIC. */
|
||||
error_setg(errp, "HVF: kernel irqchip is not currently implemented for x86.");
|
||||
break;
|
||||
#else
|
||||
hvf_kernel_irqchip = true;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case ON_OFF_SPLIT_OFF:
|
||||
hvf_kernel_irqchip = false;
|
||||
break;
|
||||
|
||||
case ON_OFF_SPLIT_SPLIT:
|
||||
error_setg(errp, "HVF: split irqchip is not supported on HVF.");
|
||||
break;
|
||||
|
||||
default:
|
||||
/*
|
||||
* The value was checked in visit_type_OnOffSplit() above. If
|
||||
* we get here, then something is wrong in QEMU.
|
||||
*/
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
static void hvf_accel_class_init(ObjectClass *oc, const void *data)
|
||||
{
|
||||
AccelClass *ac = ACCEL_CLASS(oc);
|
||||
ac->name = "HVF";
|
||||
ac->init_machine = hvf_accel_init;
|
||||
ac->allowed = &hvf_allowed;
|
||||
hvf_kernel_irqchip_override = false;
|
||||
hvf_kernel_irqchip = false;
|
||||
object_class_property_add(oc, "kernel-irqchip", "on|off|split",
|
||||
NULL, hvf_set_kernel_irqchip,
|
||||
NULL, NULL);
|
||||
object_class_property_set_description(oc, "kernel-irqchip",
|
||||
"Configure HVF irqchip");
|
||||
}
|
||||
|
||||
static const TypeInfo hvf_accel_type = {
|
||||
.name = TYPE_HVF_ACCEL,
|
||||
.parent = TYPE_ACCEL,
|
||||
.instance_size = sizeof(HVFState),
|
||||
.class_init = hvf_accel_class_init,
|
||||
};
|
||||
|
||||
static void hvf_type_init(void)
|
||||
{
|
||||
type_register_static(&hvf_accel_type);
|
||||
}
|
||||
|
||||
type_init(hvf_type_init);
|
||||
@@ -0,0 +1,4 @@
|
||||
system_ss.add(when: 'CONFIG_HVF', if_true: files(
|
||||
'hvf-all.c',
|
||||
'hvf-accel-ops.c',
|
||||
))
|
||||
@@ -0,0 +1,8 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
#
|
||||
# See docs/devel/tracing.rst for syntax documentation.
|
||||
|
||||
# hvf-accel-ops.c
|
||||
hvf_vm_map(uint64_t paddr, uint64_t size, void *vaddr, uint8_t flags, const char r, const char w, const char e) "paddr:0x%016"PRIx64" size:0x%08"PRIx64" vaddr:%p flags:0x%02x/%c%c%c"
|
||||
hvf_vm_unmap(uint64_t paddr, uint64_t size) "paddr:0x%016"PRIx64" size:0x%08"PRIx64
|
||||
hvf_vm_protect(uint64_t paddr, size_t size, uint8_t flags, const char r, const char w, const char e) "paddr:0x%016"PRIx64" size:0x%08zx flags:0x%02x/%c%c%c"
|
||||
@@ -0,0 +1,2 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
#include "trace/trace-accel_hvf.h"
|
||||
@@ -0,0 +1,128 @@
|
||||
/*
|
||||
* QEMU KVM support
|
||||
*
|
||||
* Copyright IBM, Corp. 2008
|
||||
* Red Hat, Inc. 2008
|
||||
*
|
||||
* Authors:
|
||||
* Anthony Liguori <[email protected]>
|
||||
* Glauber Costa <[email protected]>
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
||||
* See the COPYING file in the top-level directory.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/main-loop.h"
|
||||
#include "exec/cpu-common.h"
|
||||
#include "accel/accel-cpu-ops.h"
|
||||
#include "system/kvm.h"
|
||||
#include "system/kvm_int.h"
|
||||
#include "system/runstate.h"
|
||||
#include "system/cpus.h"
|
||||
#include "qemu/guest-random.h"
|
||||
#include "qapi/error.h"
|
||||
|
||||
#include <linux/kvm.h>
|
||||
#include "kvm-cpus.h"
|
||||
|
||||
static void *kvm_vcpu_thread_fn(void *arg)
|
||||
{
|
||||
CPUState *cpu = arg;
|
||||
int r;
|
||||
|
||||
rcu_register_thread();
|
||||
|
||||
bql_lock();
|
||||
qemu_thread_get_self(cpu->thread);
|
||||
cpu->thread_id = qemu_get_thread_id();
|
||||
current_cpu = cpu;
|
||||
|
||||
r = kvm_init_vcpu(cpu, &error_fatal);
|
||||
kvm_init_cpu_signals(cpu);
|
||||
|
||||
/* signal CPU creation */
|
||||
cpu_thread_signal_created(cpu);
|
||||
qemu_guest_random_seed_thread_part2(cpu->random_seed);
|
||||
|
||||
do {
|
||||
qemu_process_cpu_events(cpu);
|
||||
|
||||
if (cpu_can_run(cpu)) {
|
||||
r = kvm_cpu_exec(cpu);
|
||||
if (r == EXCP_DEBUG) {
|
||||
cpu_handle_guest_debug(cpu);
|
||||
}
|
||||
}
|
||||
} while (!cpu->unplug || cpu_can_run(cpu));
|
||||
|
||||
kvm_destroy_vcpu(cpu);
|
||||
cpu_thread_signal_destroyed(cpu);
|
||||
bql_unlock();
|
||||
rcu_unregister_thread();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void kvm_start_vcpu_thread(CPUState *cpu)
|
||||
{
|
||||
char thread_name[VCPU_THREAD_NAME_SIZE];
|
||||
|
||||
snprintf(thread_name, VCPU_THREAD_NAME_SIZE, "CPU %d/KVM",
|
||||
cpu->cpu_index);
|
||||
qemu_thread_create(cpu->thread, thread_name, kvm_vcpu_thread_fn,
|
||||
cpu, QEMU_THREAD_JOINABLE);
|
||||
}
|
||||
|
||||
static bool kvm_vcpu_thread_is_idle(CPUState *cpu)
|
||||
{
|
||||
return !kvm_halt_in_kernel();
|
||||
}
|
||||
|
||||
static bool kvm_cpus_are_resettable(void)
|
||||
{
|
||||
return !kvm_enabled() || !kvm_state->guest_state_protected;
|
||||
}
|
||||
|
||||
#ifdef TARGET_KVM_HAVE_GUEST_DEBUG
|
||||
static int kvm_update_guest_debug_ops(CPUState *cpu)
|
||||
{
|
||||
return kvm_update_guest_debug(cpu, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void kvm_accel_ops_class_init(ObjectClass *oc, const void *data)
|
||||
{
|
||||
AccelOpsClass *ops = ACCEL_OPS_CLASS(oc);
|
||||
|
||||
ops->create_vcpu_thread = kvm_start_vcpu_thread;
|
||||
ops->cpu_thread_is_idle = kvm_vcpu_thread_is_idle;
|
||||
ops->cpus_are_resettable = kvm_cpus_are_resettable;
|
||||
ops->synchronize_post_reset = kvm_cpu_synchronize_post_reset;
|
||||
ops->synchronize_post_init = kvm_cpu_synchronize_post_init;
|
||||
ops->synchronize_state = kvm_cpu_synchronize_state;
|
||||
ops->synchronize_pre_loadvm = kvm_cpu_synchronize_pre_loadvm;
|
||||
ops->handle_interrupt = generic_handle_interrupt;
|
||||
|
||||
#ifdef TARGET_KVM_HAVE_GUEST_DEBUG
|
||||
ops->update_guest_debug = kvm_update_guest_debug_ops;
|
||||
ops->insert_gdbstub_breakpoint = kvm_insert_gdbstub_breakpoint;
|
||||
ops->remove_gdbstub_breakpoint = kvm_remove_gdbstub_breakpoint;
|
||||
ops->remove_all_gdbstub_breakpoints = kvm_remove_all_gdbstub_breakpoints;
|
||||
#endif
|
||||
}
|
||||
|
||||
static const TypeInfo kvm_accel_ops_type = {
|
||||
.name = ACCEL_OPS_NAME("kvm"),
|
||||
|
||||
.parent = TYPE_ACCEL_OPS,
|
||||
.class_init = kvm_accel_ops_class_init,
|
||||
.abstract = true,
|
||||
};
|
||||
|
||||
static void kvm_accel_ops_register_types(void)
|
||||
{
|
||||
type_register_static(&kvm_accel_ops_type);
|
||||
}
|
||||
type_init(kvm_accel_ops_register_types);
|
||||
+4766
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Accelerator CPUS Interface
|
||||
*
|
||||
* Copyright 2020 SUSE LLC
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
||||
* See the COPYING file in the top-level directory.
|
||||
*/
|
||||
|
||||
#ifndef KVM_CPUS_H
|
||||
#define KVM_CPUS_H
|
||||
|
||||
#include "gdbstub/enums.h"
|
||||
|
||||
int kvm_init_vcpu(CPUState *cpu, Error **errp);
|
||||
int kvm_cpu_exec(CPUState *cpu);
|
||||
void kvm_destroy_vcpu(CPUState *cpu);
|
||||
void kvm_cpu_synchronize_post_reset(CPUState *cpu);
|
||||
void kvm_cpu_synchronize_post_init(CPUState *cpu);
|
||||
void kvm_cpu_synchronize_pre_loadvm(CPUState *cpu);
|
||||
int kvm_insert_gdbstub_breakpoint(CPUState *cpu, GdbBreakpointType type,
|
||||
vaddr addr, vaddr len);
|
||||
int kvm_remove_gdbstub_breakpoint(CPUState *cpu, GdbBreakpointType type,
|
||||
vaddr addr, vaddr len);
|
||||
void kvm_remove_all_gdbstub_breakpoints(CPUState *cpu);
|
||||
|
||||
#endif /* KVM_CPUS_H */
|
||||
@@ -0,0 +1,7 @@
|
||||
kvm_ss = ss.source_set()
|
||||
kvm_ss.add(files(
|
||||
'kvm-all.c',
|
||||
'kvm-accel-ops.c',
|
||||
))
|
||||
|
||||
specific_ss.add_all(when: 'CONFIG_KVM', if_true: kvm_ss)
|
||||
@@ -0,0 +1,41 @@
|
||||
# See docs/devel/tracing.rst for syntax documentation.
|
||||
|
||||
# kvm-all.c
|
||||
kvm_ioctl(unsigned long type, void *arg) "type 0x%lx, arg %p"
|
||||
kvm_vm_ioctl(unsigned long type, void *arg) "type 0x%lx, arg %p"
|
||||
kvm_vcpu_ioctl(int cpu_index, unsigned long type, void *arg) "cpu_index %d, type 0x%lx, arg %p"
|
||||
kvm_run_exit(int cpu_index, uint32_t reason) "cpu_index %d, reason %d"
|
||||
kvm_device_ioctl(int fd, unsigned long type, void *arg) "dev fd %d, type 0x%lx, arg %p"
|
||||
kvm_failed_reg_get(uint64_t id, const char *msg) "Warning: Unable to retrieve ONEREG %" PRIu64 " from KVM: %s"
|
||||
kvm_failed_reg_set(uint64_t id, const char *msg) "Warning: Unable to set ONEREG %" PRIu64 " to KVM: %s"
|
||||
kvm_init_vcpu(int cpu_index, unsigned long arch_cpu_id) "index: %d id: %lu"
|
||||
kvm_create_vcpu(int cpu_index, unsigned long arch_cpu_id, int kvm_fd) "index: %d, id: %lu, kvm fd: %d"
|
||||
kvm_destroy_vcpu(int cpu_index, unsigned long arch_cpu_id) "index: %d id: %lu"
|
||||
kvm_park_vcpu(int cpu_index, unsigned long arch_cpu_id) "index: %d id: %lu"
|
||||
kvm_unpark_vcpu(unsigned long arch_cpu_id, const char *msg) "id: %lu %s"
|
||||
kvm_irqchip_commit_routes(void) ""
|
||||
kvm_reset_vmfd(void) ""
|
||||
kvm_rebind_vcpus(void) ""
|
||||
kvm_irqchip_add_msi_route(char *name, int vector, int virq) "dev %s vector %d virq %d"
|
||||
kvm_irqchip_update_msi_route(int virq) "Updating MSI route virq=%d"
|
||||
kvm_irqchip_release_virq(int virq) "virq %d"
|
||||
kvm_set_ioeventfd_mmio(int fd, uint64_t addr, uint32_t val, bool assign, uint32_t size, bool datamatch) "fd: %d @0x%" PRIx64 " val=0x%x assign: %d size: %d match: %d"
|
||||
kvm_set_ioeventfd_pio(int fd, uint16_t addr, uint32_t val, bool assign, uint32_t size, bool datamatch) "fd: %d @0x%x val=0x%x assign: %d size: %d match: %d"
|
||||
kvm_set_user_memory(uint16_t as, uint16_t slot, uint32_t flags, uint64_t guest_phys_addr, uint64_t memory_size, uint64_t userspace_addr, uint32_t fd, uint64_t fd_offset, int ret) "AddrSpace#%d Slot#%d flags=0x%x gpa=0x%"PRIx64 " size=0x%"PRIx64 " ua=0x%"PRIx64 " guest_memfd=%d" " guest_memfd_offset=0x%" PRIx64 " ret=%d"
|
||||
kvm_clear_dirty_log(uint32_t slot, uint64_t start, uint32_t size) "slot#%"PRId32" start 0x%"PRIx64" size 0x%"PRIx32
|
||||
kvm_resample_fd_notify(int gsi) "gsi %d"
|
||||
kvm_dirty_ring_full(int id) "vcpu %d"
|
||||
kvm_dirty_ring_reap_vcpu(int id) "vcpu %d"
|
||||
kvm_dirty_ring_page(int vcpu, uint32_t slot, uint64_t offset) "vcpu %d fetch %"PRIu32" offset 0x%"PRIx64
|
||||
kvm_dirty_ring_reaper(const char *s) "%s"
|
||||
kvm_dirty_ring_reap(uint64_t count, int64_t t) "reaped %"PRIu64" pages (took %"PRIi64" us)"
|
||||
kvm_dirty_ring_reaper_kick(const char *reason) "%s"
|
||||
kvm_dirty_ring_flush(int finished) "%d"
|
||||
kvm_failed_get_vcpu_mmap_size(void) ""
|
||||
kvm_cpu_exec(void) ""
|
||||
kvm_interrupt_exit_request(void) ""
|
||||
kvm_io_window_exit(void) ""
|
||||
kvm_run_exit_system_event(int cpu_index, uint32_t event_type) "cpu_index %d, system_even_type %"PRIu32
|
||||
kvm_convert_memory(uint64_t start, uint64_t size, const char *msg) "start 0x%" PRIx64 " size 0x%" PRIx64 " %s"
|
||||
kvm_memory_fault(uint64_t start, uint64_t size, uint64_t flags) "start 0x%" PRIx64 " size 0x%" PRIx64 " flags 0x%" PRIx64
|
||||
kvm_slots_grow(unsigned int old, unsigned int new) "%u -> %u"
|
||||
@@ -0,0 +1 @@
|
||||
#include "trace/trace-accel_kvm.h"
|
||||
@@ -0,0 +1,18 @@
|
||||
common_ss.add(files('accel-common.c'))
|
||||
system_ss.add(files('accel-system.c', 'accel-blocker.c', 'accel-qmp.c', 'accel-irq.c'))
|
||||
user_ss.add(files('accel-user.c'))
|
||||
|
||||
subdir('tcg')
|
||||
if have_system
|
||||
subdir('hvf')
|
||||
subdir('whpx')
|
||||
subdir('qtest')
|
||||
subdir('kvm')
|
||||
subdir('xen')
|
||||
subdir('stubs')
|
||||
subdir('mshv')
|
||||
subdir('nitro')
|
||||
endif
|
||||
|
||||
# qtest
|
||||
system_ss.add(files('dummy-cpus.c'))
|
||||
@@ -0,0 +1,366 @@
|
||||
/*
|
||||
* QEMU MSHV support
|
||||
*
|
||||
* Copyright Microsoft, Corp. 2025
|
||||
*
|
||||
* Authors: Ziqiao Zhou <[email protected]>
|
||||
* Magnus Kulke <[email protected]>
|
||||
* Stanislav Kinsburskii <[email protected]>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "linux/mshv.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "hw/hyperv/hvhdk_mini.h"
|
||||
#include "hw/hyperv/hvgdk_mini.h"
|
||||
#include "hw/intc/ioapic.h"
|
||||
#include "hw/pci/msi.h"
|
||||
#include "system/mshv.h"
|
||||
#include "system/mshv_int.h"
|
||||
#include "trace.h"
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#define MSHV_IRQFD_RESAMPLE_FLAG (1 << MSHV_IRQFD_BIT_RESAMPLE)
|
||||
#define MSHV_IRQFD_BIT_DEASSIGN_FLAG (1 << MSHV_IRQFD_BIT_DEASSIGN)
|
||||
|
||||
/* Pass an eventfd which is to be used for injecting interrupts from userland */
|
||||
static int irqfd(int vm_fd, int fd, int resample_fd, uint32_t gsi,
|
||||
uint32_t flags)
|
||||
{
|
||||
int ret;
|
||||
struct mshv_user_irqfd arg = {
|
||||
.fd = fd,
|
||||
.resamplefd = resample_fd,
|
||||
.gsi = gsi,
|
||||
.flags = flags,
|
||||
};
|
||||
|
||||
ret = ioctl(vm_fd, MSHV_IRQFD, &arg);
|
||||
if (ret < 0) {
|
||||
error_report("Failed to set irqfd: gsi=%u, fd=%d", gsi, fd);
|
||||
return -1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int register_irqfd(int vm_fd, int event_fd, uint32_t gsi)
|
||||
{
|
||||
int ret;
|
||||
|
||||
trace_mshv_register_irqfd(vm_fd, event_fd, gsi);
|
||||
|
||||
ret = irqfd(vm_fd, event_fd, 0, gsi, 0);
|
||||
if (ret < 0) {
|
||||
error_report("Failed to register irqfd: gsi=%u", gsi);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int register_irqfd_with_resample(int vm_fd, int event_fd,
|
||||
int resample_fd, uint32_t gsi)
|
||||
{
|
||||
int ret;
|
||||
uint32_t flags = MSHV_IRQFD_RESAMPLE_FLAG;
|
||||
|
||||
ret = irqfd(vm_fd, event_fd, resample_fd, gsi, flags);
|
||||
if (ret < 0) {
|
||||
error_report("Failed to register irqfd with resample: gsi=%u", gsi);
|
||||
return -errno;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int unregister_irqfd(int vm_fd, int event_fd, uint32_t gsi)
|
||||
{
|
||||
int ret;
|
||||
uint32_t flags = MSHV_IRQFD_BIT_DEASSIGN_FLAG;
|
||||
|
||||
ret = irqfd(vm_fd, event_fd, 0, gsi, flags);
|
||||
if (ret < 0) {
|
||||
error_report("Failed to unregister irqfd: gsi=%u", gsi);
|
||||
return -errno;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int irqchip_update_irqfd_notifier_gsi(const EventNotifier *event,
|
||||
const EventNotifier *resample,
|
||||
int virq, bool add)
|
||||
{
|
||||
int fd = event_notifier_get_fd(event);
|
||||
int rfd = resample ? event_notifier_get_fd(resample) : -1;
|
||||
int vm_fd = mshv_state->vm;
|
||||
|
||||
trace_mshv_irqchip_update_irqfd_notifier_gsi(fd, rfd, virq, add);
|
||||
|
||||
if (!add) {
|
||||
return unregister_irqfd(vm_fd, fd, virq);
|
||||
}
|
||||
|
||||
if (rfd > 0) {
|
||||
return register_irqfd_with_resample(vm_fd, fd, rfd, virq);
|
||||
}
|
||||
|
||||
return register_irqfd(vm_fd, fd, virq);
|
||||
}
|
||||
|
||||
static int irqchip_allocate_gsi(MshvState *s, int *gsi)
|
||||
{
|
||||
int next_gsi;
|
||||
|
||||
/* Return the lowest unused GSI in the bitmap */
|
||||
next_gsi = find_first_zero_bit(s->used_gsi_bitmap, s->gsi_count);
|
||||
if (next_gsi >= s->gsi_count) {
|
||||
return -ENOSPC;
|
||||
}
|
||||
|
||||
*gsi = next_gsi;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void irqchip_release_gsi(MshvState *s, int gsi)
|
||||
{
|
||||
clear_bit(gsi, s->used_gsi_bitmap);
|
||||
}
|
||||
|
||||
static void add_routing_entry(MshvState *s, struct mshv_user_irq_entry *entry)
|
||||
{
|
||||
struct mshv_user_irq_entry *new;
|
||||
int n, size;
|
||||
|
||||
if (s->irq_routes->nr == s->nr_allocated_irq_routes) {
|
||||
n = s->nr_allocated_irq_routes * 2;
|
||||
if (n < MSHV_MIN_ALLOCATED_MSI_ROUTES) {
|
||||
n = MSHV_MIN_ALLOCATED_MSI_ROUTES;
|
||||
}
|
||||
size = sizeof(struct mshv_user_irq_table);
|
||||
size += n * sizeof(*new);
|
||||
s->irq_routes = g_realloc(s->irq_routes, size);
|
||||
s->nr_allocated_irq_routes = n;
|
||||
}
|
||||
|
||||
n = s->irq_routes->nr;
|
||||
s->irq_routes->nr++;
|
||||
new = &s->irq_routes->entries[n];
|
||||
|
||||
*new = *entry;
|
||||
|
||||
set_bit(entry->gsi, s->used_gsi_bitmap);
|
||||
|
||||
trace_mshv_add_msi_routing(entry->address_lo | entry->address_hi,
|
||||
entry->data);
|
||||
}
|
||||
|
||||
int mshv_irqchip_add_msi_route(AccelRouteChange *c, int vector, PCIDevice *dev)
|
||||
{
|
||||
struct mshv_user_irq_entry entry = { 0 };
|
||||
MSIMessage msg = { 0 };
|
||||
uint32_t data, high_addr, low_addr;
|
||||
int gsi, ret;
|
||||
MshvState *s = MSHV_STATE(c->accel);
|
||||
|
||||
if (!pci_available || !dev) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
msg = pci_get_msi_message(dev, vector);
|
||||
|
||||
ret = irqchip_allocate_gsi(mshv_state, &gsi);
|
||||
if (ret < 0) {
|
||||
error_report("Could not allocate GSI for MSI route");
|
||||
return -1;
|
||||
}
|
||||
high_addr = msg.address >> 32;
|
||||
low_addr = msg.address & 0xFFFFFFFF;
|
||||
data = le32_to_cpu(msg.data);
|
||||
|
||||
entry.gsi = gsi;
|
||||
entry.address_hi = high_addr;
|
||||
entry.address_lo = low_addr;
|
||||
entry.data = data;
|
||||
|
||||
if (s->irq_routes->nr < s->gsi_count) {
|
||||
add_routing_entry(s, &entry);
|
||||
c->changes++;
|
||||
} else {
|
||||
irqchip_release_gsi(s, gsi);
|
||||
return -ENOSPC;
|
||||
}
|
||||
|
||||
return gsi;
|
||||
}
|
||||
|
||||
void mshv_irqchip_release_virq(MshvState *s, int virq)
|
||||
{
|
||||
struct mshv_user_irq_entry *e;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < s->irq_routes->nr; i++) {
|
||||
e = &s->irq_routes->entries[i];
|
||||
if (e->gsi == virq) {
|
||||
s->irq_routes->nr--;
|
||||
*e = s->irq_routes->entries[s->irq_routes->nr];
|
||||
}
|
||||
}
|
||||
irqchip_release_gsi(s, virq);
|
||||
|
||||
trace_mshv_remove_msi_routing(virq);
|
||||
}
|
||||
|
||||
static int update_routing_entry(MshvState *s,
|
||||
struct mshv_user_irq_entry *new_entry)
|
||||
{
|
||||
struct mshv_user_irq_entry *entry;
|
||||
int n;
|
||||
|
||||
for (n = 0; n < s->irq_routes->nr; n++) {
|
||||
entry = &s->irq_routes->entries[n];
|
||||
if (entry->gsi != new_entry->gsi) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!memcmp(entry, new_entry, sizeof *entry)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
*entry = *new_entry;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -ESRCH;
|
||||
}
|
||||
|
||||
int mshv_irqchip_update_msi_route(int virq, MSIMessage msg, PCIDevice *dev)
|
||||
{
|
||||
uint32_t addr_hi = msg.address >> 32;
|
||||
uint32_t addr_lo = msg.address & 0xFFFFFFFF;
|
||||
uint32_t data = le32_to_cpu(msg.data);
|
||||
struct mshv_user_irq_entry entry = {
|
||||
.gsi = virq,
|
||||
.address_hi = addr_hi,
|
||||
.address_lo = addr_lo,
|
||||
.data = data,
|
||||
};
|
||||
int ret;
|
||||
|
||||
ret = update_routing_entry(mshv_state, &entry);
|
||||
if (ret < 0) {
|
||||
error_report("Failed to set msi routing for gsi %d", virq);
|
||||
abort();
|
||||
}
|
||||
|
||||
trace_mshv_set_msi_routing(virq, msg.address, data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mshv_request_interrupt(MshvState *mshv_state, uint32_t interrupt_type, uint32_t vector,
|
||||
uint32_t vp_index, bool logical_dest_mode,
|
||||
bool level_triggered)
|
||||
{
|
||||
int ret;
|
||||
int vm_fd = mshv_state->vm;
|
||||
|
||||
if (vector == 0) {
|
||||
warn_report("Ignoring request for interrupt vector 0");
|
||||
return 0;
|
||||
}
|
||||
|
||||
union hv_interrupt_control control = {
|
||||
.interrupt_type = interrupt_type,
|
||||
.level_triggered = level_triggered,
|
||||
.logical_dest_mode = logical_dest_mode,
|
||||
.rsvd = 0,
|
||||
};
|
||||
|
||||
struct hv_input_assert_virtual_interrupt arg = {0};
|
||||
arg.control = control;
|
||||
arg.dest_addr = (uint64_t)vp_index;
|
||||
arg.vector = vector;
|
||||
|
||||
struct mshv_root_hvcall args = {0};
|
||||
args.code = HVCALL_ASSERT_VIRTUAL_INTERRUPT;
|
||||
args.in_sz = sizeof(arg);
|
||||
args.in_ptr = (uint64_t)&arg;
|
||||
|
||||
ret = mshv_hvcall(vm_fd, &args);
|
||||
if (ret < 0) {
|
||||
error_report("Failed to request interrupt");
|
||||
return -errno;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void mshv_irqchip_commit_routes(MshvState *s)
|
||||
{
|
||||
int ret;
|
||||
int vm_fd = s->vm;
|
||||
|
||||
ret = ioctl(vm_fd, MSHV_SET_MSI_ROUTING, s->irq_routes);
|
||||
if (ret < 0) {
|
||||
error_report("Failed to commit msi routing table");
|
||||
abort();
|
||||
}
|
||||
trace_mshv_commit_msi_routing_table(vm_fd, s->irq_routes->nr);
|
||||
}
|
||||
|
||||
int mshv_irqchip_add_irqfd_notifier_gsi(const EventNotifier *event,
|
||||
const EventNotifier *resample,
|
||||
int virq)
|
||||
{
|
||||
return irqchip_update_irqfd_notifier_gsi(event, resample, virq, true);
|
||||
}
|
||||
|
||||
int mshv_irqchip_remove_irqfd_notifier_gsi(const EventNotifier *event,
|
||||
int virq)
|
||||
{
|
||||
return irqchip_update_irqfd_notifier_gsi(event, NULL, virq, false);
|
||||
}
|
||||
|
||||
static int mshv_reserve_ioapic_msi_routes(MshvState *s)
|
||||
{
|
||||
int ret, i;
|
||||
int gsi = 0;
|
||||
struct mshv_user_irq_entry blank_entry = { 0 };
|
||||
|
||||
/*
|
||||
* Reserve GSI 0-23 for IOAPIC pins, to avoid conflicts of legacy
|
||||
* peripherals with MSI-X devices
|
||||
*/
|
||||
for (i = 0; i < IOAPIC_NUM_PINS; i++) {
|
||||
/* ret = add_msi_routing(0, 0); */
|
||||
ret = irqchip_allocate_gsi(s, &gsi);
|
||||
if (ret < 0) {
|
||||
error_report("Failed to reserve GSI %d: %s", gsi, strerror(-ret));
|
||||
return -1;
|
||||
}
|
||||
blank_entry.gsi = gsi;
|
||||
add_routing_entry(s, &blank_entry);
|
||||
}
|
||||
|
||||
mshv_irqchip_commit_routes(s);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void mshv_init_irq_routing(MshvState *s)
|
||||
{
|
||||
int ret;
|
||||
int gsi_count = MSHV_MAX_MSI_ROUTES;
|
||||
|
||||
s->irq_routes = g_malloc0(sizeof(*s->irq_routes));
|
||||
s->nr_allocated_irq_routes = 0;
|
||||
s->gsi_count = gsi_count;
|
||||
s->used_gsi_bitmap = bitmap_new(gsi_count);
|
||||
|
||||
ret = mshv_reserve_ioapic_msi_routes(s);
|
||||
if (ret < 0) {
|
||||
error_report("Failed to reserve IOAPIC MSI routes");
|
||||
abort();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,424 @@
|
||||
/*
|
||||
* QEMU MSHV support
|
||||
*
|
||||
* Copyright Microsoft, Corp. 2025
|
||||
*
|
||||
* Authors:
|
||||
* Magnus Kulke <[email protected]>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qapi/error.h"
|
||||
#include "linux/mshv.h"
|
||||
#include "system/address-spaces.h"
|
||||
#include "system/mshv.h"
|
||||
#include "system/mshv_int.h"
|
||||
#include "hw/hyperv/hvhdk_mini.h"
|
||||
#include "system/physmem.h"
|
||||
#include "exec/memattrs.h"
|
||||
#include <sys/ioctl.h>
|
||||
#include "trace.h"
|
||||
|
||||
static int set_guest_memory(int vm_fd,
|
||||
const struct mshv_user_mem_region *region)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = ioctl(vm_fd, MSHV_SET_GUEST_MEMORY, region);
|
||||
if (ret < 0) {
|
||||
error_report("failed to set guest memory");
|
||||
return -errno;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int map_or_unmap(int vm_fd, const MshvMemoryRegion *mr, bool map)
|
||||
{
|
||||
struct mshv_user_mem_region region = {0};
|
||||
|
||||
region.guest_pfn = mr->guest_phys_addr >> MSHV_PAGE_SHIFT;
|
||||
region.size = mr->memory_size;
|
||||
region.userspace_addr = mr->userspace_addr;
|
||||
|
||||
if (!map) {
|
||||
region.flags |= (1 << MSHV_SET_MEM_BIT_UNMAP);
|
||||
trace_mshv_unmap_memory(mr->userspace_addr, mr->guest_phys_addr,
|
||||
mr->memory_size);
|
||||
return set_guest_memory(vm_fd, ®ion);
|
||||
}
|
||||
|
||||
region.flags = BIT(MSHV_SET_MEM_BIT_EXECUTABLE);
|
||||
if (!mr->readonly) {
|
||||
region.flags |= BIT(MSHV_SET_MEM_BIT_WRITABLE);
|
||||
}
|
||||
|
||||
trace_mshv_map_memory(mr->userspace_addr, mr->guest_phys_addr,
|
||||
mr->memory_size);
|
||||
return set_guest_memory(vm_fd, ®ion);
|
||||
}
|
||||
|
||||
static int handle_unmapped_mmio_region_read(uint64_t gpa, uint64_t size,
|
||||
uint8_t *data)
|
||||
{
|
||||
warn_report("read from unmapped mmio region gpa=0x%lx size=%lu", gpa, size);
|
||||
|
||||
if (size == 0 || size > 8) {
|
||||
error_report("invalid size %lu for reading from unmapped mmio region",
|
||||
size);
|
||||
return -1;
|
||||
}
|
||||
|
||||
memset(data, 0xFF, size);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mshv_guest_mem_read(uint64_t gpa, uint8_t *data, uintptr_t size,
|
||||
bool is_secure_mode, bool instruction_fetch)
|
||||
{
|
||||
int ret;
|
||||
MemTxAttrs memattr = { .secure = is_secure_mode };
|
||||
|
||||
if (instruction_fetch) {
|
||||
trace_mshv_insn_fetch(gpa, size);
|
||||
} else {
|
||||
trace_mshv_mem_read(gpa, size);
|
||||
}
|
||||
|
||||
ret = address_space_rw(&address_space_memory, gpa, memattr, (void *)data,
|
||||
size, false);
|
||||
if (ret == MEMTX_OK) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ret == MEMTX_DECODE_ERROR) {
|
||||
return handle_unmapped_mmio_region_read(gpa, size, data);
|
||||
}
|
||||
|
||||
error_report("failed to read guest memory at 0x%lx", gpa);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int mshv_guest_mem_write(uint64_t gpa, const uint8_t *data, uintptr_t size,
|
||||
bool is_secure_mode)
|
||||
{
|
||||
int ret;
|
||||
MemTxAttrs memattr = { .secure = is_secure_mode };
|
||||
|
||||
trace_mshv_mem_write(gpa, size);
|
||||
ret = address_space_rw(&address_space_memory, gpa, memattr, (void *)data,
|
||||
size, true);
|
||||
if (ret == MEMTX_OK) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ret == MEMTX_DECODE_ERROR) {
|
||||
warn_report("write to unmapped mmio region gpa=0x%lx size=%lu", gpa,
|
||||
size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
error_report("Failed to write guest memory");
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int set_memory(const MshvMemoryRegion *mshv_mr, bool add)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (!mshv_mr) {
|
||||
error_report("Invalid mshv_mr");
|
||||
return -1;
|
||||
}
|
||||
|
||||
trace_mshv_set_memory(add, mshv_mr->guest_phys_addr,
|
||||
mshv_mr->memory_size,
|
||||
mshv_mr->userspace_addr, mshv_mr->readonly,
|
||||
ret);
|
||||
return map_or_unmap(mshv_state->vm, mshv_mr, add);
|
||||
}
|
||||
|
||||
/*
|
||||
* Calculate and align the start address and the size of the section.
|
||||
* Return the size. If the size is 0, the aligned section is empty.
|
||||
*/
|
||||
static hwaddr align_section(MemoryRegionSection *section, hwaddr *start)
|
||||
{
|
||||
hwaddr size = int128_get64(section->size);
|
||||
hwaddr delta, aligned;
|
||||
|
||||
/*
|
||||
* works in page size chunks, but the function may be called
|
||||
* with sub-page size and unaligned start address. Pad the start
|
||||
* address to next and truncate size to previous page boundary.
|
||||
*/
|
||||
aligned = ROUND_UP(section->offset_within_address_space,
|
||||
qemu_real_host_page_size());
|
||||
delta = aligned - section->offset_within_address_space;
|
||||
*start = aligned;
|
||||
if (delta > size) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (size - delta) & qemu_real_host_page_mask();
|
||||
}
|
||||
|
||||
void mshv_set_phys_mem(MshvMemoryListener *mml, MemoryRegionSection *section,
|
||||
bool add)
|
||||
{
|
||||
int ret = 0;
|
||||
MemoryRegion *area = section->mr;
|
||||
bool writable = !area->readonly && !area->rom_device;
|
||||
hwaddr start_addr, mr_offset, size;
|
||||
void *ram;
|
||||
MshvMemoryRegion mshv_mr = {0};
|
||||
|
||||
size = align_section(section, &start_addr);
|
||||
trace_mshv_set_phys_mem(add, section->mr->name, start_addr);
|
||||
|
||||
/*
|
||||
* If the memory device is a writable non-ram area, we do not
|
||||
* want to map it into the guest memory. If it is not a ROM device,
|
||||
* we want to remove mshv memory mapping, so accesses will trap.
|
||||
*/
|
||||
if (!memory_region_is_ram(area)) {
|
||||
if (writable) {
|
||||
return;
|
||||
} else if (!area->romd_mode) {
|
||||
add = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!size) {
|
||||
return;
|
||||
}
|
||||
|
||||
mr_offset = section->offset_within_region + start_addr -
|
||||
section->offset_within_address_space;
|
||||
|
||||
ram = memory_region_get_ram_ptr(area) + mr_offset;
|
||||
|
||||
mshv_mr.guest_phys_addr = start_addr;
|
||||
mshv_mr.memory_size = size;
|
||||
mshv_mr.readonly = !writable;
|
||||
mshv_mr.userspace_addr = (uint64_t)ram;
|
||||
|
||||
ret = set_memory(&mshv_mr, add);
|
||||
if (ret < 0) {
|
||||
error_report("Failed to set memory region");
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
static int enable_dirty_page_tracking(int vm_fd)
|
||||
{
|
||||
int ret;
|
||||
struct hv_input_set_partition_property in = {0};
|
||||
struct mshv_root_hvcall args = {0};
|
||||
|
||||
in.property_code = HV_PARTITION_PROPERTY_GPA_PAGE_ACCESS_TRACKING;
|
||||
in.property_value = 1;
|
||||
|
||||
args.code = HVCALL_SET_PARTITION_PROPERTY;
|
||||
args.in_sz = sizeof(in);
|
||||
args.in_ptr = (uint64_t)∈
|
||||
|
||||
ret = mshv_hvcall(vm_fd, &args);
|
||||
if (ret < 0) {
|
||||
error_report("Failed to enable dirty page tracking: %s",
|
||||
strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Retrieve dirty page bitmap for a GPA range, clearing the dirty bits
|
||||
* atomically. Large ranges are handled in batches.
|
||||
*/
|
||||
static int get_dirty_log(int vm_fd, uint64_t base_pfn, uint64_t page_count,
|
||||
unsigned long *bitmap, size_t bitmap_size)
|
||||
{
|
||||
uint64_t batch, bitmap_offset, completed = 0;
|
||||
struct mshv_gpap_access_bitmap args = {0};
|
||||
int ret;
|
||||
|
||||
QEMU_BUILD_BUG_ON(MSHV_DIRTY_PAGES_BATCH_SIZE % BITS_PER_LONG != 0);
|
||||
assert(bitmap_size >= ROUND_UP(page_count, BITS_PER_LONG) / 8);
|
||||
|
||||
while (completed < page_count) {
|
||||
batch = MIN(MSHV_DIRTY_PAGES_BATCH_SIZE, page_count - completed);
|
||||
bitmap_offset = completed / BITS_PER_LONG;
|
||||
|
||||
args.access_type = MSHV_GPAP_ACCESS_TYPE_DIRTY;
|
||||
args.access_op = MSHV_GPAP_ACCESS_OP_CLEAR;
|
||||
args.page_count = batch;
|
||||
args.gpap_base = base_pfn + completed;
|
||||
args.bitmap_ptr = (uint64_t)(bitmap + bitmap_offset);
|
||||
|
||||
ret = ioctl(vm_fd, MSHV_GET_GPAP_ACCESS_BITMAP, &args);
|
||||
if (ret < 0) {
|
||||
error_report("Failed to get dirty log (base_pfn=0x%" PRIx64
|
||||
" batch=%" PRIu64 "): %s",
|
||||
base_pfn + completed, batch, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
completed += batch;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool mshv_log_global_start(MemoryListener *listener, Error **errp)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = enable_dirty_page_tracking(mshv_state->vm);
|
||||
if (ret < 0) {
|
||||
error_setg_errno(errp, -ret, "Failed to enable dirty page tracking");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static int disable_dirty_page_tracking(int vm_fd)
|
||||
{
|
||||
int ret;
|
||||
struct hv_input_set_partition_property in = {0};
|
||||
struct mshv_root_hvcall args = {0};
|
||||
|
||||
in.property_code = HV_PARTITION_PROPERTY_GPA_PAGE_ACCESS_TRACKING;
|
||||
in.property_value = 0;
|
||||
|
||||
args.code = HVCALL_SET_PARTITION_PROPERTY;
|
||||
args.in_sz = sizeof(in);
|
||||
args.in_ptr = (uint64_t)∈
|
||||
|
||||
ret = mshv_hvcall(vm_fd, &args);
|
||||
if (ret < 0) {
|
||||
error_report("Failed to disable dirty page tracking: %s",
|
||||
strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_dirty_pages(int vm_fd, uint64_t base_pfn, uint64_t page_count)
|
||||
{
|
||||
uint64_t batch, completed = 0;
|
||||
unsigned long bitmap[MSHV_DIRTY_PAGES_BATCH_SIZE / BITS_PER_LONG];
|
||||
struct mshv_gpap_access_bitmap args = {0};
|
||||
int ret;
|
||||
|
||||
while (completed < page_count) {
|
||||
batch = MIN(MSHV_DIRTY_PAGES_BATCH_SIZE, page_count - completed);
|
||||
|
||||
args.access_type = MSHV_GPAP_ACCESS_TYPE_DIRTY;
|
||||
args.access_op = MSHV_GPAP_ACCESS_OP_SET;
|
||||
args.page_count = batch;
|
||||
args.gpap_base = base_pfn + completed;
|
||||
args.bitmap_ptr = (uint64_t)bitmap;
|
||||
|
||||
ret = ioctl(vm_fd, MSHV_GET_GPAP_ACCESS_BITMAP, &args);
|
||||
if (ret < 0) {
|
||||
error_report("Failed to set dirty pages (base_pfn=0x%" PRIx64
|
||||
" batch=%" PRIu64 "): %s",
|
||||
base_pfn + completed, batch, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
completed += batch;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool set_dirty_bits_cb(Int128 start, Int128 len, const MemoryRegion *mr,
|
||||
hwaddr offset_in_region, void *opaque)
|
||||
{
|
||||
int ret, *errp = opaque;
|
||||
hwaddr gpa, size;
|
||||
uint64_t page_count, base_pfn;
|
||||
|
||||
gpa = int128_get64(start);
|
||||
size = int128_get64(len);
|
||||
page_count = size >> MSHV_PAGE_SHIFT;
|
||||
base_pfn = gpa >> MSHV_PAGE_SHIFT;
|
||||
|
||||
if (!mr->ram || mr->readonly) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (page_count == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ret = set_dirty_pages(mshv_state->vm, base_pfn, page_count);
|
||||
|
||||
/* true aborts the iteration, which is what we want if there's an error */
|
||||
if (ret < 0) {
|
||||
*errp = ret;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void mshv_log_global_stop(MemoryListener *listener)
|
||||
{
|
||||
int err = 0;
|
||||
/* MSHV requires all dirty bits to be set before disabling tracking. */
|
||||
FlatView *fv = address_space_to_flatview(&address_space_memory);
|
||||
flatview_for_each_range(fv, set_dirty_bits_cb, &err);
|
||||
|
||||
if (err < 0) {
|
||||
error_report("Failed to set dirty bits before disabling tracking");
|
||||
}
|
||||
|
||||
disable_dirty_page_tracking(mshv_state->vm);
|
||||
}
|
||||
|
||||
void mshv_log_sync(MemoryListener *listener, MemoryRegionSection *section)
|
||||
{
|
||||
hwaddr size, start_addr, mr_offset;
|
||||
uint64_t page_count, base_pfn;
|
||||
size_t bitmap_size;
|
||||
unsigned long *bitmap;
|
||||
ram_addr_t ram_addr;
|
||||
int ret;
|
||||
MemoryRegion *mr = section->mr;
|
||||
|
||||
if (!memory_region_is_ram(mr) || memory_region_is_rom(mr)) {
|
||||
return;
|
||||
}
|
||||
|
||||
size = align_section(section, &start_addr);
|
||||
if (!size) {
|
||||
return;
|
||||
}
|
||||
|
||||
page_count = size >> MSHV_PAGE_SHIFT;
|
||||
base_pfn = start_addr >> MSHV_PAGE_SHIFT;
|
||||
bitmap_size = ROUND_UP(page_count, BITS_PER_LONG) / 8;
|
||||
bitmap = g_malloc0(bitmap_size);
|
||||
|
||||
ret = get_dirty_log(mshv_state->vm, base_pfn, page_count, bitmap,
|
||||
bitmap_size);
|
||||
if (ret < 0) {
|
||||
g_free(bitmap);
|
||||
return;
|
||||
}
|
||||
|
||||
mr_offset = section->offset_within_region + start_addr -
|
||||
section->offset_within_address_space;
|
||||
ram_addr = memory_region_get_ram_addr(mr) + mr_offset;
|
||||
|
||||
physical_memory_set_dirty_lebitmap(bitmap, ram_addr, page_count);
|
||||
g_free(bitmap);
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
system_ss.add(when: 'CONFIG_MSHV', if_true: files(
|
||||
'irq.c',
|
||||
'mem.c',
|
||||
'mshv-all.c'
|
||||
))
|
||||
@@ -0,0 +1,858 @@
|
||||
/*
|
||||
* QEMU MSHV support
|
||||
*
|
||||
* Copyright Microsoft, Corp. 2025
|
||||
*
|
||||
* Authors:
|
||||
* Ziqiao Zhou <[email protected]>
|
||||
* Magnus Kulke <[email protected]>
|
||||
* Jinank Jain <[email protected]>
|
||||
* Wei Liu <[email protected]>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/event_notifier.h"
|
||||
#include "qemu/module.h"
|
||||
#include "qemu/main-loop.h"
|
||||
#include "hw/core/boards.h"
|
||||
|
||||
#include "hw/hyperv/hvhdk.h"
|
||||
#include "hw/hyperv/hvhdk_mini.h"
|
||||
#include "hw/hyperv/hvgdk.h"
|
||||
#include "hw/hyperv/hvgdk_mini.h"
|
||||
#include "linux/mshv.h"
|
||||
|
||||
#include "qemu/accel.h"
|
||||
#include "qemu/guest-random.h"
|
||||
#include "accel/accel-ops.h"
|
||||
#include "accel/accel-cpu-ops.h"
|
||||
#include "exec/cpu-common.h"
|
||||
#include "system/cpus.h"
|
||||
#include "system/runstate.h"
|
||||
#include "system/accel-blocker.h"
|
||||
#include "system/address-spaces.h"
|
||||
#include "system/mshv.h"
|
||||
#include "system/mshv_int.h"
|
||||
#include "system/reset.h"
|
||||
#include "migration/qemu-file-types.h"
|
||||
#include "migration/register.h"
|
||||
#include "trace.h"
|
||||
#include <err.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
bool mshv_allowed;
|
||||
|
||||
MshvState *mshv_state;
|
||||
|
||||
static int init_mshv(int *mshv_fd)
|
||||
{
|
||||
int fd = open("/dev/mshv", O_RDWR | O_CLOEXEC);
|
||||
if (fd < 0) {
|
||||
error_report("Failed to open /dev/mshv: %s", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
*mshv_fd = fd;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mshv_load_cleanup(void *opaque)
|
||||
{
|
||||
CPUState *cpu;
|
||||
int ret;
|
||||
|
||||
ret = mshv_arch_set_partition_msrs(first_cpu);
|
||||
if (ret < 0) {
|
||||
error_report("Failed to set partition MSRs: %s", strerror(-ret));
|
||||
return -1;
|
||||
}
|
||||
|
||||
CPU_FOREACH(cpu) {
|
||||
ret = mshv_arch_set_mp_state(cpu);
|
||||
if (ret < 0) {
|
||||
error_report("Failed to set mp state for vCPU %d: %s",
|
||||
cpu->cpu_index, strerror(-ret));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int get_host_partition_property(int mshv_fd, uint32_t property_code,
|
||||
uint64_t *value)
|
||||
{
|
||||
int ret;
|
||||
struct hv_input_get_partition_property in = {0};
|
||||
struct hv_output_get_partition_property out = {0};
|
||||
struct mshv_root_hvcall args = {0};
|
||||
|
||||
in.property_code = property_code;
|
||||
|
||||
args.code = HVCALL_GET_PARTITION_PROPERTY;
|
||||
args.in_sz = sizeof(in);
|
||||
args.in_ptr = (uint64_t)∈
|
||||
args.out_sz = sizeof(out);
|
||||
args.out_ptr = (uint64_t)&out;
|
||||
|
||||
ret = ioctl(mshv_fd, MSHV_ROOT_HVCALL, &args);
|
||||
if (ret < 0) {
|
||||
error_report("Failed to get host partition property bank: %s",
|
||||
strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
*value = out.property_value;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_partition_property(int vm_fd, uint32_t feature_bank,
|
||||
uint64_t *value)
|
||||
{
|
||||
struct hv_input_get_partition_property in = {0};
|
||||
struct hv_output_get_partition_property out = {0};
|
||||
struct mshv_root_hvcall args = {0};
|
||||
int ret;
|
||||
|
||||
in.property_code = feature_bank;
|
||||
|
||||
args.code = HVCALL_GET_PARTITION_PROPERTY;
|
||||
args.in_sz = sizeof(in);
|
||||
args.in_ptr = (uint64_t)∈
|
||||
args.out_sz = sizeof(out);
|
||||
args.out_ptr = (uint64_t)&out;
|
||||
|
||||
ret = ioctl(vm_fd, MSHV_ROOT_HVCALL, &args);
|
||||
if (ret < 0) {
|
||||
error_report("Failed to get guest partition property bank: %s",
|
||||
strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
*value = out.property_value;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_proc_features(int vm_fd,
|
||||
union hv_partition_processor_features *features)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = get_partition_property(vm_fd,
|
||||
HV_PARTITION_PROPERTY_PROCESSOR_FEATURES0,
|
||||
&features->as_uint64[0]);
|
||||
if (ret < 0) {
|
||||
error_report("Failed to get processor features bank 0");
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = get_partition_property(vm_fd,
|
||||
HV_PARTITION_PROPERTY_PROCESSOR_FEATURES1,
|
||||
&features->as_uint64[1]);
|
||||
if (ret < 0) {
|
||||
error_report("Failed to get processor features bank 1");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int create_partition(int mshv_fd, int *vm_fd)
|
||||
{
|
||||
int ret;
|
||||
uint64_t pt_flags, host_proc_features;
|
||||
union hv_partition_processor_xsave_features disabled_xsave_features;
|
||||
union hv_partition_processor_features disabled_partition_features = {0};
|
||||
|
||||
struct mshv_create_partition_v2 args = {0};
|
||||
|
||||
QEMU_BUILD_BUG_ON(MSHV_NUM_CPU_FEATURES_BANKS != 2);
|
||||
|
||||
/* Initialize pt_flags with the desired features */
|
||||
pt_flags = (1ULL << MSHV_PT_BIT_LAPIC) |
|
||||
(1ULL << MSHV_PT_BIT_X2APIC) |
|
||||
(1ULL << MSHV_PT_BIT_GPA_SUPER_PAGES) |
|
||||
(1ULL << MSHV_PT_BIT_CPU_AND_XSAVE_FEATURES);
|
||||
|
||||
/* enable all */
|
||||
disabled_xsave_features.as_uint64 = 0;
|
||||
/*
|
||||
* AMX TILE XSAVE state (XTILE_DATA) is 8KB, which exceeds the
|
||||
* current fixed 4KB XSAVE buffer size.
|
||||
*/
|
||||
disabled_xsave_features.amx_tile_support = 1;
|
||||
disabled_xsave_features.amx_bf16_support = 1;
|
||||
disabled_xsave_features.amx_int8_support = 1;
|
||||
disabled_xsave_features.amx_fp16_support = 1;
|
||||
|
||||
/*
|
||||
* query host for supported processor features and disable unsupported
|
||||
* features: (0 means supported, 1 means disabled, hence the negation)
|
||||
*/
|
||||
ret = get_host_partition_property(mshv_fd,
|
||||
HV_PARTITION_PROPERTY_PROCESSOR_FEATURES0,
|
||||
&host_proc_features);
|
||||
if (ret < 0) {
|
||||
error_report("Failed to get host processor feature bank 0");
|
||||
return -1;
|
||||
}
|
||||
args.pt_cpu_fbanks[0] = ~host_proc_features;
|
||||
|
||||
ret = get_host_partition_property(mshv_fd,
|
||||
HV_PARTITION_PROPERTY_PROCESSOR_FEATURES1,
|
||||
&host_proc_features);
|
||||
if (ret < 0) {
|
||||
error_report("Failed to get host processor feature bank 1");
|
||||
return -1;
|
||||
}
|
||||
args.pt_cpu_fbanks[1] = ~host_proc_features;
|
||||
|
||||
/* arch-specific features we disable regardless of host support */
|
||||
mshv_arch_disable_partition_proc_features(&disabled_partition_features);
|
||||
args.pt_cpu_fbanks[0] |= disabled_partition_features.as_uint64[0];
|
||||
args.pt_cpu_fbanks[1] |= disabled_partition_features.as_uint64[1];
|
||||
|
||||
/* populate args structure */
|
||||
args.pt_flags = pt_flags;
|
||||
args.pt_isolation = MSHV_PT_ISOLATION_NONE;
|
||||
args.pt_disabled_xsave = disabled_xsave_features.as_uint64;
|
||||
args.pt_num_cpu_fbanks = MSHV_NUM_CPU_FEATURES_BANKS;
|
||||
|
||||
ret = ioctl(mshv_fd, MSHV_CREATE_PARTITION, &args);
|
||||
if (ret < 0) {
|
||||
error_report("Failed to create partition: %s", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
*vm_fd = ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_synthetic_proc_features(int vm_fd)
|
||||
{
|
||||
int ret;
|
||||
struct hv_input_set_partition_property in = {0};
|
||||
union hv_partition_synthetic_processor_features features = {0};
|
||||
|
||||
/* Access the bitfield and set the desired features */
|
||||
features.hypervisor_present = 1;
|
||||
features.hv1 = 1;
|
||||
features.access_partition_reference_counter = 1;
|
||||
features.access_synic_regs = 1;
|
||||
features.access_synthetic_timer_regs = 1;
|
||||
features.access_partition_reference_tsc = 1;
|
||||
features.access_frequency_regs = 1;
|
||||
features.access_intr_ctrl_regs = 1;
|
||||
features.access_vp_index = 1;
|
||||
features.access_hypercall_regs = 1;
|
||||
features.tb_flush_hypercalls = 1;
|
||||
features.synthetic_cluster_ipi = 1;
|
||||
features.direct_synthetic_timers = 1;
|
||||
|
||||
mshv_arch_amend_proc_features(&features);
|
||||
|
||||
in.property_code = HV_PARTITION_PROPERTY_SYNTHETIC_PROC_FEATURES;
|
||||
in.property_value = features.as_uint64[0];
|
||||
|
||||
struct mshv_root_hvcall args = {0};
|
||||
args.code = HVCALL_SET_PARTITION_PROPERTY;
|
||||
args.in_sz = sizeof(in);
|
||||
args.in_ptr = (uint64_t)∈
|
||||
|
||||
trace_mshv_hvcall_args("synthetic_proc_features", args.code, args.in_sz);
|
||||
|
||||
ret = mshv_hvcall(vm_fd, &args);
|
||||
if (ret < 0) {
|
||||
error_report("Failed to set synthethic proc features");
|
||||
return -errno;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int initialize_vm(int vm_fd)
|
||||
{
|
||||
int ret = ioctl(vm_fd, MSHV_INITIALIZE_PARTITION);
|
||||
if (ret < 0) {
|
||||
error_report("Failed to initialize partition: %s", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int create_vm(int mshv_fd, int *vm_fd)
|
||||
{
|
||||
int ret = create_partition(mshv_fd, vm_fd);
|
||||
if (ret < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = set_synthetic_proc_features(*vm_fd);
|
||||
if (ret < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = initialize_vm(*vm_fd);
|
||||
if (ret < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = mshv_arch_post_init_vm(*vm_fd);
|
||||
if (ret < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void mem_region_add(MemoryListener *listener,
|
||||
MemoryRegionSection *section)
|
||||
{
|
||||
MshvMemoryListener *mml;
|
||||
mml = container_of(listener, MshvMemoryListener, listener);
|
||||
memory_region_ref(section->mr);
|
||||
mshv_set_phys_mem(mml, section, true);
|
||||
}
|
||||
|
||||
static void mem_region_del(MemoryListener *listener,
|
||||
MemoryRegionSection *section)
|
||||
{
|
||||
MshvMemoryListener *mml;
|
||||
mml = container_of(listener, MshvMemoryListener, listener);
|
||||
mshv_set_phys_mem(mml, section, false);
|
||||
memory_region_unref(section->mr);
|
||||
}
|
||||
|
||||
typedef enum {
|
||||
DATAMATCH_NONE,
|
||||
DATAMATCH_U32,
|
||||
DATAMATCH_U64,
|
||||
} DatamatchTag;
|
||||
|
||||
typedef struct {
|
||||
DatamatchTag tag;
|
||||
union {
|
||||
uint32_t u32;
|
||||
uint64_t u64;
|
||||
} value;
|
||||
} Datamatch;
|
||||
|
||||
/* flags: determine whether to de/assign */
|
||||
static int ioeventfd(int vm_fd, int event_fd, uint64_t addr, Datamatch dm,
|
||||
uint32_t flags)
|
||||
{
|
||||
struct mshv_user_ioeventfd args = {0};
|
||||
args.fd = event_fd;
|
||||
args.addr = addr;
|
||||
args.flags = flags;
|
||||
|
||||
if (dm.tag == DATAMATCH_NONE) {
|
||||
args.datamatch = 0;
|
||||
} else {
|
||||
flags |= BIT(MSHV_IOEVENTFD_BIT_DATAMATCH);
|
||||
args.flags = flags;
|
||||
if (dm.tag == DATAMATCH_U64) {
|
||||
args.len = sizeof(uint64_t);
|
||||
args.datamatch = dm.value.u64;
|
||||
} else {
|
||||
args.len = sizeof(uint32_t);
|
||||
args.datamatch = dm.value.u32;
|
||||
}
|
||||
}
|
||||
|
||||
int ret = ioctl(vm_fd, MSHV_IOEVENTFD, &args);
|
||||
if (ret < 0) {
|
||||
return -errno;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int unregister_ioevent(int vm_fd, int event_fd, uint64_t mmio_addr,
|
||||
uint64_t data, uint32_t len, bool data_match)
|
||||
{
|
||||
uint32_t flags = 0;
|
||||
Datamatch dm = {0};
|
||||
|
||||
flags |= BIT(MSHV_IOEVENTFD_BIT_DEASSIGN);
|
||||
if (!data_match) {
|
||||
dm.tag = DATAMATCH_NONE;
|
||||
} else if (len == sizeof(uint64_t)) {
|
||||
dm.tag = DATAMATCH_U64;
|
||||
dm.value.u64 = data;
|
||||
} else {
|
||||
dm.tag = DATAMATCH_U32;
|
||||
dm.value.u32 = data;
|
||||
}
|
||||
|
||||
return ioeventfd(vm_fd, event_fd, mmio_addr, dm, flags);
|
||||
}
|
||||
|
||||
static int register_ioevent(int vm_fd, int event_fd, uint64_t mmio_addr,
|
||||
uint64_t val, bool is_64bit, bool is_datamatch)
|
||||
{
|
||||
uint32_t flags = 0;
|
||||
Datamatch dm = {0};
|
||||
|
||||
if (!is_datamatch) {
|
||||
dm.tag = DATAMATCH_NONE;
|
||||
} else if (is_64bit) {
|
||||
dm.tag = DATAMATCH_U64;
|
||||
dm.value.u64 = val;
|
||||
} else {
|
||||
dm.tag = DATAMATCH_U32;
|
||||
dm.value.u32 = val;
|
||||
}
|
||||
|
||||
return ioeventfd(vm_fd, event_fd, mmio_addr, dm, flags);
|
||||
}
|
||||
|
||||
static void mem_ioeventfd_add(MemoryListener *listener,
|
||||
MemoryRegionSection *section,
|
||||
bool match_data, uint64_t data,
|
||||
EventNotifier *e)
|
||||
{
|
||||
int fd = event_notifier_get_fd(e);
|
||||
int ret;
|
||||
bool is_64 = int128_get64(section->size) == 8;
|
||||
uint64_t addr = section->offset_within_address_space;
|
||||
|
||||
trace_mshv_mem_ioeventfd_add(addr, int128_get64(section->size), data);
|
||||
|
||||
ret = register_ioevent(mshv_state->vm, fd, addr, data, is_64, match_data);
|
||||
|
||||
if (ret < 0) {
|
||||
error_report("Failed to register ioeventfd: %s (%d)", strerror(-ret),
|
||||
-ret);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
static void mem_ioeventfd_del(MemoryListener *listener,
|
||||
MemoryRegionSection *section,
|
||||
bool match_data, uint64_t data,
|
||||
EventNotifier *e)
|
||||
{
|
||||
int fd = event_notifier_get_fd(e);
|
||||
int ret;
|
||||
uint64_t addr = section->offset_within_address_space;
|
||||
uint64_t len = int128_get64(section->size);
|
||||
|
||||
trace_mshv_mem_ioeventfd_del(section->offset_within_address_space,
|
||||
int128_get64(section->size), data);
|
||||
|
||||
ret = unregister_ioevent(mshv_state->vm, fd, addr, data, len, match_data);
|
||||
if (ret < 0) {
|
||||
error_report("Failed to unregister ioeventfd: %s (%d)", strerror(-ret),
|
||||
-ret);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
static MemoryListener mshv_memory_listener = {
|
||||
.name = "mshv",
|
||||
.priority = MEMORY_LISTENER_PRIORITY_ACCEL,
|
||||
.region_add = mem_region_add,
|
||||
.region_del = mem_region_del,
|
||||
.eventfd_add = mem_ioeventfd_add,
|
||||
.eventfd_del = mem_ioeventfd_del,
|
||||
.log_sync = mshv_log_sync,
|
||||
.log_global_start = mshv_log_global_start,
|
||||
.log_global_stop = mshv_log_global_stop,
|
||||
};
|
||||
|
||||
static MemoryListener mshv_io_listener = {
|
||||
.name = "mshv", .priority = MEMORY_LISTENER_PRIORITY_DEV_BACKEND,
|
||||
/* MSHV does not support PIO eventfd */
|
||||
};
|
||||
|
||||
static void register_mshv_memory_listener(MshvState *s, MshvMemoryListener *mml,
|
||||
AddressSpace *as, int as_id,
|
||||
const char *name)
|
||||
{
|
||||
int i;
|
||||
|
||||
mml->listener = mshv_memory_listener;
|
||||
mml->listener.name = name;
|
||||
memory_listener_register(&mml->listener, as);
|
||||
for (i = 0; i < s->nr_as; ++i) {
|
||||
if (!s->as[i].as) {
|
||||
s->as[i].as = as;
|
||||
s->as[i].ml = mml;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int mshv_hvcall(int fd, const mshv_root_hvcall *args)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
ret = ioctl(fd, MSHV_ROOT_HVCALL, args);
|
||||
if (ret < 0) {
|
||||
error_report("Failed to perform hvcall: %s", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int mshv_init_vcpu(CPUState *cpu)
|
||||
{
|
||||
int vm_fd = mshv_state->vm;
|
||||
uint8_t vp_index = cpu->cpu_index;
|
||||
int ret;
|
||||
|
||||
cpu->accel = g_new0(AccelCPUState, 1);
|
||||
|
||||
ret = mshv_create_vcpu(vm_fd, vp_index, &cpu->accel->cpufd);
|
||||
if (ret < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
mshv_arch_init_vcpu(cpu);
|
||||
cpu->vcpu_dirty = true;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SaveVMHandlers savevm_mshv = {
|
||||
.load_cleanup = mshv_load_cleanup,
|
||||
};
|
||||
|
||||
static int mshv_init(AccelState *as, MachineState *ms)
|
||||
{
|
||||
MshvState *s;
|
||||
int mshv_fd, vm_fd, ret;
|
||||
|
||||
if (mshv_state) {
|
||||
warn_report("MSHV accelerator already initialized");
|
||||
return 0;
|
||||
}
|
||||
|
||||
s = MSHV_STATE(as);
|
||||
|
||||
accel_blocker_init();
|
||||
|
||||
s->vm = 0;
|
||||
|
||||
ret = init_mshv(&mshv_fd);
|
||||
if (ret < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
mshv_init_mmio_emu();
|
||||
|
||||
ret = create_vm(mshv_fd, &vm_fd);
|
||||
if (ret < 0) {
|
||||
close(mshv_fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
s->vm = vm_fd;
|
||||
s->fd = mshv_fd;
|
||||
|
||||
ret = get_proc_features(vm_fd, &s->processor_features);
|
||||
if (ret < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
s->nr_as = 1;
|
||||
s->as = g_new0(MshvAddressSpace, s->nr_as);
|
||||
|
||||
mshv_state = s;
|
||||
|
||||
mshv_init_irq_routing(s);
|
||||
|
||||
register_mshv_memory_listener(s, &s->memory_listener, &address_space_memory,
|
||||
0, "mshv-memory");
|
||||
memory_listener_register(&mshv_io_listener, &address_space_io);
|
||||
|
||||
register_savevm_live("mshv", 0, 1, &savevm_mshv, s);
|
||||
|
||||
mshv_clock_init();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mshv_destroy_vcpu(CPUState *cpu)
|
||||
{
|
||||
int cpu_fd = mshv_vcpufd(cpu);
|
||||
int vm_fd = mshv_state->vm;
|
||||
|
||||
mshv_remove_vcpu(vm_fd, cpu_fd);
|
||||
mshv_vcpufd(cpu) = 0;
|
||||
|
||||
mshv_arch_destroy_vcpu(cpu);
|
||||
g_clear_pointer(&cpu->accel, g_free);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mshv_cpu_exec(CPUState *cpu)
|
||||
{
|
||||
hv_message mshv_msg;
|
||||
enum MshvVmExit exit_reason;
|
||||
int ret = 0;
|
||||
|
||||
bql_unlock();
|
||||
cpu_exec_start(cpu);
|
||||
|
||||
do {
|
||||
if (cpu->vcpu_dirty) {
|
||||
ret = mshv_arch_store_vcpu_state(cpu);
|
||||
if (ret) {
|
||||
error_report("Failed to put registers after init: %s",
|
||||
strerror(-ret));
|
||||
ret = -1;
|
||||
break;
|
||||
}
|
||||
cpu->vcpu_dirty = false;
|
||||
}
|
||||
|
||||
/* Corresponding store-release is in cpu_exit. */
|
||||
if (qatomic_load_acquire(&cpu->exit_request)) {
|
||||
trace_mshv_interrupt_exit_request(cpu->cpu_index);
|
||||
ret = EXCP_INTERRUPT;
|
||||
break;
|
||||
}
|
||||
|
||||
ret = mshv_run_vcpu(mshv_state->vm, cpu, &mshv_msg, &exit_reason);
|
||||
if (ret < 0) {
|
||||
error_report("Failed to run on vcpu %d", cpu->cpu_index);
|
||||
abort();
|
||||
}
|
||||
|
||||
switch (exit_reason) {
|
||||
case MshvVmExitIgnore:
|
||||
break;
|
||||
default:
|
||||
ret = EXCP_INTERRUPT;
|
||||
break;
|
||||
}
|
||||
} while (ret == 0);
|
||||
|
||||
cpu_exec_end(cpu);
|
||||
bql_lock();
|
||||
|
||||
if (ret < 0) {
|
||||
cpu_dump_state(cpu, stderr, CPU_DUMP_CODE);
|
||||
vm_stop(RUN_STATE_INTERNAL_ERROR);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* We need a dummy handler to make SIG_IPI a deliverable signal. The kernel
|
||||
* handler will be woken up by the caught signal and instruct the hypervisor
|
||||
* to suspend execution (the concrete mechanism differs between schedulers)
|
||||
* and return to userspace.
|
||||
*/
|
||||
static void dummy_handler(int sig)
|
||||
{
|
||||
}
|
||||
|
||||
static void init_signal(CPUState *cpu)
|
||||
{
|
||||
/* init cpu signals */
|
||||
struct sigaction sigact;
|
||||
sigset_t set;
|
||||
|
||||
memset(&sigact, 0, sizeof(sigact));
|
||||
sigact.sa_handler = dummy_handler;
|
||||
sigaction(SIG_IPI, &sigact, NULL);
|
||||
|
||||
pthread_sigmask(SIG_BLOCK, NULL, &set);
|
||||
sigdelset(&set, SIG_IPI);
|
||||
pthread_sigmask(SIG_SETMASK, &set, NULL);
|
||||
}
|
||||
|
||||
static void *mshv_vcpu_thread(void *arg)
|
||||
{
|
||||
CPUState *cpu = arg;
|
||||
int ret;
|
||||
|
||||
rcu_register_thread();
|
||||
|
||||
bql_lock();
|
||||
qemu_thread_get_self(cpu->thread);
|
||||
cpu->thread_id = qemu_get_thread_id();
|
||||
current_cpu = cpu;
|
||||
ret = mshv_init_vcpu(cpu);
|
||||
if (ret < 0) {
|
||||
error_report("Failed to init vcpu %d", cpu->cpu_index);
|
||||
goto cleanup;
|
||||
}
|
||||
init_signal(cpu);
|
||||
|
||||
/* signal CPU creation */
|
||||
cpu_thread_signal_created(cpu);
|
||||
qemu_guest_random_seed_thread_part2(cpu->random_seed);
|
||||
|
||||
do {
|
||||
qemu_process_cpu_events(cpu);
|
||||
if (cpu_can_run(cpu)) {
|
||||
mshv_cpu_exec(cpu);
|
||||
}
|
||||
} while (!cpu->unplug || cpu_can_run(cpu));
|
||||
|
||||
mshv_destroy_vcpu(cpu);
|
||||
cleanup:
|
||||
cpu_thread_signal_destroyed(cpu);
|
||||
bql_unlock();
|
||||
rcu_unregister_thread();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void mshv_start_vcpu_thread(CPUState *cpu)
|
||||
{
|
||||
char thread_name[VCPU_THREAD_NAME_SIZE];
|
||||
|
||||
snprintf(thread_name, VCPU_THREAD_NAME_SIZE, "CPU %d/MSHV",
|
||||
cpu->cpu_index);
|
||||
|
||||
cpu->thread = g_malloc0(sizeof(QemuThread));
|
||||
cpu->halt_cond = g_malloc0(sizeof(QemuCond));
|
||||
|
||||
qemu_cond_init(cpu->halt_cond);
|
||||
|
||||
trace_mshv_start_vcpu_thread(thread_name, cpu->cpu_index);
|
||||
qemu_thread_create(cpu->thread, thread_name, mshv_vcpu_thread, cpu,
|
||||
QEMU_THREAD_JOINABLE);
|
||||
}
|
||||
|
||||
static void do_mshv_cpu_synchronize_post_init(CPUState *cpu,
|
||||
run_on_cpu_data arg)
|
||||
{
|
||||
int ret = mshv_arch_store_vcpu_state(cpu);
|
||||
if (ret < 0) {
|
||||
error_report("Failed to put registers after init: %s", strerror(-ret));
|
||||
abort();
|
||||
}
|
||||
|
||||
cpu->vcpu_dirty = false;
|
||||
}
|
||||
|
||||
static void mshv_cpu_synchronize_post_init(CPUState *cpu)
|
||||
{
|
||||
run_on_cpu(cpu, do_mshv_cpu_synchronize_post_init, RUN_ON_CPU_NULL);
|
||||
}
|
||||
|
||||
static void mshv_cpu_synchronize_post_reset(CPUState *cpu)
|
||||
{
|
||||
int ret = mshv_arch_store_vcpu_state(cpu);
|
||||
if (ret) {
|
||||
error_report("Failed to put registers after reset: %s",
|
||||
strerror(-ret));
|
||||
cpu_dump_state(cpu, stderr, CPU_DUMP_CODE);
|
||||
vm_stop(RUN_STATE_INTERNAL_ERROR);
|
||||
}
|
||||
cpu->vcpu_dirty = false;
|
||||
}
|
||||
|
||||
static void do_mshv_cpu_synchronize_pre_loadvm(CPUState *cpu,
|
||||
run_on_cpu_data arg)
|
||||
{
|
||||
cpu->vcpu_dirty = true;
|
||||
}
|
||||
|
||||
static void mshv_cpu_synchronize_pre_loadvm(CPUState *cpu)
|
||||
{
|
||||
run_on_cpu(cpu, do_mshv_cpu_synchronize_pre_loadvm, RUN_ON_CPU_NULL);
|
||||
}
|
||||
|
||||
static void do_mshv_cpu_synchronize(CPUState *cpu, run_on_cpu_data arg)
|
||||
{
|
||||
if (!cpu->vcpu_dirty) {
|
||||
int ret = mshv_arch_load_vcpu_state(cpu);
|
||||
if (ret < 0) {
|
||||
error_report("Failed to load registers for vcpu %d",
|
||||
cpu->cpu_index);
|
||||
|
||||
cpu_dump_state(cpu, stderr, CPU_DUMP_CODE);
|
||||
vm_stop(RUN_STATE_INTERNAL_ERROR);
|
||||
}
|
||||
|
||||
cpu->vcpu_dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
static void mshv_cpu_synchronize(CPUState *cpu)
|
||||
{
|
||||
if (!cpu->vcpu_dirty) {
|
||||
run_on_cpu(cpu, do_mshv_cpu_synchronize, RUN_ON_CPU_NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static bool mshv_cpus_are_resettable(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static void mshv_accel_class_init(ObjectClass *oc, const void *data)
|
||||
{
|
||||
AccelClass *ac = ACCEL_CLASS(oc);
|
||||
|
||||
ac->name = "MSHV";
|
||||
ac->init_machine = mshv_init;
|
||||
ac->allowed = &mshv_allowed;
|
||||
}
|
||||
|
||||
static void mshv_accel_instance_init(Object *obj)
|
||||
{
|
||||
MshvState *s = MSHV_STATE(obj);
|
||||
|
||||
s->vm = 0;
|
||||
}
|
||||
|
||||
static const TypeInfo mshv_accel_type = {
|
||||
.name = TYPE_MSHV_ACCEL,
|
||||
.parent = TYPE_ACCEL,
|
||||
.instance_init = mshv_accel_instance_init,
|
||||
.class_init = mshv_accel_class_init,
|
||||
.instance_size = sizeof(MshvState),
|
||||
};
|
||||
|
||||
/*
|
||||
* MSHV manages secondary processors in the hypervisor. SIPI for x86 and
|
||||
* PSCI for Arm are handled internally. Halted vCPUs must still enter
|
||||
* mshv_cpu_exec() so that MSHV_RUN_VP is called and the hypervisor will
|
||||
* wake APs.
|
||||
*/
|
||||
static bool mshv_vcpu_thread_is_idle(CPUState *cpu)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static void mshv_accel_ops_class_init(ObjectClass *oc, const void *data)
|
||||
{
|
||||
AccelOpsClass *ops = ACCEL_OPS_CLASS(oc);
|
||||
|
||||
ops->create_vcpu_thread = mshv_start_vcpu_thread;
|
||||
ops->cpu_thread_is_idle = mshv_vcpu_thread_is_idle;
|
||||
ops->synchronize_post_init = mshv_cpu_synchronize_post_init;
|
||||
ops->synchronize_post_reset = mshv_cpu_synchronize_post_reset;
|
||||
ops->synchronize_state = mshv_cpu_synchronize;
|
||||
ops->synchronize_pre_loadvm = mshv_cpu_synchronize_pre_loadvm;
|
||||
ops->cpus_are_resettable = mshv_cpus_are_resettable;
|
||||
ops->cpu_thread_is_idle = mshv_vcpu_thread_is_idle;
|
||||
ops->handle_interrupt = generic_handle_interrupt;
|
||||
}
|
||||
|
||||
static const TypeInfo mshv_accel_ops_type = {
|
||||
.name = ACCEL_OPS_NAME("mshv"),
|
||||
.parent = TYPE_ACCEL_OPS,
|
||||
.class_init = mshv_accel_ops_class_init,
|
||||
.abstract = true,
|
||||
};
|
||||
|
||||
static void mshv_type_init(void)
|
||||
{
|
||||
type_register_static(&mshv_accel_type);
|
||||
type_register_static(&mshv_accel_ops_type);
|
||||
}
|
||||
|
||||
type_init(mshv_type_init);
|
||||
@@ -0,0 +1,29 @@
|
||||
# Authors: Ziqiao Zhou <[email protected]>
|
||||
# Magnus Kulke <[email protected]>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
mshv_start_vcpu_thread(const char* thread, uint32_t cpu) "thread=%s cpu_index=%d"
|
||||
mshv_interrupt_exit_request(uint32_t cpu) "cpu_index=%d"
|
||||
|
||||
mshv_set_memory(bool add, uint64_t gpa, uint64_t size, uint64_t user_addr, bool readonly, int ret) "add=%d gpa=0x%" PRIx64 " size=0x%" PRIx64 " user=0x%" PRIx64 " readonly=%d result=%d"
|
||||
mshv_mem_ioeventfd_add(uint64_t addr, uint32_t size, uint32_t data) "addr=0x%" PRIx64 " size=%d data=0x%x"
|
||||
mshv_mem_ioeventfd_del(uint64_t addr, uint32_t size, uint32_t data) "addr=0x%" PRIx64 " size=%d data=0x%x"
|
||||
|
||||
mshv_hvcall_args(const char* hvcall, uint16_t code, uint16_t in_sz) "built args for '%s' code: %d in_sz: %d"
|
||||
|
||||
mshv_handle_interrupt(uint32_t cpu, int mask) "cpu_index=%d mask=0x%x"
|
||||
mshv_set_msi_routing(uint32_t gsi, uint64_t addr, uint32_t data) "gsi=%d addr=0x%" PRIx64 " data=0x%x"
|
||||
mshv_remove_msi_routing(uint32_t gsi) "gsi=%d"
|
||||
mshv_add_msi_routing(uint64_t addr, uint32_t data) "addr=0x%" PRIx64 " data=0x%x"
|
||||
mshv_commit_msi_routing_table(int vm_fd, int len) "vm_fd=%d table_size=%d"
|
||||
mshv_register_irqfd(int vm_fd, int event_fd, uint32_t gsi) "vm_fd=%d event_fd=%d gsi=%d"
|
||||
mshv_irqchip_update_irqfd_notifier_gsi(int event_fd, int resample_fd, int virq, bool add) "event_fd=%d resample_fd=%d virq=%d add=%d"
|
||||
|
||||
mshv_insn_fetch(uint64_t addr, size_t size) "gpa=0x%" PRIx64 " size=%zu"
|
||||
mshv_mem_write(uint64_t addr, size_t size) "\tgpa=0x%" PRIx64 " size=%zu"
|
||||
mshv_mem_read(uint64_t addr, size_t size) "\tgpa=0x%" PRIx64 " size=%zu"
|
||||
mshv_map_memory(uint64_t userspace_addr, uint64_t gpa, uint64_t size) "\tu_a=0x%" PRIx64 " gpa=0x%010" PRIx64 " size=0x%08" PRIx64
|
||||
mshv_unmap_memory(uint64_t userspace_addr, uint64_t gpa, uint64_t size) "\tu_a=0x%" PRIx64 " gpa=0x%010" PRIx64 " size=0x%08" PRIx64
|
||||
mshv_set_phys_mem(bool add, const char *name, uint64_t gpa) "\tadd=%d name=%s gpa=0x%010" PRIx64
|
||||
mshv_handle_mmio(uint64_t gva, uint64_t gpa, uint64_t size, uint8_t access_type) "\tgva=0x%" PRIx64 " gpa=0x%010" PRIx64 " size=0x%" PRIx64 " access_type=%d"
|
||||
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* QEMU MSHV support
|
||||
*
|
||||
* Copyright Microsoft, Corp. 2025
|
||||
*
|
||||
* Authors:
|
||||
* Ziqiao Zhou <[email protected]>
|
||||
* Magnus Kulke <[email protected]>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*
|
||||
*/
|
||||
|
||||
#include "trace/trace-accel_mshv.h"
|
||||
@@ -0,0 +1,3 @@
|
||||
nitro_ss = ss.source_set()
|
||||
nitro_ss.add(files('nitro-accel.c'))
|
||||
system_ss.add_all(when: 'CONFIG_NITRO', if_true: nitro_ss)
|
||||
@@ -0,0 +1,284 @@
|
||||
/*
|
||||
* Nitro Enclaves accelerator
|
||||
*
|
||||
* Copyright © 2026 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Authors:
|
||||
* Alexander Graf <[email protected]>
|
||||
*
|
||||
* Nitro Enclaves are a confidential compute technology which
|
||||
* allows a parent instance to carve out resources from itself
|
||||
* and spawn a confidential sibling VM next to itself. Similar
|
||||
* to other confidential compute solutions, this sibling is
|
||||
* controlled by an underlying vmm, but still has a higher level
|
||||
* vmm (QEMU) to implement some of its I/O functionality and
|
||||
* lifecycle.
|
||||
*
|
||||
* This accelerator drives /dev/nitro_enclaves to spawn a Nitro
|
||||
* Enclave. It works in tandem with the nitro_enclaves machine
|
||||
* which ensures the correct backend devices are available and
|
||||
* that the initial seed (an EIF file) is loaded at the correct
|
||||
* offset in memory.
|
||||
*
|
||||
* The accel starts the enclave when the machine starts, after
|
||||
* all device setup is finished.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qapi/visitor.h"
|
||||
#include "qemu/module.h"
|
||||
#include "qemu/rcu.h"
|
||||
#include "qemu/accel.h"
|
||||
#include "qemu/guest-random.h"
|
||||
#include "qemu/main-loop.h"
|
||||
#include "accel/accel-ops.h"
|
||||
#include "accel/accel-cpu-ops.h"
|
||||
#include "accel/dummy-cpus.h"
|
||||
#include "system/cpus.h"
|
||||
#include "hw/core/cpu.h"
|
||||
#include "hw/core/boards.h"
|
||||
#include "hw/nitro/nitro-vsock-bus.h"
|
||||
#include "system/ramblock.h"
|
||||
#include "system/nitro-accel.h"
|
||||
#include "trace.h"
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include "standard-headers/linux/nitro_enclaves.h"
|
||||
|
||||
bool nitro_allowed;
|
||||
|
||||
typedef struct NitroAccelState {
|
||||
AccelState parent_obj;
|
||||
|
||||
int ne_fd;
|
||||
int enclave_fd;
|
||||
uint64_t slot_uid;
|
||||
uint64_t enclave_cid;
|
||||
bool debug_mode;
|
||||
} NitroAccelState;
|
||||
|
||||
static int nitro_init_machine(AccelState *as, MachineState *ms)
|
||||
{
|
||||
NitroAccelState *s = NITRO_ACCEL(as);
|
||||
uint64_t slot_uid = 0;
|
||||
int ret;
|
||||
|
||||
s->ne_fd = open("/dev/nitro_enclaves", O_RDWR | O_CLOEXEC);
|
||||
if (s->ne_fd < 0) {
|
||||
error_report("nitro: failed to open /dev/nitro_enclaves: %s",
|
||||
strerror(errno));
|
||||
return -errno;
|
||||
}
|
||||
|
||||
ret = ioctl(s->ne_fd, NE_CREATE_VM, &slot_uid);
|
||||
if (ret < 0) {
|
||||
error_report("nitro: NE_CREATE_VM failed: %s", strerror(errno));
|
||||
close(s->ne_fd);
|
||||
return -errno;
|
||||
}
|
||||
s->enclave_fd = ret;
|
||||
s->slot_uid = slot_uid;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int nitro_donate_ram_block(RAMBlock *rb, void *opaque)
|
||||
{
|
||||
NitroAccelState *s = opaque;
|
||||
struct ne_user_memory_region region = {
|
||||
.flags = 0,
|
||||
.memory_size = rb->used_length,
|
||||
.userspace_addr = (uint64_t)(uintptr_t)rb->host,
|
||||
};
|
||||
|
||||
if (!rb->used_length) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ioctl(s->enclave_fd, NE_SET_USER_MEMORY_REGION, ®ion) < 0) {
|
||||
error_report("nitro: NE_SET_USER_MEMORY_REGION failed for %s "
|
||||
"(%" PRIu64 " bytes): %s", rb->idstr, rb->used_length,
|
||||
strerror(errno));
|
||||
return -errno;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Start the Enclave. At this point memory is set up and the EIF is loaded.
|
||||
* This function donates memory, adds vCPUs, and starts the enclave.
|
||||
*/
|
||||
static void nitro_setup_post(AccelState *as)
|
||||
{
|
||||
MachineState *ms = MACHINE(qdev_get_machine());
|
||||
NitroAccelState *s = NITRO_ACCEL(as);
|
||||
int nr_cpus = ms->smp.cpus;
|
||||
int i, ret;
|
||||
struct ne_enclave_start_info start_info = {
|
||||
.flags = s->debug_mode ? NE_ENCLAVE_DEBUG_MODE : 0,
|
||||
.enclave_cid = s->enclave_cid,
|
||||
};
|
||||
|
||||
ret = qemu_ram_foreach_block(nitro_donate_ram_block, s);
|
||||
if (ret < 0) {
|
||||
error_report("nitro: failed to donate memory");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
for (i = 0; i < nr_cpus; i++) {
|
||||
uint32_t cpu_id = 0;
|
||||
if (ioctl(s->enclave_fd, NE_ADD_VCPU, &cpu_id) < 0) {
|
||||
error_report("nitro: NE_ADD_VCPU failed: %s", strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
ret = ioctl(s->enclave_fd, NE_START_ENCLAVE, &start_info);
|
||||
if (ret < 0) {
|
||||
switch (errno) {
|
||||
case NE_ERR_NO_MEM_REGIONS_ADDED:
|
||||
error_report("nitro: no memory regions added");
|
||||
break;
|
||||
case NE_ERR_NO_VCPUS_ADDED:
|
||||
error_report("nitro: no vCPUs added");
|
||||
break;
|
||||
case NE_ERR_ENCLAVE_MEM_MIN_SIZE:
|
||||
error_report("nitro: memory is below the minimum "
|
||||
"required size. Try increasing -m");
|
||||
break;
|
||||
case NE_ERR_FULL_CORES_NOT_USED:
|
||||
error_report("nitro: requires full CPU cores. "
|
||||
"Try increasing -smp to a multiple of threads "
|
||||
"per core on this host (e.g. -smp 2)");
|
||||
break;
|
||||
case NE_ERR_NOT_IN_INIT_STATE:
|
||||
error_report("nitro: not in init state");
|
||||
break;
|
||||
case NE_ERR_INVALID_FLAG_VALUE:
|
||||
error_report("nitro: invalid flag value for NE_START_ENCLAVE");
|
||||
break;
|
||||
case NE_ERR_INVALID_ENCLAVE_CID:
|
||||
error_report("nitro: invalid enclave CID");
|
||||
break;
|
||||
default:
|
||||
error_report("nitro: NE_START_ENCLAVE failed: %s (errno %d)",
|
||||
strerror(errno), errno);
|
||||
break;
|
||||
}
|
||||
exit(1);
|
||||
}
|
||||
|
||||
s->enclave_cid = start_info.enclave_cid;
|
||||
trace_nitro_enclave_started(s->enclave_cid);
|
||||
|
||||
/*
|
||||
* Notify all Nitro vsock bus devices that the enclave has started
|
||||
* and provide them with the CID for vsock connections.
|
||||
*/
|
||||
{
|
||||
NitroVsockBridge *bridge = nitro_vsock_bridge_find();
|
||||
Error *err = NULL;
|
||||
|
||||
if (bridge) {
|
||||
nitro_vsock_bridge_start_enclave(bridge,
|
||||
(uint32_t)s->enclave_cid, &err);
|
||||
if (err) {
|
||||
error_report_err(err);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* QOM properties */
|
||||
|
||||
static bool nitro_get_debug_mode(Object *obj, Error **errp)
|
||||
{
|
||||
return NITRO_ACCEL(obj)->debug_mode;
|
||||
}
|
||||
|
||||
static void nitro_set_debug_mode(Object *obj, bool value, Error **errp)
|
||||
{
|
||||
NITRO_ACCEL(obj)->debug_mode = value;
|
||||
}
|
||||
|
||||
static void nitro_get_enclave_cid(Object *obj, Visitor *v,
|
||||
const char *name, void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
uint64_t val = NITRO_ACCEL(obj)->enclave_cid;
|
||||
visit_type_uint64(v, name, &val, errp);
|
||||
}
|
||||
|
||||
static void nitro_set_enclave_cid(Object *obj, Visitor *v,
|
||||
const char *name, void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
uint64_t val;
|
||||
if (visit_type_uint64(v, name, &val, errp)) {
|
||||
NITRO_ACCEL(obj)->enclave_cid = val;
|
||||
}
|
||||
}
|
||||
|
||||
static void nitro_accel_class_init(ObjectClass *oc, const void *data)
|
||||
{
|
||||
AccelClass *ac = ACCEL_CLASS(oc);
|
||||
ac->name = "Nitro";
|
||||
ac->init_machine = nitro_init_machine;
|
||||
ac->setup_post = nitro_setup_post;
|
||||
ac->allowed = &nitro_allowed;
|
||||
|
||||
object_class_property_add_bool(oc, "debug-mode",
|
||||
nitro_get_debug_mode,
|
||||
nitro_set_debug_mode);
|
||||
object_class_property_set_description(oc, "debug-mode",
|
||||
"Start enclave in debug mode (enables console output)");
|
||||
|
||||
object_class_property_add(oc, "enclave-cid", "uint64",
|
||||
nitro_get_enclave_cid,
|
||||
nitro_set_enclave_cid,
|
||||
NULL, NULL);
|
||||
object_class_property_set_description(oc, "enclave-cid",
|
||||
"Enclave CID (0 = auto-assigned by Nitro)");
|
||||
}
|
||||
|
||||
static const TypeInfo nitro_accel_type = {
|
||||
.name = TYPE_NITRO_ACCEL,
|
||||
.parent = TYPE_ACCEL,
|
||||
.instance_size = sizeof(NitroAccelState),
|
||||
.class_init = nitro_accel_class_init,
|
||||
};
|
||||
module_obj(TYPE_NITRO_ACCEL);
|
||||
|
||||
static bool nitro_cpus_are_resettable(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static void nitro_accel_ops_class_init(ObjectClass *oc, const void *data)
|
||||
{
|
||||
AccelOpsClass *ops = ACCEL_OPS_CLASS(oc);
|
||||
ops->create_vcpu_thread = dummy_start_vcpu_thread;
|
||||
ops->handle_interrupt = generic_handle_interrupt;
|
||||
ops->cpus_are_resettable = nitro_cpus_are_resettable;
|
||||
}
|
||||
|
||||
static const TypeInfo nitro_accel_ops_type = {
|
||||
.name = ACCEL_OPS_NAME("nitro"),
|
||||
.parent = TYPE_ACCEL_OPS,
|
||||
.class_init = nitro_accel_ops_class_init,
|
||||
.abstract = true,
|
||||
};
|
||||
module_obj(ACCEL_OPS_NAME("nitro"));
|
||||
|
||||
static void nitro_type_init(void)
|
||||
{
|
||||
type_register_static(&nitro_accel_type);
|
||||
type_register_static(&nitro_accel_ops_type);
|
||||
}
|
||||
|
||||
type_init(nitro_type_init);
|
||||
@@ -0,0 +1,6 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
#
|
||||
# See docs/devel/tracing.rst for syntax documentation.
|
||||
|
||||
# nitro-accel.c
|
||||
nitro_enclave_started(uint64_t cid) "nitro: enclave started, CID=%"PRIu64
|
||||
@@ -0,0 +1,2 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
#include "trace/trace-accel_nitro.h"
|
||||
@@ -0,0 +1,4 @@
|
||||
qtest_module_ss = ss.source_set()
|
||||
qtest_module_ss.add(files('qtest.c'))
|
||||
|
||||
modules += {'accel': {'qtest': qtest_module_ss}}
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* QTest accelerator code
|
||||
*
|
||||
* Copyright IBM, Corp. 2011
|
||||
*
|
||||
* Authors:
|
||||
* Anthony Liguori <[email protected]>
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
||||
* See the COPYING file in the top-level directory.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/rcu.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qemu/module.h"
|
||||
#include "qemu/option.h"
|
||||
#include "qemu/config-file.h"
|
||||
#include "qemu/accel.h"
|
||||
#include "accel/accel-ops.h"
|
||||
#include "accel/accel-cpu-ops.h"
|
||||
#include "system/qtest.h"
|
||||
#include "system/cpus.h"
|
||||
#include "qemu/guest-random.h"
|
||||
#include "qemu/main-loop.h"
|
||||
#include "hw/core/cpu.h"
|
||||
#include "accel/dummy-cpus.h"
|
||||
|
||||
static int64_t qtest_clock_counter;
|
||||
|
||||
static int64_t qtest_get_virtual_clock(void)
|
||||
{
|
||||
return qatomic_read(&qtest_clock_counter);
|
||||
}
|
||||
|
||||
static void qtest_set_virtual_clock(int64_t count)
|
||||
{
|
||||
qatomic_set(&qtest_clock_counter, count);
|
||||
}
|
||||
|
||||
static int qtest_init_accel(AccelState *as, MachineState *ms)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void qtest_accel_class_init(ObjectClass *oc, const void *data)
|
||||
{
|
||||
AccelClass *ac = ACCEL_CLASS(oc);
|
||||
ac->name = "QTest";
|
||||
ac->init_machine = qtest_init_accel;
|
||||
ac->allowed = &qtest_allowed;
|
||||
}
|
||||
|
||||
#define TYPE_QTEST_ACCEL ACCEL_CLASS_NAME("qtest")
|
||||
|
||||
static const TypeInfo qtest_accel_type = {
|
||||
.name = TYPE_QTEST_ACCEL,
|
||||
.parent = TYPE_ACCEL,
|
||||
.class_init = qtest_accel_class_init,
|
||||
};
|
||||
module_obj(TYPE_QTEST_ACCEL);
|
||||
|
||||
static void qtest_accel_ops_class_init(ObjectClass *oc, const void *data)
|
||||
{
|
||||
AccelOpsClass *ops = ACCEL_OPS_CLASS(oc);
|
||||
|
||||
ops->create_vcpu_thread = dummy_start_vcpu_thread;
|
||||
ops->get_virtual_clock = qtest_get_virtual_clock;
|
||||
ops->set_virtual_clock = qtest_set_virtual_clock;
|
||||
ops->handle_interrupt = generic_handle_interrupt;
|
||||
};
|
||||
|
||||
static const TypeInfo qtest_accel_ops_type = {
|
||||
.name = ACCEL_OPS_NAME("qtest"),
|
||||
|
||||
.parent = TYPE_ACCEL_OPS,
|
||||
.class_init = qtest_accel_ops_class_init,
|
||||
.abstract = true,
|
||||
};
|
||||
module_obj(ACCEL_OPS_NAME("qtest"));
|
||||
|
||||
static void qtest_type_init(void)
|
||||
{
|
||||
type_register_static(&qtest_accel_type);
|
||||
type_register_static(&qtest_accel_ops_type);
|
||||
}
|
||||
|
||||
type_init(qtest_type_init);
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* HVF stubs for QEMU
|
||||
*
|
||||
* Copyright (c) Linaro
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "system/hvf.h"
|
||||
|
||||
bool hvf_allowed;
|
||||
bool hvf_kernel_irqchip;
|
||||
bool hvf_nested_virt;
|
||||
|
||||
void hvf_nested_virt_enable(bool nested_virt)
|
||||
{
|
||||
/*
|
||||
* This is called unconditionally from hw/arm/virt.c
|
||||
* because we don't know if HVF is going to be used
|
||||
* as that step of initialisation happens later.
|
||||
* As such, do nothing here instead of marking as unreachable.
|
||||
*/
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
/*
|
||||
* QEMU KVM stub
|
||||
*
|
||||
* Copyright Red Hat, Inc. 2010
|
||||
*
|
||||
* Author: Paolo Bonzini <[email protected]>
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
||||
* See the COPYING file in the top-level directory.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "system/kvm.h"
|
||||
#include "hw/pci/msi.h"
|
||||
|
||||
KVMState *kvm_state;
|
||||
bool kvm_kernel_irqchip;
|
||||
bool kvm_async_interrupts_allowed;
|
||||
bool kvm_resamplefds_allowed;
|
||||
bool kvm_msi_via_irqfd_allowed;
|
||||
bool kvm_gsi_routing_allowed;
|
||||
bool kvm_gsi_direct_mapping;
|
||||
bool kvm_allowed;
|
||||
bool kvm_readonly_mem_allowed;
|
||||
bool kvm_msi_use_devid;
|
||||
|
||||
void kvm_flush_coalesced_mmio_buffer(void)
|
||||
{
|
||||
}
|
||||
|
||||
bool kvm_has_sync_mmu(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int kvm_on_sigbus_vcpu(CPUState *cpu, int code, void *addr)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int kvm_on_sigbus(int code, void *addr)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int kvm_irqchip_add_msi_route(AccelRouteChange *c, int vector, PCIDevice *dev)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
void kvm_init_irq_routing(KVMState *s)
|
||||
{
|
||||
}
|
||||
|
||||
void kvm_irqchip_release_virq(KVMState *s, int virq)
|
||||
{
|
||||
}
|
||||
|
||||
int kvm_irqchip_update_msi_route(KVMState *s, int virq, MSIMessage msg,
|
||||
PCIDevice *dev)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
void kvm_irqchip_commit_routes(KVMState *s)
|
||||
{
|
||||
}
|
||||
|
||||
void kvm_irqchip_add_change_notifier(Notifier *n)
|
||||
{
|
||||
}
|
||||
|
||||
void kvm_irqchip_remove_change_notifier(Notifier *n)
|
||||
{
|
||||
}
|
||||
|
||||
void kvm_irqchip_change_notify(void)
|
||||
{
|
||||
}
|
||||
|
||||
void kvm_vmfd_add_change_notifier(NotifierWithReturn *n)
|
||||
{
|
||||
}
|
||||
|
||||
void kvm_vmfd_remove_change_notifier(NotifierWithReturn *n)
|
||||
{
|
||||
}
|
||||
|
||||
void kvm_vcpufd_add_change_notifier(NotifierWithReturn *n)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void kvm_vcpufd_remove_change_notifier(NotifierWithReturn *n)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int kvm_irqchip_add_irqfd_notifier_gsi(KVMState *s, EventNotifier *n,
|
||||
EventNotifier *rn, int virq)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
int kvm_irqchip_remove_irqfd_notifier_gsi(KVMState *s, EventNotifier *n,
|
||||
int virq)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
unsigned int kvm_get_max_memslots(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int kvm_get_free_memslots(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool kvm_arm_supports_user_irq(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool kvm_dirty_ring_enabled(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t kvm_dirty_ring_size(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool kvm_hwpoisoned_mem(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int kvm_create_guest_memfd(uint64_t size, uint64_t flags, Error **errp)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
stub_ss.add(files(
|
||||
'hvf-stub.c',
|
||||
'kvm-stub.c',
|
||||
'nitro-stub.c',
|
||||
'mshv-stub.c',
|
||||
'nvmm-stub.c',
|
||||
'whpx-stub.c',
|
||||
'xen-stub.c',
|
||||
))
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* QEMU MSHV stub
|
||||
*
|
||||
* Copyright Red Hat, Inc. 2025
|
||||
*
|
||||
* Author: Paolo Bonzini <[email protected]>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "hw/pci/msi.h"
|
||||
#include "system/mshv.h"
|
||||
|
||||
bool mshv_allowed;
|
||||
MshvState *mshv_state;
|
||||
|
||||
int mshv_irqchip_add_msi_route(AccelRouteChange *c, int vector, PCIDevice *dev)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
void mshv_irqchip_release_virq(MshvState *s, int virq)
|
||||
{
|
||||
}
|
||||
|
||||
int mshv_irqchip_update_msi_route(int virq, MSIMessage msg, PCIDevice *dev)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
void mshv_irqchip_commit_routes(MshvState *s)
|
||||
{
|
||||
}
|
||||
|
||||
int mshv_irqchip_add_irqfd_notifier_gsi(const EventNotifier *n,
|
||||
const EventNotifier *rn, int virq)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
int mshv_irqchip_remove_irqfd_notifier_gsi(const EventNotifier *n, int virq)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
* Nitro accel stubs for QEMU
|
||||
*
|
||||
* Copyright © 2026 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
|
||||
bool nitro_allowed;
|
||||
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* NVMM stubs for QEMU
|
||||
*
|
||||
* Copyright (c) Linaro
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "system/nvmm.h"
|
||||
|
||||
bool nvmm_allowed;
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* WHPX stubs for QEMU
|
||||
*
|
||||
* Copyright (c) Linaro
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "system/whpx.h"
|
||||
|
||||
bool whpx_allowed;
|
||||
bool whpx_irqchip_in_kernel;
|
||||
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Citrix Systems UK Ltd.
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
||||
* See the COPYING file in the top-level directory.
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "system/xen.h"
|
||||
#include "qapi/qapi-commands-migration.h"
|
||||
|
||||
bool xen_allowed;
|
||||
|
||||
void qmp_xen_set_global_dirty_log(bool enable, Error **errp)
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Common Atomic Helper Functions
|
||||
*
|
||||
* This file should be included before the various instantiations of
|
||||
* the atomic_template.h helpers.
|
||||
*
|
||||
* Copyright (c) 2019 Linaro
|
||||
* Written by Alex Bennée <alex.bennee@linaro.org>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
||||
* See the COPYING file in the top-level directory.
|
||||
*/
|
||||
|
||||
static void atomic_trace_rmw_post(CPUArchState *env, uint64_t addr,
|
||||
uint64_t read_value_low,
|
||||
uint64_t read_value_high,
|
||||
uint64_t write_value_low,
|
||||
uint64_t write_value_high,
|
||||
MemOpIdx oi)
|
||||
{
|
||||
if (cpu_plugin_mem_cbs_enabled(env_cpu(env))) {
|
||||
qemu_plugin_vcpu_mem_cb(env_cpu(env), addr,
|
||||
read_value_low, read_value_high,
|
||||
oi, QEMU_PLUGIN_MEM_R);
|
||||
qemu_plugin_vcpu_mem_cb(env_cpu(env), addr,
|
||||
write_value_low, write_value_high,
|
||||
oi, QEMU_PLUGIN_MEM_W);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Atomic helpers callable from TCG.
|
||||
* These have a common interface and all defer to cpu_atomic_*
|
||||
* using the host return address from GETPC().
|
||||
*/
|
||||
|
||||
#define CMPXCHG_HELPER(OP, TYPE) \
|
||||
TYPE HELPER(atomic_##OP)(CPUArchState *env, uint64_t addr, \
|
||||
TYPE oldv, TYPE newv, uint32_t oi) \
|
||||
{ return cpu_atomic_##OP##_mmu(env, addr, oldv, newv, oi, GETPC()); }
|
||||
|
||||
CMPXCHG_HELPER(cmpxchgb, uint32_t)
|
||||
CMPXCHG_HELPER(cmpxchgw_be, uint32_t)
|
||||
CMPXCHG_HELPER(cmpxchgw_le, uint32_t)
|
||||
CMPXCHG_HELPER(cmpxchgl_be, uint32_t)
|
||||
CMPXCHG_HELPER(cmpxchgl_le, uint32_t)
|
||||
CMPXCHG_HELPER(cmpxchgq_be, uint64_t)
|
||||
CMPXCHG_HELPER(cmpxchgq_le, uint64_t)
|
||||
|
||||
#if HAVE_CMPXCHG128
|
||||
CMPXCHG_HELPER(cmpxchgo_be, Int128)
|
||||
CMPXCHG_HELPER(cmpxchgo_le, Int128)
|
||||
#endif
|
||||
|
||||
#undef CMPXCHG_HELPER
|
||||
|
||||
#define ATOMIC_HELPER(OP, TYPE) \
|
||||
TYPE HELPER(glue(atomic_,OP))(CPUArchState *env, uint64_t addr, \
|
||||
TYPE val, uint32_t oi) \
|
||||
{ return glue(glue(cpu_atomic_,OP),_mmu)(env, addr, val, oi, GETPC()); }
|
||||
|
||||
#define GEN_ATOMIC_HELPERS(OP) \
|
||||
ATOMIC_HELPER(glue(OP,b), uint32_t) \
|
||||
ATOMIC_HELPER(glue(OP,w_be), uint32_t) \
|
||||
ATOMIC_HELPER(glue(OP,w_le), uint32_t) \
|
||||
ATOMIC_HELPER(glue(OP,l_be), uint32_t) \
|
||||
ATOMIC_HELPER(glue(OP,l_le), uint32_t) \
|
||||
ATOMIC_HELPER(glue(OP,q_be), uint64_t) \
|
||||
ATOMIC_HELPER(glue(OP,q_le), uint64_t)
|
||||
|
||||
GEN_ATOMIC_HELPERS(fetch_add)
|
||||
GEN_ATOMIC_HELPERS(fetch_and)
|
||||
GEN_ATOMIC_HELPERS(fetch_or)
|
||||
GEN_ATOMIC_HELPERS(fetch_xor)
|
||||
GEN_ATOMIC_HELPERS(fetch_smin)
|
||||
GEN_ATOMIC_HELPERS(fetch_umin)
|
||||
GEN_ATOMIC_HELPERS(fetch_smax)
|
||||
GEN_ATOMIC_HELPERS(fetch_umax)
|
||||
|
||||
GEN_ATOMIC_HELPERS(add_fetch)
|
||||
GEN_ATOMIC_HELPERS(and_fetch)
|
||||
GEN_ATOMIC_HELPERS(or_fetch)
|
||||
GEN_ATOMIC_HELPERS(xor_fetch)
|
||||
GEN_ATOMIC_HELPERS(smin_fetch)
|
||||
GEN_ATOMIC_HELPERS(umin_fetch)
|
||||
GEN_ATOMIC_HELPERS(smax_fetch)
|
||||
GEN_ATOMIC_HELPERS(umax_fetch)
|
||||
|
||||
GEN_ATOMIC_HELPERS(xchg)
|
||||
|
||||
#if HAVE_CMPXCHG128
|
||||
ATOMIC_HELPER(xchgo_be, Int128)
|
||||
ATOMIC_HELPER(xchgo_le, Int128)
|
||||
ATOMIC_HELPER(fetch_ando_be, Int128)
|
||||
ATOMIC_HELPER(fetch_ando_le, Int128)
|
||||
ATOMIC_HELPER(fetch_oro_be, Int128)
|
||||
ATOMIC_HELPER(fetch_oro_le, Int128)
|
||||
#endif
|
||||
|
||||
#undef ATOMIC_HELPER
|
||||
#undef GEN_ATOMIC_HELPERS
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user