mirror of
https://github.com/utmapp/qemu.git
synced 2026-12-05 22:12:18 -10:00
Compare commits
71
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
698104725e | ||
|
|
bb7fc1543f | ||
|
|
8208694e56 | ||
|
|
00829ae384 | ||
|
|
7154e4df40 | ||
|
|
d7e1df7699 | ||
|
|
dfe87815ba | ||
|
|
e37a0d514a | ||
|
|
2f5c96d534 | ||
|
|
6472244e1b | ||
|
|
a69964ff96 | ||
|
|
307bc43095 | ||
|
|
b002acacc1 | ||
|
|
ab0065e36a | ||
|
|
9c23f2a7b0 | ||
|
|
bf0e7b068b | ||
|
|
efd6b3d176 | ||
|
|
0d42e48c73 | ||
|
|
326e620fc0 | ||
|
|
e742b7bdc2 | ||
|
|
4fdff25625 | ||
|
|
0bc6fa2446 | ||
|
|
46228925ed | ||
|
|
8062bfd517 | ||
|
|
93332c90bf | ||
|
|
df3b304605 | ||
|
|
17313df879 | ||
|
|
dd77ef99aa | ||
|
|
d100193724 | ||
|
|
2a425aae0b | ||
|
|
c22e943ea1 | ||
|
|
2257f52a97 | ||
|
|
47b6038187 | ||
|
|
704db3e250 | ||
|
|
fa2580f574 | ||
|
|
81c5a3f867 | ||
|
|
ee6a482e9c | ||
|
|
23a5e2584e | ||
|
|
6f365f185a | ||
|
|
0b50ff0c0a | ||
|
|
2addcefd69 | ||
|
|
7cffc86162 | ||
|
|
a55d610bac | ||
|
|
7242e51517 | ||
|
|
7e71b8e7f2 | ||
|
|
56a4ba5f88 | ||
|
|
ca49625616 | ||
|
|
ff633bc5d5 | ||
|
|
6833615bfd | ||
|
|
8c00f56fca | ||
|
|
93fa829344 | ||
|
|
92cf74baf4 | ||
|
|
41706d3e72 | ||
|
|
864814f71b | ||
|
|
2c3165a1a6 | ||
|
|
1053bb627c | ||
|
|
23c586abf2 | ||
|
|
0df8baec95 | ||
|
|
7b884e2a27 | ||
|
|
356c7b1752 | ||
|
|
a8731f691d | ||
|
|
1f3b34e403 | ||
|
|
05f36f7c05 | ||
|
|
423ac96729 | ||
|
|
13432ee4c6 | ||
|
|
88be119fb1 | ||
|
|
c1116b1d73 | ||
|
|
3bee93b9ab | ||
|
|
66ec38b6fa | ||
|
|
ebb625262c | ||
|
|
7248dab3c9 |
No files matched your search
@@ -656,14 +656,12 @@ build-tci:
|
||||
--target-list="$(for tg in $TARGETS; do echo -n ${tg}'-softmmu '; done)"
|
||||
|| { cat config.log meson-logs/meson-log.txt && exit 1; }
|
||||
- make -j"$JOBS"
|
||||
- make tests/qtest/boot-serial-test tests/qtest/cdrom-test tests/qtest/pxe-test
|
||||
- make tests/qtest/boot-serial-test tests/qtest/cdrom-test
|
||||
- for tg in $TARGETS ; do
|
||||
export QTEST_QEMU_BINARY="./qemu-system-${tg}" ;
|
||||
./tests/qtest/boot-serial-test || exit 1 ;
|
||||
./tests/qtest/cdrom-test || exit 1 ;
|
||||
done
|
||||
- QTEST_QEMU_BINARY="./qemu-system-x86_64" ./tests/qtest/pxe-test
|
||||
- QTEST_QEMU_BINARY="./qemu-system-s390x" ./tests/qtest/pxe-test -m slow
|
||||
- make check-tcg
|
||||
|
||||
# Check our reduced build configurations
|
||||
|
||||
@@ -37,7 +37,7 @@ x64-freebsd-14-build:
|
||||
NAME: freebsd-14
|
||||
CIRRUS_VM_INSTANCE_TYPE: freebsd_instance
|
||||
CIRRUS_VM_IMAGE_SELECTOR: image_family
|
||||
CIRRUS_VM_IMAGE_NAME: freebsd-14-2
|
||||
CIRRUS_VM_IMAGE_NAME: freebsd-14-3
|
||||
CIRRUS_VM_CPUS: 8
|
||||
CIRRUS_VM_RAM: 8G
|
||||
UPDATE_COMMAND: pkg update; pkg upgrade -y
|
||||
|
||||
@@ -41,9 +41,7 @@
|
||||
ubuntu-24.04-aarch64-all-linux-static:
|
||||
extends: .ubuntu_aarch64_template
|
||||
variables:
|
||||
# Disable -static-pie due to build error with system libc:
|
||||
# https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1987438
|
||||
CONFIGURE_ARGS: --enable-debug --static --disable-system --disable-pie
|
||||
CONFIGURE_ARGS: --enable-debug --static --disable-system
|
||||
MAKE_CHECK_ARGS: check-tcg
|
||||
|
||||
ubuntu-24.04-aarch64-all:
|
||||
|
||||
+4
-3
@@ -4444,12 +4444,13 @@ R: Philippe Mathieu-Daudé <[email protected]>
|
||||
S: Maintained
|
||||
F: tests/tcg/Makefile.target
|
||||
|
||||
GitLab custom runner (Works On Arm Sponsored)
|
||||
GitLab custom runners (HW sponsored by Linaro, OSOUL and IBM)
|
||||
M: Alex Bennée <[email protected]>
|
||||
M: Philippe Mathieu-Daudé <[email protected]>
|
||||
S: Maintained
|
||||
F: .gitlab-ci.d/custom-runners/ubuntu-22.04-aarch64.yml
|
||||
F: .gitlab-ci.d/custom-runners/ubuntu-22.04-aarch32.yml
|
||||
F: .gitlab-ci.d/custom-runners/ubuntu-24.04-aarch64.yml
|
||||
F: .gitlab-ci.d/custom-runners/ubuntu-24.04-s390x.yml
|
||||
F: .gitlab-ci.d/custom-runners/debian-13-ppc64le.yml
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
@@ -148,10 +148,11 @@ static int hvf_init_vcpu(CPUState *cpu)
|
||||
sigact.sa_handler = dummy_signal;
|
||||
sigaction(SIG_IPI, &sigact, NULL);
|
||||
|
||||
#ifdef __aarch64__
|
||||
pthread_sigmask(SIG_BLOCK, NULL, &cpu->accel->unblock_ipi_mask);
|
||||
sigdelset(&cpu->accel->unblock_ipi_mask, SIG_IPI);
|
||||
cpu->accel->guest_debug_enabled = false;
|
||||
|
||||
#ifdef __aarch64__
|
||||
r = hv_vcpu_create(&cpu->accel->fd,
|
||||
(hv_vcpu_exit_t **)&cpu->accel->exit, NULL);
|
||||
#else
|
||||
@@ -160,8 +161,6 @@ static int hvf_init_vcpu(CPUState *cpu)
|
||||
assert_hvf_ok(r);
|
||||
cpu->vcpu_dirty = true;
|
||||
|
||||
cpu->accel->guest_debug_enabled = false;
|
||||
|
||||
return hvf_arch_init_vcpu(cpu);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -3373,10 +3373,10 @@ int kvm_vm_ioctl(KVMState *s, unsigned long type, ...)
|
||||
trace_kvm_vm_ioctl(type, arg);
|
||||
accel_ioctl_begin();
|
||||
ret = ioctl(s->vmfd, type, arg);
|
||||
accel_ioctl_end();
|
||||
if (ret == -1) {
|
||||
ret = -errno;
|
||||
}
|
||||
accel_ioctl_end();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -3413,10 +3413,10 @@ int kvm_device_ioctl(int fd, unsigned long type, ...)
|
||||
trace_kvm_device_ioctl(fd, type, arg);
|
||||
accel_ioctl_begin();
|
||||
ret = ioctl(fd, type, arg);
|
||||
accel_ioctl_end();
|
||||
if (ret == -1) {
|
||||
ret = -errno;
|
||||
}
|
||||
accel_ioctl_end();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -211,7 +211,7 @@ static size_t tpm_passthrough_get_buffer_size(TPMBackend *tb)
|
||||
static int tpm_passthrough_open_sysfs_cancel(TPMPassthruState *tpm_pt)
|
||||
{
|
||||
int fd = -1;
|
||||
char *dev;
|
||||
const char *dev;
|
||||
char path[PATH_MAX];
|
||||
|
||||
if (tpm_pt->options->cancel_path) {
|
||||
|
||||
+34
-22
@@ -4288,25 +4288,8 @@ hdev_open_Mac_error:
|
||||
static bool coroutine_fn sgio_path_error(int ret, sg_io_hdr_t *io_hdr)
|
||||
{
|
||||
if (ret < 0) {
|
||||
switch (ret) {
|
||||
case -ENODEV:
|
||||
return true;
|
||||
case -EAGAIN:
|
||||
/*
|
||||
* The device is probably suspended. This happens while the dm table
|
||||
* is reloaded, e.g. because a path is added or removed. This is an
|
||||
* operation that should complete within 1ms, so just wait a bit and
|
||||
* retry.
|
||||
*
|
||||
* If the device was suspended for another reason, we'll wait and
|
||||
* retry SG_IO_MAX_RETRIES times. This is a tolerable delay before
|
||||
* we return an error and potentially stop the VM.
|
||||
*/
|
||||
qemu_co_sleep_ns(QEMU_CLOCK_REALTIME, 1000000);
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
/* Path errors sometimes result in -ENODEV */
|
||||
return ret == -ENODEV;
|
||||
}
|
||||
|
||||
if (io_hdr->host_status != SCSI_HOST_OK) {
|
||||
@@ -4375,6 +4358,7 @@ hdev_co_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
|
||||
{
|
||||
BDRVRawState *s = bs->opaque;
|
||||
RawPosixAIOData acb;
|
||||
uint64_t eagain_sleep_ns = 1 * SCALE_MS;
|
||||
int retries = SG_IO_MAX_RETRIES;
|
||||
int ret;
|
||||
|
||||
@@ -4403,9 +4387,37 @@ hdev_co_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
|
||||
},
|
||||
};
|
||||
|
||||
do {
|
||||
ret = raw_thread_pool_submit(handle_aiocb_ioctl, &acb);
|
||||
} while (req == SG_IO && retries-- && hdev_co_ioctl_sgio_retry(&acb, ret));
|
||||
retry:
|
||||
ret = raw_thread_pool_submit(handle_aiocb_ioctl, &acb);
|
||||
if (req == SG_IO && s->use_mpath) {
|
||||
if (ret == -EAGAIN && eagain_sleep_ns < NANOSECONDS_PER_SECOND) {
|
||||
/*
|
||||
* If this is a multipath device, it is probably suspended.
|
||||
*
|
||||
* This can happen while the dm table is reloaded, e.g. because a
|
||||
* path is added or removed. This is an operation that should
|
||||
* complete within 1ms, so just wait a bit and retry.
|
||||
*
|
||||
* There are also some cases in which libmpathpersist must recover
|
||||
* from path failure during its operation, which can leave the
|
||||
* device suspended for a bit longer while the library brings back
|
||||
* reservations into the expected state.
|
||||
*
|
||||
* Use increasing delays to cover both cases without waiting
|
||||
* excessively, and stop after a bit more than a second (1023 ms).
|
||||
* This is a tolerable delay before we return an error and
|
||||
* potentially stop the VM.
|
||||
*/
|
||||
qemu_co_sleep_ns(QEMU_CLOCK_REALTIME, eagain_sleep_ns);
|
||||
eagain_sleep_ns *= 2;
|
||||
goto retry;
|
||||
}
|
||||
|
||||
/* Even for ret == 0, the SG_IO header can contain an error */
|
||||
if (retries-- && hdev_co_ioctl_sgio_retry(&acb, ret)) {
|
||||
goto retry;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
+27
-29
@@ -1200,36 +1200,26 @@ fail:
|
||||
|
||||
typedef struct {
|
||||
Coroutine *co;
|
||||
bool skip_yield;
|
||||
int ret;
|
||||
AioContext *ctx;
|
||||
} NVMeCoData;
|
||||
|
||||
static void nvme_rw_cb_bh(void *opaque)
|
||||
{
|
||||
NVMeCoData *data = opaque;
|
||||
qemu_coroutine_enter(data->co);
|
||||
}
|
||||
|
||||
/* Put into NVMeRequest.cb, so runs in the BDS's main AioContext */
|
||||
static void nvme_rw_cb(void *opaque, int ret)
|
||||
{
|
||||
NVMeCoData *data = opaque;
|
||||
|
||||
data->ret = ret;
|
||||
|
||||
if (data->co == qemu_coroutine_self()) {
|
||||
/*
|
||||
* Fast path: We are inside of the request coroutine (through
|
||||
* nvme_submit_command, nvme_deferred_fn, nvme_process_completion).
|
||||
* We can set data->skip_yield here to keep the coroutine from
|
||||
* yielding, and then we don't need to schedule a BH to wake it.
|
||||
*/
|
||||
data->skip_yield = true;
|
||||
} else {
|
||||
/*
|
||||
* Safe to call: The case where we run in the request coroutine is
|
||||
* handled above, so we must be independent of it; and without
|
||||
* skip_yield set, the coroutine will yield.
|
||||
* No need to release NVMeQueuePair.lock (we are called without it
|
||||
* held). (Note: If we enter the coroutine here, @data will
|
||||
* probably be dangling once aio_co_wake() returns.)
|
||||
*/
|
||||
aio_co_wake(data->co);
|
||||
if (!data->co) {
|
||||
/* The rw coroutine hasn't yielded, don't try to enter. */
|
||||
return;
|
||||
}
|
||||
replay_bh_schedule_oneshot_event(data->ctx, nvme_rw_cb_bh, data);
|
||||
}
|
||||
|
||||
static coroutine_fn int nvme_co_prw_aligned(BlockDriverState *bs,
|
||||
@@ -1253,7 +1243,7 @@ static coroutine_fn int nvme_co_prw_aligned(BlockDriverState *bs,
|
||||
.cdw12 = cpu_to_le32(cdw12),
|
||||
};
|
||||
NVMeCoData data = {
|
||||
.co = qemu_coroutine_self(),
|
||||
.ctx = bdrv_get_aio_context(bs),
|
||||
.ret = -EINPROGRESS,
|
||||
};
|
||||
|
||||
@@ -1270,7 +1260,9 @@ static coroutine_fn int nvme_co_prw_aligned(BlockDriverState *bs,
|
||||
return r;
|
||||
}
|
||||
nvme_submit_command(ioq, req, &cmd, nvme_rw_cb, &data);
|
||||
if (!data.skip_yield) {
|
||||
|
||||
data.co = qemu_coroutine_self();
|
||||
while (data.ret == -EINPROGRESS) {
|
||||
qemu_coroutine_yield();
|
||||
}
|
||||
|
||||
@@ -1366,7 +1358,7 @@ static coroutine_fn int nvme_co_flush(BlockDriverState *bs)
|
||||
.nsid = cpu_to_le32(s->nsid),
|
||||
};
|
||||
NVMeCoData data = {
|
||||
.co = qemu_coroutine_self(),
|
||||
.ctx = bdrv_get_aio_context(bs),
|
||||
.ret = -EINPROGRESS,
|
||||
};
|
||||
|
||||
@@ -1374,7 +1366,9 @@ static coroutine_fn int nvme_co_flush(BlockDriverState *bs)
|
||||
req = nvme_get_free_req(ioq);
|
||||
assert(req);
|
||||
nvme_submit_command(ioq, req, &cmd, nvme_rw_cb, &data);
|
||||
if (!data.skip_yield) {
|
||||
|
||||
data.co = qemu_coroutine_self();
|
||||
if (data.ret == -EINPROGRESS) {
|
||||
qemu_coroutine_yield();
|
||||
}
|
||||
|
||||
@@ -1415,7 +1409,7 @@ static coroutine_fn int nvme_co_pwrite_zeroes(BlockDriverState *bs,
|
||||
};
|
||||
|
||||
NVMeCoData data = {
|
||||
.co = qemu_coroutine_self(),
|
||||
.ctx = bdrv_get_aio_context(bs),
|
||||
.ret = -EINPROGRESS,
|
||||
};
|
||||
|
||||
@@ -1435,7 +1429,9 @@ static coroutine_fn int nvme_co_pwrite_zeroes(BlockDriverState *bs,
|
||||
assert(req);
|
||||
|
||||
nvme_submit_command(ioq, req, &cmd, nvme_rw_cb, &data);
|
||||
if (!data.skip_yield) {
|
||||
|
||||
data.co = qemu_coroutine_self();
|
||||
while (data.ret == -EINPROGRESS) {
|
||||
qemu_coroutine_yield();
|
||||
}
|
||||
|
||||
@@ -1463,7 +1459,7 @@ static int coroutine_fn nvme_co_pdiscard(BlockDriverState *bs,
|
||||
};
|
||||
|
||||
NVMeCoData data = {
|
||||
.co = qemu_coroutine_self(),
|
||||
.ctx = bdrv_get_aio_context(bs),
|
||||
.ret = -EINPROGRESS,
|
||||
};
|
||||
|
||||
@@ -1508,7 +1504,9 @@ static int coroutine_fn nvme_co_pdiscard(BlockDriverState *bs,
|
||||
trace_nvme_dsm(s, offset, bytes);
|
||||
|
||||
nvme_submit_command(ioq, req, &cmd, nvme_rw_cb, &data);
|
||||
if (!data.skip_yield) {
|
||||
|
||||
data.co = qemu_coroutine_self();
|
||||
while (data.ret == -EINPROGRESS) {
|
||||
qemu_coroutine_yield();
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1089,7 +1089,7 @@ vmdk_open_vmdk4(BlockDriverState *bs, BdrvChild *file, int flags,
|
||||
static int vmdk_parse_description(const char *desc, const char *opt_name,
|
||||
char *buf, int buf_size)
|
||||
{
|
||||
char *opt_pos, *opt_end;
|
||||
const char *opt_pos, *opt_end;
|
||||
const char *end = desc + strlen(desc);
|
||||
|
||||
opt_pos = strstr(desc, opt_name);
|
||||
|
||||
+1
-1
@@ -1826,7 +1826,7 @@ cluster_was_modified(BDRVVVFATState *s, uint32_t cluster_num)
|
||||
|
||||
static const char* get_basename(const char* path)
|
||||
{
|
||||
char* basename = strrchr(path, '/');
|
||||
const char *basename = strrchr(path, '/');
|
||||
if (basename == NULL)
|
||||
return path;
|
||||
else
|
||||
|
||||
@@ -686,6 +686,7 @@ void blockdev_close_all_bdrv_states(void)
|
||||
|
||||
GLOBAL_STATE_CODE();
|
||||
QTAILQ_FOREACH_SAFE(bs, &monitor_bdrv_states, monitor_list, next_bs) {
|
||||
QTAILQ_REMOVE(&monitor_bdrv_states, bs, monitor_list);
|
||||
bdrv_unref(bs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1801,7 +1801,7 @@ if test "$plugins" = "yes" ; then
|
||||
fi
|
||||
echo "PYTHON=$python" >> tests/tcg/$config_host_mak
|
||||
|
||||
tcg_tests_targets=
|
||||
tcg_tests_with_compilers=
|
||||
for target in $target_list; do
|
||||
arch=${target%%-*}
|
||||
|
||||
@@ -1852,12 +1852,12 @@ for target in $target_list; do
|
||||
fi
|
||||
|
||||
echo "run-tcg-tests-$target: $qemu\$(EXESUF)" >> Makefile.prereqs
|
||||
tcg_tests_targets="$tcg_tests_targets $target"
|
||||
tcg_tests_with_compilers="$tcg_tests_with_compilers $target"
|
||||
fi
|
||||
done
|
||||
|
||||
if test "$tcg" = "enabled"; then
|
||||
echo "TCG_TESTS_TARGETS=$tcg_tests_targets" >> $config_host_mak
|
||||
echo "TCG_TESTS_WITH_COMPILERS=$tcg_tests_with_compilers" >> $config_host_mak
|
||||
fi
|
||||
|
||||
if test "$skip_meson" = no; then
|
||||
|
||||
@@ -98,6 +98,8 @@ class BinaryFile:
|
||||
size = f'{s.size:{addrx}}'
|
||||
if prefix_symbols:
|
||||
name = f'{binary_name}:{s.name}'
|
||||
else:
|
||||
name = s.name
|
||||
print(addr, size, 'T', name, file=sym_file)
|
||||
|
||||
def generate_debug_file(self):
|
||||
|
||||
@@ -308,13 +308,24 @@ I2C devices connected to the board can be defined via the QEMU command
|
||||
line.
|
||||
|
||||
Arm ``fp5280g2-bmc`` machine (since 10.2)
|
||||
'''''''''''''''''''''''''''''''''''''''''''
|
||||
'''''''''''''''''''''''''''''''''''''''''
|
||||
|
||||
The ``fp5280g2-bmc`` machine does not rely on any specific device
|
||||
models, it can be replaced by the ``ast2500-evb`` machine using the
|
||||
``fmc-model`` option to specify the flash type. The I2C devices
|
||||
connected to the board can be defined via the QEMU command line.
|
||||
|
||||
Arm ``fby35`` machine (since 10.2)
|
||||
''''''''''''''''''''''''''''''''''
|
||||
|
||||
The ``fby35`` machine was originally added as an example of a
|
||||
multi-SoC system, with the expectation the models would evolve over
|
||||
time in an heterogeneous system. This hasn't happened and no public
|
||||
firmware is available to boot it. It can be replaced by the
|
||||
``ast2700fc``, another multi-SoC machine based on the newer AST2700
|
||||
SoCs which are excepted to receive better support in the future.
|
||||
|
||||
|
||||
RISC-V default machine option (since 10.0)
|
||||
''''''''''''''''''''''''''''''''''''''''''
|
||||
|
||||
|
||||
@@ -266,7 +266,7 @@ Splitting a loop can also be useful to reduce the number of barriers:
|
||||
| n = 0; | smp_mb_release(); |
|
||||
| for (i = 0; i < 10; i++) { | for (i = 0; i < 10; i++) |
|
||||
| qatomic_store_release(&a[i], false); | qatomic_set(&a[i], false); |
|
||||
| smp_mb(); | smb_mb(); |
|
||||
| smp_mb(); | smp_mb(); |
|
||||
| n += qatomic_read(&b[i]); | n = 0; |
|
||||
| } | for (i = 0; i < 10; i++) |
|
||||
| | n += qatomic_read(&b[i]); |
|
||||
@@ -283,7 +283,7 @@ as well) ``smp_wmb()``:
|
||||
| | smp_mb_release(); |
|
||||
| for (i = 0; i < 10; i++) { | for (i = 0; i < 10; i++) |
|
||||
| qatomic_store_release(&a[i], false); | qatomic_set(&a[i], false); |
|
||||
| qatomic_store_release(&b[i], false); | smb_wmb(); |
|
||||
| qatomic_store_release(&b[i], false); | smp_wmb(); |
|
||||
| } | for (i = 0; i < 10; i++) |
|
||||
| | qatomic_set(&b[i], false); |
|
||||
+------------------------------------------+----------------------------------+
|
||||
|
||||
@@ -4,55 +4,103 @@
|
||||
Setup build environment
|
||||
=======================
|
||||
|
||||
QEMU uses a lot of dependencies on the host system. glib2 is used everywhere in
|
||||
the code base, and most of the other dependencies are optional.
|
||||
QEMU uses a lot of dependencies on the host system a large number of
|
||||
which are optional. At a minimum we expect to have a system C library
|
||||
(usually glibc but others can work), the glib2 library (used heavily
|
||||
in the code base) and a few other core libraries for interfacing with
|
||||
code modules and system build descriptions.
|
||||
|
||||
We present here simple instructions to enable native builds on most popular
|
||||
systems.
|
||||
We use the ``libvirt-ci`` project to handle the mapping of
|
||||
dependencies to a wide variety output formats including system install
|
||||
scripts. For example:
|
||||
|
||||
You can find additional instructions on `QEMU wiki <https://wiki.qemu.org/>`_:
|
||||
.. code-block:: bash
|
||||
|
||||
- `Linux <https://wiki.qemu.org/Hosts/Linux>`_
|
||||
- `MacOS <https://wiki.qemu.org/Hosts/Mac>`_
|
||||
- `Windows <https://wiki.qemu.org/Hosts/W32>`_
|
||||
- `BSD <https://wiki.qemu.org/Hosts/BSD>`_
|
||||
# THIS FILE WAS AUTO-GENERATED
|
||||
#
|
||||
# $ lcitool buildenvscript debian-13 ./tests/lcitool/projects/qemu-minimal.yml
|
||||
#
|
||||
# https://gitlab.com/libvirt/libvirt-ci
|
||||
|
||||
Note: Installing dependencies using your package manager build dependencies may
|
||||
miss out on deps that have been newly introduced in qemu.git. In more, it misses
|
||||
deps the distribution has decided to exclude.
|
||||
function install_buildenv() {
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
apt-get update
|
||||
apt-get dist-upgrade -y
|
||||
apt-get install --no-install-recommends -y \
|
||||
bash \
|
||||
bc \
|
||||
bison \
|
||||
bzip2 \
|
||||
ca-certificates \
|
||||
ccache \
|
||||
findutils \
|
||||
flex \
|
||||
gcc \
|
||||
git \
|
||||
libc6-dev \
|
||||
libfdt-dev \
|
||||
libffi-dev \
|
||||
libglib2.0-dev \
|
||||
libpixman-1-dev \
|
||||
locales \
|
||||
make \
|
||||
meson \
|
||||
ninja-build \
|
||||
pkgconf \
|
||||
python3 \
|
||||
python3-venv \
|
||||
sed \
|
||||
tar
|
||||
sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen
|
||||
dpkg-reconfigure locales
|
||||
rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED
|
||||
dpkg-query --showformat '${Package}_${Version}_${Architecture}\n' --show > /packages.txt
|
||||
mkdir -p /usr/libexec/ccache-wrappers
|
||||
ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc
|
||||
ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc
|
||||
}
|
||||
|
||||
Linux
|
||||
-----
|
||||
export CCACHE_WRAPPERSDIR="/usr/libexec/ccache-wrappers"
|
||||
export LANG="en_US.UTF-8"
|
||||
export MAKE="/usr/bin/make"
|
||||
export NINJA="/usr/bin/ninja"
|
||||
export PYTHON="/usr/bin/python3"
|
||||
|
||||
Fedora
|
||||
++++++
|
||||
If you instead select the ``qemu.yml`` project file you will get all
|
||||
the dependencies that the project can use.
|
||||
|
||||
::
|
||||
Using you system package manager
|
||||
--------------------------------
|
||||
|
||||
sudo dnf update && sudo dnf builddep qemu
|
||||
.. note::
|
||||
|
||||
Debian/Ubuntu
|
||||
+++++++++++++
|
||||
Installing dependencies using your package manager build dependencies may
|
||||
miss out on deps that have been newly introduced in qemu.git. It
|
||||
also misses deps the distribution has decided to exclude.
|
||||
|
||||
You first need to enable `Sources List <https://wiki.debian.org/SourcesList>`_.
|
||||
Then, use apt to install dependencies:
|
||||
Systems with Package Managers
|
||||
+++++++++++++++++++++++++++++
|
||||
|
||||
::
|
||||
.. list-table:: Package Manager Commands
|
||||
:widths: 10 50 40
|
||||
:header-rows: 1
|
||||
|
||||
sudo apt update && sudo apt build-dep qemu
|
||||
|
||||
MacOS
|
||||
-----
|
||||
|
||||
You first need to install `Homebrew <https://brew.sh/>`_. Then, use it to
|
||||
install dependencies:
|
||||
|
||||
::
|
||||
|
||||
brew update && brew install $(brew deps --include-build qemu)
|
||||
* - System
|
||||
- Command
|
||||
- Notes
|
||||
* - Fedora
|
||||
- ``sudo dnf update && sudo dnf builddep qemu``
|
||||
-
|
||||
* - Debian/Ubuntu
|
||||
- ``sudo apt update && sudo apt build-dep qemu``
|
||||
- Must enable `Sources List
|
||||
<https://wiki.debian.org/SourcesList>`_ first
|
||||
* - MacOS
|
||||
- ``brew update && brew install $(brew deps --include-build qemu)``
|
||||
- Using `Homebrew <https://brew.sh/>`_.
|
||||
|
||||
Windows
|
||||
-------
|
||||
+++++++
|
||||
|
||||
You first need to install `MSYS2 <https://www.msys2.org/>`_.
|
||||
MSYS2 offers `different environments <https://www.msys2.org/docs/environments/>`_.
|
||||
@@ -104,7 +152,7 @@ build QEMU in MSYS2 itself.
|
||||
makepkg --syncdeps --nobuild PKGBUILD || true
|
||||
|
||||
Build on windows-aarch64
|
||||
++++++++++++++++++++++++
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
When trying to cross compile meson for x86_64 using UCRT64 or MINGW64 env,
|
||||
configure will run into an error because the cpu detected is not correct.
|
||||
@@ -115,4 +163,3 @@ and force a cross compilation (with empty prefix).
|
||||
::
|
||||
|
||||
./configure --cpu=x86_64 --cross-prefix=
|
||||
|
||||
@@ -67,7 +67,7 @@ subject tag is "PULL SUBSYSTEM s390/block/whatever" rather than just
|
||||
pull requests that should be applied to master.
|
||||
|
||||
You might be interested in the `make-pullreq
|
||||
<https://git.linaro.org/people/peter.maydell/misc-scripts.git/tree/make-pullreq>`__
|
||||
<https://gitlab.com/pm215/misc-scripts/-/blob/master/make-pullreq>`__
|
||||
script which automates some of this process for you and includes a few
|
||||
sanity checks. Note that you must edit it to configure it suitably for
|
||||
your local situation!
|
||||
+504
-46
@@ -76,7 +76,7 @@ structures used in the ``ioctl()`` implementation. Messages derived from the
|
||||
``ioctl()`` will have a name derived from the ``ioctl()`` command name. E.g., the
|
||||
``VFIO_DEVICE_GET_INFO`` ``ioctl()`` command becomes a
|
||||
``VFIO_USER_DEVICE_GET_INFO`` message. The purpose of this reuse is to share as
|
||||
much code as feasible with the ``ioctl()`` implementation``.
|
||||
much code as feasible with the ``ioctl()`` implementation.
|
||||
|
||||
Connection Initiation
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
@@ -201,12 +201,32 @@ A server can serve:
|
||||
1) one or more clients, and/or
|
||||
2) one or more virtual devices, belonging to one or more clients.
|
||||
|
||||
The current protocol specification requires a dedicated socket per
|
||||
client/server connection. It is a server-side implementation detail whether a
|
||||
single server handles multiple virtual devices from the same or multiple
|
||||
clients. The location of the socket is implementation-specific. Multiplexing
|
||||
clients, devices, and servers over the same socket is not supported in this
|
||||
version of the protocol.
|
||||
The current protocol specification requires dedicated sockets per
|
||||
client/server connection. Commands in the client-to-server direction are
|
||||
handled on the main communication socket which the client connects to, and
|
||||
replies to these commands are passed on the same socket. Commands sent in the
|
||||
other direction from the server to the client as well as their corresponding
|
||||
replies can optionally be passed across a separate socket, which is set up
|
||||
during negotiation (AF_UNIX servers just pass the file descriptor).
|
||||
|
||||
Using separate sockets for each command channel avoids introducing an
|
||||
artificial point of synchronization between the channels. This simplifies
|
||||
implementations since it obviates the need to demultiplex incoming messages
|
||||
into commands and replies and interleave command handling and reply processing.
|
||||
Note that it is still illegal for implementations to stall command or reply
|
||||
processing indefinitely while waiting for replies on the other channel, as this
|
||||
may lead to deadlocks. However, since incoming commands and requests arrive on
|
||||
different sockets, it's possible to meet this requirement e.g. by running two
|
||||
independent request processing threads that can internally operate
|
||||
synchronously. It is expected that this is simpler to implement than fully
|
||||
asynchronous message handling code. Implementations may still choose a fully
|
||||
asynchronous, event-based design for other reasons, and the protocol fully
|
||||
supports it.
|
||||
|
||||
It is a server-side implementation detail whether a single server handles
|
||||
multiple virtual devices from the same or multiple clients. The location of the
|
||||
socket is implementation-specific. Multiplexing clients, devices, and servers
|
||||
over the same socket is not supported in this version of the protocol.
|
||||
|
||||
Authentication
|
||||
--------------
|
||||
@@ -364,6 +384,9 @@ Name Command Request Direction
|
||||
``VFIO_USER_DMA_WRITE`` 12 server -> client
|
||||
``VFIO_USER_DEVICE_RESET`` 13 client -> server
|
||||
``VFIO_USER_REGION_WRITE_MULTI`` 15 client -> server
|
||||
``VFIO_USER_DEVICE_FEATURE`` 16 client -> server
|
||||
``VFIO_USER_MIG_DATA_READ`` 17 client -> server
|
||||
``VFIO_USER_MIG_DATA_WRITE`` 18 client -> server
|
||||
====================================== ========= =================
|
||||
|
||||
Header
|
||||
@@ -486,45 +509,48 @@ format:
|
||||
|
||||
Capabilities:
|
||||
|
||||
+--------------------+---------+------------------------------------------------+
|
||||
| Name | Type | Description |
|
||||
+====================+=========+================================================+
|
||||
| max_msg_fds | number | Maximum number of file descriptors that can be |
|
||||
| | | received by the sender in one message. |
|
||||
| | | Optional. If not specified then the receiver |
|
||||
| | | must assume a value of ``1``. |
|
||||
+--------------------+---------+------------------------------------------------+
|
||||
| max_data_xfer_size | number | Maximum ``count`` for data transfer messages; |
|
||||
| | | see `Read and Write Operations`_. Optional, |
|
||||
| | | with a default value of 1048576 bytes. |
|
||||
+--------------------+---------+------------------------------------------------+
|
||||
| pgsizes | number | Page sizes supported in DMA map operations |
|
||||
| | | or'ed together. Optional, with a default value |
|
||||
| | | of supporting only 4k pages. |
|
||||
+--------------------+---------+------------------------------------------------+
|
||||
| max_dma_maps | number | Maximum number DMA map windows that can be |
|
||||
| | | valid simultaneously. Optional, with a |
|
||||
| | | value of 65535 (64k-1). |
|
||||
+--------------------+---------+------------------------------------------------+
|
||||
| migration | object | Migration capability parameters. If missing |
|
||||
| | | then migration is not supported by the sender. |
|
||||
+--------------------+---------+------------------------------------------------+
|
||||
| write_multiple | boolean | ``VFIO_USER_REGION_WRITE_MULTI`` messages |
|
||||
| | | are supported if the value is ``true``. |
|
||||
+--------------------+---------+------------------------------------------------+
|
||||
+--------------------+---------+-----------------------------------------------+
|
||||
| Name | Type | Description |
|
||||
+====================+=========+===============================================+
|
||||
| max_msg_fds | number | Maximum number of file descriptors that can |
|
||||
| | | be received by the sender in one message. |
|
||||
| | | Optional. If not specified then the receiver |
|
||||
| | | must assume a value of ``1``. |
|
||||
+--------------------+---------+-----------------------------------------------+
|
||||
| max_data_xfer_size | number | Maximum ``count`` for data transfer messages; |
|
||||
| | | see `Read and Write Operations`_. Optional, |
|
||||
| | | with a default value of 1048576 bytes. |
|
||||
+--------------------+---------+-----------------------------------------------+
|
||||
| max_dma_maps | number | Maximum number DMA map windows that can be |
|
||||
| | | valid simultaneously. Optional, with a |
|
||||
| | | value of 65535 (64k-1). |
|
||||
+--------------------+---------+-----------------------------------------------+
|
||||
| pgsizes | number | Page sizes supported in DMA map operations |
|
||||
| | | or'ed together. Optional, with a default |
|
||||
| | | value of supporting only 4k pages. |
|
||||
+--------------------+---------+-----------------------------------------------+
|
||||
| twin_socket | object | Parameters for twin-socket mode, which |
|
||||
| | | handles server-to-client commands and their |
|
||||
| | | replies on a separate socket. Optional. |
|
||||
+--------------------+---------+-----------------------------------------------+
|
||||
| write_multiple | boolean | ``VFIO_USER_REGION_WRITE_MULTI`` messages |
|
||||
| | | are supported if the value is ``true``. |
|
||||
+--------------------+---------+-----------------------------------------------+
|
||||
|
||||
The migration capability contains the following name/value pairs:
|
||||
The ``twin_socket`` capability object holds these name/value pairs:
|
||||
|
||||
+-----------------+--------+--------------------------------------------------+
|
||||
| Name | Type | Description |
|
||||
+=================+========+==================================================+
|
||||
| pgsize | number | Page size of dirty pages bitmap. The smallest |
|
||||
| | | between the client and the server is used. |
|
||||
+-----------------+--------+--------------------------------------------------+
|
||||
| max_bitmap_size | number | Maximum bitmap size in ``VFIO_USER_DIRTY_PAGES`` |
|
||||
| | | and ``VFIO_DMA_UNMAP`` messages. Optional, |
|
||||
| | | with a default value of 256MB. |
|
||||
+-----------------+--------+--------------------------------------------------+
|
||||
+-----------+---------+--------------------------------------------------------+
|
||||
| Name | Type | Description |
|
||||
+===========+=========+========================================================+
|
||||
| supported | boolean | Indicates whether the sender supports twin-socket |
|
||||
| | | mode. Optional, defaults to false. |
|
||||
+-----------+---------+--------------------------------------------------------+
|
||||
| fd_index | number | Specifies an index in the file descriptor array |
|
||||
| | | included with the message. The designated file |
|
||||
| | | descriptor is a socket which is to be used for the |
|
||||
| | | server-to-client command channel. Optional, only valid |
|
||||
| | | in the reply message. |
|
||||
+-----------+---------+--------------------------------------------------------+
|
||||
|
||||
Reply
|
||||
^^^^^
|
||||
@@ -532,6 +558,38 @@ Reply
|
||||
The same message format is used in the server's reply with the semantics
|
||||
described above.
|
||||
|
||||
If and only if the client has indicated support for twin-socket mode by setting
|
||||
``twin_socket.supported`` to true in its capabilities, the server may optionally
|
||||
set up a separate command channel for server-to-client commands and their
|
||||
replies. The server enables twin-socket mode as follows:
|
||||
|
||||
* Create a fresh socket pair.
|
||||
* Keep the server end of the socket pair and pass the client end in the file
|
||||
descriptor array included with the reply message.
|
||||
* Set ``twin_socket.supported`` to true in the reply.
|
||||
* Indicate the index in the file descriptor array by the
|
||||
``twin_socket.fd_index`` capability field in the reply, so the client can
|
||||
identify the correct file descriptor to use.
|
||||
|
||||
A client requesting twin-socket mode must examine the ``twin_socket`` capability
|
||||
in the reply:
|
||||
|
||||
* If ``twin_socket.supported`` is false, the field is missing, or the entire
|
||||
``twin_socket`` object is absent, the server does not support twin-socket mode
|
||||
or decided not to enable it. The client can choose whether it wants to proceed
|
||||
without twin-socket mode, or close the connection if not.
|
||||
* If ``twin_socket.supported`` is true and ``twin_socket.fd_index`` is present
|
||||
and refers to a valid file descriptor, twin-socket mode negotiation has
|
||||
succeeded. The client monitors the provided file descriptor for commands from
|
||||
the server.
|
||||
* Otherwise, the reply from the server is inconsistent. The client must abort
|
||||
and close the connection since it is potentially unable to receive commands
|
||||
from the server.
|
||||
|
||||
The twin-socket feature is optional, so some servers may not support it.
|
||||
However, for server implementations that do send server-to-client commands it is
|
||||
strongly recommended to implement twin-socket support.
|
||||
|
||||
``VFIO_USER_DMA_MAP``
|
||||
---------------------
|
||||
|
||||
@@ -1335,7 +1393,9 @@ Reply
|
||||
-----------------------
|
||||
|
||||
If the client has not shared mappable memory, the server can use this message to
|
||||
read from guest memory.
|
||||
read from guest memory. This message and its reply are passed over the separate
|
||||
server-to-client socket if twin-socket mode has been negotiated during
|
||||
connection setup.
|
||||
|
||||
Request
|
||||
^^^^^^^
|
||||
@@ -1373,7 +1433,9 @@ Reply
|
||||
-----------------------
|
||||
|
||||
If the client has not shared mappable memory, the server can use this message to
|
||||
write to guest memory.
|
||||
write to guest memory. This message and its reply are passed over the separate
|
||||
server-to-client socket if twin-socket mode has been negotiated during
|
||||
connection setup.
|
||||
|
||||
Request
|
||||
^^^^^^^
|
||||
@@ -1466,6 +1528,402 @@ Reply
|
||||
|
||||
* *wr_cnt* is the number of device writes completed.
|
||||
|
||||
``VFIO_USER_DEVICE_FEATURE``
|
||||
----------------------------
|
||||
|
||||
This command is analogous to ``VFIO_DEVICE_FEATURE``. It is used to get, set, or
|
||||
probe feature data of the device.
|
||||
|
||||
Request
|
||||
^^^^^^^
|
||||
|
||||
The request payload for this message is a structure of the following format.
|
||||
|
||||
+-------+--------+--------------------------------+
|
||||
| Name | Offset | Size |
|
||||
+=======+========+================================+
|
||||
| argsz | 0 | 4 |
|
||||
+-------+--------+--------------------------------+
|
||||
| flags | 4 | 4 |
|
||||
+-------+--------+--------------------------------+
|
||||
| | +---------+---------------------------+ |
|
||||
| | | Bit | Definition | |
|
||||
| | +=========+===========================+ |
|
||||
| | | 0 to 15 | Feature index | |
|
||||
| | +---------+---------------------------+ |
|
||||
| | | 16 | VFIO_DEVICE_FEATURE_GET | |
|
||||
| | +---------+---------------------------+ |
|
||||
| | | 17 | VFIO_DEVICE_FEATURE_SET | |
|
||||
| | +---------+---------------------------+ |
|
||||
| | | 18 | VFIO_DEVICE_FEATURE_PROBE | |
|
||||
| | +---------+---------------------------+ |
|
||||
+-------+--------+--------------------------------+
|
||||
| data | 8 | variable |
|
||||
+-------+--------+--------------------------------+
|
||||
|
||||
* *argsz* is the maximum size of the reply payload.
|
||||
|
||||
* *flags* defines the action to be performed by the server and upon which
|
||||
feature:
|
||||
|
||||
* The feature index consists of the least significant 16 bits of the flags
|
||||
field, and can be accessed using the ``VFIO_DEVICE_FEATURE_MASK`` bit mask.
|
||||
|
||||
* ``VFIO_DEVICE_FEATURE_GET`` instructs the server to get the data for the
|
||||
given feature.
|
||||
|
||||
* ``VFIO_DEVICE_FEATURE_SET`` instructs the server to set the feature data to
|
||||
that given in the ``data`` field of the payload.
|
||||
|
||||
* ``VFIO_DEVICE_FEATURE_PROBE`` instructs the server to probe for feature
|
||||
support. If ``VFIO_DEVICE_FEATURE_GET`` and/or ``VFIO_DEVICE_FEATURE_SET``
|
||||
are also set, the probe will only return success if all of the indicated
|
||||
methods are supported.
|
||||
|
||||
``VFIO_DEVICE_FEATURE_GET`` and ``VFIO_DEVICE_FEATURE_SET`` are mutually
|
||||
exclusive, except for use with ``VFIO_DEVICE_FEATURE_PROBE``.
|
||||
|
||||
* *data* is specific to the particular feature. It is not used for probing.
|
||||
|
||||
This part of the request is analogous to VFIO's ``struct vfio_device_feature``.
|
||||
|
||||
Reply
|
||||
^^^^^
|
||||
|
||||
The reply payload must be the same as the request payload for setting or
|
||||
probing a feature. For getting a feature's data, the data is added in the data
|
||||
section and its length is added to ``argsz``.
|
||||
|
||||
Device Features
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
The only device features supported by vfio-user are those related to migration,
|
||||
although this may change in the future. They are a subset of those supported in
|
||||
the VFIO implementation of the Linux kernel.
|
||||
|
||||
+----------------------------------------+---------------+
|
||||
| Name | Feature Index |
|
||||
+========================================+===============+
|
||||
| VFIO_DEVICE_FEATURE_MIGRATION | 1 |
|
||||
+----------------------------------------+---------------+
|
||||
| VFIO_DEVICE_FEATURE_MIG_DEVICE_STATE | 2 |
|
||||
+----------------------------------------+---------------+
|
||||
| VFIO_DEVICE_FEATURE_DMA_LOGGING_START | 6 |
|
||||
+----------------------------------------+---------------+
|
||||
| VFIO_DEVICE_FEATURE_DMA_LOGGING_STOP | 7 |
|
||||
+----------------------------------------+---------------+
|
||||
| VFIO_DEVICE_FEATURE_DMA_LOGGING_REPORT | 8 |
|
||||
+----------------------------------------+---------------+
|
||||
|
||||
``VFIO_DEVICE_FEATURE_MIGRATION``
|
||||
"""""""""""""""""""""""""""""""""
|
||||
|
||||
This feature indicates that the device can support the migration API through
|
||||
``VFIO_DEVICE_FEATURE_MIG_DEVICE_STATE``. If ``GET`` succeeds, the ``RUNNING``
|
||||
and ``ERROR`` states are always supported. Support for additional states is
|
||||
indicated via the flags field; at least ``VFIO_MIGRATION_STOP_COPY`` must be
|
||||
set.
|
||||
|
||||
There is no data field of the request message.
|
||||
|
||||
The data field of the reply message is structured as follows:
|
||||
|
||||
+-------+--------+---------------------------+
|
||||
| Name | Offset | Size |
|
||||
+=======+========+===========================+
|
||||
| flags | 0 | 8 |
|
||||
+-------+--------+---------------------------+
|
||||
| | +-----+--------------------------+ |
|
||||
| | | Bit | Definition | |
|
||||
| | +=====+==========================+ |
|
||||
| | | 0 | VFIO_MIGRATION_STOP_COPY | |
|
||||
| | +-----+--------------------------+ |
|
||||
| | | 1 | VFIO_MIGRATION_P2P | |
|
||||
| | +-----+--------------------------+ |
|
||||
| | | 2 | VFIO_MIGRATION_PRE_COPY | |
|
||||
| | +-----+--------------------------+ |
|
||||
+-------+--------+---------------------------+
|
||||
|
||||
These flags are interpreted in the same way as VFIO.
|
||||
|
||||
``VFIO_DEVICE_FEATURE_MIG_DEVICE_STATE``
|
||||
""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
Upon ``VFIO_DEVICE_FEATURE_SET``, execute a migration state change on the VFIO
|
||||
device. The new state is supplied in ``device_state``. The state transition must
|
||||
fully complete before the reply is sent.
|
||||
|
||||
The data field of the reply message, as well as the ``SET`` request message, is
|
||||
structured as follows:
|
||||
|
||||
+--------------+--------+------+
|
||||
| Name | Offset | Size |
|
||||
+==============+========+======+
|
||||
| device_state | 0 | 4 |
|
||||
+--------------+--------+------+
|
||||
| data_fd | 4 | 4 |
|
||||
+--------------+--------+------+
|
||||
|
||||
* *device_state* is the current state of the device (for ``GET``) or the
|
||||
state to transition to (for ``SET``). It is defined by the
|
||||
``vfio_device_mig_state`` enum as detailed below. These states are the states
|
||||
of the device migration Finite State Machine.
|
||||
|
||||
+--------------------------------+-------+---------------------------------------------------------------------+
|
||||
| Name | State | Description |
|
||||
+================================+=======+=====================================================================+
|
||||
| VFIO_DEVICE_STATE_ERROR | 0 | The device has failed and must be reset. |
|
||||
+--------------------------------+-------+---------------------------------------------------------------------+
|
||||
| VFIO_DEVICE_STATE_STOP | 1 | The device does not change the internal or external state. |
|
||||
+--------------------------------+-------+---------------------------------------------------------------------+
|
||||
| VFIO_DEVICE_STATE_RUNNING | 2 | The device is running normally. |
|
||||
+--------------------------------+-------+---------------------------------------------------------------------+
|
||||
| VFIO_DEVICE_STATE_STOP_COPY | 3 | The device internal state can be read out. |
|
||||
+--------------------------------+-------+---------------------------------------------------------------------+
|
||||
| VFIO_DEVICE_STATE_RESUMING | 4 | The device is stopped and is loading a new internal state. |
|
||||
+--------------------------------+-------+---------------------------------------------------------------------+
|
||||
| VFIO_DEVICE_STATE_RUNNING_P2P | 5 | (not used in vfio-user) |
|
||||
+--------------------------------+-------+---------------------------------------------------------------------+
|
||||
| VFIO_DEVICE_STATE_PRE_COPY | 6 | The device is running normally but tracking internal state changes. |
|
||||
+--------------------------------+-------+---------------------------------------------------------------------+
|
||||
| VFIO_DEVICE_STATE_PRE_COPY_P2P | 7 | (not used in vfio-user) |
|
||||
+--------------------------------+-------+---------------------------------------------------------------------+
|
||||
|
||||
* *data_fd* is unused in vfio-user, as the ``VFIO_USER_MIG_DATA_READ`` and
|
||||
``VFIO_USER_MIG_DATA_WRITE`` messages are used instead for migration data
|
||||
transport.
|
||||
|
||||
Direct State Transitions
|
||||
""""""""""""""""""""""""
|
||||
|
||||
The device migration FSM is a Mealy machine, so actions are taken upon the arcs
|
||||
between FSM states. The following transitions need to be supported by the
|
||||
server, a subset of those defined in ``<linux/vfio.h>``
|
||||
(``enum vfio_device_mig_state``).
|
||||
|
||||
* ``RUNNING -> STOP``, ``STOP_COPY -> STOP``: Stop the operation of the device.
|
||||
The ``STOP_COPY`` arc terminates the data transfer session.
|
||||
|
||||
* ``RESUMING -> STOP``: Terminate the data transfer session. Complete processing
|
||||
of the migration data. Stop the operation of the device. If the delivered data
|
||||
is found to be incomplete, inconsistent, or otherwise invalid, fail the
|
||||
``SET`` command and optionally transition to the ``ERROR`` state.
|
||||
|
||||
* ``PRE_COPY -> RUNNING``: Terminate the data transfer session. The device is
|
||||
now fully operational.
|
||||
|
||||
* ``STOP -> RUNNING``: Start the operation of the device.
|
||||
|
||||
* ``RUNNING -> PRE_COPY``, ``STOP -> STOP_COPY``: Begin the process of saving
|
||||
the device state. The device operation is unchanged, but data transfer begins.
|
||||
``PRE_COPY`` and ``STOP_COPY`` are referred to as the "saving group" of
|
||||
states.
|
||||
|
||||
* ``PRE_COPY -> STOP_COPY``: Continue to transfer migration data, but stop
|
||||
device operation.
|
||||
|
||||
* ``STOP -> RESUMING``: Start the process of restoring the device state. The
|
||||
internal device state may be changed to prepare the device to receive the
|
||||
migration data.
|
||||
|
||||
The ``STOP_COPY -> PRE_COPY`` transition is explicitly not allowed and should
|
||||
return an error if requested.
|
||||
|
||||
``ERROR`` cannot be specified as a device state, but any transition request can
|
||||
be failed and then move the state into ``ERROR`` if the server was unable to
|
||||
execute the requested arc AND was unable to restore the device into any valid
|
||||
state. To recover from ``ERROR``, ``VFIO_USER_DEVICE_RESET`` must be used to
|
||||
return back to ``RUNNING``.
|
||||
|
||||
If ``PRE_COPY`` is not supported, arcs touching it are removed.
|
||||
|
||||
Complex State Transitions
|
||||
"""""""""""""""""""""""""
|
||||
|
||||
The remaining possible transitions are to be implemented as combinations of the
|
||||
above FSM arcs. As there are multiple paths, the path should be selected based
|
||||
on the following rules:
|
||||
|
||||
* Select the shortest path.
|
||||
|
||||
* The path cannot have saving group states as interior arcs, only start/end
|
||||
states.
|
||||
|
||||
``VFIO_DEVICE_FEATURE_DMA_LOGGING_START`` / ``VFIO_DEVICE_FEATURE_DMA_LOGGING_STOP``
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
Upon ``VFIO_DEVICE_FEATURE_SET``, start/stop DMA logging. These features can
|
||||
also be probed to determine whether the device supports DMA logging.
|
||||
|
||||
When DMA logging is started, a range of IOVAs to monitor is provided and the
|
||||
device can optimize its logging to cover only the IOVA range given. Only DMA
|
||||
writes are logged.
|
||||
|
||||
The data field of the ``SET`` request is structured as follows:
|
||||
|
||||
+------------+--------+----------+
|
||||
| Name | Offset | Size |
|
||||
+============+========+==========+
|
||||
| page_size | 0 | 8 |
|
||||
+------------+--------+----------+
|
||||
| num_ranges | 8 | 4 |
|
||||
+------------+--------+----------+
|
||||
| reserved | 12 | 4 |
|
||||
+------------+--------+----------+
|
||||
| ranges | 16 | variable |
|
||||
+------------+--------+----------+
|
||||
|
||||
* *page_size* hints what tracking granularity the device should try to achieve.
|
||||
If the device cannot do the hinted page size then it's the driver's choice
|
||||
which page size to pick based on its support. On output the device will return
|
||||
the page size it selected.
|
||||
|
||||
* *num_ranges* is the number of IOVA ranges to monitor. A value of zero
|
||||
indicates that all writes should be logged.
|
||||
|
||||
* *ranges* is an array of ``vfio_user_device_feature_dma_logging_range``
|
||||
entries:
|
||||
|
||||
+--------+--------+------+
|
||||
| Name | Offset | Size |
|
||||
+========+========+======+
|
||||
| iova | 0 | 8 |
|
||||
+--------+--------+------+
|
||||
| length | 8 | 8 |
|
||||
+--------+--------+------+
|
||||
|
||||
* *iova* is the base IO virtual address
|
||||
* *length* is the length of the range to log
|
||||
|
||||
Upon success, the response data field will be the same as the request, unless
|
||||
the page size was changed, in which case this will be reflected in the response.
|
||||
|
||||
``VFIO_DEVICE_FEATURE_DMA_LOGGING_REPORT``
|
||||
""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
Upon ``VFIO_DEVICE_FEATURE_GET``, returns the dirty bitmap for a specific IOVA
|
||||
range. This operation is only valid if logging of dirty pages has been
|
||||
previously started by setting ``VFIO_DEVICE_FEATURE_DMA_LOGGING_START``.
|
||||
|
||||
The data field of the request is structured as follows:
|
||||
|
||||
+-----------+--------+------+
|
||||
| Name | Offset | Size |
|
||||
+===========+========+======+
|
||||
| iova | 0 | 8 |
|
||||
+-----------+--------+------+
|
||||
| length | 8 | 8 |
|
||||
+-----------+--------+------+
|
||||
| page_size | 16 | 8 |
|
||||
+-----------+--------+------+
|
||||
|
||||
* *iova* is the base IO virtual address
|
||||
|
||||
* *length* is the length of the range
|
||||
|
||||
* *page_size* is the unit of granularity of the bitmap, and must be a power of
|
||||
two. It doesn't have to match the value given to
|
||||
``VFIO_DEVICE_FEATURE_DMA_LOGGING_START`` because the driver will format its
|
||||
internal logging to match the reporting page size possibly by replicating bits
|
||||
if the internal page size is lower than requested
|
||||
|
||||
The data field of the response is identical, except with the bitmap added on
|
||||
the end at offset 24.
|
||||
|
||||
The bitmap is an array of u64s that holds the output bitmap, with 1 bit
|
||||
reporting a *page_size* unit of IOVA. The bits outside of the requested range
|
||||
must be zero.
|
||||
|
||||
The mapping of IOVA to bits is given by:
|
||||
|
||||
``bitmap[(addr - iova)/page_size] & (1ULL << (addr % 64))``
|
||||
|
||||
``VFIO_USER_MIG_DATA_READ``
|
||||
---------------------------
|
||||
|
||||
This command is used to read data from the source migration server while it is
|
||||
in a saving group state (``PRE_COPY`` or ``STOP_COPY``).
|
||||
|
||||
This command, and ``VFIO_USER_MIG_DATA_WRITE``, are used in place of the
|
||||
``data_fd`` file descriptor in ``<linux/vfio.h>``
|
||||
(``struct vfio_device_feature_mig_state``) to enable all data transport to use
|
||||
the single already-established UNIX socket. Hence, the migration data is
|
||||
treated like a stream, so the client must continue reading until no more
|
||||
migration data remains.
|
||||
|
||||
Request
|
||||
^^^^^^^
|
||||
|
||||
The request payload for this message is a structure of the following format.
|
||||
|
||||
+-------+--------+------+
|
||||
| Name | Offset | Size |
|
||||
+=======+========+======+
|
||||
| argsz | 0 | 4 |
|
||||
+-------+--------+------+
|
||||
| size | 4 | 4 |
|
||||
+-------+--------+------+
|
||||
|
||||
* *argsz* is the maximum size of the reply payload.
|
||||
|
||||
* *size* is the size of the migration data to read.
|
||||
|
||||
Reply
|
||||
^^^^^
|
||||
|
||||
The reply payload for this message is a structure of the following format.
|
||||
|
||||
+-------+--------+----------+
|
||||
| Name | Offset | Size |
|
||||
+=======+========+==========+
|
||||
| argsz | 0 | 4 |
|
||||
+-------+--------+----------+
|
||||
| size | 4 | 4 |
|
||||
+-------+--------+----------+
|
||||
| data | 8 | variable |
|
||||
+-------+--------+----------+
|
||||
|
||||
* *argsz* is the size of the above structure, including the size of the data.
|
||||
|
||||
* *size* indicates the size of returned migration data. If this is less than the
|
||||
requested size, there is no more migration data to read.
|
||||
|
||||
* *data* contains the migration data.
|
||||
|
||||
``VFIO_USER_MIG_DATA_WRITE``
|
||||
----------------------------
|
||||
|
||||
This command is used to write data to the destination migration server while it
|
||||
is in the ``RESUMING`` state.
|
||||
|
||||
As above, this replaces the ``data_fd`` file descriptor for transport of
|
||||
migration data, and as such, the migration data is treated like a stream.
|
||||
|
||||
Request
|
||||
^^^^^^^
|
||||
|
||||
The request payload for this message is a structure of the following format.
|
||||
|
||||
+-------+--------+----------+
|
||||
| Name | Offset | Size |
|
||||
+=======+========+==========+
|
||||
| argsz | 0 | 4 |
|
||||
+-------+--------+----------+
|
||||
| size | 4 | 4 |
|
||||
+-------+--------+----------+
|
||||
| data | 8 | variable |
|
||||
+-------+--------+----------+
|
||||
|
||||
* *argsz* is the maximum size of the reply payload.
|
||||
|
||||
* *size* is the size of the migration data to be written.
|
||||
|
||||
* *data* contains the migration data.
|
||||
|
||||
Reply
|
||||
^^^^^
|
||||
|
||||
There is no reply payload for this message.
|
||||
|
||||
Appendices
|
||||
==========
|
||||
|
||||
+1
-1
@@ -362,7 +362,7 @@ static const char *get_feature_xml(const char *p, const char **newp,
|
||||
* qXfer:features:read:ANNEX:OFFSET,LENGTH'
|
||||
* ^p ^newp
|
||||
*/
|
||||
char *term = strchr(p, ':');
|
||||
const char *term = strchr(p, ':');
|
||||
*newp = term + 1;
|
||||
len = term - p;
|
||||
|
||||
|
||||
+1
-1
@@ -317,7 +317,7 @@ static bool gdb_accept_socket(int gdb_fd)
|
||||
static int gdbserver_open_socket(const char *path, Error **errp)
|
||||
{
|
||||
g_autoptr(GString) buf = g_string_new("");
|
||||
char *pid_placeholder;
|
||||
const char *pid_placeholder;
|
||||
|
||||
pid_placeholder = strstr(path, "%d");
|
||||
if (pid_placeholder != NULL) {
|
||||
|
||||
@@ -67,9 +67,9 @@ static inline Int128 atomic16_fetch_and(Int128 *ptr, Int128 new)
|
||||
"stlxp %w[tmp], %[tmpl], %[tmph], %[mem]\n\t"
|
||||
"cbnz %w[tmp], 0b"
|
||||
: [mem] "+m"(*ptr), [tmp] "=&r"(tmp),
|
||||
[oldl] "=&r"(oldl), [oldh] "=&r"(oldh)
|
||||
: [newl] "r"(newl), [newh] "r"(newh),
|
||||
[tmpl] "r"(tmpl), [tmph] "r"(tmph)
|
||||
[oldl] "=&r"(oldl), [oldh] "=&r"(oldh),
|
||||
[tmpl] "=&r"(tmpl), [tmph] "=&r"(tmph)
|
||||
: [newl] "r"(newl), [newh] "r"(newh)
|
||||
: "memory");
|
||||
|
||||
return int128_make128(oldl, oldh);
|
||||
@@ -87,9 +87,9 @@ static inline Int128 atomic16_fetch_or(Int128 *ptr, Int128 new)
|
||||
"stlxp %w[tmp], %[tmpl], %[tmph], %[mem]\n\t"
|
||||
"cbnz %w[tmp], 0b"
|
||||
: [mem] "+m"(*ptr), [tmp] "=&r"(tmp),
|
||||
[oldl] "=&r"(oldl), [oldh] "=&r"(oldh)
|
||||
: [newl] "r"(newl), [newh] "r"(newh),
|
||||
[tmpl] "r"(tmpl), [tmph] "r"(tmph)
|
||||
[oldl] "=&r"(oldl), [oldh] "=&r"(oldh),
|
||||
[tmpl] "=&r"(tmpl), [tmph] "=&r"(tmph)
|
||||
: [newl] "r"(newl), [newh] "r"(newh)
|
||||
: "memory");
|
||||
|
||||
return int128_make128(oldl, oldh);
|
||||
|
||||
@@ -34,39 +34,45 @@ static inline Int128 ATTRIBUTE_ATOMIC128_OPT
|
||||
atomic16_xchg(Int128 *ptr, Int128 new)
|
||||
{
|
||||
__int128_t *ptr_align = __builtin_assume_aligned(ptr, 16);
|
||||
Int128 old = *ptr_align;
|
||||
Int128Alias o, n;
|
||||
|
||||
while (!__atomic_compare_exchange_n(ptr_align, &old, new, true,
|
||||
n.s = new;
|
||||
o.i = *ptr_align;
|
||||
while (!__atomic_compare_exchange_n(ptr_align, &o.i, n.i, true,
|
||||
__ATOMIC_SEQ_CST, 0)) {
|
||||
continue;
|
||||
}
|
||||
return old;
|
||||
return o.s;
|
||||
}
|
||||
|
||||
static inline Int128 ATTRIBUTE_ATOMIC128_OPT
|
||||
atomic16_fetch_and(Int128 *ptr, Int128 val)
|
||||
{
|
||||
__int128_t *ptr_align = __builtin_assume_aligned(ptr, 16);
|
||||
Int128 old = *ptr_align;
|
||||
Int128Alias o, v;
|
||||
|
||||
while (!__atomic_compare_exchange_n(ptr_align, &old, old & val, true,
|
||||
v.s = val;
|
||||
o.i = *ptr_align;
|
||||
while (!__atomic_compare_exchange_n(ptr_align, &o.i, o.i & v.i, true,
|
||||
__ATOMIC_SEQ_CST, 0)) {
|
||||
continue;
|
||||
}
|
||||
return old;
|
||||
return o.s;
|
||||
}
|
||||
|
||||
static inline Int128 ATTRIBUTE_ATOMIC128_OPT
|
||||
atomic16_fetch_or(Int128 *ptr, Int128 val)
|
||||
{
|
||||
__int128_t *ptr_align = __builtin_assume_aligned(ptr, 16);
|
||||
Int128 old = *ptr_align;
|
||||
Int128Alias o, v;
|
||||
|
||||
while (!__atomic_compare_exchange_n(ptr_align, &old, old | val, true,
|
||||
v.s = val;
|
||||
o.i = *ptr_align;
|
||||
while (!__atomic_compare_exchange_n(ptr_align, &o.i, o.i | v.i, true,
|
||||
__ATOMIC_SEQ_CST, 0)) {
|
||||
continue;
|
||||
}
|
||||
return old;
|
||||
return o.s;
|
||||
}
|
||||
# define HAVE_CMPXCHG128 1
|
||||
#elif defined(CONFIG_CMPXCHG128)
|
||||
|
||||
@@ -310,7 +310,7 @@ static void xen_9pfs_bh(void *opaque)
|
||||
|
||||
again:
|
||||
wait = ring->co != NULL && qemu_coroutine_entered(ring->co);
|
||||
/* paired with the smb_wmb barriers in xen_9pfs_init_in_iov_from_pdu */
|
||||
/* paired with the smp_wmb barriers in xen_9pfs_init_in_iov_from_pdu */
|
||||
smp_rmb();
|
||||
if (wait) {
|
||||
cpu_relax();
|
||||
|
||||
@@ -175,6 +175,7 @@ static void fby35_class_init(ObjectClass *oc, const void *data)
|
||||
MachineClass *mc = MACHINE_CLASS(oc);
|
||||
|
||||
mc->desc = "Meta Platforms fby35";
|
||||
mc->deprecation_reason = "For a multi-soc machine, use 'ast2700fc' instead";
|
||||
mc->init = fby35_init;
|
||||
mc->no_floppy = 1;
|
||||
mc->no_cdrom = 1;
|
||||
|
||||
@@ -494,7 +494,9 @@ static void set_uint64_checkmask(Object *obj, Visitor *v, const char *name,
|
||||
const Property *prop = opaque;
|
||||
uint64_t *ptr = object_field_prop_ptr(obj, prop);
|
||||
|
||||
visit_type_uint64(v, name, ptr, errp);
|
||||
if (!visit_type_uint64(v, name, ptr, errp)) {
|
||||
return;
|
||||
}
|
||||
if (*ptr & ~prop->bitmask) {
|
||||
error_setg(errp, "Property value for '%s' has bits outside mask '0x%" PRIx64 "'",
|
||||
name, prop->bitmask);
|
||||
|
||||
@@ -654,7 +654,7 @@ void x86_load_linux(X86MachineState *x86ms,
|
||||
uint8_t header[8192], *setup, *kernel;
|
||||
hwaddr real_addr, prot_addr, cmdline_addr, initrd_addr = 0;
|
||||
FILE *f;
|
||||
char *vmode;
|
||||
const char *vmode;
|
||||
MachineState *machine = MACHINE(x86ms);
|
||||
struct setup_data *setup_data;
|
||||
const char *kernel_filename = machine->kernel_filename;
|
||||
|
||||
+5
-4
@@ -986,7 +986,7 @@ static void virtio_net_set_features(VirtIODevice *vdev,
|
||||
virtio_has_feature_ex(vdev->guest_features_ex,
|
||||
VIRTIO_NET_F_CTRL_VLAN)) {
|
||||
bool vlan = virtio_has_feature_ex(features, VIRTIO_NET_F_CTRL_VLAN);
|
||||
memset(n->vlans, vlan ? 0 : 0xff, sizeof(n->vlans));
|
||||
memset(n->vlans, vlan ? 0 : 0xff, MAX_VLAN >> 3);
|
||||
}
|
||||
|
||||
if (virtio_has_feature_ex(features, VIRTIO_NET_F_STANDBY)) {
|
||||
@@ -3598,8 +3598,7 @@ static const VMStateDescription vmstate_virtio_net_device = {
|
||||
* buffer; hold onto your endiannesses; it's actually used as a bitmap
|
||||
* but based on the uint.
|
||||
*/
|
||||
VMSTATE_BUFFER_UNSAFE(vlans, VirtIONet, 0,
|
||||
sizeof(typeof_field(VirtIONet, vlans))),
|
||||
VMSTATE_BUFFER_POINTER_UNSAFE(vlans, VirtIONet, 0, MAX_VLAN >> 3),
|
||||
VMSTATE_WITH_TMP(VirtIONet, struct VirtIONetMigTmp,
|
||||
vmstate_virtio_net_has_vnet),
|
||||
VMSTATE_UINT8(mac_table.multi_overflow, VirtIONet),
|
||||
@@ -4017,7 +4016,8 @@ static void virtio_net_device_realize(DeviceState *dev, Error **errp)
|
||||
|
||||
n->mac_table.macs = g_malloc0(MAC_TABLE_ENTRIES * ETH_ALEN);
|
||||
|
||||
memset(n->vlans, 0xff, sizeof(n->vlans));
|
||||
n->vlans = g_malloc0(MAX_VLAN >> 3);
|
||||
memset(n->vlans, 0xff, MAX_VLAN >> 3);
|
||||
|
||||
nc = qemu_get_queue(n->nic);
|
||||
nc->rxfilter_notify_enabled = 1;
|
||||
@@ -4066,6 +4066,7 @@ static void virtio_net_device_unrealize(DeviceState *dev)
|
||||
n->netclient_type = NULL;
|
||||
|
||||
g_free(n->mac_table.macs);
|
||||
g_free(n->vlans);
|
||||
|
||||
if (n->failover) {
|
||||
qobject_unref(n->primary_opts);
|
||||
|
||||
+114
-92
@@ -147,8 +147,7 @@ VFIOUserFDs *vfio_user_getfds(int numfds)
|
||||
/*
|
||||
* Process a received message.
|
||||
*/
|
||||
static void vfio_user_process(VFIOUserProxy *proxy, VFIOUserMsg *msg,
|
||||
bool isreply)
|
||||
static void vfio_user_process(VFIOUserProxy *proxy, VFIOUserMsg *msg)
|
||||
{
|
||||
|
||||
/*
|
||||
@@ -157,7 +156,7 @@ static void vfio_user_process(VFIOUserProxy *proxy, VFIOUserMsg *msg,
|
||||
*
|
||||
* Requests get queued for the BH.
|
||||
*/
|
||||
if (isreply) {
|
||||
if ((msg->hdr->flags & VFIO_USER_TYPE) == VFIO_USER_REPLY) {
|
||||
msg->complete = true;
|
||||
if (msg->type == VFIO_MSG_WAIT) {
|
||||
qemu_cond_signal(&msg->cv);
|
||||
@@ -187,7 +186,6 @@ static int vfio_user_complete(VFIOUserProxy *proxy, Error **errp)
|
||||
{
|
||||
VFIOUserMsg *msg = proxy->part_recv;
|
||||
size_t msgleft = proxy->recv_left;
|
||||
bool isreply;
|
||||
char *data;
|
||||
int ret;
|
||||
|
||||
@@ -214,13 +212,67 @@ static int vfio_user_complete(VFIOUserProxy *proxy, Error **errp)
|
||||
*/
|
||||
proxy->part_recv = NULL;
|
||||
proxy->recv_left = 0;
|
||||
isreply = (msg->hdr->flags & VFIO_USER_TYPE) == VFIO_USER_REPLY;
|
||||
vfio_user_process(proxy, msg, isreply);
|
||||
vfio_user_process(proxy, msg);
|
||||
|
||||
/* return positive value */
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int vfio_user_recv_hdr(VFIOUserProxy *proxy, Error **errp,
|
||||
VFIOUserHdr *hdr, int **fdp, size_t *numfdp,
|
||||
bool *isreply)
|
||||
{
|
||||
struct iovec iov = {
|
||||
.iov_base = hdr,
|
||||
.iov_len = sizeof(*hdr),
|
||||
};
|
||||
int ret;
|
||||
|
||||
/*
|
||||
* Read header
|
||||
*/
|
||||
ret = qio_channel_readv_full(proxy->ioc, &iov, 1, fdp, numfdp, 0,
|
||||
errp);
|
||||
if (ret == QIO_CHANNEL_ERR_BLOCK) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (ret < 0) {
|
||||
error_setg_errno(errp, errno, "failed to read header");
|
||||
return -1;
|
||||
} else if (ret == 0) {
|
||||
error_setg(errp, "failed to read header: EOF");
|
||||
return -1;
|
||||
} else if (ret < sizeof(*hdr)) {
|
||||
error_setg(errp, "short read of header");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Validate header
|
||||
*/
|
||||
if (hdr->size < sizeof(*hdr)) {
|
||||
error_setg(errp, "bad header size");
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch (hdr->flags & VFIO_USER_TYPE) {
|
||||
case VFIO_USER_REQUEST:
|
||||
*isreply = false;
|
||||
break;
|
||||
case VFIO_USER_REPLY:
|
||||
*isreply = true;
|
||||
break;
|
||||
default:
|
||||
error_setg(errp, "unknown message type");
|
||||
return -1;
|
||||
}
|
||||
|
||||
trace_vfio_user_recv_hdr(proxy->sockname, hdr->id, hdr->command, hdr->size,
|
||||
hdr->flags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Receive and process one incoming message.
|
||||
*
|
||||
@@ -229,19 +281,14 @@ static int vfio_user_complete(VFIOUserProxy *proxy, Error **errp)
|
||||
*/
|
||||
static int vfio_user_recv_one(VFIOUserProxy *proxy, Error **errp)
|
||||
{
|
||||
VFIOUserMsg *msg = NULL;
|
||||
g_autofree int *fdp = NULL;
|
||||
VFIOUserFDs *reqfds;
|
||||
VFIOUserHdr hdr;
|
||||
struct iovec iov = {
|
||||
.iov_base = &hdr,
|
||||
.iov_len = sizeof(hdr),
|
||||
};
|
||||
VFIOUserMsg *msg = NULL;
|
||||
bool isreply = false;
|
||||
int i, ret;
|
||||
size_t msgleft, numfds = 0;
|
||||
size_t msgleft = 0;
|
||||
size_t numfds = 0;
|
||||
char *data = NULL;
|
||||
char *buf = NULL;
|
||||
VFIOUserHdr hdr;
|
||||
int i, ret;
|
||||
|
||||
/*
|
||||
* Complete any partial reads
|
||||
@@ -260,49 +307,17 @@ static int vfio_user_recv_one(VFIOUserProxy *proxy, Error **errp)
|
||||
/* else fall into reading another msg */
|
||||
}
|
||||
|
||||
/*
|
||||
* Read header
|
||||
*/
|
||||
ret = qio_channel_readv_full(proxy->ioc, &iov, 1, &fdp, &numfds, 0,
|
||||
errp);
|
||||
if (ret == QIO_CHANNEL_ERR_BLOCK) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* read error or other side closed connection */
|
||||
if (ret <= 0) {
|
||||
goto fatal;
|
||||
}
|
||||
|
||||
if (ret < sizeof(hdr)) {
|
||||
error_setg(errp, "short read of header");
|
||||
ret = vfio_user_recv_hdr(proxy, errp, &hdr, &fdp, &numfds, &isreply);
|
||||
if (ret < 0) {
|
||||
if (ret == QIO_CHANNEL_ERR_BLOCK) {
|
||||
return ret;
|
||||
}
|
||||
goto fatal;
|
||||
}
|
||||
|
||||
/*
|
||||
* Validate header
|
||||
*/
|
||||
if (hdr.size < sizeof(VFIOUserHdr)) {
|
||||
error_setg(errp, "bad header size");
|
||||
goto fatal;
|
||||
}
|
||||
switch (hdr.flags & VFIO_USER_TYPE) {
|
||||
case VFIO_USER_REQUEST:
|
||||
isreply = false;
|
||||
break;
|
||||
case VFIO_USER_REPLY:
|
||||
isreply = true;
|
||||
break;
|
||||
default:
|
||||
error_setg(errp, "unknown message type");
|
||||
goto fatal;
|
||||
}
|
||||
trace_vfio_user_recv_hdr(proxy->sockname, hdr.id, hdr.command, hdr.size,
|
||||
hdr.flags);
|
||||
|
||||
/*
|
||||
* For replies, find the matching pending request.
|
||||
* For requests, reap incoming FDs.
|
||||
* Find the matching request if this is a reply, or initialize a new
|
||||
* server->client request.
|
||||
*/
|
||||
if (isreply) {
|
||||
QTAILQ_FOREACH(msg, &proxy->pending, next) {
|
||||
@@ -316,56 +331,52 @@ static int vfio_user_recv_one(VFIOUserProxy *proxy, Error **errp)
|
||||
}
|
||||
QTAILQ_REMOVE(&proxy->pending, msg, next);
|
||||
|
||||
/*
|
||||
* Process any received FDs
|
||||
*/
|
||||
if (numfds != 0) {
|
||||
if (msg->fds == NULL || msg->fds->recv_fds < numfds) {
|
||||
error_setg(errp, "unexpected FDs");
|
||||
goto err;
|
||||
}
|
||||
msg->fds->recv_fds = numfds;
|
||||
memcpy(msg->fds->fds, fdp, numfds * sizeof(int));
|
||||
}
|
||||
} else {
|
||||
if (numfds != 0) {
|
||||
reqfds = vfio_user_getfds(numfds);
|
||||
memcpy(reqfds->fds, fdp, numfds * sizeof(int));
|
||||
} else {
|
||||
reqfds = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Put the whole message into a single buffer.
|
||||
*/
|
||||
if (isreply) {
|
||||
if (hdr.size > msg->rsize) {
|
||||
error_setg(errp, "reply larger than recv buffer");
|
||||
goto err;
|
||||
}
|
||||
*msg->hdr = hdr;
|
||||
data = (char *)msg->hdr + sizeof(hdr);
|
||||
} else {
|
||||
void *buf;
|
||||
|
||||
if (hdr.size > proxy->max_xfer_size + sizeof(VFIOUserDMARW)) {
|
||||
error_setg(errp, "vfio_user_recv request larger than max");
|
||||
goto err;
|
||||
}
|
||||
|
||||
buf = g_malloc0(hdr.size);
|
||||
memcpy(buf, &hdr, sizeof(hdr));
|
||||
data = buf + sizeof(hdr);
|
||||
msg = vfio_user_getmsg(proxy, (VFIOUserHdr *)buf, reqfds);
|
||||
msg = vfio_user_getmsg(proxy, buf, NULL);
|
||||
msg->type = VFIO_MSG_REQ;
|
||||
}
|
||||
|
||||
*msg->hdr = hdr;
|
||||
data = (char *)msg->hdr + sizeof(hdr);
|
||||
|
||||
if (numfds != 0) {
|
||||
if (msg->type == VFIO_MSG_REQ) {
|
||||
msg->fds = vfio_user_getfds(numfds);
|
||||
} else {
|
||||
if (msg->fds == NULL || msg->fds->recv_fds < numfds) {
|
||||
error_setg(errp, "unexpected FDs in reply");
|
||||
goto err;
|
||||
}
|
||||
msg->fds->recv_fds = numfds;
|
||||
}
|
||||
|
||||
memcpy(msg->fds->fds, fdp, numfds * sizeof(int));
|
||||
}
|
||||
|
||||
/*
|
||||
* Read rest of message.
|
||||
* Read rest of message into the data buffer.
|
||||
*/
|
||||
|
||||
msgleft = hdr.size - sizeof(hdr);
|
||||
while (msgleft > 0) {
|
||||
ret = qio_channel_read(proxy->ioc, data, msgleft, errp);
|
||||
|
||||
/* prepare to complete read on next iternation */
|
||||
/*
|
||||
* We'll complete this read on the next go around; keep track of the
|
||||
* partial message until then.
|
||||
*/
|
||||
if (ret == QIO_CHANNEL_ERR_BLOCK) {
|
||||
proxy->part_recv = msg;
|
||||
proxy->recv_left = msgleft;
|
||||
@@ -381,7 +392,7 @@ static int vfio_user_recv_one(VFIOUserProxy *proxy, Error **errp)
|
||||
data += ret;
|
||||
}
|
||||
|
||||
vfio_user_process(proxy, msg, isreply);
|
||||
vfio_user_process(proxy, msg);
|
||||
return 0;
|
||||
|
||||
/*
|
||||
@@ -401,11 +412,22 @@ err:
|
||||
for (i = 0; i < numfds; i++) {
|
||||
close(fdp[i]);
|
||||
}
|
||||
if (isreply && msg != NULL) {
|
||||
/* force an error to keep sending thread from hanging */
|
||||
vfio_user_set_error(msg->hdr, EINVAL);
|
||||
msg->complete = true;
|
||||
qemu_cond_signal(&msg->cv);
|
||||
if (msg != NULL) {
|
||||
if (msg->type == VFIO_MSG_REQ) {
|
||||
/*
|
||||
* Clean up the request message on failure. Change type back to
|
||||
* NOWAIT to free.
|
||||
*/
|
||||
msg->type = VFIO_MSG_NOWAIT;
|
||||
vfio_user_recycle(proxy, msg);
|
||||
} else {
|
||||
/*
|
||||
* Report an error back to the sender. Sender will recycle msg.
|
||||
*/
|
||||
vfio_user_set_error(msg->hdr, EINVAL);
|
||||
msg->complete = true;
|
||||
qemu_cond_signal(&msg->cv);
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
+23
-15
@@ -1261,7 +1261,7 @@ int vhost_virtqueue_start(struct vhost_dev *dev,
|
||||
BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev)));
|
||||
VirtioBusState *vbus = VIRTIO_BUS(qbus);
|
||||
VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(vbus);
|
||||
hwaddr s, l, a;
|
||||
hwaddr l;
|
||||
int r;
|
||||
int vhost_vq_index = dev->vhost_ops->vhost_get_vq_index(dev, idx);
|
||||
struct vhost_vring_file file = {
|
||||
@@ -1272,8 +1272,17 @@ int vhost_virtqueue_start(struct vhost_dev *dev,
|
||||
};
|
||||
struct VirtQueue *vvq = virtio_get_queue(vdev, idx);
|
||||
|
||||
a = virtio_queue_get_desc_addr(vdev, idx);
|
||||
if (a == 0) {
|
||||
vq->desc_size = virtio_queue_get_desc_size(vdev, idx);
|
||||
vq->desc_phys = virtio_queue_get_desc_addr(vdev, idx);
|
||||
vq->desc = NULL;
|
||||
vq->avail_size = virtio_queue_get_avail_size(vdev, idx);
|
||||
vq->avail_phys = virtio_queue_get_avail_addr(vdev, idx);
|
||||
vq->avail = NULL;
|
||||
vq->used_size = virtio_queue_get_used_size(vdev, idx);
|
||||
vq->used_phys = virtio_queue_get_used_addr(vdev, idx);
|
||||
vq->used = NULL;
|
||||
|
||||
if (vq->desc_phys == 0) {
|
||||
/* Queue might not be ready for start */
|
||||
return 0;
|
||||
}
|
||||
@@ -1301,24 +1310,23 @@ int vhost_virtqueue_start(struct vhost_dev *dev,
|
||||
}
|
||||
}
|
||||
|
||||
vq->desc_size = s = l = virtio_queue_get_desc_size(vdev, idx);
|
||||
vq->desc_phys = a;
|
||||
vq->desc = vhost_memory_map(dev, a, &l, false);
|
||||
if (!vq->desc || l != s) {
|
||||
l = vq->desc_size;
|
||||
vq->desc = vhost_memory_map(dev, vq->desc_phys, &l, false);
|
||||
if (!vq->desc || l != vq->desc_size) {
|
||||
r = -ENOMEM;
|
||||
goto fail_alloc_desc;
|
||||
}
|
||||
vq->avail_size = s = l = virtio_queue_get_avail_size(vdev, idx);
|
||||
vq->avail_phys = a = virtio_queue_get_avail_addr(vdev, idx);
|
||||
vq->avail = vhost_memory_map(dev, a, &l, false);
|
||||
if (!vq->avail || l != s) {
|
||||
|
||||
l = vq->avail_size;
|
||||
vq->avail = vhost_memory_map(dev, vq->avail_phys, &l, false);
|
||||
if (!vq->avail || l != vq->avail_size) {
|
||||
r = -ENOMEM;
|
||||
goto fail_alloc_avail;
|
||||
}
|
||||
vq->used_size = s = l = virtio_queue_get_used_size(vdev, idx);
|
||||
vq->used_phys = a = virtio_queue_get_used_addr(vdev, idx);
|
||||
vq->used = vhost_memory_map(dev, a, &l, true);
|
||||
if (!vq->used || l != s) {
|
||||
|
||||
l = vq->used_size;
|
||||
vq->used = vhost_memory_map(dev, vq->used_phys, &l, true);
|
||||
if (!vq->used || l != vq->used_size) {
|
||||
r = -ENOMEM;
|
||||
goto fail_alloc_used;
|
||||
}
|
||||
|
||||
@@ -751,7 +751,7 @@ int pci_iommu_register_iotlb_notifier(PCIDevice *dev, uint32_t pasid,
|
||||
|
||||
/**
|
||||
* pci_iommu_unregister_iotlb_notifier: unregister a notifier that has been
|
||||
* registerd with pci_iommu_register_iotlb_notifier.
|
||||
* registered with pci_iommu_register_iotlb_notifier.
|
||||
*
|
||||
* Returns 0 on success, or a negative errno otherwise.
|
||||
*
|
||||
|
||||
@@ -202,7 +202,7 @@ struct VirtIONet {
|
||||
uint8_t uni_overflow;
|
||||
uint8_t *macs;
|
||||
} mac_table;
|
||||
uint32_t vlans[MAX_VLAN];
|
||||
uint32_t *vlans;
|
||||
virtio_net_conf net_conf;
|
||||
NICConf nic_conf;
|
||||
DeviceState *qdev;
|
||||
|
||||
@@ -727,6 +727,15 @@ extern const VMStateInfo vmstate_info_qlist;
|
||||
.offset = offsetof(_state, _field), \
|
||||
}
|
||||
|
||||
#define VMSTATE_BUFFER_POINTER_UNSAFE(_field, _state, _version, _size) { \
|
||||
.name = (stringify(_field)), \
|
||||
.version_id = (_version), \
|
||||
.size = (_size), \
|
||||
.info = &vmstate_info_buffer, \
|
||||
.flags = VMS_BUFFER | VMS_POINTER, \
|
||||
.offset = offsetof(_state, _field), \
|
||||
}
|
||||
|
||||
/* Allocate a temporary of type 'tmp_type', set tmp->parent to _state
|
||||
* and execute the vmsd on the temporary. Note that we're working with
|
||||
* the whole of _state here, not a field within it.
|
||||
|
||||
@@ -141,6 +141,12 @@ QEMU_EXTERN_C int daemon(int, int);
|
||||
#undef ELF_DATA
|
||||
#undef ELF_ARCH
|
||||
|
||||
/*
|
||||
* Avoid conflict with Solaris FSCALE definition from <sys/param.h> header,
|
||||
* but we might as well do this unconditionally.
|
||||
*/
|
||||
#undef FSCALE
|
||||
|
||||
#ifdef CONFIG_IOVEC
|
||||
#include <sys/uio.h>
|
||||
#endif
|
||||
|
||||
@@ -10,7 +10,19 @@
|
||||
#define TCG_HELPER_INFO_H
|
||||
|
||||
#ifdef CONFIG_TCG_INTERPRETER
|
||||
/*
|
||||
* MacOSX 15 uses an old version of libffi which contains
|
||||
* #if FFI_GO_CLOSURES
|
||||
* but does not define that in <ffitarget.h>, included from <ffi.h>.
|
||||
* This was fixed upstream with
|
||||
* https://github.com/libffi/libffi/commit/c23e9a1c
|
||||
* We don't care about go closures one way or the other;
|
||||
* just suppress the warning.
|
||||
*/
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wundef"
|
||||
#include <ffi.h>
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#include "tcg-target-reg-bits.h"
|
||||
|
||||
|
||||
+1
-1
@@ -450,7 +450,7 @@ static void multifd_send_set_error(Error *err)
|
||||
*/
|
||||
static void migration_ioc_shutdown_gracefully(QIOChannel *ioc)
|
||||
{
|
||||
g_autoptr(Error) local_err = NULL;
|
||||
Error *local_err = NULL;
|
||||
|
||||
if (!migration_has_failed(migrate_get_current()) &&
|
||||
object_dynamic_cast((Object *)ioc, TYPE_QIO_CHANNEL_TLS)) {
|
||||
|
||||
@@ -1467,7 +1467,8 @@ retry:
|
||||
static int postcopy_temp_pages_setup(MigrationIncomingState *mis)
|
||||
{
|
||||
PostcopyTmpPage *tmp_page;
|
||||
int err, i, channels;
|
||||
int err;
|
||||
unsigned i, channels;
|
||||
void *temp_page;
|
||||
|
||||
if (migrate_postcopy_preempt()) {
|
||||
@@ -1479,7 +1480,7 @@ static int postcopy_temp_pages_setup(MigrationIncomingState *mis)
|
||||
}
|
||||
|
||||
channels = mis->postcopy_channels;
|
||||
mis->postcopy_tmp_pages = g_malloc0_n(sizeof(PostcopyTmpPage), channels);
|
||||
mis->postcopy_tmp_pages = g_new0(PostcopyTmpPage, channels);
|
||||
|
||||
for (i = 0; i < channels; i++) {
|
||||
tmp_page = &mis->postcopy_tmp_pages[i];
|
||||
|
||||
+3
-2
@@ -577,10 +577,11 @@ static const char *get_command_name(const char *cmdline,
|
||||
* Read key of 'type' into 'key' and return the current
|
||||
* 'type' pointer.
|
||||
*/
|
||||
static char *key_get_info(const char *type, char **key)
|
||||
static const char *key_get_info(const char *type, char **key)
|
||||
{
|
||||
size_t len;
|
||||
char *p, *str;
|
||||
const char *p;
|
||||
char *str;
|
||||
|
||||
if (*type == ',') {
|
||||
type++;
|
||||
|
||||
@@ -119,6 +119,7 @@ static void plugin_vcpu_cb__discon(CPUState *cpu,
|
||||
struct qemu_plugin_cb *cb, *next;
|
||||
uint64_t to = cpu->cc->get_pc(cpu);
|
||||
|
||||
qemu_plugin_set_cb_flags(cpu, QEMU_PLUGIN_CB_RW_REGS);
|
||||
if (cpu->cpu_index < plugin.num_vcpus) {
|
||||
/* iterate safely; plugins might uninstall themselves at any time */
|
||||
QLIST_FOREACH_SAFE_RCU(cb, &plugin.cb_lists[ev], entry, next) {
|
||||
@@ -127,6 +128,7 @@ static void plugin_vcpu_cb__discon(CPUState *cpu,
|
||||
func(cb->ctx->id, cpu->cpu_index, type, from, to);
|
||||
}
|
||||
}
|
||||
qemu_plugin_set_cb_flags(cpu, QEMU_PLUGIN_CB_NO_REGS);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -403,7 +403,8 @@ static bool build_guest_fsinfo_for_pci_dev(char const *syspath,
|
||||
int i, offset, nhosts = 0, pcilen;
|
||||
GuestPCIAddress *pciaddr = disk->pci_controller;
|
||||
bool has_ata = false, has_host = false, has_tgt = false;
|
||||
char *p, *driver = NULL;
|
||||
const char *p;
|
||||
char *driver = NULL;
|
||||
bool ret = false;
|
||||
|
||||
p = strstr(syspath, "/devices/pci");
|
||||
@@ -543,7 +544,7 @@ static bool build_guest_fsinfo_for_nonpci_virtio(char const *syspath,
|
||||
Error **errp)
|
||||
{
|
||||
unsigned int tgt[3];
|
||||
char *p;
|
||||
const char *p;
|
||||
|
||||
if (!strstr(syspath, "/virtio") || !strstr(syspath, "/block")) {
|
||||
g_debug("Unsupported virtio device '%s'", syspath);
|
||||
@@ -575,7 +576,7 @@ static bool build_guest_fsinfo_for_ccw_dev(char const *syspath,
|
||||
Error **errp)
|
||||
{
|
||||
unsigned int cssid, ssid, subchno, devno;
|
||||
char *p;
|
||||
const char *p;
|
||||
|
||||
p = strstr(syspath, "/devices/css");
|
||||
if (!p || sscanf(p + 12, "%*x/%x.%x.%x/%*x.%*x.%x/",
|
||||
|
||||
@@ -41,7 +41,7 @@ def main(args):
|
||||
for obj in args:
|
||||
entry = compile_commands.get(obj, None)
|
||||
if not entry:
|
||||
sys.stderr.print('modinfo: Could not find object file', obj)
|
||||
sys.stderr.write(f'modinfo: Could not find object file {obj}')
|
||||
sys.exit(1)
|
||||
src = entry['file']
|
||||
if not src.endswith('.c'):
|
||||
|
||||
+1
-1
@@ -114,7 +114,7 @@ def main():
|
||||
"-DSRCDIR=" + args.srcdir,
|
||||
"-DBINDIR=" + destdir + prefix,
|
||||
]
|
||||
if args.cpu == "x86_64":
|
||||
if args.cpu == "aarch64" or args.cpu == "x86_64":
|
||||
makensis += ["-DW64"]
|
||||
makensis += ["-DDLLDIR=" + dlldir]
|
||||
|
||||
|
||||
@@ -1935,13 +1935,14 @@ static int hvf_handle_exception(CPUState *cpu, hv_vcpu_exit_exception_t *excp)
|
||||
break;
|
||||
case EC_AA64_HVC:
|
||||
cpu_synchronize_state(cpu);
|
||||
if (arm_is_psci_call(arm_cpu, EXCP_HVC)) {
|
||||
if (arm_cpu->psci_conduit == QEMU_PSCI_CONDUIT_HVC) {
|
||||
/* Do NOT advance $pc for HVC */
|
||||
if (!hvf_handle_psci_call(cpu)) {
|
||||
trace_hvf_unknown_hvc(env->pc, env->xregs[0]);
|
||||
/* SMCCC 1.3 section 5.2 says every unknown SMCCC call returns -1 */
|
||||
env->xregs[0] = -1;
|
||||
}
|
||||
cpu->vcpu_dirty = true;
|
||||
} else {
|
||||
trace_hvf_unknown_hvc(env->pc, env->xregs[0]);
|
||||
hvf_raise_exception(cpu, EXCP_UDEF, syn_uncategorized(), 1);
|
||||
@@ -1949,7 +1950,7 @@ static int hvf_handle_exception(CPUState *cpu, hv_vcpu_exit_exception_t *excp)
|
||||
break;
|
||||
case EC_AA64_SMC:
|
||||
cpu_synchronize_state(cpu);
|
||||
if (arm_is_psci_call(arm_cpu, EXCP_SMC)) {
|
||||
if (arm_cpu->psci_conduit == QEMU_PSCI_CONDUIT_SMC) {
|
||||
/* Secure Monitor Call exception, we need to advance $pc */
|
||||
advance_pc = true;
|
||||
|
||||
@@ -1958,6 +1959,7 @@ static int hvf_handle_exception(CPUState *cpu, hv_vcpu_exit_exception_t *excp)
|
||||
/* SMCCC 1.3 section 5.2 says every unknown SMCCC call returns -1 */
|
||||
env->xregs[0] = -1;
|
||||
}
|
||||
cpu->vcpu_dirty = true;
|
||||
} else {
|
||||
trace_hvf_unknown_smc(env->xregs[0]);
|
||||
hvf_raise_exception(cpu, EXCP_UDEF, syn_uncategorized(), 1);
|
||||
@@ -1980,10 +1982,12 @@ static int hvf_handle_exception(CPUState *cpu, hv_vcpu_exit_exception_t *excp)
|
||||
error_report("0x%llx: unhandled exception ec=0x%x", env->pc, ec);
|
||||
}
|
||||
|
||||
/* flush any changed cpu state back to HVF */
|
||||
flush_cpu_state(cpu);
|
||||
|
||||
if (advance_pc) {
|
||||
uint64_t pc;
|
||||
|
||||
flush_cpu_state(cpu);
|
||||
|
||||
r = hv_vcpu_get_reg(cpu->accel->fd, HV_REG_PC, &pc);
|
||||
assert_hvf_ok(r);
|
||||
@@ -2016,6 +2020,7 @@ static int hvf_handle_vmexit(CPUState *cpu, hv_vcpu_exit_t *exit)
|
||||
break;
|
||||
case HV_EXIT_REASON_CANCELED:
|
||||
/* we got kicked, no exit to process */
|
||||
ret = -1;
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached();
|
||||
|
||||
@@ -250,7 +250,11 @@ void arm_deliver_fault(ARMCPU *cpu, vaddr addr,
|
||||
fsr = compute_fsr_fsc(env, fi, target_el, mmu_idx, &fsc);
|
||||
|
||||
if (access_type == MMU_INST_FETCH) {
|
||||
syn = syn_insn_abort(same_el, fi->ea, fi->s1ptw, fsc);
|
||||
if (fi->type == ARMFault_Alignment) {
|
||||
syn = syn_pcalignment();
|
||||
} else {
|
||||
syn = syn_insn_abort(same_el, fi->ea, fi->s1ptw, fsc);
|
||||
}
|
||||
exc = EXCP_PREFETCH_ABORT;
|
||||
} else {
|
||||
bool gcs = regime_is_gcs(core_to_arm_mmu_idx(env, mmu_idx));
|
||||
@@ -346,11 +350,18 @@ bool arm_cpu_tlb_fill_align(CPUState *cs, CPUTLBEntryFull *out, vaddr address,
|
||||
}
|
||||
|
||||
/*
|
||||
* Per R_XCHFJ, alignment fault not due to memory type has
|
||||
* highest precedence. Otherwise, walk the page table and
|
||||
* and collect the page description.
|
||||
* PC alignment faults should be dealt with at translation time
|
||||
* but we also need to catch them while being probed.
|
||||
*
|
||||
* Then per R_XCHFJ, alignment fault not due to memory type take
|
||||
* precedence. Otherwise, walk the page table and and collect the
|
||||
* page description.
|
||||
*
|
||||
*/
|
||||
if (address & ((1 << memop_alignment_bits(memop)) - 1)) {
|
||||
if (access_type == MMU_INST_FETCH && !cpu->env.thumb &&
|
||||
(address & 3)) {
|
||||
fi->type = ARMFault_Alignment;
|
||||
} else if (address & ((1 << memop_alignment_bits(memop)) - 1)) {
|
||||
fi->type = ARMFault_Alignment;
|
||||
} else if (!get_phys_addr(&cpu->env, address, access_type, memop,
|
||||
core_to_arm_mmu_idx(&cpu->env, mmu_idx),
|
||||
|
||||
@@ -1916,8 +1916,8 @@ static bool trans_BRA(DisasContext *s, arg_bra *a)
|
||||
return false;
|
||||
}
|
||||
dst = auth_branch_target(s, cpu_reg(s,a->rn), cpu_reg_sp(s, a->rm), !a->m);
|
||||
gen_a64_set_pc(s, dst);
|
||||
set_btype_for_br(s, a->rn);
|
||||
gen_a64_set_pc(s, dst);
|
||||
s->base.is_jmp = DISAS_JUMP;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -728,7 +728,8 @@ static int hvf_handle_vmexit(CPUState *cpu)
|
||||
uint64_t exit_qual = rvmcs(cpu->accel->fd, VMCS_EXIT_QUALIFICATION);
|
||||
uint32_t ins_len = (uint32_t)rvmcs(cpu->accel->fd,
|
||||
VMCS_EXIT_INSTRUCTION_LENGTH);
|
||||
|
||||
CPUX86State *env = &x86_cpu->env;
|
||||
uint64_t rip = 0;
|
||||
uint64_t idtvec_info = rvmcs(cpu->accel->fd, VMCS_IDT_VECTORING_INFO);
|
||||
int ret = 0;
|
||||
|
||||
@@ -966,10 +967,7 @@ static int hvf_handle_vmexit(CPUState *cpu)
|
||||
|
||||
int hvf_arch_vcpu_exec(CPUState *cpu)
|
||||
{
|
||||
X86CPU *x86_cpu = X86_CPU(cpu);
|
||||
CPUX86State *env = &x86_cpu->env;
|
||||
int ret = 0;
|
||||
uint64_t rip = 0;
|
||||
|
||||
if (hvf_process_events(cpu)) {
|
||||
return EXCP_HLT;
|
||||
|
||||
+72
-24
@@ -135,6 +135,30 @@ static void tcg_gen_req_mo(TCGBar type)
|
||||
}
|
||||
}
|
||||
|
||||
static TCGTemp *tci_extend_addr(TCGTemp *addr)
|
||||
{
|
||||
#ifdef CONFIG_TCG_INTERPRETER
|
||||
/*
|
||||
* 64-bit interpreter requires 64-bit addresses.
|
||||
* Compare to the extension performed by tcg_out_{ld,st}_helper_args
|
||||
* for native code generation.
|
||||
*/
|
||||
if (TCG_TARGET_REG_BITS == 64 && tcg_ctx->addr_type == TCG_TYPE_I32) {
|
||||
TCGv_i64 temp = tcg_temp_ebb_new_i64();
|
||||
tcg_gen_extu_i32_i64(temp, temp_tcgv_i32(addr));
|
||||
return tcgv_i64_temp(temp);
|
||||
}
|
||||
#endif
|
||||
return addr;
|
||||
}
|
||||
|
||||
static void maybe_free_addr(TCGTemp *addr, TCGTemp *copy)
|
||||
{
|
||||
if (addr != copy) {
|
||||
tcg_temp_free_internal(copy);
|
||||
}
|
||||
}
|
||||
|
||||
/* Only required for loads, where value might overlap addr. */
|
||||
static TCGv_i64 plugin_maybe_preserve_addr(TCGTemp *addr)
|
||||
{
|
||||
@@ -158,23 +182,21 @@ static void
|
||||
plugin_gen_mem_callbacks(TCGv_i64 copy_addr, TCGTemp *orig_addr, MemOpIdx oi,
|
||||
enum qemu_plugin_mem_rw rw)
|
||||
{
|
||||
if (tcg_ctx->plugin_insn != NULL) {
|
||||
qemu_plugin_meminfo_t info = make_plugin_meminfo(oi, rw);
|
||||
qemu_plugin_meminfo_t info = make_plugin_meminfo(oi, rw);
|
||||
|
||||
if (tcg_ctx->addr_type == TCG_TYPE_I32) {
|
||||
if (!copy_addr) {
|
||||
copy_addr = tcg_temp_ebb_new_i64();
|
||||
tcg_gen_extu_i32_i64(copy_addr, temp_tcgv_i32(orig_addr));
|
||||
}
|
||||
if (tcg_ctx->addr_type == TCG_TYPE_I32) {
|
||||
if (!copy_addr) {
|
||||
copy_addr = tcg_temp_ebb_new_i64();
|
||||
tcg_gen_extu_i32_i64(copy_addr, temp_tcgv_i32(orig_addr));
|
||||
}
|
||||
tcg_gen_plugin_mem_cb(copy_addr, info);
|
||||
tcg_temp_free_i64(copy_addr);
|
||||
} else {
|
||||
if (copy_addr) {
|
||||
tcg_gen_plugin_mem_cb(copy_addr, info);
|
||||
tcg_temp_free_i64(copy_addr);
|
||||
} else {
|
||||
if (copy_addr) {
|
||||
tcg_gen_plugin_mem_cb(copy_addr, info);
|
||||
tcg_temp_free_i64(copy_addr);
|
||||
} else {
|
||||
tcg_gen_plugin_mem_cb(temp_tcgv_i64(orig_addr), info);
|
||||
}
|
||||
tcg_gen_plugin_mem_cb(temp_tcgv_i64(orig_addr), info);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -234,6 +256,7 @@ static void tcg_gen_qemu_ld_i32_int(TCGv_i32 val, TCGTemp *addr,
|
||||
MemOp orig_memop;
|
||||
MemOpIdx orig_oi, oi;
|
||||
TCGv_i64 copy_addr;
|
||||
TCGTemp *addr_new;
|
||||
|
||||
tcg_gen_req_mo(TCG_MO_LD_LD | TCG_MO_ST_LD);
|
||||
orig_memop = memop = tcg_canonicalize_memop(memop, 0, 0);
|
||||
@@ -248,10 +271,12 @@ static void tcg_gen_qemu_ld_i32_int(TCGv_i32 val, TCGTemp *addr,
|
||||
oi = make_memop_idx(memop, idx);
|
||||
}
|
||||
|
||||
addr_new = tci_extend_addr(addr);
|
||||
copy_addr = plugin_maybe_preserve_addr(addr);
|
||||
gen_ldst1(INDEX_op_qemu_ld, TCG_TYPE_I32, tcgv_i32_temp(val), addr, oi);
|
||||
gen_ldst1(INDEX_op_qemu_ld, TCG_TYPE_I32, tcgv_i32_temp(val), addr_new, oi);
|
||||
plugin_gen_mem_callbacks_i32(val, copy_addr, addr, orig_oi,
|
||||
QEMU_PLUGIN_MEM_R);
|
||||
maybe_free_addr(addr, addr_new);
|
||||
|
||||
if ((orig_memop ^ memop) & MO_BSWAP) {
|
||||
switch (orig_memop & MO_SIZE) {
|
||||
@@ -282,6 +307,7 @@ static void tcg_gen_qemu_st_i32_int(TCGv_i32 val, TCGTemp *addr,
|
||||
{
|
||||
TCGv_i32 swap = NULL;
|
||||
MemOpIdx orig_oi, oi;
|
||||
TCGTemp *addr_new;
|
||||
|
||||
tcg_gen_req_mo(TCG_MO_LD_ST | TCG_MO_ST_ST);
|
||||
memop = tcg_canonicalize_memop(memop, 0, 1);
|
||||
@@ -304,8 +330,10 @@ static void tcg_gen_qemu_st_i32_int(TCGv_i32 val, TCGTemp *addr,
|
||||
oi = make_memop_idx(memop, idx);
|
||||
}
|
||||
|
||||
gen_ldst1(INDEX_op_qemu_st, TCG_TYPE_I32, tcgv_i32_temp(val), addr, oi);
|
||||
addr_new = tci_extend_addr(addr);
|
||||
gen_ldst1(INDEX_op_qemu_st, TCG_TYPE_I32, tcgv_i32_temp(val), addr_new, oi);
|
||||
plugin_gen_mem_callbacks_i32(val, NULL, addr, orig_oi, QEMU_PLUGIN_MEM_W);
|
||||
maybe_free_addr(addr, addr_new);
|
||||
|
||||
if (swap) {
|
||||
tcg_temp_free_i32(swap);
|
||||
@@ -326,6 +354,7 @@ static void tcg_gen_qemu_ld_i64_int(TCGv_i64 val, TCGTemp *addr,
|
||||
MemOp orig_memop;
|
||||
MemOpIdx orig_oi, oi;
|
||||
TCGv_i64 copy_addr;
|
||||
TCGTemp *addr_new;
|
||||
|
||||
if (TCG_TARGET_REG_BITS == 32 && (memop & MO_SIZE) < MO_64) {
|
||||
tcg_gen_qemu_ld_i32_int(TCGV_LOW(val), addr, idx, memop);
|
||||
@@ -350,10 +379,12 @@ static void tcg_gen_qemu_ld_i64_int(TCGv_i64 val, TCGTemp *addr,
|
||||
oi = make_memop_idx(memop, idx);
|
||||
}
|
||||
|
||||
addr_new = tci_extend_addr(addr);
|
||||
copy_addr = plugin_maybe_preserve_addr(addr);
|
||||
gen_ld_i64(val, addr, oi);
|
||||
gen_ld_i64(val, addr_new, oi);
|
||||
plugin_gen_mem_callbacks_i64(val, copy_addr, addr, orig_oi,
|
||||
QEMU_PLUGIN_MEM_R);
|
||||
maybe_free_addr(addr, addr_new);
|
||||
|
||||
if ((orig_memop ^ memop) & MO_BSWAP) {
|
||||
int flags = (orig_memop & MO_SIGN
|
||||
@@ -388,6 +419,7 @@ static void tcg_gen_qemu_st_i64_int(TCGv_i64 val, TCGTemp *addr,
|
||||
{
|
||||
TCGv_i64 swap = NULL;
|
||||
MemOpIdx orig_oi, oi;
|
||||
TCGTemp *addr_new;
|
||||
|
||||
if (TCG_TARGET_REG_BITS == 32 && (memop & MO_SIZE) < MO_64) {
|
||||
tcg_gen_qemu_st_i32_int(TCGV_LOW(val), addr, idx, memop);
|
||||
@@ -418,8 +450,10 @@ static void tcg_gen_qemu_st_i64_int(TCGv_i64 val, TCGTemp *addr,
|
||||
oi = make_memop_idx(memop, idx);
|
||||
}
|
||||
|
||||
gen_st_i64(val, addr, oi);
|
||||
addr_new = tci_extend_addr(addr);
|
||||
gen_st_i64(val, addr_new, oi);
|
||||
plugin_gen_mem_callbacks_i64(val, NULL, addr, orig_oi, QEMU_PLUGIN_MEM_W);
|
||||
maybe_free_addr(addr, addr_new);
|
||||
|
||||
if (swap) {
|
||||
tcg_temp_free_i64(swap);
|
||||
@@ -530,6 +564,7 @@ static void tcg_gen_qemu_ld_i128_int(TCGv_i128 val, TCGTemp *addr,
|
||||
{
|
||||
MemOpIdx orig_oi;
|
||||
TCGv_i64 ext_addr = NULL;
|
||||
TCGTemp *addr_new;
|
||||
|
||||
check_max_alignment(memop_alignment_bits(memop));
|
||||
tcg_gen_req_mo(TCG_MO_LD_LD | TCG_MO_ST_LD);
|
||||
@@ -557,8 +592,10 @@ static void tcg_gen_qemu_ld_i128_int(TCGv_i128 val, TCGTemp *addr,
|
||||
hi = TCGV128_HIGH(val);
|
||||
}
|
||||
|
||||
addr_new = tci_extend_addr(addr);
|
||||
gen_ldst2(INDEX_op_qemu_ld2, TCG_TYPE_I128, tcgv_i64_temp(lo),
|
||||
tcgv_i64_temp(hi), addr, oi);
|
||||
tcgv_i64_temp(hi), addr_new, oi);
|
||||
maybe_free_addr(addr, addr_new);
|
||||
|
||||
if (need_bswap) {
|
||||
tcg_gen_bswap64_i64(lo, lo);
|
||||
@@ -586,7 +623,9 @@ static void tcg_gen_qemu_ld_i128_int(TCGv_i128 val, TCGTemp *addr,
|
||||
y = TCGV128_LOW(val);
|
||||
}
|
||||
|
||||
gen_ld_i64(x, addr, make_memop_idx(mop[0], idx));
|
||||
addr_new = tci_extend_addr(addr);
|
||||
gen_ld_i64(x, addr_new, make_memop_idx(mop[0], idx));
|
||||
maybe_free_addr(addr, addr_new);
|
||||
|
||||
if (need_bswap) {
|
||||
tcg_gen_bswap64_i64(x, x);
|
||||
@@ -602,7 +641,9 @@ static void tcg_gen_qemu_ld_i128_int(TCGv_i128 val, TCGTemp *addr,
|
||||
addr_p8 = tcgv_i64_temp(t);
|
||||
}
|
||||
|
||||
gen_ld_i64(y, addr_p8, make_memop_idx(mop[1], idx));
|
||||
addr_new = tci_extend_addr(addr_p8);
|
||||
gen_ld_i64(y, addr_new, make_memop_idx(mop[1], idx));
|
||||
maybe_free_addr(addr_p8, addr_new);
|
||||
tcg_temp_free_internal(addr_p8);
|
||||
|
||||
if (need_bswap) {
|
||||
@@ -636,6 +677,7 @@ static void tcg_gen_qemu_st_i128_int(TCGv_i128 val, TCGTemp *addr,
|
||||
{
|
||||
MemOpIdx orig_oi;
|
||||
TCGv_i64 ext_addr = NULL;
|
||||
TCGTemp *addr_new;
|
||||
|
||||
check_max_alignment(memop_alignment_bits(memop));
|
||||
tcg_gen_req_mo(TCG_MO_ST_LD | TCG_MO_ST_ST);
|
||||
@@ -666,8 +708,10 @@ static void tcg_gen_qemu_st_i128_int(TCGv_i128 val, TCGTemp *addr,
|
||||
hi = TCGV128_HIGH(val);
|
||||
}
|
||||
|
||||
addr_new = tci_extend_addr(addr);
|
||||
gen_ldst2(INDEX_op_qemu_st2, TCG_TYPE_I128,
|
||||
tcgv_i64_temp(lo), tcgv_i64_temp(hi), addr, oi);
|
||||
tcgv_i64_temp(lo), tcgv_i64_temp(hi), addr_new, oi);
|
||||
maybe_free_addr(addr, addr_new);
|
||||
|
||||
if (need_bswap) {
|
||||
tcg_temp_free_i64(lo);
|
||||
@@ -694,7 +738,9 @@ static void tcg_gen_qemu_st_i128_int(TCGv_i128 val, TCGTemp *addr,
|
||||
x = b;
|
||||
}
|
||||
|
||||
gen_st_i64(x, addr, make_memop_idx(mop[0], idx));
|
||||
addr_new = tci_extend_addr(addr);
|
||||
gen_st_i64(x, addr_new, make_memop_idx(mop[0], idx));
|
||||
maybe_free_addr(addr, addr_new);
|
||||
|
||||
if (tcg_ctx->addr_type == TCG_TYPE_I32) {
|
||||
TCGv_i32 t = tcg_temp_ebb_new_i32();
|
||||
@@ -706,13 +752,15 @@ static void tcg_gen_qemu_st_i128_int(TCGv_i128 val, TCGTemp *addr,
|
||||
addr_p8 = tcgv_i64_temp(t);
|
||||
}
|
||||
|
||||
addr_new = tci_extend_addr(addr_p8);
|
||||
if (b) {
|
||||
tcg_gen_bswap64_i64(b, y);
|
||||
gen_st_i64(b, addr_p8, make_memop_idx(mop[1], idx));
|
||||
gen_st_i64(b, addr_new, make_memop_idx(mop[1], idx));
|
||||
tcg_temp_free_i64(b);
|
||||
} else {
|
||||
gen_st_i64(y, addr_p8, make_memop_idx(mop[1], idx));
|
||||
gen_st_i64(y, addr_new, make_memop_idx(mop[1], idx));
|
||||
}
|
||||
maybe_free_addr(addr_p8, addr_new);
|
||||
tcg_temp_free_internal(addr_p8);
|
||||
} else {
|
||||
if (tcg_ctx->addr_type == TCG_TYPE_I32) {
|
||||
|
||||
@@ -794,12 +794,24 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
|
||||
taddr = regs[r1];
|
||||
regs[r0] = tci_qemu_ld(env, taddr, oi, tb_ptr);
|
||||
break;
|
||||
case INDEX_op_tci_qemu_ld_rrr:
|
||||
tci_args_rrr(insn, &r0, &r1, &r2);
|
||||
taddr = regs[r1];
|
||||
oi = regs[r2];
|
||||
regs[r0] = tci_qemu_ld(env, taddr, oi, tb_ptr);
|
||||
break;
|
||||
|
||||
case INDEX_op_qemu_st:
|
||||
tci_args_rrm(insn, &r0, &r1, &oi);
|
||||
taddr = regs[r1];
|
||||
tci_qemu_st(env, taddr, regs[r0], oi, tb_ptr);
|
||||
break;
|
||||
case INDEX_op_tci_qemu_st_rrr:
|
||||
tci_args_rrr(insn, &r0, &r1, &r2);
|
||||
taddr = regs[r1];
|
||||
oi = regs[r2];
|
||||
tci_qemu_st(env, taddr, regs[r0], oi, tb_ptr);
|
||||
break;
|
||||
|
||||
case INDEX_op_qemu_ld2:
|
||||
tcg_debug_assert(TCG_TARGET_REG_BITS == 32);
|
||||
@@ -1050,6 +1062,13 @@ int print_insn_tci(bfd_vma addr, disassemble_info *info)
|
||||
op_name, str_r(r0), str_r(r1), oi);
|
||||
break;
|
||||
|
||||
case INDEX_op_tci_qemu_ld_rrr:
|
||||
case INDEX_op_tci_qemu_st_rrr:
|
||||
tci_args_rrr(insn, &r0, &r1, &r2);
|
||||
info->fprintf_func(info->stream, "%-12s %s, %s, %s",
|
||||
op_name, str_r(r0), str_r(r1), str_r(r2));
|
||||
break;
|
||||
|
||||
case INDEX_op_qemu_ld2:
|
||||
case INDEX_op_qemu_st2:
|
||||
tci_args_rrrr(insn, &r0, &r1, &r2, &r3);
|
||||
|
||||
@@ -13,3 +13,5 @@ DEF(tci_rotl32, 1, 2, 0, TCG_OPF_NOT_PRESENT)
|
||||
DEF(tci_rotr32, 1, 2, 0, TCG_OPF_NOT_PRESENT)
|
||||
DEF(tci_setcond32, 1, 2, 1, TCG_OPF_NOT_PRESENT)
|
||||
DEF(tci_movcond32, 1, 2, 1, TCG_OPF_NOT_PRESENT)
|
||||
DEF(tci_qemu_ld_rrr, 1, 2, 0, TCG_OPF_NOT_PRESENT)
|
||||
DEF(tci_qemu_st_rrr, 0, 3, 0, TCG_OPF_NOT_PRESENT)
|
||||
@@ -1188,7 +1188,12 @@ static const TCGOutOpStore outop_st = {
|
||||
static void tgen_qemu_ld(TCGContext *s, TCGType type, TCGReg data,
|
||||
TCGReg addr, MemOpIdx oi)
|
||||
{
|
||||
tcg_out_op_rrm(s, INDEX_op_qemu_ld, data, addr, oi);
|
||||
if (oi & ~0xffff) {
|
||||
tcg_out_movi(s, TCG_TYPE_I32, TCG_REG_TMP, oi);
|
||||
tcg_out_op_rrr(s, INDEX_op_tci_qemu_ld_rrr, data, addr, TCG_REG_TMP);
|
||||
} else {
|
||||
tcg_out_op_rrm(s, INDEX_op_qemu_ld, data, addr, oi);
|
||||
}
|
||||
}
|
||||
|
||||
static const TCGOutOpQemuLdSt outop_qemu_ld = {
|
||||
@@ -1213,7 +1218,12 @@ static const TCGOutOpQemuLdSt2 outop_qemu_ld2 = {
|
||||
static void tgen_qemu_st(TCGContext *s, TCGType type, TCGReg data,
|
||||
TCGReg addr, MemOpIdx oi)
|
||||
{
|
||||
tcg_out_op_rrm(s, INDEX_op_qemu_st, data, addr, oi);
|
||||
if (oi & ~0xffff) {
|
||||
tcg_out_movi(s, TCG_TYPE_I32, TCG_REG_TMP, oi);
|
||||
tcg_out_op_rrr(s, INDEX_op_tci_qemu_st_rrr, data, addr, TCG_REG_TMP);
|
||||
} else {
|
||||
tcg_out_op_rrm(s, INDEX_op_qemu_st, data, addr, oi);
|
||||
}
|
||||
}
|
||||
|
||||
static const TCGOutOpQemuLdSt outop_qemu_st = {
|
||||
|
||||
@@ -37,6 +37,15 @@ export SRC_PATH
|
||||
|
||||
SPEED = quick
|
||||
|
||||
|
||||
# TCG_TESTS_WITH_COMPILERS represents the test targets we have cross compiler
|
||||
# support for, CONFIGURED_TEST_TARGETS it what meson has finally
|
||||
# configured having rejected stuff we can't build.
|
||||
CONFIGURED_TCG_TARGETS=$(patsubst %-config-target.h, %, $(wildcard *-config-target.h))
|
||||
|
||||
# This is the intersection of what tests we can build and is configured
|
||||
TCG_TESTS_TARGETS=$(filter $(CONFIGURED_TCG_TARGETS), $(TCG_TESTS_WITH_COMPILERS))
|
||||
|
||||
# Per guest TCG tests
|
||||
BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(TCG_TESTS_TARGETS))
|
||||
CLEAN_TCG_TARGET_RULES=$(patsubst %,clean-tcg-tests-%, $(TCG_TESTS_TARGETS))
|
||||
|
||||
@@ -1,77 +1,97 @@
|
||||
# THIS FILE WAS AUTO-GENERATED
|
||||
#
|
||||
# Docker all cross-compiler target (tests only)
|
||||
# $ lcitool dockerfile --layers all debian-13 qemu-minimal
|
||||
#
|
||||
# While the normal cross builds take care to setup proper multiarch
|
||||
# build environments which can cross build QEMU this just installs the
|
||||
# basic compilers for as many targets as possible. We shall use this
|
||||
# to build and run linux-user tests on GitLab
|
||||
#
|
||||
FROM docker.io/library/debian:12-slim
|
||||
# https://gitlab.com/libvirt/libvirt-ci
|
||||
|
||||
# Duplicate deb line as deb-src
|
||||
RUN sed -in "s/Types: deb/Types: deb deb-src/g" /etc/apt/sources.list.d/debian.sources
|
||||
FROM docker.io/library/debian:13-slim
|
||||
|
||||
RUN export DEBIAN_FRONTEND=noninteractive && \
|
||||
apt-get update && \
|
||||
apt-get install -y eatmydata && \
|
||||
eatmydata apt-get dist-upgrade -y && \
|
||||
apt build-dep -yy --arch-only qemu
|
||||
eatmydata apt-get install --no-install-recommends -y \
|
||||
bash \
|
||||
bc \
|
||||
bison \
|
||||
bzip2 \
|
||||
ca-certificates \
|
||||
ccache \
|
||||
findutils \
|
||||
flex \
|
||||
gcc \
|
||||
git \
|
||||
libc6-dev \
|
||||
libfdt-dev \
|
||||
libffi-dev \
|
||||
libglib2.0-dev \
|
||||
libpixman-1-dev \
|
||||
locales \
|
||||
make \
|
||||
ninja-build \
|
||||
pkgconf \
|
||||
python3 \
|
||||
python3-pip \
|
||||
python3-setuptools \
|
||||
python3-venv \
|
||||
python3-wheel \
|
||||
sed \
|
||||
tar && \
|
||||
eatmydata apt-get autoremove -y && \
|
||||
eatmydata apt-get autoclean -y && \
|
||||
sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \
|
||||
dpkg-reconfigure locales && \
|
||||
rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED && \
|
||||
dpkg-query --showformat '${Package}_${Version}_${Architecture}\n' --show > /packages.txt && \
|
||||
mkdir -p /usr/libexec/ccache-wrappers && \
|
||||
ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc && \
|
||||
ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc
|
||||
|
||||
# Add extra build tools and as many cross compilers as we can for testing
|
||||
RUN /usr/bin/pip3 install meson==1.8.1
|
||||
|
||||
ENV CCACHE_WRAPPERSDIR="/usr/libexec/ccache-wrappers"
|
||||
ENV LANG="en_US.UTF-8"
|
||||
ENV MAKE="/usr/bin/make"
|
||||
ENV NINJA="/usr/bin/ninja"
|
||||
ENV PYTHON="/usr/bin/python3"
|
||||
# extras for cross and alternate toolchains
|
||||
RUN DEBIAN_FRONTEND=noninteractive eatmydata \
|
||||
apt install -y --no-install-recommends \
|
||||
bison \
|
||||
ccache \
|
||||
clang \
|
||||
dpkg-dev \
|
||||
flex \
|
||||
gcc \
|
||||
git \
|
||||
libclang-rt-dev \
|
||||
ninja-build \
|
||||
python3-pip \
|
||||
python3-setuptools \
|
||||
python3-tomli \
|
||||
python3-venv \
|
||||
python3-wheel
|
||||
|
||||
# All the generally available compilers
|
||||
apt install -y --no-install-recommends \
|
||||
clang\
|
||||
dpkg-dev\
|
||||
libclang-rt-dev
|
||||
ENV AVAILABLE_COMPILERS gcc-aarch64-linux-gnu \
|
||||
libc6-dev-arm64-cross \
|
||||
gcc-arm-linux-gnueabihf \
|
||||
libc6-dev-armhf-cross \
|
||||
gcc-mips-linux-gnu \
|
||||
libc6-dev-mips-cross \
|
||||
gcc-mips64-linux-gnuabi64 \
|
||||
libc6-dev-mips64-cross \
|
||||
gcc-mips64el-linux-gnuabi64 \
|
||||
libc6-dev-mips64el-cross \
|
||||
gcc-mipsel-linux-gnu \
|
||||
libc6-dev-mipsel-cross \
|
||||
gcc-powerpc64le-linux-gnu \
|
||||
libc6-dev-ppc64el-cross \
|
||||
gcc-riscv64-linux-gnu \
|
||||
libc6-dev-riscv64-cross \
|
||||
gcc-s390x-linux-gnu \
|
||||
libc6-dev-s390x-cross
|
||||
|
||||
libc6-dev-arm64-cross \
|
||||
gcc-arm-linux-gnueabihf \
|
||||
libc6-dev-armhf-cross \
|
||||
gcc-mips-linux-gnu \
|
||||
libc6-dev-mips-cross \
|
||||
gcc-mips64-linux-gnuabi64 \
|
||||
libc6-dev-mips64-cross \
|
||||
gcc-mips64el-linux-gnuabi64 \
|
||||
libc6-dev-mips64el-cross \
|
||||
gcc-mipsel-linux-gnu \
|
||||
libc6-dev-mipsel-cross \
|
||||
gcc-powerpc64le-linux-gnu \
|
||||
libc6-dev-ppc64el-cross \
|
||||
gcc-riscv64-linux-gnu \
|
||||
libc6-dev-riscv64-cross \
|
||||
gcc-s390x-linux-gnu \
|
||||
libc6-dev-s390x-cross
|
||||
RUN if dpkg-architecture -e amd64; then \
|
||||
export AVAILABLE_COMPILERS="${AVAILABLE_COMPILERS} gcc-hppa-linux-gnu libc6-dev-hppa-cross"; \
|
||||
export AVAILABLE_COMPILERS="${AVAILABLE_COMPILERS} gcc-m68k-linux-gnu libc6-dev-m68k-cross"; \
|
||||
export AVAILABLE_COMPILERS="${AVAILABLE_COMPILERS} gcc-powerpc-linux-gnu libc6-dev-powerpc-cross"; \
|
||||
export AVAILABLE_COMPILERS="${AVAILABLE_COMPILERS} gcc-powerpc64-linux-gnu libc6-dev-ppc64-cross"; \
|
||||
export AVAILABLE_COMPILERS="${AVAILABLE_COMPILERS} gcc-sparc64-linux-gnu libc6-dev-sparc64-cross"; \
|
||||
fi && \
|
||||
DEBIAN_FRONTEND=noninteractive eatmydata \
|
||||
apt install -y --no-install-recommends \
|
||||
${AVAILABLE_COMPILERS} && \
|
||||
dpkg-query --showformat '${Package}_${Version}_${Architecture}\n' --show > /packages.txt
|
||||
|
||||
|
||||
ENV QEMU_CONFIGURE_OPTS --disable-system --disable-docs --disable-tools
|
||||
fi && \
|
||||
DEBIAN_FRONTEND=noninteractive eatmydata \
|
||||
apt install -y --no-install-recommends \
|
||||
${AVAILABLE_COMPILERS} && \
|
||||
dpkg-query --showformat '${Package}_${Version}_${Architecture}' --show > /packages.txt
|
||||
ENV QEMU_CONFIGURE_OPTS --disable-docs
|
||||
ENV DEF_TARGET_LIST aarch64-linux-user,arm-linux-user,hppa-linux-user,i386-linux-user,m68k-linux-user,mips-linux-user,mips64-linux-user,mips64el-linux-user,mipsel-linux-user,ppc-linux-user,ppc64-linux-user,ppc64le-linux-user,riscv64-linux-user,s390x-linux-user,sparc64-linux-user
|
||||
# As a final step configure the user (if env is defined)
|
||||
ENV MAKE /usr/bin/make
|
||||
ARG USER
|
||||
ARG UID
|
||||
RUN if [ "${USER}" ]; then \
|
||||
|
||||
@@ -4,6 +4,7 @@ packages:
|
||||
- bash
|
||||
- bc
|
||||
- bison
|
||||
- bzip2
|
||||
- ccache
|
||||
- findutils
|
||||
- flex
|
||||
|
||||
@@ -161,6 +161,46 @@ ubuntu2204_rust_extras = [
|
||||
'RUN cargo install bindgen-cli\n',
|
||||
]
|
||||
|
||||
debian_all_test_cross_compilers = [
|
||||
"# extras for cross and alternate toolchains\n",
|
||||
"RUN DEBIAN_FRONTEND=noninteractive eatmydata \\\n",
|
||||
" apt install -y --no-install-recommends \\\n",
|
||||
" clang\\\n",
|
||||
" dpkg-dev\\\n",
|
||||
" libclang-rt-dev\n",
|
||||
"ENV AVAILABLE_COMPILERS gcc-aarch64-linux-gnu \\\n",
|
||||
" libc6-dev-arm64-cross \\\n",
|
||||
" gcc-arm-linux-gnueabihf \\\n",
|
||||
" libc6-dev-armhf-cross \\\n",
|
||||
" gcc-mips-linux-gnu \\\n",
|
||||
" libc6-dev-mips-cross \\\n",
|
||||
" gcc-mips64-linux-gnuabi64 \\\n",
|
||||
" libc6-dev-mips64-cross \\\n",
|
||||
" gcc-mips64el-linux-gnuabi64 \\\n",
|
||||
" libc6-dev-mips64el-cross \\\n",
|
||||
" gcc-mipsel-linux-gnu \\\n",
|
||||
" libc6-dev-mipsel-cross \\\n",
|
||||
" gcc-powerpc64le-linux-gnu \\\n",
|
||||
" libc6-dev-ppc64el-cross \\\n",
|
||||
" gcc-riscv64-linux-gnu \\\n",
|
||||
" libc6-dev-riscv64-cross \\\n",
|
||||
" gcc-s390x-linux-gnu \\\n",
|
||||
" libc6-dev-s390x-cross\n",
|
||||
"RUN if dpkg-architecture -e amd64; then \\\n",
|
||||
" export AVAILABLE_COMPILERS=\"${AVAILABLE_COMPILERS} gcc-hppa-linux-gnu libc6-dev-hppa-cross\"; \\\n",
|
||||
" export AVAILABLE_COMPILERS=\"${AVAILABLE_COMPILERS} gcc-m68k-linux-gnu libc6-dev-m68k-cross\"; \\\n",
|
||||
" export AVAILABLE_COMPILERS=\"${AVAILABLE_COMPILERS} gcc-powerpc-linux-gnu libc6-dev-powerpc-cross\"; \\\n",
|
||||
" export AVAILABLE_COMPILERS=\"${AVAILABLE_COMPILERS} gcc-powerpc64-linux-gnu libc6-dev-ppc64-cross\"; \\\n",
|
||||
" export AVAILABLE_COMPILERS=\"${AVAILABLE_COMPILERS} gcc-sparc64-linux-gnu libc6-dev-sparc64-cross\"; \\\n",
|
||||
"fi && \\\n",
|
||||
"DEBIAN_FRONTEND=noninteractive eatmydata \\\n",
|
||||
"apt install -y --no-install-recommends \\\n",
|
||||
"${AVAILABLE_COMPILERS} && \\\n",
|
||||
"dpkg-query --showformat '${Package}_${Version}_${Architecture}' --show > /packages.txt\n",
|
||||
"ENV QEMU_CONFIGURE_OPTS --disable-docs\n",
|
||||
"ENV DEF_TARGET_LIST aarch64-linux-user,arm-linux-user,hppa-linux-user,i386-linux-user,m68k-linux-user,mips-linux-user,mips64-linux-user,mips64el-linux-user,mipsel-linux-user,ppc-linux-user,ppc64-linux-user,ppc64le-linux-user,riscv64-linux-user,s390x-linux-user,sparc64-linux-user\n",
|
||||
]
|
||||
|
||||
def cross_build(prefix, targets):
|
||||
conf = "ENV QEMU_CONFIGURE_OPTS=--cross-prefix=%s\n" % (prefix)
|
||||
targets = "ENV DEF_TARGET_LIST=%s\n" % (targets)
|
||||
@@ -256,6 +296,15 @@ try:
|
||||
# https://github.com/mesonbuild/meson/pull/14991
|
||||
enable_rust=False)
|
||||
|
||||
# We also generate some docker files with minimal dependencies and
|
||||
# as many cross-compilers as Debian will package for building TCG
|
||||
# tests.
|
||||
|
||||
generate_dockerfile("debian-all-test-cross", "debian-13",
|
||||
project="qemu-minimal",
|
||||
enable_rust=False,
|
||||
trailer="".join(debian_all_test_cross_compilers))
|
||||
|
||||
#
|
||||
# Cirrus packages lists for GitLab
|
||||
#
|
||||
|
||||
@@ -39,6 +39,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
|
||||
|
||||
_supported_fmt qcow2
|
||||
_supported_proto file
|
||||
_require_secret
|
||||
|
||||
|
||||
filter_test_dir()
|
||||
{
|
||||
|
||||
@@ -39,6 +39,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
|
||||
|
||||
_supported_fmt qcow qcow2
|
||||
_supported_proto file
|
||||
_require_secret
|
||||
|
||||
|
||||
size=128M
|
||||
|
||||
@@ -39,6 +39,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
|
||||
|
||||
_supported_fmt qcow qcow2
|
||||
_supported_proto file
|
||||
_require_secret
|
||||
|
||||
|
||||
size=128M
|
||||
|
||||
@@ -1008,7 +1008,7 @@ _require_disk_usage()
|
||||
else
|
||||
FILENAME="$TEST_IMG_FILE"
|
||||
fi
|
||||
if [ -e "FILENAME" ]; then
|
||||
if [ -e "$FILENAME" ]; then
|
||||
echo "unwilling to overwrite existing file"
|
||||
exit 1
|
||||
fi
|
||||
@@ -1053,6 +1053,20 @@ _require_one_device_of()
|
||||
_notrun "$* not available"
|
||||
}
|
||||
|
||||
_require_secret()
|
||||
{
|
||||
if [ -e "$TEST_IMG" ]; then
|
||||
echo "unwilling to overwrite existing file"
|
||||
exit 1
|
||||
fi
|
||||
if $QEMU_IMG create -f $IMGFMT --object secret,id=sec0,data=123 \
|
||||
-o encryption=on,encrypt.key-secret=sec0 "$TEST_IMG" 1M 2>&1 \
|
||||
| grep "Unsupported cipher" ; then
|
||||
_notrun "missing cipher support"
|
||||
fi
|
||||
rm -f "$TEST_IMG"
|
||||
}
|
||||
|
||||
_qcow2_dump_header()
|
||||
{
|
||||
if [[ "$1" == "--no-filter-compression" ]]; then
|
||||
|
||||
@@ -746,14 +746,12 @@ vubr_run(VubrDev *dev)
|
||||
static int
|
||||
vubr_parse_host_port(const char **host, const char **port, const char *buf)
|
||||
{
|
||||
char *p = strchr(buf, ':');
|
||||
|
||||
if (!p) {
|
||||
g_auto(GStrv) tokens = g_strsplit(buf, ":", 2);
|
||||
if (!tokens[0] || !tokens[1]) {
|
||||
return -1;
|
||||
}
|
||||
*p = '\0';
|
||||
*host = strdup(buf);
|
||||
*port = strdup(p + 1);
|
||||
*host = g_steal_pointer(&tokens[0]);
|
||||
*port = g_steal_pointer(&tokens[1]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -418,7 +418,7 @@ err_out:
|
||||
void sendkey_completion(ReadLineState *rs, int nb_args, const char *str)
|
||||
{
|
||||
int i;
|
||||
char *sep;
|
||||
const char *sep;
|
||||
size_t len;
|
||||
|
||||
if (nb_args != 2) {
|
||||
|
||||
+1
-1
@@ -203,7 +203,7 @@ static ValidFilenameTemplateResult
|
||||
valid_filename_template(const char *filename, bool per_thread, Error **errp)
|
||||
{
|
||||
if (filename) {
|
||||
char *pidstr = strstr(filename, "%");
|
||||
const char *pidstr = strstr(filename, "%");
|
||||
|
||||
if (pidstr) {
|
||||
/* We only accept one %d, no other format strings */
|
||||
|
||||
Reference in new issue
Block a user