mirror of
https://github.com/utmapp/qemu.git
synced 2026-12-01 22:23:23 -10:00
Compare commits
207
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d6c5c37a2c | ||
|
|
70af4952e1 | ||
|
|
ad6349742c | ||
|
|
9839a5f1ff | ||
|
|
4c5b97bfd0 | ||
|
|
eec4682e99 | ||
|
|
02aa56c4bc | ||
|
|
e06c687fdf | ||
|
|
c8263659f1 | ||
|
|
39d41e855b | ||
|
|
cbe5fa1178 | ||
|
|
4e6515143a | ||
|
|
6f13fa7a98 | ||
|
|
9ed345a14e | ||
|
|
db5732c9cf | ||
|
|
864a024c69 | ||
|
|
08ad262643 | ||
|
|
05b53636d0 | ||
|
|
b192cd1e4f | ||
|
|
63be30e6d5 | ||
|
|
7477477ca7 | ||
|
|
2e31e210a8 | ||
|
|
84816fb63e | ||
|
|
1bd6fd8ed5 | ||
|
|
c8c8b3f1c1 | ||
|
|
7dae0a1dd1 | ||
|
|
872b8fde6c | ||
|
|
aafe6c5836 | ||
|
|
9321c1f2d0 | ||
|
|
2bd9ae7e30 | ||
|
|
45e5dc43b3 | ||
|
|
6a9e5cc61c | ||
|
|
dfba99f17f | ||
|
|
598a40b30f | ||
|
|
9227cc52cc | ||
|
|
67e8498937 | ||
|
|
66907f3d3b | ||
|
|
0c491c8485 | ||
|
|
f072fd2f85 | ||
|
|
d9b68f1add | ||
|
|
702ef9b6ae | ||
|
|
d4a42e8581 | ||
|
|
7114f6eac3 | ||
|
|
8e9c0c079a | ||
|
|
848db5257d | ||
|
|
284e269d7e | ||
|
|
0a10b8f718 | ||
|
|
d3b5a15f8d | ||
|
|
a6518755a6 | ||
|
|
64b070dad3 | ||
|
|
1b2802c49f | ||
|
|
e6b5a0718a | ||
|
|
129927fdae | ||
|
|
28af9ba260 | ||
|
|
81dddc1bb6 | ||
|
|
d4130cbfc6 | ||
|
|
90f8c0f947 | ||
|
|
df7a1f4853 | ||
|
|
ac793156f6 | ||
|
|
39cf73c349 | ||
|
|
d5cca076c3 | ||
|
|
8128c8e8cc | ||
|
|
d31e2ce68d | ||
|
|
532a3af5fb | ||
|
|
b722636972 | ||
|
|
05903f036e | ||
|
|
920f04fa3e | ||
|
|
45f11876ae | ||
|
|
cc73bbded0 | ||
|
|
5d2555a1fe | ||
|
|
514101c0b9 | ||
|
|
b3267ff675 | ||
|
|
3cd27b58dd | ||
|
|
4301acd7d7 | ||
|
|
50244cc76a | ||
|
|
4aedfc0f63 | ||
|
|
e7534f29b1 | ||
|
|
b68a92f4cb | ||
|
|
a0c0c9f8b4 | ||
|
|
19d50149c8 | ||
|
|
ea04dce7bb | ||
|
|
3ab6e68cd0 | ||
|
|
722bde6789 | ||
|
|
be95dffa32 | ||
|
|
cdb490da86 | ||
|
|
f3f69362fd | ||
|
|
b77a52a0c1 | ||
|
|
8ddd611a50 | ||
|
|
61db12d9f9 | ||
|
|
5288145d71 | ||
|
|
c3a404d3be | ||
|
|
d2b08b79b0 | ||
|
|
af0db88254 | ||
|
|
e35c138267 | ||
|
|
714ac05a19 | ||
|
|
6cf4cce7cb | ||
|
|
ff3513e632 | ||
|
|
f12a282ff4 | ||
|
|
090744d552 | ||
|
|
aad3f3bb6c | ||
|
|
9223fda464 | ||
|
|
be1183e52f | ||
|
|
aaa81ec609 | ||
|
|
1847a4a8c2 | ||
|
|
652809dfa6 | ||
|
|
c5e61a6da8 | ||
|
|
c4e6023f05 | ||
|
|
932ca4bbde | ||
|
|
b8eaee96e4 | ||
|
|
4c41341af7 | ||
|
|
8959e0a63a | ||
|
|
c4583c8c39 | ||
|
|
2211118a2a | ||
|
|
5b6a8f4392 | ||
|
|
d76f4f97eb | ||
|
|
000f5b8f46 | ||
|
|
653daf3897 | ||
|
|
e55b178b5e | ||
|
|
051f0e5be1 | ||
|
|
3a565c641a | ||
|
|
eefd2394ef | ||
|
|
b036d9ac69 | ||
|
|
ba2a9a9e63 | ||
|
|
22d30b340a | ||
|
|
bea2a9e3e0 | ||
|
|
ccee80c68d | ||
|
|
69958d8a3d | ||
|
|
bb997e5c96 | ||
|
|
b8df32555c | ||
|
|
c3481ab096 | ||
|
|
31a6f3534a | ||
|
|
464c73e8eb | ||
|
|
3e7e134d82 | ||
|
|
e8a02431ec | ||
|
|
dc7a05da69 | ||
|
|
cb0fa36b31 | ||
|
|
669b96484c | ||
|
|
40a0deb74b | ||
|
|
b950914df3 | ||
|
|
348b8d1a76 | ||
|
|
782d7b30dd | ||
|
|
c47110d90f | ||
|
|
a1b0e46130 | ||
|
|
fc69fa216c | ||
|
|
5bfb4f52fe | ||
|
|
e366766046 | ||
|
|
9dc6ee3fd7 | ||
|
|
a94a689cc5 | ||
|
|
3856873ee4 | ||
|
|
c650263807 | ||
|
|
30fe76b17c | ||
|
|
ac0c8351ab | ||
|
|
5c53015a48 | ||
|
|
09e93326e4 | ||
|
|
2b8575bd5f | ||
|
|
345d7053ca | ||
|
|
f2f984a3b3 | ||
|
|
1e6e616dc2 | ||
|
|
97d6efd0a3 | ||
|
|
3bf4583580 | ||
|
|
88da4b043b | ||
|
|
e90df5eada | ||
|
|
6ebd89cf9c | ||
|
|
68fa519a6c | ||
|
|
5ca2b25269 | ||
|
|
4ba98e96e0 | ||
|
|
cf960317cb | ||
|
|
ca263c0fb9 | ||
|
|
b5330cf19a | ||
|
|
1d2ff14b72 | ||
|
|
a4374f86dc | ||
|
|
27cf0896bf | ||
|
|
acab36ca25 | ||
|
|
9d585eaa87 | ||
|
|
8df525a558 | ||
|
|
c5cdf75613 | ||
|
|
9a2133f45c | ||
|
|
8a6359f937 | ||
|
|
ba25670c1d | ||
|
|
eea1f5bac6 | ||
|
|
6b290b41cb | ||
|
|
e8373c5653 | ||
|
|
79b99fe3f0 | ||
|
|
8543a80691 | ||
|
|
3ca7639ff0 | ||
|
|
dccf092d67 | ||
|
|
7aaab96a9b | ||
|
|
a0713e85bf | ||
|
|
d0bec217ee | ||
|
|
68b981aa76 | ||
|
|
d225b51220 | ||
|
|
8dadffc017 | ||
|
|
62f8f2603d | ||
|
|
2dc29222a6 | ||
|
|
88a844545e | ||
|
|
45964263e4 | ||
|
|
4a367cfb00 | ||
|
|
90e22a57af | ||
|
|
fd723105c1 | ||
|
|
e10a0ca17d | ||
|
|
32eb97b5eb | ||
|
|
be0cb99426 | ||
|
|
8a6c9e0fdd | ||
|
|
8cdf88690d | ||
|
|
5ebc664800 | ||
|
|
01d858629e | ||
|
|
709616c713 |
No files matched your search
+12
-9
@@ -9,11 +9,11 @@ freebsd_12_task:
|
||||
install_script:
|
||||
- ASSUME_ALWAYS_YES=yes pkg bootstrap -f ;
|
||||
- pkg install -y bash curl cyrus-sasl git glib gmake gnutls gsed
|
||||
nettle perl5 pixman pkgconf png usbredir
|
||||
nettle perl5 pixman pkgconf png usbredir ninja
|
||||
script:
|
||||
- mkdir build
|
||||
- cd build
|
||||
- ../configure --enable-werror || { cat config.log; exit 1; }
|
||||
- ../configure --enable-werror || { cat config.log meson-logs/meson-log.txt; exit 1; }
|
||||
- gmake -j$(sysctl -n hw.ncpu)
|
||||
- gmake -j$(sysctl -n hw.ncpu) check V=1
|
||||
|
||||
@@ -21,13 +21,13 @@ macos_task:
|
||||
osx_instance:
|
||||
image: catalina-base
|
||||
install_script:
|
||||
- brew install pkg-config python gnu-sed glib pixman make sdl2 bash
|
||||
- brew install pkg-config python gnu-sed glib pixman make sdl2 bash ninja
|
||||
script:
|
||||
- mkdir build
|
||||
- cd build
|
||||
- ../configure --python=/usr/local/bin/python3 --enable-werror
|
||||
--extra-cflags='-Wno-error=deprecated-declarations'
|
||||
|| { cat config.log; exit 1; }
|
||||
|| { cat config.log meson-logs/meson-log.txt; exit 1; }
|
||||
- gmake -j$(sysctl -n hw.ncpu)
|
||||
- gmake check V=1
|
||||
|
||||
@@ -36,12 +36,12 @@ macos_xcode_task:
|
||||
# this is an alias for the latest Xcode
|
||||
image: catalina-xcode
|
||||
install_script:
|
||||
- brew install pkg-config gnu-sed glib pixman make sdl2 bash
|
||||
- brew install pkg-config gnu-sed glib pixman make sdl2 bash ninja
|
||||
script:
|
||||
- mkdir build
|
||||
- cd build
|
||||
- ../configure --extra-cflags='-Wno-error=deprecated-declarations'
|
||||
--enable-werror --cc=clang || { cat config.log; exit 1; }
|
||||
--enable-werror --cc=clang || { cat config.log meson-logs/meson-log.txt; exit 1; }
|
||||
- gmake -j$(sysctl -n hw.ncpu)
|
||||
- gmake check V=1
|
||||
|
||||
@@ -76,7 +76,6 @@ windows_msys2_task:
|
||||
((Get-Content -path C:\tools\msys64\etc\\post-install\\07-pacman-key.post -Raw) -replace '--refresh-keys', '--version') | Set-Content -Path C:\tools\msys64\etc\\post-install\\07-pacman-key.post
|
||||
C:\tools\msys64\usr\bin\bash.exe -lc "sed -i 's/^CheckSpace/#CheckSpace/g' /etc/pacman.conf"
|
||||
C:\tools\msys64\usr\bin\bash.exe -lc "export"
|
||||
C:\tools\msys64\usr\bin\bash.exe -lc "grep -rl 'repo.msys2.org/' /etc/pacman.d/mirrorlist.* | xargs sed -i 's/repo.msys2.org\//mirrors.tuna.tsinghua.edu.cn\/msys2\//g'"
|
||||
C:\tools\msys64\usr\bin\pacman.exe --noconfirm -Sy
|
||||
echo Y | C:\tools\msys64\usr\bin\pacman.exe --noconfirm -Suu --overwrite=*
|
||||
taskkill /F /FI "MODULES eq msys-2.0.dll"
|
||||
@@ -111,6 +110,11 @@ windows_msys2_task:
|
||||
mingw-w64-x86_64-curl \
|
||||
mingw-w64-x86_64-gnutls \
|
||||
"
|
||||
bitsadmin /transfer msys_download /dynamic /download /priority FOREGROUND `
|
||||
https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-python-sphinx-2.3.1-1-any.pkg.tar.xz `
|
||||
C:\tools\mingw-w64-x86_64-python-sphinx-2.3.1-1-any.pkg.tar.xz
|
||||
C:\tools\msys64\usr\bin\bash.exe -lc "pacman --noconfirm -U /c/tools/mingw-w64-x86_64-python-sphinx-2.3.1-1-any.pkg.tar.xz"
|
||||
del C:\tools\mingw-w64-x86_64-python-sphinx-2.3.1-1-any.pkg.tar.xz
|
||||
C:\tools\msys64\usr\bin\bash.exe -lc "rm -rf /var/cache/pacman/pkg/*"
|
||||
cd C:\tools\msys64
|
||||
echo "Start archive"
|
||||
@@ -123,8 +127,7 @@ windows_msys2_task:
|
||||
|
||||
script:
|
||||
- C:\tools\msys64\usr\bin\bash.exe -lc "mkdir build"
|
||||
- C:\tools\msys64\usr\bin\bash.exe -lc "cd build && ../configure
|
||||
--python=python3 --ninja=ninja"
|
||||
- C:\tools\msys64\usr\bin\bash.exe -lc "cd build && ../configure --python=python3"
|
||||
- C:\tools\msys64\usr\bin\bash.exe -lc "cd build && make -j8"
|
||||
test_script:
|
||||
- C:\tools\msys64\usr\bin\bash.exe -lc "cd build && make V=1 check"
|
||||
+3
-3
@@ -32,7 +32,7 @@ include:
|
||||
../configure --enable-werror $CONFIGURE_ARGS --target-list="$TARGETS" ;
|
||||
else
|
||||
../configure --enable-werror $CONFIGURE_ARGS ;
|
||||
fi
|
||||
fi || { cat config.log meson-logs/meson-log.txt && exit 1; }
|
||||
- make -j"$JOBS"
|
||||
- if test -n "$MAKE_CHECK_ARGS";
|
||||
then
|
||||
@@ -229,7 +229,7 @@ build-tcg-disabled:
|
||||
script:
|
||||
- mkdir build
|
||||
- cd build
|
||||
- ../configure --disable-tcg --audio-drv-list=""
|
||||
- ../configure --disable-tcg --audio-drv-list="" || { cat config.log meson-logs/meson-log.txt && exit 1; }
|
||||
- make -j"$JOBS"
|
||||
- make check-unit
|
||||
- make check-qapi-schema
|
||||
@@ -322,7 +322,7 @@ build-tci:
|
||||
- mkdir build
|
||||
- cd build
|
||||
- ../configure --enable-tcg-interpreter
|
||||
--target-list="$(for tg in $TARGETS; do echo -n ${tg}'-softmmu '; done)"
|
||||
--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 run-tcg-tests-x86_64-softmmu
|
||||
- make tests/qtest/boot-serial-test tests/qtest/cdrom-test tests/qtest/pxe-test
|
||||
|
||||
+1
-4
@@ -51,7 +51,7 @@
|
||||
url = https://git.qemu.org/git/edk2.git
|
||||
[submodule "slirp"]
|
||||
path = slirp
|
||||
url = https://github.com/utmapp/libslirp.git
|
||||
url = https://git.qemu.org/git/libslirp.git
|
||||
[submodule "roms/opensbi"]
|
||||
path = roms/opensbi
|
||||
url = https://git.qemu.org/git/opensbi.git
|
||||
@@ -64,6 +64,3 @@
|
||||
[submodule "roms/vbootrom"]
|
||||
path = roms/vbootrom
|
||||
url = https://git.qemu.org/git/vbootrom.git
|
||||
[submodule "libucontext"]
|
||||
path = libucontext
|
||||
url = https://github.com/utmapp/libucontext.git
|
||||
+17
-4
@@ -49,6 +49,7 @@ addons:
|
||||
- libvdeplug-dev
|
||||
- libvte-2.91-dev
|
||||
- libzstd-dev
|
||||
- ninja-build
|
||||
- sparse
|
||||
- uuid-dev
|
||||
- gcovr
|
||||
@@ -94,7 +95,7 @@ before_install:
|
||||
# Configure step - may be overridden
|
||||
before_script:
|
||||
- mkdir -p ${BUILD_DIR} && cd ${BUILD_DIR}
|
||||
- ${SRC_DIR}/configure ${BASE_CONFIG} ${CONFIG} || { cat config.log && exit 1; }
|
||||
- ${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:
|
||||
@@ -177,6 +178,7 @@ jobs:
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- ninja-build
|
||||
- python3-sphinx
|
||||
- perl
|
||||
|
||||
@@ -197,7 +199,7 @@ jobs:
|
||||
compiler: clang
|
||||
before_script:
|
||||
- mkdir -p ${BUILD_DIR} && cd ${BUILD_DIR}
|
||||
- ${SRC_DIR}/configure ${CONFIG} --extra-cflags="-fsanitize=undefined -Werror" || { cat config.log && exit 1; }
|
||||
- ${SRC_DIR}/configure ${CONFIG} --extra-cflags="-fsanitize=undefined -Werror" || { cat config.log meson-logs/meson-log.txt && exit 1; }
|
||||
|
||||
|
||||
- name: "Clang (other-softmmu)"
|
||||
@@ -211,6 +213,10 @@ jobs:
|
||||
# gprof/gcov are GCC features
|
||||
- name: "GCC gprof/gcov"
|
||||
dist: bionic
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- ninja-build
|
||||
env:
|
||||
- CONFIG="--enable-gprof --enable-gcov --disable-libssh
|
||||
--target-list=${MAIN_SOFTMMU_TARGETS}"
|
||||
@@ -281,6 +287,7 @@ jobs:
|
||||
- liburcu-dev
|
||||
- libusb-1.0-0-dev
|
||||
- libvte-2.91-dev
|
||||
- ninja-build
|
||||
- sparse
|
||||
- uuid-dev
|
||||
language: generic
|
||||
@@ -291,7 +298,7 @@ jobs:
|
||||
- TEST_CMD=""
|
||||
before_script:
|
||||
- mkdir -p ${BUILD_DIR} && cd ${BUILD_DIR}
|
||||
- ${SRC_DIR}/configure ${CONFIG} --extra-cflags="-g3 -O0 -fsanitize=thread" || { cat config.log && exit 1; }
|
||||
- ${SRC_DIR}/configure ${CONFIG} --extra-cflags="-g3 -O0 -fsanitize=thread" || { cat config.log meson-logs/meson-log.txt && exit 1; }
|
||||
|
||||
|
||||
# Run check-tcg against linux-user
|
||||
@@ -346,6 +353,7 @@ jobs:
|
||||
- libusb-1.0-0-dev
|
||||
- libvdeplug-dev
|
||||
- libvte-2.91-dev
|
||||
- ninja-build
|
||||
# Tests dependencies
|
||||
- genisoimage
|
||||
env:
|
||||
@@ -379,6 +387,7 @@ jobs:
|
||||
- libusb-1.0-0-dev
|
||||
- libvdeplug-dev
|
||||
- libvte-2.91-dev
|
||||
- ninja-build
|
||||
# Tests dependencies
|
||||
- genisoimage
|
||||
env:
|
||||
@@ -411,6 +420,7 @@ jobs:
|
||||
- libusb-1.0-0-dev
|
||||
- libvdeplug-dev
|
||||
- libvte-2.91-dev
|
||||
- ninja-build
|
||||
# Tests dependencies
|
||||
- genisoimage
|
||||
env:
|
||||
@@ -450,6 +460,7 @@ jobs:
|
||||
- libzstd-dev
|
||||
- nettle-dev
|
||||
- xfslibs-dev
|
||||
- ninja-build
|
||||
# Tests dependencies
|
||||
- genisoimage
|
||||
env:
|
||||
@@ -463,6 +474,7 @@ jobs:
|
||||
apt_packages:
|
||||
- libgcrypt20-dev
|
||||
- libgnutls28-dev
|
||||
- ninja-build
|
||||
env:
|
||||
- CONFIG="--disable-containers --disable-system"
|
||||
|
||||
@@ -493,6 +505,7 @@ jobs:
|
||||
- libusb-1.0-0-dev
|
||||
- libvdeplug-dev
|
||||
- libvte-2.91-dev
|
||||
- ninja-build
|
||||
env:
|
||||
- TEST_CMD="make check-unit"
|
||||
- CONFIG="--disable-containers --disable-tcg --enable-kvm
|
||||
@@ -517,7 +530,7 @@ jobs:
|
||||
- ls -l ${SRC_DIR}/qemu-${QEMU_VERSION}.tar.bz2
|
||||
- tar -xf ${SRC_DIR}/qemu-${QEMU_VERSION}.tar.bz2 && cd qemu-${QEMU_VERSION}
|
||||
- mkdir -p release-build && cd release-build
|
||||
- ../configure ${BASE_CONFIG} ${CONFIG} || { cat config.log && exit 1; }
|
||||
- ../configure ${BASE_CONFIG} ${CONFIG} || { cat config.log meson-logs/meson-log.txt && exit 1; }
|
||||
- make install
|
||||
allow_failures:
|
||||
- env: UNRELIABLE=true
|
||||
+17
-17
@@ -220,11 +220,11 @@ F: hw/microblaze/
|
||||
F: disas/microblaze.c
|
||||
|
||||
MIPS TCG CPUs
|
||||
M: Aleksandar Markovic <[email protected]>
|
||||
M: Philippe Mathieu-Daudé <[email protected]>
|
||||
R: Aurelien Jarno <[email protected]>
|
||||
R: Jiaxun Yang <[email protected]>
|
||||
R: Aleksandar Rikalo <[email protected]>
|
||||
S: Maintained
|
||||
S: Odd Fixes
|
||||
F: target/mips/
|
||||
F: default-configs/*mips*
|
||||
F: disas/*mips*
|
||||
@@ -237,8 +237,6 @@ F: include/hw/intc/mips_gic.h
|
||||
F: include/hw/mips/
|
||||
F: include/hw/misc/mips_*
|
||||
F: include/hw/timer/mips_gictimer.h
|
||||
F: tests/acceptance/linux_ssh_mips_malta.py
|
||||
F: tests/acceptance/machine_mips_malta.py
|
||||
F: tests/tcg/mips/
|
||||
K: ^Subject:.*(?i)mips
|
||||
|
||||
@@ -386,7 +384,6 @@ F: target/arm/kvm.c
|
||||
|
||||
MIPS KVM CPUs
|
||||
M: Huacai Chen <[email protected]>
|
||||
M: Aleksandar Markovic <[email protected]>
|
||||
S: Odd Fixes
|
||||
F: target/mips/kvm.c
|
||||
|
||||
@@ -1123,10 +1120,9 @@ F: hw/display/jazz_led.c
|
||||
F: hw/dma/rc4030.c
|
||||
|
||||
Malta
|
||||
M: Aleksandar Markovic <[email protected]>
|
||||
M: Philippe Mathieu-Daudé <[email protected]>
|
||||
R: Aurelien Jarno <[email protected]>
|
||||
S: Maintained
|
||||
S: Odd Fixes
|
||||
F: hw/isa/piix4.c
|
||||
F: hw/acpi/piix4.c
|
||||
F: hw/mips/malta.c
|
||||
@@ -1136,14 +1132,12 @@ F: tests/acceptance/linux_ssh_mips_malta.py
|
||||
F: tests/acceptance/machine_mips_malta.py
|
||||
|
||||
Mipssim
|
||||
M: Aleksandar Markovic <[email protected]>
|
||||
R: Aleksandar Rikalo <[email protected]>
|
||||
S: Odd Fixes
|
||||
S: Orphaned
|
||||
F: hw/mips/mipssim.c
|
||||
F: hw/net/mipsnet.c
|
||||
|
||||
R4000
|
||||
M: Aleksandar Markovic <[email protected]>
|
||||
R: Aurelien Jarno <[email protected]>
|
||||
R: Aleksandar Rikalo <[email protected]>
|
||||
S: Obsolete
|
||||
@@ -1152,7 +1146,6 @@ F: hw/mips/r4k.c
|
||||
Fuloong 2E
|
||||
M: Huacai Chen <[email protected]>
|
||||
M: Philippe Mathieu-Daudé <[email protected]>
|
||||
M: Aleksandar Markovic <[email protected]>
|
||||
R: Jiaxun Yang <[email protected]>
|
||||
S: Odd Fixes
|
||||
F: hw/mips/fuloong2e.c
|
||||
@@ -1167,9 +1160,9 @@ S: Maintained
|
||||
F: hw/intc/loongson_liointc.c
|
||||
|
||||
Boston
|
||||
M: Paul Burton <pburton@wavecomp.com>
|
||||
M: Paul Burton <paulburton@kernel.org>
|
||||
R: Aleksandar Rikalo <[email protected]>
|
||||
S: Maintained
|
||||
S: Odd Fixes
|
||||
F: hw/core/loader-fit.c
|
||||
F: hw/mips/boston.c
|
||||
F: hw/pci-host/xilinx-pcie.c
|
||||
@@ -2380,11 +2373,18 @@ S: Maintained
|
||||
F: include/sysemu/cryptodev*.h
|
||||
F: backends/cryptodev*.c
|
||||
|
||||
Python library
|
||||
M: John Snow <[email protected]>
|
||||
M: Cleber Rosa <[email protected]>
|
||||
R: Eduardo Habkost <[email protected]>
|
||||
S: Maintained
|
||||
F: python/
|
||||
T: git https://gitlab.com/jsnow/qemu.git python
|
||||
|
||||
Python scripts
|
||||
M: Eduardo Habkost <[email protected]>
|
||||
M: Cleber Rosa <[email protected]>
|
||||
S: Odd fixes
|
||||
F: python/qemu/*py
|
||||
F: scripts/*.py
|
||||
F: tests/*.py
|
||||
|
||||
@@ -2823,12 +2823,12 @@ F: tcg/i386/
|
||||
F: disas/i386.c
|
||||
|
||||
MIPS TCG target
|
||||
M: Aleksandar Markovic <[email protected]>
|
||||
M: Philippe Mathieu-Daudé <[email protected]>
|
||||
R: Aurelien Jarno <[email protected]>
|
||||
R: Huacai Chen <[email protected]>
|
||||
R: Jiaxun Yang <[email protected]>
|
||||
R: Aleksandar Rikalo <[email protected]>
|
||||
S: Maintained
|
||||
S: Odd Fixes
|
||||
F: tcg/mips/
|
||||
|
||||
PPC TCG target
|
||||
@@ -3169,7 +3169,7 @@ S: Odd Fixes
|
||||
F: scripts/git-submodule.sh
|
||||
|
||||
UI translations
|
||||
M: Aleksandar Markovic <[email protected]>
|
||||
S: Orphaned
|
||||
F: po/*.po
|
||||
|
||||
Sphinx documentation configuration and build machinery
|
||||
|
||||
@@ -14,6 +14,8 @@ SRC_PATH=.
|
||||
# we have explicit rules for everything
|
||||
MAKEFLAGS += -rR
|
||||
|
||||
SHELL = /usr/bin/env 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
|
||||
@@ -28,13 +30,21 @@ UNCHECKED_GOALS := %clean TAGS cscope ctags dist \
|
||||
help check-help print-% \
|
||||
docker docker-% 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),)
|
||||
# Put the all: rule here so that config-host.mak can contain dependencies.
|
||||
all:
|
||||
include config-host.mak
|
||||
|
||||
git-submodule-update:
|
||||
.git-submodule-status: git-submodule-update config-host.mak
|
||||
Makefile: .git-submodule-status
|
||||
|
||||
.PHONY: git-submodule-update
|
||||
|
||||
@@ -62,28 +72,7 @@ git-submodule-update:
|
||||
endif
|
||||
endif
|
||||
|
||||
export NINJA=./ninjatool
|
||||
|
||||
# Running meson regenerates both build.ninja and ninjatool, and that is
|
||||
# enough to prime the rest of the build.
|
||||
ninjatool: build.ninja
|
||||
|
||||
Makefile.ninja: build.ninja ninjatool
|
||||
./ninjatool -t ninja2make --omit clean dist uninstall cscope TAGS ctags < $< > $@
|
||||
-include Makefile.ninja
|
||||
|
||||
${ninja-targets-c_COMPILER} ${ninja-targets-cpp_COMPILER}: .var.command += -MP
|
||||
|
||||
# If MESON is empty, the rule will be re-evaluated after Makefiles are
|
||||
# reread (and MESON won't be empty anymore).
|
||||
ifneq ($(MESON),)
|
||||
Makefile.mtest: build.ninja scripts/mtest2make.py
|
||||
$(MESON) introspect --targets --tests --benchmarks | $(PYTHON) scripts/mtest2make.py > $@
|
||||
-include Makefile.mtest
|
||||
endif
|
||||
|
||||
Makefile: .git-submodule-status
|
||||
.git-submodule-status: git-submodule-update 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.
|
||||
@@ -95,6 +84,21 @@ seems to have been used for an in-tree build. You can fix this by running \
|
||||
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)
|
||||
endif
|
||||
ifeq ($(wildcard build.ninja),)
|
||||
.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)/pc-bios $(SRC_PATH)/VERSION
|
||||
@echo $@ is out-of-date, running configure
|
||||
@if test -f meson-private/coredata.dat; then \
|
||||
@@ -103,6 +107,46 @@ config-host.mak: $(SRC_PATH)/configure $(SRC_PATH)/pc-bios $(SRC_PATH)/VERSION
|
||||
./config.status; \
|
||||
fi
|
||||
|
||||
# 2. ensure generated build files are up-to-date
|
||||
|
||||
ifneq ($(NINJA),)
|
||||
# A separate rule is needed for Makefile dependencies to avoid -n
|
||||
export NINJA
|
||||
Makefile.ninja: build.ninja
|
||||
$(quiet-@){ echo 'ninja-targets = \'; $(NINJA) -t targets all | sed 's/:.*//; $$!s/$$/ \\/'; } > $@
|
||||
-include Makefile.ninja
|
||||
endif
|
||||
|
||||
ifneq ($(MESON),)
|
||||
# The dependency on config-host.mak ensures that meson has run
|
||||
Makefile.mtest: build.ninja scripts/mtest2make.py config-host.mak
|
||||
$(MESON) introspect --targets --tests --benchmarks | $(PYTHON) scripts/mtest2make.py > $@
|
||||
-include Makefile.mtest
|
||||
endif
|
||||
|
||||
# 3. Rules to bridge to other makefiles
|
||||
|
||||
ifneq ($(NINJA),)
|
||||
NINJAFLAGS = $(if $V,-v,) \
|
||||
$(filter-out -j, $(lastword -j1 $(filter -l% -j%, $(MAKEFLAGS)))) \
|
||||
$(subst -k, -k0, $(filter -n -k,$(MAKEFLAGS)))
|
||||
|
||||
ninja-cmd-goals = $(or $(MAKECMDGOALS), all)
|
||||
ninja-cmd-goals += $(foreach t, $(.tests), $(.test.deps.$t))
|
||||
|
||||
makefile-targets := build.ninja ctags TAGS cscope dist clean uninstall
|
||||
ninja-targets := $(filter-out $(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)),)
|
||||
+@$(NINJA) $(NINJAFLAGS) $(sort $(filter $(ninja-targets), $(ninja-cmd-goals))) | cat
|
||||
endif
|
||||
endif
|
||||
|
||||
# Force configure to re-run if the API symbols are updated
|
||||
ifeq ($(CONFIG_PLUGIN),y)
|
||||
config-host.mak: $(SRC_PATH)/plugins/qemu-plugins.symbols
|
||||
@@ -112,37 +156,21 @@ plugins:
|
||||
$(call quiet-command,\
|
||||
$(MAKE) $(SUBDIR_MAKEFLAGS) -C contrib/plugins V="$(V)", \
|
||||
"BUILD", "example plugins")
|
||||
endif
|
||||
endif # $(CONFIG_PLUGIN)
|
||||
|
||||
else
|
||||
else # config-host.mak does not exist
|
||||
config-host.mak:
|
||||
ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
|
||||
@echo "Please call configure before running make!"
|
||||
@exit 1
|
||||
endif
|
||||
endif
|
||||
|
||||
# Only needed in case Makefile.ninja does not exist.
|
||||
.PHONY: ninja-clean ninja-distclean clean-ctlist
|
||||
clean-ctlist:
|
||||
ninja-clean::
|
||||
ninja-distclean::
|
||||
build.ninja: config-host.mak
|
||||
|
||||
# Don't try to regenerate Makefile or configure
|
||||
# We don't generate any of them
|
||||
Makefile: ;
|
||||
configure: ;
|
||||
|
||||
.PHONY: all clean distclean install \
|
||||
recurse-all dist msi FORCE
|
||||
endif # config-host.mak does not exist
|
||||
|
||||
SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory --quiet)
|
||||
|
||||
include $(SRC_PATH)/tests/Makefile.include
|
||||
|
||||
all: recurse-all
|
||||
Makefile:
|
||||
|
||||
ROM_DIRS = $(addprefix pc-bios/, $(ROMS))
|
||||
ROM_DIRS_RULES=$(foreach t, all clean, $(addsuffix /$(t), $(ROM_DIRS)))
|
||||
@@ -157,8 +185,9 @@ recurse-clean: $(addsuffix /clean, $(ROM_DIRS))
|
||||
|
||||
######################################################################
|
||||
|
||||
clean: recurse-clean ninja-clean clean-ctlist
|
||||
if test -f ninjatool; then ./ninjatool $(if $(V),-v,) -t clean; fi
|
||||
clean: recurse-clean
|
||||
-@test -f build.ninja && $(quiet-@)$(NINJA) $(NINJAFLAGS) -t clean || :
|
||||
-@test -f build.ninja && $(NINJA) $(NINJAFLAGS) clean-ctlist || :
|
||||
# avoid old build problems by removing potentially incorrect old files
|
||||
rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
|
||||
find . \( -name '*.so' -o -name '*.dll' -o -name '*.[oda]' \) -type f \
|
||||
@@ -175,8 +204,8 @@ dist: qemu-$(VERSION).tar.bz2
|
||||
qemu-%.tar.bz2:
|
||||
$(SRC_PATH)/scripts/make-release "$(SRC_PATH)" "$(patsubst qemu-%.tar.bz2,%,$@)"
|
||||
|
||||
distclean: clean ninja-distclean
|
||||
-test -f ninjatool && ./ninjatool $(if $(V),-v,) -t clean -g
|
||||
distclean: clean
|
||||
-@test -f build.ninja && $(quiet-@)$(NINJA) $(NINJAFLAGS) -t clean -g || :
|
||||
rm -f config-host.mak config-host.h*
|
||||
rm -f tests/tcg/config-*.mak
|
||||
rm -f config-all-disas.mak config.status
|
||||
@@ -185,7 +214,7 @@ distclean: clean ninja-distclean
|
||||
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 ninjatool ninjatool.stamp Makefile.mtest
|
||||
rm -f Makefile.ninja Makefile.mtest
|
||||
rm -f config.log
|
||||
rm -f linux-headers/asm
|
||||
rm -Rf .sdk
|
||||
@@ -194,19 +223,19 @@ find-src-path = find "$(SRC_PATH)/" -path "$(SRC_PATH)/meson" -prune -o -name "*
|
||||
|
||||
.PHONY: ctags
|
||||
ctags:
|
||||
rm -f tags
|
||||
$(find-src-path) -exec ctags --append {} +
|
||||
rm -f "$(SRC_PATH)/"tags
|
||||
$(find-src-path) -exec ctags -f "$(SRC_PATH)/"tags --append {} +
|
||||
|
||||
.PHONY: TAGS
|
||||
TAGS:
|
||||
rm -f TAGS
|
||||
$(find-src-path) -exec etags --append {} +
|
||||
rm -f "$(SRC_PATH)/"TAGS
|
||||
$(find-src-path) -exec etags -f "$(SRC_PATH)/"TAGS --append {} +
|
||||
|
||||
.PHONY: cscope
|
||||
cscope:
|
||||
rm -f "$(SRC_PATH)"/cscope.*
|
||||
$(find-src-path) -print | sed -e 's,^\./,,' > "$(SRC_PATH)/cscope.files"
|
||||
cscope -b -i"$(SRC_PATH)/cscope.files"
|
||||
cscope -b -i"$(SRC_PATH)/cscope.files" -f"$(SRC_PATH)"/cscope.out
|
||||
|
||||
# Needed by "meson install"
|
||||
export DESTDIR
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "sysemu/xen.h"
|
||||
#include "qapi/qapi-commands-misc.h"
|
||||
#include "qapi/qapi-commands-migration.h"
|
||||
|
||||
bool xen_allowed;
|
||||
|
||||
|
||||
@@ -64,8 +64,6 @@ void cpu_reloading_memory_map(void)
|
||||
|
||||
void cpu_loop_exit(CPUState *cpu)
|
||||
{
|
||||
/* Unlock JIT write protect if applicable. */
|
||||
tb_exec_unlock();
|
||||
/* Undo the setting in cpu_tb_exec. */
|
||||
cpu->can_do_io = 1;
|
||||
siglongjmp(cpu->jmp_env, 1);
|
||||
|
||||
@@ -175,9 +175,7 @@ static inline tcg_target_ulong cpu_tb_exec(CPUState *cpu, TranslationBlock *itb)
|
||||
}
|
||||
#endif /* DEBUG_DISAS */
|
||||
|
||||
tb_exec_lock();
|
||||
ret = tcg_qemu_tb_exec(env, tb_ptr);
|
||||
tb_exec_unlock();
|
||||
cpu->can_do_io = 1;
|
||||
last_tb = (TranslationBlock *)(ret & ~TB_EXIT_MASK);
|
||||
tb_exit = ret & TB_EXIT_MASK;
|
||||
@@ -356,7 +354,7 @@ void tb_set_jmp_target(TranslationBlock *tb, int n, uintptr_t addr)
|
||||
if (TCG_TARGET_HAS_direct_jump) {
|
||||
uintptr_t offset = tb->jmp_target_arg[n];
|
||||
uintptr_t tc_ptr = (uintptr_t)tb->tc.ptr;
|
||||
#if defined(CONFIG_IOS_JIT)
|
||||
#if defined(CONFIG_MIRROR_JIT)
|
||||
uintptr_t wr_addr = tc_ptr + offset + tb->code_rw_mirror_diff;
|
||||
#else
|
||||
uintptr_t wr_addr = tc_ptr + offset;
|
||||
|
||||
+266
-9
@@ -409,12 +409,21 @@ void tlb_flush_all_cpus_synced(CPUState *src_cpu)
|
||||
tlb_flush_by_mmuidx_all_cpus_synced(src_cpu, ALL_MMUIDX_BITS);
|
||||
}
|
||||
|
||||
static bool tlb_hit_page_mask_anyprot(CPUTLBEntry *tlb_entry,
|
||||
target_ulong page, target_ulong mask)
|
||||
{
|
||||
page &= mask;
|
||||
mask &= TARGET_PAGE_MASK | TLB_INVALID_MASK;
|
||||
|
||||
return (page == (tlb_entry->addr_read & mask) ||
|
||||
page == (tlb_addr_write(tlb_entry) & mask) ||
|
||||
page == (tlb_entry->addr_code & mask));
|
||||
}
|
||||
|
||||
static inline bool tlb_hit_page_anyprot(CPUTLBEntry *tlb_entry,
|
||||
target_ulong page)
|
||||
{
|
||||
return tlb_hit_page(tlb_entry->addr_read, page) ||
|
||||
tlb_hit_page(tlb_addr_write(tlb_entry), page) ||
|
||||
tlb_hit_page(tlb_entry->addr_code, page);
|
||||
return tlb_hit_page_mask_anyprot(tlb_entry, page, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -427,31 +436,45 @@ static inline bool tlb_entry_is_empty(const CPUTLBEntry *te)
|
||||
}
|
||||
|
||||
/* Called with tlb_c.lock held */
|
||||
static inline bool tlb_flush_entry_locked(CPUTLBEntry *tlb_entry,
|
||||
target_ulong page)
|
||||
static bool tlb_flush_entry_mask_locked(CPUTLBEntry *tlb_entry,
|
||||
target_ulong page,
|
||||
target_ulong mask)
|
||||
{
|
||||
if (tlb_hit_page_anyprot(tlb_entry, page)) {
|
||||
if (tlb_hit_page_mask_anyprot(tlb_entry, page, mask)) {
|
||||
memset(tlb_entry, -1, sizeof(*tlb_entry));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool tlb_flush_entry_locked(CPUTLBEntry *tlb_entry,
|
||||
target_ulong page)
|
||||
{
|
||||
return tlb_flush_entry_mask_locked(tlb_entry, page, -1);
|
||||
}
|
||||
|
||||
/* Called with tlb_c.lock held */
|
||||
static inline void tlb_flush_vtlb_page_locked(CPUArchState *env, int mmu_idx,
|
||||
target_ulong page)
|
||||
static void tlb_flush_vtlb_page_mask_locked(CPUArchState *env, int mmu_idx,
|
||||
target_ulong page,
|
||||
target_ulong mask)
|
||||
{
|
||||
CPUTLBDesc *d = &env_tlb(env)->d[mmu_idx];
|
||||
int k;
|
||||
|
||||
assert_cpu_is_self(env_cpu(env));
|
||||
for (k = 0; k < CPU_VTLB_SIZE; k++) {
|
||||
if (tlb_flush_entry_locked(&d->vtable[k], page)) {
|
||||
if (tlb_flush_entry_mask_locked(&d->vtable[k], page, mask)) {
|
||||
tlb_n_used_entries_dec(env, mmu_idx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void tlb_flush_vtlb_page_locked(CPUArchState *env, int mmu_idx,
|
||||
target_ulong page)
|
||||
{
|
||||
tlb_flush_vtlb_page_mask_locked(env, mmu_idx, page, -1);
|
||||
}
|
||||
|
||||
static void tlb_flush_page_locked(CPUArchState *env, int midx,
|
||||
target_ulong page)
|
||||
{
|
||||
@@ -666,6 +689,240 @@ void tlb_flush_page_all_cpus_synced(CPUState *src, target_ulong addr)
|
||||
tlb_flush_page_by_mmuidx_all_cpus_synced(src, addr, ALL_MMUIDX_BITS);
|
||||
}
|
||||
|
||||
static void tlb_flush_page_bits_locked(CPUArchState *env, int midx,
|
||||
target_ulong page, unsigned bits)
|
||||
{
|
||||
CPUTLBDesc *d = &env_tlb(env)->d[midx];
|
||||
CPUTLBDescFast *f = &env_tlb(env)->f[midx];
|
||||
target_ulong mask = MAKE_64BIT_MASK(0, bits);
|
||||
|
||||
/*
|
||||
* If @bits is smaller than the tlb size, there may be multiple entries
|
||||
* within the TLB; otherwise all addresses that match under @mask hit
|
||||
* the same TLB entry.
|
||||
*
|
||||
* TODO: Perhaps allow bits to be a few bits less than the size.
|
||||
* For now, just flush the entire TLB.
|
||||
*/
|
||||
if (mask < f->mask) {
|
||||
tlb_debug("forcing full flush midx %d ("
|
||||
TARGET_FMT_lx "/" TARGET_FMT_lx ")\n",
|
||||
midx, page, mask);
|
||||
tlb_flush_one_mmuidx_locked(env, midx, get_clock_realtime());
|
||||
return;
|
||||
}
|
||||
|
||||
/* Check if we need to flush due to large pages. */
|
||||
if ((page & d->large_page_mask) == d->large_page_addr) {
|
||||
tlb_debug("forcing full flush midx %d ("
|
||||
TARGET_FMT_lx "/" TARGET_FMT_lx ")\n",
|
||||
midx, d->large_page_addr, d->large_page_mask);
|
||||
tlb_flush_one_mmuidx_locked(env, midx, get_clock_realtime());
|
||||
return;
|
||||
}
|
||||
|
||||
if (tlb_flush_entry_mask_locked(tlb_entry(env, midx, page), page, mask)) {
|
||||
tlb_n_used_entries_dec(env, midx);
|
||||
}
|
||||
tlb_flush_vtlb_page_mask_locked(env, midx, page, mask);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
target_ulong addr;
|
||||
uint16_t idxmap;
|
||||
uint16_t bits;
|
||||
} TLBFlushPageBitsByMMUIdxData;
|
||||
|
||||
static void
|
||||
tlb_flush_page_bits_by_mmuidx_async_0(CPUState *cpu,
|
||||
TLBFlushPageBitsByMMUIdxData d)
|
||||
{
|
||||
CPUArchState *env = cpu->env_ptr;
|
||||
int mmu_idx;
|
||||
|
||||
assert_cpu_is_self(cpu);
|
||||
|
||||
tlb_debug("page addr:" TARGET_FMT_lx "/%u mmu_map:0x%x\n",
|
||||
d.addr, d.bits, d.idxmap);
|
||||
|
||||
qemu_spin_lock(&env_tlb(env)->c.lock);
|
||||
for (mmu_idx = 0; mmu_idx < NB_MMU_MODES; mmu_idx++) {
|
||||
if ((d.idxmap >> mmu_idx) & 1) {
|
||||
tlb_flush_page_bits_locked(env, mmu_idx, d.addr, d.bits);
|
||||
}
|
||||
}
|
||||
qemu_spin_unlock(&env_tlb(env)->c.lock);
|
||||
|
||||
tb_flush_jmp_cache(cpu, d.addr);
|
||||
}
|
||||
|
||||
static bool encode_pbm_to_runon(run_on_cpu_data *out,
|
||||
TLBFlushPageBitsByMMUIdxData d)
|
||||
{
|
||||
/* We need 6 bits to hold to hold @bits up to 63. */
|
||||
if (d.idxmap <= MAKE_64BIT_MASK(0, TARGET_PAGE_BITS - 6)) {
|
||||
*out = RUN_ON_CPU_TARGET_PTR(d.addr | (d.idxmap << 6) | d.bits);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static TLBFlushPageBitsByMMUIdxData
|
||||
decode_runon_to_pbm(run_on_cpu_data data)
|
||||
{
|
||||
target_ulong addr_map_bits = (target_ulong) data.target_ptr;
|
||||
return (TLBFlushPageBitsByMMUIdxData){
|
||||
.addr = addr_map_bits & TARGET_PAGE_MASK,
|
||||
.idxmap = (addr_map_bits & ~TARGET_PAGE_MASK) >> 6,
|
||||
.bits = addr_map_bits & 0x3f
|
||||
};
|
||||
}
|
||||
|
||||
static void tlb_flush_page_bits_by_mmuidx_async_1(CPUState *cpu,
|
||||
run_on_cpu_data runon)
|
||||
{
|
||||
tlb_flush_page_bits_by_mmuidx_async_0(cpu, decode_runon_to_pbm(runon));
|
||||
}
|
||||
|
||||
static void tlb_flush_page_bits_by_mmuidx_async_2(CPUState *cpu,
|
||||
run_on_cpu_data data)
|
||||
{
|
||||
TLBFlushPageBitsByMMUIdxData *d = data.host_ptr;
|
||||
tlb_flush_page_bits_by_mmuidx_async_0(cpu, *d);
|
||||
g_free(d);
|
||||
}
|
||||
|
||||
void tlb_flush_page_bits_by_mmuidx(CPUState *cpu, target_ulong addr,
|
||||
uint16_t idxmap, unsigned bits)
|
||||
{
|
||||
TLBFlushPageBitsByMMUIdxData d;
|
||||
run_on_cpu_data runon;
|
||||
|
||||
/* If all bits are significant, this devolves to tlb_flush_page. */
|
||||
if (bits >= TARGET_LONG_BITS) {
|
||||
tlb_flush_page_by_mmuidx(cpu, addr, idxmap);
|
||||
return;
|
||||
}
|
||||
/* If no page bits are significant, this devolves to tlb_flush. */
|
||||
if (bits < TARGET_PAGE_BITS) {
|
||||
tlb_flush_by_mmuidx(cpu, idxmap);
|
||||
return;
|
||||
}
|
||||
|
||||
/* This should already be page aligned */
|
||||
d.addr = addr & TARGET_PAGE_MASK;
|
||||
d.idxmap = idxmap;
|
||||
d.bits = bits;
|
||||
|
||||
if (qemu_cpu_is_self(cpu)) {
|
||||
tlb_flush_page_bits_by_mmuidx_async_0(cpu, d);
|
||||
} else if (encode_pbm_to_runon(&runon, d)) {
|
||||
async_run_on_cpu(cpu, tlb_flush_page_bits_by_mmuidx_async_1, runon);
|
||||
} else {
|
||||
TLBFlushPageBitsByMMUIdxData *p
|
||||
= g_new(TLBFlushPageBitsByMMUIdxData, 1);
|
||||
|
||||
/* Otherwise allocate a structure, freed by the worker. */
|
||||
*p = d;
|
||||
async_run_on_cpu(cpu, tlb_flush_page_bits_by_mmuidx_async_2,
|
||||
RUN_ON_CPU_HOST_PTR(p));
|
||||
}
|
||||
}
|
||||
|
||||
void tlb_flush_page_bits_by_mmuidx_all_cpus(CPUState *src_cpu,
|
||||
target_ulong addr,
|
||||
uint16_t idxmap,
|
||||
unsigned bits)
|
||||
{
|
||||
TLBFlushPageBitsByMMUIdxData d;
|
||||
run_on_cpu_data runon;
|
||||
|
||||
/* If all bits are significant, this devolves to tlb_flush_page. */
|
||||
if (bits >= TARGET_LONG_BITS) {
|
||||
tlb_flush_page_by_mmuidx_all_cpus(src_cpu, addr, idxmap);
|
||||
return;
|
||||
}
|
||||
/* If no page bits are significant, this devolves to tlb_flush. */
|
||||
if (bits < TARGET_PAGE_BITS) {
|
||||
tlb_flush_by_mmuidx_all_cpus(src_cpu, idxmap);
|
||||
return;
|
||||
}
|
||||
|
||||
/* This should already be page aligned */
|
||||
d.addr = addr & TARGET_PAGE_MASK;
|
||||
d.idxmap = idxmap;
|
||||
d.bits = bits;
|
||||
|
||||
if (encode_pbm_to_runon(&runon, d)) {
|
||||
flush_all_helper(src_cpu, tlb_flush_page_bits_by_mmuidx_async_1, runon);
|
||||
} else {
|
||||
CPUState *dst_cpu;
|
||||
TLBFlushPageBitsByMMUIdxData *p;
|
||||
|
||||
/* Allocate a separate data block for each destination cpu. */
|
||||
CPU_FOREACH(dst_cpu) {
|
||||
if (dst_cpu != src_cpu) {
|
||||
p = g_new(TLBFlushPageBitsByMMUIdxData, 1);
|
||||
*p = d;
|
||||
async_run_on_cpu(dst_cpu,
|
||||
tlb_flush_page_bits_by_mmuidx_async_2,
|
||||
RUN_ON_CPU_HOST_PTR(p));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tlb_flush_page_bits_by_mmuidx_async_0(src_cpu, d);
|
||||
}
|
||||
|
||||
void tlb_flush_page_bits_by_mmuidx_all_cpus_synced(CPUState *src_cpu,
|
||||
target_ulong addr,
|
||||
uint16_t idxmap,
|
||||
unsigned bits)
|
||||
{
|
||||
TLBFlushPageBitsByMMUIdxData d;
|
||||
run_on_cpu_data runon;
|
||||
|
||||
/* If all bits are significant, this devolves to tlb_flush_page. */
|
||||
if (bits >= TARGET_LONG_BITS) {
|
||||
tlb_flush_page_by_mmuidx_all_cpus_synced(src_cpu, addr, idxmap);
|
||||
return;
|
||||
}
|
||||
/* If no page bits are significant, this devolves to tlb_flush. */
|
||||
if (bits < TARGET_PAGE_BITS) {
|
||||
tlb_flush_by_mmuidx_all_cpus_synced(src_cpu, idxmap);
|
||||
return;
|
||||
}
|
||||
|
||||
/* This should already be page aligned */
|
||||
d.addr = addr & TARGET_PAGE_MASK;
|
||||
d.idxmap = idxmap;
|
||||
d.bits = bits;
|
||||
|
||||
if (encode_pbm_to_runon(&runon, d)) {
|
||||
flush_all_helper(src_cpu, tlb_flush_page_bits_by_mmuidx_async_1, runon);
|
||||
async_safe_run_on_cpu(src_cpu, tlb_flush_page_bits_by_mmuidx_async_1,
|
||||
runon);
|
||||
} else {
|
||||
CPUState *dst_cpu;
|
||||
TLBFlushPageBitsByMMUIdxData *p;
|
||||
|
||||
/* Allocate a separate data block for each destination cpu. */
|
||||
CPU_FOREACH(dst_cpu) {
|
||||
if (dst_cpu != src_cpu) {
|
||||
p = g_new(TLBFlushPageBitsByMMUIdxData, 1);
|
||||
*p = d;
|
||||
async_run_on_cpu(dst_cpu, tlb_flush_page_bits_by_mmuidx_async_2,
|
||||
RUN_ON_CPU_HOST_PTR(p));
|
||||
}
|
||||
}
|
||||
|
||||
p = g_new(TLBFlushPageBitsByMMUIdxData, 1);
|
||||
*p = d;
|
||||
async_safe_run_on_cpu(src_cpu, tlb_flush_page_bits_by_mmuidx_async_2,
|
||||
RUN_ON_CPU_HOST_PTR(p));
|
||||
}
|
||||
}
|
||||
|
||||
/* update the TLBs so that writes to code in the virtual page 'addr'
|
||||
can be detected */
|
||||
void tlb_protect_code(ram_addr_t ram_addr)
|
||||
|
||||
+17
-13
@@ -39,7 +39,7 @@ struct TCGState {
|
||||
|
||||
bool mttcg_enabled;
|
||||
unsigned long tb_size;
|
||||
bool mirror_rwx;
|
||||
bool mirror_jit;
|
||||
};
|
||||
typedef struct TCGState TCGState;
|
||||
|
||||
@@ -95,7 +95,11 @@ static void tcg_accel_instance_init(Object *obj)
|
||||
TCGState *s = TCG_STATE(obj);
|
||||
|
||||
s->mttcg_enabled = default_mttcg_enabled();
|
||||
s->mirror_rwx = false;
|
||||
#if defined(CONFIG_MIRROR_JIT) && defined(CONFIG_DEBUG_TCG)
|
||||
s->mirror_jit = true;
|
||||
#else
|
||||
s->mirror_jit = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool mttcg_enabled;
|
||||
@@ -104,7 +108,7 @@ static int tcg_init(MachineState *ms)
|
||||
{
|
||||
TCGState *s = TCG_STATE(current_accel());
|
||||
|
||||
tcg_exec_init(s->tb_size * 1024 * 1024, s->mirror_rwx);
|
||||
tcg_exec_init(s->tb_size * 1024 * 1024, s->mirror_jit);
|
||||
mttcg_enabled = s->mttcg_enabled;
|
||||
cpus_register_accel(&tcg_cpus);
|
||||
|
||||
@@ -170,19 +174,19 @@ static void tcg_set_tb_size(Object *obj, Visitor *v,
|
||||
s->tb_size = value;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_IOS_JIT
|
||||
static bool tcg_get_mirror_rwx(Object *obj, Error **errp)
|
||||
#ifdef CONFIG_MIRROR_JIT
|
||||
static bool tcg_get_mirror_jit(Object *obj, Error **errp)
|
||||
{
|
||||
TCGState *s = TCG_STATE(obj);
|
||||
|
||||
return s->mirror_rwx;
|
||||
return s->mirror_jit;
|
||||
}
|
||||
|
||||
static void tcg_set_mirror_rwx(Object *obj, bool value, Error **errp)
|
||||
static void tcg_set_mirror_jit(Object *obj, bool value, Error **errp)
|
||||
{
|
||||
TCGState *s = TCG_STATE(obj);
|
||||
|
||||
s->mirror_rwx = value;
|
||||
s->mirror_jit = value;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -203,11 +207,11 @@ static void tcg_accel_class_init(ObjectClass *oc, void *data)
|
||||
object_class_property_set_description(oc, "tb-size",
|
||||
"TCG translation block cache size");
|
||||
|
||||
#ifdef CONFIG_IOS_JIT
|
||||
object_class_property_add_bool(oc, "mirror-rwx",
|
||||
tcg_get_mirror_rwx, tcg_set_mirror_rwx);
|
||||
object_class_property_set_description(oc, "mirror-rwx",
|
||||
"mirror map executable pages for TCG on iOS");
|
||||
#ifdef CONFIG_MIRROR_JIT
|
||||
object_class_property_add_bool(oc, "mirror-jit",
|
||||
tcg_get_mirror_jit, tcg_set_mirror_jit);
|
||||
object_class_property_set_description(oc, "mirror-jit",
|
||||
"JIT pages mapped into separate RW and RX regions");
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
+55
-121
@@ -27,9 +27,6 @@
|
||||
#include "disas/disas.h"
|
||||
#include "exec/exec-all.h"
|
||||
#include "tcg/tcg.h"
|
||||
#if defined(CONFIG_DARWIN)
|
||||
#include "tcg/tcg-apple-jit.h"
|
||||
#endif
|
||||
#if defined(CONFIG_USER_ONLY)
|
||||
#include "qemu.h"
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
@@ -62,25 +59,7 @@
|
||||
#include "sysemu/cpus.h"
|
||||
#include "sysemu/cpu-timers.h"
|
||||
#include "sysemu/tcg.h"
|
||||
|
||||
#if defined(CONFIG_IOS_JIT)
|
||||
#include <mach/mach.h>
|
||||
extern kern_return_t mach_vm_remap(vm_map_t target_task,
|
||||
mach_vm_address_t *target_address,
|
||||
mach_vm_size_t size,
|
||||
mach_vm_offset_t mask,
|
||||
int flags,
|
||||
vm_map_t src_task,
|
||||
mach_vm_address_t src_address,
|
||||
boolean_t copy,
|
||||
vm_prot_t *cur_protection,
|
||||
vm_prot_t *max_protection,
|
||||
vm_inherit_t inheritance
|
||||
);
|
||||
#endif
|
||||
|
||||
static bool tb_exec_is_locked(void);
|
||||
static void tb_exec_change(bool locked);
|
||||
#include "qemu/memfd.h"
|
||||
|
||||
/* #define DEBUG_TB_INVALIDATE */
|
||||
/* #define DEBUG_TB_FLUSH */
|
||||
@@ -1048,14 +1027,14 @@ static inline void *split_cross_256mb(void *buf1, size_t size1)
|
||||
static uint8_t static_code_gen_buffer[DEFAULT_CODE_GEN_BUFFER_SIZE]
|
||||
__attribute__((aligned(CODE_GEN_ALIGN)));
|
||||
|
||||
static inline void *alloc_code_gen_buffer(bool no_rwx_pages)
|
||||
static inline void *alloc_code_gen_buffer(bool mirror_jit)
|
||||
{
|
||||
void *buf = static_code_gen_buffer;
|
||||
void *end = static_code_gen_buffer + sizeof(static_code_gen_buffer);
|
||||
size_t size;
|
||||
|
||||
/* not applicable */
|
||||
assert(!no_rwx_pages);
|
||||
assert(!mirror_jit);
|
||||
|
||||
/* page-align the beginning and end of the buffer */
|
||||
buf = QEMU_ALIGN_PTR_UP(buf, qemu_real_host_page_size);
|
||||
@@ -1085,33 +1064,45 @@ static inline void *alloc_code_gen_buffer(bool no_rwx_pages)
|
||||
return buf;
|
||||
}
|
||||
#elif defined(_WIN32)
|
||||
static inline void *alloc_code_gen_buffer(bool no_rwx_pages)
|
||||
static inline void *alloc_code_gen_buffer(bool mirror_jit)
|
||||
{
|
||||
size_t size = tcg_ctx->code_gen_buffer_size;
|
||||
assert(!no_rwx_pages); /* not applicable */
|
||||
assert(!mirror_jit); /* not applicable */
|
||||
return VirtualAlloc(NULL, size, MEM_RESERVE | MEM_COMMIT,
|
||||
PAGE_EXECUTE_READWRITE);
|
||||
}
|
||||
#else
|
||||
static inline void *alloc_code_gen_buffer(bool no_rwx_pages)
|
||||
static inline void *alloc_code_gen_buffer(bool mirror_jit)
|
||||
{
|
||||
int prot = PROT_READ | PROT_EXEC;
|
||||
int flags = MAP_PRIVATE | MAP_ANONYMOUS;
|
||||
int flags = 0;
|
||||
size_t size = tcg_ctx->code_gen_buffer_size;
|
||||
int fd = -1;
|
||||
void *buf;
|
||||
|
||||
#if defined(CONFIG_DARWIN) /* both iOS and macOS (Apple Silicon) applicable */
|
||||
if (!no_rwx_pages) {
|
||||
#if defined(CONFIG_MIRROR_JIT)
|
||||
#if defined(CONFIG_LINUX)
|
||||
if (mirror_jit) {
|
||||
fd = qemu_memfd_create("tcg-jit", size, false, 0, 0, NULL);
|
||||
if (fd < 0) {
|
||||
return NULL;
|
||||
}
|
||||
tcg_ctx->code_gen_buffer_fd = fd;
|
||||
flags |= MAP_SHARED;
|
||||
} else {
|
||||
prot |= PROT_WRITE;
|
||||
flags |= MAP_JIT;
|
||||
flags |= MAP_ANONYMOUS | MAP_PRIVATE;
|
||||
}
|
||||
#else
|
||||
/* not applicable */
|
||||
assert(!no_rwx_pages);
|
||||
#else /* defined(CONFIG_LINUX) */
|
||||
#error "Mirror JIT unimplemented for this platform."
|
||||
#endif /* defined(CONFIG_LINUX) */
|
||||
#else /* defined(CONFIG_MIRROR_JIT) */
|
||||
assert(!mirror_jit);
|
||||
prot |= PROT_WRITE;
|
||||
#endif
|
||||
flags |= MAP_ANONYMOUS | MAP_PRIVATE;
|
||||
#endif /* defined(CONFIG_MIRROR_JIT) */
|
||||
|
||||
buf = mmap(NULL, size, prot, flags, -1, 0);
|
||||
buf = mmap(NULL, size, prot, flags, fd, 0);
|
||||
if (buf == MAP_FAILED) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -1157,65 +1148,53 @@ static inline void *alloc_code_gen_buffer(bool no_rwx_pages)
|
||||
}
|
||||
#endif /* USE_STATIC_CODE_GEN_BUFFER, WIN32, POSIX */
|
||||
|
||||
#if defined(CONFIG_IOS_JIT)
|
||||
static inline void *alloc_jit_rw_mirror(void *base, size_t size)
|
||||
#if defined(CONFIG_MIRROR_JIT)
|
||||
#if defined(CONFIG_LINUX)
|
||||
static inline void *alloc_jit_rw_mirror(void)
|
||||
{
|
||||
kern_return_t ret;
|
||||
mach_vm_address_t mirror;
|
||||
vm_prot_t cur_prot, max_prot;
|
||||
int fd = tcg_ctx->code_gen_buffer_fd;
|
||||
size_t size = tcg_ctx->code_gen_buffer_size;
|
||||
void *buf;
|
||||
|
||||
mirror = 0;
|
||||
ret = mach_vm_remap(mach_task_self(),
|
||||
&mirror,
|
||||
size,
|
||||
0,
|
||||
VM_FLAGS_ANYWHERE | VM_FLAGS_RANDOM_ADDR,
|
||||
mach_task_self(),
|
||||
(mach_vm_address_t)base,
|
||||
false,
|
||||
&cur_prot,
|
||||
&max_prot,
|
||||
VM_INHERIT_NONE
|
||||
);
|
||||
if (ret != KERN_SUCCESS) {
|
||||
assert(fd >= 0);
|
||||
buf = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||
if (buf == MAP_FAILED) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (mprotect((void *)mirror, size, PROT_READ | PROT_WRITE) != 0) {
|
||||
munmap((void *)mirror, size);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (void *)mirror;
|
||||
return buf;
|
||||
}
|
||||
#endif /* CONFIG_IOS_JIT */
|
||||
#else
|
||||
#error "Mirror JIT unimplemented for this platform."
|
||||
#endif /* CONFIG_IOS */
|
||||
#endif /* CONFIG_MIRROR_JIT */
|
||||
|
||||
static inline void code_gen_alloc(size_t tb_size, bool mirror_rwx)
|
||||
static inline void code_gen_alloc(size_t tb_size, bool mirror_jit)
|
||||
{
|
||||
tcg_ctx->code_gen_buffer_size = size_code_gen_buffer(tb_size);
|
||||
tcg_ctx->code_gen_buffer = alloc_code_gen_buffer(mirror_rwx);
|
||||
tcg_ctx->code_gen_buffer = alloc_code_gen_buffer(mirror_jit);
|
||||
if (tcg_ctx->code_gen_buffer == NULL) {
|
||||
fprintf(stderr, "Could not allocate dynamic translator buffer\n");
|
||||
exit(1);
|
||||
}
|
||||
#if defined(CONFIG_IOS_JIT)
|
||||
#if defined(CONFIG_MIRROR_JIT)
|
||||
void *mirror;
|
||||
|
||||
if (mirror_rwx) {
|
||||
/* For iOS JIT we need a mirror mapping for code execution */
|
||||
mirror = alloc_jit_rw_mirror(tcg_ctx->code_gen_buffer,
|
||||
tcg_ctx->code_gen_buffer_size
|
||||
);
|
||||
if (mirror_jit) {
|
||||
/* For platforms that need a mirror mapping for code execution */
|
||||
mirror = alloc_jit_rw_mirror();
|
||||
if (mirror == NULL) {
|
||||
fprintf(stderr, "Could not remap code buffer mirror\n");
|
||||
exit(1);
|
||||
}
|
||||
} else {
|
||||
/* If we have JIT entitlements */
|
||||
/* If we disable mirror mapping run option */
|
||||
mirror = tcg_ctx->code_gen_buffer;
|
||||
}
|
||||
tcg_ctx->code_rw_mirror_diff = mirror - tcg_ctx->code_gen_buffer;
|
||||
#endif /* CONFIG_IOS_JIT */
|
||||
#else
|
||||
assert(!mirror_jit);
|
||||
#endif /* CONFIG_MIRROR_JIT */
|
||||
}
|
||||
|
||||
static bool tb_cmp(const void *ap, const void *bp)
|
||||
@@ -1242,16 +1221,15 @@ static void tb_htable_init(void)
|
||||
/*
|
||||
* Must be called before using the QEMU cpus. 'tb_size' is the size
|
||||
* (in bytes) allocated to the translation buffer. Zero means default
|
||||
* size. mirror_rwx only applicable on iOS.
|
||||
* size. mirror_jit separates RX and RW allocations.
|
||||
*/
|
||||
void tcg_exec_init(unsigned long tb_size, bool mirror_rwx)
|
||||
void tcg_exec_init(unsigned long tb_size, bool mirror_jit)
|
||||
{
|
||||
tcg_allowed = true;
|
||||
cpu_gen_init();
|
||||
page_init();
|
||||
tb_htable_init();
|
||||
code_gen_alloc(tb_size, mirror_rwx);
|
||||
tb_exec_unlock();
|
||||
code_gen_alloc(tb_size, mirror_jit);
|
||||
#if defined(CONFIG_SOFTMMU)
|
||||
/* There's no guest base to take into account, so go ahead and
|
||||
initialize the prologue now. */
|
||||
@@ -1528,11 +1506,8 @@ static void do_tb_phys_invalidate(TranslationBlock *tb, bool rm_from_page_list)
|
||||
PageDesc *p;
|
||||
uint32_t h;
|
||||
tb_page_addr_t phys_pc;
|
||||
bool code_gen_locked;
|
||||
|
||||
assert_memory_lock();
|
||||
code_gen_locked = tb_exec_is_locked();
|
||||
tb_exec_unlock();
|
||||
|
||||
/* make sure no further incoming jumps will be chained to this TB */
|
||||
qemu_spin_lock(&tb->jmp_lock);
|
||||
@@ -1545,7 +1520,6 @@ static void do_tb_phys_invalidate(TranslationBlock *tb, bool rm_from_page_list)
|
||||
tb->trace_vcpu_dstate);
|
||||
if (!(tb->cflags & CF_NOCACHE) &&
|
||||
!qht_remove(&tb_ctx.htable, tb, h)) {
|
||||
tb_exec_change(code_gen_locked);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1578,8 +1552,6 @@ static void do_tb_phys_invalidate(TranslationBlock *tb, bool rm_from_page_list)
|
||||
|
||||
qatomic_set(&tcg_ctx->tb_phys_invalidate_count,
|
||||
tcg_ctx->tb_phys_invalidate_count + 1);
|
||||
|
||||
tb_exec_change(code_gen_locked);
|
||||
}
|
||||
|
||||
static void tb_phys_invalidate__locked(TranslationBlock *tb)
|
||||
@@ -1820,7 +1792,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu,
|
||||
cpu_loop_exit(cpu);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_IOS_JIT)
|
||||
#if defined(CONFIG_MIRROR_JIT)
|
||||
tb->code_rw_mirror_diff = tcg_ctx->code_rw_mirror_diff;
|
||||
#endif
|
||||
gen_code_buf = tcg_ctx->code_gen_ptr;
|
||||
@@ -2820,41 +2792,3 @@ void tcg_flush_softmmu_tlb(CPUState *cs)
|
||||
tlb_flush(cs);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(CONFIG_DARWIN) && !defined(CONFIG_TCG_INTERPRETER)
|
||||
static bool tb_exec_is_locked(void)
|
||||
{
|
||||
return tcg_ctx->code_gen_locked;
|
||||
}
|
||||
|
||||
static void tb_exec_change(bool locked)
|
||||
{
|
||||
#if defined(HAVE_PTHREAD_JIT_PROTECT)
|
||||
if (__builtin_available(macOS 11, iOS 14, watchOS 7, tvOS 14, *)) {
|
||||
pthread_jit_write_protect_np(locked);
|
||||
} else
|
||||
#endif
|
||||
if (jit_write_protect_supported()) {
|
||||
jit_write_protect(locked);
|
||||
}
|
||||
tcg_ctx->code_gen_locked = locked;
|
||||
}
|
||||
#else /* not needed on non-Darwin platforms */
|
||||
static bool tb_exec_is_locked(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static void tb_exec_change(bool locked) {}
|
||||
#endif
|
||||
|
||||
void tb_exec_lock(void)
|
||||
{
|
||||
/* assumes sys_icache_invalidate already called */
|
||||
tb_exec_change(true);
|
||||
}
|
||||
|
||||
void tb_exec_unlock(void)
|
||||
{
|
||||
tb_exec_change(false);
|
||||
}
|
||||
+2
-2
@@ -106,7 +106,7 @@ static int line_out_init(HWVoiceOut *hw, struct audsettings *as,
|
||||
out->active = 0;
|
||||
|
||||
out->sin.base.sif = &playback_sif.base;
|
||||
qemu_spice_add_interface (&out->sin.base);
|
||||
qemu_spice.add_interface(&out->sin.base);
|
||||
#if SPICE_INTERFACE_PLAYBACK_MAJOR > 1 || SPICE_INTERFACE_PLAYBACK_MINOR >= 3
|
||||
spice_server_set_playback_rate(&out->sin, settings.freq);
|
||||
#endif
|
||||
@@ -215,7 +215,7 @@ static int line_in_init(HWVoiceIn *hw, struct audsettings *as, void *drv_opaque)
|
||||
in->active = 0;
|
||||
|
||||
in->sin.base.sif = &record_sif.base;
|
||||
qemu_spice_add_interface (&in->sin.base);
|
||||
qemu_spice.add_interface(&in->sin.base);
|
||||
#if SPICE_INTERFACE_RECORD_MAJOR > 2 || SPICE_INTERFACE_RECORD_MINOR >= 3
|
||||
spice_server_set_record_rate(&in->sin, settings.freq);
|
||||
#endif
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
#ifdef CONFIG_BSD
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/queue.h>
|
||||
#if !defined(__DragonFly__) && !defined(CONFIG_IOS)
|
||||
#ifndef __DragonFly__
|
||||
#include <sys/disk.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
+13
-37
@@ -41,7 +41,7 @@
|
||||
#include "scsi/pr-manager.h"
|
||||
#include "scsi/constants.h"
|
||||
|
||||
#if defined(CONFIG_HOST_BLOCK_DEVICE) && defined(__APPLE__) && (__MACH__)
|
||||
#if defined(__APPLE__) && (__MACH__)
|
||||
#include <paths.h>
|
||||
#include <sys/param.h>
|
||||
#include <IOKit/IOKitLib.h>
|
||||
@@ -181,16 +181,7 @@ typedef struct BDRVRawReopenState {
|
||||
bool check_cache_dropped;
|
||||
} BDRVRawReopenState;
|
||||
|
||||
static int fd_open(BlockDriverState *bs)
|
||||
{
|
||||
BDRVRawState *s = bs->opaque;
|
||||
|
||||
/* this is just to ensure s->fd is sane (its called by io ops) */
|
||||
if (s->fd >= 0)
|
||||
return 0;
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
static int fd_open(BlockDriverState *bs);
|
||||
static int64_t raw_getlength(BlockDriverState *bs);
|
||||
|
||||
typedef struct RawPosixAIOData {
|
||||
@@ -261,12 +252,6 @@ static int raw_normalize_devicepath(const char **filename, Error **errp)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_IOS)
|
||||
static int probe_logical_blocksize(int fd, unsigned int *sector_size_p)
|
||||
{
|
||||
return -ENOTSUP; /* not supported on iOS */
|
||||
}
|
||||
#else /* CONFIG_IOS */
|
||||
/*
|
||||
* Get logical block size via ioctl. On success store it in @sector_size_p.
|
||||
*/
|
||||
@@ -299,7 +284,6 @@ static int probe_logical_blocksize(int fd, unsigned int *sector_size_p)
|
||||
|
||||
return success ? 0 : -errno;
|
||||
}
|
||||
#endif /* !CONFIG_IOS */
|
||||
|
||||
/**
|
||||
* Get physical block size of @fd.
|
||||
@@ -1393,24 +1377,12 @@ static bool preadv_present = true;
|
||||
static ssize_t
|
||||
qemu_preadv(int fd, const struct iovec *iov, int nr_iov, off_t offset)
|
||||
{
|
||||
#ifdef CONFIG_DARWIN /* preadv introduced in macOS 11 */
|
||||
if (!__builtin_available(macOS 11, iOS 14, watchOS 7, tvOS 14, *)) {
|
||||
preadv_present = false;
|
||||
return -ENOSYS;
|
||||
} else
|
||||
#endif
|
||||
return preadv(fd, iov, nr_iov, offset);
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
qemu_pwritev(int fd, const struct iovec *iov, int nr_iov, off_t offset)
|
||||
{
|
||||
#ifdef CONFIG_DARWIN /* pwritev introduced in macOS 11 */
|
||||
if (!__builtin_available(macOS 11, iOS 14, watchOS 7, tvOS 14, *)) {
|
||||
preadv_present = false;
|
||||
return -ENOSYS;
|
||||
} else
|
||||
#endif
|
||||
return pwritev(fd, iov, nr_iov, offset);
|
||||
}
|
||||
|
||||
@@ -2334,7 +2306,7 @@ again:
|
||||
}
|
||||
if (size == 0)
|
||||
#endif
|
||||
#if !defined(CONFIG_IOS) && defined(__APPLE__) && defined(__MACH__)
|
||||
#if defined(__APPLE__) && defined(__MACH__)
|
||||
{
|
||||
uint64_t sectors = 0;
|
||||
uint32_t sector_size = 0;
|
||||
@@ -3275,8 +3247,6 @@ BlockDriver bdrv_file = {
|
||||
/***********************************************/
|
||||
/* host device */
|
||||
|
||||
#if defined(CONFIG_HOST_BLOCK_DEVICE)
|
||||
|
||||
#if defined(__APPLE__) && defined(__MACH__)
|
||||
static kern_return_t GetBSDPath(io_iterator_t mediaIterator, char *bsdPath,
|
||||
CFIndex maxPathSize, int flags);
|
||||
@@ -3569,6 +3539,16 @@ hdev_co_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
|
||||
}
|
||||
#endif /* linux */
|
||||
|
||||
static int fd_open(BlockDriverState *bs)
|
||||
{
|
||||
BDRVRawState *s = bs->opaque;
|
||||
|
||||
/* this is just to ensure s->fd is sane (its called by io ops) */
|
||||
if (s->fd >= 0)
|
||||
return 0;
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
static coroutine_fn int
|
||||
hdev_co_pdiscard(BlockDriverState *bs, int64_t offset, int bytes)
|
||||
{
|
||||
@@ -3892,8 +3872,6 @@ static BlockDriver bdrv_host_cdrom = {
|
||||
};
|
||||
#endif /* __FreeBSD__ */
|
||||
|
||||
#endif /* CONFIG_HOST_BLOCK_DEVICE */
|
||||
|
||||
static void bdrv_file_init(void)
|
||||
{
|
||||
/*
|
||||
@@ -3901,7 +3879,6 @@ static void bdrv_file_init(void)
|
||||
* registered last will get probed first.
|
||||
*/
|
||||
bdrv_register(&bdrv_file);
|
||||
#if defined(CONFIG_HOST_BLOCK_DEVICE)
|
||||
bdrv_register(&bdrv_host_device);
|
||||
#ifdef __linux__
|
||||
bdrv_register(&bdrv_host_cdrom);
|
||||
@@ -3909,7 +3886,6 @@ static void bdrv_file_init(void)
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
bdrv_register(&bdrv_host_cdrom);
|
||||
#endif
|
||||
#endif /* CONFIG_HOST_BLOCK_DEVICE */
|
||||
}
|
||||
|
||||
block_init(bdrv_file_init);
|
||||
+1
-1
@@ -110,7 +110,7 @@ static void vmc_register_interface(SpiceChardev *scd)
|
||||
return;
|
||||
}
|
||||
scd->sin.base.sif = &vmc_interface.base;
|
||||
qemu_spice_add_interface(&scd->sin.base);
|
||||
qemu_spice.add_interface(&scd->sin.base);
|
||||
scd->active = true;
|
||||
trace_spice_vmc_register_interface(scd);
|
||||
}
|
||||
|
||||
@@ -234,7 +234,6 @@ cpu=""
|
||||
iasl="iasl"
|
||||
interp_prefix="/usr/gnemul/qemu-%M"
|
||||
static="no"
|
||||
cross_compile="no"
|
||||
cross_prefix=""
|
||||
audio_drv_list=""
|
||||
block_drv_rw_whitelist=""
|
||||
@@ -298,12 +297,13 @@ brlapi=""
|
||||
curl=""
|
||||
iconv="auto"
|
||||
curses="auto"
|
||||
docs=""
|
||||
docs="auto"
|
||||
fdt="auto"
|
||||
netmap="no"
|
||||
sdl="auto"
|
||||
sdl_image="auto"
|
||||
virtfs=""
|
||||
libudev="auto"
|
||||
mpath="auto"
|
||||
vnc="enabled"
|
||||
sparse="auto"
|
||||
@@ -448,8 +448,7 @@ meson=""
|
||||
ninja=""
|
||||
skip_meson=no
|
||||
gettext=""
|
||||
host_block_device_support="yes"
|
||||
shared_lib="false"
|
||||
mirror_jit="no"
|
||||
|
||||
bogus_os="no"
|
||||
malloc_trim="auto"
|
||||
@@ -459,11 +458,6 @@ for opt do
|
||||
optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
|
||||
case "$opt" in
|
||||
--cross-prefix=*) cross_prefix="$optarg"
|
||||
cross_compile="yes"
|
||||
;;
|
||||
--enable-cross-compile) cross_compile="yes"
|
||||
;;
|
||||
--disable-cross-compile) cross_compile="no"
|
||||
;;
|
||||
--cc=*) CC="$optarg"
|
||||
;;
|
||||
@@ -545,8 +539,6 @@ QEMU_CFLAGS="-fno-strict-aliasing -fno-common -fwrapv $QEMU_CFLAGS"
|
||||
QEMU_CFLAGS="-Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
|
||||
QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
|
||||
QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
|
||||
QEMU_INCLUDES="-iquote . -iquote ${source_path} -iquote ${source_path}/accel/tcg -iquote ${source_path}/include"
|
||||
QEMU_INCLUDES="$QEMU_INCLUDES -iquote ${source_path}/disas/libvixl"
|
||||
|
||||
# Flags that are needed during configure but later taken care of by Meson
|
||||
CONFIGURE_CFLAGS="-std=gnu99 -Wall"
|
||||
@@ -563,19 +555,6 @@ EOF
|
||||
compile_object
|
||||
}
|
||||
|
||||
check_ios() {
|
||||
cat > $TMPC <<EOF
|
||||
#ifdef __APPLE__
|
||||
#import "TargetConditionals.h"
|
||||
#if !TARGET_OS_IPHONE
|
||||
#error TARGET_OS_IPHONE not true
|
||||
#endif
|
||||
#endif
|
||||
int main(void) { return 0; }
|
||||
EOF
|
||||
compile_object
|
||||
}
|
||||
|
||||
check_include() {
|
||||
cat > $TMPC <<EOF
|
||||
#include <$1>
|
||||
@@ -618,11 +597,7 @@ elif check_define __DragonFly__ ; then
|
||||
elif check_define __NetBSD__; then
|
||||
targetos='NetBSD'
|
||||
elif check_define __APPLE__; then
|
||||
if check_ios ; then
|
||||
targetos='iOS'
|
||||
else
|
||||
targetos='Darwin'
|
||||
fi
|
||||
targetos='Darwin'
|
||||
else
|
||||
# This is a fatal error, but don't report it yet, because we
|
||||
# might be going to just print the --help text, or it might
|
||||
@@ -799,22 +774,6 @@ Darwin)
|
||||
# won't work when we're compiling with gcc as a C compiler.
|
||||
QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
|
||||
;;
|
||||
iOS)
|
||||
bsd="yes"
|
||||
darwin="yes"
|
||||
ios="yes"
|
||||
if [ "$cpu" = "x86_64" ] ; then
|
||||
QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
|
||||
QEMU_LDFLAGS="-arch x86_64 $QEMU_LDFLAGS"
|
||||
fi
|
||||
host_block_device_support="no"
|
||||
audio_drv_list=""
|
||||
audio_possible_drivers=""
|
||||
QEMU_LDFLAGS="-framework CoreFoundation $QEMU_LDFLAGS"
|
||||
# Disable attempts to use ObjectiveC features in os/object.h since they
|
||||
# won't work when we're compiling with gcc as a C compiler.
|
||||
QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
|
||||
;;
|
||||
SunOS)
|
||||
solaris="yes"
|
||||
make="${MAKE-gmake}"
|
||||
@@ -837,7 +796,6 @@ Linux)
|
||||
audio_possible_drivers="oss alsa sdl pa"
|
||||
linux="yes"
|
||||
linux_user="yes"
|
||||
QEMU_INCLUDES="-isystem ${source_path}/linux-headers -Ilinux-headers $QEMU_INCLUDES"
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -863,15 +821,6 @@ do
|
||||
fi
|
||||
done
|
||||
|
||||
sphinx_build=
|
||||
for binary in sphinx-build-3 sphinx-build
|
||||
do
|
||||
if has "$binary"
|
||||
then
|
||||
sphinx_build=$(command -v "$binary")
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# Check for ancillary tools used in testing
|
||||
genisoimage=
|
||||
@@ -919,10 +868,6 @@ for opt do
|
||||
;;
|
||||
--cross-prefix=*)
|
||||
;;
|
||||
--enable-cross-compile)
|
||||
;;
|
||||
--disable-cross-compile)
|
||||
;;
|
||||
--cc=*)
|
||||
;;
|
||||
--host-cc=*) host_cc="$optarg"
|
||||
@@ -1016,7 +961,7 @@ for opt do
|
||||
;;
|
||||
--with-suffix=*) qemu_suffix="$optarg"
|
||||
;;
|
||||
--docdir=*) qemu_docdir="$optarg"
|
||||
--docdir=*) docdir="$optarg"
|
||||
;;
|
||||
--sysconfdir=*) sysconfdir="$optarg"
|
||||
;;
|
||||
@@ -1050,6 +995,10 @@ for opt do
|
||||
;;
|
||||
--enable-virtfs) virtfs="yes"
|
||||
;;
|
||||
--disable-libudev) libudev="disabled"
|
||||
;;
|
||||
--enable-libudev) libudev="enabled"
|
||||
;;
|
||||
--disable-mpath) mpath="disabled"
|
||||
;;
|
||||
--enable-mpath) mpath="enabled"
|
||||
@@ -1271,9 +1220,9 @@ for opt do
|
||||
;;
|
||||
--disable-crypto-afalg) crypto_afalg="no"
|
||||
;;
|
||||
--disable-docs) docs="no"
|
||||
--disable-docs) docs="disabled"
|
||||
;;
|
||||
--enable-docs) docs="yes"
|
||||
--enable-docs) docs="enabled"
|
||||
;;
|
||||
--disable-vhost-net) vhost_net="no"
|
||||
;;
|
||||
@@ -1565,10 +1514,6 @@ for opt do
|
||||
;;
|
||||
--disable-libdaxctl) libdaxctl=no
|
||||
;;
|
||||
--enable-shared-lib) shared_lib=true
|
||||
;;
|
||||
--disable-shared-lib) shared_lib=false
|
||||
;;
|
||||
*)
|
||||
echo "ERROR: unknown option $opt"
|
||||
echo "Try '$0 --help' for more information"
|
||||
@@ -1736,7 +1681,6 @@ Advanced options (experts only):
|
||||
--efi-aarch64=PATH PATH of efi file to use for aarch64 VMs.
|
||||
--with-suffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir/docdir [$qemu_suffix]
|
||||
--with-pkgversion=VERS use specified string as sub-version of the package
|
||||
--enable-cross-compile enable cross compiling (set automatically if $cross_prefix is set)
|
||||
--enable-debug enable common debug build options
|
||||
--enable-sanitizers enable default sanitizers
|
||||
--enable-tsan enable thread sanitizer
|
||||
@@ -1762,7 +1706,7 @@ Advanced options (experts only):
|
||||
--oss-lib path to OSS library
|
||||
--cpu=CPU Build for host CPU [$cpu]
|
||||
--with-coroutine=BACKEND coroutine backend. Supported options:
|
||||
ucontext, libucontext, sigaltstack, windows
|
||||
ucontext, sigaltstack, windows
|
||||
--enable-gcov enable test coverage analysis with gcov
|
||||
--disable-blobs disable installing provided firmware blobs
|
||||
--with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent
|
||||
@@ -1776,7 +1720,6 @@ Advanced options (experts only):
|
||||
enable plugins via shared library loading
|
||||
--disable-containers don't use containers for cross-building
|
||||
--gdb=GDB-path gdb to use for gdbstub tests [$gdb_bin]
|
||||
--enable-shared-lib build QEMU as a shared library
|
||||
|
||||
Optional features, enabled with --enable-FEATURE and
|
||||
disabled with --disable-FEATURE, default is enabled if available:
|
||||
@@ -1813,6 +1756,7 @@ disabled with --disable-FEATURE, default is enabled if available:
|
||||
vnc-png PNG compression for VNC server
|
||||
cocoa Cocoa UI (Mac OS X only)
|
||||
virtfs VirtFS
|
||||
libudev Use libudev to enumerate host devices
|
||||
mpath Multipath persistent reservation passthrough
|
||||
xen xen backend driver support
|
||||
xen-pci-passthrough PCI passthrough support for Xen
|
||||
@@ -1917,7 +1861,7 @@ python_version=$($python -c 'import sys; print("%d.%d.%d" % (sys.version_info[0]
|
||||
python="$python -B"
|
||||
|
||||
if test -z "$meson"; then
|
||||
if test "$explicit_python" = no && has meson && version_ge "$(meson --version)" 0.55.1; then
|
||||
if test "$explicit_python" = no && has meson && version_ge "$(meson --version)" 0.55.3; then
|
||||
meson=meson
|
||||
elif test -e "${source_path}/.git" && test $git_update = 'yes' ; then
|
||||
meson=git
|
||||
@@ -1959,7 +1903,7 @@ case "$meson" in
|
||||
*) meson=$(command -v "$meson") ;;
|
||||
esac
|
||||
|
||||
# Probe for ninja (used for compdb)
|
||||
# Probe for ninja
|
||||
|
||||
if test -z "$ninja"; then
|
||||
for c in ninja ninja-build samu; do
|
||||
@@ -1968,6 +1912,9 @@ if test -z "$ninja"; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test -z "$ninja"; then
|
||||
error_exit "Cannot find Ninja"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check that the C compiler works. Doing this here before testing
|
||||
@@ -2586,7 +2533,7 @@ if test "$xen" != "disabled" ; then
|
||||
xen_ctrl_version="$(printf '%d%02d%02d' \
|
||||
$($pkg_config --modversion xencontrol | sed 's/\./ /g') )"
|
||||
xen=enabled
|
||||
xen_pc="xencontrol xenstore xenguest xenforeignmemory xengnttab"
|
||||
xen_pc="xencontrol xenstore xenforeignmemory xengnttab"
|
||||
xen_pc="$xen_pc xenevtchn xendevicemodel"
|
||||
if $pkg_config --exists xentoolcore; then
|
||||
xen_pc="$xen_pc xentoolcore"
|
||||
@@ -2595,7 +2542,7 @@ if test "$xen" != "disabled" ; then
|
||||
xen_libs="$($pkg_config --libs $xen_pc)"
|
||||
else
|
||||
|
||||
xen_libs="-lxenstore -lxenctrl -lxenguest"
|
||||
xen_libs="-lxenstore -lxenctrl"
|
||||
xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn"
|
||||
|
||||
# First we test whether Xen headers and libraries are available.
|
||||
@@ -4464,45 +4411,6 @@ if check_include linux/btrfs.h ; then
|
||||
btrfs=yes
|
||||
fi
|
||||
|
||||
# If we're making warnings fatal, apply this to Sphinx runs as well
|
||||
sphinx_werror=""
|
||||
if test "$werror" = "yes"; then
|
||||
sphinx_werror="-W"
|
||||
fi
|
||||
|
||||
# Check we have a new enough version of sphinx-build
|
||||
has_sphinx_build() {
|
||||
# This is a bit awkward but works: create a trivial document and
|
||||
# try to run it with our configuration file (which enforces a
|
||||
# version requirement). This will fail if either
|
||||
# sphinx-build doesn't exist at all or if it is too old.
|
||||
mkdir -p "$TMPDIR1/sphinx"
|
||||
touch "$TMPDIR1/sphinx/index.rst"
|
||||
"$sphinx_build" $sphinx_werror -c "$source_path/docs" \
|
||||
-b html "$TMPDIR1/sphinx" \
|
||||
"$TMPDIR1/sphinx/out" >> config.log 2>&1
|
||||
}
|
||||
|
||||
# Check if tools are available to build documentation.
|
||||
if test "$docs" != "no" ; then
|
||||
if has_sphinx_build; then
|
||||
sphinx_ok=yes
|
||||
else
|
||||
sphinx_ok=no
|
||||
fi
|
||||
if test "$sphinx_ok" = "yes"; then
|
||||
docs=yes
|
||||
else
|
||||
if test "$docs" = "yes" ; then
|
||||
if has $sphinx_build && test "$sphinx_ok" != "yes"; then
|
||||
echo "Warning: $sphinx_build exists but it is either too old or uses too old a Python version" >&2
|
||||
fi
|
||||
feature_not_found "docs" "Install a Python 3 version of python-sphinx"
|
||||
fi
|
||||
docs=no
|
||||
fi
|
||||
fi
|
||||
|
||||
# Search for bswap_32 function
|
||||
byteswap_h=no
|
||||
cat > $TMPC << EOF
|
||||
@@ -4935,8 +4843,6 @@ if test "$coroutine" = ""; then
|
||||
coroutine=win32
|
||||
elif test "$ucontext_works" = "yes"; then
|
||||
coroutine=ucontext
|
||||
elif test "$ios" = "yes"; then
|
||||
coroutine=libucontext
|
||||
else
|
||||
coroutine=sigaltstack
|
||||
fi
|
||||
@@ -4960,27 +4866,12 @@ else
|
||||
error_exit "only the 'windows' coroutine backend is valid for Windows"
|
||||
fi
|
||||
;;
|
||||
libucontext)
|
||||
;;
|
||||
*)
|
||||
error_exit "unknown coroutine backend $coroutine"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
case $coroutine in
|
||||
libucontext)
|
||||
git_submodules="${git_submodules} libucontext"
|
||||
mkdir -p libucontext
|
||||
coroutine_impl=ucontext
|
||||
libucontext="enabled"
|
||||
;;
|
||||
*)
|
||||
coroutine_impl=$coroutine
|
||||
libucontext="disabled"
|
||||
;;
|
||||
esac
|
||||
|
||||
if test "$coroutine_pool" = ""; then
|
||||
coroutine_pool=yes
|
||||
fi
|
||||
@@ -5745,22 +5636,6 @@ but not implemented on your system"
|
||||
fi
|
||||
fi
|
||||
|
||||
##########################################
|
||||
# check for Apple Silicon JIT function
|
||||
|
||||
if [ "$darwin" = "yes" ] ; then
|
||||
cat > $TMPC << EOF
|
||||
#include <pthread.h>
|
||||
int main() { pthread_jit_write_protect_np(0); return 0; }
|
||||
EOF
|
||||
if ! compile_prog ""; then
|
||||
have_pthread_jit_protect='no'
|
||||
else
|
||||
have_pthread_jit_protect='yes'
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
##########################################
|
||||
# End of CC checks
|
||||
# After here, no more $cc or $ld runs
|
||||
@@ -5851,10 +5726,17 @@ if test "$mingw32" = "yes" ; then
|
||||
done
|
||||
fi
|
||||
|
||||
# Enable mirror mapping if debug_tcg on supported platform
|
||||
|
||||
if test "$debug_tcg" = "yes"; then
|
||||
if test "$linux" = "yes"; then
|
||||
mirror_jit=yes
|
||||
fi
|
||||
fi
|
||||
|
||||
qemu_confdir="$sysconfdir/$qemu_suffix"
|
||||
qemu_moddir="$libdir/$qemu_suffix"
|
||||
qemu_datadir="$datadir/$qemu_suffix"
|
||||
qemu_docdir="$docdir/$qemu_suffix"
|
||||
qemu_localedir="$datadir/locale"
|
||||
qemu_icondir="$datadir/icons"
|
||||
qemu_desktopdir="$datadir/applications"
|
||||
@@ -6053,9 +5935,6 @@ if test "$default_devices" = "yes" ; then
|
||||
else
|
||||
echo "CONFIG_MINIKCONF_MODE=--allnoconfig" >> $config_host_mak
|
||||
fi
|
||||
if test "$host_block_device_support" = "yes" ; then
|
||||
echo "CONFIG_HOST_BLOCK_DEVICE=y" >> $config_host_mak
|
||||
fi
|
||||
if test "$debug_tcg" = "yes" ; then
|
||||
echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
|
||||
fi
|
||||
@@ -6105,11 +5984,6 @@ if test "$darwin" = "yes" ; then
|
||||
echo "CONFIG_DARWIN=y" >> $config_host_mak
|
||||
fi
|
||||
|
||||
if test "$ios" = "yes" ; then
|
||||
echo "CONFIG_IOS=y" >> $config_host_mak
|
||||
echo "CONFIG_IOS_JIT=y" >> $config_host_mak
|
||||
fi
|
||||
|
||||
if test "$solaris" = "yes" ; then
|
||||
echo "CONFIG_SOLARIS=y" >> $config_host_mak
|
||||
fi
|
||||
@@ -6180,9 +6054,6 @@ qemu_version=$(head $source_path/VERSION)
|
||||
echo "PKGVERSION=$pkgversion" >>$config_host_mak
|
||||
echo "SRC_PATH=$source_path" >> $config_host_mak
|
||||
echo "TARGET_DIRS=$target_list" >> $config_host_mak
|
||||
if [ "$docs" = "yes" ] ; then
|
||||
echo "BUILD_DOCS=yes" >> $config_host_mak
|
||||
fi
|
||||
if test "$modules" = "yes"; then
|
||||
# $shacmd can generate a hash started with digit, which the compiler doesn't
|
||||
# like as an symbol. So prefix it with an underscore
|
||||
@@ -6574,7 +6445,7 @@ if test "$rbd" = "yes" ; then
|
||||
echo "RBD_LIBS=$rbd_libs" >> $config_host_mak
|
||||
fi
|
||||
|
||||
echo "CONFIG_COROUTINE_BACKEND=$coroutine_impl" >> $config_host_mak
|
||||
echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak
|
||||
if test "$coroutine_pool" = "yes" ; then
|
||||
echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak
|
||||
else
|
||||
@@ -6869,32 +6740,12 @@ if test "$secret_keyring" = "yes" ; then
|
||||
echo "CONFIG_SECRET_KEYRING=y" >> $config_host_mak
|
||||
fi
|
||||
|
||||
if test "$have_pthread_jit_protect" = "yes" ; then
|
||||
echo "HAVE_PTHREAD_JIT_PROTECT=y" >> $config_host_mak
|
||||
fi
|
||||
|
||||
if test "$tcg_interpreter" = "yes"; then
|
||||
QEMU_INCLUDES="-iquote ${source_path}/tcg/tci $QEMU_INCLUDES"
|
||||
elif test "$ARCH" = "sparc64" ; then
|
||||
QEMU_INCLUDES="-iquote ${source_path}/tcg/sparc $QEMU_INCLUDES"
|
||||
elif test "$ARCH" = "s390x" ; then
|
||||
QEMU_INCLUDES="-iquote ${source_path}/tcg/s390 $QEMU_INCLUDES"
|
||||
elif test "$ARCH" = "x86_64" || test "$ARCH" = "x32" ; then
|
||||
QEMU_INCLUDES="-iquote ${source_path}/tcg/i386 $QEMU_INCLUDES"
|
||||
elif test "$ARCH" = "ppc64" ; then
|
||||
QEMU_INCLUDES="-iquote ${source_path}/tcg/ppc $QEMU_INCLUDES"
|
||||
elif test "$ARCH" = "riscv32" || test "$ARCH" = "riscv64" ; then
|
||||
QEMU_INCLUDES="-I${source_path}/tcg/riscv $QEMU_INCLUDES"
|
||||
else
|
||||
QEMU_INCLUDES="-iquote ${source_path}/tcg/${ARCH} $QEMU_INCLUDES"
|
||||
fi
|
||||
|
||||
echo "ROMS=$roms" >> $config_host_mak
|
||||
echo "MAKE=$make" >> $config_host_mak
|
||||
echo "PYTHON=$python" >> $config_host_mak
|
||||
echo "SPHINX_BUILD=$sphinx_build" >> $config_host_mak
|
||||
echo "GENISOIMAGE=$genisoimage" >> $config_host_mak
|
||||
echo "MESON=$meson" >> $config_host_mak
|
||||
echo "NINJA=$ninja" >> $config_host_mak
|
||||
echo "CC=$cc" >> $config_host_mak
|
||||
if $iasl -h > /dev/null 2>&1; then
|
||||
echo "CONFIG_IASL=$iasl" >> $config_host_mak
|
||||
@@ -6915,7 +6766,6 @@ echo "WINDRES=$windres" >> $config_host_mak
|
||||
echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak
|
||||
echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
|
||||
echo "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak
|
||||
echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
|
||||
echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
|
||||
echo "GLIB_LIBS=$glib_libs" >> $config_host_mak
|
||||
echo "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak
|
||||
@@ -7002,6 +6852,10 @@ if test "$safe_stack" = "yes"; then
|
||||
echo "CONFIG_SAFESTACK=y" >> $config_host_mak
|
||||
fi
|
||||
|
||||
if test "$mirror_jit" = "yes"; then
|
||||
echo "CONFIG_MIRROR_JIT=y" >> $config_host_mak
|
||||
fi
|
||||
|
||||
# If we're using a separate build tree, set it up now.
|
||||
# DIRS are directories which we simply mkdir in the build tree;
|
||||
# LINKS are things to symlink back into the source tree
|
||||
@@ -7106,7 +6960,6 @@ echo "cpp_link_args = [${LDFLAGS:+$(meson_quote $LDFLAGS)}]" >> $cross
|
||||
echo "[binaries]" >> $cross
|
||||
echo "c = [$(meson_quote $cc)]" >> $cross
|
||||
test -n "$cxx" && echo "cpp = [$(meson_quote $cxx)]" >> $cross
|
||||
test -n "$objcc" && echo "objc = [$(meson_quote $objcc)]" >> $cross
|
||||
echo "ar = [$(meson_quote $ar)]" >> $cross
|
||||
echo "nm = [$(meson_quote $nm)]" >> $cross
|
||||
echo "pkgconfig = [$(meson_quote $pkg_config_exe)]" >> $cross
|
||||
@@ -7114,13 +6967,9 @@ echo "ranlib = [$(meson_quote $ranlib)]" >> $cross
|
||||
if has $sdl2_config; then
|
||||
echo "sdl2-config = [$(meson_quote $sdl2_config)]" >> $cross
|
||||
fi
|
||||
if test "$shared_lib" = "true"; then
|
||||
echo "strip = [$(meson_quote $strip), '-x']" >> $cross
|
||||
else
|
||||
echo "strip = [$(meson_quote $strip)]" >> $cross
|
||||
fi
|
||||
echo "strip = [$(meson_quote $strip)]" >> $cross
|
||||
echo "windres = [$(meson_quote $windres)]" >> $cross
|
||||
if test "$cross_compile" = "yes"; then
|
||||
if test -n "$cross_prefix"; then
|
||||
cross_arg="--cross-file config-meson.cross"
|
||||
echo "[host_machine]" >> $cross
|
||||
if test "$mingw32" = "yes" ; then
|
||||
@@ -7129,9 +6978,6 @@ if test "$cross_compile" = "yes"; then
|
||||
if test "$linux" = "yes" ; then
|
||||
echo "system = 'linux'" >> $cross
|
||||
fi
|
||||
if test "$darwin" = "yes" ; then
|
||||
echo "system = 'darwin'" >> $cross
|
||||
fi
|
||||
case "$ARCH" in
|
||||
i386|x86_64)
|
||||
echo "cpu_family = 'x86'" >> $cross
|
||||
@@ -7155,7 +7001,7 @@ fi
|
||||
mv $cross config-meson.cross
|
||||
|
||||
rm -rf meson-private meson-info meson-logs
|
||||
NINJA=${ninja:-$PWD/ninjatool} $meson setup \
|
||||
NINJA=$ninja $meson setup \
|
||||
--prefix "$prefix" \
|
||||
--libdir "$libdir" \
|
||||
--libexecdir "$libexecdir" \
|
||||
@@ -7181,15 +7027,14 @@ NINJA=${ninja:-$PWD/ninjatool} $meson setup \
|
||||
-Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \
|
||||
-Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f \
|
||||
-Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt \
|
||||
-Diconv=$iconv -Dcurses=$curses -Ducontext=$libucontext \
|
||||
-Dshared-lib=$shared_lib \
|
||||
-Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\
|
||||
-Ddocs=$docs -Dsphinx_build=$sphinx_build \
|
||||
$cross_arg \
|
||||
"$PWD" "$source_path"
|
||||
|
||||
if test "$?" -ne 0 ; then
|
||||
error_exit "meson setup failed"
|
||||
fi
|
||||
touch ninjatool.stamp
|
||||
fi
|
||||
|
||||
if test -n "${deprecated_features}"; then
|
||||
|
||||
@@ -43,4 +43,3 @@ CONFIG_FSL_IMX7=y
|
||||
CONFIG_FSL_IMX6UL=y
|
||||
CONFIG_SEMIHOSTING=y
|
||||
CONFIG_ALLWINNER_H3=y
|
||||
CONFIG_ACPI_APEI=y
|
||||
+1
-1
@@ -241,7 +241,7 @@ texinfo_documents = [
|
||||
# We use paths starting from qemu_docdir here so that you can run
|
||||
# sphinx-build from anywhere and the kerneldoc extension can still
|
||||
# find everything.
|
||||
kerneldoc_bin = os.path.join(qemu_docdir, '../scripts/kernel-doc')
|
||||
kerneldoc_bin = ['perl', os.path.join(qemu_docdir, '../scripts/kernel-doc')]
|
||||
kerneldoc_srctree = os.path.join(qemu_docdir, '..')
|
||||
hxtool_srctree = os.path.join(qemu_docdir, '..')
|
||||
qapidoc_srctree = os.path.join(qemu_docdir, '..')
|
||||
@@ -404,10 +404,8 @@ Built by Meson:
|
||||
Built by Makefile:
|
||||
|
||||
`Makefile.ninja`
|
||||
A Makefile conversion of the build rules in build.ninja. The conversion
|
||||
is straightforward and, were it necessary to debug the rules produced
|
||||
by Meson, it should be enough to look at build.ninja. The conversion
|
||||
is performed by scripts/ninjatool.py.
|
||||
A Makefile include that bridges to ninja for the actual build. The
|
||||
Makefile is mostly a list of targets that Meson included in build.ninja.
|
||||
|
||||
`Makefile.mtest`
|
||||
The Makefile definitions that let "make check" run tests defined in
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
===========
|
||||
iOS Support
|
||||
===========
|
||||
|
||||
To run qemu on the iOS platform, some modifications were required. Most of the
|
||||
modifications are conditioned on the ``CONFIG_IOS`` and ``CONFIG_IOS_JIT``
|
||||
configuration variables.
|
||||
|
||||
Build support
|
||||
-------------
|
||||
|
||||
For the code to compile, certain changes in the block driver and the slirp
|
||||
driver had to be made. There is no ``system()`` call, so code requiring it had
|
||||
to be disabled.
|
||||
|
||||
``ucontext`` support is broken on iOS. The implementation from ``libucontext``
|
||||
is used instead.
|
||||
|
||||
Because ``fork()`` is not allowed on iOS apps, the option to build qemu and the
|
||||
utilities as shared libraries is added. Note that because qemu does not perform
|
||||
resource cleanup in most cases (open files, allocated memory, etc), it is
|
||||
advisable that the user implements a proxy layer for syscalls so resources can
|
||||
be kept track by the app that uses qemu as a shared library.
|
||||
|
||||
JIT support
|
||||
-----------
|
||||
|
||||
On iOS, allocating RWX pages require special entitlements not usually granted to
|
||||
apps. However, it is possible to use `bulletproof JIT`_ with a development
|
||||
certificate. This means that we need to allocate one chunk of memory with RX
|
||||
permissions and then mirror map the same memory with RW permissions. We generate
|
||||
code to the mirror mapping and execute the original mapping.
|
||||
|
||||
With ``CONFIG_IOS_JIT`` defined, we store inside the TCG context the difference
|
||||
between the two mappings. Then, we make sure that any writes to JIT memory is
|
||||
done to the pointer + the difference (in order to get a pointer to the mirror
|
||||
mapped space). Additionally, we make sure to flush the data cache before we
|
||||
invalidate the instruction cache so the changes are seen in both mappings.
|
||||
|
||||
.. _bulletproof JIT: https://www.blackhat.com/docs/us-16/materials/us-16-Krstic.pdf
|
||||
@@ -93,7 +93,13 @@ guest CPU state in case of a guest CPU exception. This is passed
|
||||
to ``cpu_restore_state()``. Therefore the value should either be 0,
|
||||
to indicate that the guest CPU state is already synchronized, or
|
||||
the result of ``GETPC()`` from the top level ``HELPER(foo)``
|
||||
function, which is a return address into the generated code.
|
||||
function, which is a return address into the generated code [#gpc]_.
|
||||
|
||||
.. [#gpc] Note that ``GETPC()`` should be used with great care: calling
|
||||
it in other functions that are *not* the top level
|
||||
``HELPER(foo)`` will cause unexpected behavior. Instead, the
|
||||
value of ``GETPC()`` should be read from the helper and passed
|
||||
if needed to the functions that the helper calls.
|
||||
|
||||
Function names follow the pattern:
|
||||
|
||||
|
||||
@@ -1,4 +1,50 @@
|
||||
if get_option('sphinx_build') == ''
|
||||
sphinx_build = find_program(['sphinx-build-3', 'sphinx-build'],
|
||||
required: get_option('docs'))
|
||||
else
|
||||
sphinx_build = find_program(get_option('sphinx_build'),
|
||||
required: get_option('docs'))
|
||||
endif
|
||||
|
||||
# Check if tools are available to build documentation.
|
||||
build_docs = false
|
||||
if sphinx_build.found()
|
||||
SPHINX_ARGS = [sphinx_build]
|
||||
# If we're making warnings fatal, apply this to Sphinx runs as well
|
||||
if get_option('werror')
|
||||
SPHINX_ARGS += [ '-W' ]
|
||||
endif
|
||||
|
||||
# This is a bit awkward but works: create a trivial document and
|
||||
# try to run it with our configuration file (which enforces a
|
||||
# version requirement). This will fail if sphinx-build is too old.
|
||||
run_command('mkdir', ['-p', tmpdir / 'sphinx'])
|
||||
run_command('touch', [tmpdir / 'sphinx/index.rst'])
|
||||
sphinx_build_test_out = run_command(SPHINX_ARGS + [
|
||||
'-c', meson.current_source_dir(),
|
||||
'-b', 'html', tmpdir / 'sphinx',
|
||||
tmpdir / 'sphinx/out'])
|
||||
build_docs = (sphinx_build_test_out.returncode() == 0)
|
||||
|
||||
if not build_docs
|
||||
warning('@0@ exists but it is either too old or uses too old a Python version'.format(get_option('sphinx_build')))
|
||||
if get_option('docs').enabled()
|
||||
error('Install a Python 3 version of python-sphinx')
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
if build_docs
|
||||
SPHINX_ARGS += ['-Dversion=' + meson.project_version(), '-Drelease=' + config_host['PKGVERSION']]
|
||||
|
||||
sphinx_extn_depends = [ meson.source_root() / 'docs/sphinx/depfile.py',
|
||||
meson.source_root() / 'docs/sphinx/hxtool.py',
|
||||
meson.source_root() / 'docs/sphinx/kerneldoc.py',
|
||||
meson.source_root() / 'docs/sphinx/kernellog.py',
|
||||
meson.source_root() / 'docs/sphinx/qapidoc.py',
|
||||
meson.source_root() / 'docs/sphinx/qmp_lexer.py',
|
||||
qapi_gen_depends ]
|
||||
|
||||
configure_file(output: 'index.html',
|
||||
input: files('index.html.in'),
|
||||
configuration: {'VERSION': meson.project_version()},
|
||||
|
||||
@@ -67,7 +67,7 @@ class KernelDocDirective(Directive):
|
||||
|
||||
def run(self):
|
||||
env = self.state.document.settings.env
|
||||
cmd = [env.config.kerneldoc_bin, '-rst', '-enable-lineno']
|
||||
cmd = env.config.kerneldoc_bin + ['-rst', '-enable-lineno']
|
||||
|
||||
filename = env.config.kerneldoc_srctree + '/' + self.arguments[0]
|
||||
export_file_patterns = []
|
||||
|
||||
@@ -48,11 +48,17 @@ across all desired hosts.
|
||||
``I6400``
|
||||
MIPS64 Processor (Release 6, 2014)
|
||||
|
||||
``Loongson-2E``
|
||||
MIPS64 Processor (Loongson 2, 2006)
|
||||
|
||||
``Loongson-2F``
|
||||
MIPS64 Processor (Loongson 2, 2008)
|
||||
|
||||
``Loongson-2E``
|
||||
MIPS64 Processor (Loongson 2, 2006)
|
||||
``Loongson-3A1000``
|
||||
MIPS64 Processor (Loongson 3, 2010)
|
||||
|
||||
``Loongson-3A4000``
|
||||
MIPS64 Processor (Loongson 3, 2018)
|
||||
|
||||
``mips64dspr2``
|
||||
MIPS64 Processor (Release 2, 2006)
|
||||
|
||||
@@ -541,8 +541,6 @@ static int synth_init(FsContext *ctx, Error **errp)
|
||||
QLIST_INIT(&synth_root.child);
|
||||
qemu_mutex_init(&synth_mutex);
|
||||
|
||||
ctx->export_flags |= V9FS_NO_PERF_WARN;
|
||||
|
||||
/* Add "." and ".." entries for root */
|
||||
v9fs_add_dir_node(&synth_root, synth_root.attr->mode,
|
||||
"..", synth_root.attr, synth_root.attr->inode);
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "hw/virtio/virtio-access.h"
|
||||
#include "qemu/iov.h"
|
||||
#include "qemu/module.h"
|
||||
#include "sysemu/qtest.h"
|
||||
|
||||
static void virtio_9p_push_and_notify(V9fsPDU *pdu)
|
||||
{
|
||||
@@ -199,6 +200,11 @@ static void virtio_9p_device_realize(DeviceState *dev, Error **errp)
|
||||
VirtIODevice *vdev = VIRTIO_DEVICE(dev);
|
||||
V9fsVirtioState *v = VIRTIO_9P(dev);
|
||||
V9fsState *s = &v->state;
|
||||
FsDriverEntry *fse = get_fsdev_fsentry(s->fsconf.fsdev_id);
|
||||
|
||||
if (qtest_enabled() && fse) {
|
||||
fse->export_flags |= V9FS_NO_PERF_WARN;
|
||||
}
|
||||
|
||||
if (v9fs_device_realize_common(s, &virtio_9p_transport, errp)) {
|
||||
return;
|
||||
|
||||
@@ -57,6 +57,20 @@ Aml *aml_irq_no_flags(uint8_t irq)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Aml *aml_interrupt(AmlConsumerAndProducer con_and_pro,
|
||||
AmlLevelAndEdge level_and_edge,
|
||||
AmlActiveHighAndLow high_and_low, AmlShared shared,
|
||||
uint32_t *irq_list, uint8_t irq_count)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Aml *aml_memory32_fixed(uint32_t addr, uint32_t size,
|
||||
AmlReadAndWrite read_and_write)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Aml *aml_int(const uint64_t val)
|
||||
{
|
||||
return NULL;
|
||||
|
||||
@@ -26,6 +26,7 @@ config ARM_VIRT
|
||||
select ACPI_MEMORY_HOTPLUG
|
||||
select ACPI_HW_REDUCED
|
||||
select ACPI_NVDIMM
|
||||
select ACPI_APEI
|
||||
|
||||
config CHEETAH
|
||||
bool
|
||||
|
||||
@@ -171,8 +171,17 @@ static void bcm2835_peripherals_realize(DeviceState *dev, Error **errp)
|
||||
memory_region_add_subregion(&s->peri_mr, ST_OFFSET,
|
||||
sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->systmr), 0));
|
||||
sysbus_connect_irq(SYS_BUS_DEVICE(&s->systmr), 0,
|
||||
qdev_get_gpio_in_named(DEVICE(&s->ic), BCM2835_IC_ARM_IRQ,
|
||||
INTERRUPT_ARM_TIMER));
|
||||
qdev_get_gpio_in_named(DEVICE(&s->ic), BCM2835_IC_GPU_IRQ,
|
||||
INTERRUPT_TIMER0));
|
||||
sysbus_connect_irq(SYS_BUS_DEVICE(&s->systmr), 1,
|
||||
qdev_get_gpio_in_named(DEVICE(&s->ic), BCM2835_IC_GPU_IRQ,
|
||||
INTERRUPT_TIMER1));
|
||||
sysbus_connect_irq(SYS_BUS_DEVICE(&s->systmr), 2,
|
||||
qdev_get_gpio_in_named(DEVICE(&s->ic), BCM2835_IC_GPU_IRQ,
|
||||
INTERRUPT_TIMER2));
|
||||
sysbus_connect_irq(SYS_BUS_DEVICE(&s->systmr), 3,
|
||||
qdev_get_gpio_in_named(DEVICE(&s->ic), BCM2835_IC_GPU_IRQ,
|
||||
INTERRUPT_TIMER3));
|
||||
|
||||
/* UART0 */
|
||||
qdev_prop_set_chr(DEVICE(&s->uart0), "chardev", serial_hd(0));
|
||||
|
||||
@@ -1318,6 +1318,7 @@ static void n8x0_init(MachineState *machine,
|
||||
g_free(sz);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
binfo->ram_size = machine->ram_size;
|
||||
|
||||
memory_region_add_subregion(get_system_memory(), OMAP2_Q2_BASE,
|
||||
machine->ram);
|
||||
|
||||
+1
-1
@@ -935,7 +935,7 @@ struct StrongARMUARTState {
|
||||
uint8_t rx_start;
|
||||
uint8_t rx_len;
|
||||
|
||||
uint64_t char_transmit_time; /* time to transmit a char in ticks*/
|
||||
uint64_t char_transmit_time; /* time to transmit a char in nanoseconds */
|
||||
bool wait_break_end;
|
||||
QEMUTimer *rx_timeout_timer;
|
||||
QEMUTimer *tx_timer;
|
||||
|
||||
@@ -23,6 +23,21 @@ void clock_setup_canonical_path(Clock *clk)
|
||||
clk->canonical_path = object_get_canonical_path(OBJECT(clk));
|
||||
}
|
||||
|
||||
Clock *clock_new(Object *parent, const char *name)
|
||||
{
|
||||
Object *obj;
|
||||
Clock *clk;
|
||||
|
||||
obj = object_new(TYPE_CLOCK);
|
||||
object_property_add_child(parent, name, obj);
|
||||
object_unref(obj);
|
||||
|
||||
clk = CLOCK(obj);
|
||||
clock_setup_canonical_path(clk);
|
||||
|
||||
return clk;
|
||||
}
|
||||
|
||||
void clock_set_callback(Clock *clk, ClockCallback *cb, void *opaque)
|
||||
{
|
||||
clk->callback = cb;
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "hw/qdev-clock.h"
|
||||
#include "hw/qdev-core.h"
|
||||
#include "qapi/error.h"
|
||||
@@ -153,6 +154,11 @@ Clock *qdev_get_clock_in(DeviceState *dev, const char *name)
|
||||
assert(name);
|
||||
|
||||
ncl = qdev_get_clocklist(dev, name);
|
||||
if (!ncl) {
|
||||
error_report("Can not find clock-in '%s' for device type '%s'",
|
||||
name, object_get_typename(OBJECT(dev)));
|
||||
abort();
|
||||
}
|
||||
assert(!ncl->output);
|
||||
|
||||
return ncl->clock;
|
||||
@@ -165,6 +171,11 @@ Clock *qdev_get_clock_out(DeviceState *dev, const char *name)
|
||||
assert(name);
|
||||
|
||||
ncl = qdev_get_clocklist(dev, name);
|
||||
if (!ncl) {
|
||||
error_report("Can not find clock-out '%s' for device type '%s'",
|
||||
name, object_get_typename(OBJECT(dev)));
|
||||
abort();
|
||||
}
|
||||
assert(ncl->output);
|
||||
|
||||
return ncl->clock;
|
||||
|
||||
@@ -83,6 +83,7 @@ static const VMStateDescription microbit_i2c_vmstate = {
|
||||
.fields = (VMStateField[]) {
|
||||
VMSTATE_UINT32_ARRAY(regs, MicrobitI2CState, MICROBIT_I2C_NREGS),
|
||||
VMSTATE_UINT32(read_idx, MicrobitI2CState),
|
||||
VMSTATE_END_OF_LIST()
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -105,6 +105,7 @@ config MICROVM
|
||||
select VIRTIO_MMIO
|
||||
select ACPI_HW_REDUCED
|
||||
select PCI_EXPRESS_GENERIC_BRIDGE
|
||||
select USB_XHCI_SYSBUS
|
||||
|
||||
config X86_IOMMU
|
||||
bool
|
||||
|
||||
@@ -2477,7 +2477,7 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)
|
||||
|
||||
acpi_add_table(table_offsets, tables_blob);
|
||||
acpi_build_madt(tables_blob, tables->linker, x86ms,
|
||||
ACPI_DEVICE_IF(x86ms->acpi_dev), true);
|
||||
ACPI_DEVICE_IF(x86ms->acpi_dev));
|
||||
|
||||
vmgenid_dev = find_vmgenid_dev();
|
||||
if (vmgenid_dev) {
|
||||
|
||||
+11
-15
@@ -72,8 +72,7 @@ void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid,
|
||||
}
|
||||
|
||||
void acpi_build_madt(GArray *table_data, BIOSLinker *linker,
|
||||
X86MachineState *x86ms, AcpiDeviceIf *adev,
|
||||
bool has_pci)
|
||||
X86MachineState *x86ms, AcpiDeviceIf *adev)
|
||||
{
|
||||
MachineClass *mc = MACHINE_GET_CLASS(x86ms);
|
||||
const CPUArchIdList *apic_ids = mc->possible_cpu_arch_ids(MACHINE(x86ms));
|
||||
@@ -113,20 +112,17 @@ void acpi_build_madt(GArray *table_data, BIOSLinker *linker,
|
||||
intsrcovr->flags = cpu_to_le16(0); /* conforms to bus specifications */
|
||||
}
|
||||
|
||||
if (has_pci) {
|
||||
for (i = 1; i < 16; i++) {
|
||||
#define ACPI_BUILD_PCI_IRQS ((1<<5) | (1<<9) | (1<<10) | (1<<11))
|
||||
if (!(ACPI_BUILD_PCI_IRQS & (1 << i))) {
|
||||
/* No need for a INT source override structure. */
|
||||
continue;
|
||||
}
|
||||
intsrcovr = acpi_data_push(table_data, sizeof *intsrcovr);
|
||||
intsrcovr->type = ACPI_APIC_XRUPT_OVERRIDE;
|
||||
intsrcovr->length = sizeof(*intsrcovr);
|
||||
intsrcovr->source = i;
|
||||
intsrcovr->gsi = cpu_to_le32(i);
|
||||
intsrcovr->flags = cpu_to_le16(0xd); /* active high, level triggered */
|
||||
for (i = 1; i < 16; i++) {
|
||||
if (!(x86ms->pci_irq_mask & (1 << i))) {
|
||||
/* No need for a INT source override structure. */
|
||||
continue;
|
||||
}
|
||||
intsrcovr = acpi_data_push(table_data, sizeof *intsrcovr);
|
||||
intsrcovr->type = ACPI_APIC_XRUPT_OVERRIDE;
|
||||
intsrcovr->length = sizeof(*intsrcovr);
|
||||
intsrcovr->source = i;
|
||||
intsrcovr->gsi = cpu_to_le32(i);
|
||||
intsrcovr->flags = cpu_to_le16(0xd); /* active high, level triggered */
|
||||
}
|
||||
|
||||
if (x2apic_mode) {
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#define ACPI_BUILD_IOAPIC_ID 0x0
|
||||
|
||||
void acpi_build_madt(GArray *table_data, BIOSLinker *linker,
|
||||
X86MachineState *x86ms, AcpiDeviceIf *adev,
|
||||
bool has_pci);
|
||||
X86MachineState *x86ms, AcpiDeviceIf *adev);
|
||||
|
||||
#endif
|
||||
+10
-1
@@ -35,6 +35,7 @@
|
||||
#include "hw/i386/microvm.h"
|
||||
#include "hw/pci/pci.h"
|
||||
#include "hw/pci/pcie_host.h"
|
||||
#include "hw/usb/xhci.h"
|
||||
#include "hw/virtio/virtio-mmio.h"
|
||||
|
||||
#include "acpi-common.h"
|
||||
@@ -89,6 +90,13 @@ static void acpi_dsdt_add_virtio(Aml *scope,
|
||||
}
|
||||
}
|
||||
|
||||
static void acpi_dsdt_add_xhci(Aml *scope, MicrovmMachineState *mms)
|
||||
{
|
||||
if (machine_usb(MACHINE(mms))) {
|
||||
xhci_sysbus_build_aml(scope, MICROVM_XHCI_BASE, MICROVM_XHCI_IRQ);
|
||||
}
|
||||
}
|
||||
|
||||
static void acpi_dsdt_add_pci(Aml *scope, MicrovmMachineState *mms)
|
||||
{
|
||||
if (mms->pcie != ON_OFF_AUTO_ON) {
|
||||
@@ -123,6 +131,7 @@ build_dsdt_microvm(GArray *table_data, BIOSLinker *linker,
|
||||
GED_MMIO_IRQ, AML_SYSTEM_MEMORY, GED_MMIO_BASE);
|
||||
acpi_dsdt_add_power_button(sb_scope);
|
||||
acpi_dsdt_add_virtio(sb_scope, mms);
|
||||
acpi_dsdt_add_xhci(sb_scope, mms);
|
||||
acpi_dsdt_add_pci(sb_scope, mms);
|
||||
aml_append(dsdt, sb_scope);
|
||||
|
||||
@@ -196,7 +205,7 @@ static void acpi_build_microvm(AcpiBuildTables *tables,
|
||||
|
||||
acpi_add_table(table_offsets, tables_blob);
|
||||
acpi_build_madt(tables_blob, tables->linker, X86_MACHINE(machine),
|
||||
ACPI_DEVICE_IF(x86ms->acpi_dev), false);
|
||||
ACPI_DEVICE_IF(x86ms->acpi_dev));
|
||||
|
||||
xsdt = tables_blob->len;
|
||||
build_xsdt(tables_blob, tables->linker, table_offsets, NULL, NULL);
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#include "hw/acpi/acpi.h"
|
||||
#include "hw/acpi/generic_event_device.h"
|
||||
#include "hw/pci-host/gpex.h"
|
||||
#include "hw/usb/xhci.h"
|
||||
|
||||
#include "cpu.h"
|
||||
#include "elf.h"
|
||||
@@ -197,6 +198,18 @@ static void microvm_devices_init(MicrovmMachineState *mms)
|
||||
x86ms->acpi_dev = HOTPLUG_HANDLER(dev);
|
||||
}
|
||||
|
||||
if (x86_machine_is_acpi_enabled(x86ms) && machine_usb(MACHINE(mms))) {
|
||||
DeviceState *dev = qdev_new(TYPE_XHCI_SYSBUS);
|
||||
qdev_prop_set_uint32(dev, "intrs", 1);
|
||||
qdev_prop_set_uint32(dev, "slots", XHCI_MAXSLOTS);
|
||||
qdev_prop_set_uint32(dev, "p2", 8);
|
||||
qdev_prop_set_uint32(dev, "p3", 8);
|
||||
sysbus_realize(SYS_BUS_DEVICE(dev), &error_fatal);
|
||||
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, MICROVM_XHCI_BASE);
|
||||
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0,
|
||||
x86ms->gsi[MICROVM_XHCI_IRQ]);
|
||||
}
|
||||
|
||||
if (x86_machine_is_acpi_enabled(x86ms) && mms->pcie == ON_OFF_AUTO_ON) {
|
||||
/* use topmost 25% of the address space available */
|
||||
hwaddr phys_size = (hwaddr)1 << X86_CPU(first_cpu)->phys_bits;
|
||||
@@ -210,6 +223,12 @@ static void microvm_devices_init(MicrovmMachineState *mms)
|
||||
mms->gpex.ecam.size = PCIE_ECAM_SIZE;
|
||||
mms->gpex.irq = PCIE_IRQ_BASE;
|
||||
create_gpex(mms);
|
||||
x86ms->pci_irq_mask = ((1 << (PCIE_IRQ_BASE + 0)) |
|
||||
(1 << (PCIE_IRQ_BASE + 1)) |
|
||||
(1 << (PCIE_IRQ_BASE + 2)) |
|
||||
(1 << (PCIE_IRQ_BASE + 3)));
|
||||
} else {
|
||||
x86ms->pci_irq_mask = 0;
|
||||
}
|
||||
|
||||
if (mms->pic == ON_OFF_AUTO_ON || mms->pic == ON_OFF_AUTO_AUTO) {
|
||||
|
||||
+2
-2
@@ -987,7 +987,7 @@ static void xenfv_4_2_machine_options(MachineClass *m)
|
||||
pc_i440fx_4_2_machine_options(m);
|
||||
m->desc = "Xen Fully-virtualized PC";
|
||||
m->max_cpus = HVM_MAX_VCPUS;
|
||||
m->default_machine_opts = "accel=xen";
|
||||
m->default_machine_opts = "accel=xen,suppress-vmdesc=on";
|
||||
}
|
||||
|
||||
DEFINE_PC_MACHINE(xenfv_4_2, "xenfv-4.2", pc_xen_hvm_init,
|
||||
@@ -999,7 +999,7 @@ static void xenfv_3_1_machine_options(MachineClass *m)
|
||||
m->desc = "Xen Fully-virtualized PC";
|
||||
m->alias = "xenfv";
|
||||
m->max_cpus = HVM_MAX_VCPUS;
|
||||
m->default_machine_opts = "accel=xen";
|
||||
m->default_machine_opts = "accel=xen,suppress-vmdesc=on";
|
||||
}
|
||||
|
||||
DEFINE_PC_MACHINE(xenfv, "xenfv-3.1", pc_xen_hvm_init,
|
||||
|
||||
@@ -1178,6 +1178,7 @@ static void x86_machine_initfn(Object *obj)
|
||||
x86ms->smm = ON_OFF_AUTO_AUTO;
|
||||
x86ms->acpi = ON_OFF_AUTO_AUTO;
|
||||
x86ms->smp_dies = 1;
|
||||
x86ms->pci_irq_mask = ACPI_BUILD_PCI_IRQS;
|
||||
}
|
||||
|
||||
static void x86_machine_class_init(ObjectClass *oc, void *data)
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "hw/xen/xen-bus.h"
|
||||
#include "hw/xen/xen-x86.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qapi/qapi-commands-misc.h"
|
||||
#include "qapi/qapi-commands-migration.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/main-loop.h"
|
||||
#include "qemu/range.h"
|
||||
|
||||
@@ -37,8 +37,6 @@
|
||||
#include "sysemu/block-backend.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/module.h"
|
||||
|
||||
#include <xenguest.h>
|
||||
#include "qom/object.h"
|
||||
|
||||
//#define DEBUG_PLATFORM
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "migration/vmstate.h"
|
||||
#include "qemu/log.h"
|
||||
#include "qemu/module.h"
|
||||
#include "trace.h"
|
||||
|
||||
#define GPU_IRQS 64
|
||||
#define ARM_IRQS 8
|
||||
@@ -51,7 +52,6 @@ static void bcm2835_ic_update(BCM2835ICState *s)
|
||||
set = (s->gpu_irq_level & s->gpu_irq_enable)
|
||||
|| (s->arm_irq_level & s->arm_irq_enable);
|
||||
qemu_set_irq(s->irq, set);
|
||||
|
||||
}
|
||||
|
||||
static void bcm2835_ic_set_gpu_irq(void *opaque, int irq, int level)
|
||||
@@ -59,6 +59,7 @@ static void bcm2835_ic_set_gpu_irq(void *opaque, int irq, int level)
|
||||
BCM2835ICState *s = opaque;
|
||||
|
||||
assert(irq >= 0 && irq < 64);
|
||||
trace_bcm2835_ic_set_gpu_irq(irq, level);
|
||||
s->gpu_irq_level = deposit64(s->gpu_irq_level, irq, 1, level != 0);
|
||||
bcm2835_ic_update(s);
|
||||
}
|
||||
@@ -68,6 +69,7 @@ static void bcm2835_ic_set_arm_irq(void *opaque, int irq, int level)
|
||||
BCM2835ICState *s = opaque;
|
||||
|
||||
assert(irq >= 0 && irq < 8);
|
||||
trace_bcm2835_ic_set_cpu_irq(irq, level);
|
||||
s->arm_irq_level = deposit32(s->arm_irq_level, irq, 1, level != 0);
|
||||
bcm2835_ic_update(s);
|
||||
}
|
||||
|
||||
@@ -157,22 +157,22 @@ static void bcm2836_control_set_local_irq(void *opaque, int core, int local_irq,
|
||||
|
||||
static void bcm2836_control_set_local_irq0(void *opaque, int core, int level)
|
||||
{
|
||||
bcm2836_control_set_local_irq(opaque, core, 0, level);
|
||||
bcm2836_control_set_local_irq(opaque, core, IRQ_CNTPSIRQ, level);
|
||||
}
|
||||
|
||||
static void bcm2836_control_set_local_irq1(void *opaque, int core, int level)
|
||||
{
|
||||
bcm2836_control_set_local_irq(opaque, core, 1, level);
|
||||
bcm2836_control_set_local_irq(opaque, core, IRQ_CNTPNSIRQ, level);
|
||||
}
|
||||
|
||||
static void bcm2836_control_set_local_irq2(void *opaque, int core, int level)
|
||||
{
|
||||
bcm2836_control_set_local_irq(opaque, core, 2, level);
|
||||
bcm2836_control_set_local_irq(opaque, core, IRQ_CNTHPIRQ, level);
|
||||
}
|
||||
|
||||
static void bcm2836_control_set_local_irq3(void *opaque, int core, int level)
|
||||
{
|
||||
bcm2836_control_set_local_irq(opaque, core, 3, level);
|
||||
bcm2836_control_set_local_irq(opaque, core, IRQ_CNTVIRQ, level);
|
||||
}
|
||||
|
||||
static void bcm2836_control_set_gpu_irq(void *opaque, int irq, int level)
|
||||
|
||||
@@ -199,3 +199,7 @@ nvic_sysreg_write(uint64_t addr, uint32_t value, unsigned size) "NVIC sysreg wri
|
||||
heathrow_write(uint64_t addr, unsigned int n, uint64_t value) "0x%"PRIx64" %u: 0x%"PRIx64
|
||||
heathrow_read(uint64_t addr, unsigned int n, uint64_t value) "0x%"PRIx64" %u: 0x%"PRIx64
|
||||
heathrow_set_irq(int num, int level) "set_irq: num=0x%02x level=%d"
|
||||
|
||||
# bcm2835_ic.c
|
||||
bcm2835_ic_set_gpu_irq(int irq, int level) "GPU irq #%d level %d"
|
||||
bcm2835_ic_set_cpu_irq(int irq, int level) "CPU irq #%d level %d"
|
||||
+17
-4
@@ -30,6 +30,7 @@
|
||||
#include "hw/mips/cps.h"
|
||||
#include "hw/mips/cpudevs.h"
|
||||
#include "hw/pci-host/xilinx-pcie.h"
|
||||
#include "hw/qdev-clock.h"
|
||||
#include "hw/qdev-properties.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qemu/error-report.h"
|
||||
@@ -43,10 +44,10 @@
|
||||
#include <libfdt.h>
|
||||
#include "qom/object.h"
|
||||
|
||||
#define TYPE_MIPS_BOSTON "mips-boston"
|
||||
#define TYPE_BOSTON "mips-boston"
|
||||
typedef struct BostonState BostonState;
|
||||
DECLARE_INSTANCE_CHECKER(BostonState, BOSTON,
|
||||
TYPE_MIPS_BOSTON)
|
||||
TYPE_BOSTON)
|
||||
|
||||
struct BostonState {
|
||||
SysBusDevice parent_obj;
|
||||
@@ -54,6 +55,7 @@ struct BostonState {
|
||||
MachineState *mach;
|
||||
MIPSCPSState cps;
|
||||
SerialMM *uart;
|
||||
Clock *cpuclk;
|
||||
|
||||
CharBackend lcd_display;
|
||||
char lcd_content[8];
|
||||
@@ -251,10 +253,19 @@ static const MemoryRegionOps boston_platreg_ops = {
|
||||
.endianness = DEVICE_NATIVE_ENDIAN,
|
||||
};
|
||||
|
||||
static void mips_boston_instance_init(Object *obj)
|
||||
{
|
||||
BostonState *s = BOSTON(obj);
|
||||
|
||||
s->cpuclk = qdev_init_clock_out(DEVICE(obj), "cpu-refclk");
|
||||
clock_set_hz(s->cpuclk, 1000000000); /* 1 GHz */
|
||||
}
|
||||
|
||||
static const TypeInfo boston_device = {
|
||||
.name = TYPE_MIPS_BOSTON,
|
||||
.name = TYPE_BOSTON,
|
||||
.parent = TYPE_SYS_BUS_DEVICE,
|
||||
.instance_size = sizeof(BostonState),
|
||||
.instance_init = mips_boston_instance_init,
|
||||
};
|
||||
|
||||
static void boston_register_types(void)
|
||||
@@ -444,7 +455,7 @@ static void boston_mach_init(MachineState *machine)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
dev = qdev_new(TYPE_MIPS_BOSTON);
|
||||
dev = qdev_new(TYPE_BOSTON);
|
||||
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
|
||||
|
||||
s = BOSTON(dev);
|
||||
@@ -462,6 +473,8 @@ static void boston_mach_init(MachineState *machine)
|
||||
&error_fatal);
|
||||
object_property_set_int(OBJECT(&s->cps), "num-vp", machine->smp.cpus,
|
||||
&error_fatal);
|
||||
qdev_connect_clock_in(DEVICE(&s->cps), "clk-in",
|
||||
qdev_get_clock_out(dev, "cpu-refclk"));
|
||||
sysbus_realize(SYS_BUS_DEVICE(&s->cps), &error_fatal);
|
||||
|
||||
sysbus_mmio_map_overlap(SYS_BUS_DEVICE(&s->cps), 0, 0, 1);
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "qemu/module.h"
|
||||
#include "hw/mips/cps.h"
|
||||
#include "hw/mips/mips.h"
|
||||
#include "hw/qdev-clock.h"
|
||||
#include "hw/qdev-properties.h"
|
||||
#include "hw/mips/cpudevs.h"
|
||||
#include "sysemu/kvm.h"
|
||||
@@ -38,6 +39,7 @@ static void mips_cps_init(Object *obj)
|
||||
SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
|
||||
MIPSCPSState *s = MIPS_CPS(obj);
|
||||
|
||||
s->clock = qdev_init_clock_in(DEVICE(obj), "clk-in", NULL, NULL);
|
||||
/*
|
||||
* Cover entire address space as there do not seem to be any
|
||||
* constraints for the base address of CPC and GIC.
|
||||
@@ -72,6 +74,11 @@ static void mips_cps_realize(DeviceState *dev, Error **errp)
|
||||
bool itu_present = false;
|
||||
bool saar_present = false;
|
||||
|
||||
if (!clock_get(s->clock)) {
|
||||
error_setg(errp, "CPS input clock is not connected to an output clock");
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < s->num_vp; i++) {
|
||||
cpu = MIPS_CPU(object_new(s->cpu_type));
|
||||
|
||||
@@ -80,6 +87,8 @@ static void mips_cps_realize(DeviceState *dev, Error **errp)
|
||||
errp)) {
|
||||
return;
|
||||
}
|
||||
/* All cores use the same clock tree */
|
||||
qdev_connect_clock_in(DEVICE(cpu), "clk-in", s->clock);
|
||||
|
||||
if (!qdev_realize_and_unref(DEVICE(cpu), NULL, errp)) {
|
||||
return;
|
||||
|
||||
+10
-8
@@ -23,6 +23,7 @@
|
||||
#include "qemu/units.h"
|
||||
#include "qapi/error.h"
|
||||
#include "cpu.h"
|
||||
#include "hw/clock.h"
|
||||
#include "hw/intc/i8259.h"
|
||||
#include "hw/dma/i8257.h"
|
||||
#include "hw/isa/superio.h"
|
||||
@@ -132,8 +133,7 @@ static int64_t load_kernel(CPUMIPSState *env)
|
||||
if (loaderparams.initrd_filename) {
|
||||
initrd_size = get_image_size(loaderparams.initrd_filename);
|
||||
if (initrd_size > 0) {
|
||||
initrd_offset = (kernel_high + ~INITRD_PAGE_MASK) &
|
||||
INITRD_PAGE_MASK;
|
||||
initrd_offset = ROUND_UP(kernel_high, INITRD_PAGE_SIZE);
|
||||
if (initrd_offset + initrd_size > ram_size) {
|
||||
error_report("memory too small for initial ram disk '%s'",
|
||||
loaderparams.initrd_filename);
|
||||
@@ -298,12 +298,16 @@ static void mips_fuloong2e_init(MachineState *machine)
|
||||
PCIBus *pci_bus;
|
||||
ISABus *isa_bus;
|
||||
I2CBus *smbus;
|
||||
Clock *cpuclk;
|
||||
MIPSCPU *cpu;
|
||||
CPUMIPSState *env;
|
||||
DeviceState *dev;
|
||||
|
||||
cpuclk = clock_new(OBJECT(machine), "cpu-refclk");
|
||||
clock_set_hz(cpuclk, 533080000); /* ~533 MHz */
|
||||
|
||||
/* init CPUs */
|
||||
cpu = MIPS_CPU(cpu_create(machine->cpu_type));
|
||||
cpu = mips_cpu_create_with_clock(machine->cpu_type, cpuclk);
|
||||
env = &cpu->env;
|
||||
|
||||
qemu_register_reset(main_cpu_reset, cpu);
|
||||
@@ -333,10 +337,8 @@ static void mips_fuloong2e_init(MachineState *machine)
|
||||
kernel_entry = load_kernel(env);
|
||||
write_bootloader(env, memory_region_get_ram_ptr(bios), kernel_entry);
|
||||
} else {
|
||||
if (bios_name == NULL) {
|
||||
bios_name = FULOONG_BIOSNAME;
|
||||
}
|
||||
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
|
||||
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS,
|
||||
bios_name ?: FULOONG_BIOSNAME);
|
||||
if (filename) {
|
||||
bios_size = load_image_targphys(filename, 0x1fc00000LL,
|
||||
BIOS_SIZE);
|
||||
@@ -346,7 +348,7 @@ static void mips_fuloong2e_init(MachineState *machine)
|
||||
}
|
||||
|
||||
if ((bios_size < 0 || bios_size > BIOS_SIZE) &&
|
||||
!kernel_filename && !qtest_enabled()) {
|
||||
bios_name && !qtest_enabled()) {
|
||||
error_report("Could not load MIPS bios '%s'", bios_name);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
+17
-6
@@ -24,6 +24,7 @@
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu-common.h"
|
||||
#include "hw/clock.h"
|
||||
#include "hw/mips/mips.h"
|
||||
#include "hw/mips/cpudevs.h"
|
||||
#include "hw/intc/i8259.h"
|
||||
@@ -142,6 +143,7 @@ static void mips_jazz_init(MachineState *machine,
|
||||
MemoryRegion *address_space = get_system_memory();
|
||||
char *filename;
|
||||
int bios_size, n;
|
||||
Clock *cpuclk;
|
||||
MIPSCPU *cpu;
|
||||
CPUClass *cc;
|
||||
CPUMIPSState *env;
|
||||
@@ -163,14 +165,25 @@ static void mips_jazz_init(MachineState *machine,
|
||||
MemoryRegion *bios2 = g_new(MemoryRegion, 1);
|
||||
SysBusESPState *sysbus_esp;
|
||||
ESPState *esp;
|
||||
static const struct {
|
||||
unsigned freq_hz;
|
||||
unsigned pll_mult;
|
||||
} ext_clk[] = {
|
||||
[JAZZ_MAGNUM] = {50000000, 2},
|
||||
[JAZZ_PICA61] = {33333333, 4},
|
||||
};
|
||||
|
||||
if (machine->ram_size > 256 * MiB) {
|
||||
error_report("RAM size more than 256Mb is not supported");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
cpuclk = clock_new(OBJECT(machine), "cpu-refclk");
|
||||
clock_set_hz(cpuclk, ext_clk[jazz_model].freq_hz
|
||||
* ext_clk[jazz_model].pll_mult);
|
||||
|
||||
/* init CPUs */
|
||||
cpu = MIPS_CPU(cpu_create(machine->cpu_type));
|
||||
cpu = mips_cpu_create_with_clock(machine->cpu_type, cpuclk);
|
||||
env = &cpu->env;
|
||||
qemu_register_reset(main_cpu_reset, cpu);
|
||||
|
||||
@@ -205,10 +218,7 @@ static void mips_jazz_init(MachineState *machine,
|
||||
memory_region_add_subregion(address_space, 0xfff00000LL, bios2);
|
||||
|
||||
/* load the BIOS image. */
|
||||
if (bios_name == NULL) {
|
||||
bios_name = BIOS_FILENAME;
|
||||
}
|
||||
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
|
||||
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name ?: BIOS_FILENAME);
|
||||
if (filename) {
|
||||
bios_size = load_image_targphys(filename, 0xfff00000LL,
|
||||
MAGNUM_BIOS_SIZE);
|
||||
@@ -216,7 +226,8 @@ static void mips_jazz_init(MachineState *machine,
|
||||
} else {
|
||||
bios_size = -1;
|
||||
}
|
||||
if ((bios_size < 0 || bios_size > MAGNUM_BIOS_SIZE) && !qtest_enabled()) {
|
||||
if ((bios_size < 0 || bios_size > MAGNUM_BIOS_SIZE)
|
||||
&& bios_name && !qtest_enabled()) {
|
||||
error_report("Could not load MIPS bios '%s'", bios_name);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
+34
-25
@@ -26,6 +26,7 @@
|
||||
#include "qemu/units.h"
|
||||
#include "qemu-common.h"
|
||||
#include "cpu.h"
|
||||
#include "hw/clock.h"
|
||||
#include "hw/southbridge/piix.h"
|
||||
#include "hw/isa/superio.h"
|
||||
#include "hw/char/serial.h"
|
||||
@@ -57,6 +58,7 @@
|
||||
#include "sysemu/kvm.h"
|
||||
#include "hw/semihosting/semihost.h"
|
||||
#include "hw/mips/cps.h"
|
||||
#include "hw/qdev-clock.h"
|
||||
|
||||
#define ENVP_ADDR 0x80002000l
|
||||
#define ENVP_NB_ENTRIES 16
|
||||
@@ -94,6 +96,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(MaltaState, MIPS_MALTA)
|
||||
struct MaltaState {
|
||||
SysBusDevice parent_obj;
|
||||
|
||||
Clock *cpuclk;
|
||||
MIPSCPSState cps;
|
||||
qemu_irq i8259[ISA_NUM_IRQS];
|
||||
};
|
||||
@@ -575,7 +578,7 @@ static MaltaFPGAState *malta_fpga_init(MemoryRegion *address_space,
|
||||
memory_region_init_alias(&s->iomem_lo, NULL, "malta-fpga",
|
||||
&s->iomem, 0, 0x900);
|
||||
memory_region_init_alias(&s->iomem_hi, NULL, "malta-fpga",
|
||||
&s->iomem, 0xa00, 0x10000 - 0xa00);
|
||||
&s->iomem, 0xa00, 0x100000 - 0xa00);
|
||||
|
||||
memory_region_add_subregion(address_space, base, &s->iomem_lo);
|
||||
memory_region_add_subregion(address_space, base + 0xa00, &s->iomem_hi);
|
||||
@@ -1074,9 +1077,9 @@ static int64_t load_kernel(void)
|
||||
* the initrd. It takes at most 128kiB for 2GB RAM and 4kiB
|
||||
* pages.
|
||||
*/
|
||||
initrd_offset = (loaderparams.ram_low_size - initrd_size
|
||||
- (128 * KiB)
|
||||
- ~INITRD_PAGE_MASK) & INITRD_PAGE_MASK;
|
||||
initrd_offset = ROUND_UP(loaderparams.ram_low_size
|
||||
- (initrd_size + 128 * KiB),
|
||||
INITRD_PAGE_SIZE);
|
||||
if (kernel_high >= initrd_offset) {
|
||||
error_report("memory too small for initial ram disk '%s'",
|
||||
loaderparams.initrd_filename);
|
||||
@@ -1159,7 +1162,7 @@ static void main_cpu_reset(void *opaque)
|
||||
}
|
||||
}
|
||||
|
||||
static void create_cpu_without_cps(MachineState *ms,
|
||||
static void create_cpu_without_cps(MachineState *ms, MaltaState *s,
|
||||
qemu_irq *cbus_irq, qemu_irq *i8259_irq)
|
||||
{
|
||||
CPUMIPSState *env;
|
||||
@@ -1167,7 +1170,7 @@ static void create_cpu_without_cps(MachineState *ms,
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ms->smp.cpus; i++) {
|
||||
cpu = MIPS_CPU(cpu_create(ms->cpu_type));
|
||||
cpu = mips_cpu_create_with_clock(ms->cpu_type, s->cpuclk);
|
||||
|
||||
/* Init internal devices */
|
||||
cpu_mips_irq_init_cpu(cpu);
|
||||
@@ -1189,6 +1192,7 @@ static void create_cps(MachineState *ms, MaltaState *s,
|
||||
&error_fatal);
|
||||
object_property_set_int(OBJECT(&s->cps), "num-vp", ms->smp.cpus,
|
||||
&error_fatal);
|
||||
qdev_connect_clock_in(DEVICE(&s->cps), "clk-in", s->cpuclk);
|
||||
sysbus_realize(SYS_BUS_DEVICE(&s->cps), &error_fatal);
|
||||
|
||||
sysbus_mmio_map_overlap(SYS_BUS_DEVICE(&s->cps), 0, 0, 1);
|
||||
@@ -1203,7 +1207,7 @@ static void mips_create_cpu(MachineState *ms, MaltaState *s,
|
||||
if ((ms->smp.cpus > 1) && cpu_supports_cps_smp(ms->cpu_type)) {
|
||||
create_cps(ms, s, cbus_irq, i8259_irq);
|
||||
} else {
|
||||
create_cpu_without_cps(ms, cbus_irq, i8259_irq);
|
||||
create_cpu_without_cps(ms, s, cbus_irq, i8259_irq);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1231,18 +1235,11 @@ void mips_malta_init(MachineState *machine)
|
||||
DriveInfo *dinfo;
|
||||
int fl_idx = 0;
|
||||
int be;
|
||||
MaltaState *s;
|
||||
DeviceState *dev;
|
||||
|
||||
DeviceState *dev = qdev_new(TYPE_MIPS_MALTA);
|
||||
MaltaState *s = MIPS_MALTA(dev);
|
||||
|
||||
/*
|
||||
* The whole address space decoded by the GT-64120A doesn't generate
|
||||
* exception when accessing invalid memory. Create an empty slot to
|
||||
* emulate this feature.
|
||||
*/
|
||||
empty_slot_init("GT64120", 0, 0x20000000);
|
||||
|
||||
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
|
||||
s = MIPS_MALTA(qdev_new(TYPE_MIPS_MALTA));
|
||||
sysbus_realize_and_unref(SYS_BUS_DEVICE(s), &error_fatal);
|
||||
|
||||
/* create CPU */
|
||||
mips_create_cpu(machine, s, &cbus_irq, &i8259_irq);
|
||||
@@ -1335,10 +1332,8 @@ void mips_malta_init(MachineState *machine)
|
||||
/* Load firmware from flash. */
|
||||
if (!dinfo) {
|
||||
/* Load a BIOS image. */
|
||||
if (bios_name == NULL) {
|
||||
bios_name = BIOS_FILENAME;
|
||||
}
|
||||
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
|
||||
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS,
|
||||
bios_name ?: BIOS_FILENAME);
|
||||
if (filename) {
|
||||
bios_size = load_image_targphys(filename, FLASH_ADDRESS,
|
||||
BIOS_SIZE);
|
||||
@@ -1347,9 +1342,8 @@ void mips_malta_init(MachineState *machine)
|
||||
bios_size = -1;
|
||||
}
|
||||
if ((bios_size < 0 || bios_size > BIOS_SIZE) &&
|
||||
!kernel_filename && !qtest_enabled()) {
|
||||
error_report("Could not load MIPS bios '%s', and no "
|
||||
"-kernel argument was specified", bios_name);
|
||||
bios_name && !qtest_enabled()) {
|
||||
error_report("Could not load MIPS bios '%s'", bios_name);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
@@ -1395,6 +1389,12 @@ void mips_malta_init(MachineState *machine)
|
||||
|
||||
/* Northbridge */
|
||||
pci_bus = gt64120_register(s->i8259);
|
||||
/*
|
||||
* The whole address space decoded by the GT-64120A doesn't generate
|
||||
* exception when accessing invalid memory. Create an empty slot to
|
||||
* emulate this feature.
|
||||
*/
|
||||
empty_slot_init("GT64120", 0, 0x20000000);
|
||||
|
||||
/* Southbridge */
|
||||
dev = piix4_create(pci_bus, &isa_bus, &smbus);
|
||||
@@ -1421,10 +1421,19 @@ void mips_malta_init(MachineState *machine)
|
||||
pci_vga_init(pci_bus);
|
||||
}
|
||||
|
||||
static void mips_malta_instance_init(Object *obj)
|
||||
{
|
||||
MaltaState *s = MIPS_MALTA(obj);
|
||||
|
||||
s->cpuclk = qdev_init_clock_out(DEVICE(obj), "cpu-refclk");
|
||||
clock_set_hz(s->cpuclk, 320000000); /* 320 MHz */
|
||||
}
|
||||
|
||||
static const TypeInfo mips_malta_device = {
|
||||
.name = TYPE_MIPS_MALTA,
|
||||
.parent = TYPE_SYS_BUS_DEVICE,
|
||||
.instance_size = sizeof(MaltaState),
|
||||
.instance_init = mips_malta_instance_init,
|
||||
};
|
||||
|
||||
static void mips_malta_machine_init(MachineClass *mc)
|
||||
|
||||
+15
-15
@@ -29,6 +29,7 @@
|
||||
#include "qapi/error.h"
|
||||
#include "qemu-common.h"
|
||||
#include "cpu.h"
|
||||
#include "hw/clock.h"
|
||||
#include "hw/mips/mips.h"
|
||||
#include "hw/mips/cpudevs.h"
|
||||
#include "hw/char/serial.h"
|
||||
@@ -76,11 +77,7 @@ static int64_t load_kernel(void)
|
||||
(uint64_t *)&entry, NULL,
|
||||
(uint64_t *)&kernel_high, NULL, big_endian,
|
||||
EM_MIPS, 1, 0);
|
||||
if (kernel_size >= 0) {
|
||||
if ((entry & ~0x7fffffffULL) == 0x80000000) {
|
||||
entry = (int32_t)entry;
|
||||
}
|
||||
} else {
|
||||
if (kernel_size < 0) {
|
||||
error_report("could not load kernel '%s': %s",
|
||||
loaderparams.kernel_filename,
|
||||
load_elf_strerror(kernel_size));
|
||||
@@ -93,8 +90,7 @@ static int64_t load_kernel(void)
|
||||
if (loaderparams.initrd_filename) {
|
||||
initrd_size = get_image_size(loaderparams.initrd_filename);
|
||||
if (initrd_size > 0) {
|
||||
initrd_offset = (kernel_high + ~INITRD_PAGE_MASK) &
|
||||
INITRD_PAGE_MASK;
|
||||
initrd_offset = ROUND_UP(kernel_high, INITRD_PAGE_SIZE);
|
||||
if (initrd_offset + initrd_size > loaderparams.ram_size) {
|
||||
error_report("memory too small for initial ram disk '%s'",
|
||||
loaderparams.initrd_filename);
|
||||
@@ -150,13 +146,21 @@ mips_mipssim_init(MachineState *machine)
|
||||
MemoryRegion *address_space_mem = get_system_memory();
|
||||
MemoryRegion *isa = g_new(MemoryRegion, 1);
|
||||
MemoryRegion *bios = g_new(MemoryRegion, 1);
|
||||
Clock *cpuclk;
|
||||
MIPSCPU *cpu;
|
||||
CPUMIPSState *env;
|
||||
ResetData *reset_info;
|
||||
int bios_size;
|
||||
|
||||
cpuclk = clock_new(OBJECT(machine), "cpu-refclk");
|
||||
#ifdef TARGET_MIPS64
|
||||
clock_set_hz(cpuclk, 6000000); /* 6 MHz */
|
||||
#else
|
||||
clock_set_hz(cpuclk, 12000000); /* 12 MHz */
|
||||
#endif
|
||||
|
||||
/* Init CPUs. */
|
||||
cpu = MIPS_CPU(cpu_create(machine->cpu_type));
|
||||
cpu = mips_cpu_create_with_clock(machine->cpu_type, cpuclk);
|
||||
env = &cpu->env;
|
||||
|
||||
reset_info = g_malloc0(sizeof(ResetData));
|
||||
@@ -173,10 +177,7 @@ mips_mipssim_init(MachineState *machine)
|
||||
/* Map the BIOS / boot exception handler. */
|
||||
memory_region_add_subregion(address_space_mem, 0x1fc00000LL, bios);
|
||||
/* Load a BIOS / boot exception handler image. */
|
||||
if (bios_name == NULL) {
|
||||
bios_name = BIOS_FILENAME;
|
||||
}
|
||||
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
|
||||
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name ?: BIOS_FILENAME);
|
||||
if (filename) {
|
||||
bios_size = load_image_targphys(filename, 0x1fc00000LL, BIOS_SIZE);
|
||||
g_free(filename);
|
||||
@@ -184,10 +185,9 @@ mips_mipssim_init(MachineState *machine)
|
||||
bios_size = -1;
|
||||
}
|
||||
if ((bios_size < 0 || bios_size > BIOS_SIZE) &&
|
||||
!kernel_filename && !qtest_enabled()) {
|
||||
bios_name && !qtest_enabled()) {
|
||||
/* Bail out if we have neither a kernel image nor boot vector code. */
|
||||
error_report("Could not load MIPS bios '%s', and no "
|
||||
"-kernel argument was specified", bios_name);
|
||||
error_report("Could not load MIPS bios '%s'", bios_name);
|
||||
exit(1);
|
||||
} else {
|
||||
/* We have a boot vector start address. */
|
||||
|
||||
+8
-8
@@ -13,6 +13,7 @@
|
||||
#include "qapi/error.h"
|
||||
#include "qemu-common.h"
|
||||
#include "cpu.h"
|
||||
#include "hw/clock.h"
|
||||
#include "hw/mips/mips.h"
|
||||
#include "hw/mips/cpudevs.h"
|
||||
#include "hw/intc/i8259.h"
|
||||
@@ -101,11 +102,7 @@ static int64_t load_kernel(void)
|
||||
(uint64_t *)&entry, NULL,
|
||||
(uint64_t *)&kernel_high, NULL, big_endian,
|
||||
EM_MIPS, 1, 0);
|
||||
if (kernel_size >= 0) {
|
||||
if ((entry & ~0x7fffffffULL) == 0x80000000) {
|
||||
entry = (int32_t)entry;
|
||||
}
|
||||
} else {
|
||||
if (kernel_size < 0) {
|
||||
error_report("could not load kernel '%s': %s",
|
||||
loaderparams.kernel_filename,
|
||||
load_elf_strerror(kernel_size));
|
||||
@@ -118,8 +115,7 @@ static int64_t load_kernel(void)
|
||||
if (loaderparams.initrd_filename) {
|
||||
initrd_size = get_image_size(loaderparams.initrd_filename);
|
||||
if (initrd_size > 0) {
|
||||
initrd_offset = (kernel_high + ~INITRD_PAGE_MASK) &
|
||||
INITRD_PAGE_MASK;
|
||||
initrd_offset = ROUND_UP(kernel_high, INITRD_PAGE_SIZE);
|
||||
if (initrd_offset + initrd_size > ram_size) {
|
||||
error_report("memory too small for initial ram disk '%s'",
|
||||
loaderparams.initrd_filename);
|
||||
@@ -182,6 +178,7 @@ void mips_r4k_init(MachineState *machine)
|
||||
MemoryRegion *isa_io = g_new(MemoryRegion, 1);
|
||||
MemoryRegion *isa_mem = g_new(MemoryRegion, 1);
|
||||
int bios_size;
|
||||
Clock *cpuclk;
|
||||
MIPSCPU *cpu;
|
||||
CPUMIPSState *env;
|
||||
ResetData *reset_info;
|
||||
@@ -192,8 +189,11 @@ void mips_r4k_init(MachineState *machine)
|
||||
DriveInfo *dinfo;
|
||||
int be;
|
||||
|
||||
cpuclk = clock_new(OBJECT(machine), "cpu-refclk");
|
||||
clock_set_hz(cpuclk, 200000000); /* 200 MHz */
|
||||
|
||||
/* init CPUs */
|
||||
cpu = MIPS_CPU(cpu_create(machine->cpu_type));
|
||||
cpu = mips_cpu_create_with_clock(machine->cpu_type, cpuclk);
|
||||
env = &cpu->env;
|
||||
|
||||
reset_info = g_malloc0(sizeof(ResetData));
|
||||
|
||||
@@ -109,8 +109,6 @@ static void macio_common_realize(PCIDevice *d, Error **errp)
|
||||
qdev_prop_set_uint32(DEVICE(&s->escc), "disabled", 0);
|
||||
qdev_prop_set_uint32(DEVICE(&s->escc), "frequency", ESCC_CLOCK);
|
||||
qdev_prop_set_uint32(DEVICE(&s->escc), "it_shift", 4);
|
||||
qdev_prop_set_chr(DEVICE(&s->escc), "chrA", serial_hd(0));
|
||||
qdev_prop_set_chr(DEVICE(&s->escc), "chrB", serial_hd(1));
|
||||
qdev_prop_set_uint32(DEVICE(&s->escc), "chnBtype", escc_serial);
|
||||
qdev_prop_set_uint32(DEVICE(&s->escc), "chnAtype", escc_serial);
|
||||
if (!qdev_realize(DEVICE(&s->escc), BUS(&s->macio_bus), errp)) {
|
||||
@@ -458,8 +456,6 @@ static void macio_class_init(ObjectClass *klass, void *data)
|
||||
k->class_id = PCI_CLASS_OTHERS << 8;
|
||||
device_class_set_props(dc, macio_properties);
|
||||
set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
|
||||
/* Reason: Uses serial_hds in macio_instance_init */
|
||||
dc->user_creatable = false;
|
||||
}
|
||||
|
||||
static const TypeInfo macio_bus_info = {
|
||||
|
||||
+2
-17
@@ -28,7 +28,6 @@
|
||||
#include "hw/ppc/mac.h"
|
||||
#include "hw/qdev-properties.h"
|
||||
#include "hw/pci/pci.h"
|
||||
#include "hw/intc/heathrow_pic.h"
|
||||
#include "hw/irq.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qemu/module.h"
|
||||
@@ -41,7 +40,6 @@ struct GrackleState {
|
||||
PCIHostState parent_obj;
|
||||
|
||||
uint32_t ofw_addr;
|
||||
HeathrowState *pic;
|
||||
qemu_irq irqs[4];
|
||||
MemoryRegion pci_mmio;
|
||||
MemoryRegion pci_hole;
|
||||
@@ -62,15 +60,6 @@ static void pci_grackle_set_irq(void *opaque, int irq_num, int level)
|
||||
qemu_set_irq(s->irqs[irq_num], level);
|
||||
}
|
||||
|
||||
static void grackle_init_irqs(GrackleState *s)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(s->irqs); i++) {
|
||||
s->irqs[i] = qdev_get_gpio_in(DEVICE(s->pic), 0x15 + i);
|
||||
}
|
||||
}
|
||||
|
||||
static void grackle_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
GrackleState *s = GRACKLE_PCI_HOST_BRIDGE(dev);
|
||||
@@ -85,7 +74,6 @@ static void grackle_realize(DeviceState *dev, Error **errp)
|
||||
0, 4, TYPE_PCI_BUS);
|
||||
|
||||
pci_create_simple(phb->bus, 0, "grackle");
|
||||
grackle_init_irqs(s);
|
||||
}
|
||||
|
||||
static void grackle_init(Object *obj)
|
||||
@@ -106,15 +94,12 @@ static void grackle_init(Object *obj)
|
||||
memory_region_init_io(&phb->data_mem, obj, &pci_host_data_le_ops,
|
||||
DEVICE(obj), "pci-data-idx", 0x1000);
|
||||
|
||||
object_property_add_link(obj, "pic", TYPE_HEATHROW,
|
||||
(Object **) &s->pic,
|
||||
qdev_prop_allow_set_link_before_realize,
|
||||
0);
|
||||
|
||||
sysbus_init_mmio(sbd, &phb->conf_mem);
|
||||
sysbus_init_mmio(sbd, &phb->data_mem);
|
||||
sysbus_init_mmio(sbd, &s->pci_hole);
|
||||
sysbus_init_mmio(sbd, &s->pci_io);
|
||||
|
||||
qdev_init_gpio_out(DEVICE(obj), s->irqs, ARRAY_SIZE(s->irqs));
|
||||
}
|
||||
|
||||
static void grackle_pci_realize(PCIDevice *d, Error **errp)
|
||||
|
||||
+9
-36
@@ -32,8 +32,6 @@
|
||||
#include "hw/pci-host/uninorth.h"
|
||||
#include "trace.h"
|
||||
|
||||
static const int unin_irq_line[] = { 0x1b, 0x1c, 0x1d, 0x1e };
|
||||
|
||||
static int pci_unin_map_irq(PCIDevice *pci_dev, int irq_num)
|
||||
{
|
||||
return (irq_num + (pci_dev->devfn >> 3)) & 3;
|
||||
@@ -43,7 +41,7 @@ static void pci_unin_set_irq(void *opaque, int irq_num, int level)
|
||||
{
|
||||
UNINHostState *s = opaque;
|
||||
|
||||
trace_unin_set_irq(unin_irq_line[irq_num], level);
|
||||
trace_unin_set_irq(irq_num, level);
|
||||
qemu_set_irq(s->irqs[irq_num], level);
|
||||
}
|
||||
|
||||
@@ -112,15 +110,6 @@ static const MemoryRegionOps unin_data_ops = {
|
||||
.endianness = DEVICE_LITTLE_ENDIAN,
|
||||
};
|
||||
|
||||
static void pci_unin_init_irqs(UNINHostState *s)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(s->irqs); i++) {
|
||||
s->irqs[i] = qdev_get_gpio_in(DEVICE(s->pic), unin_irq_line[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static char *pci_unin_main_ofw_unit_address(const SysBusDevice *dev)
|
||||
{
|
||||
UNINHostState *s = UNI_NORTH_PCI_HOST_BRIDGE(dev);
|
||||
@@ -141,7 +130,6 @@ static void pci_unin_main_realize(DeviceState *dev, Error **errp)
|
||||
PCI_DEVFN(11, 0), 4, TYPE_PCI_BUS);
|
||||
|
||||
pci_create_simple(h->bus, PCI_DEVFN(11, 0), "uni-north-pci");
|
||||
pci_unin_init_irqs(s);
|
||||
|
||||
/* DEC 21154 bridge */
|
||||
#if 0
|
||||
@@ -172,15 +160,12 @@ static void pci_unin_main_init(Object *obj)
|
||||
"unin-pci-hole", &s->pci_mmio,
|
||||
0x80000000ULL, 0x10000000ULL);
|
||||
|
||||
object_property_add_link(obj, "pic", TYPE_OPENPIC,
|
||||
(Object **) &s->pic,
|
||||
qdev_prop_allow_set_link_before_realize,
|
||||
0);
|
||||
|
||||
sysbus_init_mmio(sbd, &h->conf_mem);
|
||||
sysbus_init_mmio(sbd, &h->data_mem);
|
||||
sysbus_init_mmio(sbd, &s->pci_hole);
|
||||
sysbus_init_mmio(sbd, &s->pci_io);
|
||||
|
||||
qdev_init_gpio_out(DEVICE(obj), s->irqs, ARRAY_SIZE(s->irqs));
|
||||
}
|
||||
|
||||
static void pci_u3_agp_realize(DeviceState *dev, Error **errp)
|
||||
@@ -196,7 +181,6 @@ static void pci_u3_agp_realize(DeviceState *dev, Error **errp)
|
||||
PCI_DEVFN(11, 0), 4, TYPE_PCI_BUS);
|
||||
|
||||
pci_create_simple(h->bus, PCI_DEVFN(11, 0), "u3-agp");
|
||||
pci_unin_init_irqs(s);
|
||||
}
|
||||
|
||||
static void pci_u3_agp_init(Object *obj)
|
||||
@@ -220,15 +204,12 @@ static void pci_u3_agp_init(Object *obj)
|
||||
"unin-pci-hole", &s->pci_mmio,
|
||||
0x80000000ULL, 0x70000000ULL);
|
||||
|
||||
object_property_add_link(obj, "pic", TYPE_OPENPIC,
|
||||
(Object **) &s->pic,
|
||||
qdev_prop_allow_set_link_before_realize,
|
||||
0);
|
||||
|
||||
sysbus_init_mmio(sbd, &h->conf_mem);
|
||||
sysbus_init_mmio(sbd, &h->data_mem);
|
||||
sysbus_init_mmio(sbd, &s->pci_hole);
|
||||
sysbus_init_mmio(sbd, &s->pci_io);
|
||||
|
||||
qdev_init_gpio_out(DEVICE(obj), s->irqs, ARRAY_SIZE(s->irqs));
|
||||
}
|
||||
|
||||
static void pci_unin_agp_realize(DeviceState *dev, Error **errp)
|
||||
@@ -244,7 +225,6 @@ static void pci_unin_agp_realize(DeviceState *dev, Error **errp)
|
||||
PCI_DEVFN(11, 0), 4, TYPE_PCI_BUS);
|
||||
|
||||
pci_create_simple(h->bus, PCI_DEVFN(11, 0), "uni-north-agp");
|
||||
pci_unin_init_irqs(s);
|
||||
}
|
||||
|
||||
static void pci_unin_agp_init(Object *obj)
|
||||
@@ -259,13 +239,10 @@ static void pci_unin_agp_init(Object *obj)
|
||||
memory_region_init_io(&h->data_mem, OBJECT(h), &pci_host_data_le_ops,
|
||||
obj, "unin-agp-conf-data", 0x1000);
|
||||
|
||||
object_property_add_link(obj, "pic", TYPE_OPENPIC,
|
||||
(Object **) &s->pic,
|
||||
qdev_prop_allow_set_link_before_realize,
|
||||
0);
|
||||
|
||||
sysbus_init_mmio(sbd, &h->conf_mem);
|
||||
sysbus_init_mmio(sbd, &h->data_mem);
|
||||
|
||||
qdev_init_gpio_out(DEVICE(obj), s->irqs, ARRAY_SIZE(s->irqs));
|
||||
}
|
||||
|
||||
static void pci_unin_internal_realize(DeviceState *dev, Error **errp)
|
||||
@@ -281,7 +258,6 @@ static void pci_unin_internal_realize(DeviceState *dev, Error **errp)
|
||||
PCI_DEVFN(14, 0), 4, TYPE_PCI_BUS);
|
||||
|
||||
pci_create_simple(h->bus, PCI_DEVFN(14, 0), "uni-north-internal-pci");
|
||||
pci_unin_init_irqs(s);
|
||||
}
|
||||
|
||||
static void pci_unin_internal_init(Object *obj)
|
||||
@@ -296,13 +272,10 @@ static void pci_unin_internal_init(Object *obj)
|
||||
memory_region_init_io(&h->data_mem, OBJECT(h), &pci_host_data_le_ops,
|
||||
obj, "unin-pci-conf-data", 0x1000);
|
||||
|
||||
object_property_add_link(obj, "pic", TYPE_OPENPIC,
|
||||
(Object **) &s->pic,
|
||||
qdev_prop_allow_set_link_before_realize,
|
||||
0);
|
||||
|
||||
sysbus_init_mmio(sbd, &h->conf_mem);
|
||||
sysbus_init_mmio(sbd, &h->data_mem);
|
||||
|
||||
qdev_init_gpio_out(DEVICE(obj), s->irqs, ARRAY_SIZE(s->irqs));
|
||||
}
|
||||
|
||||
static void unin_main_pci_host_realize(PCIDevice *d, Error **errp)
|
||||
|
||||
@@ -39,10 +39,8 @@
|
||||
/* SMP is not enabled, for now */
|
||||
#define MAX_CPUS 1
|
||||
|
||||
#define BIOS_SIZE (1 * MiB)
|
||||
#define NVRAM_SIZE 0x2000
|
||||
#define PROM_FILENAME "openbios-ppc"
|
||||
#define PROM_ADDR 0xfff00000
|
||||
|
||||
#define KERNEL_LOAD_ADDR 0x01000000
|
||||
#define KERNEL_GAP 0x00100000
|
||||
|
||||
+36
-16
@@ -82,6 +82,8 @@
|
||||
|
||||
#define NDRV_VGA_FILENAME "qemu_vga.ndrv"
|
||||
|
||||
#define PROM_BASE 0xfff00000
|
||||
#define PROM_SIZE (1 * MiB)
|
||||
|
||||
static void fw_cfg_boot_set(void *opaque, const char *boot_device,
|
||||
Error **errp)
|
||||
@@ -100,7 +102,7 @@ static void ppc_core99_reset(void *opaque)
|
||||
|
||||
cpu_reset(CPU(cpu));
|
||||
/* 970 CPUs want to get their initial IP as part of their boot protocol */
|
||||
cpu->env.nip = PROM_ADDR + 0x100;
|
||||
cpu->env.nip = PROM_BASE + 0x100;
|
||||
}
|
||||
|
||||
/* PowerPC Mac99 hardware initialisation */
|
||||
@@ -123,6 +125,7 @@ static void ppc_core99_init(MachineState *machine)
|
||||
UNINHostState *uninorth_pci;
|
||||
PCIBus *pci_bus;
|
||||
PCIDevice *macio;
|
||||
ESCCState *escc;
|
||||
bool has_pmu, has_adb;
|
||||
MACIOIDEState *macio_ide;
|
||||
BusState *adb_bus;
|
||||
@@ -153,25 +156,29 @@ static void ppc_core99_init(MachineState *machine)
|
||||
/* allocate RAM */
|
||||
memory_region_add_subregion(get_system_memory(), 0, machine->ram);
|
||||
|
||||
/* allocate and load BIOS */
|
||||
memory_region_init_rom(bios, NULL, "ppc_core99.bios", BIOS_SIZE,
|
||||
/* allocate and load firmware ROM */
|
||||
memory_region_init_rom(bios, NULL, "ppc_core99.bios", PROM_SIZE,
|
||||
&error_fatal);
|
||||
memory_region_add_subregion(get_system_memory(), PROM_BASE, bios);
|
||||
|
||||
if (bios_name == NULL)
|
||||
if (!bios_name) {
|
||||
bios_name = PROM_FILENAME;
|
||||
}
|
||||
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
|
||||
memory_region_add_subregion(get_system_memory(), PROM_ADDR, bios);
|
||||
|
||||
/* Load OpenBIOS (ELF) */
|
||||
if (filename) {
|
||||
/* Load OpenBIOS (ELF) */
|
||||
bios_size = load_elf(filename, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL, 1, PPC_ELF_MACHINE, 0, 0);
|
||||
|
||||
if (bios_size <= 0) {
|
||||
/* or load binary ROM image */
|
||||
bios_size = load_image_targphys(filename, PROM_BASE, PROM_SIZE);
|
||||
}
|
||||
g_free(filename);
|
||||
} else {
|
||||
bios_size = -1;
|
||||
}
|
||||
if (bios_size < 0 || bios_size > BIOS_SIZE) {
|
||||
if (bios_size < 0 || bios_size > PROM_SIZE) {
|
||||
error_report("could not load PowerPC bios '%s'", bios_name);
|
||||
exit(1);
|
||||
}
|
||||
@@ -302,8 +309,6 @@ static void ppc_core99_init(MachineState *machine)
|
||||
/* 970 gets a U3 bus */
|
||||
/* Uninorth AGP bus */
|
||||
dev = qdev_new(TYPE_U3_AGP_HOST_BRIDGE);
|
||||
object_property_set_link(OBJECT(dev), "pic", OBJECT(pic_dev),
|
||||
&error_abort);
|
||||
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
|
||||
uninorth_pci = U3_AGP_HOST_BRIDGE(dev);
|
||||
s = SYS_BUS_DEVICE(dev);
|
||||
@@ -316,32 +321,38 @@ static void ppc_core99_init(MachineState *machine)
|
||||
sysbus_mmio_map(s, 0, 0xf0800000);
|
||||
sysbus_mmio_map(s, 1, 0xf0c00000);
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
qdev_connect_gpio_out(dev, i, qdev_get_gpio_in(pic_dev, 0x1b + i));
|
||||
}
|
||||
|
||||
machine_arch = ARCH_MAC99_U3;
|
||||
} else {
|
||||
/* Use values found on a real PowerMac */
|
||||
/* Uninorth AGP bus */
|
||||
dev = qdev_new(TYPE_UNI_NORTH_AGP_HOST_BRIDGE);
|
||||
object_property_set_link(OBJECT(dev), "pic", OBJECT(pic_dev),
|
||||
&error_abort);
|
||||
s = SYS_BUS_DEVICE(dev);
|
||||
sysbus_realize_and_unref(s, &error_fatal);
|
||||
sysbus_mmio_map(s, 0, 0xf0800000);
|
||||
sysbus_mmio_map(s, 1, 0xf0c00000);
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
qdev_connect_gpio_out(dev, i, qdev_get_gpio_in(pic_dev, 0x1b + i));
|
||||
}
|
||||
|
||||
/* Uninorth internal bus */
|
||||
dev = qdev_new(TYPE_UNI_NORTH_INTERNAL_PCI_HOST_BRIDGE);
|
||||
object_property_set_link(OBJECT(dev), "pic", OBJECT(pic_dev),
|
||||
&error_abort);
|
||||
s = SYS_BUS_DEVICE(dev);
|
||||
sysbus_realize_and_unref(s, &error_fatal);
|
||||
sysbus_mmio_map(s, 0, 0xf4800000);
|
||||
sysbus_mmio_map(s, 1, 0xf4c00000);
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
qdev_connect_gpio_out(dev, i, qdev_get_gpio_in(pic_dev, 0x1b + i));
|
||||
}
|
||||
|
||||
/* Uninorth main bus */
|
||||
dev = qdev_new(TYPE_UNI_NORTH_PCI_HOST_BRIDGE);
|
||||
qdev_prop_set_uint32(dev, "ofw-addr", 0xf2000000);
|
||||
object_property_set_link(OBJECT(dev), "pic", OBJECT(pic_dev),
|
||||
&error_abort);
|
||||
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
|
||||
uninorth_pci = UNI_NORTH_PCI_HOST_BRIDGE(dev);
|
||||
s = SYS_BUS_DEVICE(dev);
|
||||
@@ -354,6 +365,10 @@ static void ppc_core99_init(MachineState *machine)
|
||||
sysbus_mmio_map(s, 0, 0xf2800000);
|
||||
sysbus_mmio_map(s, 1, 0xf2c00000);
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
qdev_connect_gpio_out(dev, i, qdev_get_gpio_in(pic_dev, 0x1b + i));
|
||||
}
|
||||
|
||||
machine_arch = ARCH_MAC99;
|
||||
}
|
||||
|
||||
@@ -380,6 +395,11 @@ static void ppc_core99_init(MachineState *machine)
|
||||
qdev_prop_set_bit(dev, "has-adb", has_adb);
|
||||
object_property_set_link(OBJECT(macio), "pic", OBJECT(pic_dev),
|
||||
&error_abort);
|
||||
|
||||
escc = ESCC(object_resolve_path_component(OBJECT(macio), "escc"));
|
||||
qdev_prop_set_chr(DEVICE(escc), "chrA", serial_hd(0));
|
||||
qdev_prop_set_chr(DEVICE(escc), "chrB", serial_hd(1));
|
||||
|
||||
pci_realize_and_unref(macio, pci_bus, &error_fatal);
|
||||
|
||||
/* We only emulate 2 out of 3 IDE controllers for now */
|
||||
|
||||
+49
-31
@@ -59,6 +59,8 @@
|
||||
#define NDRV_VGA_FILENAME "qemu_vga.ndrv"
|
||||
|
||||
#define GRACKLE_BASE 0xfec00000
|
||||
#define PROM_BASE 0xffc00000
|
||||
#define PROM_SIZE (4 * MiB)
|
||||
|
||||
static void fw_cfg_boot_set(void *opaque, const char *boot_device,
|
||||
Error **errp)
|
||||
@@ -81,24 +83,22 @@ static void ppc_heathrow_reset(void *opaque)
|
||||
static void ppc_heathrow_init(MachineState *machine)
|
||||
{
|
||||
ram_addr_t ram_size = machine->ram_size;
|
||||
const char *kernel_filename = machine->kernel_filename;
|
||||
const char *kernel_cmdline = machine->kernel_cmdline;
|
||||
const char *initrd_filename = machine->initrd_filename;
|
||||
const char *boot_device = machine->boot_order;
|
||||
MemoryRegion *sysmem = get_system_memory();
|
||||
PowerPCCPU *cpu = NULL;
|
||||
CPUPPCState *env = NULL;
|
||||
char *filename;
|
||||
int linux_boot, i;
|
||||
int i;
|
||||
MemoryRegion *bios = g_new(MemoryRegion, 1);
|
||||
uint32_t kernel_base, initrd_base, cmdline_base = 0;
|
||||
int32_t kernel_size, initrd_size;
|
||||
PCIBus *pci_bus;
|
||||
PCIDevice *macio;
|
||||
MACIOIDEState *macio_ide;
|
||||
ESCCState *escc;
|
||||
SysBusDevice *s;
|
||||
DeviceState *dev, *pic_dev;
|
||||
BusState *adb_bus;
|
||||
uint64_t bios_addr;
|
||||
int bios_size;
|
||||
unsigned int smp_cpus = machine->smp.cpus;
|
||||
uint16_t ppc_boot_device;
|
||||
@@ -106,8 +106,6 @@ static void ppc_heathrow_init(MachineState *machine)
|
||||
void *fw_cfg;
|
||||
uint64_t tbfreq;
|
||||
|
||||
linux_boot = (kernel_filename != NULL);
|
||||
|
||||
/* init CPUs */
|
||||
for (i = 0; i < smp_cpus; i++) {
|
||||
cpu = POWERPC_CPU(cpu_create(machine->cpu_type));
|
||||
@@ -125,31 +123,39 @@ static void ppc_heathrow_init(MachineState *machine)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
memory_region_add_subregion(sysmem, 0, machine->ram);
|
||||
memory_region_add_subregion(get_system_memory(), 0, machine->ram);
|
||||
|
||||
/* allocate and load BIOS */
|
||||
memory_region_init_rom(bios, NULL, "ppc_heathrow.bios", BIOS_SIZE,
|
||||
/* allocate and load firmware ROM */
|
||||
memory_region_init_rom(bios, NULL, "ppc_heathrow.bios", PROM_SIZE,
|
||||
&error_fatal);
|
||||
memory_region_add_subregion(get_system_memory(), PROM_BASE, bios);
|
||||
|
||||
if (bios_name == NULL)
|
||||
if (!bios_name) {
|
||||
bios_name = PROM_FILENAME;
|
||||
}
|
||||
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
|
||||
memory_region_add_subregion(sysmem, PROM_ADDR, bios);
|
||||
|
||||
/* Load OpenBIOS (ELF) */
|
||||
if (filename) {
|
||||
bios_size = load_elf(filename, NULL, 0, NULL, NULL, NULL, NULL, NULL,
|
||||
1, PPC_ELF_MACHINE, 0, 0);
|
||||
/* Load OpenBIOS (ELF) */
|
||||
bios_size = load_elf(filename, NULL, NULL, NULL, NULL, &bios_addr,
|
||||
NULL, NULL, 1, PPC_ELF_MACHINE, 0, 0);
|
||||
/* Unfortunately, load_elf sign-extends reading elf32 */
|
||||
bios_addr = (uint32_t)bios_addr;
|
||||
|
||||
if (bios_size <= 0) {
|
||||
/* or if could not load ELF try loading a binary ROM image */
|
||||
bios_size = load_image_targphys(filename, PROM_BASE, PROM_SIZE);
|
||||
bios_addr = PROM_BASE;
|
||||
}
|
||||
g_free(filename);
|
||||
} else {
|
||||
bios_size = -1;
|
||||
}
|
||||
if (bios_size < 0 || bios_size > BIOS_SIZE) {
|
||||
if (bios_size < 0 || bios_addr - PROM_BASE + bios_size > PROM_SIZE) {
|
||||
error_report("could not load PowerPC bios '%s'", bios_name);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (linux_boot) {
|
||||
if (machine->kernel_filename) {
|
||||
int bswap_needed;
|
||||
|
||||
#ifdef BSWAP_NEEDED
|
||||
@@ -158,29 +164,32 @@ static void ppc_heathrow_init(MachineState *machine)
|
||||
bswap_needed = 0;
|
||||
#endif
|
||||
kernel_base = KERNEL_LOAD_ADDR;
|
||||
kernel_size = load_elf(kernel_filename, NULL,
|
||||
kernel_size = load_elf(machine->kernel_filename, NULL,
|
||||
translate_kernel_address, NULL, NULL, NULL,
|
||||
NULL, NULL, 1, PPC_ELF_MACHINE, 0, 0);
|
||||
if (kernel_size < 0)
|
||||
kernel_size = load_aout(kernel_filename, kernel_base,
|
||||
kernel_size = load_aout(machine->kernel_filename, kernel_base,
|
||||
ram_size - kernel_base, bswap_needed,
|
||||
TARGET_PAGE_SIZE);
|
||||
if (kernel_size < 0)
|
||||
kernel_size = load_image_targphys(kernel_filename,
|
||||
kernel_size = load_image_targphys(machine->kernel_filename,
|
||||
kernel_base,
|
||||
ram_size - kernel_base);
|
||||
if (kernel_size < 0) {
|
||||
error_report("could not load kernel '%s'", kernel_filename);
|
||||
error_report("could not load kernel '%s'",
|
||||
machine->kernel_filename);
|
||||
exit(1);
|
||||
}
|
||||
/* load initrd */
|
||||
if (initrd_filename) {
|
||||
initrd_base = TARGET_PAGE_ALIGN(kernel_base + kernel_size + KERNEL_GAP);
|
||||
initrd_size = load_image_targphys(initrd_filename, initrd_base,
|
||||
if (machine->initrd_filename) {
|
||||
initrd_base = TARGET_PAGE_ALIGN(kernel_base + kernel_size +
|
||||
KERNEL_GAP);
|
||||
initrd_size = load_image_targphys(machine->initrd_filename,
|
||||
initrd_base,
|
||||
ram_size - initrd_base);
|
||||
if (initrd_size < 0) {
|
||||
error_report("could not load initial ram disk '%s'",
|
||||
initrd_filename);
|
||||
machine->initrd_filename);
|
||||
exit(1);
|
||||
}
|
||||
cmdline_base = TARGET_PAGE_ALIGN(initrd_base + initrd_size);
|
||||
@@ -252,10 +261,9 @@ static void ppc_heathrow_init(MachineState *machine)
|
||||
/* Grackle PCI host bridge */
|
||||
dev = qdev_new(TYPE_GRACKLE_PCI_HOST_BRIDGE);
|
||||
qdev_prop_set_uint32(dev, "ofw-addr", 0x80000000);
|
||||
object_property_set_link(OBJECT(dev), "pic", OBJECT(pic_dev),
|
||||
&error_abort);
|
||||
s = SYS_BUS_DEVICE(dev);
|
||||
sysbus_realize_and_unref(s, &error_fatal);
|
||||
|
||||
sysbus_mmio_map(s, 0, GRACKLE_BASE);
|
||||
sysbus_mmio_map(s, 1, GRACKLE_BASE + 0x200000);
|
||||
/* PCI hole */
|
||||
@@ -265,6 +273,10 @@ static void ppc_heathrow_init(MachineState *machine)
|
||||
memory_region_add_subregion(get_system_memory(), 0xfe000000,
|
||||
sysbus_mmio_get_region(s, 3));
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
qdev_connect_gpio_out(dev, i, qdev_get_gpio_in(pic_dev, 0x15 + i));
|
||||
}
|
||||
|
||||
pci_bus = PCI_HOST_BRIDGE(dev)->bus;
|
||||
|
||||
pci_vga_init(pci_bus);
|
||||
@@ -276,11 +288,16 @@ static void ppc_heathrow_init(MachineState *machine)
|
||||
ide_drive_get(hd, ARRAY_SIZE(hd));
|
||||
|
||||
/* MacIO */
|
||||
macio = pci_new(-1, TYPE_OLDWORLD_MACIO);
|
||||
macio = pci_new(PCI_DEVFN(16, 0), TYPE_OLDWORLD_MACIO);
|
||||
dev = DEVICE(macio);
|
||||
qdev_prop_set_uint64(dev, "frequency", tbfreq);
|
||||
object_property_set_link(OBJECT(macio), "pic", OBJECT(pic_dev),
|
||||
&error_abort);
|
||||
|
||||
escc = ESCC(object_resolve_path_component(OBJECT(macio), "escc"));
|
||||
qdev_prop_set_chr(DEVICE(escc), "chrA", serial_hd(0));
|
||||
qdev_prop_set_chr(DEVICE(escc), "chrB", serial_hd(1));
|
||||
|
||||
pci_realize_and_unref(macio, pci_bus, &error_fatal);
|
||||
|
||||
macio_ide = MACIO_IDE(object_resolve_path_component(OBJECT(macio),
|
||||
@@ -324,9 +341,10 @@ static void ppc_heathrow_init(MachineState *machine)
|
||||
fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, ARCH_HEATHROW);
|
||||
fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_ADDR, kernel_base);
|
||||
fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_SIZE, kernel_size);
|
||||
if (kernel_cmdline) {
|
||||
if (machine->kernel_cmdline) {
|
||||
fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, cmdline_base);
|
||||
pstrcpy_targphys("cmdline", cmdline_base, TARGET_PAGE_SIZE, kernel_cmdline);
|
||||
pstrcpy_targphys("cmdline", cmdline_base, TARGET_PAGE_SIZE,
|
||||
machine->kernel_cmdline);
|
||||
} else {
|
||||
fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, 0);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
#include "qemu-common.h"
|
||||
#include "cpu.h"
|
||||
#include "hw/ppc/ppc.h"
|
||||
#include "hw/qdev-properties.h"
|
||||
#include "hw/sysbus.h"
|
||||
#include "ppc405.h"
|
||||
#include "hw/rtc/m48t59.h"
|
||||
#include "hw/block/flash.h"
|
||||
@@ -145,6 +147,8 @@ static void ref405ep_init(MachineState *machine)
|
||||
char *filename;
|
||||
ppc4xx_bd_info_t bd;
|
||||
CPUPPCState *env;
|
||||
DeviceState *dev;
|
||||
SysBusDevice *s;
|
||||
qemu_irq *pic;
|
||||
MemoryRegion *bios;
|
||||
MemoryRegion *sram = g_new(MemoryRegion, 1);
|
||||
@@ -227,7 +231,11 @@ static void ref405ep_init(MachineState *machine)
|
||||
/* Register FPGA */
|
||||
ref405ep_fpga_init(sysmem, 0xF0300000);
|
||||
/* Register NVRAM */
|
||||
m48t59_init(NULL, 0xF0000000, 0, 8192, 1968, 8);
|
||||
dev = qdev_new("sysbus-m48t08");
|
||||
qdev_prop_set_int32(dev, "base-year", 1968);
|
||||
s = SYS_BUS_DEVICE(dev);
|
||||
sysbus_realize_and_unref(s, &error_fatal);
|
||||
sysbus_mmio_map(s, 0, 0xF0000000);
|
||||
/* Load kernel */
|
||||
linux_boot = (kernel_filename != NULL);
|
||||
if (linux_boot) {
|
||||
|
||||
@@ -58,31 +58,6 @@ static M48txxInfo m48txx_isa_info[] = {
|
||||
}
|
||||
};
|
||||
|
||||
Nvram *m48t59_init_isa(ISABus *bus, uint32_t io_base, uint16_t size,
|
||||
int base_year, int model)
|
||||
{
|
||||
ISADevice *isa_dev;
|
||||
DeviceState *dev;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(m48txx_isa_info); i++) {
|
||||
if (m48txx_isa_info[i].size != size ||
|
||||
m48txx_isa_info[i].model != model) {
|
||||
continue;
|
||||
}
|
||||
|
||||
isa_dev = isa_new(m48txx_isa_info[i].bus_name);
|
||||
dev = DEVICE(isa_dev);
|
||||
qdev_prop_set_uint32(dev, "iobase", io_base);
|
||||
qdev_prop_set_int32(dev, "base-year", base_year);
|
||||
isa_realize_and_unref(isa_dev, bus, &error_fatal);
|
||||
return NVRAM(dev);
|
||||
}
|
||||
|
||||
assert(false);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static uint32_t m48txx_isa_read(Nvram *obj, uint32_t addr)
|
||||
{
|
||||
M48txxISAState *d = M48TXX_ISA(obj);
|
||||
|
||||
@@ -564,41 +564,6 @@ const MemoryRegionOps m48t59_io_ops = {
|
||||
.endianness = DEVICE_LITTLE_ENDIAN,
|
||||
};
|
||||
|
||||
/* Initialisation routine */
|
||||
Nvram *m48t59_init(qemu_irq IRQ, hwaddr mem_base,
|
||||
uint32_t io_base, uint16_t size, int base_year,
|
||||
int model)
|
||||
{
|
||||
DeviceState *dev;
|
||||
SysBusDevice *s;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(m48txx_sysbus_info); i++) {
|
||||
if (m48txx_sysbus_info[i].size != size ||
|
||||
m48txx_sysbus_info[i].model != model) {
|
||||
continue;
|
||||
}
|
||||
|
||||
dev = qdev_new(m48txx_sysbus_info[i].bus_name);
|
||||
qdev_prop_set_int32(dev, "base-year", base_year);
|
||||
s = SYS_BUS_DEVICE(dev);
|
||||
sysbus_realize_and_unref(s, &error_fatal);
|
||||
sysbus_connect_irq(s, 0, IRQ);
|
||||
if (io_base != 0) {
|
||||
memory_region_add_subregion(get_system_io(), io_base,
|
||||
sysbus_mmio_get_region(s, 1));
|
||||
}
|
||||
if (mem_base != 0) {
|
||||
sysbus_mmio_map(s, 0, mem_base);
|
||||
}
|
||||
|
||||
return NVRAM(s);
|
||||
}
|
||||
|
||||
assert(false);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void m48t59_realize_common(M48t59State *s, Error **errp)
|
||||
{
|
||||
s->buffer = g_malloc0(s->size);
|
||||
|
||||
+22
-8
@@ -53,6 +53,8 @@
|
||||
|
||||
#define SDSC_MAX_CAPACITY (2 * GiB)
|
||||
|
||||
#define INVALID_ADDRESS UINT32_MAX
|
||||
|
||||
typedef enum {
|
||||
sd_r0 = 0, /* no response */
|
||||
sd_r1, /* normal response command */
|
||||
@@ -575,8 +577,8 @@ static void sd_reset(DeviceState *dev)
|
||||
sd->wpgrps_size = sect;
|
||||
sd->wp_groups = bitmap_new(sd->wpgrps_size);
|
||||
memset(sd->function_group, 0, sizeof(sd->function_group));
|
||||
sd->erase_start = 0;
|
||||
sd->erase_end = 0;
|
||||
sd->erase_start = INVALID_ADDRESS;
|
||||
sd->erase_end = INVALID_ADDRESS;
|
||||
sd->size = size;
|
||||
sd->blk_len = 0x200;
|
||||
sd->pwd_len = 0;
|
||||
@@ -664,8 +666,8 @@ static int sd_vmstate_pre_load(void *opaque)
|
||||
|
||||
static const VMStateDescription sd_vmstate = {
|
||||
.name = "sd-card",
|
||||
.version_id = 1,
|
||||
.minimum_version_id = 1,
|
||||
.version_id = 2,
|
||||
.minimum_version_id = 2,
|
||||
.pre_load = sd_vmstate_pre_load,
|
||||
.fields = (VMStateField[]) {
|
||||
VMSTATE_UINT32(mode, SDState),
|
||||
@@ -749,9 +751,12 @@ static void sd_erase(SDState *sd)
|
||||
uint64_t erase_start = sd->erase_start;
|
||||
uint64_t erase_end = sd->erase_end;
|
||||
|
||||
trace_sdcard_erase();
|
||||
if (!sd->erase_start || !sd->erase_end) {
|
||||
trace_sdcard_erase(sd->erase_start, sd->erase_end);
|
||||
if (sd->erase_start == INVALID_ADDRESS
|
||||
|| sd->erase_end == INVALID_ADDRESS) {
|
||||
sd->card_status |= ERASE_SEQ_ERROR;
|
||||
sd->erase_start = INVALID_ADDRESS;
|
||||
sd->erase_end = INVALID_ADDRESS;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -761,13 +766,21 @@ static void sd_erase(SDState *sd)
|
||||
erase_end *= 512;
|
||||
}
|
||||
|
||||
if (sd->erase_start > sd->size || sd->erase_end > sd->size) {
|
||||
sd->card_status |= OUT_OF_RANGE;
|
||||
sd->erase_start = INVALID_ADDRESS;
|
||||
sd->erase_end = INVALID_ADDRESS;
|
||||
return;
|
||||
}
|
||||
|
||||
erase_start = sd_addr_to_wpnum(erase_start);
|
||||
erase_end = sd_addr_to_wpnum(erase_end);
|
||||
sd->erase_start = 0;
|
||||
sd->erase_end = 0;
|
||||
sd->erase_start = INVALID_ADDRESS;
|
||||
sd->erase_end = INVALID_ADDRESS;
|
||||
sd->csd[14] |= 0x40;
|
||||
|
||||
for (i = erase_start; i <= erase_end; i++) {
|
||||
assert(i < sd->wpgrps_size);
|
||||
if (test_bit(i, sd->wp_groups)) {
|
||||
sd->card_status |= WP_ERASE_SKIP;
|
||||
}
|
||||
@@ -782,6 +795,7 @@ static uint32_t sd_wpbits(SDState *sd, uint64_t addr)
|
||||
wpnum = sd_addr_to_wpnum(addr);
|
||||
|
||||
for (i = 0; i < 32; i++, wpnum++, addr += WPGROUP_SIZE) {
|
||||
assert(wpnum < sd->wpgrps_size);
|
||||
if (addr < sd->size && test_bit(wpnum, sd->wp_groups)) {
|
||||
ret |= (1 << i);
|
||||
}
|
||||
|
||||
+35
-6
@@ -1,6 +1,8 @@
|
||||
/*
|
||||
* SD Association Host Standard Specification v2.0 controller emulation
|
||||
*
|
||||
* Datasheet: PartA2_SD_Host_Controller_Simplified_Specification_Ver2.00.pdf
|
||||
*
|
||||
* Copyright (c) 2011 Samsung Electronics Co., Ltd.
|
||||
* Mitsyanko Igor <i.mitsyanko@samsung.com>
|
||||
* Peter A.G. Crosthwaite <peter.crosthwaite@petalogix.com>
|
||||
@@ -216,9 +218,14 @@ static uint8_t sdhci_slotint(SDHCIState *s)
|
||||
((s->norintsts & SDHC_NIS_REMOVE) && (s->wakcon & SDHC_WKUP_ON_RMV));
|
||||
}
|
||||
|
||||
static inline void sdhci_update_irq(SDHCIState *s)
|
||||
/* Return true if IRQ was pending and delivered */
|
||||
static bool sdhci_update_irq(SDHCIState *s)
|
||||
{
|
||||
qemu_set_irq(s->irq, sdhci_slotint(s));
|
||||
bool pending = sdhci_slotint(s);
|
||||
|
||||
qemu_set_irq(s->irq, pending);
|
||||
|
||||
return pending;
|
||||
}
|
||||
|
||||
static void sdhci_raise_insertion_irq(void *opaque)
|
||||
@@ -729,6 +736,12 @@ static void sdhci_do_adma(SDHCIState *s)
|
||||
ADMADescr dscr = {};
|
||||
int i;
|
||||
|
||||
if (s->trnmod & SDHC_TRNS_BLK_CNT_EN && !s->blkcnt) {
|
||||
/* Stop Multiple Transfer */
|
||||
sdhci_end_transfer(s);
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < SDHC_ADMA_DESCS_PER_DELAY; ++i) {
|
||||
s->admaerr &= ~SDHC_ADMAERR_LENGTH_MISMATCH;
|
||||
|
||||
@@ -754,7 +767,6 @@ static void sdhci_do_adma(SDHCIState *s)
|
||||
|
||||
switch (dscr.attr & SDHC_ADMA_ATTR_ACT_MASK) {
|
||||
case SDHC_ADMA_ATTR_ACT_TRAN: /* data transfer */
|
||||
|
||||
if (s->trnmod & SDHC_TRNS_READ) {
|
||||
while (length) {
|
||||
if (s->data_count == 0) {
|
||||
@@ -825,7 +837,10 @@ static void sdhci_do_adma(SDHCIState *s)
|
||||
s->norintsts |= SDHC_NIS_DMA;
|
||||
}
|
||||
|
||||
sdhci_update_irq(s);
|
||||
if (sdhci_update_irq(s) && !(dscr.attr & SDHC_ADMA_ATTR_END)) {
|
||||
/* IRQ delivered, reschedule current transfer */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* ADMA transfer terminates if blkcnt == 0 or by END attribute */
|
||||
@@ -941,11 +956,21 @@ sdhci_buff_access_is_sequential(SDHCIState *s, unsigned byte_num)
|
||||
return true;
|
||||
}
|
||||
|
||||
static void sdhci_resume_pending_transfer(SDHCIState *s)
|
||||
{
|
||||
timer_del(s->transfer_timer);
|
||||
sdhci_data_transfer(s);
|
||||
}
|
||||
|
||||
static uint64_t sdhci_read(void *opaque, hwaddr offset, unsigned size)
|
||||
{
|
||||
SDHCIState *s = (SDHCIState *)opaque;
|
||||
uint32_t ret = 0;
|
||||
|
||||
if (timer_pending(s->transfer_timer)) {
|
||||
sdhci_resume_pending_transfer(s);
|
||||
}
|
||||
|
||||
switch (offset & ~0x3) {
|
||||
case SDHC_SYSAD:
|
||||
ret = s->sdmasysad;
|
||||
@@ -1089,6 +1114,10 @@ sdhci_write(void *opaque, hwaddr offset, uint64_t val, unsigned size)
|
||||
uint32_t value = val;
|
||||
value <<= shift;
|
||||
|
||||
if (timer_pending(s->transfer_timer)) {
|
||||
sdhci_resume_pending_transfer(s);
|
||||
}
|
||||
|
||||
switch (offset & ~0x3) {
|
||||
case SDHC_SYSAD:
|
||||
s->sdmasysad = (s->sdmasysad & mask) | value;
|
||||
@@ -1105,14 +1134,14 @@ sdhci_write(void *opaque, hwaddr offset, uint64_t val, unsigned size)
|
||||
break;
|
||||
case SDHC_BLKSIZE:
|
||||
if (!TRANSFERRING_DATA(s->prnsts)) {
|
||||
MASKED_WRITE(s->blksize, mask, value);
|
||||
MASKED_WRITE(s->blksize, mask, extract32(value, 0, 12));
|
||||
MASKED_WRITE(s->blkcnt, mask >> 16, value >> 16);
|
||||
}
|
||||
|
||||
/* Limit block size to the maximum buffer size */
|
||||
if (extract32(s->blksize, 0, 12) > s->buf_maxsz) {
|
||||
qemu_log_mask(LOG_GUEST_ERROR, "%s: Size 0x%x is larger than "
|
||||
"the maximum buffer 0x%x", __func__, s->blksize,
|
||||
"the maximum buffer 0x%x\n", __func__, s->blksize,
|
||||
s->buf_maxsz);
|
||||
|
||||
s->blksize = deposit32(s->blksize, 0, 12, s->buf_maxsz);
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ sdcard_reset(void) ""
|
||||
sdcard_set_blocklen(uint16_t length) "0x%03x"
|
||||
sdcard_inserted(bool readonly) "read_only: %u"
|
||||
sdcard_ejected(void) ""
|
||||
sdcard_erase(void) ""
|
||||
sdcard_erase(uint32_t first, uint32_t last) "addr first 0x%" PRIx32" last 0x%" PRIx32
|
||||
sdcard_lock(void) ""
|
||||
sdcard_unlock(void) ""
|
||||
sdcard_read_block(uint64_t addr, uint32_t len) "addr 0x%" PRIx64 " size 0x%x"
|
||||
|
||||
+8
-2
@@ -837,7 +837,7 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,
|
||||
{
|
||||
DeviceState *slavio_intctl;
|
||||
unsigned int i;
|
||||
void *nvram;
|
||||
Nvram *nvram;
|
||||
qemu_irq *cpu_irqs[MAX_CPUS], slavio_irq[32], slavio_cpu_irq[MAX_CPUS];
|
||||
qemu_irq fdc_tc;
|
||||
unsigned long kernel_size;
|
||||
@@ -966,7 +966,13 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,
|
||||
create_unimplemented_device("SUNW,sx", hwdef->sx_base, 0x2000);
|
||||
}
|
||||
|
||||
nvram = m48t59_init(slavio_irq[0], hwdef->nvram_base, 0, 0x2000, 1968, 8);
|
||||
dev = qdev_new("sysbus-m48t08");
|
||||
qdev_prop_set_int32(dev, "base-year", 1968);
|
||||
s = SYS_BUS_DEVICE(dev);
|
||||
sysbus_realize_and_unref(s, &error_fatal);
|
||||
sysbus_connect_irq(s, 0, slavio_irq[0]);
|
||||
sysbus_mmio_map(s, 0, hwdef->nvram_base);
|
||||
nvram = NVRAM(dev);
|
||||
|
||||
slavio_timer_init_all(hwdef->counter_base, slavio_irq[19], slavio_cpu_irq, smp_cpus);
|
||||
|
||||
|
||||
+5
-2
@@ -671,10 +671,13 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
|
||||
pci_ide_create_devs(pci_dev);
|
||||
|
||||
/* Map NVRAM into I/O (ebus) space */
|
||||
nvram = m48t59_init(NULL, 0, 0, NVRAM_SIZE, 1968, 59);
|
||||
s = SYS_BUS_DEVICE(nvram);
|
||||
dev = qdev_new("sysbus-m48t59");
|
||||
qdev_prop_set_int32(dev, "base-year", 1968);
|
||||
s = SYS_BUS_DEVICE(dev);
|
||||
sysbus_realize_and_unref(s, &error_fatal);
|
||||
memory_region_add_subregion(pci_address_space_io(ebus), 0x2000,
|
||||
sysbus_mmio_get_region(s, 0));
|
||||
nvram = NVRAM(dev);
|
||||
|
||||
initrd_size = 0;
|
||||
initrd_addr = 0;
|
||||
|
||||
+36
-21
@@ -28,20 +28,13 @@ REG32(COMPARE1, 0x10)
|
||||
REG32(COMPARE2, 0x14)
|
||||
REG32(COMPARE3, 0x18)
|
||||
|
||||
static void bcm2835_systmr_update_irq(BCM2835SystemTimerState *s)
|
||||
static void bcm2835_systmr_timer_expire(void *opaque)
|
||||
{
|
||||
bool enable = !!s->reg.status;
|
||||
BCM2835SystemTimerCompare *tmr = opaque;
|
||||
|
||||
trace_bcm2835_systmr_irq(enable);
|
||||
qemu_set_irq(s->irq, enable);
|
||||
}
|
||||
|
||||
static void bcm2835_systmr_update_compare(BCM2835SystemTimerState *s,
|
||||
unsigned timer_index)
|
||||
{
|
||||
/* TODO fow now, since neither Linux nor U-boot use these timers. */
|
||||
qemu_log_mask(LOG_UNIMP, "COMPARE register %u not implemented\n",
|
||||
timer_index);
|
||||
trace_bcm2835_systmr_timer_expired(tmr->id);
|
||||
tmr->state->reg.ctrl_status |= 1 << tmr->id;
|
||||
qemu_set_irq(tmr->irq, 1);
|
||||
}
|
||||
|
||||
static uint64_t bcm2835_systmr_read(void *opaque, hwaddr offset,
|
||||
@@ -52,7 +45,7 @@ static uint64_t bcm2835_systmr_read(void *opaque, hwaddr offset,
|
||||
|
||||
switch (offset) {
|
||||
case A_CTRL_STATUS:
|
||||
r = s->reg.status;
|
||||
r = s->reg.ctrl_status;
|
||||
break;
|
||||
case A_COMPARE0 ... A_COMPARE3:
|
||||
r = s->reg.compare[(offset - A_COMPARE0) >> 2];
|
||||
@@ -75,19 +68,33 @@ static uint64_t bcm2835_systmr_read(void *opaque, hwaddr offset,
|
||||
}
|
||||
|
||||
static void bcm2835_systmr_write(void *opaque, hwaddr offset,
|
||||
uint64_t value, unsigned size)
|
||||
uint64_t value64, unsigned size)
|
||||
{
|
||||
BCM2835SystemTimerState *s = BCM2835_SYSTIMER(opaque);
|
||||
int index;
|
||||
uint32_t value = value64;
|
||||
uint32_t triggers_delay_us;
|
||||
uint64_t now;
|
||||
|
||||
trace_bcm2835_systmr_write(offset, value);
|
||||
switch (offset) {
|
||||
case A_CTRL_STATUS:
|
||||
s->reg.status &= ~value; /* Ack */
|
||||
bcm2835_systmr_update_irq(s);
|
||||
s->reg.ctrl_status &= ~value; /* Ack */
|
||||
for (index = 0; index < ARRAY_SIZE(s->tmr); index++) {
|
||||
if (extract32(value, index, 1)) {
|
||||
trace_bcm2835_systmr_irq_ack(index);
|
||||
qemu_set_irq(s->tmr[index].irq, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case A_COMPARE0 ... A_COMPARE3:
|
||||
s->reg.compare[(offset - A_COMPARE0) >> 2] = value;
|
||||
bcm2835_systmr_update_compare(s, (offset - A_COMPARE0) >> 2);
|
||||
index = (offset - A_COMPARE0) >> 2;
|
||||
s->reg.compare[index] = value;
|
||||
now = qemu_clock_get_us(QEMU_CLOCK_VIRTUAL);
|
||||
/* Compare lower 32-bits of the free-running counter. */
|
||||
triggers_delay_us = value - now;
|
||||
trace_bcm2835_systmr_run(index, triggers_delay_us);
|
||||
timer_mod(&s->tmr[index].timer, now + triggers_delay_us);
|
||||
break;
|
||||
case A_COUNTER_LOW:
|
||||
case A_COUNTER_HIGH:
|
||||
@@ -125,7 +132,14 @@ static void bcm2835_systmr_realize(DeviceState *dev, Error **errp)
|
||||
memory_region_init_io(&s->iomem, OBJECT(dev), &bcm2835_systmr_ops,
|
||||
s, "bcm2835-sys-timer", 0x20);
|
||||
sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->iomem);
|
||||
sysbus_init_irq(SYS_BUS_DEVICE(dev), &s->irq);
|
||||
|
||||
for (size_t i = 0; i < ARRAY_SIZE(s->tmr); i++) {
|
||||
s->tmr[i].id = i;
|
||||
s->tmr[i].state = s;
|
||||
sysbus_init_irq(SYS_BUS_DEVICE(dev), &s->tmr[i].irq);
|
||||
timer_init_us(&s->tmr[i].timer, QEMU_CLOCK_VIRTUAL,
|
||||
bcm2835_systmr_timer_expire, &s->tmr[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static const VMStateDescription bcm2835_systmr_vmstate = {
|
||||
@@ -133,8 +147,9 @@ static const VMStateDescription bcm2835_systmr_vmstate = {
|
||||
.version_id = 1,
|
||||
.minimum_version_id = 1,
|
||||
.fields = (VMStateField[]) {
|
||||
VMSTATE_UINT32(reg.status, BCM2835SystemTimerState),
|
||||
VMSTATE_UINT32_ARRAY(reg.compare, BCM2835SystemTimerState, 4),
|
||||
VMSTATE_UINT32(reg.ctrl_status, BCM2835SystemTimerState),
|
||||
VMSTATE_UINT32_ARRAY(reg.compare, BCM2835SystemTimerState,
|
||||
BCM2835_SYSTIMER_COUNT),
|
||||
VMSTATE_END_OF_LIST()
|
||||
}
|
||||
};
|
||||
|
||||
@@ -77,9 +77,11 @@ nrf51_timer_write(uint8_t timer_id, uint64_t addr, uint32_t value, unsigned size
|
||||
nrf51_timer_set_count(uint8_t timer_id, uint8_t counter_id, uint32_t value) "timer %u counter %u count 0x%" PRIx32
|
||||
|
||||
# bcm2835_systmr.c
|
||||
bcm2835_systmr_irq(bool enable) "timer irq state %u"
|
||||
bcm2835_systmr_timer_expired(unsigned id) "timer #%u expired"
|
||||
bcm2835_systmr_irq_ack(unsigned id) "timer #%u acked"
|
||||
bcm2835_systmr_read(uint64_t offset, uint64_t data) "timer read: offset 0x%" PRIx64 " data 0x%" PRIx64
|
||||
bcm2835_systmr_write(uint64_t offset, uint64_t data) "timer write: offset 0x%" PRIx64 " data 0x%" PRIx64
|
||||
bcm2835_systmr_write(uint64_t offset, uint32_t data) "timer write: offset 0x%" PRIx64 " data 0x%" PRIx32
|
||||
bcm2835_systmr_run(unsigned id, uint64_t delay_us) "timer #%u expiring in %"PRIu64" us"
|
||||
|
||||
# avr_timer16.c
|
||||
avr_timer16_read(uint8_t addr, uint8_t value) "timer16 read addr:%u value:%u"
|
||||
|
||||
+2
-4
@@ -32,8 +32,6 @@ config USB_EHCI_SYSBUS
|
||||
|
||||
config USB_XHCI
|
||||
bool
|
||||
default y if PCI_DEVICES
|
||||
depends on PCI
|
||||
select USB
|
||||
|
||||
config USB_XHCI_PCI
|
||||
@@ -50,8 +48,8 @@ config USB_XHCI_NEC
|
||||
|
||||
config USB_XHCI_SYSBUS
|
||||
bool
|
||||
default y if USB_XHCI
|
||||
select USB
|
||||
default y
|
||||
select USB_XHCI
|
||||
|
||||
config USB_MUSB
|
||||
bool
|
||||
|
||||
+87
-19
@@ -238,13 +238,24 @@ static void dwc2_handle_packet(DWC2State *s, uint32_t devadr, USBDevice *dev,
|
||||
pid = get_field(hctsiz, TSIZ_SC_MC_PID);
|
||||
pcnt = get_field(hctsiz, TSIZ_PKTCNT);
|
||||
len = get_field(hctsiz, TSIZ_XFERSIZE);
|
||||
assert(len <= DWC2_MAX_XFER_SIZE);
|
||||
if (len > DWC2_MAX_XFER_SIZE) {
|
||||
qemu_log_mask(LOG_GUEST_ERROR,
|
||||
"%s: HCTSIZ transfer size too large\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
chan = index >> 3;
|
||||
p = &s->packet[chan];
|
||||
|
||||
trace_usb_dwc2_handle_packet(chan, dev, &p->packet, epnum, types[eptype],
|
||||
dirs[epdir], mps, len, pcnt);
|
||||
|
||||
if (mps == 0) {
|
||||
qemu_log_mask(LOG_GUEST_ERROR,
|
||||
"%s: Bad HCCHAR_MPS set to zero\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
if (eptype == USB_ENDPOINT_XFER_CONTROL && pid == TSIZ_SC_MC_PID_SETUP) {
|
||||
pid = USB_TOKEN_SETUP;
|
||||
} else {
|
||||
@@ -663,7 +674,12 @@ static uint64_t dwc2_glbreg_read(void *ptr, hwaddr addr, int index,
|
||||
DWC2State *s = ptr;
|
||||
uint32_t val;
|
||||
|
||||
assert(addr <= GINTSTS2);
|
||||
if (addr > GINTSTS2) {
|
||||
qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%"HWADDR_PRIx"\n",
|
||||
__func__, addr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
val = s->glbreg[index];
|
||||
|
||||
switch (addr) {
|
||||
@@ -690,7 +706,12 @@ static void dwc2_glbreg_write(void *ptr, hwaddr addr, int index, uint64_t val,
|
||||
uint32_t old;
|
||||
int iflg = 0;
|
||||
|
||||
assert(addr <= GINTSTS2);
|
||||
if (addr > GINTSTS2) {
|
||||
qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%"HWADDR_PRIx"\n",
|
||||
__func__, addr);
|
||||
return;
|
||||
}
|
||||
|
||||
mmio = &s->glbreg[index];
|
||||
old = *mmio;
|
||||
|
||||
@@ -715,27 +736,34 @@ static void dwc2_glbreg_write(void *ptr, hwaddr addr, int index, uint64_t val,
|
||||
val &= ~GRSTCTL_DMAREQ;
|
||||
if (!(old & GRSTCTL_TXFFLSH) && (val & GRSTCTL_TXFFLSH)) {
|
||||
/* TODO - TX fifo flush */
|
||||
qemu_log_mask(LOG_UNIMP, "Tx FIFO flush not implemented\n");
|
||||
qemu_log_mask(LOG_UNIMP, "%s: Tx FIFO flush not implemented\n",
|
||||
__func__);
|
||||
}
|
||||
if (!(old & GRSTCTL_RXFFLSH) && (val & GRSTCTL_RXFFLSH)) {
|
||||
/* TODO - RX fifo flush */
|
||||
qemu_log_mask(LOG_UNIMP, "Rx FIFO flush not implemented\n");
|
||||
qemu_log_mask(LOG_UNIMP, "%s: Rx FIFO flush not implemented\n",
|
||||
__func__);
|
||||
}
|
||||
if (!(old & GRSTCTL_IN_TKNQ_FLSH) && (val & GRSTCTL_IN_TKNQ_FLSH)) {
|
||||
/* TODO - device IN token queue flush */
|
||||
qemu_log_mask(LOG_UNIMP, "Token queue flush not implemented\n");
|
||||
qemu_log_mask(LOG_UNIMP, "%s: Token queue flush not implemented\n",
|
||||
__func__);
|
||||
}
|
||||
if (!(old & GRSTCTL_FRMCNTRRST) && (val & GRSTCTL_FRMCNTRRST)) {
|
||||
/* TODO - host frame counter reset */
|
||||
qemu_log_mask(LOG_UNIMP, "Frame counter reset not implemented\n");
|
||||
qemu_log_mask(LOG_UNIMP,
|
||||
"%s: Frame counter reset not implemented\n",
|
||||
__func__);
|
||||
}
|
||||
if (!(old & GRSTCTL_HSFTRST) && (val & GRSTCTL_HSFTRST)) {
|
||||
/* TODO - host soft reset */
|
||||
qemu_log_mask(LOG_UNIMP, "Host soft reset not implemented\n");
|
||||
qemu_log_mask(LOG_UNIMP, "%s: Host soft reset not implemented\n",
|
||||
__func__);
|
||||
}
|
||||
if (!(old & GRSTCTL_CSFTRST) && (val & GRSTCTL_CSFTRST)) {
|
||||
/* TODO - core soft reset */
|
||||
qemu_log_mask(LOG_UNIMP, "Core soft reset not implemented\n");
|
||||
qemu_log_mask(LOG_UNIMP, "%s: Core soft reset not implemented\n",
|
||||
__func__);
|
||||
}
|
||||
/* don't allow clearing of self-clearing bits */
|
||||
val |= old & (GRSTCTL_TXFFLSH | GRSTCTL_RXFFLSH |
|
||||
@@ -774,7 +802,12 @@ static uint64_t dwc2_fszreg_read(void *ptr, hwaddr addr, int index,
|
||||
DWC2State *s = ptr;
|
||||
uint32_t val;
|
||||
|
||||
assert(addr == HPTXFSIZ);
|
||||
if (addr != HPTXFSIZ) {
|
||||
qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%"HWADDR_PRIx"\n",
|
||||
__func__, addr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
val = s->fszreg[index];
|
||||
|
||||
trace_usb_dwc2_fszreg_read(addr, val);
|
||||
@@ -789,7 +822,12 @@ static void dwc2_fszreg_write(void *ptr, hwaddr addr, int index, uint64_t val,
|
||||
uint32_t *mmio;
|
||||
uint32_t old;
|
||||
|
||||
assert(addr == HPTXFSIZ);
|
||||
if (addr != HPTXFSIZ) {
|
||||
qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%"HWADDR_PRIx"\n",
|
||||
__func__, addr);
|
||||
return;
|
||||
}
|
||||
|
||||
mmio = &s->fszreg[index];
|
||||
old = *mmio;
|
||||
|
||||
@@ -810,7 +848,12 @@ static uint64_t dwc2_hreg0_read(void *ptr, hwaddr addr, int index,
|
||||
DWC2State *s = ptr;
|
||||
uint32_t val;
|
||||
|
||||
assert(addr >= HCFG && addr <= HPRT0);
|
||||
if (addr < HCFG || addr > HPRT0) {
|
||||
qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%"HWADDR_PRIx"\n",
|
||||
__func__, addr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
val = s->hreg0[index];
|
||||
|
||||
switch (addr) {
|
||||
@@ -837,7 +880,12 @@ static void dwc2_hreg0_write(void *ptr, hwaddr addr, int index, uint64_t val,
|
||||
int prst = 0;
|
||||
int iflg = 0;
|
||||
|
||||
assert(addr >= HCFG && addr <= HPRT0);
|
||||
if (addr < HCFG || addr > HPRT0) {
|
||||
qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%"HWADDR_PRIx"\n",
|
||||
__func__, addr);
|
||||
return;
|
||||
}
|
||||
|
||||
mmio = &s->hreg0[index];
|
||||
old = *mmio;
|
||||
|
||||
@@ -923,7 +971,12 @@ static uint64_t dwc2_hreg1_read(void *ptr, hwaddr addr, int index,
|
||||
DWC2State *s = ptr;
|
||||
uint32_t val;
|
||||
|
||||
assert(addr >= HCCHAR(0) && addr <= HCDMAB(DWC2_NB_CHAN - 1));
|
||||
if (addr < HCCHAR(0) || addr > HCDMAB(DWC2_NB_CHAN - 1)) {
|
||||
qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%"HWADDR_PRIx"\n",
|
||||
__func__, addr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
val = s->hreg1[index];
|
||||
|
||||
trace_usb_dwc2_hreg1_read(addr, hreg1nm[index & 7], addr >> 5, val);
|
||||
@@ -941,7 +994,12 @@ static void dwc2_hreg1_write(void *ptr, hwaddr addr, int index, uint64_t val,
|
||||
int enflg = 0;
|
||||
int disflg = 0;
|
||||
|
||||
assert(addr >= HCCHAR(0) && addr <= HCDMAB(DWC2_NB_CHAN - 1));
|
||||
if (addr < HCCHAR(0) || addr > HCDMAB(DWC2_NB_CHAN - 1)) {
|
||||
qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%"HWADDR_PRIx"\n",
|
||||
__func__, addr);
|
||||
return;
|
||||
}
|
||||
|
||||
mmio = &s->hreg1[index];
|
||||
old = *mmio;
|
||||
|
||||
@@ -1008,7 +1066,12 @@ static uint64_t dwc2_pcgreg_read(void *ptr, hwaddr addr, int index,
|
||||
DWC2State *s = ptr;
|
||||
uint32_t val;
|
||||
|
||||
assert(addr >= PCGCTL && addr <= PCGCCTL1);
|
||||
if (addr < PCGCTL || addr > PCGCCTL1) {
|
||||
qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%"HWADDR_PRIx"\n",
|
||||
__func__, addr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
val = s->pcgreg[index];
|
||||
|
||||
trace_usb_dwc2_pcgreg_read(addr, pcgregnm[index], val);
|
||||
@@ -1023,7 +1086,12 @@ static void dwc2_pcgreg_write(void *ptr, hwaddr addr, int index,
|
||||
uint32_t *mmio;
|
||||
uint32_t old;
|
||||
|
||||
assert(addr >= PCGCTL && addr <= PCGCCTL1);
|
||||
if (addr < PCGCTL || addr > PCGCCTL1) {
|
||||
qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%"HWADDR_PRIx"\n",
|
||||
__func__, addr);
|
||||
return;
|
||||
}
|
||||
|
||||
mmio = &s->pcgreg[index];
|
||||
old = *mmio;
|
||||
|
||||
@@ -1108,7 +1176,7 @@ static uint64_t dwc2_hreg2_read(void *ptr, hwaddr addr, unsigned size)
|
||||
{
|
||||
/* TODO - implement FIFOs to support slave mode */
|
||||
trace_usb_dwc2_hreg2_read(addr, addr >> 12, 0);
|
||||
qemu_log_mask(LOG_UNIMP, "FIFO read not implemented\n");
|
||||
qemu_log_mask(LOG_UNIMP, "%s: FIFO read not implemented\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1119,7 +1187,7 @@ static void dwc2_hreg2_write(void *ptr, hwaddr addr, uint64_t val,
|
||||
|
||||
/* TODO - implement FIFOs to support slave mode */
|
||||
trace_usb_dwc2_hreg2_write(addr, addr >> 12, orig, 0, val);
|
||||
qemu_log_mask(LOG_UNIMP, "FIFO write not implemented\n");
|
||||
qemu_log_mask(LOG_UNIMP, "%s: FIFO write not implemented\n", __func__);
|
||||
}
|
||||
|
||||
static const MemoryRegionOps dwc2_mmio_hreg2_ops = {
|
||||
|
||||
+18
-17
@@ -1447,24 +1447,25 @@ static int ehci_process_itd(EHCIState *ehci,
|
||||
dev = ehci_find_device(ehci, devaddr);
|
||||
if (dev == NULL) {
|
||||
ehci_trace_guest_bug(ehci, "no device found");
|
||||
qemu_sglist_destroy(&ehci->isgl);
|
||||
return -1;
|
||||
}
|
||||
pid = dir ? USB_TOKEN_IN : USB_TOKEN_OUT;
|
||||
ep = usb_ep_get(dev, pid, endp);
|
||||
if (ep && ep->type == USB_ENDPOINT_XFER_ISOC) {
|
||||
usb_packet_setup(&ehci->ipacket, pid, ep, 0, addr, false,
|
||||
(itd->transact[i] & ITD_XACT_IOC) != 0);
|
||||
if (usb_packet_map(&ehci->ipacket, &ehci->isgl)) {
|
||||
qemu_sglist_destroy(&ehci->isgl);
|
||||
return -1;
|
||||
}
|
||||
usb_handle_packet(dev, &ehci->ipacket);
|
||||
usb_packet_unmap(&ehci->ipacket, &ehci->isgl);
|
||||
} else {
|
||||
DPRINTF("ISOCH: attempt to addess non-iso endpoint\n");
|
||||
ehci->ipacket.status = USB_RET_NAK;
|
||||
ehci->ipacket.status = USB_RET_NODEV;
|
||||
ehci->ipacket.actual_length = 0;
|
||||
} else {
|
||||
pid = dir ? USB_TOKEN_IN : USB_TOKEN_OUT;
|
||||
ep = usb_ep_get(dev, pid, endp);
|
||||
if (ep && ep->type == USB_ENDPOINT_XFER_ISOC) {
|
||||
usb_packet_setup(&ehci->ipacket, pid, ep, 0, addr, false,
|
||||
(itd->transact[i] & ITD_XACT_IOC) != 0);
|
||||
if (usb_packet_map(&ehci->ipacket, &ehci->isgl)) {
|
||||
qemu_sglist_destroy(&ehci->isgl);
|
||||
return -1;
|
||||
}
|
||||
usb_handle_packet(dev, &ehci->ipacket);
|
||||
usb_packet_unmap(&ehci->ipacket, &ehci->isgl);
|
||||
} else {
|
||||
DPRINTF("ISOCH: attempt to addess non-iso endpoint\n");
|
||||
ehci->ipacket.status = USB_RET_NAK;
|
||||
ehci->ipacket.actual_length = 0;
|
||||
}
|
||||
}
|
||||
qemu_sglist_destroy(&ehci->isgl);
|
||||
|
||||
|
||||
@@ -34,8 +34,8 @@ static Property nec_xhci_properties[] = {
|
||||
xhci.flags, XHCI_FLAG_SS_FIRST, true),
|
||||
DEFINE_PROP_BIT("force-pcie-endcap", XHCIPciState, xhci.flags,
|
||||
XHCI_FLAG_FORCE_PCIE_ENDCAP, false),
|
||||
DEFINE_PROP_UINT32("intrs", XHCIPciState, xhci.numintrs, MAXINTRS),
|
||||
DEFINE_PROP_UINT32("slots", XHCIPciState, xhci.numslots, MAXSLOTS),
|
||||
DEFINE_PROP_UINT32("intrs", XHCIPciState, xhci.numintrs, XHCI_MAXINTRS),
|
||||
DEFINE_PROP_UINT32("slots", XHCIPciState, xhci.numslots, XHCI_MAXSLOTS),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
};
|
||||
|
||||
|
||||
@@ -240,8 +240,8 @@ static void qemu_xhci_instance_init(Object *obj)
|
||||
|
||||
s->msi = ON_OFF_AUTO_OFF;
|
||||
s->msix = ON_OFF_AUTO_AUTO;
|
||||
xhci->numintrs = MAXINTRS;
|
||||
xhci->numslots = MAXSLOTS;
|
||||
xhci->numintrs = XHCI_MAXINTRS;
|
||||
xhci->numslots = XHCI_MAXSLOTS;
|
||||
xhci_set_flag(xhci, XHCI_FLAG_SS_FIRST);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "trace.h"
|
||||
#include "qapi/error.h"
|
||||
#include "hcd-xhci-sysbus.h"
|
||||
#include "hw/acpi/aml-build.h"
|
||||
#include "hw/irq.h"
|
||||
|
||||
static void xhci_sysbus_intr_raise(XHCIState *xhci, int n, bool level)
|
||||
@@ -68,9 +69,23 @@ static void xhci_sysbus_instance_init(Object *obj)
|
||||
s->xhci.intr_raise = xhci_sysbus_intr_raise;
|
||||
}
|
||||
|
||||
void xhci_sysbus_build_aml(Aml *scope, uint32_t mmio, unsigned int irq)
|
||||
{
|
||||
Aml *dev = aml_device("XHCI");
|
||||
Aml *crs = aml_resource_template();
|
||||
|
||||
aml_append(crs, aml_memory32_fixed(mmio, XHCI_LEN_REGS, AML_READ_WRITE));
|
||||
aml_append(crs, aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
|
||||
AML_EXCLUSIVE, &irq, 1));
|
||||
|
||||
aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0D10")));
|
||||
aml_append(dev, aml_name_decl("_CRS", crs));
|
||||
aml_append(scope, dev);
|
||||
}
|
||||
|
||||
static Property xhci_sysbus_props[] = {
|
||||
DEFINE_PROP_UINT32("intrs", XHCISysbusState, xhci.numintrs, MAXINTRS),
|
||||
DEFINE_PROP_UINT32("slots", XHCISysbusState, xhci.numslots, MAXSLOTS),
|
||||
DEFINE_PROP_UINT32("intrs", XHCISysbusState, xhci.numintrs, XHCI_MAXINTRS),
|
||||
DEFINE_PROP_UINT32("slots", XHCISysbusState, xhci.numslots, XHCI_MAXSLOTS),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
};
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include "hcd-xhci.h"
|
||||
#include "hw/sysbus.h"
|
||||
|
||||
#define TYPE_XHCI_SYSBUS "sysbus-xhci"
|
||||
#define XHCI_SYSBUS(obj) \
|
||||
OBJECT_CHECK(XHCISysbusState, (obj), TYPE_XHCI_SYSBUS)
|
||||
|
||||
|
||||
+16
-18
@@ -46,15 +46,13 @@
|
||||
#define TRANSFER_LIMIT 256
|
||||
|
||||
#define LEN_CAP 0x40
|
||||
#define LEN_OPER (0x400 + 0x10 * MAXPORTS)
|
||||
#define LEN_RUNTIME ((MAXINTRS + 1) * 0x20)
|
||||
#define LEN_DOORBELL ((MAXSLOTS + 1) * 0x20)
|
||||
#define LEN_OPER (0x400 + 0x10 * XHCI_MAXPORTS)
|
||||
#define LEN_RUNTIME ((XHCI_MAXINTRS + 1) * 0x20)
|
||||
#define LEN_DOORBELL ((XHCI_MAXSLOTS + 1) * 0x20)
|
||||
|
||||
#define OFF_OPER LEN_CAP
|
||||
#define OFF_RUNTIME 0x1000
|
||||
#define OFF_DOORBELL 0x2000
|
||||
/* must be power of 2 */
|
||||
#define LEN_REGS 0x4000
|
||||
|
||||
#if (OFF_OPER + LEN_OPER) > OFF_RUNTIME
|
||||
#error Increase OFF_RUNTIME
|
||||
@@ -62,8 +60,8 @@
|
||||
#if (OFF_RUNTIME + LEN_RUNTIME) > OFF_DOORBELL
|
||||
#error Increase OFF_DOORBELL
|
||||
#endif
|
||||
#if (OFF_DOORBELL + LEN_DOORBELL) > LEN_REGS
|
||||
# error Increase LEN_REGS
|
||||
#if (OFF_DOORBELL + LEN_DOORBELL) > XHCI_LEN_REGS
|
||||
# error Increase XHCI_LEN_REGS
|
||||
#endif
|
||||
|
||||
/* bit definitions */
|
||||
@@ -3276,11 +3274,11 @@ static void usb_xhci_init(XHCIState *xhci)
|
||||
|
||||
xhci->usbsts = USBSTS_HCH;
|
||||
|
||||
if (xhci->numports_2 > MAXPORTS_2) {
|
||||
xhci->numports_2 = MAXPORTS_2;
|
||||
if (xhci->numports_2 > XHCI_MAXPORTS_2) {
|
||||
xhci->numports_2 = XHCI_MAXPORTS_2;
|
||||
}
|
||||
if (xhci->numports_3 > MAXPORTS_3) {
|
||||
xhci->numports_3 = MAXPORTS_3;
|
||||
if (xhci->numports_3 > XHCI_MAXPORTS_3) {
|
||||
xhci->numports_3 = XHCI_MAXPORTS_3;
|
||||
}
|
||||
usbports = MAX(xhci->numports_2, xhci->numports_3);
|
||||
xhci->numports = xhci->numports_2 + xhci->numports_3;
|
||||
@@ -3302,7 +3300,7 @@ static void usb_xhci_init(XHCIState *xhci)
|
||||
USB_SPEED_MASK_LOW |
|
||||
USB_SPEED_MASK_FULL |
|
||||
USB_SPEED_MASK_HIGH;
|
||||
assert(i < MAXPORTS);
|
||||
assert(i < XHCI_MAXPORTS);
|
||||
snprintf(port->name, sizeof(port->name), "usb2 port #%d", i+1);
|
||||
speedmask |= port->speedmask;
|
||||
}
|
||||
@@ -3316,7 +3314,7 @@ static void usb_xhci_init(XHCIState *xhci)
|
||||
}
|
||||
port->uport = &xhci->uports[i];
|
||||
port->speedmask = USB_SPEED_MASK_SUPER;
|
||||
assert(i < MAXPORTS);
|
||||
assert(i < XHCI_MAXPORTS);
|
||||
snprintf(port->name, sizeof(port->name), "usb3 port #%d", i+1);
|
||||
speedmask |= port->speedmask;
|
||||
}
|
||||
@@ -3331,8 +3329,8 @@ static void usb_xhci_realize(DeviceState *dev, Error **errp)
|
||||
|
||||
XHCIState *xhci = XHCI(dev);
|
||||
|
||||
if (xhci->numintrs > MAXINTRS) {
|
||||
xhci->numintrs = MAXINTRS;
|
||||
if (xhci->numintrs > XHCI_MAXINTRS) {
|
||||
xhci->numintrs = XHCI_MAXINTRS;
|
||||
}
|
||||
while (xhci->numintrs & (xhci->numintrs - 1)) { /* ! power of 2 */
|
||||
xhci->numintrs++;
|
||||
@@ -3340,8 +3338,8 @@ static void usb_xhci_realize(DeviceState *dev, Error **errp)
|
||||
if (xhci->numintrs < 1) {
|
||||
xhci->numintrs = 1;
|
||||
}
|
||||
if (xhci->numslots > MAXSLOTS) {
|
||||
xhci->numslots = MAXSLOTS;
|
||||
if (xhci->numslots > XHCI_MAXSLOTS) {
|
||||
xhci->numslots = XHCI_MAXSLOTS;
|
||||
}
|
||||
if (xhci->numslots < 1) {
|
||||
xhci->numslots = 1;
|
||||
@@ -3355,7 +3353,7 @@ static void usb_xhci_realize(DeviceState *dev, Error **errp)
|
||||
usb_xhci_init(xhci);
|
||||
xhci->mfwrap_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, xhci_mfwrap_timer, xhci);
|
||||
|
||||
memory_region_init(&xhci->mem, OBJECT(dev), "xhci", LEN_REGS);
|
||||
memory_region_init(&xhci->mem, OBJECT(dev), "xhci", XHCI_LEN_REGS);
|
||||
memory_region_init_io(&xhci->mem_cap, OBJECT(dev), &xhci_cap_ops, xhci,
|
||||
"capabilities", LEN_CAP);
|
||||
memory_region_init_io(&xhci->mem_oper, OBJECT(dev), &xhci_oper_ops, xhci,
|
||||
|
||||
+6
-16
@@ -24,23 +24,13 @@
|
||||
#include "qom/object.h"
|
||||
|
||||
#include "hw/usb.h"
|
||||
#include "hw/usb/xhci.h"
|
||||
#include "sysemu/dma.h"
|
||||
|
||||
#define TYPE_XHCI "base-xhci"
|
||||
#define TYPE_NEC_XHCI "nec-usb-xhci"
|
||||
#define TYPE_QEMU_XHCI "qemu-xhci"
|
||||
|
||||
OBJECT_DECLARE_SIMPLE_TYPE(XHCIState, XHCI)
|
||||
|
||||
#define MAXPORTS_2 15
|
||||
#define MAXPORTS_3 15
|
||||
|
||||
#define MAXPORTS (MAXPORTS_2 + MAXPORTS_3)
|
||||
#define MAXSLOTS 64
|
||||
#define MAXINTRS 16
|
||||
|
||||
/* Very pessimistic, let's hope it's enough for all cases */
|
||||
#define EV_QUEUE (((3 * 24) + 16) * MAXSLOTS)
|
||||
#define EV_QUEUE (((3 * 24) + 16) * XHCI_MAXSLOTS)
|
||||
|
||||
typedef struct XHCIStreamContext XHCIStreamContext;
|
||||
typedef struct XHCIEPContext XHCIEPContext;
|
||||
@@ -217,15 +207,15 @@ typedef struct XHCIState {
|
||||
uint32_t dcbaap_high;
|
||||
uint32_t config;
|
||||
|
||||
USBPort uports[MAX_CONST(MAXPORTS_2, MAXPORTS_3)];
|
||||
XHCIPort ports[MAXPORTS];
|
||||
XHCISlot slots[MAXSLOTS];
|
||||
USBPort uports[MAX_CONST(XHCI_MAXPORTS_2, XHCI_MAXPORTS_3)];
|
||||
XHCIPort ports[XHCI_MAXPORTS];
|
||||
XHCISlot slots[XHCI_MAXSLOTS];
|
||||
uint32_t numports;
|
||||
|
||||
/* Runtime Registers */
|
||||
int64_t mfindex_start;
|
||||
QEMUTimer *mfwrap_timer;
|
||||
XHCIInterrupter intr[MAXINTRS];
|
||||
XHCIInterrupter intr[XHCI_MAXINTRS];
|
||||
|
||||
XHCIRing cmd_ring;
|
||||
|
||||
|
||||
@@ -41,6 +41,12 @@ static void xen_backend_table_add(XenBackendImpl *impl)
|
||||
g_hash_table_insert(xen_backend_table_get(), (void *)impl->type, impl);
|
||||
}
|
||||
|
||||
static const char **xen_backend_table_keys(unsigned int *count)
|
||||
{
|
||||
return (const char **)g_hash_table_get_keys_as_array(
|
||||
xen_backend_table_get(), count);
|
||||
}
|
||||
|
||||
static const XenBackendImpl *xen_backend_table_lookup(const char *type)
|
||||
{
|
||||
return g_hash_table_lookup(xen_backend_table_get(), type);
|
||||
@@ -70,6 +76,11 @@ void xen_backend_register(const XenBackendInfo *info)
|
||||
xen_backend_table_add(impl);
|
||||
}
|
||||
|
||||
const char **xen_backend_get_types(unsigned int *count)
|
||||
{
|
||||
return xen_backend_table_keys(count);
|
||||
}
|
||||
|
||||
static QLIST_HEAD(, XenBackendInstance) backend_list;
|
||||
|
||||
static void xen_backend_list_add(XenBackendInstance *backend)
|
||||
|
||||
+32
-8
@@ -430,7 +430,15 @@ static void xen_bus_unrealize(BusState *bus)
|
||||
trace_xen_bus_unrealize();
|
||||
|
||||
if (xenbus->backend_watch) {
|
||||
xen_bus_remove_watch(xenbus, xenbus->backend_watch, NULL);
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < xenbus->backend_types; i++) {
|
||||
if (xenbus->backend_watch[i]) {
|
||||
xen_bus_remove_watch(xenbus, xenbus->backend_watch[i], NULL);
|
||||
}
|
||||
}
|
||||
|
||||
g_free(xenbus->backend_watch);
|
||||
xenbus->backend_watch = NULL;
|
||||
}
|
||||
|
||||
@@ -446,8 +454,11 @@ static void xen_bus_unrealize(BusState *bus)
|
||||
|
||||
static void xen_bus_realize(BusState *bus, Error **errp)
|
||||
{
|
||||
char *key = g_strdup_printf("%u", xen_domid);
|
||||
XenBus *xenbus = XEN_BUS(bus);
|
||||
unsigned int domid;
|
||||
const char **type;
|
||||
unsigned int i;
|
||||
Error *local_err = NULL;
|
||||
|
||||
trace_xen_bus_realize();
|
||||
@@ -469,19 +480,32 @@ static void xen_bus_realize(BusState *bus, Error **errp)
|
||||
|
||||
module_call_init(MODULE_INIT_XEN_BACKEND);
|
||||
|
||||
xenbus->backend_watch =
|
||||
xen_bus_add_watch(xenbus, "", /* domain root node */
|
||||
"backend", xen_bus_backend_changed, &local_err);
|
||||
if (local_err) {
|
||||
/* This need not be treated as a hard error so don't propagate */
|
||||
error_reportf_err(local_err,
|
||||
"failed to set up enumeration watch: ");
|
||||
type = xen_backend_get_types(&xenbus->backend_types);
|
||||
xenbus->backend_watch = g_new(XenWatch *, xenbus->backend_types);
|
||||
|
||||
for (i = 0; i < xenbus->backend_types; i++) {
|
||||
char *node = g_strdup_printf("backend/%s", type[i]);
|
||||
|
||||
xenbus->backend_watch[i] =
|
||||
xen_bus_add_watch(xenbus, node, key, xen_bus_backend_changed,
|
||||
&local_err);
|
||||
if (local_err) {
|
||||
/* This need not be treated as a hard error so don't propagate */
|
||||
error_reportf_err(local_err,
|
||||
"failed to set up '%s' enumeration watch: ",
|
||||
type[i]);
|
||||
}
|
||||
|
||||
g_free(node);
|
||||
}
|
||||
|
||||
g_free(type);
|
||||
g_free(key);
|
||||
return;
|
||||
|
||||
fail:
|
||||
xen_bus_unrealize(bus);
|
||||
g_free(key);
|
||||
}
|
||||
|
||||
static void xen_bus_unplug_request(HotplugHandler *hotplug,
|
||||
|
||||
+37
-3
@@ -251,6 +251,25 @@ void tlb_flush_by_mmuidx_all_cpus(CPUState *cpu, uint16_t idxmap);
|
||||
* depend on when the guests translation ends the TB.
|
||||
*/
|
||||
void tlb_flush_by_mmuidx_all_cpus_synced(CPUState *cpu, uint16_t idxmap);
|
||||
|
||||
/**
|
||||
* tlb_flush_page_bits_by_mmuidx
|
||||
* @cpu: CPU whose TLB should be flushed
|
||||
* @addr: virtual address of page to be flushed
|
||||
* @idxmap: bitmap of mmu indexes to flush
|
||||
* @bits: number of significant bits in address
|
||||
*
|
||||
* Similar to tlb_flush_page_mask, but with a bitmap of indexes.
|
||||
*/
|
||||
void tlb_flush_page_bits_by_mmuidx(CPUState *cpu, target_ulong addr,
|
||||
uint16_t idxmap, unsigned bits);
|
||||
|
||||
/* Similarly, with broadcast and syncing. */
|
||||
void tlb_flush_page_bits_by_mmuidx_all_cpus(CPUState *cpu, target_ulong addr,
|
||||
uint16_t idxmap, unsigned bits);
|
||||
void tlb_flush_page_bits_by_mmuidx_all_cpus_synced
|
||||
(CPUState *cpu, target_ulong addr, uint16_t idxmap, unsigned bits);
|
||||
|
||||
/**
|
||||
* tlb_set_page_with_attrs:
|
||||
* @cpu: CPU to add this TLB entry for
|
||||
@@ -337,6 +356,23 @@ static inline void tlb_flush_by_mmuidx_all_cpus_synced(CPUState *cpu,
|
||||
uint16_t idxmap)
|
||||
{
|
||||
}
|
||||
static inline void tlb_flush_page_bits_by_mmuidx(CPUState *cpu,
|
||||
target_ulong addr,
|
||||
uint16_t idxmap,
|
||||
unsigned bits)
|
||||
{
|
||||
}
|
||||
static inline void tlb_flush_page_bits_by_mmuidx_all_cpus(CPUState *cpu,
|
||||
target_ulong addr,
|
||||
uint16_t idxmap,
|
||||
unsigned bits)
|
||||
{
|
||||
}
|
||||
static inline void
|
||||
tlb_flush_page_bits_by_mmuidx_all_cpus_synced(CPUState *cpu, target_ulong addr,
|
||||
uint16_t idxmap, unsigned bits)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
/**
|
||||
* probe_access:
|
||||
@@ -484,7 +520,7 @@ struct TranslationBlock {
|
||||
uintptr_t jmp_list_next[2];
|
||||
uintptr_t jmp_dest[2];
|
||||
|
||||
#if defined(CONFIG_IOS_JIT)
|
||||
#if defined(CONFIG_MIRROR_JIT)
|
||||
/*
|
||||
* Store difference to writable mirror
|
||||
* We need this when patching the jump instructions
|
||||
@@ -521,8 +557,6 @@ TranslationBlock *tb_htable_lookup(CPUState *cpu, target_ulong pc,
|
||||
target_ulong cs_base, uint32_t flags,
|
||||
uint32_t cf_mask);
|
||||
void tb_set_jmp_target(TranslationBlock *tb, int n, uintptr_t addr);
|
||||
void tb_exec_lock(void);
|
||||
void tb_exec_unlock(void);
|
||||
|
||||
/* GETPC is the true target of the return instruction that we'll execute. */
|
||||
#if defined(CONFIG_TCG_INTERPRETER)
|
||||
|
||||
@@ -90,6 +90,19 @@ extern const VMStateDescription vmstate_clock;
|
||||
*/
|
||||
void clock_setup_canonical_path(Clock *clk);
|
||||
|
||||
/**
|
||||
* clock_new:
|
||||
* @parent: the clock parent
|
||||
* @name: the clock object name
|
||||
*
|
||||
* Helper function to create a new clock and parent it to @parent. There is no
|
||||
* need to call clock_setup_canonical_path on the returned clock as it is done
|
||||
* by this function.
|
||||
*
|
||||
* @return the newly created clock
|
||||
*/
|
||||
Clock *clock_new(Object *parent, const char *name);
|
||||
|
||||
/**
|
||||
* clock_set_callback:
|
||||
* @clk: the clock to register the callback into
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
* 7 | parallel |
|
||||
* 8 | rtc | rtc (rtc=on)
|
||||
* 9 | acpi | acpi (ged)
|
||||
* 10 | pci lnk |
|
||||
* 10 | pci lnk | xhci (usb=on)
|
||||
* 11 | pci lnk |
|
||||
* 12 | ps2 | pcie
|
||||
* 13 | fpu | pcie
|
||||
@@ -60,6 +60,9 @@
|
||||
#define GED_MMIO_BASE_REGS (GED_MMIO_BASE + 0x200)
|
||||
#define GED_MMIO_IRQ 9
|
||||
|
||||
#define MICROVM_XHCI_BASE 0xfe900000
|
||||
#define MICROVM_XHCI_IRQ 10
|
||||
|
||||
#define PCIE_MMIO_BASE 0xc0000000
|
||||
#define PCIE_MMIO_SIZE 0x20000000
|
||||
#define PCIE_ECAM_BASE 0xe0000000
|
||||
|
||||
@@ -58,6 +58,7 @@ struct X86MachineState {
|
||||
|
||||
/* CPU and apic information: */
|
||||
bool apic_xrupt_override;
|
||||
unsigned pci_irq_mask;
|
||||
unsigned apic_id_limit;
|
||||
uint16_t boot_cpus;
|
||||
unsigned smp_dies;
|
||||
@@ -114,6 +115,7 @@ bool x86_machine_is_acpi_enabled(const X86MachineState *x86ms);
|
||||
/* Global System Interrupts */
|
||||
|
||||
#define GSI_NUM_PINS IOAPIC_NUM_PINS
|
||||
#define ACPI_BUILD_PCI_IRQS ((1<<5) | (1<<9) | (1<<10) | (1<<11))
|
||||
|
||||
typedef struct GSIState {
|
||||
qemu_irq i8259_irq[ISA_NUM_IRQS];
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#define MIPS_CPS_H
|
||||
|
||||
#include "hw/sysbus.h"
|
||||
#include "hw/clock.h"
|
||||
#include "hw/misc/mips_cmgcr.h"
|
||||
#include "hw/intc/mips_gic.h"
|
||||
#include "hw/misc/mips_cpc.h"
|
||||
@@ -43,6 +44,7 @@ struct MIPSCPSState {
|
||||
MIPSGICState gic;
|
||||
MIPSCPCState cpc;
|
||||
MIPSITUState itu;
|
||||
Clock *clock;
|
||||
};
|
||||
|
||||
qemu_irq get_cps_irq(MIPSCPSState *cps, int pin_number);
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
#define HW_MIPS_H
|
||||
/* Definitions for mips board emulation. */
|
||||
|
||||
#include "qemu/units.h"
|
||||
|
||||
/* Kernels can be configured with 64KB pages */
|
||||
#define INITRD_PAGE_MASK (~((1 << 16) - 1))
|
||||
#define INITRD_PAGE_SIZE (64 * KiB)
|
||||
|
||||
#include "exec/memory.h"
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#define UNINORTH_H
|
||||
|
||||
#include "hw/pci/pci_host.h"
|
||||
#include "hw/ppc/openpic.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
/* UniNorth version */
|
||||
@@ -51,7 +50,6 @@ struct UNINHostState {
|
||||
PCIHostState parent_obj;
|
||||
|
||||
uint32_t ofw_addr;
|
||||
OpenPICState *pic;
|
||||
qemu_irq irqs[4];
|
||||
MemoryRegion pci_mmio;
|
||||
MemoryRegion pci_hole;
|
||||
|
||||
@@ -47,10 +47,4 @@ struct NvramClass {
|
||||
void (*toggle_lock)(Nvram *obj, int lock);
|
||||
};
|
||||
|
||||
Nvram *m48t59_init_isa(ISABus *bus, uint32_t io_base, uint16_t size,
|
||||
int base_year, int type);
|
||||
Nvram *m48t59_init(qemu_irq IRQ, hwaddr mem_base,
|
||||
uint32_t io_base, uint16_t size, int base_year,
|
||||
int type);
|
||||
|
||||
#endif /* HW_M48T59_H */
|
||||
@@ -11,23 +11,32 @@
|
||||
|
||||
#include "hw/sysbus.h"
|
||||
#include "hw/irq.h"
|
||||
#include "qemu/timer.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
#define TYPE_BCM2835_SYSTIMER "bcm2835-sys-timer"
|
||||
OBJECT_DECLARE_SIMPLE_TYPE(BCM2835SystemTimerState, BCM2835_SYSTIMER)
|
||||
|
||||
#define BCM2835_SYSTIMER_COUNT 4
|
||||
|
||||
typedef struct {
|
||||
unsigned id;
|
||||
QEMUTimer timer;
|
||||
qemu_irq irq;
|
||||
BCM2835SystemTimerState *state;
|
||||
} BCM2835SystemTimerCompare;
|
||||
|
||||
struct BCM2835SystemTimerState {
|
||||
/*< private >*/
|
||||
SysBusDevice parent_obj;
|
||||
|
||||
/*< public >*/
|
||||
MemoryRegion iomem;
|
||||
qemu_irq irq;
|
||||
|
||||
struct {
|
||||
uint32_t status;
|
||||
uint32_t compare[4];
|
||||
uint32_t ctrl_status;
|
||||
uint32_t compare[BCM2835_SYSTIMER_COUNT];
|
||||
} reg;
|
||||
BCM2835SystemTimerCompare tmr[BCM2835_SYSTIMER_COUNT];
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,21 @@
|
||||
#ifndef HW_USB_XHCI_H
|
||||
#define HW_USB_XHCI_H
|
||||
|
||||
#define TYPE_XHCI "base-xhci"
|
||||
#define TYPE_NEC_XHCI "nec-usb-xhci"
|
||||
#define TYPE_QEMU_XHCI "qemu-xhci"
|
||||
#define TYPE_XHCI_SYSBUS "sysbus-xhci"
|
||||
|
||||
#define XHCI_MAXPORTS_2 15
|
||||
#define XHCI_MAXPORTS_3 15
|
||||
|
||||
#define XHCI_MAXPORTS (XHCI_MAXPORTS_2 + XHCI_MAXPORTS_3)
|
||||
#define XHCI_MAXSLOTS 64
|
||||
#define XHCI_MAXINTRS 16
|
||||
|
||||
/* must be power of 2 */
|
||||
#define XHCI_LEN_REGS 0x4000
|
||||
|
||||
void xhci_sysbus_build_aml(Aml *scope, uint32_t mmio, unsigned int irq);
|
||||
|
||||
#endif
|
||||
@@ -31,6 +31,7 @@ void xen_backend_set_device(XenBackendInstance *backend,
|
||||
XenDevice *xen_backend_get_device(XenBackendInstance *backend);
|
||||
|
||||
void xen_backend_register(const XenBackendInfo *info);
|
||||
const char **xen_backend_get_types(unsigned int *nr);
|
||||
|
||||
void xen_backend_device_create(XenBus *xenbus, const char *type,
|
||||
const char *name, QDict *opts, Error **errp);
|
||||
|
||||
@@ -66,7 +66,8 @@ struct XenBus {
|
||||
domid_t backend_id;
|
||||
struct xs_handle *xsh;
|
||||
XenWatchList *watch_list;
|
||||
XenWatch *backend_watch;
|
||||
unsigned int backend_types;
|
||||
XenWatch **backend_watch;
|
||||
QLIST_HEAD(, XenDevice) inactive_devices;
|
||||
};
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#define TYPE_XENBACKEND "xen-backend"
|
||||
|
||||
typedef struct XenLegacyDevice XenLegacyDevice;
|
||||
DECLARE_INSTANCE_CHECKER(XenLegacyDevice, XENBACKEND_DEVICE,
|
||||
DECLARE_INSTANCE_CHECKER(XenLegacyDevice, XENBACKEND,
|
||||
TYPE_XENBACKEND)
|
||||
|
||||
/* variables */
|
||||
|
||||
@@ -158,6 +158,18 @@ int qemu_strtosz_metric(const char *nptr, const char **end, uint64_t *result);
|
||||
|
||||
char *size_to_str(uint64_t val);
|
||||
|
||||
/**
|
||||
* freq_to_str:
|
||||
* @freq_hz: frequency to stringify
|
||||
*
|
||||
* Return human readable string for frequency @freq_hz.
|
||||
* Use SI units like KHz, MHz, and so forth.
|
||||
*
|
||||
* The caller is responsible for releasing the value returned
|
||||
* with g_free() after use.
|
||||
*/
|
||||
char *freq_to_str(uint64_t freq_hz);
|
||||
|
||||
/* used to print char* safely */
|
||||
#define STR_OR_NULL(str) ((str) ? (str) : "null")
|
||||
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
/*
|
||||
* Apple Silicon APRR functions for JIT handling
|
||||
*
|
||||
* Copyright (c) 2020 osy
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Credits to: https://siguza.github.io/APRR/
|
||||
* Reversed from /usr/lib/system/libsystem_pthread.dylib
|
||||
*/
|
||||
|
||||
#ifndef TCG_APPLE_JIT_H
|
||||
#define TCG_APPLE_JIT_H
|
||||
|
||||
#if defined(__aarch64__) && defined(CONFIG_DARWIN)
|
||||
|
||||
#define _COMM_PAGE_START_ADDRESS (0x0000000FFFFFC000ULL) /* In TTBR0 */
|
||||
#define _COMM_PAGE_APRR_SUPPORT (_COMM_PAGE_START_ADDRESS + 0x10C)
|
||||
#define _COMM_PAGE_APPR_WRITE_ENABLE (_COMM_PAGE_START_ADDRESS + 0x110)
|
||||
#define _COMM_PAGE_APRR_WRITE_DISABLE (_COMM_PAGE_START_ADDRESS + 0x118)
|
||||
|
||||
static __attribute__((__always_inline__)) bool jit_write_protect_supported(void)
|
||||
{
|
||||
/* Access shared kernel page at fixed memory location. */
|
||||
uint8_t aprr_support = *(volatile uint8_t *)_COMM_PAGE_APRR_SUPPORT;
|
||||
return aprr_support > 0;
|
||||
}
|
||||
|
||||
/* write protect enable = write disable */
|
||||
static __attribute__((__always_inline__)) void jit_write_protect(int enabled)
|
||||
{
|
||||
/* Access shared kernel page at fixed memory location. */
|
||||
uint8_t aprr_support = *(volatile uint8_t *)_COMM_PAGE_APRR_SUPPORT;
|
||||
if (aprr_support == 0 || aprr_support > 3) {
|
||||
return;
|
||||
} else if (aprr_support == 1) {
|
||||
__asm__ __volatile__ (
|
||||
"mov x0, %0\n"
|
||||
"ldr x0, [x0]\n"
|
||||
"msr S3_4_c15_c2_7, x0\n"
|
||||
"isb sy\n"
|
||||
:: "r" (enabled ? _COMM_PAGE_APRR_WRITE_DISABLE
|
||||
: _COMM_PAGE_APPR_WRITE_ENABLE)
|
||||
: "memory", "x0"
|
||||
);
|
||||
} else {
|
||||
__asm__ __volatile__ (
|
||||
"mov x0, %0\n"
|
||||
"ldr x0, [x0]\n"
|
||||
"msr S3_6_c15_c1_5, x0\n"
|
||||
"isb sy\n"
|
||||
:: "r" (enabled ? _COMM_PAGE_APRR_WRITE_DISABLE
|
||||
: _COMM_PAGE_APPR_WRITE_ENABLE)
|
||||
: "memory", "x0"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#else /* defined(__aarch64__) && defined(CONFIG_DARWIN) */
|
||||
|
||||
static __attribute__((__always_inline__)) bool jit_write_protect_supported(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static __attribute__((__always_inline__)) void jit_write_protect(int enabled)
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* define TCG_APPLE_JIT_H */
|
||||
+3
-5
@@ -627,12 +627,10 @@ struct TCGContext {
|
||||
size_t code_gen_buffer_size;
|
||||
void *code_gen_ptr;
|
||||
void *data_gen_ptr;
|
||||
#if defined(CONFIG_IOS_JIT)
|
||||
#if defined(CONFIG_MIRROR_JIT)
|
||||
int code_gen_buffer_fd;
|
||||
ptrdiff_t code_rw_mirror_diff;
|
||||
#endif
|
||||
#if defined(CONFIG_DARWIN) && !defined(CONFIG_TCG_INTERPRETER)
|
||||
bool code_gen_locked; /* on Darwin each thread tracks W^X flags */
|
||||
#endif
|
||||
|
||||
/* Threshold to flush the translated code buffer. */
|
||||
void *code_gen_highwater;
|
||||
@@ -685,7 +683,7 @@ struct TCGContext {
|
||||
|
||||
static inline void *tcg_mirror_ptr_rw(TCGContext *s, const void *rx)
|
||||
{
|
||||
#if defined(CONFIG_IOS_JIT)
|
||||
#if defined(CONFIG_MIRROR_JIT)
|
||||
return (void *)rx + s->code_rw_mirror_diff;
|
||||
#else
|
||||
return (void *)rx;
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
*
|
||||
* 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 or
|
||||
* (at your option) version 3 of the License.
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#ifndef QEMU_SPICE_MODULE_H
|
||||
#define QEMU_SPICE_MODULE_H
|
||||
|
||||
#ifdef CONFIG_SPICE
|
||||
#include <spice.h>
|
||||
#endif
|
||||
|
||||
typedef struct SpiceInfo SpiceInfo;
|
||||
|
||||
struct QemuSpiceOps {
|
||||
void (*init)(void);
|
||||
void (*display_init)(void);
|
||||
int (*migrate_info)(const char *h, int p, int t, const char *s);
|
||||
int (*set_passwd)(const char *passwd,
|
||||
bool fail_if_connected, bool disconnect_if_connected);
|
||||
int (*set_pw_expire)(time_t expires);
|
||||
int (*display_add_client)(int csock, int skipauth, int tls);
|
||||
#ifdef CONFIG_SPICE
|
||||
int (*add_interface)(SpiceBaseInstance *sin);
|
||||
SpiceInfo* (*qmp_query)(Error **errp);
|
||||
#endif
|
||||
};
|
||||
|
||||
extern int using_spice;
|
||||
extern struct QemuSpiceOps qemu_spice;
|
||||
|
||||
#endif
|
||||
+1
-41
@@ -19,24 +19,17 @@
|
||||
#define QEMU_SPICE_H
|
||||
|
||||
#include "qapi/error.h"
|
||||
#include "ui/qemu-spice-module.h"
|
||||
|
||||
#ifdef CONFIG_SPICE
|
||||
|
||||
#include <spice.h>
|
||||
#include "qemu/config-file.h"
|
||||
|
||||
extern int using_spice;
|
||||
|
||||
void qemu_spice_init(void);
|
||||
void qemu_spice_input_init(void);
|
||||
void qemu_spice_display_init(void);
|
||||
int qemu_spice_display_add_client(int csock, int skipauth, int tls);
|
||||
int qemu_spice_add_interface(SpiceBaseInstance *sin);
|
||||
bool qemu_spice_have_display_interface(QemuConsole *con);
|
||||
int qemu_spice_add_display_interface(QXLInstance *qxlin, QemuConsole *con);
|
||||
int qemu_spice_set_passwd(const char *passwd,
|
||||
bool fail_if_connected, bool disconnect_if_connected);
|
||||
int qemu_spice_set_pw_expire(time_t expires);
|
||||
int qemu_spice_migrate_info(const char *hostname, int port, int tls_port,
|
||||
const char *subject);
|
||||
|
||||
@@ -50,40 +43,7 @@ int qemu_spice_migrate_info(const char *hostname, int port, int tls_port,
|
||||
|
||||
#include "qemu/error-report.h"
|
||||
|
||||
#define using_spice 0
|
||||
#define spice_displays 0
|
||||
static inline int qemu_spice_set_passwd(const char *passwd,
|
||||
bool fail_if_connected,
|
||||
bool disconnect_if_connected)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
static inline int qemu_spice_set_pw_expire(time_t expires)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
static inline int qemu_spice_migrate_info(const char *h, int p, int t,
|
||||
const char *s)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
static inline int qemu_spice_display_add_client(int csock, int skipauth,
|
||||
int tls)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
static inline void qemu_spice_display_init(void)
|
||||
{
|
||||
/* This must never be called if CONFIG_SPICE is disabled */
|
||||
error_report("spice support is disabled");
|
||||
abort();
|
||||
}
|
||||
|
||||
static inline void qemu_spice_init(void)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* CONFIG_SPICE */
|
||||
|
||||
|
||||
Loaded 100 of 205 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user