Merge tag 'pull-target-arm-20251103' of https://gitlab.com/pm215/qemu into staging

target-arm queue:
 * allow KVM accelerator on imx8mp-evk
 * docs/devel/testing/fuzzing: Note that you can get qtest to read from a file

# -----BEGIN PGP SIGNATURE-----
#
# iQJNBAABCAA3FiEE4aXFk81BneKOgxXPPCUl7RQ2DN4FAmkIzk0ZHHBldGVyLm1h
# eWRlbGxAbGluYXJvLm9yZwAKCRA8JSXtFDYM3pn5D/0djVUHCCeDkw8ZrgXYqw3m
# IkdSkA4dmuBPUUnjBT92ZUwuZ6IY7bk14fARC2Y4W01mgB78V+kzoRAeHSJ3Hp2+
# 8fKKDrv0ZCmBV/iqlxpP3j9q7gG91aEsC5dz7xfl1bZmLMaSvOArPbuEZECDTW7z
# vQxQfw9V33TwIzbLy8hLOmgCMxse4BIm8wpKjXAcVNAt0dDc7VGBaLfMCegZ/JYR
# 8+c8XSAITxe9bd5CrVfIOI5pnZ/PBekMAAYRtT/fhJLPGeKZsqH3EZpSOrBS+apv
# dpjtOEUdUbN54v5QkmNaCiX+/Yy4EEo+/0etmNR10LKpDBPPUkLQMWgtF0YUHPyp
# e7Y3iaLqTrd+GQ8JNvjqZteKiI6NEVxZDB+EKf9VyxZ0DACVxrDyZ9Yq8r4RGlib
# ltog0lPxShJW88yhuHajLouMITVj/FQiUSwQ9I4fmzHqTJa0CDC553vivIxXSglG
# BBF3dJ2WcBynkkzfpH751TwAnS/k/QsjR75c2wc8Vx21LAL+MM0RpbMwbk5Wh46Z
# uXKHps2NTyfDX8WfetgS3+FnAeyOfy8pqLpQPOyvep3s24xjW8Vuh6bxpHjyhYxm
# mHN+3ZB2/am2rNADg5WWtqzeRUw4kytoRAPTQyw2t7jWnjebRDHr3eCpPcicXkv5
# zuNSj8Ugiq60jgmRxZAQ9w==
# =Zqu+
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon 03 Nov 2025 04:46:21 PM CET
# gpg:                using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE
# gpg:                issuer "peter.maydell@linaro.org"
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>" [unknown]
# gpg:                 aka "Peter Maydell <pmaydell@gmail.com>" [unknown]
# gpg:                 aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>" [unknown]
# gpg:                 aka "Peter Maydell <peter@archaic.org.uk>" [unknown]
# gpg: WARNING: The key's User ID is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83  15CF 3C25 25ED 1436 0CDE

* tag 'pull-target-arm-20251103' of https://gitlab.com/pm215/qemu:
  docs/devel/testing/fuzzing: Note that you can get qtest to read from a file
  hw/arm/imx8mp-evk: Fix guest time in KVM mode
  hw/arm/imx8mp-evk: Add KVM support

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson
2025-11-04 16:19:17 +01:00
5 changed files with 79 additions and 6 deletions
+9
View File
@@ -263,6 +263,15 @@ generic-fuzz target.
- Report the bug and send a patch with the C reproducer upstream
QEMU can also read the reproducer directly from a file rather than
from standard input::
$QEMU_PATH $QEMU_ARGS -qtest chardev:repro \
-chardev file,id=repro,path=/dev/null,input-path=/tmp/reproducer
This is useful if you want to run QEMU under a debugger to investigate
the failure.
Implementation Details / Fuzzer Lifecycle
-----------------------------------------
+19
View File
@@ -60,3 +60,22 @@ Now that everything is prepared the machine can be started as follows:
-dtb imx8mp-evk.dtb \
-append "root=/dev/mmcblk2p2" \
-drive file=sdcard.img,if=sd,bus=2,format=raw,id=mmcblk2
KVM Acceleration
----------------
To enable hardware-assisted acceleration via KVM, append
``-accel kvm -cpu host`` to the command line. While this speeds up performance
significantly, be aware of the following limitations:
* The ``imx8mp-evk`` machine is not included under the "virtualization use case"
of :doc:`QEMU's security policy </system/security>`. This means that you
should not trust that it can contain malicious guests, whether it is run
using TCG or KVM. If you don't trust your guests and you're relying on QEMU to
be the security boundary, you want to choose another machine such as ``virt``.
* Rather than Cortex-A53 CPUs, the same CPU type as the host's will be used.
This is a limitation of KVM and may not work with guests with a tight
dependency on Cortex-A53.
* No EL2 and EL3 exception levels are available which is also a KVM limitation.
Direct kernel boot should work but running U-Boot, TF-A, etc. won't succeed.
+2 -1
View File
@@ -622,7 +622,8 @@ config FSL_IMX8MP
config FSL_IMX8MP_EVK
bool
default y
depends on TCG && AARCH64
depends on AARCH64
depends on TCG || KVM
select FSL_IMX8MP
config ARM_SMMUV3
+29 -5
View File
@@ -12,11 +12,13 @@
#include "system/address-spaces.h"
#include "hw/arm/bsa.h"
#include "hw/arm/fsl-imx8mp.h"
#include "hw/intc/arm_gicv3.h"
#include "hw/misc/unimp.h"
#include "hw/boards.h"
#include "system/kvm.h"
#include "system/system.h"
#include "target/arm/cpu.h"
#include "target/arm/cpu-qom.h"
#include "target/arm/kvm_arm.h"
#include "qapi/error.h"
#include "qobject/qlist.h"
@@ -193,15 +195,15 @@ static void fsl_imx8mp_init(Object *obj)
{
MachineState *ms = MACHINE(qdev_get_machine());
FslImx8mpState *s = FSL_IMX8MP(obj);
const char *cpu_type = ms->cpu_type ?: ARM_CPU_TYPE_NAME("cortex-a53");
int i;
for (i = 0; i < MIN(ms->smp.cpus, FSL_IMX8MP_NUM_CPUS); i++) {
g_autofree char *name = g_strdup_printf("cpu%d", i);
object_initialize_child(obj, name, &s->cpu[i],
ARM_CPU_TYPE_NAME("cortex-a53"));
object_initialize_child(obj, name, &s->cpu[i], cpu_type);
}
object_initialize_child(obj, "gic", &s->gic, TYPE_ARM_GICV3);
object_initialize_child(obj, "gic", &s->gic, gicv3_class_name());
object_initialize_child(obj, "ccm", &s->ccm, TYPE_IMX8MP_CCM);
@@ -274,7 +276,8 @@ static void fsl_imx8mp_realize(DeviceState *dev, Error **errp)
/* CPUs */
for (i = 0; i < ms->smp.cpus; i++) {
/* On uniprocessor, the CBAR is set to 0 */
if (ms->smp.cpus > 1) {
if (ms->smp.cpus > 1 &&
object_property_find(OBJECT(&s->cpu[i]), "reset-cbar")) {
object_property_set_int(OBJECT(&s->cpu[i]), "reset-cbar",
fsl_imx8mp_memmap[FSL_IMX8MP_GIC_DIST].addr,
&error_abort);
@@ -286,6 +289,16 @@ static void fsl_imx8mp_realize(DeviceState *dev, Error **errp)
object_property_set_int(OBJECT(&s->cpu[i]), "cntfrq", 8000000,
&error_abort);
if (object_property_find(OBJECT(&s->cpu[i]), "has_el2")) {
object_property_set_bool(OBJECT(&s->cpu[i]), "has_el2",
!kvm_enabled(), &error_abort);
}
if (object_property_find(OBJECT(&s->cpu[i]), "has_el3")) {
object_property_set_bool(OBJECT(&s->cpu[i]), "has_el3",
!kvm_enabled(), &error_abort);
}
if (i) {
/*
* Secondary CPUs start in powered-down state (and can be
@@ -304,6 +317,7 @@ static void fsl_imx8mp_realize(DeviceState *dev, Error **errp)
{
SysBusDevice *gicsbd = SYS_BUS_DEVICE(&s->gic);
QList *redist_region_count;
bool pmu = object_property_get_bool(OBJECT(first_cpu), "pmu", NULL);
qdev_prop_set_uint32(gicdev, "num-cpu", ms->smp.cpus);
qdev_prop_set_uint32(gicdev, "num-irq",
@@ -360,6 +374,16 @@ static void fsl_imx8mp_realize(DeviceState *dev, Error **errp)
qdev_get_gpio_in(cpudev, ARM_CPU_VIRQ));
sysbus_connect_irq(gicsbd, i + 3 * ms->smp.cpus,
qdev_get_gpio_in(cpudev, ARM_CPU_VFIQ));
if (kvm_enabled()) {
if (pmu) {
assert(arm_feature(&s->cpu[i].env, ARM_FEATURE_PMU));
if (kvm_irqchip_in_kernel()) {
kvm_arm_pmu_set_irq(&s->cpu[i], VIRTUAL_PMU_IRQ);
}
kvm_arm_pmu_init(&s->cpu[i]);
}
}
}
}
+20
View File
@@ -13,6 +13,7 @@
#include "hw/arm/machines-qom.h"
#include "hw/boards.h"
#include "hw/qdev-properties.h"
#include "system/kvm.h"
#include "system/qtest.h"
#include "qemu/error-report.h"
#include "qapi/error.h"
@@ -43,6 +44,15 @@ static void imx8mp_evk_modify_dtb(const struct arm_boot_info *info, void *fdt)
fdt_nop_property(fdt, offset, "cpu-idle-states");
offset = fdt_node_offset_by_compatible(fdt, offset, "arm,cortex-a53");
}
if (kvm_enabled()) {
/* Use system counter frequency from host CPU to fix time in guest */
offset = fdt_node_offset_by_compatible(fdt, -1, "arm,armv8-timer");
while (offset >= 0) {
fdt_nop_property(fdt, offset, "clock-frequency");
offset = fdt_node_offset_by_compatible(fdt, offset, "arm,armv8-timer");
}
}
}
static void imx8mp_evk_init(MachineState *machine)
@@ -94,12 +104,22 @@ static void imx8mp_evk_init(MachineState *machine)
}
}
static const char *imx8mp_evk_get_default_cpu_type(const MachineState *ms)
{
if (kvm_enabled()) {
return ARM_CPU_TYPE_NAME("host");
}
return ARM_CPU_TYPE_NAME("cortex-a53");
}
static void imx8mp_evk_machine_init(MachineClass *mc)
{
mc->desc = "NXP i.MX 8M Plus EVK Board";
mc->init = imx8mp_evk_init;
mc->max_cpus = FSL_IMX8MP_NUM_CPUS;
mc->default_ram_id = "imx8mp-evk.ram";
mc->get_default_cpu_type = imx8mp_evk_get_default_cpu_type;
}
DEFINE_MACHINE_AARCH64("imx8mp-evk", imx8mp_evk_machine_init)