* [PULL v4 00/62] Misc HW patches for 2026-04-22
@ 2026-04-24 19:25 Philippe Mathieu-Daudé
2026-04-24 19:25 ` [PULL v4 02/62] hw/core/cpu: Expose CPUState::start_powered_off docstring Philippe Mathieu-Daudé
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-04-24 19:25 UTC (permalink / raw)
To: qemu-devel
v4:
fixed QOM 'compat' properties on linux-user
v3:
now than target-arm.next is merged, 3 more MAINTAINERS patches
The following changes since commit 4bde339ecb41b16e90810233ba5ee2fa87bd443f:
Merge tag 'pull-11.1-virtio-gpu-hotfixes-230426-1' of https://gitlab.com/stsquad/qemu into staging (2026-04-23 20:51:57 -0400)
are available in the Git repository at:
https://github.com/philmd/qemu.git tags/hw-misc-20260422
for you to fetch changes up to 7754d268a0558b10c3bfdaaff0ccb1727a94918a:
MAINTAINERS: Transfer CI maintenance to Pierrick (2026-04-24 21:20:45 +0200)
----------------------------------------------------------------
Misc HW patches
- Build hw/avr/ as common unit files
- Header cleanups around 'cpu.h', 'qemu/audio.h' or duplicated lines
- Remove obsolete TPMIfClass::ppi_enabled field
- Cleanups around load/store API
- Restrict 'compat' properties API to system emulation
- Correct TPM PPCI ACPI for Windows guests on ARM Virt machine
- Simplify physical_memory_range_includes_clean()
- Avoid including CONFIG_DEVICES in hw/arm/smmuv3
- Initialize bus frequency in PPC e500 device tree blob
- More ATI VGA fixes
- Fix fuzzing issues on AVR power controller and SH4 MCU
- MAINTAINERS updates
- Machine compat array for v11.0.0 release
- USB EHCI cleanups
----------------------------------------------------------------
Bin Guo (1):
physmem: Simplify dirty memory type checks with loop
Cornelia Huck (1):
hw: add compat machines for 11.1
Jamin Lin (6):
hw/usb/hcd-ehci: Remove unused EHCIfstn structure and dead code
hw/usb/hcd-ehci.h: Fix coding style issues reported by checkpatch
hw/usb/hcd-ehci.c: Fix coding style issues reported by checkpatch
hw/usb/hcd-ehci.c: Replace fprintf(stderr, ...) with
qemu_log_mask(LOG_GUEST_ERROR)
hw/usb/hcd-ehci: Replace DPRINTF debug logs with trace events
hw/usb/hcd-ehci: Introduce common properties macro for sysbus and pci
Junjie Cao (2):
ati-vga: fix unsigned integer overflow in cursor bounds checks
ati-vga: mask out lock bit from CUR_OFFSET in cursor offset
calculation
Mohammadfaiz Bawa (3):
docs/specs/tpm: document PPI support on ARM64 virt
hw/acpi/tpm: parameterize PPI base address in tpm_build_ppi_acpi
hw/tpm: add PPI support to tpm-tis-device for ARM64 virt
Osama Abdelkader (3):
hw/virtio/virtio-iommu: remove duplicate include
hw/hyperv: remove duplicate include
hw/ppc/amigaone: remove duplicate include
Peter Maydell (1):
hw/arm, hw/ppc: Remove unnecessary audio.h includes from board code
Philippe Mathieu-Daudé (42):
hw/avr: Build as common unit files
hw/core/cpu: Expose CPUState::start_powered_off docstring
hw/misc/cpc: Include missing 'hw/core/cpu.h' header
hw/alpha: Include full path to target 'cpu.h' header
hw/arm: Include full path to target 'cpu.h' header
hw/avr: Include full path to target 'cpu.h' header
hw/hppa: Include full path to target 'cpu.h' header
hw/i386: Include full path to target 'cpu.h' header
hw/m68k: Include full path to target 'cpu.h' header
hw/microblaze: Include full path to target 'cpu.h' header
hw/mips: Include full path to target 'cpu.h' header
hw/or1k: Include full path to target 'cpu.h' header
hw/ppc: Include full path to target 'cpu.h' header
hw/riscv: Include full path to target 'cpu.h' header
hw/s390x: Include full path to target 'cpu.h' header
hw/sh4: Include full path to target 'cpu.h' header
hw/sparc: Include full path to target 'cpu.h' header
hw/tricore: Include full path to target 'cpu.h' header
hw/xtensa: Include full path to target 'cpu.h' header
hw/tpm: Factor tpm_ppi_enabled() out
hw/tpm: Add TPMIfClass::ppi_enabled field
hw/tpm: Remove CRBState::ppi_enabled field
hw/tpm: Propagate @ppi_enabled to tpm_tis_reset() and remove in
TPMState
hw/tpm: Simplify tpm_ppi_enabled()
hw/ppc/spapr: Un-inline rtas_load/store() helpers
hw/hyperv: Replace legacy ld_phys() -> address_space_ld()
system/memory: Constify various AddressSpace arguments (flatview)
hw/core: Move compat_props_add() to 'hw/core/boards.h'
qom: Declare GlobalProperty structure in 'qom/compat-properties.h'
qom: Declare compat properties API in 'qom/compat-properties.h'
qom: Restrict compat properties API to system emulation
hw/arm/smmuv3: Have smmuv3_accel_init() take an Error* parameter
hw/arm/smmuv3: Avoid including CONFIG_DEVICES in hw/ header
hw/cxl: Define cxl_fmws_get_all_sorted() stub
hw/arm/virt: Do not select Kconfig symbol PCI_EXPRESS
MAINTAINERS: Merge PCIe DOE section within SPDM
MAINTAINERS: Cover hexloader tests under the Generic Loader section
MAINTAINERS: Remove my unused git tree locations
MAINTAINERS: Remove my disfunctional emails
MAINTAINERS: Remove PhilMD from NVMe Block Driver
MAINTAINERS: Maintain MIPS Boston
MAINTAINERS: Transfer CI maintenance to Pierrick
Thomas Huth (2):
hw/misc: Fix the valid access size to the avr-power device
hw/sh4/sh7750: Remove forgotten abort() in the MM_ITLB_DATA handler
Vivien LEGER (1):
hw/ppc/e500: fix bus-frequency property hardcoded to zero in CPU FDT
node
MAINTAINERS | 28 +--
docs/specs/tpm.rst | 24 +++
hw/arm/smmuv3-accel.h | 41 +---
hw/avr/boot.h | 2 +-
hw/ppc/e500.h | 1 +
hw/s390x/ipl.h | 2 +-
hw/s390x/s390-hypercall.h | 2 +-
hw/sd/sdmmc-internal.h | 2 +-
hw/tpm/tpm_tis.h | 3 +-
hw/usb/hcd-ehci.h | 37 ++--
hw/xtensa/xtensa_memory.h | 2 +-
include/crypto/tls-cipher-suites.h | 2 +-
include/hw/acpi/tpm.h | 3 +-
include/hw/arm/digic.h | 2 +-
include/hw/arm/fsl-imx6.h | 2 +-
include/hw/arm/fsl-imx6ul.h | 2 +-
include/hw/arm/fsl-imx7.h | 2 +-
include/hw/arm/fsl-imx8mp.h | 2 +-
include/hw/core/boards.h | 14 ++
include/hw/core/cpu.h | 2 +-
include/hw/core/qdev-properties.h | 1 +
include/hw/core/qdev.h | 27 ---
include/hw/i2c/arm_sbcon_i2c.h | 2 +-
include/hw/i386/apic_internal.h | 2 +-
include/hw/i386/pc.h | 3 +
include/hw/intc/mips_gic.h | 2 +-
include/hw/misc/bcm2835_thermal.h | 2 +-
include/hw/misc/led.h | 2 +-
include/hw/ppc/pnv.h | 2 +-
include/hw/ppc/spapr.h | 18 +-
include/hw/ppc/spapr_fadump.h | 2 +-
include/hw/timer/bcm2835_systmr.h | 2 +-
include/qemu/units.h | 2 +-
include/qom/compat-properties.h | 40 ++++
include/qom/object.h | 8 -
include/system/memory.h | 2 +-
include/system/tpm.h | 9 +
system/memory-internal.h | 5 +-
accel/accel-system.c | 1 +
backends/hostmem.c | 1 +
crypto/tls-cipher-suites.c | 2 +-
hw/acpi/tpm.c | 10 +-
hw/alpha/dp264.c | 2 +-
hw/alpha/typhoon.c | 2 +-
hw/arm/boot.c | 2 +-
hw/arm/exynos4210.c | 2 +-
hw/arm/integratorcp.c | 1 -
hw/arm/mps3r.c | 2 +-
hw/arm/musicpal.c | 1 -
hw/arm/omap1.c | 2 +-
hw/arm/realview.c | 3 +-
hw/arm/smmuv3-accel-stubs.c | 52 +++++
hw/arm/smmuv3-accel.c | 3 +-
hw/arm/smmuv3.c | 13 +-
hw/arm/versatilepb.c | 1 -
hw/arm/vexpress.c | 1 -
hw/arm/virt-acpi-build.c | 9 +-
hw/arm/virt.c | 11 +-
hw/arm/xlnx-zcu102.c | 1 -
hw/core/machine.c | 4 +
hw/core/qdev-properties.c | 1 +
hw/core/qdev.c | 1 +
hw/cxl/cxl-host-stubs.c | 5 +
hw/display/ati.c | 12 +-
hw/hppa/machine.c | 2 +-
hw/hyperv/hyperv.c | 6 +-
hw/hyperv/vmbus.c | 1 -
hw/i386/acpi-build.c | 4 +-
hw/i386/fw_cfg.c | 2 +-
hw/i386/multiboot.c | 2 +-
hw/i386/pc.c | 3 +
hw/i386/pc_piix.c | 13 +-
hw/i386/pc_q35.c | 14 +-
hw/i386/pc_sysfw_ovmf-stubs.c | 2 +-
hw/i386/pc_sysfw_ovmf.c | 2 +-
hw/i386/vmmouse.c | 2 +-
hw/intc/arm_gicv3_cpuif.c | 2 +-
hw/intc/arm_gicv3_cpuif_common.c | 2 +-
hw/intc/m68k_irqc.c | 2 +-
hw/intc/sh_intc.c | 2 +-
hw/isa/lpc_ich9.c | 2 +-
hw/m68k/an5206.c | 2 +-
hw/m68k/mcf5206.c | 2 +-
hw/m68k/mcf5208.c | 2 +-
hw/m68k/mcf_intc.c | 2 +-
hw/m68k/q800-glue.c | 2 +-
hw/m68k/q800.c | 2 +-
hw/m68k/virt.c | 13 +-
hw/microblaze/boot.c | 2 +-
hw/microblaze/petalogix_ml605_mmu.c | 2 +-
hw/microblaze/petalogix_s3adsp1800_mmu.c | 2 +-
hw/microblaze/xlnx-zynqmp-pmu.c | 2 +-
hw/mips/bootloader.c | 2 +-
hw/mips/fuloong2e.c | 2 +-
hw/mips/jazz.c | 2 +-
hw/mips/malta.c | 2 +-
hw/misc/avr_power.c | 3 +
hw/misc/bcm2835_thermal.c | 2 +-
hw/misc/led.c | 2 +-
hw/misc/mips_cpc.c | 3 +-
hw/misc/riscv_cmgcr.c | 2 +-
hw/misc/riscv_cpc.c | 3 +-
hw/or1k/boot.c | 2 +-
hw/or1k/cputimer.c | 2 +-
hw/or1k/or1k-sim.c | 2 +-
hw/or1k/virt.c | 2 +-
hw/ppc/amigaone.c | 1 -
hw/ppc/e500.c | 2 +-
hw/ppc/e500plat.c | 1 +
hw/ppc/fw_cfg.c | 2 +-
hw/ppc/mpc8544_guts.c | 2 +-
hw/ppc/mpc8544ds.c | 3 +-
hw/ppc/ppc440_uc.c | 2 +-
hw/ppc/ppc4xx_devs.c | 2 +-
hw/ppc/ppc_booke.c | 2 +-
hw/ppc/prep.c | 1 -
hw/ppc/prep_systemio.c | 2 +-
hw/ppc/spapr.c | 17 +-
hw/ppc/spapr_rtas.c | 15 ++
hw/ppc/spapr_vhyp_mmu.c | 2 +-
hw/ppc/virtex_ml507.c | 2 +-
hw/riscv/microblaze-v-generic.c | 2 +-
hw/s390x/ap-bridge.c | 2 +-
hw/s390x/s390-hypercall.c | 2 +-
hw/s390x/s390-stattrib.c | 2 +-
hw/s390x/s390-virtio-ccw.c | 14 +-
hw/s390x/tod-tcg.c | 2 +-
hw/sd/sd.c | 2 +-
hw/sh4/r2d.c | 2 +-
hw/sh4/sh7750.c | 1 -
hw/sparc/leon3.c | 2 +-
hw/sparc/sun4m.c | 2 +-
hw/sparc64/niagara.c | 2 +-
hw/sparc64/sparc64.c | 2 +-
hw/sparc64/sun4u.c | 2 +-
hw/timer/bcm2835_systmr.c | 2 +-
hw/tpm/tpm_crb.c | 13 +-
hw/tpm/tpm_tis_common.c | 4 +-
hw/tpm/tpm_tis_i2c.c | 2 +-
hw/tpm/tpm_tis_isa.c | 12 +-
hw/tpm/tpm_tis_sysbus.c | 13 +-
hw/tricore/tricore_testboard.c | 2 +-
hw/usb/bus-stub.c | 2 +-
hw/usb/hcd-ehci-pci.c | 2 +-
hw/usb/hcd-ehci-sysbus.c | 2 +-
hw/usb/hcd-ehci.c | 228 ++++++++++----------
hw/virtio/virtio-iommu.c | 1 -
hw/xtensa/pic_cpu.c | 2 +-
hw/xtensa/xtfpga.c | 2 +-
qom/compat-properties.c | 76 +++++++
qom/object.c | 62 +-----
stubs/fw_cfg.c | 2 +-
stubs/hotplug-stubs.c | 2 +-
stubs/qdev.c | 2 +-
stubs/qom-compat-properties.c | 14 ++
system/memory.c | 2 +-
system/physmem.c | 16 +-
system/rtc.c | 1 +
system/vl.c | 1 +
target/i386/sev.c | 1 +
tests/qtest/fuzz-sb16-test.c | 2 +-
tests/qtest/fuzz-sdcard-test.c | 2 +-
tests/qtest/sdhci-test.c | 2 +-
ui/vdagent.c | 1 +
hw/arm/Kconfig | 1 -
hw/arm/meson.build | 5 +-
hw/misc/meson.build | 2 +-
hw/timer/meson.build | 2 +-
hw/usb/trace-events | 9 +
qom/meson.build | 3 +
rust/bindings/qom-sys/lib.rs | 2 +-
stubs/meson.build | 1 +
tests/functional/aarch64/test_raspi3.py | 2 +-
tests/functional/arm/test_bflt.py | 2 +-
tests/functional/arm/test_raspi2.py | 2 +-
tests/functional/m68k/test_nextcube.py | 2 +-
tests/functional/mips/test_malta.py | 2 +-
tests/functional/mips64el/test_fuloong2e.py | 2 +-
tests/functional/mips64el/test_malta.py | 2 +-
tests/functional/mipsel/test_malta.py | 2 +-
tests/functional/ppc/test_40p.py | 2 +-
tests/functional/qemu_test/tesseract.py | 2 +-
182 files changed, 687 insertions(+), 504 deletions(-)
create mode 100644 include/qom/compat-properties.h
create mode 100644 hw/arm/smmuv3-accel-stubs.c
create mode 100644 qom/compat-properties.c
create mode 100644 stubs/qom-compat-properties.c
--
2.53.0
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PULL v4 02/62] hw/core/cpu: Expose CPUState::start_powered_off docstring
2026-04-24 19:25 [PULL v4 00/62] Misc HW patches for 2026-04-22 Philippe Mathieu-Daudé
@ 2026-04-24 19:25 ` Philippe Mathieu-Daudé
2026-04-24 19:25 ` [PULL v4 28/62] hw: add compat machines for 11.1 Philippe Mathieu-Daudé
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-04-24 19:25 UTC (permalink / raw)
To: qemu-devel
The comment about @start_powered_off is buried within the
CPUState structure. Hoist it to the structure docstring
comment.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260423170229.64655-6-philmd@linaro.org>
---
include/hw/core/cpu.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index 6bdae9ab707..207a7a1becb 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -419,6 +419,7 @@ struct qemu_work_item;
* QOM parent.
* Under TCG this value is propagated to @tcg_cflags.
* See TranslationBlock::TCG CF_CLUSTER_MASK.
+ * @start_powered_off: Indicates whether the CPU starts in powered-off state.
* @tcg_cflags: Pre-computed cflags for this cpu.
* @nr_threads: Number of threads within this CPU core.
* @thread: Host thread details, only live once @created is #true
@@ -502,7 +503,6 @@ struct CPUState {
bool stop;
bool stopped;
- /* Should CPU start in powered-off state? */
bool start_powered_off;
bool unplug;
--
2.53.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL v4 28/62] hw: add compat machines for 11.1
2026-04-24 19:25 [PULL v4 00/62] Misc HW patches for 2026-04-22 Philippe Mathieu-Daudé
2026-04-24 19:25 ` [PULL v4 02/62] hw/core/cpu: Expose CPUState::start_powered_off docstring Philippe Mathieu-Daudé
@ 2026-04-24 19:25 ` Philippe Mathieu-Daudé
2026-04-24 19:25 ` [PULL v4 32/62] qom: Restrict compat properties API to system emulation Philippe Mathieu-Daudé
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-04-24 19:25 UTC (permalink / raw)
To: qemu-devel
From: Cornelia Huck <cohuck@redhat.com>
Add 11.1 machine types for arm/i440fx/m68k/q35/s390x/spapr.
Reviewed-by: Eric Farman <farman@linux.ibm.com> # s390
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Message-ID: <20260331140347.653404-1-cohuck@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/hw/core/boards.h | 3 +++
include/hw/i386/pc.h | 3 +++
hw/arm/virt.c | 11 +++++++++--
hw/core/machine.c | 3 +++
hw/i386/pc.c | 3 +++
hw/i386/pc_piix.c | 13 +++++++++++--
hw/i386/pc_q35.c | 13 +++++++++++--
hw/m68k/virt.c | 11 +++++++++--
hw/ppc/spapr.c | 17 ++++++++++++++---
hw/s390x/s390-virtio-ccw.c | 14 +++++++++++++-
10 files changed, 79 insertions(+), 12 deletions(-)
diff --git a/include/hw/core/boards.h b/include/hw/core/boards.h
index f38b3f5f784..9d4ccd1c1cb 100644
--- a/include/hw/core/boards.h
+++ b/include/hw/core/boards.h
@@ -803,6 +803,9 @@ struct MachineState {
} \
} while (0)
+extern GlobalProperty hw_compat_11_0[];
+extern const size_t hw_compat_11_0_len;
+
extern GlobalProperty hw_compat_10_2[];
extern const size_t hw_compat_10_2_len;
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 22325324d09..85a74363b52 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -208,6 +208,9 @@ void pc_system_parse_ovmf_flash(uint8_t *flash_ptr, size_t flash_size);
/* sgx.c */
void pc_machine_init_sgx_epc(PCMachineState *pcms);
+extern GlobalProperty pc_compat_11_0[];
+extern const size_t pc_compat_11_0_len;
+
extern GlobalProperty pc_compat_10_2[];
extern const size_t pc_compat_10_2_len;
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 1725744d1aa..f62253e1aba 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -4052,10 +4052,17 @@ static void machvirt_machine_init(void)
}
type_init(machvirt_machine_init);
-static void virt_machine_11_0_options(MachineClass *mc)
+static void virt_machine_11_1_options(MachineClass *mc)
{
}
-DEFINE_VIRT_MACHINE_AS_LATEST(11, 0)
+DEFINE_VIRT_MACHINE_AS_LATEST(11, 1)
+
+static void virt_machine_11_0_options(MachineClass *mc)
+{
+ virt_machine_11_1_options(mc);
+ compat_props_add(mc->compat_props, hw_compat_11_0, hw_compat_11_0_len);
+}
+DEFINE_VIRT_MACHINE(11, 0)
static void virt_machine_10_2_options(MachineClass *mc)
{
diff --git a/hw/core/machine.c b/hw/core/machine.c
index 0aa77a57e95..1abc8ae7373 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -38,6 +38,9 @@
#include "hw/acpi/generic_event_device.h"
#include "qemu/audio.h"
+GlobalProperty hw_compat_11_0[] = {};
+const size_t hw_compat_11_0_len = G_N_ELEMENTS(hw_compat_11_0);
+
GlobalProperty hw_compat_10_2[] = {
{ "scsi-block", "migrate-pr", "off" },
{ "isa-cirrus-vga", "global-vmstate", "true" },
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 4b53b5be4a9..2ecad3c503f 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -73,6 +73,9 @@
#include "hw/xen/xen-bus.h"
#endif
+GlobalProperty pc_compat_11_0[] = {};
+const size_t pc_compat_11_0_len = G_N_ELEMENTS(pc_compat_11_0);
+
GlobalProperty pc_compat_10_2[] = {};
const size_t pc_compat_10_2_len = G_N_ELEMENTS(pc_compat_10_2);
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 4d71e0d51a2..82457bdb167 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -428,12 +428,21 @@ static void pc_i440fx_machine_options(MachineClass *m)
pc_piix_compat_defaults, pc_piix_compat_defaults_len);
}
-static void pc_i440fx_machine_11_0_options(MachineClass *m)
+static void pc_i440fx_machine_11_1_options(MachineClass *m)
{
pc_i440fx_machine_options(m);
}
-DEFINE_I440FX_MACHINE_AS_LATEST(11, 0);
+DEFINE_I440FX_MACHINE_AS_LATEST(11, 1);
+
+static void pc_i440fx_machine_11_0_options(MachineClass *m)
+{
+ pc_i440fx_machine_11_1_options(m);
+ compat_props_add(m->compat_props, hw_compat_11_0, hw_compat_11_0_len);
+ compat_props_add(m->compat_props, pc_compat_11_0, pc_compat_11_0_len);
+}
+
+DEFINE_I440FX_MACHINE(11, 0);
static void pc_i440fx_machine_10_2_options(MachineClass *m)
{
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index cb23322f5a4..972dd9275f6 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -364,12 +364,21 @@ static void pc_q35_machine_options(MachineClass *m)
pc_q35_compat_defaults, pc_q35_compat_defaults_len);
}
-static void pc_q35_machine_11_0_options(MachineClass *m)
+static void pc_q35_machine_11_1_options(MachineClass *m)
{
pc_q35_machine_options(m);
}
-DEFINE_Q35_MACHINE_AS_LATEST(11, 0);
+DEFINE_Q35_MACHINE_AS_LATEST(11, 1);
+
+static void pc_q35_machine_11_0_options(MachineClass *m)
+{
+ pc_q35_machine_11_1_options(m);
+ compat_props_add(m->compat_props, hw_compat_11_0, hw_compat_11_0_len);
+ compat_props_add(m->compat_props, pc_compat_11_0, pc_compat_11_0_len);
+}
+
+DEFINE_Q35_MACHINE(11, 0);
static void pc_q35_machine_10_2_options(MachineClass *m)
{
diff --git a/hw/m68k/virt.c b/hw/m68k/virt.c
index cf8ebd65e30..51158ce1c08 100644
--- a/hw/m68k/virt.c
+++ b/hw/m68k/virt.c
@@ -367,10 +367,17 @@ type_init(virt_machine_register_types)
#define DEFINE_VIRT_MACHINE(major, minor) \
DEFINE_VIRT_MACHINE_IMPL(false, major, minor)
-static void virt_machine_11_0_options(MachineClass *mc)
+static void virt_machine_11_1_options(MachineClass *mc)
{
}
-DEFINE_VIRT_MACHINE_AS_LATEST(11, 0)
+DEFINE_VIRT_MACHINE_AS_LATEST(11, 1)
+
+static void virt_machine_11_0_options(MachineClass *mc)
+{
+ virt_machine_11_1_options(mc);
+ compat_props_add(mc->compat_props, hw_compat_11_0, hw_compat_11_0_len);
+}
+DEFINE_VIRT_MACHINE(11, 0)
static void virt_machine_10_2_options(MachineClass *mc)
{
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 0ab39dfea6b..428b491a7df 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -4761,14 +4761,25 @@ static void spapr_machine_latest_class_options(MachineClass *mc)
DEFINE_SPAPR_MACHINE_IMPL(false, major, minor)
/*
- * pseries-11.0
+ * pseries-11.1
*/
-static void spapr_machine_11_0_class_options(MachineClass *mc)
+static void spapr_machine_11_1_class_options(MachineClass *mc)
{
/* Defaults for the latest behaviour inherited from the base class */
}
-DEFINE_SPAPR_MACHINE_AS_LATEST(11, 0);
+DEFINE_SPAPR_MACHINE_AS_LATEST(11, 1);
+
+/*
+ * pseries-11.0
+ */
+static void spapr_machine_11_0_class_options(MachineClass *mc)
+{
+ spapr_machine_11_1_class_options(mc);
+ compat_props_add(mc->compat_props, hw_compat_11_0, hw_compat_11_0_len);
+}
+
+DEFINE_SPAPR_MACHINE(11, 0);
/*
* pseries-10.2
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index 3ef009463d1..cc768daeb04 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -907,14 +907,26 @@ static const TypeInfo ccw_machine_info = {
DEFINE_CCW_MACHINE_IMPL(false, major, minor)
+static void ccw_machine_11_1_instance_options(MachineState *machine)
+{
+}
+
+static void ccw_machine_11_1_class_options(MachineClass *mc)
+{
+}
+DEFINE_CCW_MACHINE_AS_LATEST(11, 1);
+
static void ccw_machine_11_0_instance_options(MachineState *machine)
{
+ ccw_machine_11_1_instance_options(machine);
}
static void ccw_machine_11_0_class_options(MachineClass *mc)
{
+ ccw_machine_11_1_class_options(mc);
+ compat_props_add(mc->compat_props, hw_compat_11_0, hw_compat_11_0_len);
}
-DEFINE_CCW_MACHINE_AS_LATEST(11, 0);
+DEFINE_CCW_MACHINE(11, 0);
static void ccw_machine_10_2_instance_options(MachineState *machine)
{
--
2.53.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL v4 32/62] qom: Restrict compat properties API to system emulation
2026-04-24 19:25 [PULL v4 00/62] Misc HW patches for 2026-04-22 Philippe Mathieu-Daudé
2026-04-24 19:25 ` [PULL v4 02/62] hw/core/cpu: Expose CPUState::start_powered_off docstring Philippe Mathieu-Daudé
2026-04-24 19:25 ` [PULL v4 28/62] hw: add compat machines for 11.1 Philippe Mathieu-Daudé
@ 2026-04-24 19:25 ` Philippe Mathieu-Daudé
2026-04-24 19:25 ` [PULL v4 48/62] hw/cxl: Define cxl_fmws_get_all_sorted() stub Philippe Mathieu-Daudé
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-04-24 19:25 UTC (permalink / raw)
To: qemu-devel
Move compat properties API definitions to their own file
unit, compile it only when system emulation is configured.
Add a pair of stubs for user emulation.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Message-Id: <20260325151728.45378-6-philmd@linaro.org>
---
MAINTAINERS | 1 +
qom/compat-properties.c | 76 +++++++++++++++++++++++++++++++++++
qom/object.c | 60 ---------------------------
stubs/qom-compat-properties.c | 14 +++++++
qom/meson.build | 3 ++
stubs/meson.build | 1 +
6 files changed, 95 insertions(+), 60 deletions(-)
create mode 100644 qom/compat-properties.c
create mode 100644 stubs/qom-compat-properties.c
diff --git a/MAINTAINERS b/MAINTAINERS
index facc4b499a9..45d258f64fc 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3533,6 +3533,7 @@ F: qapi/qom.json
F: scripts/coccinelle/qom-parent-type.cocci
F: scripts/qom-cast-macro-clean-cocci-gen.py
F: qom/
+F: stubs/qom-compat-properties.c
F: tests/unit/check-qom-interface.c
F: tests/unit/check-qom-proplist.c
F: tests/qtest/qom-test.c
diff --git a/qom/compat-properties.c b/qom/compat-properties.c
new file mode 100644
index 00000000000..2110754155a
--- /dev/null
+++ b/qom/compat-properties.c
@@ -0,0 +1,76 @@
+/*
+ * QEMU Object Model
+ *
+ * Copyright IBM, Corp. 2011
+ *
+ * Authors:
+ * Anthony Liguori <aliguori@us.ibm.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/error.h"
+#include "qom/compat-properties.h"
+#include "qom/qom-qobject.h"
+#include "hw/core/qdev.h"
+
+/*
+ * Global property defaults
+ * Slot 0: accelerator's global property defaults
+ * Slot 1: machine's global property defaults
+ * Slot 2: global properties from legacy command line option
+ * Each is a GPtrArray of GlobalProperty.
+ * Applied in order, later entries override earlier ones.
+ */
+static GPtrArray *object_compat_props[3];
+
+/*
+ * Retrieve @GPtrArray for global property defined with options
+ * other than "-global". These are generally used for syntactic
+ * sugar and legacy command line options.
+ */
+void object_register_sugar_prop(const char *driver, const char *prop,
+ const char *value, bool optional)
+{
+ GlobalProperty *g;
+ if (!object_compat_props[2]) {
+ object_compat_props[2] = g_ptr_array_new();
+ }
+ g = g_new0(GlobalProperty, 1);
+ g->driver = g_strdup(driver);
+ g->property = g_strdup(prop);
+ g->value = g_strdup(value);
+ g->optional = optional;
+ g_ptr_array_add(object_compat_props[2], g);
+}
+
+/*
+ * Set machine's global property defaults to @compat_props.
+ * May be called at most once.
+ */
+void object_set_machine_compat_props(GPtrArray *compat_props)
+{
+ assert(!object_compat_props[1]);
+ object_compat_props[1] = compat_props;
+}
+
+/*
+ * Set accelerator's global property defaults to @compat_props.
+ * May be called at most once.
+ */
+void object_set_accelerator_compat_props(GPtrArray *compat_props)
+{
+ assert(!object_compat_props[0]);
+ object_compat_props[0] = compat_props;
+}
+
+void object_apply_compat_props(Object *obj)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(object_compat_props); i++) {
+ object_apply_global_props(obj, object_compat_props[i],
+ i == 2 ? &error_fatal : &error_abort);
+ }
+}
diff --git a/qom/object.c b/qom/object.c
index d6500bcbbf4..f981e270440 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -480,66 +480,6 @@ bool object_apply_global_props(Object *obj, const GPtrArray *props,
return true;
}
-/*
- * Global property defaults
- * Slot 0: accelerator's global property defaults
- * Slot 1: machine's global property defaults
- * Slot 2: global properties from legacy command line option
- * Each is a GPtrArray of GlobalProperty.
- * Applied in order, later entries override earlier ones.
- */
-static GPtrArray *object_compat_props[3];
-
-/*
- * Retrieve @GPtrArray for global property defined with options
- * other than "-global". These are generally used for syntactic
- * sugar and legacy command line options.
- */
-void object_register_sugar_prop(const char *driver, const char *prop,
- const char *value, bool optional)
-{
- GlobalProperty *g;
- if (!object_compat_props[2]) {
- object_compat_props[2] = g_ptr_array_new();
- }
- g = g_new0(GlobalProperty, 1);
- g->driver = g_strdup(driver);
- g->property = g_strdup(prop);
- g->value = g_strdup(value);
- g->optional = optional;
- g_ptr_array_add(object_compat_props[2], g);
-}
-
-/*
- * Set machine's global property defaults to @compat_props.
- * May be called at most once.
- */
-void object_set_machine_compat_props(GPtrArray *compat_props)
-{
- assert(!object_compat_props[1]);
- object_compat_props[1] = compat_props;
-}
-
-/*
- * Set accelerator's global property defaults to @compat_props.
- * May be called at most once.
- */
-void object_set_accelerator_compat_props(GPtrArray *compat_props)
-{
- assert(!object_compat_props[0]);
- object_compat_props[0] = compat_props;
-}
-
-void object_apply_compat_props(Object *obj)
-{
- int i;
-
- for (i = 0; i < ARRAY_SIZE(object_compat_props); i++) {
- object_apply_global_props(obj, object_compat_props[i],
- i == 2 ? &error_fatal : &error_abort);
- }
-}
-
static void object_class_property_init_all(Object *obj)
{
ObjectPropertyIterator iter;
diff --git a/stubs/qom-compat-properties.c b/stubs/qom-compat-properties.c
new file mode 100644
index 00000000000..2c955677bed
--- /dev/null
+++ b/stubs/qom-compat-properties.c
@@ -0,0 +1,14 @@
+/*
+ * QEMU Object Model (compat properties stubs for user emulation)
+ *
+ * Copyright (c) Linaro
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "qom/compat-properties.h"
+
+void object_apply_compat_props(Object *obj)
+{
+}
diff --git a/qom/meson.build b/qom/meson.build
index 81922434309..bd6f4aadd78 100644
--- a/qom/meson.build
+++ b/qom/meson.build
@@ -5,6 +5,9 @@ qom_ss.add(files(
'object_interfaces.c',
'qom-qobject.c',
))
+if have_system
+ qom_ss.add(files('compat-properties.c'))
+endif
qmp_ss.add(files('qom-qmp-cmds.c'))
system_ss.add(files('qom-hmp-cmds.c'))
diff --git a/stubs/meson.build b/stubs/meson.build
index 7189ff63ed5..f33b1d2a089 100644
--- a/stubs/meson.build
+++ b/stubs/meson.build
@@ -54,6 +54,7 @@ if have_user
# Symbols that are used by hw/core.
stub_ss.add(files('cpu-synchronize-state.c'))
stub_ss.add(files('cpu-destroy-address-spaces.c'))
+ stub_ss.add(files('qom-compat-properties.c'))
# Stubs for QAPI events. Those can always be included in the build, but
# they are not built at all for --disable-system builds.
--
2.53.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL v4 48/62] hw/cxl: Define cxl_fmws_get_all_sorted() stub
2026-04-24 19:25 [PULL v4 00/62] Misc HW patches for 2026-04-22 Philippe Mathieu-Daudé
` (2 preceding siblings ...)
2026-04-24 19:25 ` [PULL v4 32/62] qom: Restrict compat properties API to system emulation Philippe Mathieu-Daudé
@ 2026-04-24 19:25 ` Philippe Mathieu-Daudé
2026-04-24 19:25 ` [PULL v4 49/62] hw/arm/virt: Do not select Kconfig symbol PCI_EXPRESS Philippe Mathieu-Daudé
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-04-24 19:25 UTC (permalink / raw)
To: qemu-devel
Add a stub for cxl_fmws_get_all_sorted() to fix building
a QEMU configured with the '--without-default-devices' option:
Undefined symbols for architecture arm64:
"_cxl_fmws_get_all_sorted", referenced from:
_cxl_build_cedt in hw_acpi_cxl.c.o
Note, the CXL <-> ACPI Kconfig relationship is a bit convoluted.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260423170229.64655-3-philmd@linaro.org>
---
hw/cxl/cxl-host-stubs.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/hw/cxl/cxl-host-stubs.c b/hw/cxl/cxl-host-stubs.c
index c015baac813..9b515913ea4 100644
--- a/hw/cxl/cxl-host-stubs.c
+++ b/hw/cxl/cxl-host-stubs.c
@@ -18,3 +18,8 @@ hwaddr cxl_fmws_set_memmap(hwaddr base, hwaddr max_addr)
void cxl_fmws_update_mmio(void) {};
const MemoryRegionOps cfmws_ops;
+
+GSList *cxl_fmws_get_all_sorted(void)
+{
+ g_assert_not_reached();
+}
--
2.53.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL v4 49/62] hw/arm/virt: Do not select Kconfig symbol PCI_EXPRESS
2026-04-24 19:25 [PULL v4 00/62] Misc HW patches for 2026-04-22 Philippe Mathieu-Daudé
` (3 preceding siblings ...)
2026-04-24 19:25 ` [PULL v4 48/62] hw/cxl: Define cxl_fmws_get_all_sorted() stub Philippe Mathieu-Daudé
@ 2026-04-24 19:25 ` Philippe Mathieu-Daudé
2026-04-24 19:25 ` [PULL v4 50/62] hw/usb/hcd-ehci: Remove unused EHCIfstn structure and dead code Philippe Mathieu-Daudé
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-04-24 19:25 UTC (permalink / raw)
To: qemu-devel
The PCIe bus is not provided by the Virt machine but by
its GPEX host bridge (selected via PCI_EXPRESS_GENERIC_BRIDGE).
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260423170229.64655-4-philmd@linaro.org>
---
hw/arm/Kconfig | 1 -
1 file changed, 1 deletion(-)
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
index 4e50fb1111f..41d5e968c86 100644
--- a/hw/arm/Kconfig
+++ b/hw/arm/Kconfig
@@ -15,7 +15,6 @@ config ARM_VIRT
select GPIO_KEY
select DEVICE_TREE
select FW_CFG_DMA
- select PCI_EXPRESS
select PCI_EXPRESS_GENERIC_BRIDGE
select PFLASH_CFI01
select PL011 # UART
--
2.53.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL v4 50/62] hw/usb/hcd-ehci: Remove unused EHCIfstn structure and dead code
2026-04-24 19:25 [PULL v4 00/62] Misc HW patches for 2026-04-22 Philippe Mathieu-Daudé
` (4 preceding siblings ...)
2026-04-24 19:25 ` [PULL v4 49/62] hw/arm/virt: Do not select Kconfig symbol PCI_EXPRESS Philippe Mathieu-Daudé
@ 2026-04-24 19:25 ` Philippe Mathieu-Daudé
2026-04-24 19:25 ` [PULL v4 51/62] hw/usb/hcd-ehci.h: Fix coding style issues reported by checkpatch Philippe Mathieu-Daudé
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-04-24 19:25 UTC (permalink / raw)
To: qemu-devel
From: Jamin Lin <jamin_lin@aspeedtech.com>
The EHCIfstn structure, defined according to EHCI spec section 3.7,
is currently unused in the EHCI implementation. Remove it to reduce
unused code and improve maintainability.
Additionally, drop a block of disabled (#if 0) code in
ehci_state_advqueue() that was never implemented. This code path
is incomplete and has no functional impact.
No functional change.
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-ID: <20260424080508.53992-3-jamin_lin@aspeedtech.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/usb/hcd-ehci.h | 7 -------
hw/usb/hcd-ehci.c | 6 ------
2 files changed, 13 deletions(-)
diff --git a/hw/usb/hcd-ehci.h b/hw/usb/hcd-ehci.h
index 0ae8c06331a..3aec0e047c9 100644
--- a/hw/usb/hcd-ehci.h
+++ b/hw/usb/hcd-ehci.h
@@ -202,13 +202,6 @@ typedef struct EHCIqh {
#define BUFPTR_SBYTES_SH 5
} EHCIqh;
-/* EHCI spec version 1.0 Section 3.7
- */
-typedef struct EHCIfstn {
- uint32_t next; /* Standard next link pointer */
- uint32_t backptr; /* Standard next link pointer */
-} EHCIfstn;
-
enum async_state {
EHCI_ASYNC_NONE = 0,
EHCI_ASYNC_INITIALIZED,
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index 57f930b0998..23167bf96f3 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -1756,16 +1756,10 @@ static int ehci_state_fetchsitd(EHCIState *ehci, int async)
/* Section 4.10.2 - paragraph 3 */
static int ehci_state_advqueue(EHCIQueue *q)
{
-#if 0
/* TO-DO: 4.10.2 - paragraph 2
* if I-bit is set to 1 and QH is not active
* go to horizontal QH
*/
- if (I-bit set) {
- ehci_set_state(ehci, async, EST_HORIZONTALQH);
- goto out;
- }
-#endif
/*
* want data and alt-next qTD is valid
--
2.53.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL v4 51/62] hw/usb/hcd-ehci.h: Fix coding style issues reported by checkpatch
2026-04-24 19:25 [PULL v4 00/62] Misc HW patches for 2026-04-22 Philippe Mathieu-Daudé
` (5 preceding siblings ...)
2026-04-24 19:25 ` [PULL v4 50/62] hw/usb/hcd-ehci: Remove unused EHCIfstn structure and dead code Philippe Mathieu-Daudé
@ 2026-04-24 19:25 ` Philippe Mathieu-Daudé
2026-04-24 19:25 ` [PULL v4 52/62] hw/usb/hcd-ehci.c: " Philippe Mathieu-Daudé
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-04-24 19:25 UTC (permalink / raw)
To: qemu-devel
From: Jamin Lin <jamin_lin@aspeedtech.com>
No functional change.
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260424080508.53992-4-jamin_lin@aspeedtech.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/usb/hcd-ehci.h | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/hw/usb/hcd-ehci.h b/hw/usb/hcd-ehci.h
index 3aec0e047c9..736407fd521 100644
--- a/hw/usb/hcd-ehci.h
+++ b/hw/usb/hcd-ehci.h
@@ -43,7 +43,8 @@ typedef struct EHCIPacket EHCIPacket;
typedef struct EHCIQueue EHCIQueue;
typedef struct EHCIState EHCIState;
-/* EHCI spec version 1.0 Section 3.3
+/*
+ * EHCI spec version 1.0 Section 3.3
*/
typedef struct EHCIitd {
uint32_t next;
@@ -74,7 +75,8 @@ typedef struct EHCIitd {
#define ITD_BUFPTR_MULT_SH 0
} EHCIitd;
-/* EHCI spec version 1.0 Section 3.4
+/*
+ * EHCI spec version 1.0 Section 3.4
*/
typedef struct EHCIsitd {
uint32_t next; /* Standard next link pointer */
@@ -118,7 +120,8 @@ typedef struct EHCIsitd {
uint32_t backptr; /* Standard next link pointer */
} EHCIsitd;
-/* EHCI spec version 1.0 Section 3.5
+/*
+ * EHCI spec version 1.0 Section 3.5
*/
typedef struct EHCIqtd {
uint32_t next; /* Standard next link pointer */
@@ -148,7 +151,8 @@ typedef struct EHCIqtd {
#define QTD_BUFPTR_SH 12
} EHCIqtd;
-/* EHCI spec version 1.0 Section 3.6
+/*
+ * EHCI spec version 1.0 Section 3.6
*/
typedef struct EHCIqh {
uint32_t next; /* Standard next link pointer */
@@ -230,7 +234,8 @@ struct EHCIQueue {
int async;
int transact_ctr;
- /* cached data from guest - needs to be flushed
+ /*
+ * cached data from guest - needs to be flushed
* when guest removes an entry (doorbell, handshake sequence)
*/
EHCIqh qh; /* copy of current QH (being worked on) */
@@ -268,7 +273,7 @@ struct EHCIState {
*/
uint8_t caps[CAPA_SIZE];
union {
- uint32_t opreg[0x44/sizeof(uint32_t)];
+ uint32_t opreg[0x44 / sizeof(uint32_t)];
struct {
uint32_t usbcmd;
uint32_t usbsts;
--
2.53.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL v4 52/62] hw/usb/hcd-ehci.c: Fix coding style issues reported by checkpatch
2026-04-24 19:25 [PULL v4 00/62] Misc HW patches for 2026-04-22 Philippe Mathieu-Daudé
` (6 preceding siblings ...)
2026-04-24 19:25 ` [PULL v4 51/62] hw/usb/hcd-ehci.h: Fix coding style issues reported by checkpatch Philippe Mathieu-Daudé
@ 2026-04-24 19:25 ` Philippe Mathieu-Daudé
2026-04-24 19:25 ` [PULL v4 53/62] hw/usb/hcd-ehci.c: Replace fprintf(stderr, ...) with qemu_log_mask(LOG_GUEST_ERROR) Philippe Mathieu-Daudé
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-04-24 19:25 UTC (permalink / raw)
To: qemu-devel
From: Jamin Lin <jamin_lin@aspeedtech.com>
No functional change.
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260424080508.53992-5-jamin_lin@aspeedtech.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/usb/hcd-ehci.c | 129 +++++++++++++++++++++++++---------------------
1 file changed, 71 insertions(+), 58 deletions(-)
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index 23167bf96f3..7e0b767eb9e 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -41,21 +41,23 @@
#define FRAME_TIMER_NS (NANOSECONDS_PER_SECOND / FRAME_TIMER_FREQ)
#define UFRAME_TIMER_NS (FRAME_TIMER_NS / 8)
-#define NB_MAXINTRATE 8 // Max rate at which controller issues ints
-#define BUFF_SIZE 5*4096 // Max bytes to transfer per transaction
-#define MAX_QH 100 // Max allowable queue heads in a chain
+#define NB_MAXINTRATE 8 /* Max rate at which controller issues ints */
+#define BUFF_SIZE (5 * 4096) /* Max bytes to transfer per transaction */
+#define MAX_QH 100 /* Max allowable queue heads in a chain */
#define MIN_UFR_PER_TICK 24 /* Min frames to process when catching up */
#define PERIODIC_ACTIVE 512 /* Micro-frames */
-/* Internal periodic / asynchronous schedule state machine states
+/*
+ * Internal periodic / asynchronous schedule state machine states
*/
typedef enum {
EST_INACTIVE = 1000,
EST_ACTIVE,
EST_EXECUTING,
EST_SLEEPING,
- /* The following states are internal to the state machine function
- */
+ /*
+ * The following states are internal to the state machine function
+ */
EST_WAITLISTHEAD,
EST_FETCHENTRY,
EST_FETCHQH,
@@ -71,13 +73,13 @@ typedef enum {
/* macros for accessing fields within next link pointer entry */
#define NLPTR_GET(x) ((x) & 0xffffffe0)
#define NLPTR_TYPE_GET(x) (((x) >> 1) & 3)
-#define NLPTR_TBIT(x) ((x) & 1) // 1=invalid, 0=valid
+#define NLPTR_TBIT(x) ((x) & 1) /* 1=invalid, 0=valid */
/* link pointer types */
-#define NLPTR_TYPE_ITD 0 // isoc xfer descriptor
-#define NLPTR_TYPE_QH 1 // queue head
-#define NLPTR_TYPE_STITD 2 // split xaction, isoc xfer descriptor
-#define NLPTR_TYPE_FSTN 3 // frame span traversal node
+#define NLPTR_TYPE_ITD 0 /* isoc xfer descriptor */
+#define NLPTR_TYPE_QH 1 /* queue head */
+#define NLPTR_TYPE_STITD 2 /* split xaction, isoc xfer descriptor */
+#define NLPTR_TYPE_FSTN 3 /* frame span traversal node */
#define SET_LAST_RUN_CLOCK(s) \
(s)->last_run_ns = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
@@ -88,10 +90,10 @@ typedef enum {
#define set_field(data, newval, field) do { \
uint32_t val = *data; \
- val &= ~ field##_MASK; \
+ val &= ~field##_MASK; \
val |= ((newval) << field##_SH) & field##_MASK; \
*data = val; \
- } while(0)
+ } while (0)
static const char *ehci_state_names[] = {
[EST_INACTIVE] = "INACTIVE",
@@ -472,8 +474,10 @@ static bool ehci_verify_pid(EHCIQueue *q, EHCIqtd *qtd)
}
}
-/* Finish executing and writeback a packet outside of the regular
- fetchqh -> fetchqtd -> execute -> writeback cycle */
+/*
+ * Finish executing and writeback a packet outside of the regular
+ * fetchqh -> fetchqtd -> execute -> writeback cycle
+ */
static void ehci_writeback_async_complete_packet(EHCIPacket *p)
{
EHCIQueue *q = p->queue;
@@ -733,7 +737,7 @@ static void ehci_detach(USBPort *port)
ehci_queues_rip_device(s, port->dev, 0);
ehci_queues_rip_device(s, port->dev, 1);
- *portsc &= ~(PORTSC_CONNECT|PORTSC_PED|PORTSC_SUSPEND);
+ *portsc &= ~(PORTSC_CONNECT | PORTSC_PED | PORTSC_SUSPEND);
*portsc |= PORTSC_CSC;
ehci_raise_irq(s, USBSTS_PCD);
@@ -858,7 +862,7 @@ void ehci_reset(void *opaque)
* Do the detach before touching portsc, so that it correctly gets send to
* us or to our companion based on PORTSC_POWNER before the reset.
*/
- for(i = 0; i < EHCI_PORTS; i++) {
+ for (i = 0; i < EHCI_PORTS; i++) {
devs[i] = s->ports[i].dev;
if (devs[i] && devs[i]->attached) {
usb_detach(&s->ports[i]);
@@ -877,7 +881,7 @@ void ehci_reset(void *opaque)
s->astate = EST_INACTIVE;
s->pstate = EST_INACTIVE;
- for(i = 0; i < EHCI_PORTS; i++) {
+ for (i = 0; i < EHCI_PORTS; i++) {
if (s->companion_ports[i]) {
s->portsc[i] = PORTSC_POWNER | PORTSC_PPOWER;
} else {
@@ -942,8 +946,9 @@ static void handle_port_owner_write(EHCIState *s, int port, uint32_t owner)
uint32_t *portsc = &s->portsc[port];
uint32_t orig;
- if (s->companion_ports[port] == NULL)
+ if (s->companion_ports[port] == NULL) {
return;
+ }
owner = owner & PORTSC_POWNER;
orig = *portsc & PORTSC_POWNER;
@@ -988,7 +993,7 @@ static void ehci_port_write(void *ptr, hwaddr addr,
trace_usb_ehci_port_reset(port, 1);
}
- if (!(val & PORTSC_PRESET) &&(*portsc & PORTSC_PRESET)) {
+ if (!(val & PORTSC_PRESET) && (*portsc & PORTSC_PRESET)) {
trace_usb_ehci_port_reset(port, 0);
if (dev && dev->attached) {
usb_port_reset(&s->ports[port]);
@@ -1065,8 +1070,10 @@ static void ehci_opreg_write(void *ptr, hwaddr addr,
break;
case USBSTS:
- val &= USBSTS_RO_MASK; // bits 6 through 31 are RO
- ehci_clear_usbsts(s, val); // bits 0 through 5 are R/WC
+ /* bits 6 through 31 are RO */
+ val &= USBSTS_RO_MASK;
+ /* bits 0 through 5 are R/WC */
+ ehci_clear_usbsts(s, val);
val = s->usbsts;
ehci_update_irq(s);
break;
@@ -1131,8 +1138,7 @@ static void ehci_flush_qh(EHCIQueue *q)
put_dwords(q->ehci, addr + 3 * sizeof(uint32_t), qh + 3, dwords - 3);
}
-// 4.10.2
-
+/* 4.10.2 */
static int ehci_qh_do_overlay(EHCIQueue *q)
{
EHCIPacket *p = QTAILQ_FIRST(&q->packets);
@@ -1145,8 +1151,7 @@ static int ehci_qh_do_overlay(EHCIQueue *q)
assert(p != NULL);
assert(p->qtdaddr == q->qtdaddr);
- // remember values in fields to preserve in qh after overlay
-
+ /* remember values in fields to preserve in qh after overlay */
dtoggle = q->qh.token & QTD_TOKEN_DTOGGLE;
ping = q->qh.token & QTD_TOKEN_PING;
@@ -1170,7 +1175,7 @@ static int ehci_qh_do_overlay(EHCIQueue *q)
}
if (!(q->qh.epchar & QH_EPCHAR_DTC)) {
- // preserve QH DT bit
+ /* preserve QH DT bit */
q->qh.token &= ~QTD_TOKEN_DTOGGLE;
q->qh.token |= dtoggle;
}
@@ -1397,9 +1402,7 @@ static int ehci_execute(EHCIPacket *p, const char *action)
return 1;
}
-/* 4.7.2
- */
-
+/* 4.7.2 */
static int ehci_process_itd(EHCIState *ehci,
EHCIitd *itd,
uint32_t addr)
@@ -1411,13 +1414,13 @@ static int ehci_process_itd(EHCIState *ehci,
ehci->periodic_sched_active = PERIODIC_ACTIVE;
- dir =(itd->bufptr[1] & ITD_BUFPTR_DIRECTION);
+ dir = (itd->bufptr[1] & ITD_BUFPTR_DIRECTION);
devaddr = get_field(itd->bufptr[0], ITD_BUFPTR_DEVADDR);
endp = get_field(itd->bufptr[0], ITD_BUFPTR_EP);
max = get_field(itd->bufptr[1], ITD_BUFPTR_MAXPKT);
mult = get_field(itd->bufptr[2], ITD_BUFPTR_MULT);
- for(i = 0; i < 8; i++) {
+ for (i = 0; i < 8; i++) {
if (itd->transact[i] & ITD_XACT_ACTIVE) {
pg = get_field(itd->transact[i], ITD_XACT_PGSEL);
off = itd->transact[i] & ITD_XACT_OFFSET_MASK;
@@ -1513,8 +1516,9 @@ static int ehci_process_itd(EHCIState *ehci,
}
-/* This state is the entry point for asynchronous schedule
- * processing. Entry here constitutes a EHCI start event state (4.8.5)
+/*
+ * This state is the entry point for asynchronous schedule
+ * processing. Entry here constitutes a EHCI start event state (4.8.5)
*/
static int ehci_state_waitlisthead(EHCIState *ehci, int async)
{
@@ -1531,7 +1535,7 @@ static int ehci_state_waitlisthead(EHCIState *ehci, int async)
ehci_queues_rip_unused(ehci, async);
/* Find the head of the list (4.9.1.1) */
- for(i = 0; i < MAX_QH; i++) {
+ for (i = 0; i < MAX_QH; i++) {
if (get_dwords(ehci, NLPTR_GET(entry), (uint32_t *) &qh,
sizeof(EHCIqh) >> 2) < 0) {
return 0;
@@ -1564,8 +1568,9 @@ out:
}
-/* This state is the entry point for periodic schedule processing as
- * well as being a continuation state for async processing.
+/*
+ * This state is the entry point for periodic schedule processing as
+ * well as being a continuation state for async processing.
*/
static int ehci_state_fetchentry(EHCIState *ehci, int async)
{
@@ -1674,7 +1679,7 @@ static EHCIQueue *ehci_state_fetchqh(EHCIState *ehci, int async)
#if EHCI_DEBUG
if (q->qhaddr != q->qh.next) {
- DPRINTF("FETCHQH: QH 0x%08x (h %x halt %x active %x) next 0x%08x\n",
+ DPRINTF("FETCHQH: QH 0x%08x (h %x halt %x active %x) next 0x%08x\n",
q->qhaddr,
q->qh.epchar & QH_EPCHAR_H,
q->qh.token & QTD_TOKEN_HALT,
@@ -1756,7 +1761,8 @@ static int ehci_state_fetchsitd(EHCIState *ehci, int async)
/* Section 4.10.2 - paragraph 3 */
static int ehci_state_advqueue(EHCIQueue *q)
{
- /* TO-DO: 4.10.2 - paragraph 2
+ /*
+ * TO-DO: 4.10.2 - paragraph 2
* if I-bit is set to 1 and QH is not active
* go to horizontal QH
*/
@@ -1929,8 +1935,10 @@ static int ehci_state_execute(EHCIQueue *q)
return -1;
}
- // TODO verify enough time remains in the uframe as in 4.4.1.1
- // TODO write back ptr to async list when done or out of time
+ /*
+ * TODO verify enough time remains in the uframe as in 4.4.1.1
+ * TODO write back ptr to async list when done or out of time
+ */
/* 4.10.3, bottom of page 82, go horizontal on transaction counter == 0 */
if (!q->async && q->transact_ctr == 0) {
@@ -2041,7 +2049,7 @@ static void ehci_advance_state(EHCIState *ehci, int async)
int again;
do {
- switch(ehci_get_state(ehci, async)) {
+ switch (ehci_get_state(ehci, async)) {
case EST_WAITLISTHEAD:
again = ehci_state_waitlisthead(ehci, async);
break;
@@ -2120,21 +2128,20 @@ static void ehci_advance_state(EHCIState *ehci, int async)
ehci_reset(ehci);
again = 0;
}
- }
- while (again);
+ } while (again);
}
static void ehci_advance_async_state(EHCIState *ehci)
{
const int async = 1;
- switch(ehci_get_state(ehci, async)) {
+ switch (ehci_get_state(ehci, async)) {
case EST_INACTIVE:
if (!ehci_async_enabled(ehci)) {
break;
}
ehci_set_state(ehci, async, EST_ACTIVE);
- // No break, fall through to ACTIVE
+ /* No break, fall through to ACTIVE */
case EST_ACTIVE:
if (!ehci_async_enabled(ehci)) {
@@ -2158,7 +2165,8 @@ static void ehci_advance_async_state(EHCIState *ehci)
ehci_set_state(ehci, async, EST_WAITLISTHEAD);
ehci_advance_state(ehci, async);
- /* If the doorbell is set, the guest wants to make a change to the
+ /*
+ * If the doorbell is set, the guest wants to make a change to the
* schedule. The host controller needs to release cached data.
* (section 4.8.2)
*/
@@ -2185,13 +2193,13 @@ static void ehci_advance_periodic_state(EHCIState *ehci)
uint32_t list;
const int async = 0;
- // 4.6
+ /* 4.6 */
- switch(ehci_get_state(ehci, async)) {
+ switch (ehci_get_state(ehci, async)) {
case EST_INACTIVE:
if (!(ehci->frindex & 7) && ehci_periodic_enabled(ehci)) {
ehci_set_state(ehci, async, EST_ACTIVE);
- // No break, fall through to ACTIVE
+ /* No break, fall through to ACTIVE */
} else
break;
@@ -2215,7 +2223,7 @@ static void ehci_advance_periodic_state(EHCIState *ehci)
DPRINTF("PERIODIC state adv fr=%d. [%08X] -> %08X\n",
ehci->frindex / 8, list, entry);
- ehci_set_fetch_addr(ehci, async,entry);
+ ehci_set_fetch_addr(ehci, async, entry);
ehci_set_state(ehci, async, EST_FETCHENTRY);
ehci_advance_state(ehci, async);
ehci_queues_rip_unused(ehci, async);
@@ -2240,7 +2248,8 @@ static void ehci_update_frindex(EHCIState *ehci, int uframes)
ehci_raise_irq(ehci, USBSTS_FLR);
}
- /* How many times will frindex roll over 0x4000 with this frame count?
+ /*
+ * How many times will frindex roll over 0x4000 with this frame count?
* usbsts_frindex is decremented by 0x4000 on rollover until it reaches 0
*/
int rollovers = (ehci->frindex + uframes) / 0x4000;
@@ -2320,8 +2329,9 @@ static void ehci_work_bh(void *opaque)
ehci->async_stepdown++;
}
- /* Async is not inside loop since it executes everything it can once
- * called
+ /*
+ * Async is not inside loop since it executes everything it can once
+ * called
*/
if (ehci_async_enabled(ehci) || ehci->astate != EST_INACTIVE) {
need_timer++;
@@ -2339,15 +2349,18 @@ static void ehci_work_bh(void *opaque)
}
if (need_timer) {
- /* If we've raised int, we speed up the timer, so that we quickly
- * notice any new packets queued up in response */
+ /*
+ * If we've raised int, we speed up the timer, so that we quickly
+ * notice any new packets queued up in response
+ */
if (ehci->int_req_by_async && (ehci->usbsts & USBSTS_INT)) {
expire_time = t_now +
NANOSECONDS_PER_SECOND / (FRAME_TIMER_FREQ * 4);
ehci->int_req_by_async = false;
} else {
- expire_time = t_now + (NANOSECONDS_PER_SECOND
- * (ehci->async_stepdown+1) / FRAME_TIMER_FREQ);
+ expire_time = t_now
+ + (NANOSECONDS_PER_SECOND * (ehci->async_stepdown + 1) /
+ FRAME_TIMER_FREQ);
}
timer_mod(ehci->frame_timer, expire_time);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL v4 53/62] hw/usb/hcd-ehci.c: Replace fprintf(stderr, ...) with qemu_log_mask(LOG_GUEST_ERROR)
2026-04-24 19:25 [PULL v4 00/62] Misc HW patches for 2026-04-22 Philippe Mathieu-Daudé
` (7 preceding siblings ...)
2026-04-24 19:25 ` [PULL v4 52/62] hw/usb/hcd-ehci.c: " Philippe Mathieu-Daudé
@ 2026-04-24 19:25 ` Philippe Mathieu-Daudé
2026-04-24 19:25 ` [PULL v4 54/62] hw/usb/hcd-ehci: Replace DPRINTF debug logs with trace events Philippe Mathieu-Daudé
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-04-24 19:25 UTC (permalink / raw)
To: qemu-devel
From: Jamin Lin <jamin_lin@aspeedtech.com>
Replace direct fprintf(stderr, ...) calls with qemu_log_mask()
using LOG_GUEST_ERROR in the EHCI controller implementation.
Direct writes to stderr are discouraged in QEMU as they bypass
the logging framework and cannot be filtered or controlled at
runtime. Using qemu_log_mask() ensures that guest-visible errors
are properly categorized and can be managed via QEMU logging
options.
All affected messages correspond to guest-triggerable error
conditions, so LOG_GUEST_ERROR is used consistently.
This change improves integration with QEMU's logging infrastructure
and aligns with upstream coding guidelines.
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-ID: <20260424080508.53992-6-jamin_lin@aspeedtech.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/usb/hcd-ehci.c | 46 +++++++++++++++++++++++++---------------------
1 file changed, 25 insertions(+), 21 deletions(-)
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index 7e0b767eb9e..8acaedeaa90 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -36,6 +36,7 @@
#include "qemu/error-report.h"
#include "qemu/main-loop.h"
#include "system/runstate.h"
+#include "qemu/log.h"
#define FRAME_TIMER_FREQ 1000
#define FRAME_TIMER_NS (NANOSECONDS_PER_SECOND / FRAME_TIMER_FREQ)
@@ -425,7 +426,7 @@ static int ehci_get_pid(EHCIqtd *qtd)
case 2:
return USB_TOKEN_SETUP;
default:
- fprintf(stderr, "bad token\n");
+ qemu_log_mask(LOG_GUEST_ERROR, "bad token\n");
return 0;
}
}
@@ -532,7 +533,7 @@ static void ehci_free_packet(EHCIPacket *p)
}
if (p->async == EHCI_ASYNC_FINISHED &&
p->packet.status == USB_RET_SUCCESS) {
- fprintf(stderr,
+ qemu_log_mask(LOG_GUEST_ERROR,
"EHCI: Dropping completed packet from halted %s ep %02X\n",
(p->pid == USB_TOKEN_IN) ? "in" : "out",
get_field(p->queue->qh.epchar, QH_EPCHAR_EP));
@@ -1042,8 +1043,9 @@ static void ehci_opreg_write(void *ptr, hwaddr addr,
/* not supporting dynamic frame list size at the moment */
if ((val & USBCMD_FLS) && !(s->usbcmd & USBCMD_FLS)) {
- fprintf(stderr, "attempt to set frame list size -- value %d\n",
- (int)val & USBCMD_FLS);
+ qemu_log_mask(LOG_GUEST_ERROR,
+ "attempt to set frame list size -- value %" PRId64
+ "\n", val & USBCMD_FLS);
val &= ~USBCMD_FLS;
}
@@ -1101,7 +1103,7 @@ static void ehci_opreg_write(void *ptr, hwaddr addr,
case PERIODICLISTBASE:
if (ehci_periodic_enabled(s)) {
- fprintf(stderr,
+ qemu_log_mask(LOG_GUEST_ERROR,
"ehci: PERIODIC list base register set while periodic schedule\n"
" is enabled and HC is enabled\n");
}
@@ -1109,7 +1111,7 @@ static void ehci_opreg_write(void *ptr, hwaddr addr,
case ASYNCLISTADDR:
if (ehci_async_enabled(s)) {
- fprintf(stderr,
+ qemu_log_mask(LOG_GUEST_ERROR,
"ehci: ASYNC list address register set while async schedule\n"
" is enabled and HC is enabled\n");
}
@@ -1200,7 +1202,7 @@ static int ehci_init_transfer(EHCIPacket *p)
while (bytes > 0) {
if (cpage > 4) {
- fprintf(stderr, "cpage out of range (%u)\n", cpage);
+ qemu_log_mask(LOG_GUEST_ERROR, "cpage out of range (%u)\n", cpage);
qemu_sglist_destroy(&p->sgl);
return -1;
}
@@ -1306,7 +1308,8 @@ static void ehci_execute_complete(EHCIQueue *q)
break;
default:
/* should not be triggerable */
- fprintf(stderr, "USB invalid response %d\n", p->packet.status);
+ qemu_log_mask(LOG_GUEST_ERROR, "USB invalid response %d\n",
+ p->packet.status);
g_assert_not_reached();
}
@@ -1354,7 +1357,7 @@ static int ehci_execute(EHCIPacket *p, const char *action)
p->async == EHCI_ASYNC_INITIALIZED);
if (!(p->qtd.token & QTD_TOKEN_ACTIVE)) {
- fprintf(stderr, "Attempting to execute inactive qtd\n");
+ qemu_log_mask(LOG_GUEST_ERROR, "Attempting to execute inactive qtd\n");
return -1;
}
@@ -1395,7 +1398,8 @@ static int ehci_execute(EHCIPacket *p, const char *action)
p->packet.actual_length);
if (p->packet.actual_length > BUFF_SIZE) {
- fprintf(stderr, "ret from usb_handle_packet > BUFF_SIZE\n");
+ qemu_log_mask(LOG_GUEST_ERROR,
+ "ret from usb_handle_packet > BUFF_SIZE\n");
return -1;
}
@@ -1479,8 +1483,9 @@ static int ehci_process_itd(EHCIState *ehci,
case USB_RET_SUCCESS:
break;
default:
- fprintf(stderr, "Unexpected iso usb result: %d\n",
- ehci->ipacket.status);
+ qemu_log_mask(LOG_GUEST_ERROR,
+ "Unexpected iso usb result: %d\n",
+ ehci->ipacket.status);
/* Fall through */
case USB_RET_IOERROR:
case USB_RET_NODEV:
@@ -1584,7 +1589,8 @@ static int ehci_state_fetchentry(EHCIState *ehci, int async)
/* section 4.8, only QH in async schedule */
if (async && (NLPTR_TYPE_GET(entry) != NLPTR_TYPE_QH)) {
- fprintf(stderr, "non queue head request in async schedule\n");
+ qemu_log_mask(LOG_GUEST_ERROR,
+ "non queue head request in async schedule\n");
return -1;
}
@@ -1606,8 +1612,10 @@ static int ehci_state_fetchentry(EHCIState *ehci, int async)
default:
/* TODO: handle FSTN type */
- fprintf(stderr, "FETCHENTRY: entry at %X is of type %u "
- "which is not supported yet\n", entry, NLPTR_TYPE_GET(entry));
+ qemu_log_mask(LOG_GUEST_ERROR,
+ "FETCHENTRY: entry at 0x%x is of type %u "
+ "which is not supported yet\n",
+ entry, NLPTR_TYPE_GET(entry));
return -1;
}
@@ -2118,13 +2126,13 @@ static void ehci_advance_state(EHCIState *ehci, int async)
break;
default:
- fprintf(stderr, "Bad state!\n");
g_assert_not_reached();
}
if (again < 0 || itd_count > 16) {
/* TODO: notify guest (raise HSE irq?) */
- fprintf(stderr, "processing error - resetting ehci HC\n");
+ qemu_log_mask(LOG_GUEST_ERROR,
+ "processing error - resetting ehci HC\n");
ehci_reset(ehci);
again = 0;
}
@@ -2181,8 +2189,6 @@ static void ehci_advance_async_state(EHCIState *ehci)
default:
/* this should only be due to a developer mistake */
- fprintf(stderr, "ehci: Bad asynchronous state %d. "
- "Resetting to active\n", ehci->astate);
g_assert_not_reached();
}
}
@@ -2231,8 +2237,6 @@ static void ehci_advance_periodic_state(EHCIState *ehci)
default:
/* this should only be due to a developer mistake */
- fprintf(stderr, "ehci: Bad periodic state %d. "
- "Resetting to active\n", ehci->pstate);
g_assert_not_reached();
}
}
--
2.53.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL v4 54/62] hw/usb/hcd-ehci: Replace DPRINTF debug logs with trace events
2026-04-24 19:25 [PULL v4 00/62] Misc HW patches for 2026-04-22 Philippe Mathieu-Daudé
` (8 preceding siblings ...)
2026-04-24 19:25 ` [PULL v4 53/62] hw/usb/hcd-ehci.c: Replace fprintf(stderr, ...) with qemu_log_mask(LOG_GUEST_ERROR) Philippe Mathieu-Daudé
@ 2026-04-24 19:25 ` Philippe Mathieu-Daudé
2026-04-24 19:25 ` [PULL v4 55/62] hw/usb/hcd-ehci: Introduce common properties macro for sysbus and pci Philippe Mathieu-Daudé
2026-04-25 16:59 ` [PULL v4 00/62] Misc HW patches for 2026-04-22 Stefan Hajnoczi
11 siblings, 0 replies; 13+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-04-24 19:25 UTC (permalink / raw)
To: qemu-devel
From: Jamin Lin <jamin_lin@aspeedtech.com>
Replace legacy DPRINTF() debug logging in the EHCI host controller
implementation with QEMU trace events.
The EHCI_DEBUG macro and associated DPRINTF() definitions are
removed as they are no longer needed.
Trace events are added for:
- packet submission and completion
- queue head execution state
- periodic schedule advancement
- ITD error conditions
- port state handling
- skipped microframes
No functional change.
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260424080508.53992-7-jamin_lin@aspeedtech.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/usb/hcd-ehci.h | 10 ---------
hw/usb/hcd-ehci.c | 49 +++++++++++++++++++--------------------------
hw/usb/trace-events | 9 +++++++++
3 files changed, 30 insertions(+), 38 deletions(-)
diff --git a/hw/usb/hcd-ehci.h b/hw/usb/hcd-ehci.h
index 736407fd521..4234591cb41 100644
--- a/hw/usb/hcd-ehci.h
+++ b/hw/usb/hcd-ehci.h
@@ -24,16 +24,6 @@
#include "hw/pci/pci_device.h"
#include "hw/core/sysbus.h"
-#ifndef EHCI_DEBUG
-#define EHCI_DEBUG 0
-#endif
-
-#if EHCI_DEBUG
-#define DPRINTF printf
-#else
-#define DPRINTF(...)
-#endif
-
#define MMIO_SIZE 0x1000
#define CAPA_SIZE 0x10
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index 8acaedeaa90..28a60e4c1a7 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -839,7 +839,7 @@ static USBDevice *ehci_find_device(EHCIState *ehci, uint8_t addr)
for (i = 0; i < EHCI_PORTS; i++) {
port = &ehci->ports[i];
if (!(ehci->portsc[i] & PORTSC_PED)) {
- DPRINTF("Port %d not enabled\n", i);
+ trace_usb_ehci_port_disable(i);
continue;
}
dev = usb_find_device(port, addr);
@@ -1281,10 +1281,8 @@ static void ehci_execute_complete(EHCIQueue *q)
assert(p->async == EHCI_ASYNC_INITIALIZED ||
p->async == EHCI_ASYNC_FINISHED);
- DPRINTF("execute_complete: qhaddr 0x%x, next 0x%x, qtdaddr 0x%x, "
- "status %d, actual_length %d\n",
- q->qhaddr, q->qh.next, q->qtdaddr,
- p->packet.status, p->packet.actual_length);
+ trace_usb_ehci_execute_complete(q->qhaddr, q->qh.next, q->qtdaddr,
+ p->packet.status, p->packet.actual_length);
switch (p->packet.status) {
case USB_RET_SUCCESS:
@@ -1327,7 +1325,7 @@ static void ehci_execute_complete(EHCIQueue *q)
} else {
tbytes = 0;
}
- DPRINTF("updating tbytes to %d\n", tbytes);
+ trace_usb_ehci_qh_tbytes(tbytes);
set_field(&q->qh.token, tbytes, QTD_TOKEN_TBYTES);
ehci_finish_transfer(q, p->packet.actual_length);
@@ -1392,10 +1390,9 @@ static int ehci_execute(EHCIPacket *p, const char *action)
trace_usb_ehci_packet_action(p->queue, p, action);
usb_handle_packet(p->queue->dev, &p->packet);
- DPRINTF("submit: qh 0x%x next 0x%x qtd 0x%x pid 0x%x len %zd endp 0x%x "
- "status %d actual_length %d\n", p->queue->qhaddr, p->qtd.next,
- p->qtdaddr, p->pid, p->packet.iov.size, endp, p->packet.status,
- p->packet.actual_length);
+ trace_usb_ehci_packet_submit(p->queue->qhaddr, p->qtd.next, p->qtdaddr,
+ p->pid, p->packet.iov.size, endp,
+ p->packet.status, p->packet.actual_length);
if (p->packet.actual_length > BUFF_SIZE) {
qemu_log_mask(LOG_GUEST_ERROR,
@@ -1472,7 +1469,8 @@ static int ehci_process_itd(EHCIState *ehci,
usb_handle_packet(dev, &ehci->ipacket);
usb_packet_unmap(&ehci->ipacket, &ehci->isgl);
} else {
- DPRINTF("ISOCH: attempt to address non-iso endpoint\n");
+ trace_usb_ehci_log("ISOCH: "
+ "attempt to address non-iso endpoint");
ehci->ipacket.status = USB_RET_NAK;
ehci->ipacket.actual_length = 0;
}
@@ -1677,24 +1675,22 @@ static EHCIQueue *ehci_state_fetchqh(EHCIState *ehci, int async)
if (ehci->usbsts & USBSTS_REC) {
ehci_clear_usbsts(ehci, USBSTS_REC);
} else {
- DPRINTF("FETCHQH: QH 0x%08x. H-bit set, reclamation status reset"
- " - done processing\n", q->qhaddr);
+ trace_usb_ehci_fetchqh_reclaim_done(q->qhaddr);
ehci_set_state(ehci, async, EST_ACTIVE);
q = NULL;
goto out;
}
}
-#if EHCI_DEBUG
- if (q->qhaddr != q->qh.next) {
- DPRINTF("FETCHQH: QH 0x%08x (h %x halt %x active %x) next 0x%08x\n",
- q->qhaddr,
- q->qh.epchar & QH_EPCHAR_H,
- q->qh.token & QTD_TOKEN_HALT,
- q->qh.token & QTD_TOKEN_ACTIVE,
- q->qh.next);
+ if (trace_event_get_state_backends(TRACE_USB_EHCI_FETCHQH_DBG)) {
+ if (q->qhaddr != q->qh.next) {
+ trace_usb_ehci_fetchqh_dbg(q->qhaddr,
+ q->qh.epchar & QH_EPCHAR_H,
+ q->qh.token & QTD_TOKEN_HALT,
+ q->qh.token & QTD_TOKEN_ACTIVE,
+ q->qh.next);
+ }
}
-#endif
if (q->qh.token & QTD_TOKEN_HALT) {
ehci_set_state(ehci, async, EST_HORIZONTALQH);
@@ -2161,7 +2157,7 @@ static void ehci_advance_async_state(EHCIState *ehci)
/* make sure guest has acknowledged the doorbell interrupt */
/* TO-DO: is this really needed? */
if (ehci->usbsts & USBSTS_IAA) {
- DPRINTF("IAA status bit still set.\n");
+ trace_usb_ehci_log("IAA status bit still set.");
break;
}
@@ -2226,9 +2222,7 @@ static void ehci_advance_periodic_state(EHCIState *ehci)
if (get_dwords(ehci, list, &entry, 1) < 0) {
break;
}
-
- DPRINTF("PERIODIC state adv fr=%d. [%08X] -> %08X\n",
- ehci->frindex / 8, list, entry);
+ trace_usb_ehci_periodic_state_advance(ehci->frindex / 8, list, entry);
ehci_set_fetch_addr(ehci, async, entry);
ehci_set_state(ehci, async, EST_FETCHENTRY);
ehci_advance_state(ehci, async);
@@ -2294,8 +2288,7 @@ static void ehci_work_bh(void *opaque)
ehci_update_frindex(ehci, skipped_uframes);
ehci->last_run_ns += UFRAME_TIMER_NS * skipped_uframes;
uframes -= skipped_uframes;
- DPRINTF("WARNING - EHCI skipped %"PRIu64" uframes\n",
- skipped_uframes);
+ trace_usb_ehci_skipped_uframes(skipped_uframes);
}
for (i = 0; i < uframes; i++) {
diff --git a/hw/usb/trace-events b/hw/usb/trace-events
index dd04f14add1..0d4318dcf14 100644
--- a/hw/usb/trace-events
+++ b/hw/usb/trace-events
@@ -89,6 +89,7 @@ usb_ehci_state(const char *schedule, const char *state) "%s schedule %s"
usb_ehci_qh_ptrs(void *q, uint32_t addr, uint32_t nxt, uint32_t c_qtd, uint32_t n_qtd, uint32_t a_qtd) "q %p - QH @ 0x%08x: next 0x%08x qtds 0x%08x,0x%08x,0x%08x"
usb_ehci_qh_fields(uint32_t addr, int rl, int mplen, int eps, int ep, int devaddr) "QH @ 0x%08x - rl %d, mplen %d, eps %d, ep %d, dev %d"
usb_ehci_qh_bits(uint32_t addr, int c, int h, int dtc, int i) "QH @ 0x%08x - c %d, h %d, dtc %d, i %d"
+usb_ehci_qh_tbytes(uint32_t tbytes) "updating tbytes to %d"
usb_ehci_qtd_ptrs(void *q, uint32_t addr, uint32_t nxt, uint32_t altnext) "q %p - QTD @ 0x%08x: next 0x%08x altnext 0x%08x"
usb_ehci_qtd_fields(uint32_t addr, int tbytes, int cpage, int cerr, int pid) "QTD @ 0x%08x - tbytes %d, cpage %d, cerr %d, pid %d"
usb_ehci_qtd_bits(uint32_t addr, int ioc, int active, int halt, int babble, int xacterr) "QTD @ 0x%08x - ioc %d, active %d, halt %d, babble %d, xacterr %d"
@@ -100,13 +101,21 @@ usb_ehci_port_reset(uint32_t port, int enable) "reset port #%d - %d"
usb_ehci_port_suspend(uint32_t port) "port #%d"
usb_ehci_port_wakeup(uint32_t port) "port #%d"
usb_ehci_port_resume(uint32_t port) "port #%d"
+usb_ehci_port_disable(uint32_t port) "port #%d"
usb_ehci_queue_action(void *q, const char *action) "q %p: %s"
usb_ehci_packet_action(void *q, void *p, const char *action) "q %p p %p: %s"
+usb_ehci_packet_submit(uint32_t qhaddr, uint32_t next, uint32_t qtdaddr, int pid, size_t len, int endp, int status, int actual_length) "qh=0x%x, next=0x%x, qtd=0x%x, pid=0x%x, len=%zd, endp=0x%x, status=%d, actual_length=%d"
usb_ehci_irq(uint32_t level, uint32_t frindex, uint32_t sts, uint32_t mask) "level %d, frindex 0x%04x, sts 0x%x, mask 0x%x"
usb_ehci_guest_bug(const char *reason) "%s"
usb_ehci_doorbell_ring(void) ""
usb_ehci_doorbell_ack(void) ""
usb_ehci_dma_error(void) ""
+usb_ehci_execute_complete(uint32_t qhaddr, uint32_t next, uint32_t qtdaddr, int status, int actual_length) "qhaddr=0x%x, next=0x%x, qtdaddr=0x%x, status=%d, actual_length=%d"
+usb_ehci_fetchqh_reclaim_done(uint32_t qhaddr) "QH 0x%08x H-bit set, reclamation status reset - done processing"
+usb_ehci_fetchqh_dbg(uint32_t qhaddr, uint32_t h, uint32_t halt, uint32_t active, uint32_t next) "QH 0x%08x (h 0x%x halt 0x%x active 0x%x) next 0x%08x"
+usb_ehci_periodic_state_advance(uint32_t frame, uint32_t list, uint32_t entry) "frame=%d, list=0x%x, entry=0x%x"
+usb_ehci_skipped_uframes(uint64_t skipped_uframes) "skipped %" PRIu64 " uframes"
+usb_ehci_log(const char *msg) "%s"
# hcd-uhci.c
usb_uhci_reset(void) "=== RESET ==="
--
2.53.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL v4 55/62] hw/usb/hcd-ehci: Introduce common properties macro for sysbus and pci
2026-04-24 19:25 [PULL v4 00/62] Misc HW patches for 2026-04-22 Philippe Mathieu-Daudé
` (9 preceding siblings ...)
2026-04-24 19:25 ` [PULL v4 54/62] hw/usb/hcd-ehci: Replace DPRINTF debug logs with trace events Philippe Mathieu-Daudé
@ 2026-04-24 19:25 ` Philippe Mathieu-Daudé
2026-04-25 16:59 ` [PULL v4 00/62] Misc HW patches for 2026-04-22 Stefan Hajnoczi
11 siblings, 0 replies; 13+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-04-24 19:25 UTC (permalink / raw)
To: qemu-devel
From: Jamin Lin <jamin_lin@aspeedtech.com>
EHCI properties are currently defined separately in both sysbus and
PCI implementations, leading to duplicated code for common fields
such as "maxframes".
Introduce DEFINE_EHCI_COMMON_PROPERTIES() to consolidate shared
property definitions and reuse them across both EHCISysBusState
and EHCIPCIState.
This reduces code duplication and keeps property definitions
consistent between different EHCI device variants.
No functional change.
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260424080508.53992-8-jamin_lin@aspeedtech.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/usb/hcd-ehci.h | 3 +++
hw/usb/hcd-ehci-pci.c | 2 +-
hw/usb/hcd-ehci-sysbus.c | 2 +-
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/hw/usb/hcd-ehci.h b/hw/usb/hcd-ehci.h
index 4234591cb41..d038ee1e310 100644
--- a/hw/usb/hcd-ehci.h
+++ b/hw/usb/hcd-ehci.h
@@ -307,6 +307,9 @@ struct EHCIState {
VMChangeStateEntry *vmstate;
};
+#define DEFINE_EHCI_COMMON_PROPERTIES(_state) \
+ DEFINE_PROP_UINT32("maxframes", _state, ehci.maxframes, 128)
+
extern const VMStateDescription vmstate_ehci;
void usb_ehci_init(EHCIState *s, DeviceState *dev);
diff --git a/hw/usb/hcd-ehci-pci.c b/hw/usb/hcd-ehci-pci.c
index 9febcc10314..fd35d253407 100644
--- a/hw/usb/hcd-ehci-pci.c
+++ b/hw/usb/hcd-ehci-pci.c
@@ -136,7 +136,7 @@ static void usb_ehci_pci_write_config(PCIDevice *dev, uint32_t addr,
}
static const Property ehci_pci_properties[] = {
- DEFINE_PROP_UINT32("maxframes", EHCIPCIState, ehci.maxframes, 128),
+ DEFINE_EHCI_COMMON_PROPERTIES(EHCIPCIState),
};
static const VMStateDescription vmstate_ehci_pci = {
diff --git a/hw/usb/hcd-ehci-sysbus.c b/hw/usb/hcd-ehci-sysbus.c
index b31032bbf39..7f7c7f8a2f1 100644
--- a/hw/usb/hcd-ehci-sysbus.c
+++ b/hw/usb/hcd-ehci-sysbus.c
@@ -31,7 +31,7 @@ static const VMStateDescription vmstate_ehci_sysbus = {
};
static const Property ehci_sysbus_properties[] = {
- DEFINE_PROP_UINT32("maxframes", EHCISysBusState, ehci.maxframes, 128),
+ DEFINE_EHCI_COMMON_PROPERTIES(EHCISysBusState),
DEFINE_PROP_BOOL("companion-enable", EHCISysBusState, ehci.companion_enable,
false),
};
--
2.53.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PULL v4 00/62] Misc HW patches for 2026-04-22
2026-04-24 19:25 [PULL v4 00/62] Misc HW patches for 2026-04-22 Philippe Mathieu-Daudé
` (10 preceding siblings ...)
2026-04-24 19:25 ` [PULL v4 55/62] hw/usb/hcd-ehci: Introduce common properties macro for sysbus and pci Philippe Mathieu-Daudé
@ 2026-04-25 16:59 ` Stefan Hajnoczi
11 siblings, 0 replies; 13+ messages in thread
From: Stefan Hajnoczi @ 2026-04-25 16:59 UTC (permalink / raw)
To: Philippe Mathieu-Daudé; +Cc: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 116 bytes --]
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/11.1 for any user-visible changes.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2026-04-25 20:01 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-24 19:25 [PULL v4 00/62] Misc HW patches for 2026-04-22 Philippe Mathieu-Daudé
2026-04-24 19:25 ` [PULL v4 02/62] hw/core/cpu: Expose CPUState::start_powered_off docstring Philippe Mathieu-Daudé
2026-04-24 19:25 ` [PULL v4 28/62] hw: add compat machines for 11.1 Philippe Mathieu-Daudé
2026-04-24 19:25 ` [PULL v4 32/62] qom: Restrict compat properties API to system emulation Philippe Mathieu-Daudé
2026-04-24 19:25 ` [PULL v4 48/62] hw/cxl: Define cxl_fmws_get_all_sorted() stub Philippe Mathieu-Daudé
2026-04-24 19:25 ` [PULL v4 49/62] hw/arm/virt: Do not select Kconfig symbol PCI_EXPRESS Philippe Mathieu-Daudé
2026-04-24 19:25 ` [PULL v4 50/62] hw/usb/hcd-ehci: Remove unused EHCIfstn structure and dead code Philippe Mathieu-Daudé
2026-04-24 19:25 ` [PULL v4 51/62] hw/usb/hcd-ehci.h: Fix coding style issues reported by checkpatch Philippe Mathieu-Daudé
2026-04-24 19:25 ` [PULL v4 52/62] hw/usb/hcd-ehci.c: " Philippe Mathieu-Daudé
2026-04-24 19:25 ` [PULL v4 53/62] hw/usb/hcd-ehci.c: Replace fprintf(stderr, ...) with qemu_log_mask(LOG_GUEST_ERROR) Philippe Mathieu-Daudé
2026-04-24 19:25 ` [PULL v4 54/62] hw/usb/hcd-ehci: Replace DPRINTF debug logs with trace events Philippe Mathieu-Daudé
2026-04-24 19:25 ` [PULL v4 55/62] hw/usb/hcd-ehci: Introduce common properties macro for sysbus and pci Philippe Mathieu-Daudé
2026-04-25 16:59 ` [PULL v4 00/62] Misc HW patches for 2026-04-22 Stefan Hajnoczi
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.