mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge tag 'pull-10.0-for-softfreeze-100325-3' of https://gitlab.com/stsquad/qemu into staging
functional and tcg tests, plugins and MAINTAINERS - update and expand aarch64 GPU tests - fix build dependence for plugins - update libvirt-ci to vulkan-tools - allow plugin tests to run on non-POSIX systems - tweak test/vm times - mark test-vma as linux only - various compiler fixes for tcg tests - add gitlab build unit tracker - error out early on stalled RME tests - compile core plugin code once - update MAINTAINERS # -----BEGIN PGP SIGNATURE----- # # iQEzBAABCgAdFiEEZoWumedRZ7yvyN81+9DbCVqeKkQFAmfOwjcACgkQ+9DbCVqe # KkRkcwgAlRTflCqYlZxdlo4CiOSXaHAFr8yfwWq138LJQRQH530JZnz1lZtxTbEM # pXT7ixnuJQDMybCQJmvUlK5UTUkZhGS3VuAR1VeM2J8/3VXYzf5sFjZ7yko9mA8S # 2FX8vdfbko8/J31+lKccA0tpbHyi2AbMR+mO8xj6KZQoePwmHoRmhgH7p7LE35YO # 8ytaOjMwTKF5fReVK+tlcrVJHFMdGsGNwtsnB2FhhVjI56fQqyM5hGXfOING2Fx3 # iZH3rjzfDB4SWbBqaRsMgH9RXjuB9Eo4v0Qs5ve5SjDyzRJk+/CbbBJ4oRt9hurJ # bA+CYZuNLGBf8Z/mUeYMavA7rxT5rw== # =qobU # -----END PGP SIGNATURE----- # gpg: Signature made Mon 10 Mar 2025 18:43:03 HKT # gpg: using RSA key 6685AE99E75167BCAFC8DF35FBD0DB095A9E2A44 # gpg: Good signature from "Alex Bennée (Master Work Key) <alex.bennee@linaro.org>" [unknown] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 6685 AE99 E751 67BC AFC8 DF35 FBD0 DB09 5A9E 2A44 * tag 'pull-10.0-for-softfreeze-100325-3' of https://gitlab.com/stsquad/qemu: (31 commits) MAINTAINERS: remove widely sanctioned entities plugins/core: make a single build unit plugins/api: build only once plugins/api: split out time control helpers plugins/api: split out the vaddr/hwaddr helpers plugins/api: split out binary path/start/end/entry code plugins/loader: compile loader only once plugins/plugin.h: include queue.h plugins/api: clean-up the includes include/qemu: plugin-memory.h doesn't need cpu-defs.h plugins/loader: populate target_name with target_name() plugins/api: use qemu_target_page_mask() to get value tests/functional: add boot error detection for RME tests gitlab: add a new build_unit job to track build size tests/tcg: Suppress compiler false-positive warning on sha1.c tests/tcg: enable -fwrapv for test-i386-bmi tests/tcg: fix constraints in test-i386-adcox tests/tcg: add message to _Static_assert in test-avx tests/tcg: mark test-vma as a linux-only test tests/vm: bump timeout for shutdown ... Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
Executable
+66
@@ -0,0 +1,66 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# check-units.py: check the number of compilation units and identify
|
||||
# those that are rebuilt multiple times
|
||||
#
|
||||
# Copyright (C) 2025 Linaro Ltd.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
from os import access, R_OK, path
|
||||
from sys import argv, exit
|
||||
import json
|
||||
from collections import Counter
|
||||
|
||||
|
||||
def extract_build_units(cc_path):
|
||||
"""
|
||||
Extract the build units and their counds from compile_commands.json file.
|
||||
|
||||
Returns:
|
||||
Hash table of ["unit"] = count
|
||||
"""
|
||||
|
||||
j = json.load(open(cc_path, 'r'))
|
||||
files = [f['file'] for f in j]
|
||||
build_units = Counter(files)
|
||||
|
||||
return build_units
|
||||
|
||||
|
||||
def analyse_units(build_units):
|
||||
"""
|
||||
Analyse the build units and report stats and the top 10 rebuilds
|
||||
"""
|
||||
|
||||
print(f"Total source files: {len(build_units.keys())}")
|
||||
print(f"Total build units: {sum(units.values())}")
|
||||
|
||||
# Create a sorted list by number of rebuilds
|
||||
sorted_build_units = sorted(build_units.items(),
|
||||
key=lambda item: item[1],
|
||||
reverse=True)
|
||||
|
||||
print("Most rebuilt units:")
|
||||
for unit, count in sorted_build_units[:20]:
|
||||
print(f" {unit} built {count} times")
|
||||
|
||||
print("Least rebuilt units:")
|
||||
for unit, count in sorted_build_units[-10:]:
|
||||
print(f" {unit} built {count} times")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(argv) != 2:
|
||||
script_name = path.basename(argv[0])
|
||||
print(f"Usage: {script_name} <path_to_compile_commands.json>")
|
||||
exit(1)
|
||||
|
||||
cc_path = argv[1]
|
||||
if path.isfile(cc_path) and access(cc_path, R_OK):
|
||||
units = extract_build_units(cc_path)
|
||||
analyse_units(units)
|
||||
exit(0)
|
||||
else:
|
||||
print(f"{cc_path} doesn't exist or isn't readable")
|
||||
exit(1)
|
||||
@@ -11,6 +11,6 @@ MAKE='/usr/local/bin/gmake'
|
||||
NINJA='/usr/local/bin/ninja'
|
||||
PACKAGING_COMMAND='pkg'
|
||||
PIP3='/usr/local/bin/pip'
|
||||
PKGS='alsa-lib bash bison bzip2 ca_root_nss capstone4 ccache4 cmocka ctags curl cyrus-sasl dbus diffutils dtc flex fusefs-libs3 gettext git glib gmake gnutls gsed gtk-vnc gtk3 json-c libepoxy libffi libgcrypt libjpeg-turbo libnfs libslirp libspice-server libssh libtasn1 llvm lzo2 meson mtools ncurses nettle ninja opencv pixman pkgconf png py311-numpy py311-pillow py311-pip py311-pyyaml py311-sphinx py311-sphinx_rtd_theme py311-tomli python3 rpm2cpio rust rust-bindgen-cli sdl2 sdl2_image snappy sndio socat spice-protocol tesseract usbredir virglrenderer vte3 xorriso zstd'
|
||||
PKGS='alsa-lib bash bison bzip2 ca_root_nss capstone4 ccache4 cmocka ctags curl cyrus-sasl dbus diffutils dtc flex fusefs-libs3 gettext git glib gmake gnutls gsed gtk-vnc gtk3 json-c libepoxy libffi libgcrypt libjpeg-turbo libnfs libslirp libspice-server libssh libtasn1 llvm lzo2 meson mtools ncurses nettle ninja opencv pixman pkgconf png py311-numpy py311-pillow py311-pip py311-pyyaml py311-sphinx py311-sphinx_rtd_theme py311-tomli python3 rpm2cpio rust rust-bindgen-cli sdl2 sdl2_image snappy sndio socat spice-protocol tesseract usbredir virglrenderer vte3 vulkan-tools xorriso zstd'
|
||||
PYPI_PKGS=''
|
||||
PYTHON='/usr/local/bin/python3'
|
||||
|
||||
@@ -11,6 +11,6 @@ MAKE='/opt/homebrew/bin/gmake'
|
||||
NINJA='/opt/homebrew/bin/ninja'
|
||||
PACKAGING_COMMAND='brew'
|
||||
PIP3='/opt/homebrew/bin/pip3'
|
||||
PKGS='bash bc bindgen bison bzip2 capstone ccache cmocka ctags curl dbus diffutils dtc flex gcovr gettext git glib gnu-sed gnutls gtk+3 gtk-vnc jemalloc jpeg-turbo json-c libcbor libepoxy libffi libgcrypt libiscsi libnfs libpng libslirp libssh libtasn1 libusb llvm lzo make meson mtools ncurses nettle ninja pixman pkg-config python3 rpm2cpio rust sdl2 sdl2_image snappy socat sparse spice-protocol swtpm tesseract usbredir vde vte3 xorriso zlib zstd'
|
||||
PKGS='bash bc bindgen bison bzip2 capstone ccache cmocka ctags curl dbus diffutils dtc flex gcovr gettext git glib gnu-sed gnutls gtk+3 gtk-vnc jemalloc jpeg-turbo json-c libcbor libepoxy libffi libgcrypt libiscsi libnfs libpng libslirp libssh libtasn1 libusb llvm lzo make meson mtools ncurses nettle ninja pixman pkg-config python3 rpm2cpio rust sdl2 sdl2_image snappy socat sparse spice-protocol swtpm tesseract usbredir vde vte3 vulkan-tools xorriso zlib zstd'
|
||||
PYPI_PKGS='PyYAML numpy pillow sphinx sphinx-rtd-theme tomli'
|
||||
PYTHON='/opt/homebrew/bin/python3'
|
||||
|
||||
@@ -70,3 +70,25 @@ check-rust-tools-nightly:
|
||||
expire_in: 2 days
|
||||
paths:
|
||||
- rust/target/doc
|
||||
|
||||
check-build-units:
|
||||
extends: .base_job_template
|
||||
stage: build
|
||||
image: $CI_REGISTRY_IMAGE/qemu/debian:$QEMU_CI_CONTAINER_TAG
|
||||
needs:
|
||||
job: amd64-debian-container
|
||||
before_script:
|
||||
- source scripts/ci/gitlab-ci-section
|
||||
- section_start setup "Install Tools"
|
||||
- apt install --assume-yes --no-install-recommends jq
|
||||
- section_end setup
|
||||
script:
|
||||
- mkdir build
|
||||
- cd build
|
||||
- section_start configure "Running configure"
|
||||
- ../configure
|
||||
- cd ..
|
||||
- section_end configure
|
||||
- section_start analyse "Analyse"
|
||||
- .gitlab-ci.d/check-units.py build/compile_commands.json
|
||||
- section_end analyse
|
||||
|
||||
+4
-4
@@ -2547,8 +2547,7 @@ F: hw/i2c/i2c_mux_pca954x.c
|
||||
F: include/hw/i2c/i2c_mux_pca954x.h
|
||||
|
||||
pcf8574
|
||||
M: Dmitrii Sharikhin <d.sharikhin@yadro.com>
|
||||
S: Maintained
|
||||
S: Orphaned
|
||||
F: hw/gpio/pcf8574.c
|
||||
F: include/gpio/pcf8574.h
|
||||
|
||||
@@ -2631,6 +2630,7 @@ F: hw/display/virtio-gpu*
|
||||
F: hw/display/virtio-vga.*
|
||||
F: include/hw/virtio/virtio-gpu.h
|
||||
F: docs/system/devices/virtio-gpu.rst
|
||||
F: tests/functional/test_aarch64_virt_gpu.py
|
||||
|
||||
vhost-user-blk
|
||||
M: Raphael Norwitz <raphael@enfabrica.net>
|
||||
@@ -3659,10 +3659,10 @@ F: net/filter-mirror.c
|
||||
F: tests/qtest/test-filter*
|
||||
|
||||
Record/replay
|
||||
M: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
|
||||
R: Paolo Bonzini <pbonzini@redhat.com>
|
||||
R: Alex Bennée <alex.bennee@linaro.org>
|
||||
W: https://wiki.qemu.org/Features/record-replay
|
||||
S: Supported
|
||||
S: Odd Fixes
|
||||
F: replay/*
|
||||
F: block/blkreplay.c
|
||||
F: net/filter-replay.c
|
||||
|
||||
@@ -13,6 +13,7 @@ bsd_user_ss.add(files(
|
||||
'elfload.c',
|
||||
'main.c',
|
||||
'mmap.c',
|
||||
'plugin-api.c',
|
||||
'signal.c',
|
||||
'strace.c',
|
||||
'uaccess.c',
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* QEMU Plugin API - bsd-user-mode only implementations
|
||||
*
|
||||
* Common user-mode only APIs are in plugins/api-user. These helpers
|
||||
* are only specific to bsd-user.
|
||||
*
|
||||
* Copyright (C) 2017, Emilio G. Cota <cota@braap.org>
|
||||
* Copyright (C) 2019-2025, Linaro
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu.h"
|
||||
#include "common-user/plugin-api.c.inc"
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* QEMU Plugin API - *-user-mode only implementations
|
||||
*
|
||||
* Common user-mode only APIs are in plugins/api-user. These helpers
|
||||
* are only specific to the *-user frontends.
|
||||
*
|
||||
* Copyright (C) 2017, Emilio G. Cota <cota@braap.org>
|
||||
* Copyright (C) 2019-2025, Linaro
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/main-loop.h"
|
||||
#include "qemu/plugin.h"
|
||||
#include "qemu.h"
|
||||
|
||||
/*
|
||||
* Binary path, start and end locations. Host specific due to TaskState.
|
||||
*/
|
||||
const char *qemu_plugin_path_to_binary(void)
|
||||
{
|
||||
TaskState *ts = get_task_state(current_cpu);
|
||||
return g_strdup(ts->bprm->filename);
|
||||
}
|
||||
|
||||
uint64_t qemu_plugin_start_code(void)
|
||||
{
|
||||
TaskState *ts = get_task_state(current_cpu);
|
||||
return ts->info->start_code;
|
||||
}
|
||||
|
||||
uint64_t qemu_plugin_end_code(void)
|
||||
{
|
||||
TaskState *ts = get_task_state(current_cpu);
|
||||
return ts->info->end_code;
|
||||
}
|
||||
|
||||
uint64_t qemu_plugin_entry_code(void)
|
||||
{
|
||||
TaskState *ts = get_task_state(current_cpu);
|
||||
return ts->info->entry;
|
||||
}
|
||||
@@ -26,3 +26,5 @@ if t.length() > 0
|
||||
else
|
||||
run_target('contrib-plugins', command: find_program('true'))
|
||||
endif
|
||||
|
||||
plugin_modules += t
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#ifndef PLUGIN_MEMORY_H
|
||||
#define PLUGIN_MEMORY_H
|
||||
|
||||
#include "exec/cpu-defs.h"
|
||||
#include "exec/hwaddr.h"
|
||||
|
||||
struct qemu_plugin_hwaddr {
|
||||
|
||||
@@ -27,6 +27,7 @@ linux_user_ss.add(libdw)
|
||||
linux_user_ss.add(when: 'TARGET_HAS_BFLT', if_true: files('flatload.c'))
|
||||
linux_user_ss.add(when: 'TARGET_I386', if_true: files('vm86.c'))
|
||||
linux_user_ss.add(when: 'CONFIG_ARM_COMPATIBLE_SEMIHOSTING', if_true: files('semihost.c'))
|
||||
linux_user_ss.add(when: 'CONFIG_TCG_PLUGINS', if_true: files('plugin-api.c'))
|
||||
|
||||
syscall_nr_generators = {}
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* QEMU Plugin API - linux-user-mode only implementations
|
||||
*
|
||||
* Common user-mode only APIs are in plugins/api-user. These helpers
|
||||
* are only specific to linux-user.
|
||||
*
|
||||
* Copyright (C) 2017, Emilio G. Cota <cota@braap.org>
|
||||
* Copyright (C) 2019-2025, Linaro
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu.h"
|
||||
#include "common-user/plugin-api.c.inc"
|
||||
@@ -3668,6 +3668,7 @@ qtest_module_ss = ss.source_set()
|
||||
|
||||
modules = {}
|
||||
target_modules = {}
|
||||
plugin_modules = []
|
||||
hw_arch = {}
|
||||
target_arch = {}
|
||||
target_system_arch = {}
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
* QEMU Plugin API - System specific implementations
|
||||
*
|
||||
* This provides the APIs that have a specific system implementation
|
||||
* or are only relevant to system-mode.
|
||||
*
|
||||
* Copyright (C) 2017, Emilio G. Cota <cota@braap.org>
|
||||
* Copyright (C) 2019-2025, Linaro
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/main-loop.h"
|
||||
#include "qapi/error.h"
|
||||
#include "migration/blocker.h"
|
||||
#include "hw/boards.h"
|
||||
#include "qemu/plugin-memory.h"
|
||||
#include "qemu/plugin.h"
|
||||
|
||||
/*
|
||||
* In system mode we cannot trace the binary being executed so the
|
||||
* helpers all return NULL/0.
|
||||
*/
|
||||
const char *qemu_plugin_path_to_binary(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
uint64_t qemu_plugin_start_code(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint64_t qemu_plugin_end_code(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint64_t qemu_plugin_entry_code(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Virtual Memory queries
|
||||
*/
|
||||
|
||||
static __thread struct qemu_plugin_hwaddr hwaddr_info;
|
||||
|
||||
struct qemu_plugin_hwaddr *qemu_plugin_get_hwaddr(qemu_plugin_meminfo_t info,
|
||||
uint64_t vaddr)
|
||||
{
|
||||
CPUState *cpu = current_cpu;
|
||||
unsigned int mmu_idx = get_mmuidx(info);
|
||||
enum qemu_plugin_mem_rw rw = get_plugin_meminfo_rw(info);
|
||||
hwaddr_info.is_store = (rw & QEMU_PLUGIN_MEM_W) != 0;
|
||||
|
||||
assert(mmu_idx < NB_MMU_MODES);
|
||||
|
||||
if (!tlb_plugin_lookup(cpu, vaddr, mmu_idx,
|
||||
hwaddr_info.is_store, &hwaddr_info)) {
|
||||
error_report("invalid use of qemu_plugin_get_hwaddr");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return &hwaddr_info;
|
||||
}
|
||||
|
||||
bool qemu_plugin_hwaddr_is_io(const struct qemu_plugin_hwaddr *haddr)
|
||||
{
|
||||
return haddr->is_io;
|
||||
}
|
||||
|
||||
uint64_t qemu_plugin_hwaddr_phys_addr(const struct qemu_plugin_hwaddr *haddr)
|
||||
{
|
||||
if (haddr) {
|
||||
return haddr->phys_addr;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *qemu_plugin_hwaddr_device_name(const struct qemu_plugin_hwaddr *h)
|
||||
{
|
||||
if (h && h->is_io) {
|
||||
MemoryRegion *mr = h->mr;
|
||||
if (!mr->name) {
|
||||
unsigned maddr = (uintptr_t)mr;
|
||||
g_autofree char *temp = g_strdup_printf("anon%08x", maddr);
|
||||
return g_intern_string(temp);
|
||||
} else {
|
||||
return g_intern_string(mr->name);
|
||||
}
|
||||
} else {
|
||||
return g_intern_static_string("RAM");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Time control
|
||||
*/
|
||||
static bool has_control;
|
||||
static Error *migration_blocker;
|
||||
|
||||
const void *qemu_plugin_request_time_control(void)
|
||||
{
|
||||
if (!has_control) {
|
||||
has_control = true;
|
||||
error_setg(&migration_blocker,
|
||||
"TCG plugin time control does not support migration");
|
||||
migrate_add_blocker(&migration_blocker, NULL);
|
||||
return &has_control;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void advance_virtual_time__async(CPUState *cpu, run_on_cpu_data data)
|
||||
{
|
||||
int64_t new_time = data.host_ulong;
|
||||
qemu_clock_advance_virtual_time(new_time);
|
||||
}
|
||||
|
||||
void qemu_plugin_update_ns(const void *handle, int64_t new_time)
|
||||
{
|
||||
if (handle == &has_control) {
|
||||
/* Need to execute out of cpu_exec, so bql can be locked. */
|
||||
async_run_on_cpu(current_cpu,
|
||||
advance_virtual_time__async,
|
||||
RUN_ON_CPU_HOST_ULONG(new_time));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* QEMU Plugin API - user-mode only implementations
|
||||
*
|
||||
* This provides the APIs that have a user-mode specific
|
||||
* implementations or are only relevant to user-mode.
|
||||
*
|
||||
* Copyright (C) 2017, Emilio G. Cota <cota@braap.org>
|
||||
* Copyright (C) 2019-2025, Linaro
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/plugin.h"
|
||||
#include "exec/log.h"
|
||||
|
||||
/*
|
||||
* Virtual Memory queries - these are all NOPs for user-mode which
|
||||
* only ever has visibility of virtual addresses.
|
||||
*/
|
||||
|
||||
struct qemu_plugin_hwaddr *qemu_plugin_get_hwaddr(qemu_plugin_meminfo_t info,
|
||||
uint64_t vaddr)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool qemu_plugin_hwaddr_is_io(const struct qemu_plugin_hwaddr *haddr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint64_t qemu_plugin_hwaddr_phys_addr(const struct qemu_plugin_hwaddr *haddr)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *qemu_plugin_hwaddr_device_name(const struct qemu_plugin_hwaddr *h)
|
||||
{
|
||||
return g_intern_static_string("Invalid");
|
||||
}
|
||||
|
||||
/*
|
||||
* Time control - for user mode the only real time is wall clock time
|
||||
* so realistically all you can do in user mode is slow down execution
|
||||
* which doesn't require the ability to mess with the clock.
|
||||
*/
|
||||
|
||||
const void *qemu_plugin_request_time_control(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void qemu_plugin_update_ns(const void *handle, int64_t new_time)
|
||||
{
|
||||
qemu_log_mask(LOG_UNIMP, "user-mode can't control time");
|
||||
}
|
||||
+2
-169
@@ -39,26 +39,13 @@
|
||||
#include "qemu/main-loop.h"
|
||||
#include "qemu/plugin.h"
|
||||
#include "qemu/log.h"
|
||||
#include "qemu/timer.h"
|
||||
#include "tcg/tcg.h"
|
||||
#include "exec/exec-all.h"
|
||||
#include "exec/gdbstub.h"
|
||||
#include "exec/target_page.h"
|
||||
#include "exec/translation-block.h"
|
||||
#include "exec/translator.h"
|
||||
#include "disas/disas.h"
|
||||
#include "plugin.h"
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
#include "qapi/error.h"
|
||||
#include "migration/blocker.h"
|
||||
#include "exec/ram_addr.h"
|
||||
#include "qemu/plugin-memory.h"
|
||||
#include "hw/boards.h"
|
||||
#else
|
||||
#include "qemu.h"
|
||||
#ifdef CONFIG_LINUX
|
||||
#include "loader.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Uninstall and Reset handlers */
|
||||
|
||||
@@ -287,7 +274,7 @@ uint64_t qemu_plugin_insn_vaddr(const struct qemu_plugin_insn *insn)
|
||||
void *qemu_plugin_insn_haddr(const struct qemu_plugin_insn *insn)
|
||||
{
|
||||
const DisasContextBase *db = tcg_ctx->plugin_db;
|
||||
vaddr page0_last = db->pc_first | ~TARGET_PAGE_MASK;
|
||||
vaddr page0_last = db->pc_first | ~qemu_target_page_mask();
|
||||
|
||||
if (db->fake_insn) {
|
||||
return NULL;
|
||||
@@ -385,76 +372,6 @@ qemu_plugin_mem_value qemu_plugin_mem_get_value(qemu_plugin_meminfo_t info)
|
||||
return value;
|
||||
}
|
||||
|
||||
/*
|
||||
* Virtual Memory queries
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_SOFTMMU
|
||||
static __thread struct qemu_plugin_hwaddr hwaddr_info;
|
||||
#endif
|
||||
|
||||
struct qemu_plugin_hwaddr *qemu_plugin_get_hwaddr(qemu_plugin_meminfo_t info,
|
||||
uint64_t vaddr)
|
||||
{
|
||||
#ifdef CONFIG_SOFTMMU
|
||||
CPUState *cpu = current_cpu;
|
||||
unsigned int mmu_idx = get_mmuidx(info);
|
||||
enum qemu_plugin_mem_rw rw = get_plugin_meminfo_rw(info);
|
||||
hwaddr_info.is_store = (rw & QEMU_PLUGIN_MEM_W) != 0;
|
||||
|
||||
assert(mmu_idx < NB_MMU_MODES);
|
||||
|
||||
if (!tlb_plugin_lookup(cpu, vaddr, mmu_idx,
|
||||
hwaddr_info.is_store, &hwaddr_info)) {
|
||||
error_report("invalid use of qemu_plugin_get_hwaddr");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return &hwaddr_info;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool qemu_plugin_hwaddr_is_io(const struct qemu_plugin_hwaddr *haddr)
|
||||
{
|
||||
#ifdef CONFIG_SOFTMMU
|
||||
return haddr->is_io;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
uint64_t qemu_plugin_hwaddr_phys_addr(const struct qemu_plugin_hwaddr *haddr)
|
||||
{
|
||||
#ifdef CONFIG_SOFTMMU
|
||||
if (haddr) {
|
||||
return haddr->phys_addr;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *qemu_plugin_hwaddr_device_name(const struct qemu_plugin_hwaddr *h)
|
||||
{
|
||||
#ifdef CONFIG_SOFTMMU
|
||||
if (h && h->is_io) {
|
||||
MemoryRegion *mr = h->mr;
|
||||
if (!mr->name) {
|
||||
unsigned maddr = (uintptr_t)mr;
|
||||
g_autofree char *temp = g_strdup_printf("anon%08x", maddr);
|
||||
return g_intern_string(temp);
|
||||
} else {
|
||||
return g_intern_string(mr->name);
|
||||
}
|
||||
} else {
|
||||
return g_intern_static_string("RAM");
|
||||
}
|
||||
#else
|
||||
return g_intern_static_string("Invalid");
|
||||
#endif
|
||||
}
|
||||
|
||||
int qemu_plugin_num_vcpus(void)
|
||||
{
|
||||
return plugin_num_vcpus();
|
||||
@@ -473,49 +390,6 @@ bool qemu_plugin_bool_parse(const char *name, const char *value, bool *ret)
|
||||
return name && value && qapi_bool_parse(name, value, ret, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Binary path, start and end locations
|
||||
*/
|
||||
const char *qemu_plugin_path_to_binary(void)
|
||||
{
|
||||
char *path = NULL;
|
||||
#ifdef CONFIG_USER_ONLY
|
||||
TaskState *ts = get_task_state(current_cpu);
|
||||
path = g_strdup(ts->bprm->filename);
|
||||
#endif
|
||||
return path;
|
||||
}
|
||||
|
||||
uint64_t qemu_plugin_start_code(void)
|
||||
{
|
||||
uint64_t start = 0;
|
||||
#ifdef CONFIG_USER_ONLY
|
||||
TaskState *ts = get_task_state(current_cpu);
|
||||
start = ts->info->start_code;
|
||||
#endif
|
||||
return start;
|
||||
}
|
||||
|
||||
uint64_t qemu_plugin_end_code(void)
|
||||
{
|
||||
uint64_t end = 0;
|
||||
#ifdef CONFIG_USER_ONLY
|
||||
TaskState *ts = get_task_state(current_cpu);
|
||||
end = ts->info->end_code;
|
||||
#endif
|
||||
return end;
|
||||
}
|
||||
|
||||
uint64_t qemu_plugin_entry_code(void)
|
||||
{
|
||||
uint64_t entry = 0;
|
||||
#ifdef CONFIG_USER_ONLY
|
||||
TaskState *ts = get_task_state(current_cpu);
|
||||
entry = ts->info->entry;
|
||||
#endif
|
||||
return entry;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create register handles.
|
||||
*
|
||||
@@ -641,44 +515,3 @@ uint64_t qemu_plugin_u64_sum(qemu_plugin_u64 entry)
|
||||
return total;
|
||||
}
|
||||
|
||||
/*
|
||||
* Time control
|
||||
*/
|
||||
static bool has_control;
|
||||
#ifdef CONFIG_SOFTMMU
|
||||
static Error *migration_blocker;
|
||||
#endif
|
||||
|
||||
const void *qemu_plugin_request_time_control(void)
|
||||
{
|
||||
if (!has_control) {
|
||||
has_control = true;
|
||||
#ifdef CONFIG_SOFTMMU
|
||||
error_setg(&migration_blocker,
|
||||
"TCG plugin time control does not support migration");
|
||||
migrate_add_blocker(&migration_blocker, NULL);
|
||||
#endif
|
||||
return &has_control;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SOFTMMU
|
||||
static void advance_virtual_time__async(CPUState *cpu, run_on_cpu_data data)
|
||||
{
|
||||
int64_t new_time = data.host_ulong;
|
||||
qemu_clock_advance_virtual_time(new_time);
|
||||
}
|
||||
#endif
|
||||
|
||||
void qemu_plugin_update_ns(const void *handle, int64_t new_time)
|
||||
{
|
||||
#ifdef CONFIG_SOFTMMU
|
||||
if (handle == &has_control) {
|
||||
/* Need to execute out of cpu_exec, so bql can be locked. */
|
||||
async_run_on_cpu(current_cpu,
|
||||
advance_virtual_time__async,
|
||||
RUN_ON_CPU_HOST_ULONG(new_time));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
+1
-9
@@ -12,22 +12,14 @@
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/config-file.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qemu/lockable.h"
|
||||
#include "qemu/option.h"
|
||||
#include "qemu/plugin.h"
|
||||
#include "qemu/queue.h"
|
||||
#include "qemu/rcu_queue.h"
|
||||
#include "qemu/xxhash.h"
|
||||
#include "qemu/rcu.h"
|
||||
#include "hw/core/cpu.h"
|
||||
|
||||
#include "exec/exec-all.h"
|
||||
#include "exec/tb-flush.h"
|
||||
#include "tcg/tcg.h"
|
||||
#include "tcg/tcg-op.h"
|
||||
#include "tcg/tcg-op-common.h"
|
||||
#include "plugin.h"
|
||||
|
||||
struct qemu_plugin_cb {
|
||||
|
||||
+3
-12
@@ -31,9 +31,6 @@
|
||||
#include "qemu/memalign.h"
|
||||
#include "hw/core/cpu.h"
|
||||
#include "exec/tb-flush.h"
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
#include "hw/boards.h"
|
||||
#endif
|
||||
|
||||
#include "plugin.h"
|
||||
|
||||
@@ -297,17 +294,11 @@ int qemu_plugin_load_list(QemuPluginList *head, Error **errp)
|
||||
struct qemu_plugin_desc *desc, *next;
|
||||
g_autofree qemu_info_t *info = g_new0(qemu_info_t, 1);
|
||||
|
||||
info->target_name = TARGET_NAME;
|
||||
info->target_name = target_name();
|
||||
info->version.min = QEMU_PLUGIN_MIN_VERSION;
|
||||
info->version.cur = QEMU_PLUGIN_VERSION;
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
MachineState *ms = MACHINE(qdev_get_machine());
|
||||
info->system_emulation = true;
|
||||
info->system.smp_vcpus = ms->smp.cpus;
|
||||
info->system.max_vcpus = ms->smp.max_cpus;
|
||||
#else
|
||||
info->system_emulation = false;
|
||||
#endif
|
||||
|
||||
qemu_plugin_fillin_mode_info(info);
|
||||
|
||||
QTAILQ_FOREACH_SAFE(desc, head, entry, next) {
|
||||
int err;
|
||||
|
||||
+6
-5
@@ -57,8 +57,9 @@ if host_os == 'windows'
|
||||
command: dlltool_cmd
|
||||
)
|
||||
endif
|
||||
specific_ss.add(files(
|
||||
'loader.c',
|
||||
'core.c',
|
||||
'api.c',
|
||||
))
|
||||
|
||||
user_ss.add(files('user.c', 'api-user.c'))
|
||||
system_ss.add(files('system.c', 'api-system.c'))
|
||||
|
||||
common_ss.add(files('loader.c', 'api.c', 'core.c'))
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#define PLUGIN_H
|
||||
|
||||
#include <gmodule.h>
|
||||
#include "qemu/queue.h"
|
||||
#include "qemu/qht.h"
|
||||
|
||||
#define QEMU_PLUGIN_MIN_VERSION 2
|
||||
@@ -118,4 +119,10 @@ struct qemu_plugin_scoreboard *plugin_scoreboard_new(size_t element_size);
|
||||
|
||||
void plugin_scoreboard_free(struct qemu_plugin_scoreboard *score);
|
||||
|
||||
/**
|
||||
* qemu_plugin_fillin_mode_info() - populate mode specific info
|
||||
* info: pointer to qemu_info_t structure
|
||||
*/
|
||||
void qemu_plugin_fillin_mode_info(qemu_info_t *info);
|
||||
|
||||
#endif /* PLUGIN_H */
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user