* [PULL 00/49] Misc HW patches for 2025-01-12
@ 2025-01-12 22:16 Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 01/49] pc-bios/meson.build: Silent unuseful DTC warnings Philippe Mathieu-Daudé
` (49 more replies)
0 siblings, 50 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:16 UTC (permalink / raw)
To: qemu-devel; +Cc: Philippe Mathieu-Daudé
The following changes since commit 3214bec13d8d4c40f707d21d8350d04e4123ae97:
Merge tag 'migration-20250110-pull-request' of https://gitlab.com/farosas/qemu into staging (2025-01-10 13:39:19 -0500)
are available in the Git repository at:
https://github.com/philmd/qemu.git tags/hw-misc-20250112
for you to fetch changes up to 4a0031691596bd81c5949cf4632a6d178f8c2fe5:
Add a b4 configuration file (2025-01-12 23:06:29 +0100)
----------------------------------------------------------------
Misc HW patches queue
- Silent unuseful DTC warnings (Philippe)
- Add few QOM parentship relations (Philippe)
- Rework XilinX EthLite RAM buffers (Philippe)
- Convert vmcoreinfo to 3-phase reset (Philippe)
- Convert HPPA CPUs to 3-phase reset (Helge)
- Fix UFS endianness issue (Keoseong)
- Introduce pci_set_enabled (Akihiko)
- Clarify Enclave and Firecracker relationship (Alexander)
- Set SDHCI DMA interrupt status bit in correct place (Bernhard)
- Fix leak in cryptodev-vhost-user backend (Gabriel)
- Use USB XHCI ring 0 when mapping is not supported (Phil)
- Convert DPRINTF to trace events (Nikita, Bernhard)
- Remove &first_cpu in TriCore machine (Philippe)
- Checkpatch style cleanups (Bibo)
- MAINTAINERS updates (Marcin, Gustavo, Akihiko)
- Add default configuration for b4 tool (Jiaxun)
----------------------------------------------------------------
Akihiko Odaki (2):
hw/pci: Rename has_power to enabled
MAINTAINERS: Update path to coreaudio.m
Alexander Graf (1):
docs/nitro-enclave: Clarify Enclave and Firecracker relationship
Bernhard Beschow (7):
hw/sd/sdhci: Set SDHC_NIS_DMA bit when appropriate
hw/timer/imx_gpt: Remove unused define
tests/qtest/libqos: Reuse TYPE_IMX_I2C define
hw/misc/imx6_src: Convert DPRINTF() to trace events
hw/char/imx_serial: Turn some DPRINTF() statements into trace events
hw/i2c/imx_i2c: Convert DPRINTF() to trace events
hw/gpio/imx_gpio: Turn DPRINTF() into trace events
Bibo Mao (1):
hw/loongarch/virt: Checkpatch cleanup
Gabriel Barrantes (1):
backends/cryptodev-vhost-user: Fix local_error leaks
Gustavo Romero (1):
MAINTAINERS: Add me as the maintainer for ivshmem-flat
Helge Deller (4):
target/hppa: Convert hppa_cpu_init() to ResetHold handler
hw/hppa: Reset vCPUs calling resettable_reset()
target/hppa: Set PC on vCPU reset
target/hppa: Speed up hppa_is_pa20()
Jiaxun Yang (1):
Add a b4 configuration file
Keoseong Park (1):
hw/ufs: Adjust value to match CPU's endian format
Marcin Juszkiewicz (1):
MAINTAINERS: remove myself from sbsa-ref
Nikita Shubin (1):
hw/char/stm32f2xx_usart: replace print with trace
Phil Dennis-Jordan (1):
hw/usb/hcd-xhci-pci: Use event ring 0 if mapping unsupported
Philippe Mathieu-Daudé (27):
pc-bios/meson.build: Silent unuseful DTC warnings
target: Replace DEVICE(object_new) -> qdev_new()
hw: Replace DEVICE(object_new) -> qdev_new()
hw: Add QOM parentship relation with CPUs
hw/usb: Inline usb_try_new()
hw/usb: Inline usb_new()
hw/microblaze: Restrict MemoryRegionOps are implemented as 32-bit
hw/net/xilinx_ethlite: Map MDIO registers (as unimplemented)
hw/net/xilinx_ethlite: Introduce txbuf_ptr() helper
hw/net/xilinx_ethlite: Introduce rxbuf_ptr() helper
hw/net/xilinx_ethlite: Access TX_GIE register for each port
hw/net/xilinx_ethlite: Access TX_LEN register for each port
hw/net/xilinx_ethlite: Access TX_CTRL register for each port
hw/net/xilinx_ethlite: Map RX_CTRL as MMIO
hw/net/xilinx_ethlite: Map TX_LEN as MMIO
hw/net/xilinx_ethlite: Map TX_GIE as MMIO
hw/net/xilinx_ethlite: Map TX_CTRL as MMIO
hw/net/xilinx_ethlite: Map the RAM buffer as RAM memory region
hw/net/xilinx_ethlite: Rename 'mmio' MR as 'container'
hw/net/xilinx_ethlite: Map RESERVED I/O as unimplemented
hw/misc/vmcoreinfo: Rename VMCOREINFO_DEVICE -> TYPE_VMCOREINFO
hw/misc/vmcoreinfo: Convert to three-phase reset interface
hw/sd/sdhci: Factor sdhci_sdma_transfer() out
tests/qtest/boot-serial-test: Correct HPPA machine name
tests: Add functional tests for HPPA machines
target/hppa: Only set PSW 'M' bit on reset
hw/tricore/triboard: Remove unnecessary use of &first_cpu
MAINTAINERS | 19 +-
docs/system/i386/nitro-enclave.rst | 2 +-
include/hw/misc/vmcoreinfo.h | 7 +-
include/hw/pci/pci.h | 1 +
include/hw/pci/pci_device.h | 2 +-
include/hw/usb.h | 12 +-
target/hppa/cpu.h | 11 +-
backends/cryptodev-vhost-user.c | 3 +-
hw/arm/musicpal.c | 2 +-
hw/char/imx_serial.c | 58 ++--
hw/char/stm32f2xx_usart.c | 49 ++--
hw/gpio/imx_gpio.c | 18 +-
hw/hppa/machine.c | 6 +-
hw/i2c/imx_i2c.c | 21 +-
hw/i386/x86-common.c | 1 +
hw/intc/xilinx_intc.c | 4 +
hw/loongarch/acpi-build.c | 3 +-
hw/loongarch/boot.c | 4 +-
hw/loongarch/virt.c | 8 +-
hw/microblaze/petalogix_ml605_mmu.c | 1 +
hw/microblaze/petalogix_s3adsp1800_mmu.c | 1 +
hw/mips/cps.c | 1 +
hw/misc/imx6_src.c | 23 +-
hw/misc/vmcoreinfo.c | 14 +-
hw/net/xilinx_ethlite.c | 312 ++++++++++++++-------
hw/pci/pci.c | 17 +-
hw/pci/pci_host.c | 4 +-
hw/ppc/e500.c | 1 +
hw/ppc/spapr.c | 1 +
hw/sd/sdhci.c | 33 ++-
hw/sparc/sun4m.c | 4 +-
hw/timer/imx_gpt.c | 4 -
hw/timer/xilinx_timer.c | 4 +
hw/tricore/triboard.c | 6 +-
hw/ufs/ufs.c | 2 +-
hw/usb/bus.c | 5 +-
hw/usb/dev-serial.c | 2 +-
hw/usb/hcd-xhci.c | 4 +
target/hppa/cpu.c | 22 +-
target/mips/cpu.c | 2 +-
target/xtensa/cpu.c | 2 +-
tests/qtest/boot-serial-test.c | 2 -
tests/qtest/libqos/arm-imx25-pdk-machine.c | 5 +-
tests/qtest/libqos/i2c-imx.c | 4 +-
tests/qtest/ufs-test.c | 2 +-
.b4-config | 14 +
hw/char/trace-events | 11 +
hw/gpio/trace-events | 5 +
hw/i2c/trace-events | 5 +
hw/misc/trace-events | 6 +
pc-bios/meson.build | 3 +-
tests/functional/meson.build | 4 +
tests/functional/test_hppa_seabios.py | 35 +++
tests/qtest/meson.build | 2 +-
54 files changed, 518 insertions(+), 276 deletions(-)
create mode 100644 .b4-config
create mode 100755 tests/functional/test_hppa_seabios.py
--
2.47.1
^ permalink raw reply [flat|nested] 61+ messages in thread
* [PULL 01/49] pc-bios/meson.build: Silent unuseful DTC warnings
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
@ 2025-01-12 22:16 ` Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 02/49] target: Replace DEVICE(object_new) -> qdev_new() Philippe Mathieu-Daudé
` (48 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:16 UTC (permalink / raw)
To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Peter Maydell, BALATON Zoltan
QEMU consumes some device tree blobs, so these have been committed
to the tree in as firmware, along with the device tree source used
to generate them. We know the blobs are "good enough" to have QEMU
boot a system, so we don't really maintain and rebuild the sources.
These blobs were generated with older 'dtc' binaries. We use the
v1.6.1 version since 2021 (commit 962fde57b7 "dtc: Update to version
1.6.1").
Since commit 6e0dc9d2a8 ("meson: compile bundled device trees"),
if dtc binary is available, it is directly used to compile the
device tree sources. New versions of 'dtc' add checks which display
warnings or errors. Our sources are a bit old, so dtc v1.6.1 now
emit the following warnings on a fresh build:
[163/3414] Generating pc-bios/canyonlands.dts with a custom command
pc-bios/canyonlands.dts:47.9-50.4: Warning (unit_address_vs_reg): /memory: node has a reg or ranges property, but no unit name
pc-bios/canyonlands.dts:210.13-429.5: Warning (unit_address_vs_reg): /plb/opb: node has a reg or ranges property, but no unit name
pc-bios/canyonlands.dts:464.26-504.5: Warning (pci_bridge): /plb/pciex@d00000000: node name is not "pci" or "pcie"
pc-bios/canyonlands.dts:506.26-546.5: Warning (pci_bridge): /plb/pciex@d20000000: node name is not "pci" or "pcie"
pc-bios/canyonlands.dtb: Warning (unit_address_format): Failed prerequisite 'pci_bridge'
pc-bios/canyonlands.dtb: Warning (pci_device_reg): Failed prerequisite 'pci_bridge'
pc-bios/canyonlands.dtb: Warning (pci_device_bus_num): Failed prerequisite 'pci_bridge'
pc-bios/canyonlands.dts:268.14-289.7: Warning (avoid_unnecessary_addr_size): /plb/opb/ebc/ndfc@3,0: unnecessary #address-cells/#size-cells without "ranges" or child "reg" property
[164/3414] Generating pc-bios/petalogix-s3adsp1800.dts with a custom command
pc-bios/petalogix-s3adsp1800.dts:258.33-266.5: Warning (interrupt_provider): /plb/interrupt-controller@81800000: Missing #address-cells in interrupt provider
[165/3414] Generating pc-bios/petalogix-ml605.dts with a custom command
pc-bios/petalogix-ml605.dts:234.39-241.5: Warning (interrupt_provider): /axi/interrupt-controller@81800000: Missing #address-cells in interrupt provider
[177/3414] Generating pc-bios/bamboo.dts with a custom command
pc-bios/bamboo.dts:45.9-48.4: Warning (unit_address_vs_reg): /memory: node has a reg or ranges property, but no unit name
pc-bios/bamboo.dts:87.13-154.5: Warning (unit_address_vs_reg): /plb/opb: node has a reg or ranges property, but no unit name
pc-bios/bamboo.dts:198.3-50: Warning (chosen_node_stdout_path): /chosen:linux,stdout-path: Use 'stdout-path' instead
pc-bios/bamboo.dts:87.13-154.5: Warning (interrupts_property): /plb/opb: Missing interrupt-parent
pc-bios/bamboo.dts:100.14-108.6: Warning (interrupts_property): /plb/opb/ebc: Missing interrupt-parent
From QEMU perspective, these warnings are not really useful. It is
the responsibility of developers adding DT source/blob to QEMU
repository to check the source doesn't produce warnings, but as
long as the blob is useful enough, QEMU can consume it. So these
warnings don't add any value, instead they are noisy and might
distract us to focus on important warnings. Better disable them.
'dtc' provides the '--quiet' option for that [*]:
$ dtc --help
Usage: dtc [options] <input file>
Options: -[qI:O:o:V:d:R:S:p:a:fb:i:H:sW:E:@AThv]
-q, --quiet
Quiet: -q suppress warnings, -qq errors, -qqq all
Update meson to disable these unuseful DTC warnings.
[*] https://lore.kernel.org/qemu-devel/CAFEAcA-WJ9J1YQunJ+bSG=wnpxh1By+Bf18j2CyV7G0vZ=8b7g@mail.gmail.com/
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Acked-by: BALATON Zoltan <balaton@eik.bme.hu>
Message-Id: <20231006064750.33852-1-philmd@linaro.org>
---
pc-bios/meson.build | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/pc-bios/meson.build b/pc-bios/meson.build
index 4823dff189a..b68b29cc7d1 100644
--- a/pc-bios/meson.build
+++ b/pc-bios/meson.build
@@ -99,7 +99,8 @@ foreach f : [
output: out,
install: get_option('install_blobs'),
install_dir: qemu_datadir,
- command: [ dtc, '-I', 'dts', '-O', 'dtb', '-o', '@OUTPUT@', '@INPUT0@' ])
+ command: [ dtc, '-q', '-I', 'dts', '-O', 'dtb',
+ '-o', '@OUTPUT@', '@INPUT0@' ])
else
blobs += out
endif
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 02/49] target: Replace DEVICE(object_new) -> qdev_new()
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 01/49] pc-bios/meson.build: Silent unuseful DTC warnings Philippe Mathieu-Daudé
@ 2025-01-12 22:16 ` Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 03/49] hw: " Philippe Mathieu-Daudé
` (47 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:16 UTC (permalink / raw)
To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Zhao Liu
Prefer QDev API for QDev objects, avoid the underlying QOM layer.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Message-Id: <20240216110313.17039-8-philmd@linaro.org>
---
target/mips/cpu.c | 2 +-
target/xtensa/cpu.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/target/mips/cpu.c b/target/mips/cpu.c
index e3af02a4e6d..47cd7cfdcef 100644
--- a/target/mips/cpu.c
+++ b/target/mips/cpu.c
@@ -644,7 +644,7 @@ MIPSCPU *mips_cpu_create_with_clock(const char *cpu_type, Clock *cpu_refclk,
{
DeviceState *cpu;
- cpu = DEVICE(object_new(cpu_type));
+ cpu = qdev_new(cpu_type);
qdev_connect_clock_in(cpu, "clk-in", cpu_refclk);
object_property_set_bool(OBJECT(cpu), "big-endian", is_big_endian,
&error_abort);
diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c
index 0910a3d2904..4eb699d1f45 100644
--- a/target/xtensa/cpu.c
+++ b/target/xtensa/cpu.c
@@ -208,7 +208,7 @@ XtensaCPU *xtensa_cpu_create_with_clock(const char *cpu_type, Clock *cpu_refclk)
{
DeviceState *cpu;
- cpu = DEVICE(object_new(cpu_type));
+ cpu = qdev_new(cpu_type);
qdev_connect_clock_in(cpu, "clk-in", cpu_refclk);
qdev_realize(cpu, NULL, &error_abort);
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 03/49] hw: Replace DEVICE(object_new) -> qdev_new()
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 01/49] pc-bios/meson.build: Silent unuseful DTC warnings Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 02/49] target: Replace DEVICE(object_new) -> qdev_new() Philippe Mathieu-Daudé
@ 2025-01-12 22:16 ` Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 04/49] hw: Add QOM parentship relation with CPUs Philippe Mathieu-Daudé
` (46 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:16 UTC (permalink / raw)
To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Zhao Liu
Prefer QDev API for QDev objects, avoid the underlying QOM layer.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Message-Id: <20240216110313.17039-7-philmd@linaro.org>
---
hw/arm/musicpal.c | 2 +-
hw/sparc/sun4m.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c
index a712ff954bd..48a32c24079 100644
--- a/hw/arm/musicpal.c
+++ b/hw/arm/musicpal.c
@@ -1238,7 +1238,7 @@ static void musicpal_init(MachineState *machine)
qdev_get_gpio_in(pic, MP_TIMER4_IRQ), NULL);
/* Logically OR both UART IRQs together */
- uart_orgate = DEVICE(object_new(TYPE_OR_IRQ));
+ uart_orgate = qdev_new(TYPE_OR_IRQ);
object_property_set_int(OBJECT(uart_orgate), "num-lines", 2, &error_fatal);
qdev_realize_and_unref(uart_orgate, NULL, &error_fatal);
qdev_connect_gpio_out(uart_orgate, 0,
diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
index 217a69e4d5d..e070360a2c7 100644
--- a/hw/sparc/sun4m.c
+++ b/hw/sparc/sun4m.c
@@ -974,7 +974,7 @@ static void sun4m_hw_init(MachineState *machine)
sysbus_mmio_map(s, 0, hwdef->ms_kb_base);
/* Logically OR both its IRQs together */
- ms_kb_orgate = DEVICE(object_new(TYPE_OR_IRQ));
+ ms_kb_orgate = qdev_new(TYPE_OR_IRQ);
object_property_set_int(OBJECT(ms_kb_orgate), "num-lines", 2, &error_fatal);
qdev_realize_and_unref(ms_kb_orgate, NULL, &error_fatal);
sysbus_connect_irq(s, 0, qdev_get_gpio_in(ms_kb_orgate, 0));
@@ -995,7 +995,7 @@ static void sun4m_hw_init(MachineState *machine)
sysbus_mmio_map(s, 0, hwdef->serial_base);
/* Logically OR both its IRQs together */
- serial_orgate = DEVICE(object_new(TYPE_OR_IRQ));
+ serial_orgate = qdev_new(TYPE_OR_IRQ);
object_property_set_int(OBJECT(serial_orgate), "num-lines", 2,
&error_fatal);
qdev_realize_and_unref(serial_orgate, NULL, &error_fatal);
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 04/49] hw: Add QOM parentship relation with CPUs
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (2 preceding siblings ...)
2025-01-12 22:16 ` [PULL 03/49] hw: " Philippe Mathieu-Daudé
@ 2025-01-12 22:16 ` Philippe Mathieu-Daudé
2025-01-13 12:28 ` Igor Mammedov
2025-01-12 22:16 ` [PULL 05/49] hw/usb: Inline usb_try_new() Philippe Mathieu-Daudé
` (45 subsequent siblings)
49 siblings, 1 reply; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:16 UTC (permalink / raw)
To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Zhao Liu
QDev objects created with object_new() need to manually add
their parent relationship with object_property_add_child().
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Message-Id: <20240216110313.17039-22-philmd@linaro.org>
---
hw/i386/x86-common.c | 1 +
hw/microblaze/petalogix_ml605_mmu.c | 1 +
hw/microblaze/petalogix_s3adsp1800_mmu.c | 1 +
hw/mips/cps.c | 1 +
hw/ppc/e500.c | 1 +
hw/ppc/spapr.c | 1 +
6 files changed, 6 insertions(+)
diff --git a/hw/i386/x86-common.c b/hw/i386/x86-common.c
index 97b4f7d4a0d..9c9ffb3484a 100644
--- a/hw/i386/x86-common.c
+++ b/hw/i386/x86-common.c
@@ -60,6 +60,7 @@ static void x86_cpu_new(X86MachineState *x86ms, int64_t apic_id, Error **errp)
if (!object_property_set_uint(cpu, "apic-id", apic_id, errp)) {
goto out;
}
+ object_property_add_child(OBJECT(x86ms), "cpu[*]", OBJECT(cpu));
qdev_realize(DEVICE(cpu), NULL, errp);
out:
diff --git a/hw/microblaze/petalogix_ml605_mmu.c b/hw/microblaze/petalogix_ml605_mmu.c
index 8b44be75a22..b6be40915ac 100644
--- a/hw/microblaze/petalogix_ml605_mmu.c
+++ b/hw/microblaze/petalogix_ml605_mmu.c
@@ -83,6 +83,7 @@ petalogix_ml605_init(MachineState *machine)
/* init CPUs */
cpu = MICROBLAZE_CPU(object_new(TYPE_MICROBLAZE_CPU));
+ object_property_add_child(OBJECT(machine), "cpu", OBJECT(cpu));
object_property_set_str(OBJECT(cpu), "version", "8.10.a", &error_abort);
/* Use FPU but don't use floating point conversion and square
* root instructions
diff --git a/hw/microblaze/petalogix_s3adsp1800_mmu.c b/hw/microblaze/petalogix_s3adsp1800_mmu.c
index 2c0d8c34cd2..29629310ba2 100644
--- a/hw/microblaze/petalogix_s3adsp1800_mmu.c
+++ b/hw/microblaze/petalogix_s3adsp1800_mmu.c
@@ -73,6 +73,7 @@ petalogix_s3adsp1800_init(MachineState *machine)
MemoryRegion *sysmem = get_system_memory();
cpu = MICROBLAZE_CPU(object_new(TYPE_MICROBLAZE_CPU));
+ object_property_add_child(OBJECT(machine), "cpu", OBJECT(cpu));
object_property_set_str(OBJECT(cpu), "version", "7.10.d", &error_abort);
object_property_set_bool(OBJECT(cpu), "little-endian",
!TARGET_BIG_ENDIAN, &error_abort);
diff --git a/hw/mips/cps.c b/hw/mips/cps.c
index 0d8cbdc8924..293b405b965 100644
--- a/hw/mips/cps.c
+++ b/hw/mips/cps.c
@@ -87,6 +87,7 @@ static void mips_cps_realize(DeviceState *dev, Error **errp)
/* All cores use the same clock tree */
qdev_connect_clock_in(DEVICE(cpu), "clk-in", s->clock);
+ object_property_add_child(OBJECT(dev), "cpu[*]", OBJECT(cpu));
if (!qdev_realize_and_unref(DEVICE(cpu), NULL, errp)) {
return;
}
diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
index 4551157c011..17d63ced907 100644
--- a/hw/ppc/e500.c
+++ b/hw/ppc/e500.c
@@ -955,6 +955,7 @@ void ppce500_init(MachineState *machine)
*/
object_property_set_bool(OBJECT(cs), "start-powered-off", i != 0,
&error_abort);
+ object_property_add_child(OBJECT(machine), "cpu[*]", OBJECT(cpu));
qdev_realize_and_unref(DEVICE(cs), NULL, &error_fatal);
if (!firstenv) {
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 623842f8064..125be6d29fd 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -2705,6 +2705,7 @@ static void spapr_init_cpus(SpaprMachineState *spapr)
&error_fatal);
object_property_set_int(core, CPU_CORE_PROP_CORE_ID, core_id,
&error_fatal);
+ object_property_add_child(OBJECT(spapr), "cpu[*]", OBJECT(core));
qdev_realize(DEVICE(core), NULL, &error_fatal);
object_unref(core);
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 05/49] hw/usb: Inline usb_try_new()
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (3 preceding siblings ...)
2025-01-12 22:16 ` [PULL 04/49] hw: Add QOM parentship relation with CPUs Philippe Mathieu-Daudé
@ 2025-01-12 22:16 ` Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 06/49] hw/usb: Inline usb_new() Philippe Mathieu-Daudé
` (44 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:16 UTC (permalink / raw)
To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Zhao Liu
Inline the single use of usb_try_new().
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Message-Id: <20240216110313.17039-10-philmd@linaro.org>
---
include/hw/usb.h | 5 -----
hw/usb/bus.c | 2 +-
2 files changed, 1 insertion(+), 6 deletions(-)
diff --git a/include/hw/usb.h b/include/hw/usb.h
index d46d96779ad..bb778cb844b 100644
--- a/include/hw/usb.h
+++ b/include/hw/usb.h
@@ -584,11 +584,6 @@ static inline USBDevice *usb_new(const char *name)
return USB_DEVICE(qdev_new(name));
}
-static inline USBDevice *usb_try_new(const char *name)
-{
- return USB_DEVICE(qdev_try_new(name));
-}
-
static inline bool usb_realize_and_unref(USBDevice *dev, USBBus *bus, Error **errp)
{
return qdev_realize_and_unref(&dev->qdev, &bus->qbus, errp);
diff --git a/hw/usb/bus.c b/hw/usb/bus.c
index b19b0b13ebd..7e7deaadcaf 100644
--- a/hw/usb/bus.c
+++ b/hw/usb/bus.c
@@ -411,7 +411,7 @@ void usb_claim_port(USBDevice *dev, Error **errp)
} else {
if (bus->nfree == 1 && strcmp(object_get_typename(OBJECT(dev)), "usb-hub") != 0) {
/* Create a new hub and chain it on */
- hub = usb_try_new("usb-hub");
+ hub = USB_DEVICE(qdev_try_new("usb-hub"));
if (hub) {
usb_realize_and_unref(hub, bus, NULL);
}
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 06/49] hw/usb: Inline usb_new()
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (4 preceding siblings ...)
2025-01-12 22:16 ` [PULL 05/49] hw/usb: Inline usb_try_new() Philippe Mathieu-Daudé
@ 2025-01-12 22:16 ` Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 07/49] hw/microblaze: Restrict MemoryRegionOps are implemented as 32-bit Philippe Mathieu-Daudé
` (43 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:16 UTC (permalink / raw)
To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Zhao Liu
Inline the 3 uses of usb_new().
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20240216110313.17039-11-philmd@linaro.org>
---
include/hw/usb.h | 7 +------
hw/usb/bus.c | 3 ++-
hw/usb/dev-serial.c | 2 +-
3 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/include/hw/usb.h b/include/hw/usb.h
index bb778cb844b..e410693d0c6 100644
--- a/include/hw/usb.h
+++ b/include/hw/usb.h
@@ -579,11 +579,6 @@ void usb_pcap_init(FILE *fp);
void usb_pcap_ctrl(USBPacket *p, bool setup);
void usb_pcap_data(USBPacket *p, bool setup);
-static inline USBDevice *usb_new(const char *name)
-{
- return USB_DEVICE(qdev_new(name));
-}
-
static inline bool usb_realize_and_unref(USBDevice *dev, USBBus *bus, Error **errp)
{
return qdev_realize_and_unref(&dev->qdev, &bus->qbus, errp);
@@ -591,7 +586,7 @@ static inline bool usb_realize_and_unref(USBDevice *dev, USBBus *bus, Error **er
static inline USBDevice *usb_create_simple(USBBus *bus, const char *name)
{
- USBDevice *dev = usb_new(name);
+ USBDevice *dev = USB_DEVICE(qdev_new(name));
usb_realize_and_unref(dev, bus, &error_abort);
return dev;
diff --git a/hw/usb/bus.c b/hw/usb/bus.c
index 7e7deaadcaf..f45b82c776d 100644
--- a/hw/usb/bus.c
+++ b/hw/usb/bus.c
@@ -662,7 +662,8 @@ USBDevice *usbdevice_create(const char *driver)
return NULL;
}
- dev = f->usbdevice_init ? f->usbdevice_init() : usb_new(f->name);
+ dev = f->usbdevice_init ? f->usbdevice_init()
+ : USB_DEVICE(qdev_new(f->name));
if (!dev) {
error_report("Failed to create USB device '%s'", f->name);
return NULL;
diff --git a/hw/usb/dev-serial.c b/hw/usb/dev-serial.c
index a0821db902f..aa50a92e26f 100644
--- a/hw/usb/dev-serial.c
+++ b/hw/usb/dev-serial.c
@@ -624,7 +624,7 @@ static USBDevice *usb_braille_init(void)
return NULL;
}
- dev = usb_new("usb-braille");
+ dev = USB_DEVICE(qdev_new("usb-braille"));
qdev_prop_set_chr(&dev->qdev, "chardev", cdrv);
return dev;
}
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 07/49] hw/microblaze: Restrict MemoryRegionOps are implemented as 32-bit
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (5 preceding siblings ...)
2025-01-12 22:16 ` [PULL 06/49] hw/usb: Inline usb_new() Philippe Mathieu-Daudé
@ 2025-01-12 22:16 ` Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 08/49] hw/net/xilinx_ethlite: Map MDIO registers (as unimplemented) Philippe Mathieu-Daudé
` (42 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:16 UTC (permalink / raw)
To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Anton Johansson
All these MemoryRegionOps read() and write() handlers are
implemented expecting 32-bit accesses. Clarify that setting
.impl.min/max_access_size fields.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Anton Johansson <anjo@rev.ng>
Message-Id: <20241105130431.22564-8-philmd@linaro.org>
---
hw/intc/xilinx_intc.c | 4 ++++
hw/net/xilinx_ethlite.c | 4 ++++
hw/timer/xilinx_timer.c | 4 ++++
3 files changed, 12 insertions(+)
diff --git a/hw/intc/xilinx_intc.c b/hw/intc/xilinx_intc.c
index d99cf567aeb..6930f83907a 100644
--- a/hw/intc/xilinx_intc.c
+++ b/hw/intc/xilinx_intc.c
@@ -144,6 +144,10 @@ static const MemoryRegionOps pic_ops = {
.read = pic_read,
.write = pic_write,
.endianness = DEVICE_NATIVE_ENDIAN,
+ .impl = {
+ .min_access_size = 4,
+ .max_access_size = 4,
+ },
.valid = {
.min_access_size = 4,
.max_access_size = 4
diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c
index 4c0c7fcae3e..88ab331acce 100644
--- a/hw/net/xilinx_ethlite.c
+++ b/hw/net/xilinx_ethlite.c
@@ -166,6 +166,10 @@ static const MemoryRegionOps eth_ops = {
.read = eth_read,
.write = eth_write,
.endianness = DEVICE_NATIVE_ENDIAN,
+ .impl = {
+ .min_access_size = 4,
+ .max_access_size = 4,
+ },
.valid = {
.min_access_size = 4,
.max_access_size = 4
diff --git a/hw/timer/xilinx_timer.c b/hw/timer/xilinx_timer.c
index 4955fe1b01b..6595cf5f517 100644
--- a/hw/timer/xilinx_timer.c
+++ b/hw/timer/xilinx_timer.c
@@ -193,6 +193,10 @@ static const MemoryRegionOps timer_ops = {
.read = timer_read,
.write = timer_write,
.endianness = DEVICE_NATIVE_ENDIAN,
+ .impl = {
+ .min_access_size = 4,
+ .max_access_size = 4,
+ },
.valid = {
.min_access_size = 4,
.max_access_size = 4
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 08/49] hw/net/xilinx_ethlite: Map MDIO registers (as unimplemented)
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (6 preceding siblings ...)
2025-01-12 22:16 ` [PULL 07/49] hw/microblaze: Restrict MemoryRegionOps are implemented as 32-bit Philippe Mathieu-Daudé
@ 2025-01-12 22:16 ` Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 09/49] hw/net/xilinx_ethlite: Introduce txbuf_ptr() helper Philippe Mathieu-Daudé
` (41 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:16 UTC (permalink / raw)
To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Edgar E. Iglesias
Rather than handling the MDIO registers as RAM, map them
as unimplemented I/O within the device MR.
The memory flat view becomes:
(qemu) info mtree -f
FlatView #0
Root memory region: system
0000000081000000-00000000810007e3 (prio 0, i/o): xlnx.xps-ethernetlite
00000000810007e4-00000000810007f3 (prio 0, i/o): ethlite.mdio
00000000810007f4-0000000081001fff (prio 0, i/o): xlnx.xps-ethernetlite @00000000000007f4
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
Message-Id: <20241112181044.92193-7-philmd@linaro.org>
---
hw/net/xilinx_ethlite.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c
index 88ab331acce..442467abeb8 100644
--- a/hw/net/xilinx_ethlite.c
+++ b/hw/net/xilinx_ethlite.c
@@ -28,15 +28,18 @@
#include "qemu/osdep.h"
#include "qemu/module.h"
#include "qom/object.h"
+#include "qapi/error.h"
#include "exec/tswap.h"
#include "hw/sysbus.h"
#include "hw/irq.h"
#include "hw/qdev-properties.h"
+#include "hw/misc/unimp.h"
#include "net/net.h"
#include "trace.h"
#define R_TX_BUF0 0
#define BUFSZ_MAX 0x07e4
+#define A_MDIO_BASE 0x07e4
#define R_TX_LEN0 (0x07f4 / 4)
#define R_TX_GIE0 (0x07f8 / 4)
#define R_TX_CTRL0 (0x07fc / 4)
@@ -72,6 +75,7 @@ struct XlnxXpsEthLite
uint32_t c_rx_pingpong;
unsigned int port_index; /* dual port RAM index */
+ UnimplementedDeviceState mdio;
uint32_t regs[R_MAX];
};
@@ -232,6 +236,14 @@ static void xilinx_ethlite_realize(DeviceState *dev, Error **errp)
{
XlnxXpsEthLite *s = XILINX_ETHLITE(dev);
+ object_initialize_child(OBJECT(dev), "ethlite.mdio", &s->mdio,
+ TYPE_UNIMPLEMENTED_DEVICE);
+ qdev_prop_set_string(DEVICE(&s->mdio), "name", "ethlite.mdio");
+ qdev_prop_set_uint64(DEVICE(&s->mdio), "size", 4 * 4);
+ sysbus_realize(SYS_BUS_DEVICE(&s->mdio), &error_fatal);
+ memory_region_add_subregion(&s->mmio, A_MDIO_BASE,
+ sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->mdio), 0));
+
qemu_macaddr_default_if_unset(&s->conf.macaddr);
s->nic = qemu_new_nic(&net_xilinx_ethlite_info, &s->conf,
object_get_typename(OBJECT(dev)), dev->id,
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 09/49] hw/net/xilinx_ethlite: Introduce txbuf_ptr() helper
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (7 preceding siblings ...)
2025-01-12 22:16 ` [PULL 08/49] hw/net/xilinx_ethlite: Map MDIO registers (as unimplemented) Philippe Mathieu-Daudé
@ 2025-01-12 22:16 ` Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 10/49] hw/net/xilinx_ethlite: Introduce rxbuf_ptr() helper Philippe Mathieu-Daudé
` (40 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:16 UTC (permalink / raw)
To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Edgar E. Iglesias
For a particular physical address within the EthLite MMIO range,
addr_to_port_index() returns which port is accessed.
txbuf_ptr() points to the beginning of a (RAM) TX buffer
within the device state.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
Message-Id: <20241112181044.92193-10-philmd@linaro.org>
---
hw/net/xilinx_ethlite.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c
index 442467abeb8..8df621904a1 100644
--- a/hw/net/xilinx_ethlite.c
+++ b/hw/net/xilinx_ethlite.c
@@ -27,6 +27,7 @@
#include "qemu/osdep.h"
#include "qemu/module.h"
+#include "qemu/bitops.h"
#include "qom/object.h"
#include "qapi/error.h"
#include "exec/tswap.h"
@@ -87,6 +88,18 @@ static inline void eth_pulse_irq(XlnxXpsEthLite *s)
}
}
+static unsigned addr_to_port_index(hwaddr addr)
+{
+ return extract64(addr, 11, 1);
+}
+
+static void *txbuf_ptr(XlnxXpsEthLite *s, unsigned port_index)
+{
+ unsigned int rxbase = port_index * (0x800 / 4);
+
+ return &s->regs[rxbase + R_TX_BUF0];
+}
+
static uint64_t
eth_read(void *opaque, hwaddr addr, unsigned int size)
{
@@ -119,6 +132,7 @@ eth_write(void *opaque, hwaddr addr,
uint64_t val64, unsigned int size)
{
XlnxXpsEthLite *s = opaque;
+ unsigned int port_index = addr_to_port_index(addr);
unsigned int base = 0;
uint32_t value = val64;
@@ -132,12 +146,12 @@ eth_write(void *opaque, hwaddr addr,
if ((value & (CTRL_P | CTRL_S)) == CTRL_S) {
qemu_send_packet(qemu_get_queue(s->nic),
- (void *) &s->regs[base],
+ txbuf_ptr(s, port_index),
s->regs[base + R_TX_LEN0]);
if (s->regs[base + R_TX_CTRL0] & CTRL_I)
eth_pulse_irq(s);
} else if ((value & (CTRL_P | CTRL_S)) == (CTRL_P | CTRL_S)) {
- memcpy(&s->conf.macaddr.a[0], &s->regs[base], 6);
+ memcpy(&s->conf.macaddr.a[0], txbuf_ptr(s, port_index), 6);
if (s->regs[base + R_TX_CTRL0] & CTRL_I)
eth_pulse_irq(s);
}
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 10/49] hw/net/xilinx_ethlite: Introduce rxbuf_ptr() helper
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (8 preceding siblings ...)
2025-01-12 22:16 ` [PULL 09/49] hw/net/xilinx_ethlite: Introduce txbuf_ptr() helper Philippe Mathieu-Daudé
@ 2025-01-12 22:16 ` Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 11/49] hw/net/xilinx_ethlite: Access TX_GIE register for each port Philippe Mathieu-Daudé
` (39 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:16 UTC (permalink / raw)
To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Edgar E. Iglesias
rxbuf_ptr() points to the beginning of a (RAM) RX buffer
within the device state.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
Message-Id: <20241112181044.92193-11-philmd@linaro.org>
---
hw/net/xilinx_ethlite.c | 39 +++++++++++++++++++++++++++++----------
1 file changed, 29 insertions(+), 10 deletions(-)
diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c
index 8df621904a1..67adecc0883 100644
--- a/hw/net/xilinx_ethlite.c
+++ b/hw/net/xilinx_ethlite.c
@@ -60,6 +60,12 @@
#define CTRL_P 0x2
#define CTRL_S 0x1
+typedef struct XlnxXpsEthLitePort {
+ struct {
+ uint32_t rx_ctrl;
+ } reg;
+} XlnxXpsEthLitePort;
+
#define TYPE_XILINX_ETHLITE "xlnx.xps-ethernetlite"
OBJECT_DECLARE_SIMPLE_TYPE(XlnxXpsEthLite, XILINX_ETHLITE)
@@ -77,6 +83,7 @@ struct XlnxXpsEthLite
unsigned int port_index; /* dual port RAM index */
UnimplementedDeviceState mdio;
+ XlnxXpsEthLitePort port[2];
uint32_t regs[R_MAX];
};
@@ -100,10 +107,18 @@ static void *txbuf_ptr(XlnxXpsEthLite *s, unsigned port_index)
return &s->regs[rxbase + R_TX_BUF0];
}
+static void *rxbuf_ptr(XlnxXpsEthLite *s, unsigned port_index)
+{
+ unsigned int rxbase = port_index * (0x800 / 4);
+
+ return &s->regs[rxbase + R_RX_BUF0];
+}
+
static uint64_t
eth_read(void *opaque, hwaddr addr, unsigned int size)
{
XlnxXpsEthLite *s = opaque;
+ unsigned port_index = addr_to_port_index(addr);
uint32_t r = 0;
addr >>= 2;
@@ -115,9 +130,12 @@ eth_read(void *opaque, hwaddr addr, unsigned int size)
case R_TX_LEN1:
case R_TX_CTRL1:
case R_TX_CTRL0:
+ r = s->regs[addr];
+ break;
+
case R_RX_CTRL1:
case R_RX_CTRL0:
- r = s->regs[addr];
+ r = s->port[port_index].reg.rx_ctrl;
break;
default:
@@ -167,7 +185,9 @@ eth_write(void *opaque, hwaddr addr,
if (!(value & CTRL_S)) {
qemu_flush_queued_packets(qemu_get_queue(s->nic));
}
- /* fall through */
+ s->port[port_index].reg.rx_ctrl = value;
+ break;
+
case R_TX_LEN0:
case R_TX_LEN1:
case R_TX_GIE0:
@@ -197,22 +217,21 @@ static const MemoryRegionOps eth_ops = {
static bool eth_can_rx(NetClientState *nc)
{
XlnxXpsEthLite *s = qemu_get_nic_opaque(nc);
- unsigned int rxbase = s->port_index * (0x800 / 4);
- return !(s->regs[rxbase + R_RX_CTRL0] & CTRL_S);
+ return !(s->port[s->port_index].reg.rx_ctrl & CTRL_S);
}
static ssize_t eth_rx(NetClientState *nc, const uint8_t *buf, size_t size)
{
XlnxXpsEthLite *s = qemu_get_nic_opaque(nc);
- unsigned int rxbase = s->port_index * (0x800 / 4);
+ unsigned int port_index = s->port_index;
/* DA filter. */
if (!(buf[0] & 0x80) && memcmp(&s->conf.macaddr.a[0], buf, 6))
return size;
- if (s->regs[rxbase + R_RX_CTRL0] & CTRL_S) {
- trace_ethlite_pkt_lost(s->regs[R_RX_CTRL0]);
+ if (s->port[port_index].reg.rx_ctrl & CTRL_S) {
+ trace_ethlite_pkt_lost(s->port[port_index].reg.rx_ctrl);
return -1;
}
@@ -220,10 +239,10 @@ static ssize_t eth_rx(NetClientState *nc, const uint8_t *buf, size_t size)
trace_ethlite_pkt_size_too_big(size);
return -1;
}
- memcpy(&s->regs[rxbase + R_RX_BUF0], buf, size);
+ memcpy(rxbuf_ptr(s, port_index), buf, size);
- s->regs[rxbase + R_RX_CTRL0] |= CTRL_S;
- if (s->regs[R_RX_CTRL0] & CTRL_I) {
+ s->port[port_index].reg.rx_ctrl |= CTRL_S;
+ if (s->port[port_index].reg.rx_ctrl & CTRL_I) {
eth_pulse_irq(s);
}
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 11/49] hw/net/xilinx_ethlite: Access TX_GIE register for each port
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (9 preceding siblings ...)
2025-01-12 22:16 ` [PULL 10/49] hw/net/xilinx_ethlite: Introduce rxbuf_ptr() helper Philippe Mathieu-Daudé
@ 2025-01-12 22:16 ` Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 12/49] hw/net/xilinx_ethlite: Access TX_LEN " Philippe Mathieu-Daudé
` (38 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:16 UTC (permalink / raw)
To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Edgar E. Iglesias
Rather than accessing the registers within the mixed RAM/MMIO
region as indexed register, declare a per-port TX_GIE. This
will help to map the RAM as RAM (keeping MMIO as MMIO) in few
commits.
Previous s->regs[R_TX_GIE0] and s->regs[R_TX_GIE1] are now
unused. Not a concern, this array will soon disappear.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
Message-Id: <20241112181044.92193-13-philmd@linaro.org>
---
hw/net/xilinx_ethlite.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c
index 67adecc0883..3252c9d508a 100644
--- a/hw/net/xilinx_ethlite.c
+++ b/hw/net/xilinx_ethlite.c
@@ -62,6 +62,8 @@
typedef struct XlnxXpsEthLitePort {
struct {
+ uint32_t tx_gie;
+
uint32_t rx_ctrl;
} reg;
} XlnxXpsEthLitePort;
@@ -90,7 +92,7 @@ struct XlnxXpsEthLite
static inline void eth_pulse_irq(XlnxXpsEthLite *s)
{
/* Only the first gie reg is active. */
- if (s->regs[R_TX_GIE0] & GIE_GIE) {
+ if (s->port[0].reg.tx_gie & GIE_GIE) {
qemu_irq_pulse(s->irq);
}
}
@@ -126,6 +128,9 @@ eth_read(void *opaque, hwaddr addr, unsigned int size)
switch (addr)
{
case R_TX_GIE0:
+ r = s->port[port_index].reg.tx_gie;
+ break;
+
case R_TX_LEN0:
case R_TX_LEN1:
case R_TX_CTRL1:
@@ -190,10 +195,13 @@ eth_write(void *opaque, hwaddr addr,
case R_TX_LEN0:
case R_TX_LEN1:
- case R_TX_GIE0:
s->regs[addr] = value;
break;
+ case R_TX_GIE0:
+ s->port[port_index].reg.tx_gie = value;
+ break;
+
default:
s->regs[addr] = tswap32(value);
break;
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 12/49] hw/net/xilinx_ethlite: Access TX_LEN register for each port
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (10 preceding siblings ...)
2025-01-12 22:16 ` [PULL 11/49] hw/net/xilinx_ethlite: Access TX_GIE register for each port Philippe Mathieu-Daudé
@ 2025-01-12 22:16 ` Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 13/49] hw/net/xilinx_ethlite: Access TX_CTRL " Philippe Mathieu-Daudé
` (37 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:16 UTC (permalink / raw)
To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Edgar E. Iglesias
Rather than accessing the registers within the mixed RAM/MMIO
region as indexed register, declare a per-port TX_LEN. This
will help to map the RAM as RAM (keeping MMIO as MMIO) in few
commits.
Previous s->regs[R_TX_LEN0] and s->regs[R_TX_LEN1] are now
unused. Not a concern, this array will soon disappear.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
Message-Id: <20241112181044.92193-14-philmd@linaro.org>
---
hw/net/xilinx_ethlite.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c
index 3252c9d508a..ce9555bd1e2 100644
--- a/hw/net/xilinx_ethlite.c
+++ b/hw/net/xilinx_ethlite.c
@@ -62,6 +62,7 @@
typedef struct XlnxXpsEthLitePort {
struct {
+ uint32_t tx_len;
uint32_t tx_gie;
uint32_t rx_ctrl;
@@ -133,6 +134,9 @@ eth_read(void *opaque, hwaddr addr, unsigned int size)
case R_TX_LEN0:
case R_TX_LEN1:
+ r = s->port[port_index].reg.tx_len;
+ break;
+
case R_TX_CTRL1:
case R_TX_CTRL0:
r = s->regs[addr];
@@ -170,7 +174,7 @@ eth_write(void *opaque, hwaddr addr,
if ((value & (CTRL_P | CTRL_S)) == CTRL_S) {
qemu_send_packet(qemu_get_queue(s->nic),
txbuf_ptr(s, port_index),
- s->regs[base + R_TX_LEN0]);
+ s->port[port_index].reg.tx_len);
if (s->regs[base + R_TX_CTRL0] & CTRL_I)
eth_pulse_irq(s);
} else if ((value & (CTRL_P | CTRL_S)) == (CTRL_P | CTRL_S)) {
@@ -195,7 +199,7 @@ eth_write(void *opaque, hwaddr addr,
case R_TX_LEN0:
case R_TX_LEN1:
- s->regs[addr] = value;
+ s->port[port_index].reg.tx_len = value;
break;
case R_TX_GIE0:
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 13/49] hw/net/xilinx_ethlite: Access TX_CTRL register for each port
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (11 preceding siblings ...)
2025-01-12 22:16 ` [PULL 12/49] hw/net/xilinx_ethlite: Access TX_LEN " Philippe Mathieu-Daudé
@ 2025-01-12 22:16 ` Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 14/49] hw/net/xilinx_ethlite: Map RX_CTRL as MMIO Philippe Mathieu-Daudé
` (36 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:16 UTC (permalink / raw)
To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Edgar E. Iglesias
Rather than accessing the registers within the mixed RAM/MMIO
region as indexed register, declare a per-port TX_CTRL. This
will help to map the RAM as RAM (keeping MMIO as MMIO) in few
commits.
Previous s->regs[R_TX_CTRL0] and s->regs[R_TX_CTRL1] are now
unused. Not a concern, this array will soon disappear.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
Message-Id: <20241112181044.92193-15-philmd@linaro.org>
---
hw/net/xilinx_ethlite.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c
index ce9555bd1e2..f8b01fe9a62 100644
--- a/hw/net/xilinx_ethlite.c
+++ b/hw/net/xilinx_ethlite.c
@@ -64,6 +64,7 @@ typedef struct XlnxXpsEthLitePort {
struct {
uint32_t tx_len;
uint32_t tx_gie;
+ uint32_t tx_ctrl;
uint32_t rx_ctrl;
} reg;
@@ -139,7 +140,7 @@ eth_read(void *opaque, hwaddr addr, unsigned int size)
case R_TX_CTRL1:
case R_TX_CTRL0:
- r = s->regs[addr];
+ r = s->port[port_index].reg.tx_ctrl;
break;
case R_RX_CTRL1:
@@ -160,7 +161,6 @@ eth_write(void *opaque, hwaddr addr,
{
XlnxXpsEthLite *s = opaque;
unsigned int port_index = addr_to_port_index(addr);
- unsigned int base = 0;
uint32_t value = val64;
addr >>= 2;
@@ -168,24 +168,23 @@ eth_write(void *opaque, hwaddr addr,
{
case R_TX_CTRL0:
case R_TX_CTRL1:
- if (addr == R_TX_CTRL1)
- base = 0x800 / 4;
-
if ((value & (CTRL_P | CTRL_S)) == CTRL_S) {
qemu_send_packet(qemu_get_queue(s->nic),
txbuf_ptr(s, port_index),
s->port[port_index].reg.tx_len);
- if (s->regs[base + R_TX_CTRL0] & CTRL_I)
+ if (s->port[port_index].reg.tx_ctrl & CTRL_I) {
eth_pulse_irq(s);
+ }
} else if ((value & (CTRL_P | CTRL_S)) == (CTRL_P | CTRL_S)) {
memcpy(&s->conf.macaddr.a[0], txbuf_ptr(s, port_index), 6);
- if (s->regs[base + R_TX_CTRL0] & CTRL_I)
+ if (s->port[port_index].reg.tx_ctrl & CTRL_I) {
eth_pulse_irq(s);
+ }
}
/* We are fast and get ready pretty much immediately so
we actually never flip the S nor P bits to one. */
- s->regs[addr] = value & ~(CTRL_P | CTRL_S);
+ s->port[port_index].reg.tx_ctrl = value & ~(CTRL_P | CTRL_S);
break;
/* Keep these native. */
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 14/49] hw/net/xilinx_ethlite: Map RX_CTRL as MMIO
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (12 preceding siblings ...)
2025-01-12 22:16 ` [PULL 13/49] hw/net/xilinx_ethlite: Access TX_CTRL " Philippe Mathieu-Daudé
@ 2025-01-12 22:16 ` Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 15/49] hw/net/xilinx_ethlite: Map TX_LEN " Philippe Mathieu-Daudé
` (35 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:16 UTC (permalink / raw)
To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Edgar E. Iglesias
Declare RX registers as MMIO region, split it out
of the current mixed RAM/MMIO region.
The memory flat view becomes:
(qemu) info mtree -f
FlatView #0
Root memory region: system
0000000081000000-00000000810007e3 (prio 0, i/o): xlnx.xps-ethernetlite
00000000810007e4-00000000810007f3 (prio 0, i/o): ethlite.mdio
00000000810007f4-00000000810017fb (prio 0, i/o): xlnx.xps-ethernetlite @00000000000007f4
00000000810017fc-00000000810017ff (prio 0, i/o): ethlite.rx[0]io
0000000081001800-0000000081001ffb (prio 0, i/o): xlnx.xps-ethernetlite @0000000000001800
0000000081001ffc-0000000081001fff (prio 0, i/o): ethlite.rx[1]io
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20241112181044.92193-16-philmd@linaro.org>
---
hw/net/xilinx_ethlite.c | 82 +++++++++++++++++++++++++++++++++--------
1 file changed, 67 insertions(+), 15 deletions(-)
diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c
index f8b01fe9a62..9ac81ca1e06 100644
--- a/hw/net/xilinx_ethlite.c
+++ b/hw/net/xilinx_ethlite.c
@@ -49,11 +49,16 @@
#define R_TX_CTRL1 (0x0ffc / 4)
#define R_RX_BUF0 (0x1000 / 4)
-#define R_RX_CTRL0 (0x17fc / 4)
+#define A_RX_BASE0 0x17fc
#define R_RX_BUF1 (0x1800 / 4)
-#define R_RX_CTRL1 (0x1ffc / 4)
+#define A_RX_BASE1 0x1ffc
#define R_MAX (0x2000 / 4)
+enum {
+ RX_CTRL = 0,
+ RX_MAX
+};
+
#define GIE_GIE 0x80000000
#define CTRL_I 0x8
@@ -61,6 +66,8 @@
#define CTRL_S 0x1
typedef struct XlnxXpsEthLitePort {
+ MemoryRegion rxio;
+
struct {
uint32_t tx_len;
uint32_t tx_gie;
@@ -118,6 +125,55 @@ static void *rxbuf_ptr(XlnxXpsEthLite *s, unsigned port_index)
return &s->regs[rxbase + R_RX_BUF0];
}
+static uint64_t port_rx_read(void *opaque, hwaddr addr, unsigned int size)
+{
+ XlnxXpsEthLite *s = opaque;
+ unsigned port_index = addr_to_port_index(addr);
+ uint32_t r = 0;
+
+ switch (addr >> 2) {
+ case RX_CTRL:
+ r = s->port[port_index].reg.rx_ctrl;
+ break;
+ default:
+ g_assert_not_reached();
+ }
+
+ return r;
+}
+
+static void port_rx_write(void *opaque, hwaddr addr, uint64_t value,
+ unsigned int size)
+{
+ XlnxXpsEthLite *s = opaque;
+ unsigned port_index = addr_to_port_index(addr);
+
+ switch (addr >> 2) {
+ case RX_CTRL:
+ if (!(value & CTRL_S)) {
+ qemu_flush_queued_packets(qemu_get_queue(s->nic));
+ }
+ s->port[port_index].reg.rx_ctrl = value;
+ break;
+ default:
+ g_assert_not_reached();
+ }
+}
+
+static const MemoryRegionOps eth_portrx_ops = {
+ .read = port_rx_read,
+ .write = port_rx_write,
+ .endianness = DEVICE_NATIVE_ENDIAN,
+ .impl = {
+ .min_access_size = 4,
+ .max_access_size = 4,
+ },
+ .valid = {
+ .min_access_size = 4,
+ .max_access_size = 4,
+ },
+};
+
static uint64_t
eth_read(void *opaque, hwaddr addr, unsigned int size)
{
@@ -143,11 +199,6 @@ eth_read(void *opaque, hwaddr addr, unsigned int size)
r = s->port[port_index].reg.tx_ctrl;
break;
- case R_RX_CTRL1:
- case R_RX_CTRL0:
- r = s->port[port_index].reg.rx_ctrl;
- break;
-
default:
r = tswap32(s->regs[addr]);
break;
@@ -188,14 +239,6 @@ eth_write(void *opaque, hwaddr addr,
break;
/* Keep these native. */
- case R_RX_CTRL0:
- case R_RX_CTRL1:
- if (!(value & CTRL_S)) {
- qemu_flush_queued_packets(qemu_get_queue(s->nic));
- }
- s->port[port_index].reg.rx_ctrl = value;
- break;
-
case R_TX_LEN0:
case R_TX_LEN1:
s->port[port_index].reg.tx_len = value;
@@ -288,6 +331,15 @@ static void xilinx_ethlite_realize(DeviceState *dev, Error **errp)
memory_region_add_subregion(&s->mmio, A_MDIO_BASE,
sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->mdio), 0));
+ for (unsigned i = 0; i < 2; i++) {
+ memory_region_init_io(&s->port[i].rxio, OBJECT(dev),
+ ð_portrx_ops, s,
+ i ? "ethlite.rx[1]io" : "ethlite.rx[0]io",
+ 4 * RX_MAX);
+ memory_region_add_subregion(&s->mmio, i ? A_RX_BASE1 : A_RX_BASE0,
+ &s->port[i].rxio);
+ }
+
qemu_macaddr_default_if_unset(&s->conf.macaddr);
s->nic = qemu_new_nic(&net_xilinx_ethlite_info, &s->conf,
object_get_typename(OBJECT(dev)), dev->id,
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 15/49] hw/net/xilinx_ethlite: Map TX_LEN as MMIO
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (13 preceding siblings ...)
2025-01-12 22:16 ` [PULL 14/49] hw/net/xilinx_ethlite: Map RX_CTRL as MMIO Philippe Mathieu-Daudé
@ 2025-01-12 22:16 ` Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 16/49] hw/net/xilinx_ethlite: Map TX_GIE " Philippe Mathieu-Daudé
` (34 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:16 UTC (permalink / raw)
To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Edgar E. Iglesias
Declare TX registers as MMIO region, split it out
of the current mixed RAM/MMIO region.
The memory flat view becomes:
(qemu) info mtree -f
FlatView #0
Root memory region: system
0000000081000000-00000000810007e3 (prio 0, i/o): xlnx.xps-ethernetlite
00000000810007e4-00000000810007f3 (prio 0, i/o): ethlite.mdio
00000000810007f4-00000000810007f7 (prio 0, i/o): ethlite.tx[0]io
00000000810007f8-0000000081000ff3 (prio 0, i/o): xlnx.xps-ethernetlite @00000000000007f8
0000000081000ff4-0000000081000ff7 (prio 0, i/o): ethlite.tx[1]io
0000000081000ff8-00000000810017fb (prio 0, i/o): xlnx.xps-ethernetlite @0000000000000ff8
00000000810017fc-00000000810017ff (prio 0, i/o): ethlite.rx[0]io
0000000081001800-0000000081001ffb (prio 0, i/o): xlnx.xps-ethernetlite @0000000000001800
0000000081001ffc-0000000081001fff (prio 0, i/o): ethlite.rx[1]io
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
Message-Id: <20241112181044.92193-17-philmd@linaro.org>
---
hw/net/xilinx_ethlite.c | 73 ++++++++++++++++++++++++++++++++++-------
1 file changed, 61 insertions(+), 12 deletions(-)
diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c
index 9ac81ca1e06..5dac44fa688 100644
--- a/hw/net/xilinx_ethlite.c
+++ b/hw/net/xilinx_ethlite.c
@@ -41,11 +41,11 @@
#define R_TX_BUF0 0
#define BUFSZ_MAX 0x07e4
#define A_MDIO_BASE 0x07e4
-#define R_TX_LEN0 (0x07f4 / 4)
+#define A_TX_BASE0 0x07f4
#define R_TX_GIE0 (0x07f8 / 4)
#define R_TX_CTRL0 (0x07fc / 4)
#define R_TX_BUF1 (0x0800 / 4)
-#define R_TX_LEN1 (0x0ff4 / 4)
+#define A_TX_BASE1 0x0ff4
#define R_TX_CTRL1 (0x0ffc / 4)
#define R_RX_BUF0 (0x1000 / 4)
@@ -54,6 +54,11 @@
#define A_RX_BASE1 0x1ffc
#define R_MAX (0x2000 / 4)
+enum {
+ TX_LEN = 0,
+ TX_MAX
+};
+
enum {
RX_CTRL = 0,
RX_MAX
@@ -66,6 +71,7 @@ enum {
#define CTRL_S 0x1
typedef struct XlnxXpsEthLitePort {
+ MemoryRegion txio;
MemoryRegion rxio;
struct {
@@ -125,6 +131,52 @@ static void *rxbuf_ptr(XlnxXpsEthLite *s, unsigned port_index)
return &s->regs[rxbase + R_RX_BUF0];
}
+static uint64_t port_tx_read(void *opaque, hwaddr addr, unsigned int size)
+{
+ XlnxXpsEthLite *s = opaque;
+ unsigned port_index = addr_to_port_index(addr);
+ uint32_t r = 0;
+
+ switch (addr >> 2) {
+ case TX_LEN:
+ r = s->port[port_index].reg.tx_len;
+ break;
+ default:
+ g_assert_not_reached();
+ }
+
+ return r;
+}
+
+static void port_tx_write(void *opaque, hwaddr addr, uint64_t value,
+ unsigned int size)
+{
+ XlnxXpsEthLite *s = opaque;
+ unsigned port_index = addr_to_port_index(addr);
+
+ switch (addr >> 2) {
+ case TX_LEN:
+ s->port[port_index].reg.tx_len = value;
+ break;
+ default:
+ g_assert_not_reached();
+ }
+}
+
+static const MemoryRegionOps eth_porttx_ops = {
+ .read = port_tx_read,
+ .write = port_tx_write,
+ .endianness = DEVICE_NATIVE_ENDIAN,
+ .impl = {
+ .min_access_size = 4,
+ .max_access_size = 4,
+ },
+ .valid = {
+ .min_access_size = 4,
+ .max_access_size = 4,
+ },
+};
+
static uint64_t port_rx_read(void *opaque, hwaddr addr, unsigned int size)
{
XlnxXpsEthLite *s = opaque;
@@ -189,11 +241,6 @@ eth_read(void *opaque, hwaddr addr, unsigned int size)
r = s->port[port_index].reg.tx_gie;
break;
- case R_TX_LEN0:
- case R_TX_LEN1:
- r = s->port[port_index].reg.tx_len;
- break;
-
case R_TX_CTRL1:
case R_TX_CTRL0:
r = s->port[port_index].reg.tx_ctrl;
@@ -239,11 +286,6 @@ eth_write(void *opaque, hwaddr addr,
break;
/* Keep these native. */
- case R_TX_LEN0:
- case R_TX_LEN1:
- s->port[port_index].reg.tx_len = value;
- break;
-
case R_TX_GIE0:
s->port[port_index].reg.tx_gie = value;
break;
@@ -332,6 +374,13 @@ static void xilinx_ethlite_realize(DeviceState *dev, Error **errp)
sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->mdio), 0));
for (unsigned i = 0; i < 2; i++) {
+ memory_region_init_io(&s->port[i].txio, OBJECT(dev),
+ ð_porttx_ops, s,
+ i ? "ethlite.tx[1]io" : "ethlite.tx[0]io",
+ 4 * TX_MAX);
+ memory_region_add_subregion(&s->mmio, i ? A_TX_BASE1 : A_TX_BASE0,
+ &s->port[i].txio);
+
memory_region_init_io(&s->port[i].rxio, OBJECT(dev),
ð_portrx_ops, s,
i ? "ethlite.rx[1]io" : "ethlite.rx[0]io",
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 16/49] hw/net/xilinx_ethlite: Map TX_GIE as MMIO
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (14 preceding siblings ...)
2025-01-12 22:16 ` [PULL 15/49] hw/net/xilinx_ethlite: Map TX_LEN " Philippe Mathieu-Daudé
@ 2025-01-12 22:16 ` Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 17/49] hw/net/xilinx_ethlite: Map TX_CTRL " Philippe Mathieu-Daudé
` (33 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:16 UTC (permalink / raw)
To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Edgar E. Iglesias
Add TX_GIE to the TX registers MMIO region.
Before TX_GIE1 was accessed as RAM, with no effect.
Now it is accessed as MMIO, also without any effect.
The memory flat view becomes:
(qemu) info mtree -f
FlatView #0
Root memory region: system
0000000081000000-00000000810007e3 (prio 0, i/o): xlnx.xps-ethernetlite
00000000810007e4-00000000810007f3 (prio 0, i/o): ethlite.mdio
00000000810007f4-00000000810007fb (prio 0, i/o): ethlite.tx[0]io
00000000810007fc-0000000081000ff3 (prio 0, i/o): xlnx.xps-ethernetlite @00000000000007fc
0000000081000ff4-0000000081000ffb (prio 0, i/o): ethlite.tx[1]io
0000000081000ffc-00000000810017fb (prio 0, i/o): xlnx.xps-ethernetlite @0000000000000ffc
00000000810017fc-00000000810017ff (prio 0, i/o): ethlite.rx[0]io
0000000081001800-0000000081001ffb (prio 0, i/o): xlnx.xps-ethernetlite @0000000000001800
0000000081001ffc-0000000081001fff (prio 0, i/o): ethlite.rx[1]io
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
Message-Id: <20241112181044.92193-18-philmd@linaro.org>
---
hw/net/xilinx_ethlite.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c
index 5dac44fa688..898c09b3981 100644
--- a/hw/net/xilinx_ethlite.c
+++ b/hw/net/xilinx_ethlite.c
@@ -42,7 +42,6 @@
#define BUFSZ_MAX 0x07e4
#define A_MDIO_BASE 0x07e4
#define A_TX_BASE0 0x07f4
-#define R_TX_GIE0 (0x07f8 / 4)
#define R_TX_CTRL0 (0x07fc / 4)
#define R_TX_BUF1 (0x0800 / 4)
#define A_TX_BASE1 0x0ff4
@@ -56,6 +55,7 @@
enum {
TX_LEN = 0,
+ TX_GIE = 1,
TX_MAX
};
@@ -141,6 +141,9 @@ static uint64_t port_tx_read(void *opaque, hwaddr addr, unsigned int size)
case TX_LEN:
r = s->port[port_index].reg.tx_len;
break;
+ case TX_GIE:
+ r = s->port[port_index].reg.tx_gie;
+ break;
default:
g_assert_not_reached();
}
@@ -158,6 +161,9 @@ static void port_tx_write(void *opaque, hwaddr addr, uint64_t value,
case TX_LEN:
s->port[port_index].reg.tx_len = value;
break;
+ case TX_GIE:
+ s->port[port_index].reg.tx_gie = value;
+ break;
default:
g_assert_not_reached();
}
@@ -237,10 +243,6 @@ eth_read(void *opaque, hwaddr addr, unsigned int size)
switch (addr)
{
- case R_TX_GIE0:
- r = s->port[port_index].reg.tx_gie;
- break;
-
case R_TX_CTRL1:
case R_TX_CTRL0:
r = s->port[port_index].reg.tx_ctrl;
@@ -285,11 +287,6 @@ eth_write(void *opaque, hwaddr addr,
s->port[port_index].reg.tx_ctrl = value & ~(CTRL_P | CTRL_S);
break;
- /* Keep these native. */
- case R_TX_GIE0:
- s->port[port_index].reg.tx_gie = value;
- break;
-
default:
s->regs[addr] = tswap32(value);
break;
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 17/49] hw/net/xilinx_ethlite: Map TX_CTRL as MMIO
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (15 preceding siblings ...)
2025-01-12 22:16 ` [PULL 16/49] hw/net/xilinx_ethlite: Map TX_GIE " Philippe Mathieu-Daudé
@ 2025-01-12 22:16 ` Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 18/49] hw/net/xilinx_ethlite: Map the RAM buffer as RAM memory region Philippe Mathieu-Daudé
` (32 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:16 UTC (permalink / raw)
To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Edgar E. Iglesias
Add TX_CTRL to the TX registers MMIO region.
The memory flat view becomes:
(qemu) info mtree -f
FlatView #0
Root memory region: system
0000000081000000-00000000810007e3 (prio 0, i/o): xlnx.xps-ethernetlite
00000000810007e4-00000000810007f3 (prio 0, i/o): ethlite.mdio
00000000810007f4-00000000810007ff (prio 0, i/o): ethlite.tx[0]io
0000000081000800-0000000081000ff3 (prio 0, i/o): xlnx.xps-ethernetlite @0000000000000800
0000000081000ff4-0000000081000fff (prio 0, i/o): ethlite.tx[1]io
0000000081001000-00000000810017fb (prio 0, i/o): xlnx.xps-ethernetlite @0000000000001000
00000000810017fc-00000000810017ff (prio 0, i/o): ethlite.rx[0]io
0000000081001800-0000000081001ffb (prio 0, i/o): xlnx.xps-ethernetlite @0000000000001800
0000000081001ffc-0000000081001fff (prio 0, i/o): ethlite.rx[1]io
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
Message-Id: <20241112181044.92193-19-philmd@linaro.org>
---
hw/net/xilinx_ethlite.c | 54 ++++++++++++++++++-----------------------
1 file changed, 24 insertions(+), 30 deletions(-)
diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c
index 898c09b3981..5ab8ae43b2b 100644
--- a/hw/net/xilinx_ethlite.c
+++ b/hw/net/xilinx_ethlite.c
@@ -42,10 +42,8 @@
#define BUFSZ_MAX 0x07e4
#define A_MDIO_BASE 0x07e4
#define A_TX_BASE0 0x07f4
-#define R_TX_CTRL0 (0x07fc / 4)
#define R_TX_BUF1 (0x0800 / 4)
#define A_TX_BASE1 0x0ff4
-#define R_TX_CTRL1 (0x0ffc / 4)
#define R_RX_BUF0 (0x1000 / 4)
#define A_RX_BASE0 0x17fc
@@ -56,6 +54,7 @@
enum {
TX_LEN = 0,
TX_GIE = 1,
+ TX_CTRL = 2,
TX_MAX
};
@@ -144,6 +143,9 @@ static uint64_t port_tx_read(void *opaque, hwaddr addr, unsigned int size)
case TX_GIE:
r = s->port[port_index].reg.tx_gie;
break;
+ case TX_CTRL:
+ r = s->port[port_index].reg.tx_ctrl;
+ break;
default:
g_assert_not_reached();
}
@@ -164,6 +166,26 @@ static void port_tx_write(void *opaque, hwaddr addr, uint64_t value,
case TX_GIE:
s->port[port_index].reg.tx_gie = value;
break;
+ case TX_CTRL:
+ if ((value & (CTRL_P | CTRL_S)) == CTRL_S) {
+ qemu_send_packet(qemu_get_queue(s->nic),
+ txbuf_ptr(s, port_index),
+ s->port[port_index].reg.tx_len);
+ if (s->port[port_index].reg.tx_ctrl & CTRL_I) {
+ eth_pulse_irq(s);
+ }
+ } else if ((value & (CTRL_P | CTRL_S)) == (CTRL_P | CTRL_S)) {
+ memcpy(&s->conf.macaddr.a[0], txbuf_ptr(s, port_index), 6);
+ if (s->port[port_index].reg.tx_ctrl & CTRL_I) {
+ eth_pulse_irq(s);
+ }
+ }
+ /*
+ * We are fast and get ready pretty much immediately
+ * so we actually never flip the S nor P bits to one.
+ */
+ s->port[port_index].reg.tx_ctrl = value & ~(CTRL_P | CTRL_S);
+ break;
default:
g_assert_not_reached();
}
@@ -236,18 +258,12 @@ static uint64_t
eth_read(void *opaque, hwaddr addr, unsigned int size)
{
XlnxXpsEthLite *s = opaque;
- unsigned port_index = addr_to_port_index(addr);
uint32_t r = 0;
addr >>= 2;
switch (addr)
{
- case R_TX_CTRL1:
- case R_TX_CTRL0:
- r = s->port[port_index].reg.tx_ctrl;
- break;
-
default:
r = tswap32(s->regs[addr]);
break;
@@ -260,33 +276,11 @@ eth_write(void *opaque, hwaddr addr,
uint64_t val64, unsigned int size)
{
XlnxXpsEthLite *s = opaque;
- unsigned int port_index = addr_to_port_index(addr);
uint32_t value = val64;
addr >>= 2;
switch (addr)
{
- case R_TX_CTRL0:
- case R_TX_CTRL1:
- if ((value & (CTRL_P | CTRL_S)) == CTRL_S) {
- qemu_send_packet(qemu_get_queue(s->nic),
- txbuf_ptr(s, port_index),
- s->port[port_index].reg.tx_len);
- if (s->port[port_index].reg.tx_ctrl & CTRL_I) {
- eth_pulse_irq(s);
- }
- } else if ((value & (CTRL_P | CTRL_S)) == (CTRL_P | CTRL_S)) {
- memcpy(&s->conf.macaddr.a[0], txbuf_ptr(s, port_index), 6);
- if (s->port[port_index].reg.tx_ctrl & CTRL_I) {
- eth_pulse_irq(s);
- }
- }
-
- /* We are fast and get ready pretty much immediately so
- we actually never flip the S nor P bits to one. */
- s->port[port_index].reg.tx_ctrl = value & ~(CTRL_P | CTRL_S);
- break;
-
default:
s->regs[addr] = tswap32(value);
break;
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 18/49] hw/net/xilinx_ethlite: Map the RAM buffer as RAM memory region
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (16 preceding siblings ...)
2025-01-12 22:16 ` [PULL 17/49] hw/net/xilinx_ethlite: Map TX_CTRL " Philippe Mathieu-Daudé
@ 2025-01-12 22:16 ` Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 19/49] hw/net/xilinx_ethlite: Rename 'mmio' MR as 'container' Philippe Mathieu-Daudé
` (31 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:16 UTC (permalink / raw)
To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Paolo Bonzini, Edgar E. Iglesias
Rather than using I/O registers for RAM buffer, having to
swap endianness back and forth (because the core memory layer
automatically swaps endiannes for us), declare the buffers
as RAM regions. The "xlnx.xps-ethernetlite" MR doesn't have
any more I/O regions. Remove the now unused s->regs[] array.
The memory flat view becomes:
FlatView #0
Root memory region: system
0000000081000000-00000000810007e3 (prio 0, ram): ethlite.tx[0]buf
00000000810007e4-00000000810007f3 (prio 0, i/o): ethlite.mdio
00000000810007f4-00000000810007ff (prio 0, i/o): ethlite.tx[0]io
0000000081000800-0000000081000fe3 (prio 0, ram): ethlite.tx[1]buf
0000000081000ff4-0000000081000fff (prio 0, i/o): ethlite.tx[1]io
0000000081001000-00000000810017e3 (prio 0, ram): ethlite.rx[0]buf
00000000810017fc-00000000810017ff (prio 0, i/o): ethlite.rx[0]io
0000000081001800-0000000081001fe3 (prio 0, ram): ethlite.rx[1]buf
0000000081001ffc-0000000081001fff (prio 0, i/o): ethlite.rx[1]io
Reported-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20241114210010.34502-18-philmd@linaro.org>
---
hw/net/xilinx_ethlite.c | 81 +++++++++--------------------------------
1 file changed, 17 insertions(+), 64 deletions(-)
diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c
index 5ab8ae43b2b..758226a65dd 100644
--- a/hw/net/xilinx_ethlite.c
+++ b/hw/net/xilinx_ethlite.c
@@ -2,6 +2,7 @@
* QEMU model of the Xilinx Ethernet Lite MAC.
*
* Copyright (c) 2009 Edgar E. Iglesias.
+ * Copyright (c) 2024 Linaro, Ltd
*
* DS580: https://docs.amd.com/v/u/en-US/xps_ethernetlite
* LogiCORE IP XPS Ethernet Lite Media Access Controller
@@ -30,7 +31,6 @@
#include "qemu/bitops.h"
#include "qom/object.h"
#include "qapi/error.h"
-#include "exec/tswap.h"
#include "hw/sysbus.h"
#include "hw/irq.h"
#include "hw/qdev-properties.h"
@@ -38,18 +38,12 @@
#include "net/net.h"
#include "trace.h"
-#define R_TX_BUF0 0
#define BUFSZ_MAX 0x07e4
#define A_MDIO_BASE 0x07e4
#define A_TX_BASE0 0x07f4
-#define R_TX_BUF1 (0x0800 / 4)
#define A_TX_BASE1 0x0ff4
-
-#define R_RX_BUF0 (0x1000 / 4)
#define A_RX_BASE0 0x17fc
-#define R_RX_BUF1 (0x1800 / 4)
#define A_RX_BASE1 0x1ffc
-#define R_MAX (0x2000 / 4)
enum {
TX_LEN = 0,
@@ -72,6 +66,8 @@ enum {
typedef struct XlnxXpsEthLitePort {
MemoryRegion txio;
MemoryRegion rxio;
+ MemoryRegion txbuf;
+ MemoryRegion rxbuf;
struct {
uint32_t tx_len;
@@ -100,7 +96,6 @@ struct XlnxXpsEthLite
UnimplementedDeviceState mdio;
XlnxXpsEthLitePort port[2];
- uint32_t regs[R_MAX];
};
static inline void eth_pulse_irq(XlnxXpsEthLite *s)
@@ -118,16 +113,12 @@ static unsigned addr_to_port_index(hwaddr addr)
static void *txbuf_ptr(XlnxXpsEthLite *s, unsigned port_index)
{
- unsigned int rxbase = port_index * (0x800 / 4);
-
- return &s->regs[rxbase + R_TX_BUF0];
+ return memory_region_get_ram_ptr(&s->port[port_index].txbuf);
}
static void *rxbuf_ptr(XlnxXpsEthLite *s, unsigned port_index)
{
- unsigned int rxbase = port_index * (0x800 / 4);
-
- return &s->regs[rxbase + R_RX_BUF0];
+ return memory_region_get_ram_ptr(&s->port[port_index].rxbuf);
}
static uint64_t port_tx_read(void *opaque, hwaddr addr, unsigned int size)
@@ -254,53 +245,6 @@ static const MemoryRegionOps eth_portrx_ops = {
},
};
-static uint64_t
-eth_read(void *opaque, hwaddr addr, unsigned int size)
-{
- XlnxXpsEthLite *s = opaque;
- uint32_t r = 0;
-
- addr >>= 2;
-
- switch (addr)
- {
- default:
- r = tswap32(s->regs[addr]);
- break;
- }
- return r;
-}
-
-static void
-eth_write(void *opaque, hwaddr addr,
- uint64_t val64, unsigned int size)
-{
- XlnxXpsEthLite *s = opaque;
- uint32_t value = val64;
-
- addr >>= 2;
- switch (addr)
- {
- default:
- s->regs[addr] = tswap32(value);
- break;
- }
-}
-
-static const MemoryRegionOps eth_ops = {
- .read = eth_read,
- .write = eth_write,
- .endianness = DEVICE_NATIVE_ENDIAN,
- .impl = {
- .min_access_size = 4,
- .max_access_size = 4,
- },
- .valid = {
- .min_access_size = 4,
- .max_access_size = 4
- }
-};
-
static bool eth_can_rx(NetClientState *nc)
{
XlnxXpsEthLite *s = qemu_get_nic_opaque(nc);
@@ -356,6 +300,9 @@ static void xilinx_ethlite_realize(DeviceState *dev, Error **errp)
{
XlnxXpsEthLite *s = XILINX_ETHLITE(dev);
+ memory_region_init(&s->mmio, OBJECT(dev),
+ "xlnx.xps-ethernetlite", 0x2000);
+
object_initialize_child(OBJECT(dev), "ethlite.mdio", &s->mdio,
TYPE_UNIMPLEMENTED_DEVICE);
qdev_prop_set_string(DEVICE(&s->mdio), "name", "ethlite.mdio");
@@ -365,6 +312,10 @@ static void xilinx_ethlite_realize(DeviceState *dev, Error **errp)
sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->mdio), 0));
for (unsigned i = 0; i < 2; i++) {
+ memory_region_init_ram(&s->port[i].txbuf, OBJECT(dev),
+ i ? "ethlite.tx[1]buf" : "ethlite.tx[0]buf",
+ BUFSZ_MAX, &error_abort);
+ memory_region_add_subregion(&s->mmio, 0x0800 * i, &s->port[i].txbuf);
memory_region_init_io(&s->port[i].txio, OBJECT(dev),
ð_porttx_ops, s,
i ? "ethlite.tx[1]io" : "ethlite.tx[0]io",
@@ -372,6 +323,11 @@ static void xilinx_ethlite_realize(DeviceState *dev, Error **errp)
memory_region_add_subregion(&s->mmio, i ? A_TX_BASE1 : A_TX_BASE0,
&s->port[i].txio);
+ memory_region_init_ram(&s->port[i].rxbuf, OBJECT(dev),
+ i ? "ethlite.rx[1]buf" : "ethlite.rx[0]buf",
+ BUFSZ_MAX, &error_abort);
+ memory_region_add_subregion(&s->mmio, 0x1000 + 0x0800 * i,
+ &s->port[i].rxbuf);
memory_region_init_io(&s->port[i].rxio, OBJECT(dev),
ð_portrx_ops, s,
i ? "ethlite.rx[1]io" : "ethlite.rx[0]io",
@@ -392,9 +348,6 @@ static void xilinx_ethlite_init(Object *obj)
XlnxXpsEthLite *s = XILINX_ETHLITE(obj);
sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq);
-
- memory_region_init_io(&s->mmio, obj, ð_ops, s,
- "xlnx.xps-ethernetlite", R_MAX * 4);
sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mmio);
}
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 19/49] hw/net/xilinx_ethlite: Rename 'mmio' MR as 'container'
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (17 preceding siblings ...)
2025-01-12 22:16 ` [PULL 18/49] hw/net/xilinx_ethlite: Map the RAM buffer as RAM memory region Philippe Mathieu-Daudé
@ 2025-01-12 22:16 ` Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 20/49] hw/net/xilinx_ethlite: Map RESERVED I/O as unimplemented Philippe Mathieu-Daudé
` (30 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:16 UTC (permalink / raw)
To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Edgar E. Iglesias
Having all its address range mapped by subregions,
s->mmio MemoryRegion effectively became a container.
Rename it as 'container' for clarity.
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20241112181044.92193-21-philmd@linaro.org>
---
hw/net/xilinx_ethlite.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c
index 758226a65dd..a7f6d1b368c 100644
--- a/hw/net/xilinx_ethlite.c
+++ b/hw/net/xilinx_ethlite.c
@@ -85,7 +85,7 @@ struct XlnxXpsEthLite
{
SysBusDevice parent_obj;
- MemoryRegion mmio;
+ MemoryRegion container;
qemu_irq irq;
NICState *nic;
NICConf conf;
@@ -300,7 +300,7 @@ static void xilinx_ethlite_realize(DeviceState *dev, Error **errp)
{
XlnxXpsEthLite *s = XILINX_ETHLITE(dev);
- memory_region_init(&s->mmio, OBJECT(dev),
+ memory_region_init(&s->container, OBJECT(dev),
"xlnx.xps-ethernetlite", 0x2000);
object_initialize_child(OBJECT(dev), "ethlite.mdio", &s->mdio,
@@ -308,31 +308,31 @@ static void xilinx_ethlite_realize(DeviceState *dev, Error **errp)
qdev_prop_set_string(DEVICE(&s->mdio), "name", "ethlite.mdio");
qdev_prop_set_uint64(DEVICE(&s->mdio), "size", 4 * 4);
sysbus_realize(SYS_BUS_DEVICE(&s->mdio), &error_fatal);
- memory_region_add_subregion(&s->mmio, A_MDIO_BASE,
+ memory_region_add_subregion(&s->container, A_MDIO_BASE,
sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->mdio), 0));
for (unsigned i = 0; i < 2; i++) {
memory_region_init_ram(&s->port[i].txbuf, OBJECT(dev),
i ? "ethlite.tx[1]buf" : "ethlite.tx[0]buf",
BUFSZ_MAX, &error_abort);
- memory_region_add_subregion(&s->mmio, 0x0800 * i, &s->port[i].txbuf);
+ memory_region_add_subregion(&s->container, 0x0800 * i, &s->port[i].txbuf);
memory_region_init_io(&s->port[i].txio, OBJECT(dev),
ð_porttx_ops, s,
i ? "ethlite.tx[1]io" : "ethlite.tx[0]io",
4 * TX_MAX);
- memory_region_add_subregion(&s->mmio, i ? A_TX_BASE1 : A_TX_BASE0,
+ memory_region_add_subregion(&s->container, i ? A_TX_BASE1 : A_TX_BASE0,
&s->port[i].txio);
memory_region_init_ram(&s->port[i].rxbuf, OBJECT(dev),
i ? "ethlite.rx[1]buf" : "ethlite.rx[0]buf",
BUFSZ_MAX, &error_abort);
- memory_region_add_subregion(&s->mmio, 0x1000 + 0x0800 * i,
+ memory_region_add_subregion(&s->container, 0x1000 + 0x0800 * i,
&s->port[i].rxbuf);
memory_region_init_io(&s->port[i].rxio, OBJECT(dev),
ð_portrx_ops, s,
i ? "ethlite.rx[1]io" : "ethlite.rx[0]io",
4 * RX_MAX);
- memory_region_add_subregion(&s->mmio, i ? A_RX_BASE1 : A_RX_BASE0,
+ memory_region_add_subregion(&s->container, i ? A_RX_BASE1 : A_RX_BASE0,
&s->port[i].rxio);
}
@@ -348,7 +348,7 @@ static void xilinx_ethlite_init(Object *obj)
XlnxXpsEthLite *s = XILINX_ETHLITE(obj);
sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq);
- sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mmio);
+ sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->container);
}
static const Property xilinx_ethlite_properties[] = {
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 20/49] hw/net/xilinx_ethlite: Map RESERVED I/O as unimplemented
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (18 preceding siblings ...)
2025-01-12 22:16 ` [PULL 19/49] hw/net/xilinx_ethlite: Rename 'mmio' MR as 'container' Philippe Mathieu-Daudé
@ 2025-01-12 22:16 ` Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 21/49] docs/nitro-enclave: Clarify Enclave and Firecracker relationship Philippe Mathieu-Daudé
` (29 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:16 UTC (permalink / raw)
To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Alex Bennée
In order to track access to reserved I/O space, use yet
another UnimplementedDevice covering the whole device
memory range. Mapped with lower priority (-1).
The memory flat view becomes:
(qemu) info mtree -f
FlatView #0
Root memory region: system
0000000081000000-00000000810007e3 (prio 0, ram): ethlite.tx[0]buf
00000000810007e4-00000000810007f3 (prio 0, i/o): ethlite.mdio
00000000810007f4-00000000810007ff (prio 0, i/o): ethlite.tx[0]io
0000000081000800-0000000081000fe3 (prio 0, ram): ethlite.tx[1]buf
0000000081000fe4-0000000081000ff3 (prio -1, i/o): ethlite.reserved @0000000000000fe4
0000000081000ff4-0000000081000fff (prio 0, i/o): ethlite.tx[1]io
0000000081001000-00000000810017e3 (prio 0, ram): ethlite.rx[0]buf
00000000810017e4-00000000810017fb (prio -1, i/o): ethlite.reserved @00000000000017e4
00000000810017fc-00000000810017ff (prio 0, i/o): ethlite.rx[0]io
0000000081001800-0000000081001fe3 (prio 0, ram): ethlite.rx[1]buf
0000000081001fe4-0000000081001ffb (prio -1, i/o): ethlite.reserved @0000000000001fe4
0000000081001ffc-0000000081001fff (prio 0, i/o): ethlite.rx[1]io
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20241114210010.34502-20-philmd@linaro.org>
---
hw/net/xilinx_ethlite.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c
index a7f6d1b368c..14bf2b2e17a 100644
--- a/hw/net/xilinx_ethlite.c
+++ b/hw/net/xilinx_ethlite.c
@@ -94,6 +94,7 @@ struct XlnxXpsEthLite
uint32_t c_rx_pingpong;
unsigned int port_index; /* dual port RAM index */
+ UnimplementedDeviceState rsvd;
UnimplementedDeviceState mdio;
XlnxXpsEthLitePort port[2];
};
@@ -303,6 +304,16 @@ static void xilinx_ethlite_realize(DeviceState *dev, Error **errp)
memory_region_init(&s->container, OBJECT(dev),
"xlnx.xps-ethernetlite", 0x2000);
+ object_initialize_child(OBJECT(dev), "ethlite.reserved", &s->rsvd,
+ TYPE_UNIMPLEMENTED_DEVICE);
+ qdev_prop_set_string(DEVICE(&s->rsvd), "name", "ethlite.reserved");
+ qdev_prop_set_uint64(DEVICE(&s->rsvd), "size",
+ memory_region_size(&s->container));
+ sysbus_realize(SYS_BUS_DEVICE(&s->rsvd), &error_fatal);
+ memory_region_add_subregion_overlap(&s->container, 0,
+ sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->rsvd), 0),
+ -1);
+
object_initialize_child(OBJECT(dev), "ethlite.mdio", &s->mdio,
TYPE_UNIMPLEMENTED_DEVICE);
qdev_prop_set_string(DEVICE(&s->mdio), "name", "ethlite.mdio");
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 21/49] docs/nitro-enclave: Clarify Enclave and Firecracker relationship
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (19 preceding siblings ...)
2025-01-12 22:16 ` [PULL 20/49] hw/net/xilinx_ethlite: Map RESERVED I/O as unimplemented Philippe Mathieu-Daudé
@ 2025-01-12 22:16 ` Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 22/49] hw/misc/vmcoreinfo: Rename VMCOREINFO_DEVICE -> TYPE_VMCOREINFO Philippe Mathieu-Daudé
` (28 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:16 UTC (permalink / raw)
To: qemu-devel; +Cc: Alexander Graf, Dorjoy Chowdhury, Philippe Mathieu-Daudé
From: Alexander Graf <graf@amazon.com>
The documentation says that Nitro Enclaves are based on Firecracker.
AWS has never made that statement.
This patch nudges the wording to instead say it "looks like a
Firecracker microvm".
Signed-off-by: Alexander Graf <graf@amazon.com>
Reviewed-by: Dorjoy Chowdhury <dorjoychy111@gmail.com>
Message-ID: <20241211222512.95660-1-graf@amazon.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
docs/system/i386/nitro-enclave.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/system/i386/nitro-enclave.rst b/docs/system/i386/nitro-enclave.rst
index 48eda5bd9ec..7317f547dce 100644
--- a/docs/system/i386/nitro-enclave.rst
+++ b/docs/system/i386/nitro-enclave.rst
@@ -13,7 +13,7 @@ the enclave VM gets a dynamic CID. Enclaves use an EIF (`Enclave Image Format`_)
file which contains the necessary kernel, cmdline and ramdisk(s) to boot.
In QEMU, ``nitro-enclave`` is a machine type based on ``microvm`` similar to how
-AWS nitro enclaves are based on `Firecracker`_ microvm. This is useful for
+AWS nitro enclaves look like a `Firecracker`_ microvm. This is useful for
local testing of EIF files using QEMU instead of running real AWS Nitro Enclaves
which can be difficult for debugging due to its roots in security. The vsock
device emulation is done using vhost-user-vsock which means another process that
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 22/49] hw/misc/vmcoreinfo: Rename VMCOREINFO_DEVICE -> TYPE_VMCOREINFO
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (20 preceding siblings ...)
2025-01-12 22:16 ` [PULL 21/49] docs/nitro-enclave: Clarify Enclave and Firecracker relationship Philippe Mathieu-Daudé
@ 2025-01-12 22:16 ` Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 23/49] hw/misc/vmcoreinfo: Convert to three-phase reset interface Philippe Mathieu-Daudé
` (27 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:16 UTC (permalink / raw)
To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Marc-André Lureau
Follow the assumed QOM type definition style, prefixing with
'TYPE_', and dropping the '_DEVICE' suffix which doesn't add
any value.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20250102132624.53443-1-philmd@linaro.org>
---
include/hw/misc/vmcoreinfo.h | 7 +++----
hw/misc/vmcoreinfo.c | 6 +++---
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/include/hw/misc/vmcoreinfo.h b/include/hw/misc/vmcoreinfo.h
index 0b7b55d400a..1aa44771632 100644
--- a/include/hw/misc/vmcoreinfo.h
+++ b/include/hw/misc/vmcoreinfo.h
@@ -16,10 +16,9 @@
#include "standard-headers/linux/qemu_fw_cfg.h"
#include "qom/object.h"
-#define VMCOREINFO_DEVICE "vmcoreinfo"
+#define TYPE_VMCOREINFO "vmcoreinfo"
typedef struct VMCoreInfoState VMCoreInfoState;
-DECLARE_INSTANCE_CHECKER(VMCoreInfoState, VMCOREINFO,
- VMCOREINFO_DEVICE)
+DECLARE_INSTANCE_CHECKER(VMCoreInfoState, VMCOREINFO, TYPE_VMCOREINFO)
typedef struct fw_cfg_vmcoreinfo FWCfgVMCoreInfo;
@@ -33,7 +32,7 @@ struct VMCoreInfoState {
/* returns NULL unless there is exactly one device */
static inline VMCoreInfoState *vmcoreinfo_find(void)
{
- Object *o = object_resolve_path_type("", VMCOREINFO_DEVICE, NULL);
+ Object *o = object_resolve_path_type("", TYPE_VMCOREINFO, NULL);
return o ? VMCOREINFO(o) : NULL;
}
diff --git a/hw/misc/vmcoreinfo.c b/hw/misc/vmcoreinfo.c
index b1fcc22e92b..145f13a65cf 100644
--- a/hw/misc/vmcoreinfo.c
+++ b/hw/misc/vmcoreinfo.c
@@ -47,13 +47,13 @@ static void vmcoreinfo_realize(DeviceState *dev, Error **errp)
*/
if (!vmcoreinfo_find()) {
error_setg(errp, "at most one %s device is permitted",
- VMCOREINFO_DEVICE);
+ TYPE_VMCOREINFO);
return;
}
if (!fw_cfg || !fw_cfg->dma_enabled) {
error_setg(errp, "%s device requires fw_cfg with DMA",
- VMCOREINFO_DEVICE);
+ TYPE_VMCOREINFO);
return;
}
@@ -95,7 +95,7 @@ static void vmcoreinfo_device_class_init(ObjectClass *klass, void *data)
static const TypeInfo vmcoreinfo_types[] = {
{
- .name = VMCOREINFO_DEVICE,
+ .name = TYPE_VMCOREINFO,
.parent = TYPE_DEVICE,
.instance_size = sizeof(VMCoreInfoState),
.class_init = vmcoreinfo_device_class_init,
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 23/49] hw/misc/vmcoreinfo: Convert to three-phase reset interface
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (21 preceding siblings ...)
2025-01-12 22:16 ` [PULL 22/49] hw/misc/vmcoreinfo: Rename VMCOREINFO_DEVICE -> TYPE_VMCOREINFO Philippe Mathieu-Daudé
@ 2025-01-12 22:16 ` Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 24/49] hw/pci: Rename has_power to enabled Philippe Mathieu-Daudé
` (26 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:16 UTC (permalink / raw)
To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Daniel P. Berrangé
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20241219153857.57450-6-philmd@linaro.org>
---
hw/misc/vmcoreinfo.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/hw/misc/vmcoreinfo.c b/hw/misc/vmcoreinfo.c
index 145f13a65cf..b0145fa5044 100644
--- a/hw/misc/vmcoreinfo.c
+++ b/hw/misc/vmcoreinfo.c
@@ -26,9 +26,9 @@ static void fw_cfg_vmci_write(void *opaque, off_t offset, size_t len)
&& s->vmcoreinfo.guest_format != FW_CFG_VMCOREINFO_FORMAT_NONE;
}
-static void vmcoreinfo_reset(void *opaque)
+static void vmcoreinfo_reset_hold(Object *obj, ResetType type)
{
- VMCoreInfoState *s = opaque;
+ VMCoreInfoState *s = VMCOREINFO(obj);
s->has_vmcoreinfo = false;
memset(&s->vmcoreinfo, 0, sizeof(s->vmcoreinfo));
@@ -65,7 +65,7 @@ static void vmcoreinfo_realize(DeviceState *dev, Error **errp)
* This device requires to register a global reset because it is
* not plugged to a bus (which, as its QOM parent, would reset it).
*/
- qemu_register_reset(vmcoreinfo_reset, s);
+ qemu_register_resettable(OBJECT(s));
vmcoreinfo_state = s;
}
@@ -86,11 +86,13 @@ static const VMStateDescription vmstate_vmcoreinfo = {
static void vmcoreinfo_device_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
+ ResettableClass *rc = RESETTABLE_CLASS(klass);
dc->vmsd = &vmstate_vmcoreinfo;
dc->realize = vmcoreinfo_realize;
dc->hotpluggable = false;
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
+ rc->phases.hold = vmcoreinfo_reset_hold;
}
static const TypeInfo vmcoreinfo_types[] = {
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 24/49] hw/pci: Rename has_power to enabled
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (22 preceding siblings ...)
2025-01-12 22:16 ` [PULL 23/49] hw/misc/vmcoreinfo: Convert to three-phase reset interface Philippe Mathieu-Daudé
@ 2025-01-12 22:17 ` Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 25/49] hw/ufs: Adjust value to match CPU's endian format Philippe Mathieu-Daudé
` (25 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:17 UTC (permalink / raw)
To: qemu-devel; +Cc: Akihiko Odaki, Philippe Mathieu-Daudé
From: Akihiko Odaki <akihiko.odaki@daynix.com>
The renamed state will not only represent powering state of PFs, but
also represent SR-IOV VF enablement in the future.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250109-reuse-v19-1-f541e82ca5f7@daynix.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/hw/pci/pci.h | 1 +
include/hw/pci/pci_device.h | 2 +-
hw/pci/pci.c | 17 +++++++++++------
hw/pci/pci_host.c | 4 ++--
4 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index cefeb388bde..4002bbeebde 100644
--- a/include/hw/pci/pci.h
+++ b/include/hw/pci/pci.h
@@ -674,6 +674,7 @@ static inline void pci_irq_deassert(PCIDevice *pci_dev)
}
MSIMessage pci_get_msi_message(PCIDevice *dev, int vector);
+void pci_set_enabled(PCIDevice *pci_dev, bool state);
void pci_set_power(PCIDevice *pci_dev, bool state);
#endif
diff --git a/include/hw/pci/pci_device.h b/include/hw/pci/pci_device.h
index 16ea7f4c19b..add208edfab 100644
--- a/include/hw/pci/pci_device.h
+++ b/include/hw/pci/pci_device.h
@@ -57,7 +57,7 @@ typedef struct PCIReqIDCache PCIReqIDCache;
struct PCIDevice {
DeviceState qdev;
bool partially_hotplugged;
- bool has_power;
+ bool enabled;
/* PCI config space */
uint8_t *config;
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 78907527f2e..2afa423925c 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -1598,7 +1598,7 @@ static void pci_update_mappings(PCIDevice *d)
continue;
new_addr = pci_bar_address(d, i, r->type, r->size);
- if (!d->has_power) {
+ if (!d->enabled) {
new_addr = PCI_BAR_UNMAPPED;
}
@@ -1686,7 +1686,7 @@ void pci_default_write_config(PCIDevice *d, uint32_t addr, uint32_t val_in, int
pci_update_irq_disabled(d, was_irq_disabled);
memory_region_set_enabled(&d->bus_master_enable_region,
(pci_get_word(d->config + PCI_COMMAND)
- & PCI_COMMAND_MASTER) && d->has_power);
+ & PCI_COMMAND_MASTER) && d->enabled);
}
msi_write_config(d, addr, val_in, l);
@@ -2963,16 +2963,21 @@ MSIMessage pci_get_msi_message(PCIDevice *dev, int vector)
void pci_set_power(PCIDevice *d, bool state)
{
- if (d->has_power == state) {
+ pci_set_enabled(d, state);
+}
+
+void pci_set_enabled(PCIDevice *d, bool state)
+{
+ if (d->enabled == state) {
return;
}
- d->has_power = state;
+ d->enabled = state;
pci_update_mappings(d);
memory_region_set_enabled(&d->bus_master_enable_region,
(pci_get_word(d->config + PCI_COMMAND)
- & PCI_COMMAND_MASTER) && d->has_power);
- if (!d->has_power) {
+ & PCI_COMMAND_MASTER) && d->enabled);
+ if (!d->enabled) {
pci_device_reset(d);
}
}
diff --git a/hw/pci/pci_host.c b/hw/pci/pci_host.c
index 4510890dfc1..80f91f409f9 100644
--- a/hw/pci/pci_host.c
+++ b/hw/pci/pci_host.c
@@ -86,7 +86,7 @@ void pci_host_config_write_common(PCIDevice *pci_dev, uint32_t addr,
* allowing direct removal of unexposed functions.
*/
if ((pci_dev->qdev.hotplugged && !pci_get_function_0(pci_dev)) ||
- !pci_dev->has_power || is_pci_dev_ejected(pci_dev)) {
+ !pci_dev->enabled || is_pci_dev_ejected(pci_dev)) {
return;
}
@@ -111,7 +111,7 @@ uint32_t pci_host_config_read_common(PCIDevice *pci_dev, uint32_t addr,
* allowing direct removal of unexposed functions.
*/
if ((pci_dev->qdev.hotplugged && !pci_get_function_0(pci_dev)) ||
- !pci_dev->has_power || is_pci_dev_ejected(pci_dev)) {
+ !pci_dev->enabled || is_pci_dev_ejected(pci_dev)) {
return ~0x0;
}
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 25/49] hw/ufs: Adjust value to match CPU's endian format
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (23 preceding siblings ...)
2025-01-12 22:17 ` [PULL 24/49] hw/pci: Rename has_power to enabled Philippe Mathieu-Daudé
@ 2025-01-12 22:17 ` Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 26/49] hw/sd/sdhci: Set SDHC_NIS_DMA bit when appropriate Philippe Mathieu-Daudé
` (24 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:17 UTC (permalink / raw)
To: qemu-devel; +Cc: Keoseong Park, Philippe Mathieu-Daudé, Jeuk Kim
From: Keoseong Park <keosung.park@samsung.com>
In ufs_write_attr_value(), the value parameter is handled in the CPU's
endian format but provided in big-endian format by the caller. Thus, it
is converted to the CPU's endian format. The related test code is also
fixed to reflect this change.
Fixes: 7c85332a2b3e ("hw/ufs: minor bug fixes related to ufs-test")
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Keoseong Park <keosung.park@samsung.com>
Reviewed-by: Jeuk Kim <jeuk20.kim@samsung.com>
Message-ID: <20250107084356epcms2p2af4d86432174d76ea57336933e46b4c3@epcms2p2>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/ufs/ufs.c | 2 +-
tests/qtest/ufs-test.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/ufs/ufs.c b/hw/ufs/ufs.c
index 8d26d137918..428fe927ad0 100644
--- a/hw/ufs/ufs.c
+++ b/hw/ufs/ufs.c
@@ -1164,7 +1164,7 @@ static QueryRespCode ufs_exec_query_attr(UfsRequest *req, int op)
value = ufs_read_attr_value(u, idn);
ret = UFS_QUERY_RESULT_SUCCESS;
} else {
- value = req->req_upiu.qr.value;
+ value = be32_to_cpu(req->req_upiu.qr.value);
ret = ufs_write_attr_value(u, idn, value);
}
req->rsp_upiu.qr.value = cpu_to_be32(value);
diff --git a/tests/qtest/ufs-test.c b/tests/qtest/ufs-test.c
index 60199abbee7..1f860b41c06 100644
--- a/tests/qtest/ufs-test.c
+++ b/tests/qtest/ufs-test.c
@@ -145,7 +145,7 @@ static void ufs_send_query(QUfs *ufs, uint8_t slot, uint8_t query_function,
req_upiu.qr.idn = idn;
req_upiu.qr.index = index;
req_upiu.qr.selector = selector;
- req_upiu.qr.value = attr_value;
+ req_upiu.qr.value = cpu_to_be32(attr_value);
req_upiu.qr.length = UFS_QUERY_DESC_MAX_SIZE;
qtest_memwrite(ufs->dev.bus->qts, req_upiu_addr, &req_upiu,
sizeof(req_upiu));
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 26/49] hw/sd/sdhci: Set SDHC_NIS_DMA bit when appropriate
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (24 preceding siblings ...)
2025-01-12 22:17 ` [PULL 25/49] hw/ufs: Adjust value to match CPU's endian format Philippe Mathieu-Daudé
@ 2025-01-12 22:17 ` Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 27/49] hw/sd/sdhci: Factor sdhci_sdma_transfer() out Philippe Mathieu-Daudé
` (23 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:17 UTC (permalink / raw)
To: qemu-devel; +Cc: Bernhard Beschow, Philippe Mathieu-Daudé
From: Bernhard Beschow <shentey@gmail.com>
In U-Boot, the fsl_esdhc[_imx] driver waits for both "transmit completed" and
"DMA" bits in esdhc_send_cmd_common() by means of DATA_COMPLETE constant. QEMU
currently misses to set the DMA bit which causes the driver to loop forever. Fix
that by setting the DMA bit if enabled when doing DMA block transfers.
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250108092538.11474-2-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/sd/sdhci.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
index 299cd4bc1b6..a958c114974 100644
--- a/hw/sd/sdhci.c
+++ b/hw/sd/sdhci.c
@@ -665,12 +665,13 @@ static void sdhci_sdma_transfer_multi_blocks(SDHCIState *s)
}
}
+ if (s->norintstsen & SDHC_NISEN_DMA) {
+ s->norintsts |= SDHC_NIS_DMA;
+ }
+
if (s->blkcnt == 0) {
sdhci_end_transfer(s);
} else {
- if (s->norintstsen & SDHC_NISEN_DMA) {
- s->norintsts |= SDHC_NIS_DMA;
- }
sdhci_update_irq(s);
}
}
@@ -691,6 +692,10 @@ static void sdhci_sdma_transfer_single_block(SDHCIState *s)
}
s->blkcnt--;
+ if (s->norintstsen & SDHC_NISEN_DMA) {
+ s->norintsts |= SDHC_NIS_DMA;
+ }
+
sdhci_end_transfer(s);
}
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 27/49] hw/sd/sdhci: Factor sdhci_sdma_transfer() out
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (25 preceding siblings ...)
2025-01-12 22:17 ` [PULL 26/49] hw/sd/sdhci: Set SDHC_NIS_DMA bit when appropriate Philippe Mathieu-Daudé
@ 2025-01-12 22:17 ` Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 28/49] hw/char/stm32f2xx_usart: replace print with trace Philippe Mathieu-Daudé
` (22 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:17 UTC (permalink / raw)
To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Bernhard Beschow
Factor sdhci_sdma_transfer() out of sdhci_data_transfer().
Re-use it in sdhci_write(), so we don't try to run multi
block transfer for a single block.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Bernhard Beschow <shentey@gmail.com>
Message-Id: <20250109122029.22780-1-philmd@linaro.org>
---
hw/sd/sdhci.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
index a958c114974..318587ff57c 100644
--- a/hw/sd/sdhci.c
+++ b/hw/sd/sdhci.c
@@ -699,6 +699,15 @@ static void sdhci_sdma_transfer_single_block(SDHCIState *s)
sdhci_end_transfer(s);
}
+static void sdhci_sdma_transfer(SDHCIState *s)
+{
+ if ((s->blkcnt == 1) || !(s->trnmod & SDHC_TRNS_MULTI)) {
+ sdhci_sdma_transfer_single_block(s);
+ } else {
+ sdhci_sdma_transfer_multi_blocks(s);
+ }
+}
+
typedef struct ADMADescr {
hwaddr addr;
uint16_t length;
@@ -930,12 +939,7 @@ static void sdhci_data_transfer(void *opaque)
if (s->trnmod & SDHC_TRNS_DMA) {
switch (SDHC_DMA_TYPE(s->hostctl1)) {
case SDHC_CTRL_SDMA:
- if ((s->blkcnt == 1) || !(s->trnmod & SDHC_TRNS_MULTI)) {
- sdhci_sdma_transfer_single_block(s);
- } else {
- sdhci_sdma_transfer_multi_blocks(s);
- }
-
+ sdhci_sdma_transfer(s);
break;
case SDHC_CTRL_ADMA1_32:
if (!(s->capareg & R_SDHC_CAPAB_ADMA1_MASK)) {
@@ -1179,11 +1183,7 @@ sdhci_write(void *opaque, hwaddr offset, uint64_t val, unsigned size)
if (!(mask & 0xFF000000) && s->blkcnt &&
(s->blksize & BLOCK_SIZE_MASK) &&
SDHC_DMA_TYPE(s->hostctl1) == SDHC_CTRL_SDMA) {
- if (s->trnmod & SDHC_TRNS_MULTI) {
- sdhci_sdma_transfer_multi_blocks(s);
- } else {
- sdhci_sdma_transfer_single_block(s);
- }
+ sdhci_sdma_transfer(s);
}
}
break;
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 28/49] hw/char/stm32f2xx_usart: replace print with trace
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (26 preceding siblings ...)
2025-01-12 22:17 ` [PULL 27/49] hw/sd/sdhci: Factor sdhci_sdma_transfer() out Philippe Mathieu-Daudé
@ 2025-01-12 22:17 ` Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 29/49] hw/timer/imx_gpt: Remove unused define Philippe Mathieu-Daudé
` (21 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:17 UTC (permalink / raw)
To: qemu-devel
Cc: Nikita Shubin, Nikita Shubin, Alistair Francis,
Philippe Mathieu-Daudé
From: Nikita Shubin <nshubin@yadro.com>
Drop debug printing macros and replace them with according trace
functions.
Signed-off-by: Nikita Shubin <n.shubin@yadro.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20241220111756.16511-1-nikita.shubin@maquefel.me>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/char/stm32f2xx_usart.c | 49 ++++++++++++++++++---------------------
hw/char/trace-events | 6 +++++
2 files changed, 29 insertions(+), 26 deletions(-)
diff --git a/hw/char/stm32f2xx_usart.c b/hw/char/stm32f2xx_usart.c
index ebcc510f4ea..87882daa715 100644
--- a/hw/char/stm32f2xx_usart.c
+++ b/hw/char/stm32f2xx_usart.c
@@ -30,17 +30,7 @@
#include "qemu/log.h"
#include "qemu/module.h"
-#ifndef STM_USART_ERR_DEBUG
-#define STM_USART_ERR_DEBUG 0
-#endif
-
-#define DB_PRINT_L(lvl, fmt, args...) do { \
- if (STM_USART_ERR_DEBUG >= lvl) { \
- qemu_log("%s: " fmt, __func__, ## args); \
- } \
-} while (0)
-
-#define DB_PRINT(fmt, args...) DB_PRINT_L(1, fmt, ## args)
+#include "trace.h"
static int stm32f2xx_usart_can_receive(void *opaque)
{
@@ -67,10 +57,11 @@ static void stm32f2xx_update_irq(STM32F2XXUsartState *s)
static void stm32f2xx_usart_receive(void *opaque, const uint8_t *buf, int size)
{
STM32F2XXUsartState *s = opaque;
+ DeviceState *d = DEVICE(s);
if (!(s->usart_cr1 & USART_CR1_UE && s->usart_cr1 & USART_CR1_RE)) {
/* USART not enabled - drop the chars */
- DB_PRINT("Dropping the chars\n");
+ trace_stm32f2xx_usart_drop(d->id);
return;
}
@@ -79,7 +70,7 @@ static void stm32f2xx_usart_receive(void *opaque, const uint8_t *buf, int size)
stm32f2xx_update_irq(s);
- DB_PRINT("Receiving: %c\n", s->usart_dr);
+ trace_stm32f2xx_usart_receive(d->id, *buf);
}
static void stm32f2xx_usart_reset(DeviceState *dev)
@@ -101,49 +92,55 @@ static uint64_t stm32f2xx_usart_read(void *opaque, hwaddr addr,
unsigned int size)
{
STM32F2XXUsartState *s = opaque;
- uint64_t retvalue;
-
- DB_PRINT("Read 0x%"HWADDR_PRIx"\n", addr);
+ DeviceState *d = DEVICE(s);
+ uint64_t retvalue = 0;
switch (addr) {
case USART_SR:
retvalue = s->usart_sr;
qemu_chr_fe_accept_input(&s->chr);
- return retvalue;
+ break;
case USART_DR:
- DB_PRINT("Value: 0x%" PRIx32 ", %c\n", s->usart_dr, (char) s->usart_dr);
retvalue = s->usart_dr & 0x3FF;
s->usart_sr &= ~USART_SR_RXNE;
qemu_chr_fe_accept_input(&s->chr);
stm32f2xx_update_irq(s);
- return retvalue;
+ break;
case USART_BRR:
- return s->usart_brr;
+ retvalue = s->usart_brr;
+ break;
case USART_CR1:
- return s->usart_cr1;
+ retvalue = s->usart_cr1;
+ break;
case USART_CR2:
- return s->usart_cr2;
+ retvalue = s->usart_cr2;
+ break;
case USART_CR3:
- return s->usart_cr3;
+ retvalue = s->usart_cr3;
+ break;
case USART_GTPR:
- return s->usart_gtpr;
+ retvalue = s->usart_gtpr;
+ break;
default:
qemu_log_mask(LOG_GUEST_ERROR,
"%s: Bad offset 0x%"HWADDR_PRIx"\n", __func__, addr);
return 0;
}
- return 0;
+ trace_stm32f2xx_usart_read(d->id, size, addr, retvalue);
+
+ return retvalue;
}
static void stm32f2xx_usart_write(void *opaque, hwaddr addr,
uint64_t val64, unsigned int size)
{
STM32F2XXUsartState *s = opaque;
+ DeviceState *d = DEVICE(s);
uint32_t value = val64;
unsigned char ch;
- DB_PRINT("Write 0x%" PRIx32 ", 0x%"HWADDR_PRIx"\n", value, addr);
+ trace_stm32f2xx_usart_write(d->id, size, addr, val64);
switch (addr) {
case USART_SR:
diff --git a/hw/char/trace-events b/hw/char/trace-events
index 59e1f734a7d..140b994fd4d 100644
--- a/hw/char/trace-events
+++ b/hw/char/trace-events
@@ -125,3 +125,9 @@ xen_console_unrealize(unsigned int idx) "idx %u"
xen_console_realize(unsigned int idx, const char *chrdev) "idx %u chrdev %s"
xen_console_device_create(unsigned int idx) "idx %u"
xen_console_device_destroy(unsigned int idx) "idx %u"
+
+# stm32f2xx_usart.c
+stm32f2xx_usart_read(char *id, unsigned size, uint64_t ofs, uint64_t val) " %s size %d ofs 0x%02" PRIx64 " -> 0x%02" PRIx64
+stm32f2xx_usart_write(char *id, unsigned size, uint64_t ofs, uint64_t val) "%s size %d ofs 0x%02" PRIx64 " <- 0x%02" PRIx64
+stm32f2xx_usart_drop(char *id) " %s dropping the chars"
+stm32f2xx_usart_receive(char *id, uint8_t chr) " %s receiving '%c'"
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 29/49] hw/timer/imx_gpt: Remove unused define
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (27 preceding siblings ...)
2025-01-12 22:17 ` [PULL 28/49] hw/char/stm32f2xx_usart: replace print with trace Philippe Mathieu-Daudé
@ 2025-01-12 22:17 ` Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 30/49] tests/qtest/libqos: Reuse TYPE_IMX_I2C define Philippe Mathieu-Daudé
` (20 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:17 UTC (permalink / raw)
To: qemu-devel; +Cc: Bernhard Beschow, Philippe Mathieu-Daudé
From: Bernhard Beschow <shentey@gmail.com>
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250108092538.11474-11-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/timer/imx_gpt.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/hw/timer/imx_gpt.c b/hw/timer/imx_gpt.c
index 2663a9d9ef4..11eca9fa4df 100644
--- a/hw/timer/imx_gpt.c
+++ b/hw/timer/imx_gpt.c
@@ -20,10 +20,6 @@
#include "qemu/log.h"
#include "trace.h"
-#ifndef DEBUG_IMX_GPT
-#define DEBUG_IMX_GPT 0
-#endif
-
static const char *imx_gpt_reg_name(uint32_t reg)
{
switch (reg) {
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 30/49] tests/qtest/libqos: Reuse TYPE_IMX_I2C define
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (28 preceding siblings ...)
2025-01-12 22:17 ` [PULL 29/49] hw/timer/imx_gpt: Remove unused define Philippe Mathieu-Daudé
@ 2025-01-12 22:17 ` Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 31/49] hw/misc/imx6_src: Convert DPRINTF() to trace events Philippe Mathieu-Daudé
` (19 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:17 UTC (permalink / raw)
To: qemu-devel; +Cc: Bernhard Beschow, Philippe Mathieu-Daudé, Fabiano Rosas
From: Bernhard Beschow <shentey@gmail.com>
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Message-ID: <20250108092538.11474-12-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
tests/qtest/libqos/arm-imx25-pdk-machine.c | 5 +++--
tests/qtest/libqos/i2c-imx.c | 4 ++--
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/tests/qtest/libqos/arm-imx25-pdk-machine.c b/tests/qtest/libqos/arm-imx25-pdk-machine.c
index 8fe128fae86..2d8b7543439 100644
--- a/tests/qtest/libqos/arm-imx25-pdk-machine.c
+++ b/tests/qtest/libqos/arm-imx25-pdk-machine.c
@@ -23,6 +23,7 @@
#include "libqos-malloc.h"
#include "qgraph.h"
#include "i2c.h"
+#include "hw/i2c/imx_i2c.h"
#define ARM_PAGE_SIZE 4096
#define IMX25_PDK_RAM_START 0x80000000
@@ -50,7 +51,7 @@ static void *imx25_pdk_get_driver(void *object, const char *interface)
static QOSGraphObject *imx25_pdk_get_device(void *obj, const char *device)
{
QIMX25PDKMachine *machine = obj;
- if (!g_strcmp0(device, "imx.i2c")) {
+ if (!g_strcmp0(device, TYPE_IMX_I2C)) {
return &machine->i2c_1.obj;
}
@@ -86,7 +87,7 @@ static void imx25_pdk_register_nodes(void)
.extra_device_opts = "bus=i2c-bus.0"
};
qos_node_create_machine("arm/imx25-pdk", qos_create_machine_arm_imx25_pdk);
- qos_node_contains("arm/imx25-pdk", "imx.i2c", &edge, NULL);
+ qos_node_contains("arm/imx25-pdk", TYPE_IMX_I2C, &edge, NULL);
}
libqos_init(imx25_pdk_register_nodes);
diff --git a/tests/qtest/libqos/i2c-imx.c b/tests/qtest/libqos/i2c-imx.c
index 710cb926d62..6d868e4cc4d 100644
--- a/tests/qtest/libqos/i2c-imx.c
+++ b/tests/qtest/libqos/i2c-imx.c
@@ -209,8 +209,8 @@ void imx_i2c_init(IMXI2C *s, QTestState *qts, uint64_t addr)
static void imx_i2c_register_nodes(void)
{
- qos_node_create_driver("imx.i2c", NULL);
- qos_node_produces("imx.i2c", "i2c-bus");
+ qos_node_create_driver(TYPE_IMX_I2C, NULL);
+ qos_node_produces(TYPE_IMX_I2C, "i2c-bus");
}
libqos_init(imx_i2c_register_nodes);
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 31/49] hw/misc/imx6_src: Convert DPRINTF() to trace events
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (29 preceding siblings ...)
2025-01-12 22:17 ` [PULL 30/49] tests/qtest/libqos: Reuse TYPE_IMX_I2C define Philippe Mathieu-Daudé
@ 2025-01-12 22:17 ` Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 32/49] hw/char/imx_serial: Turn some DPRINTF() statements into " Philippe Mathieu-Daudé
` (18 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:17 UTC (permalink / raw)
To: qemu-devel; +Cc: Bernhard Beschow, Philippe Mathieu-Daudé
From: Bernhard Beschow <shentey@gmail.com>
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250108092538.11474-14-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/misc/imx6_src.c | 23 +++++------------------
hw/misc/trace-events | 6 ++++++
2 files changed, 11 insertions(+), 18 deletions(-)
diff --git a/hw/misc/imx6_src.c b/hw/misc/imx6_src.c
index dc6a2b92ba4..06cc46292ed 100644
--- a/hw/misc/imx6_src.c
+++ b/hw/misc/imx6_src.c
@@ -17,18 +17,7 @@
#include "qemu/module.h"
#include "target/arm/arm-powerctl.h"
#include "hw/core/cpu.h"
-
-#ifndef DEBUG_IMX6_SRC
-#define DEBUG_IMX6_SRC 0
-#endif
-
-#define DPRINTF(fmt, args...) \
- do { \
- if (DEBUG_IMX6_SRC) { \
- fprintf(stderr, "[%s]%s: " fmt , TYPE_IMX6_SRC, \
- __func__, ##args); \
- } \
- } while (0)
+#include "trace.h"
static const char *imx6_src_reg_name(uint32_t reg)
{
@@ -87,7 +76,7 @@ static void imx6_src_reset(DeviceState *dev)
{
IMX6SRCState *s = IMX6_SRC(dev);
- DPRINTF("\n");
+ trace_imx6_src_reset();
memset(s->regs, 0, sizeof(s->regs));
@@ -111,7 +100,7 @@ static uint64_t imx6_src_read(void *opaque, hwaddr offset, unsigned size)
}
- DPRINTF("reg[%s] => 0x%" PRIx32 "\n", imx6_src_reg_name(index), value);
+ trace_imx6_src_read(imx6_src_reg_name(index), value);
return value;
}
@@ -134,8 +123,7 @@ static void imx6_clear_reset_bit(CPUState *cpu, run_on_cpu_data data)
assert(bql_locked());
s->regs[SRC_SCR] = deposit32(s->regs[SRC_SCR], ri->reset_bit, 1, 0);
- DPRINTF("reg[%s] <= 0x%" PRIx32 "\n",
- imx6_src_reg_name(SRC_SCR), s->regs[SRC_SCR]);
+ trace_imx6_clear_reset_bit(imx6_src_reg_name(SRC_SCR), s->regs[SRC_SCR]);
g_free(ri);
}
@@ -173,8 +161,7 @@ static void imx6_src_write(void *opaque, hwaddr offset, uint64_t value,
return;
}
- DPRINTF("reg[%s] <= 0x%" PRIx32 "\n", imx6_src_reg_name(index),
- (uint32_t)current_value);
+ trace_imx6_src_write(imx6_src_reg_name(index), value);
change_mask = s->regs[index] ^ (uint32_t)current_value;
diff --git a/hw/misc/trace-events b/hw/misc/trace-events
index 0f5d2b56660..cf1abe69285 100644
--- a/hw/misc/trace-events
+++ b/hw/misc/trace-events
@@ -253,6 +253,12 @@ ccm_clock_freq(uint32_t clock, uint32_t freq) "(Clock = %d) = %d"
ccm_read_reg(const char *reg_name, uint32_t value) "reg[%s] <= 0x%" PRIx32
ccm_write_reg(const char *reg_name, uint32_t value) "reg[%s] => 0x%" PRIx32
+# imx6_src.c
+imx6_src_read(const char *reg_name, uint32_t value) "reg[%s] => 0x%" PRIx32
+imx6_src_write(const char *reg_name, uint64_t value) "reg[%s] <= 0x%" PRIx64
+imx6_clear_reset_bit(const char *reg_name, uint32_t value) "reg[%s] <= 0x%" PRIx32
+imx6_src_reset(void) ""
+
# imx7_src.c
imx7_src_read(const char *reg_name, uint32_t value) "reg[%s] => 0x%" PRIx32
imx7_src_write(const char *reg_name, uint32_t value) "reg[%s] <= 0x%" PRIx32
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 32/49] hw/char/imx_serial: Turn some DPRINTF() statements into trace events
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (30 preceding siblings ...)
2025-01-12 22:17 ` [PULL 31/49] hw/misc/imx6_src: Convert DPRINTF() to trace events Philippe Mathieu-Daudé
@ 2025-01-12 22:17 ` Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 33/49] hw/i2c/imx_i2c: Convert DPRINTF() to " Philippe Mathieu-Daudé
` (17 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:17 UTC (permalink / raw)
To: qemu-devel; +Cc: Bernhard Beschow, Philippe Mathieu-Daudé
From: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Message-ID: <20250111183711.2338-9-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/char/imx_serial.c | 58 +++++++++++++++++++++++++++++---------------
hw/char/trace-events | 5 ++++
2 files changed, 44 insertions(+), 19 deletions(-)
diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c
index 12705a1337f..7c353fde509 100644
--- a/hw/char/imx_serial.c
+++ b/hw/char/imx_serial.c
@@ -27,6 +27,7 @@
#include "qemu/log.h"
#include "qemu/module.h"
#include "qemu/fifo32.h"
+#include "trace.h"
#ifndef DEBUG_IMX_UART
#define DEBUG_IMX_UART 0
@@ -184,10 +185,10 @@ static uint64_t imx_serial_read(void *opaque, hwaddr offset,
unsigned size)
{
IMXSerialState *s = (IMXSerialState *)opaque;
+ Chardev *chr = qemu_chr_fe_get_driver(&s->chr);
uint32_t c, rx_used;
uint8_t rxtl = s->ufcr & TL_MASK;
-
- DPRINTF("read(offset=0x%" HWADDR_PRIx ")\n", offset);
+ uint64_t value;
switch (offset >> 2) {
case 0x0: /* URXD */
@@ -208,49 +209,67 @@ static uint64_t imx_serial_read(void *opaque, hwaddr offset,
imx_serial_rx_fifo_ageing_timer_restart(s);
qemu_chr_fe_accept_input(&s->chr);
}
- return c;
+ value = c;
+ break;
case 0x20: /* UCR1 */
- return s->ucr1;
+ value = s->ucr1;
+ break;
case 0x21: /* UCR2 */
- return s->ucr2;
+ value = s->ucr2;
+ break;
case 0x25: /* USR1 */
- return s->usr1;
+ value = s->usr1;
+ break;
case 0x26: /* USR2 */
- return s->usr2;
+ value = s->usr2;
+ break;
case 0x2A: /* BRM Modulator */
- return s->ubmr;
+ value = s->ubmr;
+ break;
case 0x2B: /* Baud Rate Count */
- return s->ubrc;
+ value = s->ubrc;
+ break;
case 0x2d: /* Test register */
- return s->uts1;
+ value = s->uts1;
+ break;
case 0x24: /* UFCR */
- return s->ufcr;
+ value = s->ufcr;
+ break;
case 0x2c:
- return s->onems;
+ value = s->onems;
+ break;
case 0x22: /* UCR3 */
- return s->ucr3;
+ value = s->ucr3;
+ break;
case 0x23: /* UCR4 */
- return s->ucr4;
+ value = s->ucr4;
+ break;
case 0x29: /* BRM Incremental */
- return 0x0; /* TODO */
+ value = 0x0; /* TODO */
+ break;
default:
qemu_log_mask(LOG_GUEST_ERROR, "[%s]%s: Bad register at offset 0x%"
HWADDR_PRIx "\n", TYPE_IMX_SERIAL, __func__, offset);
- return 0;
+ value = 0;
+ break;
}
+
+ trace_imx_serial_read(chr ? chr->label : "NODEV", offset, value);
+
+ return value;
}
static void imx_serial_write(void *opaque, hwaddr offset,
@@ -260,8 +279,7 @@ static void imx_serial_write(void *opaque, hwaddr offset,
Chardev *chr = qemu_chr_fe_get_driver(&s->chr);
unsigned char ch;
- DPRINTF("write(offset=0x%" HWADDR_PRIx ", value = 0x%x) to %s\n",
- offset, (unsigned int)value, chr ? chr->label : "NODEV");
+ trace_imx_serial_write(chr ? chr->label : "NODEV", offset, value);
switch (offset >> 2) {
case 0x10: /* UTXD */
@@ -373,9 +391,11 @@ static int imx_can_receive(void *opaque)
static void imx_put_data(void *opaque, uint32_t value)
{
IMXSerialState *s = (IMXSerialState *)opaque;
+ Chardev *chr = qemu_chr_fe_get_driver(&s->chr);
uint8_t rxtl = s->ufcr & TL_MASK;
- DPRINTF("received char\n");
+ trace_imx_serial_put_data(chr ? chr->label : "NODEV", value);
+
imx_serial_rx_fifo_push(s, value);
if (fifo32_num_used(&s->rx_fifo) >= rxtl) {
s->usr1 |= USR1_RRDY;
diff --git a/hw/char/trace-events b/hw/char/trace-events
index 140b994fd4d..3ee7cfcdff2 100644
--- a/hw/char/trace-events
+++ b/hw/char/trace-events
@@ -52,6 +52,11 @@ escc_sunkbd_event_out(int ch) "Translated keycode 0x%2.2x"
escc_kbd_command(int val) "Command %d"
escc_sunmouse_event(int dx, int dy, int buttons_state) "dx=%d dy=%d buttons=0x%01x"
+# imx_serial.c
+imx_serial_read(const char *chrname, uint64_t addr, uint64_t value) "%s:[0x%03" PRIu64 "] -> 0x%08" PRIx64
+imx_serial_write(const char *chrname, uint64_t addr, uint64_t value) "%s:[0x%03" PRIu64 "] <- 0x%08" PRIx64
+imx_serial_put_data(const char *chrname, uint32_t value) "%s: 0x%" PRIx32
+
# pl011.c
pl011_irq_state(int level) "irq state %d"
pl011_read(uint32_t addr, uint32_t value, const char *regname) "addr 0x%03x value 0x%08x reg %s"
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 33/49] hw/i2c/imx_i2c: Convert DPRINTF() to trace events
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (31 preceding siblings ...)
2025-01-12 22:17 ` [PULL 32/49] hw/char/imx_serial: Turn some DPRINTF() statements into " Philippe Mathieu-Daudé
@ 2025-01-12 22:17 ` Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 34/49] hw/gpio/imx_gpio: Turn DPRINTF() into " Philippe Mathieu-Daudé
` (16 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:17 UTC (permalink / raw)
To: qemu-devel; +Cc: Bernhard Beschow, Philippe Mathieu-Daudé
From: Bernhard Beschow <shentey@gmail.com>
Also print the QOM canonical path when tracing which allows for distinguishing
the many instances a typical i.MX SoC has.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Message-ID: <20250111183711.2338-12-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/i2c/imx_i2c.c | 21 +++++----------------
hw/i2c/trace-events | 5 +++++
2 files changed, 10 insertions(+), 16 deletions(-)
diff --git a/hw/i2c/imx_i2c.c b/hw/i2c/imx_i2c.c
index c565fd5b8ab..d62213b9e0f 100644
--- a/hw/i2c/imx_i2c.c
+++ b/hw/i2c/imx_i2c.c
@@ -25,18 +25,7 @@
#include "hw/i2c/i2c.h"
#include "qemu/log.h"
#include "qemu/module.h"
-
-#ifndef DEBUG_IMX_I2C
-#define DEBUG_IMX_I2C 0
-#endif
-
-#define DPRINTF(fmt, args...) \
- do { \
- if (DEBUG_IMX_I2C) { \
- fprintf(stderr, "[%s]%s: " fmt , TYPE_IMX_I2C, \
- __func__, ##args); \
- } \
- } while (0)
+#include "trace.h"
static const char *imx_i2c_get_regname(unsigned offset)
{
@@ -152,8 +141,8 @@ static uint64_t imx_i2c_read(void *opaque, hwaddr offset,
break;
}
- DPRINTF("read %s [0x%" HWADDR_PRIx "] -> 0x%02x\n",
- imx_i2c_get_regname(offset), offset, value);
+ trace_imx_i2c_read(DEVICE(s)->canonical_path, imx_i2c_get_regname(offset),
+ offset, value);
return (uint64_t)value;
}
@@ -163,8 +152,8 @@ static void imx_i2c_write(void *opaque, hwaddr offset,
{
IMXI2CState *s = IMX_I2C(opaque);
- DPRINTF("write %s [0x%" HWADDR_PRIx "] <- 0x%02x\n",
- imx_i2c_get_regname(offset), offset, (int)value);
+ trace_imx_i2c_read(DEVICE(s)->canonical_path, imx_i2c_get_regname(offset),
+ offset, value);
value &= 0xff;
diff --git a/hw/i2c/trace-events b/hw/i2c/trace-events
index f708a7ace18..1ad0e95c0e6 100644
--- a/hw/i2c/trace-events
+++ b/hw/i2c/trace-events
@@ -56,3 +56,8 @@ npcm7xx_smbus_recv_fifo(const char *id, uint8_t received, uint8_t expected) "%s
pca954x_write_bytes(uint8_t value) "PCA954X write data: 0x%02x"
pca954x_read_data(uint8_t value) "PCA954X read data: 0x%02x"
+
+# imx_i2c.c
+
+imx_i2c_read(const char *id, const char *reg, uint64_t ofs, uint64_t value) "%s:[%s (0x%" PRIx64 ")] -> 0x%02" PRIx64
+imx_i2c_write(const char *id, const char *reg, uint64_t ofs, uint64_t value) "%s:[%s (0x%" PRIx64 ")] <- 0x%02" PRIx64
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 34/49] hw/gpio/imx_gpio: Turn DPRINTF() into trace events
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (32 preceding siblings ...)
2025-01-12 22:17 ` [PULL 33/49] hw/i2c/imx_i2c: Convert DPRINTF() to " Philippe Mathieu-Daudé
@ 2025-01-12 22:17 ` Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 35/49] tests/qtest/boot-serial-test: Correct HPPA machine name Philippe Mathieu-Daudé
` (15 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:17 UTC (permalink / raw)
To: qemu-devel; +Cc: Bernhard Beschow, Philippe Mathieu-Daudé
From: Bernhard Beschow <shentey@gmail.com>
While at it add a trace event for input GPIO events.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Message-ID: <20250111183711.2338-14-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/gpio/imx_gpio.c | 18 +++++++-----------
hw/gpio/trace-events | 5 +++++
2 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/hw/gpio/imx_gpio.c b/hw/gpio/imx_gpio.c
index 898f80f8c83..549a281ed79 100644
--- a/hw/gpio/imx_gpio.c
+++ b/hw/gpio/imx_gpio.c
@@ -24,6 +24,7 @@
#include "migration/vmstate.h"
#include "qemu/log.h"
#include "qemu/module.h"
+#include "trace.h"
#ifndef DEBUG_IMX_GPIO
#define DEBUG_IMX_GPIO 0
@@ -34,14 +35,6 @@ typedef enum IMXGPIOLevel {
IMX_GPIO_LEVEL_HIGH = 1,
} IMXGPIOLevel;
-#define DPRINTF(fmt, args...) \
- do { \
- if (DEBUG_IMX_GPIO) { \
- fprintf(stderr, "[%s]%s: " fmt , TYPE_IMX_GPIO, \
- __func__, ##args); \
- } \
- } while (0)
-
static const char *imx_gpio_reg_name(uint32_t reg)
{
switch (reg) {
@@ -111,6 +104,8 @@ static void imx_gpio_set(void *opaque, int line, int level)
IMXGPIOState *s = IMX_GPIO(opaque);
IMXGPIOLevel imx_level = level ? IMX_GPIO_LEVEL_HIGH : IMX_GPIO_LEVEL_LOW;
+ trace_imx_gpio_set(DEVICE(s)->canonical_path, line, imx_level);
+
imx_gpio_set_int_line(s, line, imx_level);
/* this is an input signal, so set PSR */
@@ -200,7 +195,8 @@ static uint64_t imx_gpio_read(void *opaque, hwaddr offset, unsigned size)
break;
}
- DPRINTF("(%s) = 0x%" PRIx32 "\n", imx_gpio_reg_name(offset), reg_value);
+ trace_imx_gpio_read(DEVICE(s)->canonical_path, imx_gpio_reg_name(offset),
+ reg_value);
return reg_value;
}
@@ -210,8 +206,8 @@ static void imx_gpio_write(void *opaque, hwaddr offset, uint64_t value,
{
IMXGPIOState *s = IMX_GPIO(opaque);
- DPRINTF("(%s, value = 0x%" PRIx32 ")\n", imx_gpio_reg_name(offset),
- (uint32_t)value);
+ trace_imx_gpio_write(DEVICE(s)->canonical_path, imx_gpio_reg_name(offset),
+ value);
switch (offset) {
case DR_ADDR:
diff --git a/hw/gpio/trace-events b/hw/gpio/trace-events
index b91cc7e9a45..cea896b28f6 100644
--- a/hw/gpio/trace-events
+++ b/hw/gpio/trace-events
@@ -1,5 +1,10 @@
# See docs/devel/tracing.rst for syntax documentation.
+# imx_gpio.c
+imx_gpio_read(const char *id, const char *reg, uint32_t value) "%s:[%s] -> 0x%" PRIx32
+imx_gpio_write(const char *id, const char *reg, uint32_t value) "%s:[%s] <- 0x%" PRIx32
+imx_gpio_set(const char *id, int line, int level) "%s:[%d] <- %d"
+
# npcm7xx_gpio.c
npcm7xx_gpio_read(const char *id, uint64_t offset, uint64_t value) " %s offset: 0x%04" PRIx64 " value 0x%08" PRIx64
npcm7xx_gpio_write(const char *id, uint64_t offset, uint64_t value) "%s offset: 0x%04" PRIx64 " value 0x%08" PRIx64
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 35/49] tests/qtest/boot-serial-test: Correct HPPA machine name
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (33 preceding siblings ...)
2025-01-12 22:17 ` [PULL 34/49] hw/gpio/imx_gpio: Turn DPRINTF() into " Philippe Mathieu-Daudé
@ 2025-01-12 22:17 ` Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 36/49] tests: Add functional tests for HPPA machines Philippe Mathieu-Daudé
` (14 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:17 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé, qemu-stable, Thomas Huth,
Richard Henderson
Commit 7df6f751176 ("hw/hppa: Split out machine creation")
renamed the 'hppa' machine as 'B160L', but forgot to update
the boot serial test, which ended being skipped.
Cc: qemu-stable@nongnu.org
Fixes: 7df6f751176 ("hw/hppa: Split out machine creation")
Reported-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20250102100340.43014-2-philmd@linaro.org>
---
tests/qtest/boot-serial-test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/qtest/boot-serial-test.c b/tests/qtest/boot-serial-test.c
index 3b92fa5d506..7759e8c9702 100644
--- a/tests/qtest/boot-serial-test.c
+++ b/tests/qtest/boot-serial-test.c
@@ -185,7 +185,7 @@ static const testdef_t tests[] = {
sizeof(kernel_plml605), kernel_plml605 },
{ "arm", "raspi2b", "", "TT", sizeof(bios_raspi2), 0, bios_raspi2 },
/* For hppa, force bios to output to serial by disabling graphics. */
- { "hppa", "hppa", "-vga none", "SeaBIOS wants SYSTEM HALT" },
+ { "hppa", "B160L", "-vga none", "SeaBIOS wants SYSTEM HALT" },
{ "aarch64", "virt", "-cpu max", "TT", sizeof(kernel_aarch64),
kernel_aarch64 },
{ "arm", "microbit", "", "T", sizeof(kernel_nrf51), kernel_nrf51 },
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 36/49] tests: Add functional tests for HPPA machines
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (34 preceding siblings ...)
2025-01-12 22:17 ` [PULL 35/49] tests/qtest/boot-serial-test: Correct HPPA machine name Philippe Mathieu-Daudé
@ 2025-01-12 22:17 ` Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 37/49] target/hppa: Convert hppa_cpu_init() to ResetHold handler Philippe Mathieu-Daudé
` (13 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:17 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé, Helge Deller, Thomas Huth,
Richard Henderson
Add quick firmware boot tests (less than 1sec) for the
B160L (32-bit) and C3700 (64-bit) HPPA machines:
$ make check-functional-hppa
...
4/4 qemu:func-quick+func-hppa / func-hppa-hppa_seabios OK 0.22s 2 subtests passed
Remove the duplicated B160L test in qtest/boot-serial-test.c.
Suggested-by: Helge Deller <deller@gmx.de>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Helge Deller <deller@gmx.de>
Tested-by: Helge Deller <deller@gmx.de>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20250102100340.43014-3-philmd@linaro.org>
---
MAINTAINERS | 1 +
tests/qtest/boot-serial-test.c | 2 --
tests/functional/meson.build | 4 +++
tests/functional/test_hppa_seabios.py | 35 +++++++++++++++++++++++++++
tests/qtest/meson.build | 2 +-
5 files changed, 41 insertions(+), 3 deletions(-)
create mode 100755 tests/functional/test_hppa_seabios.py
diff --git a/MAINTAINERS b/MAINTAINERS
index 2101b512175..770bbf9f233 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1203,6 +1203,7 @@ F: include/hw/pci-host/astro.h
F: include/hw/pci-host/dino.h
F: pc-bios/hppa-firmware.img
F: roms/seabios-hppa/
+F: tests/functional/test_hppa_seabios.py
LoongArch Machines
------------------
diff --git a/tests/qtest/boot-serial-test.c b/tests/qtest/boot-serial-test.c
index 7759e8c9702..7ea24855072 100644
--- a/tests/qtest/boot-serial-test.c
+++ b/tests/qtest/boot-serial-test.c
@@ -184,8 +184,6 @@ static const testdef_t tests[] = {
{ "microblazeel", "petalogix-ml605", "", "TT",
sizeof(kernel_plml605), kernel_plml605 },
{ "arm", "raspi2b", "", "TT", sizeof(bios_raspi2), 0, bios_raspi2 },
- /* For hppa, force bios to output to serial by disabling graphics. */
- { "hppa", "B160L", "-vga none", "SeaBIOS wants SYSTEM HALT" },
{ "aarch64", "virt", "-cpu max", "TT", sizeof(kernel_aarch64),
kernel_aarch64 },
{ "arm", "microbit", "", "T", sizeof(kernel_nrf51), kernel_nrf51 },
diff --git a/tests/functional/meson.build b/tests/functional/meson.build
index a5087fcb34f..999d5b930f3 100644
--- a/tests/functional/meson.build
+++ b/tests/functional/meson.build
@@ -104,6 +104,10 @@ tests_avr_system_thorough = [
'avr_mega2560',
]
+tests_hppa_system_quick = [
+ 'hppa_seabios',
+]
+
tests_i386_system_thorough = [
'i386_tuxrun',
]
diff --git a/tests/functional/test_hppa_seabios.py b/tests/functional/test_hppa_seabios.py
new file mode 100755
index 00000000000..a44d1a3eebe
--- /dev/null
+++ b/tests/functional/test_hppa_seabios.py
@@ -0,0 +1,35 @@
+#!/usr/bin/env python3
+#
+# SeaBIOS boot test for HPPA machines
+#
+# Copyright (c) 2024 Linaro, Ltd
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+from qemu_test import QemuSystemTest
+from qemu_test import wait_for_console_pattern
+
+class HppaSeabios(QemuSystemTest):
+
+ timeout = 5
+ MACH_BITS = {'B160L': 32, 'C3700': 64}
+
+ def boot_seabios(self):
+ mach = self.machine
+ bits = self.MACH_BITS[mach]
+ self.vm.set_console()
+ self.vm.launch()
+ self.machine
+ wait_for_console_pattern(self, f'SeaBIOS PA-RISC {bits}-bit Firmware')
+ wait_for_console_pattern(self, f'Emulated machine: HP {mach} ({bits}-bit')
+
+ def test_hppa_32(self):
+ self.set_machine('B160L')
+ self.boot_seabios()
+
+ def test_hppa_64(self):
+ self.set_machine('C3700')
+ self.boot_seabios()
+
+if __name__ == '__main__':
+ QemuSystemTest.main()
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
index c5a70021c50..ab296a97a78 100644
--- a/tests/qtest/meson.build
+++ b/tests/qtest/meson.build
@@ -140,7 +140,7 @@ qtests_alpha = ['boot-serial-test'] + \
qtests_avr = [ 'boot-serial-test' ]
-qtests_hppa = ['boot-serial-test'] + \
+qtests_hppa = \
qtests_filter + \
(config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : [])
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 37/49] target/hppa: Convert hppa_cpu_init() to ResetHold handler
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (35 preceding siblings ...)
2025-01-12 22:17 ` [PULL 36/49] tests: Add functional tests for HPPA machines Philippe Mathieu-Daudé
@ 2025-01-12 22:17 ` Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 38/49] hw/hppa: Reset vCPUs calling resettable_reset() Philippe Mathieu-Daudé
` (12 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:17 UTC (permalink / raw)
To: qemu-devel; +Cc: Helge Deller, Philippe Mathieu-Daudé
From: Helge Deller <deller@gmx.de>
hppa_cpu_initfn() is called once when a HPPA CPU instance is
initialized, but it sets fields which should be set each time
a CPU resets. Rename it as a reset handler, having it matching
the ResettablePhases::hold() signature, and register it as
ResettableClass handler.
Since on reset the CPU registers and TLB entries are expected
to be zero, add a memset() call clearing CPUHPPAState up to
the &end_reset_fields marker.
Signed-off-by: Helge Deller <deller@gmx.de>
Co-developed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20241231190620.24442-3-philmd@linaro.org>
---
target/hppa/cpu.h | 5 +++++
target/hppa/cpu.c | 14 ++++++++++++--
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h
index 22a6510e087..c1d69c1a835 100644
--- a/target/hppa/cpu.h
+++ b/target/hppa/cpu.h
@@ -263,6 +263,9 @@ typedef struct CPUArchState {
IntervalTreeRoot tlb_root;
HPPATLBEntry tlb[HPPA_TLB_ENTRIES];
+
+ /* Fields up to this point are cleared by a CPU reset */
+ struct {} end_reset_fields;
} CPUHPPAState;
/**
@@ -281,6 +284,7 @@ struct ArchCPU {
/**
* HPPACPUClass:
* @parent_realize: The parent class' realize handler.
+ * @parent_phases: The parent class' reset phase handlers.
*
* An HPPA CPU model.
*/
@@ -288,6 +292,7 @@ struct HPPACPUClass {
CPUClass parent_class;
DeviceRealize parent_realize;
+ ResettablePhases parent_phases;
};
#include "exec/cpu-all.h"
diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c
index 47d01609557..d784bcdd602 100644
--- a/target/hppa/cpu.c
+++ b/target/hppa/cpu.c
@@ -193,13 +193,20 @@ static void hppa_cpu_realizefn(DeviceState *dev, Error **errp)
tcg_cflags_set(cs, CF_PCREL);
}
-static void hppa_cpu_initfn(Object *obj)
+static void hppa_cpu_reset_hold(Object *obj, ResetType type)
{
+ HPPACPUClass *scc = HPPA_CPU_GET_CLASS(obj);
CPUState *cs = CPU(obj);
HPPACPU *cpu = HPPA_CPU(obj);
CPUHPPAState *env = &cpu->env;
+ if (scc->parent_phases.hold) {
+ scc->parent_phases.hold(obj, type);
+ }
cs->exception_index = -1;
+
+ memset(env, 0, offsetof(CPUHPPAState, end_reset_fields));
+
cpu_hppa_loaded_fr0(env);
cpu_hppa_put_psw(env, PSW_W);
}
@@ -242,10 +249,14 @@ static void hppa_cpu_class_init(ObjectClass *oc, void *data)
DeviceClass *dc = DEVICE_CLASS(oc);
CPUClass *cc = CPU_CLASS(oc);
HPPACPUClass *acc = HPPA_CPU_CLASS(oc);
+ ResettableClass *rc = RESETTABLE_CLASS(oc);
device_class_set_parent_realize(dc, hppa_cpu_realizefn,
&acc->parent_realize);
+ resettable_class_set_parent_phases(rc, NULL, hppa_cpu_reset_hold, NULL,
+ &acc->parent_phases);
+
cc->class_by_name = hppa_cpu_class_by_name;
cc->has_work = hppa_cpu_has_work;
cc->mmu_index = hppa_cpu_mmu_index;
@@ -269,7 +280,6 @@ static const TypeInfo hppa_cpu_type_infos[] = {
.parent = TYPE_CPU,
.instance_size = sizeof(HPPACPU),
.instance_align = __alignof(HPPACPU),
- .instance_init = hppa_cpu_initfn,
.abstract = false,
.class_size = sizeof(HPPACPUClass),
.class_init = hppa_cpu_class_init,
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 38/49] hw/hppa: Reset vCPUs calling resettable_reset()
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (36 preceding siblings ...)
2025-01-12 22:17 ` [PULL 37/49] target/hppa: Convert hppa_cpu_init() to ResetHold handler Philippe Mathieu-Daudé
@ 2025-01-12 22:17 ` Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 39/49] target/hppa: Only set PSW 'M' bit on reset Philippe Mathieu-Daudé
` (11 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:17 UTC (permalink / raw)
To: qemu-devel; +Cc: Helge Deller, Philippe Mathieu-Daudé
From: Helge Deller <deller@gmx.de>
Rather than manually (and incompletely) resetting vCPUs,
call resettable_reset() which will fully reset the vCPUs.
Remove redundant assignations.
Signed-off-by: Helge Deller <deller@gmx.de>
Co-developed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20241231190620.24442-4-philmd@linaro.org>
---
hw/hppa/machine.c | 6 +++---
target/hppa/cpu.c | 1 +
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c
index 65259308e2e..8230f43e41c 100644
--- a/hw/hppa/machine.c
+++ b/hw/hppa/machine.c
@@ -655,12 +655,12 @@ static void hppa_machine_reset(MachineState *ms, ResetType type)
for (i = 0; i < smp_cpus; i++) {
CPUState *cs = CPU(cpu[i]);
+ /* reset CPU */
+ resettable_reset(OBJECT(cs), RESET_TYPE_COLD);
+
cpu_set_pc(cs, firmware_entry);
cpu[i]->env.psw = PSW_Q;
cpu[i]->env.gr[5] = CPU_HPA + i * 0x1000;
-
- cs->exception_index = -1;
- cs->halted = 0;
}
/* already initialized by machine_hppa_init()? */
diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c
index d784bcdd602..41538d39d62 100644
--- a/target/hppa/cpu.c
+++ b/target/hppa/cpu.c
@@ -204,6 +204,7 @@ static void hppa_cpu_reset_hold(Object *obj, ResetType type)
scc->parent_phases.hold(obj, type);
}
cs->exception_index = -1;
+ cs->halted = 0;
memset(env, 0, offsetof(CPUHPPAState, end_reset_fields));
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 39/49] target/hppa: Only set PSW 'M' bit on reset
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (37 preceding siblings ...)
2025-01-12 22:17 ` [PULL 38/49] hw/hppa: Reset vCPUs calling resettable_reset() Philippe Mathieu-Daudé
@ 2025-01-12 22:17 ` Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 40/49] target/hppa: Set PC on vCPU reset Philippe Mathieu-Daudé
` (10 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:17 UTC (permalink / raw)
To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Helge Deller
On reset:
"All PSW bits except the M bit is reset. The M bit is set."
Commit 1a19da0da44 ("target/hppa: Fill in hppa_cpu_do_interrupt /
hppa_cpu_exec_interrupt") inadvertently set the W bit at RESET,
remove it and set the M bit.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Acked-by: Helge Deller <deller@gmx.de>
Message-Id: <20241231190620.24442-5-philmd@linaro.org>
---
target/hppa/cpu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c
index 41538d39d62..dbd46842841 100644
--- a/target/hppa/cpu.c
+++ b/target/hppa/cpu.c
@@ -209,7 +209,7 @@ static void hppa_cpu_reset_hold(Object *obj, ResetType type)
memset(env, 0, offsetof(CPUHPPAState, end_reset_fields));
cpu_hppa_loaded_fr0(env);
- cpu_hppa_put_psw(env, PSW_W);
+ cpu_hppa_put_psw(env, PSW_M);
}
static ObjectClass *hppa_cpu_class_by_name(const char *cpu_model)
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 40/49] target/hppa: Set PC on vCPU reset
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (38 preceding siblings ...)
2025-01-12 22:17 ` [PULL 39/49] target/hppa: Only set PSW 'M' bit on reset Philippe Mathieu-Daudé
@ 2025-01-12 22:17 ` Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 41/49] target/hppa: Speed up hppa_is_pa20() Philippe Mathieu-Daudé
` (9 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:17 UTC (permalink / raw)
To: qemu-devel; +Cc: Helge Deller, Philippe Mathieu-Daudé
From: Helge Deller <deller@gmx.de>
On reset:
"The CPU begins fetching instructions from address 0xf0000004.
This address is in PDC space."
Switch vCPUs to 32-bit mode (PSW_W bit is not set) and start
execution at address 0xf0000004.
Signed-off-by: Helge Deller <deller@gmx.de>
Co-developed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20241231190620.24442-6-philmd@linaro.org>
---
target/hppa/cpu.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c
index dbd46842841..7278b7ca6b5 100644
--- a/target/hppa/cpu.c
+++ b/target/hppa/cpu.c
@@ -205,6 +205,7 @@ static void hppa_cpu_reset_hold(Object *obj, ResetType type)
}
cs->exception_index = -1;
cs->halted = 0;
+ cpu_set_pc(cs, 0xf0000004);
memset(env, 0, offsetof(CPUHPPAState, end_reset_fields));
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 41/49] target/hppa: Speed up hppa_is_pa20()
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (39 preceding siblings ...)
2025-01-12 22:17 ` [PULL 40/49] target/hppa: Set PC on vCPU reset Philippe Mathieu-Daudé
@ 2025-01-12 22:17 ` Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 42/49] hw/loongarch/virt: Checkpatch cleanup Philippe Mathieu-Daudé
` (8 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:17 UTC (permalink / raw)
To: qemu-devel; +Cc: Helge Deller, Philippe Mathieu-Daudé
From: Helge Deller <deller@gmx.de>
Although the hppa_is_pa20() helper is costly due to string comparisons
in object_dynamic_cast(), it is called quite often during memory lookups
and at each start of a block of instruction translations.
Speed hppa_is_pa20() up by calling object_dynamic_cast() only once at
CPU creation and store the result in the is_pa20 of struct CPUArchState.
Signed-off-by: Helge Deller <deller@gmx.de>
Co-developed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20241231190620.24442-7-philmd@linaro.org>
---
target/hppa/cpu.h | 6 ++++--
target/hppa/cpu.c | 8 ++++++++
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h
index c1d69c1a835..083d4f5a56a 100644
--- a/target/hppa/cpu.h
+++ b/target/hppa/cpu.h
@@ -266,6 +266,8 @@ typedef struct CPUArchState {
/* Fields up to this point are cleared by a CPU reset */
struct {} end_reset_fields;
+
+ bool is_pa20;
} CPUHPPAState;
/**
@@ -297,9 +299,9 @@ struct HPPACPUClass {
#include "exec/cpu-all.h"
-static inline bool hppa_is_pa20(CPUHPPAState *env)
+static inline bool hppa_is_pa20(const CPUHPPAState *env)
{
- return object_dynamic_cast(OBJECT(env_cpu(env)), TYPE_HPPA64_CPU) != NULL;
+ return env->is_pa20;
}
static inline int HPPA_BTLB_ENTRIES(CPUHPPAState *env)
diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c
index 7278b7ca6b5..b0bc9d35e4c 100644
--- a/target/hppa/cpu.c
+++ b/target/hppa/cpu.c
@@ -193,6 +193,13 @@ static void hppa_cpu_realizefn(DeviceState *dev, Error **errp)
tcg_cflags_set(cs, CF_PCREL);
}
+static void hppa_cpu_initfn(Object *obj)
+{
+ CPUHPPAState *env = cpu_env(CPU(obj));
+
+ env->is_pa20 = !!object_dynamic_cast(obj, TYPE_HPPA64_CPU);
+}
+
static void hppa_cpu_reset_hold(Object *obj, ResetType type)
{
HPPACPUClass *scc = HPPA_CPU_GET_CLASS(obj);
@@ -282,6 +289,7 @@ static const TypeInfo hppa_cpu_type_infos[] = {
.parent = TYPE_CPU,
.instance_size = sizeof(HPPACPU),
.instance_align = __alignof(HPPACPU),
+ .instance_init = hppa_cpu_initfn,
.abstract = false,
.class_size = sizeof(HPPACPUClass),
.class_init = hppa_cpu_class_init,
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 42/49] hw/loongarch/virt: Checkpatch cleanup
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (40 preceding siblings ...)
2025-01-12 22:17 ` [PULL 41/49] target/hppa: Speed up hppa_is_pa20() Philippe Mathieu-Daudé
@ 2025-01-12 22:17 ` Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 43/49] backends/cryptodev-vhost-user: Fix local_error leaks Philippe Mathieu-Daudé
` (7 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:17 UTC (permalink / raw)
To: qemu-devel; +Cc: Bibo Mao, Philippe Mathieu-Daudé
From: Bibo Mao <maobibo@loongson.cn>
Code cleanup with directory hw/loongarch/, removing errors from
command "scripts/checkpatch.pl hw/loongarch/*"
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250103064514.2660438-1-maobibo@loongson.cn>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/loongarch/acpi-build.c | 3 ++-
hw/loongarch/boot.c | 4 ++--
hw/loongarch/virt.c | 8 +++++---
3 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/hw/loongarch/acpi-build.c b/hw/loongarch/acpi-build.c
index 9eb5fb68bff..fdd62acf7e9 100644
--- a/hw/loongarch/acpi-build.c
+++ b/hw/loongarch/acpi-build.c
@@ -456,8 +456,9 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, MachineState *machine)
acpi_table_begin(&table, table_data);
dsdt = init_aml_allocator();
- for (i = 0; i < VIRT_UART_COUNT; i++)
+ for (i = 0; i < VIRT_UART_COUNT; i++) {
build_uart_device_aml(dsdt, i);
+ }
build_pci_device_aml(dsdt, lvms);
build_la_ged_aml(dsdt, machine);
build_flash_aml(dsdt, lvms);
diff --git a/hw/loongarch/boot.c b/hw/loongarch/boot.c
index 241c0eef1f0..bd8763c61c3 100644
--- a/hw/loongarch/boot.c
+++ b/hw/loongarch/boot.c
@@ -292,7 +292,7 @@ static void reset_load_elf(void *opaque)
cpu_reset(CPU(cpu));
if (env->load_elf) {
- if (cpu == LOONGARCH_CPU(first_cpu)) {
+ if (cpu == LOONGARCH_CPU(first_cpu)) {
env->gpr[4] = env->boot_info->a0;
env->gpr[5] = env->boot_info->a1;
env->gpr[6] = env->boot_info->a2;
@@ -354,7 +354,7 @@ static void loongarch_direct_kernel_boot(struct loongarch_boot_info *info)
if (info->kernel_filename) {
kernel_addr = load_kernel_info(info);
} else {
- if(!qtest_enabled()) {
+ if (!qtest_enabled()) {
warn_report("No kernel provided, booting from flash drive.");
}
}
diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c
index df56d75a6e7..db37ed6a717 100644
--- a/hw/loongarch/virt.c
+++ b/hw/loongarch/virt.c
@@ -331,8 +331,9 @@ static void fdt_add_uart_node(LoongArchVirtMachineState *lvms,
qemu_fdt_setprop_string(ms->fdt, nodename, "compatible", "ns16550a");
qemu_fdt_setprop_cells(ms->fdt, nodename, "reg", 0x0, base, 0x0, size);
qemu_fdt_setprop_cell(ms->fdt, nodename, "clock-frequency", 100000000);
- if (chosen)
+ if (chosen) {
qemu_fdt_setprop_string(ms->fdt, "/chosen", "stdout-path", nodename);
+ }
qemu_fdt_setprop_cells(ms->fdt, nodename, "interrupts", irq, 0x4);
qemu_fdt_setprop_cell(ms->fdt, nodename, "interrupt-parent",
*pch_pic_phandle);
@@ -815,7 +816,7 @@ static void virt_devices_init(DeviceState *pch_pic,
* Create uart fdt node in reverse order so that they appear
* in the finished device tree lowest address first
*/
- for (i = VIRT_UART_COUNT; i --> 0;) {
+ for (i = VIRT_UART_COUNT; i-- > 0;) {
hwaddr base = VIRT_UART_BASE + i * VIRT_UART_SIZE;
int irq = VIRT_UART_IRQ + i - VIRT_GSI_BASE;
serial_mm_init(get_system_memory(), base, 0,
@@ -1175,8 +1176,9 @@ static void fw_cfg_add_memory(MachineState *ms)
size = ram_size - numa_info[0].node_mem;
}
- if (size)
+ if (size) {
memmap_add_entry(base, size, 1);
+ }
}
static void virt_init(MachineState *machine)
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 43/49] backends/cryptodev-vhost-user: Fix local_error leaks
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (41 preceding siblings ...)
2025-01-12 22:17 ` [PULL 42/49] hw/loongarch/virt: Checkpatch cleanup Philippe Mathieu-Daudé
@ 2025-01-12 22:17 ` Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 44/49] hw/usb/hcd-xhci-pci: Use event ring 0 if mapping unsupported Philippe Mathieu-Daudé
` (6 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:17 UTC (permalink / raw)
To: qemu-devel; +Cc: Gabriel Barrantes, zhenwei pi, Philippe Mathieu-Daudé
From: Gabriel Barrantes <gabriel.barrantes.dev@outlook.com>
Do not propagate error to the upper, directly output the error
to avoid leaks.
Fixes: 2fda101de07 ("virtio-crypto: Support asynchronous mode")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2714
Signed-off-by: Gabriel Barrantes <gabriel.barrantes.dev@outlook.com>
Reviewed-by: zhenwei pi <pizhenwei@bytedance.com>
Message-Id: <DM8PR13MB50781054A4FDACE6F4FB6469B30F2@DM8PR13MB5078.namprd13.prod.outlook.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
backends/cryptodev-vhost-user.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/backends/cryptodev-vhost-user.c b/backends/cryptodev-vhost-user.c
index 43efdf97477..3295c6198a7 100644
--- a/backends/cryptodev-vhost-user.c
+++ b/backends/cryptodev-vhost-user.c
@@ -281,8 +281,7 @@ static int cryptodev_vhost_user_create_session(
break;
default:
- error_setg(&local_error, "Unsupported opcode :%" PRIu32 "",
- sess_info->op_code);
+ error_report("Unsupported opcode :%" PRIu32 "", sess_info->op_code);
return -VIRTIO_CRYPTO_NOTSUPP;
}
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 44/49] hw/usb/hcd-xhci-pci: Use event ring 0 if mapping unsupported
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (42 preceding siblings ...)
2025-01-12 22:17 ` [PULL 43/49] backends/cryptodev-vhost-user: Fix local_error leaks Philippe Mathieu-Daudé
@ 2025-01-12 22:17 ` Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 45/49] hw/tricore/triboard: Remove unnecessary use of &first_cpu Philippe Mathieu-Daudé
` (5 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:17 UTC (permalink / raw)
To: qemu-devel; +Cc: Phil Dennis-Jordan, Philippe Mathieu-Daudé
From: Phil Dennis-Jordan <phil@philjordan.eu>
The XHCI specification, section 4.17.1 specifies that "If the
Number of Interrupters (MaxIntrs) field is greater than 1, then
Interrupter Mapping shall be supported." and "If Interrupter
Mapping is not supported, the Interrupter Target field shall be
ignored by the xHC and all Events targeted at Interrupter 0."
QEMU's XHCI device has so far not specially addressed this case,
so we add a check to xhci_event() to redirect to event ring and
interrupt 0 if mapping is disabled.
Signed-off-by: Phil Dennis-Jordan <phil@philjordan.eu>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20241227121336.25838-4-phil@philjordan.eu>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/usb/hcd-xhci.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index 7dc0994c89c..00d5bc37792 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -644,6 +644,10 @@ static void xhci_event(XHCIState *xhci, XHCIEvent *event, int v)
dma_addr_t erdp;
unsigned int dp_idx;
+ if (xhci->numintrs == 1) {
+ v = 0;
+ }
+
if (v >= xhci->numintrs) {
DPRINTF("intr nr out of range (%d >= %d)\n", v, xhci->numintrs);
return;
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 45/49] hw/tricore/triboard: Remove unnecessary use of &first_cpu
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (43 preceding siblings ...)
2025-01-12 22:17 ` [PULL 44/49] hw/usb/hcd-xhci-pci: Use event ring 0 if mapping unsupported Philippe Mathieu-Daudé
@ 2025-01-12 22:17 ` Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 46/49] MAINTAINERS: remove myself from sbsa-ref Philippe Mathieu-Daudé
` (4 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:17 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé, Richard Henderson, Pierrick Bouvier,
Bastian Koppelmann
triboard_machine_init() has access to the single CPU via:
TriBoardMachineState {
TC27XSoCState {
TriCoreCPU cpu;
...
} tc27x_soc;
} ms;
Pass it as argument to tricore_load_kernel() so we can
remove the &first_cpu global use.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Message-Id: <20250110180909.83165-1-philmd@linaro.org>
---
hw/tricore/triboard.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/hw/tricore/triboard.c b/hw/tricore/triboard.c
index 4dba0259cd3..9cc8d282ff2 100644
--- a/hw/tricore/triboard.c
+++ b/hw/tricore/triboard.c
@@ -31,11 +31,10 @@
#include "hw/tricore/triboard.h"
#include "hw/tricore/tc27x_soc.h"
-static void tricore_load_kernel(const char *kernel_filename)
+static void tricore_load_kernel(TriCoreCPU *cpu, const char *kernel_filename)
{
uint64_t entry;
long kernel_size;
- TriCoreCPU *cpu;
CPUTriCoreState *env;
kernel_size = load_elf(kernel_filename, NULL,
@@ -46,7 +45,6 @@ static void tricore_load_kernel(const char *kernel_filename)
error_report("no kernel file '%s'", kernel_filename);
exit(1);
}
- cpu = TRICORE_CPU(first_cpu);
env = &cpu->env;
env->PC = entry;
}
@@ -62,7 +60,7 @@ static void triboard_machine_init(MachineState *machine)
sysbus_realize(SYS_BUS_DEVICE(&ms->tc27x_soc), &error_fatal);
if (machine->kernel_filename) {
- tricore_load_kernel(machine->kernel_filename);
+ tricore_load_kernel(&ms->tc27x_soc.cpu, machine->kernel_filename);
}
}
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 46/49] MAINTAINERS: remove myself from sbsa-ref
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (44 preceding siblings ...)
2025-01-12 22:17 ` [PULL 45/49] hw/tricore/triboard: Remove unnecessary use of &first_cpu Philippe Mathieu-Daudé
@ 2025-01-12 22:17 ` Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 47/49] MAINTAINERS: Add me as the maintainer for ivshmem-flat Philippe Mathieu-Daudé
` (3 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:17 UTC (permalink / raw)
To: qemu-devel; +Cc: Marcin Juszkiewicz, Philippe Mathieu-Daudé, Leif Lindholm
From: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
I am ending my time with Linaro and do not have plans to continue
working on SBSA Reference Platform anymore.
Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
Message-ID: <20241218123055.11220-1-marcin.juszkiewicz@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
MAINTAINERS | 1 -
1 file changed, 1 deletion(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index 770bbf9f233..4ca3981dd25 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -923,7 +923,6 @@ SBSA-REF
M: Radoslaw Biernacki <rad@semihalf.com>
M: Peter Maydell <peter.maydell@linaro.org>
R: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
-R: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
L: qemu-arm@nongnu.org
S: Maintained
F: hw/arm/sbsa-ref.c
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 47/49] MAINTAINERS: Add me as the maintainer for ivshmem-flat
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (45 preceding siblings ...)
2025-01-12 22:17 ` [PULL 46/49] MAINTAINERS: remove myself from sbsa-ref Philippe Mathieu-Daudé
@ 2025-01-12 22:17 ` Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 48/49] MAINTAINERS: Update path to coreaudio.m Philippe Mathieu-Daudé
` (2 subsequent siblings)
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:17 UTC (permalink / raw)
To: qemu-devel; +Cc: Gustavo Romero, Philippe Mathieu-Daudé
From: Gustavo Romero <gustavo.romero@linaro.org>
Add me as the maintainer for the ivshmem-flat device.
Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250107015639.27648-1-gustavo.romero@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
MAINTAINERS | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/MAINTAINERS b/MAINTAINERS
index 4ca3981dd25..0727579cdec 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2785,6 +2785,13 @@ F: hw/hyperv/hv-balloon*.h
F: include/hw/hyperv/dynmem-proto.h
F: include/hw/hyperv/hv-balloon.h
+ivshmem-flat
+M: Gustavo Romero <gustavo.romero@linaro.org>
+S: Maintained
+F: hw/misc/ivshmem-flat.c
+F: include/hw/misc/ivshmem-flat.h
+F: docs/system/devices/ivshmem-flat.rst
+
Subsystems
----------
Overall Audio backends
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 48/49] MAINTAINERS: Update path to coreaudio.m
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (46 preceding siblings ...)
2025-01-12 22:17 ` [PULL 47/49] MAINTAINERS: Add me as the maintainer for ivshmem-flat Philippe Mathieu-Daudé
@ 2025-01-12 22:17 ` Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 49/49] Add a b4 configuration file Philippe Mathieu-Daudé
2025-01-13 15:40 ` [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:17 UTC (permalink / raw)
To: qemu-devel
Cc: Akihiko Odaki, Christian Schoenebeck, Philippe Mathieu-Daudé
From: Akihiko Odaki <akihiko.odaki@daynix.com>
Commit 8b46d7e2dc8e ("audio: Rename coreaudio extension to use
Objective-C compiler") renamed coreaudio.c to coreaudio.m.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250111-maintainers-v1-1-faebe6ef0fec@daynix.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
MAINTAINERS | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index 0727579cdec..ec898a3cbc6 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2800,7 +2800,7 @@ M: Marc-André Lureau <marcandre.lureau@redhat.com>
S: Odd Fixes
F: audio/
X: audio/alsaaudio.c
-X: audio/coreaudio.c
+X: audio/coreaudio.m
X: audio/dsound*
X: audio/jackaudio.c
X: audio/ossaudio.c
@@ -2822,7 +2822,7 @@ M: Philippe Mathieu-Daudé <philmd@linaro.org>
R: Christian Schoenebeck <qemu_oss@crudebyte.com>
R: Akihiko Odaki <akihiko.odaki@daynix.com>
S: Odd Fixes
-F: audio/coreaudio.c
+F: audio/coreaudio.m
DSound Audio backend
M: Gerd Hoffmann <kraxel@redhat.com>
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PULL 49/49] Add a b4 configuration file
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (47 preceding siblings ...)
2025-01-12 22:17 ` [PULL 48/49] MAINTAINERS: Update path to coreaudio.m Philippe Mathieu-Daudé
@ 2025-01-12 22:17 ` Philippe Mathieu-Daudé
2025-01-13 15:40 ` [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 22:17 UTC (permalink / raw)
To: qemu-devel; +Cc: Jiaxun Yang, Signed-off-by: Philippe Mathieu-Daudé
From: Jiaxun Yang <jiaxun.yang@flygoat.com>
b4 [1] is a convenient tool to manage patch series with mailing list
working flow.
Add a project default config file to match QEMU's mailing list conventions
as well as adopting differences on scripting.
Examples of b4:
```
$ b4 prep --check
Checking patches using:
scripts/checkpatch.pl -q --terse --no-summary --mailback -
---
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
Changes in v2:
- Add lore masks (philmd) from:
https://lore.kernel.org/qemu-devel/20241224135054.10243-1-philmd@linaro.org/
- Link to v1: https://lore.kernel.org/r/20241222-b4-config-v1-1-b3667beb30a4@flygoat.com
---
● cc5a4c890fed: Add a b4 configuration file
● checkpatch.pl: 27: WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
---
Success: 0, Warning: 1, Error: 0
```
```
$ b4 prep -c
Will collect To: addresses using echo
Will collect Cc: addresses using get_maintainer.pl
Collecting To/Cc addresses
+ To: qemu-devel@nongnu.org
---
You can trim/expand this list with: b4 prep --edit-cover
Invoking git-filter-repo to update the cover letter.
New history written in 0.02 seconds...
Completely finished after 0.06 seconds
```
[1]: https://b4.docs.kernel.org/
Co-developed-by: Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Message-ID: <20250102-b4-config-v2-1-cc7299e399bb@flygoat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
MAINTAINERS | 6 ++++++
.b4-config | 14 ++++++++++++++
2 files changed, 20 insertions(+)
create mode 100644 .b4-config
diff --git a/MAINTAINERS b/MAINTAINERS
index ec898a3cbc6..0c71eb3f925 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4310,3 +4310,9 @@ Machine development tool
M: Maksim Davydov <davydov-max@yandex-team.ru>
S: Supported
F: scripts/compare-machine-types.py
+
+b4 tool configuration
+M: Jiaxun Yang <jiaxun.yang@flygoat.com>
+M: Philippe Mathieu-Daudé <philmd@linaro.org>
+S: Odd Fixes
+F: .b4-config
diff --git a/.b4-config b/.b4-config
new file mode 100644
index 00000000000..4b9b2fe290f
--- /dev/null
+++ b/.b4-config
@@ -0,0 +1,14 @@
+#
+# Common b4 settings that can be used to send patches to QEMU upstream.
+# https://b4.docs.kernel.org/
+#
+
+[b4]
+ send-series-to = qemu-devel@nongnu.org
+ send-auto-to-cmd = echo
+ send-auto-cc-cmd = scripts/get_maintainer.pl --noroles --norolestats --nogit --nogit-fallback
+ am-perpatch-check-cmd = scripts/checkpatch.pl -q --terse --no-summary --mailback -
+ prep-perpatch-check-cmd = scripts/checkpatch.pl -q --terse --no-summary --mailback -
+ searchmask = https://lore.kernel.org/qemu-devel/?x=m&t=1&q=%s
+ linkmask = https://lore.kernel.org/qemu-devel/%s
+ linktrailermask = Message-ID: <%s>
--
2.47.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* Re: [PULL 04/49] hw: Add QOM parentship relation with CPUs
2025-01-12 22:16 ` [PULL 04/49] hw: Add QOM parentship relation with CPUs Philippe Mathieu-Daudé
@ 2025-01-13 12:28 ` Igor Mammedov
2025-01-13 16:00 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 61+ messages in thread
From: Igor Mammedov @ 2025-01-13 12:28 UTC (permalink / raw)
To: Philippe Mathieu-Daudé; +Cc: qemu-devel, Zhao Liu
On Sun, 12 Jan 2025 23:16:40 +0100
Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
> QDev objects created with object_new() need to manually add
> their parent relationship with object_property_add_child().
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
> Message-Id: <20240216110313.17039-22-philmd@linaro.org>
> ---
> hw/i386/x86-common.c | 1 +
> hw/microblaze/petalogix_ml605_mmu.c | 1 +
> hw/microblaze/petalogix_s3adsp1800_mmu.c | 1 +
> hw/mips/cps.c | 1 +
> hw/ppc/e500.c | 1 +
> hw/ppc/spapr.c | 1 +
> 6 files changed, 6 insertions(+)
>
> diff --git a/hw/i386/x86-common.c b/hw/i386/x86-common.c
> index 97b4f7d4a0d..9c9ffb3484a 100644
> --- a/hw/i386/x86-common.c
> +++ b/hw/i386/x86-common.c
> @@ -60,6 +60,7 @@ static void x86_cpu_new(X86MachineState *x86ms, int64_t apic_id, Error **errp)
> if (!object_property_set_uint(cpu, "apic-id", apic_id, errp)) {
> goto out;
> }
> + object_property_add_child(OBJECT(x86ms), "cpu[*]", OBJECT(cpu));
I might be missing something but why it needs to be done manually?
device_set_realized() will place any parent-less device under (1) /machine/unattached
while devices created with device_add() are be placed under /machine/peripheral[-anon]
The commit message unfortunately doesn't explain why [1] shall be replaced
by direct cpu[*] array property directly under machine.
Granted, those paths aren't any kind of ABI and wrt x86 cpus
nothing should break (or I'd say it shouldn't break our promises)
But I'd rather not do this without a good reason/explanation.
> qdev_realize(DEVICE(cpu), NULL, errp);
>
> out:
> diff --git a/hw/microblaze/petalogix_ml605_mmu.c b/hw/microblaze/petalogix_ml605_mmu.c
> index 8b44be75a22..b6be40915ac 100644
> --- a/hw/microblaze/petalogix_ml605_mmu.c
> +++ b/hw/microblaze/petalogix_ml605_mmu.c
> @@ -83,6 +83,7 @@ petalogix_ml605_init(MachineState *machine)
>
> /* init CPUs */
> cpu = MICROBLAZE_CPU(object_new(TYPE_MICROBLAZE_CPU));
> + object_property_add_child(OBJECT(machine), "cpu", OBJECT(cpu));
> object_property_set_str(OBJECT(cpu), "version", "8.10.a", &error_abort);
> /* Use FPU but don't use floating point conversion and square
> * root instructions
> diff --git a/hw/microblaze/petalogix_s3adsp1800_mmu.c b/hw/microblaze/petalogix_s3adsp1800_mmu.c
> index 2c0d8c34cd2..29629310ba2 100644
> --- a/hw/microblaze/petalogix_s3adsp1800_mmu.c
> +++ b/hw/microblaze/petalogix_s3adsp1800_mmu.c
> @@ -73,6 +73,7 @@ petalogix_s3adsp1800_init(MachineState *machine)
> MemoryRegion *sysmem = get_system_memory();
>
> cpu = MICROBLAZE_CPU(object_new(TYPE_MICROBLAZE_CPU));
> + object_property_add_child(OBJECT(machine), "cpu", OBJECT(cpu));
> object_property_set_str(OBJECT(cpu), "version", "7.10.d", &error_abort);
> object_property_set_bool(OBJECT(cpu), "little-endian",
> !TARGET_BIG_ENDIAN, &error_abort);
> diff --git a/hw/mips/cps.c b/hw/mips/cps.c
> index 0d8cbdc8924..293b405b965 100644
> --- a/hw/mips/cps.c
> +++ b/hw/mips/cps.c
> @@ -87,6 +87,7 @@ static void mips_cps_realize(DeviceState *dev, Error **errp)
> /* All cores use the same clock tree */
> qdev_connect_clock_in(DEVICE(cpu), "clk-in", s->clock);
>
> + object_property_add_child(OBJECT(dev), "cpu[*]", OBJECT(cpu));
> if (!qdev_realize_and_unref(DEVICE(cpu), NULL, errp)) {
> return;
> }
> diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
> index 4551157c011..17d63ced907 100644
> --- a/hw/ppc/e500.c
> +++ b/hw/ppc/e500.c
> @@ -955,6 +955,7 @@ void ppce500_init(MachineState *machine)
> */
> object_property_set_bool(OBJECT(cs), "start-powered-off", i != 0,
> &error_abort);
> + object_property_add_child(OBJECT(machine), "cpu[*]", OBJECT(cpu));
> qdev_realize_and_unref(DEVICE(cs), NULL, &error_fatal);
>
> if (!firstenv) {
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 623842f8064..125be6d29fd 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -2705,6 +2705,7 @@ static void spapr_init_cpus(SpaprMachineState *spapr)
> &error_fatal);
> object_property_set_int(core, CPU_CORE_PROP_CORE_ID, core_id,
> &error_fatal);
> + object_property_add_child(OBJECT(spapr), "cpu[*]", OBJECT(core));
> qdev_realize(DEVICE(core), NULL, &error_fatal);
>
> object_unref(core);
^ permalink raw reply [flat|nested] 61+ messages in thread
* Re: [PULL 00/49] Misc HW patches for 2025-01-12
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
` (48 preceding siblings ...)
2025-01-12 22:17 ` [PULL 49/49] Add a b4 configuration file Philippe Mathieu-Daudé
@ 2025-01-13 15:40 ` Philippe Mathieu-Daudé
49 siblings, 0 replies; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-13 15:40 UTC (permalink / raw)
To: Stefan Hajnoczi; +Cc: QEMU Developers
Hi Stefan,
Please drop this PR since Igor made a comment on a patch,
Thanks!
On 12/1/25 23:16, Philippe Mathieu-Daudé wrote:
> The following changes since commit 3214bec13d8d4c40f707d21d8350d04e4123ae97:
>
> Merge tag 'migration-20250110-pull-request' of https://gitlab.com/farosas/qemu into staging (2025-01-10 13:39:19 -0500)
>
> are available in the Git repository at:
>
> https://github.com/philmd/qemu.git tags/hw-misc-20250112
>
> for you to fetch changes up to 4a0031691596bd81c5949cf4632a6d178f8c2fe5:
>
> Add a b4 configuration file (2025-01-12 23:06:29 +0100)
>
> ----------------------------------------------------------------
> Misc HW patches queue
>
> - Silent unuseful DTC warnings (Philippe)
> - Add few QOM parentship relations (Philippe)
> - Rework XilinX EthLite RAM buffers (Philippe)
> - Convert vmcoreinfo to 3-phase reset (Philippe)
> - Convert HPPA CPUs to 3-phase reset (Helge)
> - Fix UFS endianness issue (Keoseong)
> - Introduce pci_set_enabled (Akihiko)
> - Clarify Enclave and Firecracker relationship (Alexander)
> - Set SDHCI DMA interrupt status bit in correct place (Bernhard)
> - Fix leak in cryptodev-vhost-user backend (Gabriel)
> - Use USB XHCI ring 0 when mapping is not supported (Phil)
> - Convert DPRINTF to trace events (Nikita, Bernhard)
> - Remove &first_cpu in TriCore machine (Philippe)
> - Checkpatch style cleanups (Bibo)
> - MAINTAINERS updates (Marcin, Gustavo, Akihiko)
> - Add default configuration for b4 tool (Jiaxun)
>
> ----------------------------------------------------------------
^ permalink raw reply [flat|nested] 61+ messages in thread
* Re: [PULL 04/49] hw: Add QOM parentship relation with CPUs
2025-01-13 12:28 ` Igor Mammedov
@ 2025-01-13 16:00 ` Philippe Mathieu-Daudé
2025-01-14 10:18 ` Igor Mammedov
0 siblings, 1 reply; 61+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-13 16:00 UTC (permalink / raw)
To: Igor Mammedov; +Cc: qemu-devel, Zhao Liu, Markus Armbruster, Peter Xu
On 13/1/25 13:28, Igor Mammedov wrote:
> On Sun, 12 Jan 2025 23:16:40 +0100
> Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
>> QDev objects created with object_new() need to manually add
>> their parent relationship with object_property_add_child().
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
>> Message-Id: <20240216110313.17039-22-philmd@linaro.org>
>> ---
>> hw/i386/x86-common.c | 1 +
>> hw/microblaze/petalogix_ml605_mmu.c | 1 +
>> hw/microblaze/petalogix_s3adsp1800_mmu.c | 1 +
>> hw/mips/cps.c | 1 +
>> hw/ppc/e500.c | 1 +
>> hw/ppc/spapr.c | 1 +
>> 6 files changed, 6 insertions(+)
>>
>> diff --git a/hw/i386/x86-common.c b/hw/i386/x86-common.c
>> index 97b4f7d4a0d..9c9ffb3484a 100644
>> --- a/hw/i386/x86-common.c
>> +++ b/hw/i386/x86-common.c
>> @@ -60,6 +60,7 @@ static void x86_cpu_new(X86MachineState *x86ms, int64_t apic_id, Error **errp)
>> if (!object_property_set_uint(cpu, "apic-id", apic_id, errp)) {
>> goto out;
>> }
>> + object_property_add_child(OBJECT(x86ms), "cpu[*]", OBJECT(cpu));
>
> I might be missing something but why it needs to be done manually?
>
> device_set_realized() will place any parent-less device under (1) /machine/unattached
This is exactly what we want to avoid, to eventually remove
the "/machine/unattached" container for good.
See "= Problem 4: The /machine/unattached/ orphanage =" in:
https://lore.kernel.org/qemu-devel/87o7d1i7ky.fsf@pond.sub.org/
> while devices created with device_add() are be placed under /machine/peripheral[-anon]
>
> The commit message unfortunately doesn't explain why [1] shall be replaced
> by direct cpu[*] array property directly under machine.
Right. I'll drop for now and respin once reworded.
> Granted, those paths aren't any kind of ABI and wrt x86 cpus
> nothing should break (or I'd say it shouldn't break our promises)
> But I'd rather not do this without a good reason/explanation.
>
>> qdev_realize(DEVICE(cpu), NULL, errp);
>>
>> out:
^ permalink raw reply [flat|nested] 61+ messages in thread
* Re: [PULL 04/49] hw: Add QOM parentship relation with CPUs
2025-01-13 16:00 ` Philippe Mathieu-Daudé
@ 2025-01-14 10:18 ` Igor Mammedov
2025-01-14 12:38 ` Markus Armbruster
2025-01-14 14:38 ` Zhao Liu
0 siblings, 2 replies; 61+ messages in thread
From: Igor Mammedov @ 2025-01-14 10:18 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, Zhao Liu, Markus Armbruster, Peter Xu
On Mon, 13 Jan 2025 17:00:55 +0100
Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
> On 13/1/25 13:28, Igor Mammedov wrote:
> > On Sun, 12 Jan 2025 23:16:40 +0100
> > Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
> >
> >> QDev objects created with object_new() need to manually add
> >> their parent relationship with object_property_add_child().
> >>
> >> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> >> Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
> >> Message-Id: <20240216110313.17039-22-philmd@linaro.org>
> >> ---
> >> hw/i386/x86-common.c | 1 +
> >> hw/microblaze/petalogix_ml605_mmu.c | 1 +
> >> hw/microblaze/petalogix_s3adsp1800_mmu.c | 1 +
> >> hw/mips/cps.c | 1 +
> >> hw/ppc/e500.c | 1 +
> >> hw/ppc/spapr.c | 1 +
> >> 6 files changed, 6 insertions(+)
> >>
> >> diff --git a/hw/i386/x86-common.c b/hw/i386/x86-common.c
> >> index 97b4f7d4a0d..9c9ffb3484a 100644
> >> --- a/hw/i386/x86-common.c
> >> +++ b/hw/i386/x86-common.c
> >> @@ -60,6 +60,7 @@ static void x86_cpu_new(X86MachineState *x86ms, int64_t apic_id, Error **errp)
> >> if (!object_property_set_uint(cpu, "apic-id", apic_id, errp)) {
> >> goto out;
> >> }
> >> + object_property_add_child(OBJECT(x86ms), "cpu[*]", OBJECT(cpu));
> >
> > I might be missing something but why it needs to be done manually?
> >
> > device_set_realized() will place any parent-less device under (1) /machine/unattached
>
> This is exactly what we want to avoid, to eventually remove
> the "/machine/unattached" container for good.
>
> See "= Problem 4: The /machine/unattached/ orphanage =" in:
> https://lore.kernel.org/qemu-devel/87o7d1i7ky.fsf@pond.sub.org/
QOM paths as far as I'm aware were never part ABI nor I'm aware of
of any proposal to make it or some parts of it a public interface.
IMHO for public ABI, QEMU provides explicit QMP commands while
QOM should stay a playground for developers.
I this specific case, one basically replaces /machine/unattached
orphanage with explicit /machine one and many 'cpuN' children,
which ain't any better than device[N].
and in future I can imagine that at least in x86 case vcpus
might have another parent depending on configuration.
(i.e. being parented to cores instead)
If goal is to get rid of /machine/unattached, that's fine.
But please not make brittle naming under /machine/unattached
as a reason as 'cpu[N]' is the same just in different place
and scattered all over code (hence doubts if it's any better than current way).
(ps: don't we have exactly the same for peripheral-anon container)
> > while devices created with device_add() are be placed under /machine/peripheral[-anon]
> >
> > The commit message unfortunately doesn't explain why [1] shall be replaced
> > by direct cpu[*] array property directly under machine.
>
> Right. I'll drop for now and respin once reworded.
>
> > Granted, those paths aren't any kind of ABI and wrt x86 cpus
> > nothing should break (or I'd say it shouldn't break our promises)
> > But I'd rather not do this without a good reason/explanation.
> >
> >> qdev_realize(DEVICE(cpu), NULL, errp);
> >>
> >> out:
>
^ permalink raw reply [flat|nested] 61+ messages in thread
* Re: [PULL 04/49] hw: Add QOM parentship relation with CPUs
2025-01-14 10:18 ` Igor Mammedov
@ 2025-01-14 12:38 ` Markus Armbruster
2025-01-15 10:19 ` Igor Mammedov
2025-01-14 14:38 ` Zhao Liu
1 sibling, 1 reply; 61+ messages in thread
From: Markus Armbruster @ 2025-01-14 12:38 UTC (permalink / raw)
To: Igor Mammedov; +Cc: Philippe Mathieu-Daudé, qemu-devel, Zhao Liu, Peter Xu
Igor Mammedov <imammedo@redhat.com> writes:
> On Mon, 13 Jan 2025 17:00:55 +0100
> Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
>> On 13/1/25 13:28, Igor Mammedov wrote:
>> > On Sun, 12 Jan 2025 23:16:40 +0100
>> > Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>> >
>> >> QDev objects created with object_new() need to manually add
>> >> their parent relationship with object_property_add_child().
>> >>
>> >> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> >> Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
>> >> Message-Id: <20240216110313.17039-22-philmd@linaro.org>
>> >> ---
>> >> hw/i386/x86-common.c | 1 +
>> >> hw/microblaze/petalogix_ml605_mmu.c | 1 +
>> >> hw/microblaze/petalogix_s3adsp1800_mmu.c | 1 +
>> >> hw/mips/cps.c | 1 +
>> >> hw/ppc/e500.c | 1 +
>> >> hw/ppc/spapr.c | 1 +
>> >> 6 files changed, 6 insertions(+)
>> >>
>> >> diff --git a/hw/i386/x86-common.c b/hw/i386/x86-common.c
>> >> index 97b4f7d4a0d..9c9ffb3484a 100644
>> >> --- a/hw/i386/x86-common.c
>> >> +++ b/hw/i386/x86-common.c
>> >> @@ -60,6 +60,7 @@ static void x86_cpu_new(X86MachineState *x86ms, int64_t apic_id, Error **errp)
>> >> if (!object_property_set_uint(cpu, "apic-id", apic_id, errp)) {
>> >> goto out;
>> >> }
>> >> + object_property_add_child(OBJECT(x86ms), "cpu[*]", OBJECT(cpu));
>> >
>> > I might be missing something but why it needs to be done manually?
>> >
>> > device_set_realized() will place any parent-less device under (1) /machine/unattached
>>
>> This is exactly what we want to avoid, to eventually remove
>> the "/machine/unattached" container for good.
>>
>> See "= Problem 4: The /machine/unattached/ orphanage =" in:
>> https://lore.kernel.org/qemu-devel/87o7d1i7ky.fsf@pond.sub.org/
>
>
> QOM paths as far as I'm aware were never part ABI nor I'm aware of
> of any proposal to make it or some parts of it a public interface.
We've been waffling on this since forever. QOM is not a public
interface except when it is, and it is when somebody says so, and it
isn't when somebody says so, resulting in a wave function that wobbles
like an underdone souffle, but never quite collapses.
> IMHO for public ABI, QEMU provides explicit QMP commands while
> QOM should stay a playground for developers.
Plenty of commands take QOM paths as arguments: eject,
blockdev-open-tray, blockdev-close-tray, blockdev-remove-medium,
blockdev-insert-medium, blockdev-change-medium,
block-latency-histogram-set, cxl-inject-general-media-event,
cxl-inject-dram-event, cxl-inject-memory-module-event,
cxl-inject-poison, cxl-inject-uncorrectable-errors,
cxl-inject-correctable-error, device_del, device-sync-config,
query-stats, x-query-virtio-status, x-query-virtio-queue-status,
x-query-virtio-vhost-queue-status, x-query-virtio-queue-element, and
possibly more.
The only way their QOM path arguments can be used without relying on QOM
paths being ABI would be obtaining the argument value with a command or
from an event. I doubt that would be possible even if we tried it,
which we haven't.
> I this specific case, one basically replaces /machine/unattached
> orphanage with explicit /machine one and many 'cpuN' children,
> which ain't any better than device[N].
>
> and in future I can imagine that at least in x86 case vcpus
> might have another parent depending on configuration.
> (i.e. being parented to cores instead)
>
> If goal is to get rid of /machine/unattached, that's fine.
/machine/unattached was a lazy mistake.
> But please not make brittle naming under /machine/unattached
> as a reason as 'cpu[N]' is the same just in different place
> and scattered all over code (hence doubts if it's any better than current way).
Can you suggest a better, workable naming scheme?
> (ps: don't we have exactly the same for peripheral-anon container)
Yes, but users can avoid that by passing an @id argument.
[...]
^ permalink raw reply [flat|nested] 61+ messages in thread
* Re: [PULL 04/49] hw: Add QOM parentship relation with CPUs
2025-01-14 10:18 ` Igor Mammedov
2025-01-14 12:38 ` Markus Armbruster
@ 2025-01-14 14:38 ` Zhao Liu
2025-01-15 13:13 ` Igor Mammedov
1 sibling, 1 reply; 61+ messages in thread
From: Zhao Liu @ 2025-01-14 14:38 UTC (permalink / raw)
To: Igor Mammedov
Cc: Philippe Mathieu-Daudé, qemu-devel, Markus Armbruster,
Peter Xu
> I this specific case, one basically replaces /machine/unattached
> orphanage with explicit /machine one and many 'cpuN' children,
> which ain't any better than device[N].
>
> and in future I can imagine that at least in x86 case vcpus
> might have another parent depending on configuration.
> (i.e. being parented to cores instead)
I remember that this was your idea all along, and I'm not sure if you're
also referring to my previous patches about hybrid topology :-), which I'll
continue to refresh afterward in future (after all, the hybrid architecture
will continue in x86). And I think, since socket/core/thread are the three
default QEMU topology hierarchies, I understand that it would be best for
thread to always have core as parent.
^ permalink raw reply [flat|nested] 61+ messages in thread
* Re: [PULL 04/49] hw: Add QOM parentship relation with CPUs
2025-01-14 12:38 ` Markus Armbruster
@ 2025-01-15 10:19 ` Igor Mammedov
2025-01-15 17:44 ` Peter Xu
0 siblings, 1 reply; 61+ messages in thread
From: Igor Mammedov @ 2025-01-15 10:19 UTC (permalink / raw)
To: Markus Armbruster
Cc: Philippe Mathieu-Daudé, qemu-devel, Zhao Liu, Peter Xu
On Tue, 14 Jan 2025 13:38:59 +0100
Markus Armbruster <armbru@redhat.com> wrote:
> Igor Mammedov <imammedo@redhat.com> writes:
>
> > On Mon, 13 Jan 2025 17:00:55 +0100
> > Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
> >
> >> On 13/1/25 13:28, Igor Mammedov wrote:
> >> > On Sun, 12 Jan 2025 23:16:40 +0100
> >> > Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
> >> >
> >> >> QDev objects created with object_new() need to manually add
> >> >> their parent relationship with object_property_add_child().
> >> >>
> >> >> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> >> >> Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
> >> >> Message-Id: <20240216110313.17039-22-philmd@linaro.org>
> >> >> ---
> >> >> hw/i386/x86-common.c | 1 +
> >> >> hw/microblaze/petalogix_ml605_mmu.c | 1 +
> >> >> hw/microblaze/petalogix_s3adsp1800_mmu.c | 1 +
> >> >> hw/mips/cps.c | 1 +
> >> >> hw/ppc/e500.c | 1 +
> >> >> hw/ppc/spapr.c | 1 +
> >> >> 6 files changed, 6 insertions(+)
> >> >>
> >> >> diff --git a/hw/i386/x86-common.c b/hw/i386/x86-common.c
> >> >> index 97b4f7d4a0d..9c9ffb3484a 100644
> >> >> --- a/hw/i386/x86-common.c
> >> >> +++ b/hw/i386/x86-common.c
> >> >> @@ -60,6 +60,7 @@ static void x86_cpu_new(X86MachineState *x86ms, int64_t apic_id, Error **errp)
> >> >> if (!object_property_set_uint(cpu, "apic-id", apic_id, errp)) {
> >> >> goto out;
> >> >> }
> >> >> + object_property_add_child(OBJECT(x86ms), "cpu[*]", OBJECT(cpu));
> >> >
> >> > I might be missing something but why it needs to be done manually?
> >> >
> >> > device_set_realized() will place any parent-less device under (1) /machine/unattached
> >>
> >> This is exactly what we want to avoid, to eventually remove
> >> the "/machine/unattached" container for good.
> >>
> >> See "= Problem 4: The /machine/unattached/ orphanage =" in:
> >> https://lore.kernel.org/qemu-devel/87o7d1i7ky.fsf@pond.sub.org/
> >
> >
> > QOM paths as far as I'm aware were never part ABI nor I'm aware of
> > of any proposal to make it or some parts of it a public interface.
>
> We've been waffling on this since forever. QOM is not a public
> interface except when it is, and it is when somebody says so, and it
> isn't when somebody says so, resulting in a wave function that wobbles
> like an underdone souffle, but never quite collapses.
>
> > IMHO for public ABI, QEMU provides explicit QMP commands while
> > QOM should stay a playground for developers.
>
> Plenty of commands take QOM paths as arguments: eject,
> blockdev-open-tray, blockdev-close-tray, blockdev-remove-medium,
> blockdev-insert-medium, blockdev-change-medium,
> block-latency-histogram-set, cxl-inject-general-media-event,
> cxl-inject-dram-event, cxl-inject-memory-module-event,
> cxl-inject-poison, cxl-inject-uncorrectable-errors,
> cxl-inject-correctable-error, device_del, device-sync-config,
> query-stats, x-query-virtio-status, x-query-virtio-queue-status,
> x-query-virtio-vhost-queue-status, x-query-virtio-queue-element, and
> possibly more.
well, unless draw a line somewhere it will never stop.
Perhaps we should find on some border where QOM exposure stops
and document it. So whenever question pops up again, one could be
sent there.
all x- commands could be ignored, prefix tells no promises whatsoever,
cxl- group all new and doesn't have excuse to expose QOM, but not
many pay attention it subsystem considering it as platform bring up effort
> The only way their QOM path arguments can be used without relying on QOM
> paths being ABI would be obtaining the argument value with a command or
> from an event. I doubt that would be possible even if we tried it,
> which we haven't.
hotpluggable-cpu command might be an example (it returns vcpu path,
which is valid within vcpu lifetime). But then again it's for
devs convenience.
What I don't like about exposing QOM is
> > I this specific case, one basically replaces /machine/unattached
> > orphanage with explicit /machine one and many 'cpuN' children,
> > which ain't any better than device[N].
> >
> > and in future I can imagine that at least in x86 case vcpus
> > might have another parent depending on configuration.
> > (i.e. being parented to cores instead)
> >
> > If goal is to get rid of /machine/unattached, that's fine.
>
> /machine/unattached was a lazy mistake.
no argument here
>
> > But please not make brittle naming under /machine/unattached
> > as a reason as 'cpu[N]' is the same just in different place
> > and scattered all over code (hence doubts if it's any better than current way).
>
> Can you suggest a better, workable naming scheme?
nope, that's why I'm not arguing against it (modulo voicing my doubts)
PS:
Another question is if it's safe to move/rename device withing QOM tree
wrt migration (i.e. when 1st instance has old QOM tree and 2nd a modified one)
quick smoke test works (migrating from old qemu to a new one with this patch)
But it's better to ask to be safe.
> > (ps: don't we have exactly the same for peripheral-anon container)
>
> Yes, but users can avoid that by passing an @id argument.
>
> [...]
>
^ permalink raw reply [flat|nested] 61+ messages in thread
* Re: [PULL 04/49] hw: Add QOM parentship relation with CPUs
2025-01-14 14:38 ` Zhao Liu
@ 2025-01-15 13:13 ` Igor Mammedov
2025-01-15 14:07 ` Zhao Liu
0 siblings, 1 reply; 61+ messages in thread
From: Igor Mammedov @ 2025-01-15 13:13 UTC (permalink / raw)
To: Zhao Liu
Cc: Philippe Mathieu-Daudé, qemu-devel, Markus Armbruster,
Peter Xu
On Tue, 14 Jan 2025 22:38:30 +0800
Zhao Liu <zhao1.liu@intel.com> wrote:
> > I this specific case, one basically replaces /machine/unattached
> > orphanage with explicit /machine one and many 'cpuN' children,
> > which ain't any better than device[N].
> >
> > and in future I can imagine that at least in x86 case vcpus
> > might have another parent depending on configuration.
> > (i.e. being parented to cores instead)
>
> I remember that this was your idea all along, and I'm not sure if you're
> also referring to my previous patches about hybrid topology :-), which I'll
I'm sorry, I've should've reviewed it long time ago.
But it got lost in from my review queue, can you give me a pointer
to the latest you've posted, please?
> continue to refresh afterward in future (after all, the hybrid architecture
> will continue in x86). And I think, since socket/core/thread are the three
> default QEMU topology hierarchies, I understand that it would be best for
> thread to always have core as parent.
I guess it's fine as /machine/cpu[N] for now,
what I've initially wished for is commit message that explains
how do we get there and why it's done, so that later, whoever has to
touch that code would have an idea why it's there.
^ permalink raw reply [flat|nested] 61+ messages in thread
* Re: [PULL 04/49] hw: Add QOM parentship relation with CPUs
2025-01-15 13:13 ` Igor Mammedov
@ 2025-01-15 14:07 ` Zhao Liu
0 siblings, 0 replies; 61+ messages in thread
From: Zhao Liu @ 2025-01-15 14:07 UTC (permalink / raw)
To: Igor Mammedov
Cc: Philippe Mathieu-Daudé, qemu-devel, Markus Armbruster,
Peter Xu
> > I remember that this was your idea all along, and I'm not sure if you're
> > also referring to my previous patches about hybrid topology :-), which I'll
>
> I'm sorry, I've should've reviewed it long time ago.
> But it got lost in from my review queue, can you give me a pointer
> to the latest you've posted, please?
You are very kind, no need sorry :-). I have also been inspired by many
of your previous ideas (although my work may not fully meet your
expectations yet). Here are the links:
[1]: qom-topo series, which tries to abstract every topology levels as
devices and build a topology tree:
https://lore.kernel.org/qemu-devel/20240919015533.766754-1-zhao1.liu@intel.com/
[2]: hybird-topo series, based on [1], which allows i386 to customize
topology tree:
https://lore.kernel.org/qemu-devel/20240919061128.769139-1-zhao1.liu@intel.com/
Thanks,
Zhao
^ permalink raw reply [flat|nested] 61+ messages in thread
* Re: [PULL 04/49] hw: Add QOM parentship relation with CPUs
2025-01-15 10:19 ` Igor Mammedov
@ 2025-01-15 17:44 ` Peter Xu
2025-02-25 11:50 ` Igor Mammedov
0 siblings, 1 reply; 61+ messages in thread
From: Peter Xu @ 2025-01-15 17:44 UTC (permalink / raw)
To: Igor Mammedov
Cc: Markus Armbruster, Philippe Mathieu-Daudé, qemu-devel,
Zhao Liu
On Wed, Jan 15, 2025 at 11:19:28AM +0100, Igor Mammedov wrote:
> Another question is if it's safe to move/rename device withing QOM tree
> wrt migration (i.e. when 1st instance has old QOM tree and 2nd a modified one)
>
> quick smoke test works (migrating from old qemu to a new one with this patch)
> But it's better to ask to be safe.
I had a quick look, taking the simplest qemu64 cpu, I see two vmsds: "cpu"
+ "cpu_common", provided with different "instance_id" for each. That's the
ABI for the migration stream so far to match devices on two sides.
From that POV it's okay to move CPU devices within the qom-tree, hence not
yet part of the ABI. It matches with above tests that it would pass.
Though I'm not 100% sure this is wise either from migration POV.. because I
think we need to rely on strictly below on both sides of QEMU src/dst:
- Exactly the same QEMU cmdlines to be used (e.g. -smp X should be the
same on src/dst, or anything that creates the CPUs in cmdlines)
- Exactly the same QMP command to do device_add / device_del on CPUs,
with exactly the same parameters.
I suppose only above be guaranteed by the user (or, libvirt), could the
instance_id to be assigned be identical on both src/dst. But I'm not 100%
sure Libvirt can guarantee that. E.g., we have vhost-user bug that can see
different instance_id of some slirp instances after some plug/unplugs:
https://issues.redhat.com/browse/RHEL-56331
That might be slightly different topic, though, so the movement in the qom
tree so far looks ok..
--
Peter Xu
^ permalink raw reply [flat|nested] 61+ messages in thread
* Re: [PULL 04/49] hw: Add QOM parentship relation with CPUs
2025-01-15 17:44 ` Peter Xu
@ 2025-02-25 11:50 ` Igor Mammedov
0 siblings, 0 replies; 61+ messages in thread
From: Igor Mammedov @ 2025-02-25 11:50 UTC (permalink / raw)
To: Peter Xu
Cc: Markus Armbruster, Philippe Mathieu-Daudé, qemu-devel,
Zhao Liu
On Wed, 15 Jan 2025 12:44:54 -0500
Peter Xu <peterx@redhat.com> wrote:
> On Wed, Jan 15, 2025 at 11:19:28AM +0100, Igor Mammedov wrote:
> > Another question is if it's safe to move/rename device withing QOM tree
> > wrt migration (i.e. when 1st instance has old QOM tree and 2nd a modified one)
> >
> > quick smoke test works (migrating from old qemu to a new one with this patch)
> > But it's better to ask to be safe.
>
> I had a quick look, taking the simplest qemu64 cpu, I see two vmsds: "cpu"
> + "cpu_common", provided with different "instance_id" for each. That's the
> ABI for the migration stream so far to match devices on two sides.
>
> From that POV it's okay to move CPU devices within the qom-tree, hence not
> yet part of the ABI. It matches with above tests that it would pass.
>
> Though I'm not 100% sure this is wise either from migration POV.. because I
> think we need to rely on strictly below on both sides of QEMU src/dst:
>
> - Exactly the same QEMU cmdlines to be used (e.g. -smp X should be the
> same on src/dst, or anything that creates the CPUs in cmdlines)
> - Exactly the same QMP command to do device_add / device_del on CPUs,
> with exactly the same parameters.
-smp X must be the same, but -device/device_(add|del) don't need to be
in the same order as ('cpu' and 'cpu_common') take it from cpu_index,
which is overridden to stable value (-smp topo based) by machines
that care about cpu hotplug and migration.
For machines that do not have cpu hotplug and do not override cpu_index
only -smp X matters and it stays the same.
That will break only if order of vCPUs creation is changed in a board code
(not impossible but for boards where we care about migration we usually
would pay attention to such reordering) and pretty soon get reports about
broken migration if it get merged.
To test for such case, we basically need to keep old QEMU binaries
and test cross version migration.
>
> I suppose only above be guaranteed by the user (or, libvirt), could the
> instance_id to be assigned be identical on both src/dst. But I'm not 100%
> sure Libvirt can guarantee that. E.g., we have vhost-user bug that can see
> different instance_id of some slirp instances after some plug/unplugs:
>
> https://issues.redhat.com/browse/RHEL-56331
>
> That might be slightly different topic, though, so the movement in the qom
> tree so far looks ok..
>
^ permalink raw reply [flat|nested] 61+ messages in thread
end of thread, other threads:[~2025-02-25 11:51 UTC | newest]
Thread overview: 61+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-12 22:16 [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 01/49] pc-bios/meson.build: Silent unuseful DTC warnings Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 02/49] target: Replace DEVICE(object_new) -> qdev_new() Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 03/49] hw: " Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 04/49] hw: Add QOM parentship relation with CPUs Philippe Mathieu-Daudé
2025-01-13 12:28 ` Igor Mammedov
2025-01-13 16:00 ` Philippe Mathieu-Daudé
2025-01-14 10:18 ` Igor Mammedov
2025-01-14 12:38 ` Markus Armbruster
2025-01-15 10:19 ` Igor Mammedov
2025-01-15 17:44 ` Peter Xu
2025-02-25 11:50 ` Igor Mammedov
2025-01-14 14:38 ` Zhao Liu
2025-01-15 13:13 ` Igor Mammedov
2025-01-15 14:07 ` Zhao Liu
2025-01-12 22:16 ` [PULL 05/49] hw/usb: Inline usb_try_new() Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 06/49] hw/usb: Inline usb_new() Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 07/49] hw/microblaze: Restrict MemoryRegionOps are implemented as 32-bit Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 08/49] hw/net/xilinx_ethlite: Map MDIO registers (as unimplemented) Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 09/49] hw/net/xilinx_ethlite: Introduce txbuf_ptr() helper Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 10/49] hw/net/xilinx_ethlite: Introduce rxbuf_ptr() helper Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 11/49] hw/net/xilinx_ethlite: Access TX_GIE register for each port Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 12/49] hw/net/xilinx_ethlite: Access TX_LEN " Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 13/49] hw/net/xilinx_ethlite: Access TX_CTRL " Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 14/49] hw/net/xilinx_ethlite: Map RX_CTRL as MMIO Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 15/49] hw/net/xilinx_ethlite: Map TX_LEN " Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 16/49] hw/net/xilinx_ethlite: Map TX_GIE " Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 17/49] hw/net/xilinx_ethlite: Map TX_CTRL " Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 18/49] hw/net/xilinx_ethlite: Map the RAM buffer as RAM memory region Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 19/49] hw/net/xilinx_ethlite: Rename 'mmio' MR as 'container' Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 20/49] hw/net/xilinx_ethlite: Map RESERVED I/O as unimplemented Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 21/49] docs/nitro-enclave: Clarify Enclave and Firecracker relationship Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 22/49] hw/misc/vmcoreinfo: Rename VMCOREINFO_DEVICE -> TYPE_VMCOREINFO Philippe Mathieu-Daudé
2025-01-12 22:16 ` [PULL 23/49] hw/misc/vmcoreinfo: Convert to three-phase reset interface Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 24/49] hw/pci: Rename has_power to enabled Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 25/49] hw/ufs: Adjust value to match CPU's endian format Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 26/49] hw/sd/sdhci: Set SDHC_NIS_DMA bit when appropriate Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 27/49] hw/sd/sdhci: Factor sdhci_sdma_transfer() out Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 28/49] hw/char/stm32f2xx_usart: replace print with trace Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 29/49] hw/timer/imx_gpt: Remove unused define Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 30/49] tests/qtest/libqos: Reuse TYPE_IMX_I2C define Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 31/49] hw/misc/imx6_src: Convert DPRINTF() to trace events Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 32/49] hw/char/imx_serial: Turn some DPRINTF() statements into " Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 33/49] hw/i2c/imx_i2c: Convert DPRINTF() to " Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 34/49] hw/gpio/imx_gpio: Turn DPRINTF() into " Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 35/49] tests/qtest/boot-serial-test: Correct HPPA machine name Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 36/49] tests: Add functional tests for HPPA machines Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 37/49] target/hppa: Convert hppa_cpu_init() to ResetHold handler Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 38/49] hw/hppa: Reset vCPUs calling resettable_reset() Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 39/49] target/hppa: Only set PSW 'M' bit on reset Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 40/49] target/hppa: Set PC on vCPU reset Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 41/49] target/hppa: Speed up hppa_is_pa20() Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 42/49] hw/loongarch/virt: Checkpatch cleanup Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 43/49] backends/cryptodev-vhost-user: Fix local_error leaks Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 44/49] hw/usb/hcd-xhci-pci: Use event ring 0 if mapping unsupported Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 45/49] hw/tricore/triboard: Remove unnecessary use of &first_cpu Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 46/49] MAINTAINERS: remove myself from sbsa-ref Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 47/49] MAINTAINERS: Add me as the maintainer for ivshmem-flat Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 48/49] MAINTAINERS: Update path to coreaudio.m Philippe Mathieu-Daudé
2025-01-12 22:17 ` [PULL 49/49] Add a b4 configuration file Philippe Mathieu-Daudé
2025-01-13 15:40 ` [PULL 00/49] Misc HW patches for 2025-01-12 Philippe Mathieu-Daudé
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).