Misc HW patches for 2025-01-12
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
Signature · 1 line
2.47.1
[PULL 01/49] pc-bios/meson.build: Silent unuseful DTC warnings
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.
Message-Id: <[email protected]>
--- pc-bios/meson.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
pc-bios/meson.build +2 -1
@@ -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
Signature · 1 line
2.47.1
[PULL 02/49] target: Replace DEVICE(object_new) -> qdev_new()
In reply to Philippe Mathieu-DaudéPrefer QDev API for QDev objects, avoid the underlying QOM layer.
Message-Id: <[email protected]>
--- target/mips/cpu.c | 2 +- target/xtensa/cpu.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
target/mips/cpu.c +1 -1
@@ -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);
target/xtensa/cpu.c +1 -1
@@ -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);
Signature · 1 line
2.47.1
[PULL 06/49] hw/usb: Inline usb_new()
In reply to Philippe Mathieu-DaudéInline the 3 uses of usb_new().
Message-Id: <[email protected]>
--- include/hw/usb.h | 7 +------ hw/usb/bus.c | 3 ++- hw/usb/dev-serial.c | 2 +- 3 files changed, 4 insertions(+), 8 deletions(-)
include/hw/usb.h +1 -6
@@ -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 **erstatic 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;
hw/usb/bus.c +2 -1
@@ -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 ;
hw/usb/dev-serial.c +1 -1
@@ -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; }
Signature · 1 line
2.47.1
[PULL 05/49] hw/usb: Inline usb_try_new()
In reply to Philippe Mathieu-DaudéInline the single use of usb_try_new().
Message-Id: <[email protected]>
--- include/hw/usb.h | 5 ----- hw/usb/bus.c | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-)
include/hw/usb.h +0 -5
@@ -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);
hw/usb/bus.c +1 -1
@@ -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 ); }
Signature · 1 line
2.47.1
[PULL 03/49] hw: Replace DEVICE(object_new) -> qdev_new()
In reply to Philippe Mathieu-DaudéPrefer QDev API for QDev objects, avoid the underlying QOM layer.
Message-Id: <[email protected]>
--- hw/arm/musicpal.c | 2 +- hw/sparc/sun4m.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
hw/arm/musicpal.c +1 -1
@@ -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,
hw/sparc/sun4m.c +2 -2
@@ -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);
Signature · 1 line
2.47.1
[PULL 04/49] hw: Add QOM parentship relation with CPUs
In reply to Philippe Mathieu-DaudéQDev objects created with object_new() need to manually add their parent relationship with object_property_add_child().
Message-Id: <[email protected]>
--- 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(+)
hw/i386/x86-common.c +1 -0
@@ -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:
hw/microblaze/petalogix_ml605_mmu.c +1 -0
@@ -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
hw/microblaze/petalogix_s3adsp1800_mmu.c +1 -0
@@ -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);
hw/mips/cps.c +1 -0
@@ -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 ; }
hw/ppc/e500.c +1 -0
@@ -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) {
hw/ppc/spapr.c +1 -0
@@ -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);
Signature · 1 line
2.47.1
Re: [PULL 04/49] hw: Add QOM parentship relation with CPUs
Quoted 20 lines · On Sun, 12 Jan 2025 23:16:40 +0100 Philippe Mathieu-Daudé <[email protected]>…
QDev objects created with
object_new()need to manually add their parent relationship withobject_property_add_child().Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Zhao Liu <[email protected]>Message-Id: <[email protected]>
--- 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(+)hw/i386/x86-common.c +0
-0
hw/i386/x86-common.c static void x86_cpu_new(X86MachineState *x86ms, int64_t apic_id, Error **errp) · line 63
Quoted 4 lines
hw/i386/x86-common.c +1
-0@@ -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.
Quoted 63 lines
hw/i386/x86-common.c +0
-0qdev_realize (DEVICE (cpu),NULL , errp); out:hw/microblaze/petalogix_ml605_mmu.c +1
-0@@ -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 hw/microblaze/petalogix_s3adsp1800_mmu.c +1
-0@@ -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);hw/mips/cps.c +1
-0@@ -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 ; }hw/ppc/e500.c +1
-0@@ -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) {hw/ppc/spapr.c +1
-0@@ -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);
Re: [PULL 04/49] hw: Add QOM parentship relation with CPUs
Quoted 30 lines · Igor Mammedov
Quoted 20 lines · On Sun, 12 Jan 2025 23:16:40 +0100 Philippe Mathieu-Daudé <[email protected]>…
QDev objects created with
object_new()need to manually add their parent relationship withobject_property_add_child().Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Zhao Liu <[email protected]>Message-Id: <[email protected]>
--- 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(+)hw/i386/x86-common.c +0
-0hw/i386/x86-common.c static void x86_cpu_new(X86MachineState *x86ms, int64_t apic_id, Error **errp) · line 63
Quoted 4 lines
hw/i386/x86-common.c +1
-0@@ -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?
Quoted 1 line
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/[email protected]/
Quoted 4 lines
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.
Quoted 7 lines
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.
Quoted 3 lines
hw/i386/x86-common.c +0
-0qdev_realize (DEVICE (cpu),NULL , errp); out:
Re: [PULL 04/49] hw: Add QOM parentship relation with CPUs
Quoted 31 lines · On Mon, 13 Jan 2025 17:00:55 +0100 Philippe Mathieu-Daudé <[email protected]>…
Quoted 30 lines · Igor Mammedov
Quoted 20 lines · On Sun, 12 Jan 2025 23:16:40 +0100 Philippe Mathieu-Daudé <[email protected]>…
QDev objects created with
object_new()need to manually add their parent relationship withobject_property_add_child().Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Zhao Liu <[email protected]>Message-Id: <[email protected]>
--- 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(+)hw/i386/x86-common.c +0
-0hw/i386/x86-common.c static void x86_cpu_new(X86MachineState *x86ms, int64_t apic_id, Error **errp) · line 63
Quoted 4 lines
hw/i386/x86-common.c +1
-0@@ -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?
Quoted 7 lines
Quoted 1 line
device_set_realized()will place any parent-less device under (1) /machine/unattachedThis 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/[email protected]/
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)
Quoted 15 lines
Quoted 4 lines
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.
Quoted 7 lines
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.
Quoted 3 lines
hw/i386/x86-common.c +0
-0qdev_realize (DEVICE (cpu),NULL , errp); out:
Re: [PULL 04/49] hw: Add QOM parentship relation with CPUs
Quoted 39 lines · Igor Mammedov
Quoted 36 lines · On Mon, 13 Jan 2025 17:00:55 +0100 Philippe Mathieu-Daudé <[email protected]>…
Quoted 30 lines · Igor Mammedov
Quoted 20 lines · On Sun, 12 Jan 2025 23:16:40 +0100 Philippe Mathieu-Daudé <[email protected]>…
QDev objects created with
object_new()need to manually add their parent relationship withobject_property_add_child().Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Zhao Liu <[email protected]>Message-Id: <[email protected]>
--- 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(+)hw/i386/x86-common.c +0
-0hw/i386/x86-common.c static void x86_cpu_new(X86MachineState *x86ms, int64_t apic_id, Error **errp) · line 63
Quoted 4 lines
hw/i386/x86-common.c +1
-0@@ -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?
Quoted 1 line
device_set_realized()will place any parent-less device under (1) /machine/unattachedThis is exactly what we want to avoid, to eventually remove the "/machine/unattached" container for good.
Quoted 6 lines
Quoted 2 lines
See "= Problem 4: The /machine/unattached/ orphanage =" in:
https://lore.kernel.org/qemu-devel/[email protected]/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.
Quoted 2 lines
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.
Quoted 9 lines
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.
Quoted 3 lines
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?
Quoted 1 line
(ps: don't we have exactly the same for peripheral-anon container)
Yes, but users can avoid that by passing an @id argument.
[...]
Re: [PULL 04/49] hw: Add QOM parentship relation with CPUs
Quoted 56 lines · On Tue, 14 Jan 2025 13:38:59 +0100 Markus Armbruster <[email protected]> wrote:
Quoted 39 lines · Igor Mammedov
Quoted 36 lines · On Mon, 13 Jan 2025 17:00:55 +0100 Philippe Mathieu-Daudé <[email protected]>…
Quoted 30 lines · Igor Mammedov
Quoted 20 lines · On Sun, 12 Jan 2025 23:16:40 +0100 Philippe Mathieu-Daudé <[email protected]>…
QDev objects created with
object_new()need to manually add their parent relationship withobject_property_add_child().Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Zhao Liu <[email protected]>Message-Id: <[email protected]>
--- 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(+)hw/i386/x86-common.c +0
-0hw/i386/x86-common.c static void x86_cpu_new(X86MachineState *x86ms, int64_t apic_id, Error **errp) · line 63
Quoted 4 lines
hw/i386/x86-common.c +1
-0@@ -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?
Quoted 1 line
device_set_realized()will place any parent-less device under (1) /machine/unattachedThis is exactly what we want to avoid, to eventually remove the "/machine/unattached" container for good.
Quoted 6 lines
Quoted 2 lines
See "= Problem 4: The /machine/unattached/ orphanage =" in:
https://lore.kernel.org/qemu-devel/[email protected]/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.
Quoted 2 lines
IMHO for public ABI, QEMU provides explicit QMP commands while QOM should stay a playground for developers.
Quoted 10 lines
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
Quoted 4 lines
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
Quoted 11 lines
Quoted 9 lines
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
Quoted 6 lines
Quoted 4 lines
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.
Quoted 6 lines
Quoted 1 line
(ps: don't we have exactly the same for peripheral-anon container)
Yes, but users can avoid that by passing an @id argument.
[...]
Re: [PULL 04/49] hw: Add QOM parentship relation with CPUs
Quoted 5 lines · Igor Mammedov
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..
Signature · 1 line
Peter Xu
Re: [PULL 04/49] hw: Add QOM parentship relation with CPUs
Quoted 14 lines · On Wed, 15 Jan 2025 12:44:54 -0500 Peter Xu <[email protected]> wrote:
Quoted 5 lines · Igor Mammedov
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.
Quoted 7 lines
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 dodevice_add/device_delon 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.
Quoted 11 lines
I suppose only above be guaranteed by the user (or, libvirt), could the
instance_idto 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 differentinstance_idof 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..
Re: [PULL 04/49] hw: Add QOM parentship relation with CPUs
In reply to Igor MammedovQuoted 7 lines
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.
Re: [PULL 04/49] hw: Add QOM parentship relation with CPUs
Quoted 10 lines · On Tue, 14 Jan 2025 22:38:30 +0800 Zhao Liu <[email protected]> wrote:
Quoted 7 lines
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?
Quoted 4 lines
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.
Re: [PULL 04/49] hw: Add QOM parentship relation with CPUs
Quoted 6 lines
Quoted 2 lines
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/[email protected]/
[2]: hybird-topo series, based on [1], which allows i386 to customize
topology tree:
https://lore.kernel.org/qemu-devel/[email protected]/Thanks,
Zhao
[PULL 13/49] hw/net/xilinx_ethlite: Access TX_CTRL register for each port
In reply to Philippe Mathieu-Daudé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.
Message-Id: <[email protected]>
--- hw/net/xilinx_ethlite.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
hw/net/xilinx_ethlite.c +7 -8
@@ -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. */
Signature · 1 line
2.47.1
[PULL 15/49] hw/net/xilinx_ethlite: Map TX_LEN as MMIO
In reply to Philippe Mathieu-Daudé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]ioMessage-Id: <[email protected]>
--- hw/net/xilinx_ethlite.c | 73 ++++++++++++++++++++++++++++++++++------- 1 file changed, 61 insertions(+), 12 deletions(-)
hw/net/xilinx_ethlite.c +61 -12
@@ -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",
Signature · 1 line
2.47.1
[PULL 14/49] hw/net/xilinx_ethlite: Map RX_CTRL as MMIO
In reply to Philippe Mathieu-Daudé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]ioMessage-Id: <[email protected]>
--- hw/net/xilinx_ethlite.c | 82 +++++++++++++++++++++++++++++++++-------- 1 file changed, 67 insertions(+), 15 deletions(-)
hw/net/xilinx_ethlite.c +67 -15
@@ -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,
Signature · 1 line
2.47.1
[PULL 11/49] hw/net/xilinx_ethlite: Access TX_GIE register for each port
In reply to Philippe Mathieu-Daudé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.
Message-Id: <[email protected]>
--- hw/net/xilinx_ethlite.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
hw/net/xilinx_ethlite.c +10 -2
@@ -62,6 +62,8 @@typedef struct XlnxXpsEthLitePort {struct { +uint32_t tx_gie; +uint32_t rx_ctrl; } reg; }XlnxXpsEthLitePort ;
@@ -90,7 +92,7 @@ struct XlnxXpsEthLitestatic 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 ;
Signature · 1 line
2.47.1
[PULL 12/49] hw/net/xilinx_ethlite: Access TX_LEN register for each port
In reply to Philippe Mathieu-Daudé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.
Message-Id: <[email protected]>
--- hw/net/xilinx_ethlite.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
hw/net/xilinx_ethlite.c +6 -2
@@ -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 :
Signature · 1 line
2.47.1
[PULL 18/49] hw/net/xilinx_ethlite: Map the RAM buffer as RAM memory region
In reply to Philippe Mathieu-Daudé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]ioMessage-Id: <[email protected]>
--- hw/net/xilinx_ethlite.c | 81 +++++++++-------------------------------- 1 file changed, 17 insertions(+), 64 deletions(-)
hw/net/xilinx_ethlite.c +17 -64
@@ -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 XlnxXpsEthLiteUnimplementedDeviceState 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); }
Signature · 1 line
2.47.1
[PULL 07/49] hw/microblaze: Restrict MemoryRegionOps are implemented as 32-bit
In reply to Philippe Mathieu-DaudéAll these MemoryRegionOps read() and write() handlers are implemented expecting 32-bit accesses. Clarify that setting .impl.min/max_access_size fields.
Message-Id: <[email protected]>
--- hw/intc/xilinx_intc.c | 4 ++++ hw/net/xilinx_ethlite.c | 4 ++++ hw/timer/xilinx_timer.c | 4 ++++ 3 files changed, 12 insertions(+)
hw/intc/xilinx_intc.c +4 -0
@@ -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
hw/net/xilinx_ethlite.c +4 -0
@@ -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
hw/timer/xilinx_timer.c +4 -0
@@ -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
Signature · 1 line
2.47.1
[PULL 20/49] hw/net/xilinx_ethlite: Map RESERVED I/O as unimplemented
In reply to Philippe Mathieu-Daudé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]ioMessage-Id: <[email protected]>
--- hw/net/xilinx_ethlite.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
hw/net/xilinx_ethlite.c +11 -0
@@ -94,6 +94,7 @@ struct XlnxXpsEthLiteuint32_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" );
Signature · 1 line
2.47.1
[PULL 21/49] docs/nitro-enclave: Clarify Enclave and Firecracker relationship
In reply to Philippe Mathieu-DaudéFrom: Alexander Graf <[email protected]>
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".
Message-ID: <[email protected]>
--- docs/system/i386/nitro-enclave.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
docs/system/i386/nitro-enclave.rst +1 -1
@@ -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
Signature · 1 line
2.47.1
[PULL 35/49] tests/qtest/boot-serial-test: Correct HPPA machine name
In reply to Philippe Mathieu-Daudé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.
Message-Id: <[email protected]>
--- tests/qtest/boot-serial-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qtest/boot-serial-test.c +1 -1
@@ -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 },
Signature · 1 line
2.47.1
[PULL 08/49] hw/net/xilinx_ethlite: Map MDIO registers (as unimplemented)
In reply to Philippe Mathieu-Daudé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 @00000000000007f4Message-Id: <[email protected]>
--- hw/net/xilinx_ethlite.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
hw/net/xilinx_ethlite.c +12 -0
@@ -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 XlnxXpsEthLiteuint32_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,
Signature · 1 line
2.47.1
[PULL 40/49] target/hppa: Set PC on vCPU reset
In reply to Philippe Mathieu-DaudéFrom: Helge Deller <[email protected]>
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.
Message-Id: <[email protected]>
--- target/hppa/cpu.c | 1 + 1 file changed, 1 insertion(+)
target/hppa/cpu.c +1 -0
@@ -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));
Signature · 1 line
2.47.1
[PULL 39/49] target/hppa: Only set PSW 'M' bit on reset
In reply to Philippe Mathieu-Daudé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.
Message-Id: <[email protected]>
--- target/hppa/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/hppa/cpu.c +1 -1
@@ -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)
Signature · 1 line
2.47.1
[PULL 22/49] hw/misc/vmcoreinfo: Rename VMCOREINFO_DEVICE -> TYPE_VMCOREINFO
In reply to Philippe Mathieu-DaudéFollow the assumed QOM type definition style, prefixing with 'TYPE_', and dropping the '_DEVICE' suffix which doesn't add any value.
Message-Id: <[email protected]>
--- include/hw/misc/vmcoreinfo.h | 7 +++---- hw/misc/vmcoreinfo.c | 6 +++--- 2 files changed, 6 insertions(+), 7 deletions(-)
include/hw/misc/vmcoreinfo.h +3 -4
@@ -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 ; }
hw/misc/vmcoreinfo.c +3 -3
@@ -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,
Signature · 1 line
2.47.1
[PULL 32/49] hw/char/imx_serial: Turn some DPRINTF() statements into trace events
In reply to Philippe Mathieu-DaudéFrom: Bernhard Beschow <[email protected]>
Message-ID: <[email protected]>
--- hw/char/imx_serial.c | 58 +++++++++++++++++++++++++++++--------------- hw/char/trace-events | 5 ++++ 2 files changed, 44 insertions(+), 19 deletions(-)
hw/char/imx_serial.c +39 -19
@@ -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 ;
hw/char/trace-events +5 -0
@@ -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"
Signature · 1 line
2.47.1
[PULL 45/49] hw/tricore/triboard: Remove unnecessary use of &first_cpu
In reply to Philippe Mathieu-Daudé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.
Message-Id: <[email protected]>
--- hw/tricore/triboard.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
hw/tricore/triboard.c +2 -4
@@ -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); } }
Signature · 1 line
2.47.1
[PULL 43/49] backends/cryptodev-vhost-user: Fix local_error leaks
In reply to Philippe Mathieu-DaudéFrom: Gabriel Barrantes <[email protected]>
Do not propagate error to the upper, directly output the error to avoid leaks.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2714
Message-Id: <DM8PR13MB50781054A4FDACE6F4FB6469B30F2@DM8PR13MB5078.namprd13.prod.outlook.com>
--- backends/cryptodev-vhost-user.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
backends/cryptodev-vhost-user.c +1 -2
@@ -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 ; }
Signature · 1 line
2.47.1
[PULL 46/49] MAINTAINERS: remove myself from sbsa-ref
In reply to Philippe Mathieu-DaudéFrom: Marcin Juszkiewicz <[email protected]>
I am ending my time with Linaro and do not have plans to continue working on SBSA Reference Platform anymore.
Message-ID: <[email protected]>
--- MAINTAINERS | 1 - 1 file changed, 1 deletion(-)
MAINTAINERS +0 -1
@@ -923,7 +923,6 @@ SBSA-REF M: Radoslaw Biernacki <[email protected]> M: Peter Maydell <[email protected]> R: Leif Lindholm <[email protected]> -R: Marcin Juszkiewicz <[email protected]> L: [email protected] S: Maintained F: hw/arm/sbsa-ref.c
Signature · 1 line
2.47.1
[PULL 19/49] hw/net/xilinx_ethlite: Rename 'mmio' MR as 'container'
In reply to Philippe Mathieu-DaudéHaving all its address range mapped by subregions, s->mmio MemoryRegion effectively became a container. Rename it as 'container' for clarity.
Message-Id: <[email protected]>
--- hw/net/xilinx_ethlite.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
hw/net/xilinx_ethlite.c +8 -8
@@ -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[] = {
Signature · 1 line
2.47.1
[PULL 48/49] MAINTAINERS: Update path to coreaudio.m
In reply to Philippe Mathieu-DaudéFrom: Akihiko Odaki <[email protected]>
Commit 8b46d7e2dc8e ("audio: Rename coreaudio extension to use Objective-C compiler") renamed coreaudio.c to coreaudio.m.
Message-ID: <[email protected]>
--- MAINTAINERS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
MAINTAINERS +2 -2
@@ -2800,7 +2800,7 @@ M: Marc-André Lureau <[email protected]> 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é <[email protected]> R: Christian Schoenebeck <[email protected]> R: Akihiko Odaki <[email protected]> S: Odd Fixes -F: audio/coreaudio.c +F: audio/coreaudio.m DSound Audio backend M: Gerd Hoffmann <[email protected]>
Signature · 1 line
2.47.1
[PULL 30/49] tests/qtest/libqos: Reuse TYPE_IMX_I2C define
In reply to Philippe Mathieu-DaudéFrom: Bernhard Beschow <[email protected]>
Message-ID: <[email protected]>
--- tests/qtest/libqos/arm-imx25-pdk-machine.c | 5 +++-- tests/qtest/libqos/i2c-imx.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-)
tests/qtest/libqos/arm-imx25-pdk-machine.c +3 -2
@@ -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);
tests/qtest/libqos/i2c-imx.c +2 -2
@@ -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);
Signature · 1 line
2.47.1
[PULL 47/49] MAINTAINERS: Add me as the maintainer for ivshmem-flat
In reply to Philippe Mathieu-DaudéFrom: Gustavo Romero <[email protected]>
Add me as the maintainer for the ivshmem-flat device.
Message-ID: <[email protected]>
--- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+)
MAINTAINERS +7 -0
@@ -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 <[email protected]> +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
Signature · 1 line
2.47.1
[PULL 33/49] hw/i2c/imx_i2c: Convert DPRINTF() to trace events
In reply to Philippe Mathieu-DaudéFrom: Bernhard Beschow <[email protected]>
Also print the QOM canonical path when tracing which allows for distinguishing the many instances a typical i.MX SoC has.
Message-ID: <[email protected]>
--- hw/i2c/imx_i2c.c | 21 +++++---------------- hw/i2c/trace-events | 5 +++++ 2 files changed, 10 insertions(+), 16 deletions(-)
hw/i2c/imx_i2c.c +5 -16
@@ -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 ;
hw/i2c/trace-events +5 -0
@@ -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
Signature · 1 line
2.47.1
[PULL 24/49] hw/pci: Rename has_power to enabled
In reply to Philippe Mathieu-DaudéFrom: Akihiko Odaki <[email protected]>
The renamed state will not only represent powering state of PFs, but also represent SR-IOV VF enablement in the future.
Message-ID: <[email protected]>
--- 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(-)
include/hw/pci/pci.h +1 -0
@@ -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
include/hw/pci/pci_device.h +1 -1
@@ -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;
hw/pci/pci.c +11 -6
@@ -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, intpci_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); } }
hw/pci/pci_host.c +2 -2
@@ -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 ; }
Signature · 1 line
2.47.1
[PULL 17/49] hw/net/xilinx_ethlite: Map TX_CTRL as MMIO
In reply to Philippe Mathieu-Daudé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]ioMessage-Id: <[email protected]>
--- hw/net/xilinx_ethlite.c | 54 ++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 30 deletions(-)
hw/net/xilinx_ethlite.c +24 -30
@@ -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 ;
Signature · 1 line
2.47.1
[PULL 38/49] hw/hppa: Reset vCPUs calling resettable_reset()
In reply to Philippe Mathieu-DaudéFrom: Helge Deller <[email protected]>
Rather than manually (and incompletely) resetting vCPUs, call resettable_reset() which will fully reset the vCPUs. Remove redundant assignations.
Message-Id: <[email protected]>
--- hw/hppa/machine.c | 6 +++--- target/hppa/cpu.c | 1 + 2 files changed, 4 insertions(+), 3 deletions(-)
hw/hppa/machine.c +3 -3
@@ -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()? */
target/hppa/cpu.c +1 -0
@@ -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));
Signature · 1 line
2.47.1
[PULL 36/49] tests: Add functional tests for HPPA machines
In reply to Philippe Mathieu-Daudé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.
Message-Id: <[email protected]>
--- 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
MAINTAINERS +1 -0
@@ -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 ------------------
tests/qtest/boot-serial-test.c +0 -2
@@ -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 },
tests/functional/meson.build +4 -0
@@ -104,6 +104,10 @@ tests_avr_system_thorough = [ 'avr_mega2560', ] +tests_hppa_system_quick = [ + 'hppa_seabios', +] + tests_i386_system_thorough = [ 'i386_tuxrun', ]
tests/functional/test_hppa_seabios.py new file +35 -0
@@ -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()
tests/qtest/meson.build +1 -1
@@ -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'] : [])
Signature · 1 line
2.47.1
[PULL 09/49] hw/net/xilinx_ethlite: Introduce txbuf_ptr() helper
In reply to Philippe Mathieu-Daudé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.
Message-Id: <[email protected]>
--- hw/net/xilinx_ethlite.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
hw/net/xilinx_ethlite.c +16 -2
@@ -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); }
Signature · 1 line
2.47.1
[PULL 25/49] hw/ufs: Adjust value to match CPU's endian format
In reply to Philippe Mathieu-DaudéFrom: Keoseong Park <[email protected]>
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.
Message-ID: <20250107084356epcms2p2af4d86432174d76ea57336933e46b4c3@epcms2p2>
--- hw/ufs/ufs.c | 2 +- tests/qtest/ufs-test.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
hw/ufs/ufs.c +1 -1
@@ -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);
tests/qtest/ufs-test.c +1 -1
@@ -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));
Signature · 1 line
2.47.1
[PULL 29/49] hw/timer/imx_gpt: Remove unused define
In reply to Philippe Mathieu-DaudéFrom: Bernhard Beschow <[email protected]>
Message-ID: <[email protected]>
--- hw/timer/imx_gpt.c | 4 ---- 1 file changed, 4 deletions(-)
hw/timer/imx_gpt.c +0 -4
@@ -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) {
Signature · 1 line
2.47.1
[PULL 44/49] hw/usb/hcd-xhci-pci: Use event ring 0 if mapping unsupported
In reply to Philippe Mathieu-DaudéFrom: Phil Dennis-Jordan <[email protected]>
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.
Message-ID: <[email protected]>
--- hw/usb/hcd-xhci.c | 4 ++++ 1 file changed, 4 insertions(+)
hw/usb/hcd-xhci.c +4 -0
@@ -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 ;
Signature · 1 line
2.47.1
[PULL 23/49] hw/misc/vmcoreinfo: Convert to three-phase reset interface
In reply to Philippe Mathieu-DaudéMessage-Id: <[email protected]>
--- hw/misc/vmcoreinfo.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
hw/misc/vmcoreinfo.c +5 -3
@@ -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[] = {
Signature · 1 line
2.47.1
[PULL 31/49] hw/misc/imx6_src: Convert DPRINTF() to trace events
In reply to Philippe Mathieu-DaudéFrom: Bernhard Beschow <[email protected]>
Message-ID: <[email protected]>
--- hw/misc/imx6_src.c | 23 +++++------------------ hw/misc/trace-events | 6 ++++++ 2 files changed, 11 insertions(+), 18 deletions(-)
hw/misc/imx6_src.c +5 -18
@@ -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;
hw/misc/trace-events +6 -0
@@ -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
Signature · 1 line
2.47.1
[PULL 49/49] Add a b4 configuration file
In reply to Philippe Mathieu-DaudéFrom: Jiaxun Yang <[email protected]>
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 <[email protected]>
---
Changes in v2:
- Add lore masks (philmd) from:
https://lore.kernel.org/qemu-devel/[email protected]/
- Link to v1: https://lore.kernel.org/r/[email protected]
---
● 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: [email protected]
---
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/
Message-ID: <[email protected]>
--- MAINTAINERS | 6 ++++++ .b4-config | 14 ++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 .b4-config
MAINTAINERS +6 -0
@@ -4310,3 +4310,9 @@ Machine development tool M: Maksim Davydov <[email protected]> S: Supported F: scripts/compare-machine-types.py + +b4 tool configuration +M: Jiaxun Yang <[email protected]> +M: Philippe Mathieu-Daudé <[email protected]> +S: Odd Fixes +F: .b4-config
.b4-config new file +14 -0
@@ -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 = [email protected] + 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>
Signature · 1 line
2.47.1
[PULL 27/49] hw/sd/sdhci: Factor sdhci_sdma_transfer() out
In reply to Philippe Mathieu-Daudé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.
Message-Id: <[email protected]>
--- hw/sd/sdhci.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
hw/sd/sdhci.c +11 -11
@@ -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 ;
Signature · 1 line
2.47.1
[PULL 28/49] hw/char/stm32f2xx_usart: replace print with trace
In reply to Philippe Mathieu-DaudéFrom: Nikita Shubin <[email protected]>
Drop debug printing macros and replace them with according trace functions.
Message-ID: <[email protected]>
--- hw/char/stm32f2xx_usart.c | 49 ++++++++++++++++++--------------------- hw/char/trace-events | 6 +++++ 2 files changed, 29 insertions(+), 26 deletions(-)
hw/char/stm32f2xx_usart.c +23 -26
@@ -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 :
hw/char/trace-events +6 -0
@@ -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'"
Signature · 1 line
2.47.1
[PULL 26/49] hw/sd/sdhci: Set SDHC_NIS_DMA bit when appropriate
In reply to Philippe Mathieu-DaudéFrom: Bernhard Beschow <[email protected]>
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.
Message-ID: <[email protected]>
--- hw/sd/sdhci.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
hw/sd/sdhci.c +8 -3
@@ -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); }
Signature · 1 line
2.47.1
[PULL 34/49] hw/gpio/imx_gpio: Turn DPRINTF() into trace events
In reply to Philippe Mathieu-DaudéFrom: Bernhard Beschow <[email protected]>
While at it add a trace event for input GPIO events.
Message-ID: <[email protected]>
--- hw/gpio/imx_gpio.c | 18 +++++++----------- hw/gpio/trace-events | 5 +++++ 2 files changed, 12 insertions(+), 11 deletions(-)
hw/gpio/imx_gpio.c +7 -11
@@ -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 :
hw/gpio/trace-events +5 -0
@@ -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
Signature · 1 line
2.47.1
[PULL 41/49] target/hppa: Speed up hppa_is_pa20()
In reply to Philippe Mathieu-DaudéFrom: Helge Deller <[email protected]>
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.
Message-Id: <[email protected]>
--- target/hppa/cpu.h | 6 ++++-- target/hppa/cpu.c | 8 ++++++++ 2 files changed, 12 insertions(+), 2 deletions(-)
target/hppa/cpu.h +4 -2
@@ -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)
target/hppa/cpu.c +8 -0
@@ -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,
Signature · 1 line
2.47.1
[PULL 42/49] hw/loongarch/virt: Checkpatch cleanup
In reply to Philippe Mathieu-DaudéFrom: Bibo Mao <[email protected]>
Code cleanup with directory hw/loongarch/, removing errors from command "scripts/checkpatch.pl hw/loongarch/*"
Message-ID: <[email protected]>
--- hw/loongarch/acpi-build.c | 3 ++- hw/loongarch/boot.c | 4 ++-- hw/loongarch/virt.c | 8 +++++--- 3 files changed, 9 insertions(+), 6 deletions(-)
hw/loongarch/acpi-build.c +2 -1
@@ -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);
hw/loongarch/boot.c +2 -2
@@ -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." ); } }
hw/loongarch/virt.c +5 -3
@@ -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)
Signature · 1 line
2.47.1
[PULL 37/49] target/hppa: Convert hppa_cpu_init() to ResetHold handler
In reply to Philippe Mathieu-DaudéFrom: Helge Deller <[email protected]>
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.
Message-Id: <[email protected]>
--- target/hppa/cpu.h | 5 +++++ target/hppa/cpu.c | 14 ++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-)
target/hppa/cpu.h +5 -0
@@ -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"
target/hppa/cpu.c +12 -2
@@ -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,
Signature · 1 line
2.47.1
[PULL 10/49] hw/net/xilinx_ethlite: Introduce rxbuf_ptr() helper
In reply to Philippe Mathieu-Daudérxbuf_ptr() points to the beginning of a (RAM) RX buffer within the device state.
Message-Id: <[email protected]>
--- hw/net/xilinx_ethlite.c | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-)
hw/net/xilinx_ethlite.c +29 -10
@@ -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 XlnxXpsEthLiteunsigned 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); }
Signature · 1 line
2.47.1
[PULL 16/49] hw/net/xilinx_ethlite: Map TX_GIE as MMIO
In reply to Philippe Mathieu-Daudé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]ioMessage-Id: <[email protected]>
--- hw/net/xilinx_ethlite.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-)
hw/net/xilinx_ethlite.c +7 -10
@@ -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 ;
Signature · 1 line
2.47.1
Hi Stefan,
Please drop this PR since Igor made a comment on a patch,
Thanks!
Quoted 33 lines · 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-20250112for 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)
- Introducepci_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_cpuin TriCore machine (Philippe)
- Checkpatch style cleanups (Bibo)
-MAINTAINERSupdates (Marcin, Gustavo, Akihiko)
- Add default configuration for b4 tool (Jiaxun)----------------------------------------------------------------