[PATCH v10 02/18] tap: Remove qemu_using_vnet_hdr()

2024-04-28 Thread Akihiko Odaki
Since qemu_set_vnet_hdr_len() is always called when qemu_using_vnet_hdr() is called, we can merge them and save some code. For consistency, express that the virtio-net header is not in use by returning 0 with qemu_get_vnet_hdr_len() instead of having a dedicated function, qemu_get_using_vnet_hdr()

[PATCH v10 04/18] net: Remove receive_raw()

2024-04-28 Thread Akihiko Odaki
While netmap implements virtio-net header, it does not implement receive_raw(). Instead of implementing receive_raw for netmap, add virtio-net headers in the common code and use receive_iov()/receive() instead. This also fixes the buffer size for the virtio-net header. Fixes: fbbdbddec0 ("tap: all

[PATCH v10 00/18] virtio-net RSS/hash report fixes and improvements

2024-04-28 Thread Akihiko Odaki
This series contains fixes and improvements for virtio-net RSS and hash reporting feature. V7 -> V8: Reset author email addresses. Rebased. V6 -> V7: Dropped patch "virtio-net: Do not clear VIRTIO_NET_F_HASH_REPORT". Dropped the changes to remove packet flags. Re-introduced tap_receive(

[PATCH v10 03/18] net: Move virtio-net header length assertion

2024-04-28 Thread Akihiko Odaki
The virtio-net header length assertion should happen for any clients. Signed-off-by: Akihiko Odaki --- net/net.c | 5 + net/tap.c | 3 --- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/net/net.c b/net/net.c index bd51037ebfb0..db096765f4b2 100644 --- a/net/net.c +++ b/net/ne

[PATCH v10 09/18] virtio-net: Copy header only when necessary

2024-04-28 Thread Akihiko Odaki
The copied header is only used for byte swapping. Signed-off-by: Akihiko Odaki --- hw/net/virtio-net.c | 26 -- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index e33bdbfd84a5..ca0fbf7b7654 100644 --- a/hw/net/v

[PATCH v10 05/18] tap: Call tap_receive_iov() from tap_receive()

2024-04-28 Thread Akihiko Odaki
This will save duplicate logic found in both of tap_receive_iov() and tap_receive(). Suggested-by: "Zhang, Chen" Signed-off-by: Akihiko Odaki --- net/tap.c | 35 +-- 1 file changed, 5 insertions(+), 30 deletions(-) diff --git a/net/tap.c b/net/tap.c index 99c59e

[PATCH v10 13/18] virtio-net: Always set populate_hash

2024-04-28 Thread Akihiko Odaki
The member is not cleared during reset so may have a stale value. Signed-off-by: Akihiko Odaki --- hw/net/virtio-net.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 61b49e335dea..527aac3a0465 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virt

[PATCH v10 08/18] virtio-net: Add only one queue pair when realizing

2024-04-28 Thread Akihiko Odaki
Multiqueue usage is not negotiated yet when realizing. If more than one queue is added and the guest never requests to enable multiqueue, the extra queues will not be deleted when unrealizing and leak. Fixes: f9d6dbf0bf6e ("virtio-net: remove virtio queues if the guest doesn't support multiqueue"

[PATCH v10 18/18] ebpf: Add a separate target for skeleton

2024-04-28 Thread Akihiko Odaki
This generalizes the rule to generate the skeleton and allows to add another. Signed-off-by: Akihiko Odaki --- tools/ebpf/Makefile.ebpf | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tools/ebpf/Makefile.ebpf b/tools/ebpf/Makefile.ebpf index 3391e7ce0898..572c

[PATCH v10 01/18] tap: Remove tap_probe_vnet_hdr_len()

2024-04-28 Thread Akihiko Odaki
It was necessary since an Linux older than 2.6.35 may implement the virtio-net header but may not allow to change its length. Remove it since such an old Linux is no longer supported. Signed-off-by: Akihiko Odaki Acked-by: Michael S. Tsirkin --- net/tap_int.h | 1 - net/tap-bsd.c | 5

[PATCH v10 15/18] ebpf: Fix RSS error handling

2024-04-28 Thread Akihiko Odaki
calculate_rss_hash() was using hash value 0 to tell if it calculated a hash, but the hash value may be 0 on a rare occasion. Have a distinct bool value for correctness. Fixes: f3fa412de2 ("ebpf: Added eBPF RSS program.") Signed-off-by: Akihiko Odaki --- ebpf/rss.bpf.skeleton.h | 1210 +++

[PATCH v10 14/18] virtio-net: Do not write hashes to peer buffer

2024-04-28 Thread Akihiko Odaki
The peer buffer is qualified with const and not meant to be modified. Signed-off-by: Akihiko Odaki --- hw/net/virtio-net.c | 36 +--- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 527aac3a0465..c805

[PATCH v10 06/18] tap: Shrink zeroed virtio-net header

2024-04-28 Thread Akihiko Odaki
tap prepends a zeroed virtio-net header when writing a packet to a tap with virtio-net header enabled but not in use. This only happens when s->host_vnet_hdr_len == sizeof(struct virtio_net_hdr). Signed-off-by: Akihiko Odaki --- net/tap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) di

[PATCH v10 17/18] ebpf: Refactor tun_rss_steering_prog()

2024-04-28 Thread Akihiko Odaki
This saves branches and makes later BPF program changes easier. Signed-off-by: Akihiko Odaki --- tools/ebpf/rss.bpf.c | 26 +++--- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/tools/ebpf/rss.bpf.c b/tools/ebpf/rss.bpf.c index 77434435ac15..c989cb3cd82c 1006

[PATCH v10 11/18] virtio-net: Disable RSS on reset

2024-04-28 Thread Akihiko Odaki
RSS is disabled by default. Fixes: 590790297c ("virtio-net: implement RSS configuration command") Signed-off-by: Akihiko Odaki Reviewed-by: Michael Tokarev --- hw/net/virtio-net.c | 70 +++-- 1 file changed, 36 insertions(+), 34 deletions(-) diff

[PATCH v10 16/18] ebpf: Return 0 when configuration fails

2024-04-28 Thread Akihiko Odaki
The kernel interprets the returned value as an unsigned 32-bit so -1 will mean queue 4294967295, which is awkward. Return 0 instead. Signed-off-by: Akihiko Odaki --- ebpf/rss.bpf.skeleton.h | 1532 +++ tools/ebpf/rss.bpf.c|2 +- 2 files changed

[PATCH v10 07/18] virtio-net: Do not propagate ebpf-rss-fds errors

2024-04-28 Thread Akihiko Odaki
Propagating ebpf-rss-fds errors has several problems. First, it makes device realization fail and disables the fallback to the conventional eBPF loading. Second, it leaks memory by making device realization fail without freeing memory already allocated. Third, the convention is to set an error w

[PATCH v10 10/18] virtio-net: Shrink header byte swapping buffer

2024-04-28 Thread Akihiko Odaki
Byte swapping is only performed for the part of header shared with the legacy standard and the buffer only needs to cover it. Signed-off-by: Akihiko Odaki --- hw/net/virtio-net.c | 17 ++--- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/v

[PATCH v10 12/18] virtio-net: Unify the logic to update NIC state for RSS

2024-04-28 Thread Akihiko Odaki
The code to attach or detach the eBPF program to RSS were duplicated so unify them into one function to save some code. Signed-off-by: Akihiko Odaki --- hw/net/virtio-net.c | 90 + 1 file changed, 36 insertions(+), 54 deletions(-) diff --git a

Re: [PATCH v7 03/17] hw/loongarch: Add slave cpu boot_code

2024-04-28 Thread gaosong
在 2024/4/28 上午9:15, maobibo 写道: On 2024/4/26 下午5:15, Song Gao wrote: Message text is missing here :( Signed-off-by: Song Gao Message-Id: <20240307164835.300412-4-gaos...@loongson.cn> It is strange that there is "Message-Id:" string. Is it required here? Message_ID helps to find the origi

Re: [PATCH v7 06/17] hw/loongarch: Init efi_boot_memmap table

2024-04-28 Thread gaosong
在 2024/4/28 上午9:34, maobibo 写道: On 2024/4/26 下午5:15, Song Gao wrote: Message test is also missing there :( Signed-off-by: Song Gao Message-Id: <20240307164835.300412-7-gaos...@loongson.cn> ---   include/hw/loongarch/boot.h | 27 +   include/hw/loongarch/virt.h | 10 ++

[PATCH 0/3] virtio-net: Convert feature properties to OnOffAuto

2024-04-28 Thread Akihiko Odaki
Based-on: <20240428-rss-v10-0-73cbaa91a...@daynix.com> ("[PATCH v10 00/18] virtio-net RSS/hash report fixes and improvements") Some features are not always available, and virtio-net used to disable them when not available even if the corresponding properties were explicitly set t

[PATCH 1/3] qdev-properties: Add DEFINE_PROP_ON_OFF_AUTO_BIT64()

2024-04-28 Thread Akihiko Odaki
DEFINE_PROP_ON_OFF_AUTO_BIT64() corresponds to DEFINE_PROP_ON_OFF_AUTO() as DEFINE_PROP_BIT64() corresponds to DEFINE_PROP_BOOL(). The difference is that DEFINE_PROP_ON_OFF_AUTO_BIT64() exposes OnOffAuto instead of bool. Signed-off-by: Akihiko Odaki --- include/hw/qdev-properties.h | 18

[PATCH 2/3] virtio-net: Convert feature properties to OnOffAuto

2024-04-28 Thread Akihiko Odaki
Some features are not always available, and virtio-net used to disable them when not available even if the corresponding properties were explicitly set to "on". Convert feature properties to OnOffAuto so that the user can explicitly tell QEMU to automatically select the value by setting them "auto

[PATCH 3/3] virtio-net: Report RSS warning at device realization

2024-04-28 Thread Akihiko Odaki
Warning about RSS fallback at device realization allows the user to notice the configuration problem early. Signed-off-by: Akihiko Odaki --- hw/net/virtio-net.c | 14 ++ 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 5b6c

[PATCH RFC v4 2/7] hw/pci: Fix SR-IOV VF number calculation

2024-04-28 Thread Akihiko Odaki
pci_config_get_bar_addr() had a division by vf_stride. vf_stride needs to be non-zero when there are multiple VFs, but the specification does not prohibit to make it zero when there is only one VF. Do not perform the division for the first VF to avoid division by zero. Signed-off-by: Akihiko Odak

[PATCH RFC v4 5/7] pcie_sriov: Allow user to create SR-IOV device

2024-04-28 Thread Akihiko Odaki
A user can create a SR-IOV device by specifying the PF with the sriov-pf property of the VFs. The VFs must be added before the PF. A user-creatable VF must have PCIDeviceClass::sriov_vf_user_creatable set. Such a VF cannot refer to the PF because it is created before the PF. A PF that user-creata

[PATCH RFC v4 6/7] virtio-pci: Implement SR-IOV PF

2024-04-28 Thread Akihiko Odaki
Allow user to attach SR-IOV VF to a virtio-pci PF. Signed-off-by: Akihiko Odaki --- hw/virtio/virtio-pci.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index eaaf86402cfa..996bb2cbad20 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virt

[PATCH RFC v4 4/7] pcie_sriov: Check PCI Express for SR-IOV PF

2024-04-28 Thread Akihiko Odaki
SR-IOV requires PCI Express. Signed-off-by: Akihiko Odaki --- hw/pci/pcie_sriov.c | 5 + 1 file changed, 5 insertions(+) diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c index ec8fc0757b92..3af0cc7d560a 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci/pcie_sriov.c @@ -42,6 +42,11 @@ bool

[PATCH RFC v4 0/7] virtio-net: add support for SR-IOV emulation

2024-04-28 Thread Akihiko Odaki
Based-on: <20240315-reuse-v9-0-67aa69af4...@daynix.com> ("[PATCH for 9.1 v9 00/11] hw/pci: SR-IOV related fixes and improvements") Introduction This series is based on the RFC series submitted by Yui Washizu[1]. See also [2] for the context. This series enables SR-IOV emulation for

[PATCH RFC v4 7/7] virtio-net: Implement SR-IOV VF

2024-04-28 Thread Akihiko Odaki
A virtio-net device can be added as a SR-IOV VF to another virtio-pci device that will be the PF. Signed-off-by: Akihiko Odaki --- hw/virtio/virtio-net-pci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/virtio/virtio-net-pci.c b/hw/virtio/virtio-net-pci.c index e03543a70a75..dba4987d6e

[PATCH RFC v4 3/7] pcie_sriov: Ensure PF and VF are mutually exclusive

2024-04-28 Thread Akihiko Odaki
A device cannot be a SR-IOV PF and a VF at the same time. Signed-off-by: Akihiko Odaki --- hw/pci/pcie_sriov.c | 5 + 1 file changed, 5 insertions(+) diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c index 56523ab4e833..ec8fc0757b92 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci/pcie_sr

[PATCH RFC v4 1/7] hw/pci: Do not add ROM BAR for SR-IOV VF

2024-04-28 Thread Akihiko Odaki
A SR-IOV VF cannot have a ROM BAR. Co-developed-by: Yui Washizu Signed-off-by: Akihiko Odaki --- hw/pci/pci.c | 8 1 file changed, 8 insertions(+) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index cb5ac46e9f27..201ff64e11cc 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -2359,6 +2359,14

[PULL 06/17] hw/loongarch: Init efi_boot_memmap table

2024-04-28 Thread Song Gao
The efi_system_table adds a efi_boot_memmap configuration table. Signed-off-by: Song Gao Reviewed-by: Bibo Mao Message-Id: <20240426091551.2397867-7-gaos...@loongson.cn> --- hw/loongarch/boot.c | 40 + hw/loongarch/virt.c | 11 ++ incl

[PULL 00/17] loongarch-to-apply queue

2024-04-28 Thread Song Gao
The following changes since commit fd87be1dada5672f877e03c2ca8504458292c479: Merge tag 'accel-20240426' of https://github.com/philmd/qemu into staging (2024-04-26 15:28:13 -0700) are available in the Git repository at: https://gitlab.com/gaosong/qemu.git tags/pull-loongarch-202

[PULL 04/17] hw/loongarch: Add init_cmdline

2024-04-28 Thread Song Gao
Add init_cmline and set boot_info->a0, a1 Signed-off-by: Song Gao Reviewed-by: Bibo Mao Message-Id: <20240426091551.2397867-5-gaos...@loongson.cn> --- hw/loongarch/boot.c | 30 ++ include/hw/loongarch/virt.h | 2 ++ target/loongarch/cpu.h | 2 ++ 3 fil

[PULL 02/17] hw/loongarch: Add load initrd

2024-04-28 Thread Song Gao
we load initrd ramdisk after kernel_high address Signed-off-by: Song Gao Reviewed-by: Bibo Mao Message-Id: <20240426091551.2397867-3-gaos...@loongson.cn> --- hw/loongarch/boot.c | 29 - 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/hw/loongarch/boot.c

[PULL 07/17] hw/loongarch: Init efi_initrd table

2024-04-28 Thread Song Gao
The efi_system_table adds a efi_initrd configuration table. Signed-off-by: Song Gao Reviewed-by: Bibo Mao Message-Id: <20240426091551.2397867-8-gaos...@loongson.cn> --- hw/loongarch/boot.c | 23 +-- include/hw/loongarch/boot.h | 9 + 2 files changed, 30 inse

[PULL 15/17] hw/loongarch: fdt remove unused irqchip node

2024-04-28 Thread Song Gao
This patch removes the unused fdt irqchip node. Signed-off-by: Song Gao Reviewed-by: Bibo Mao Message-Id: <20240426091551.2397867-16-gaos...@loongson.cn> --- hw/loongarch/virt.c | 31 +-- 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/hw/loongarch/virt

[PULL 10/17] hw/loongarch: fdt adds cpu interrupt controller node

2024-04-28 Thread Song Gao
fdt adds cpu interrupt controller node, we use 'loongson,cpu-interrupt-controller'. See: https://github.com/torvalds/linux/blob/v6.7/drivers/irqchip/irq-loongarch-cpu.c https://lore.kernel.org/r/20221114113824.1880-2-liupei...@loongson.cn Signed-off-by: Song Gao Reviewed-by: Bibo Mao Message-Id

[PULL 14/17] hw/loongarch: fdt adds pcie irq_map node

2024-04-28 Thread Song Gao
This patch adds pcie irq_map node for FDT. Signed-off-by: Song Gao Reviewed-by: Bibo Mao Message-Id: <20240426091551.2397867-15-gaos...@loongson.cn> --- hw/loongarch/virt.c | 73 ++--- 1 file changed, 69 insertions(+), 4 deletions(-) diff --git a/hw/loon

[PULL 01/17] hw/loongarch: Move boot functions to boot.c

2024-04-28 Thread Song Gao
Move some boot functions to boot.c and struct loongarch_boot_info into struct LoongArchMachineState. Signed-off-by: Song Gao Reviewed-by: Bibo Mao Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20240426091551.2397867-2-gaos...@loongson.cn> --- hw/loongarch/boot.c | 128 ++

[PULL 08/17] hw/loongarch: Init efi_fdt table

2024-04-28 Thread Song Gao
The efi_system_table adds a efi_fdt configuration table. Signed-off-by: Song Gao Reviewed-by: Bibo Mao Message-Id: <20240426091551.2397867-9-gaos...@loongson.cn> --- hw/loongarch/boot.c | 11 +++ hw/loongarch/virt.c | 6 ++ include/hw/loongarch/boot.h | 4 inc

[PULL 17/17] hw/loongarch: Add cells missing from rtc node

2024-04-28 Thread Song Gao
rtc node need interrupts and interrupt-parent cells. Signed-off-by: Song Gao Reviewed-by: Bibo Mao Message-Id: <20240426091551.2397867-18-gaos...@loongson.cn> --- hw/loongarch/virt.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/hw/loongarch/virt.c b/hw/loonga

[PULL 03/17] hw/loongarch: Add slave cpu boot_code

2024-04-28 Thread Song Gao
Load the slave CPU boot code at pflash0 and set the slave CPU elf_address to VIRT_FLASH0_BASE. Signed-off-by: Song Gao Reviewed-by: Bibo Mao Message-Id: <20240426091551.2397867-4-gaos...@loongson.cn> --- hw/loongarch/boot.c | 62 - 1 file changed, 61

[PULL 13/17] hw/loongarch: fdt adds pch_msi Controller

2024-04-28 Thread Song Gao
fdt adds pch msi controller, we use 'loongson,pch-msi-1.0'. See: https://github.com/torvalds/linux/blob/v6.7/drivers/irqchip/irq-loongson-pch-msi.c https://lore.kernel.org/r/20200528152757.1028711-6-jiaxun.y...@flygoat.com Signed-off-by: Song Gao Reviewed-by: Bibo Mao Message-Id: <2024042609155

[PULL 09/17] hw/loongarch: Fix fdt memory node wrong 'reg'

2024-04-28 Thread Song Gao
The right fdt memory node like [1], not [2] [1] memory@0 { device_type = "memory"; reg = <0x00 0x00 0x00 0x1000>; }; [2] memory@0 { device_type = "memory"; reg = <0x02 0x00 0x02 0x1000>; };

[PULL 05/17] hw/loongarch: Init efi_system_table

2024-04-28 Thread Song Gao
Add init_systab and set boot_info->a2 Signed-off-by: Song Gao Reviewed-by: Bibo Mao Message-Id: <20240426091551.2397867-6-gaos...@loongson.cn> --- hw/loongarch/boot.c | 22 + include/hw/loongarch/boot.h | 48 + 2 files changed, 70 inse

[PULL 11/17] hw/loongarch: fdt adds Extend I/O Interrupt Controller

2024-04-28 Thread Song Gao
fdt adds Extend I/O Interrupt Controller, we use 'loongson,ls2k2000-eiointc'. See: https://github.com/torvalds/linux/blob/v6.7/drivers/irqchip/irq-loongson-eiointc.c https://lore.kernel.org/r/764e02d924094580ac0f1d15535f4b98308705c6.1683279769.git.zhoubin...@loongson.cn Signed-off-by: Song Gao R

[PULL 16/17] hw/loongarch: Add cells missing from uart node

2024-04-28 Thread Song Gao
uart node need interrupts and interrupt-parent cells. Signed-off-by: Song Gao Reviewed-by: Bibo Mao Message-Id: <20240426091551.2397867-17-gaos...@loongson.cn> --- hw/loongarch/virt.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/loongarch/virt.c b/hw/loongarch

[PULL 12/17] hw/loongarch: fdt adds pch_pic Controller

2024-04-28 Thread Song Gao
fdt adds pch pic controller, we use 'loongson,pch-pic-1.0' See: https://github.com/torvalds/linux/blob/v6.7/drivers/irqchip/irq-loongson-pch-pic.c https://lore.kernel.org/r/20200528152757.1028711-4-jiaxun.y...@flygoat.com Signed-off-by: Song Gao Reviewed-by: Bibo Mao Message-Id: <20240426091551

[PATCH 2/2] Revert "hw/net/net_tx_pkt: Fix overrun in update_sctp_checksum()"

2024-04-28 Thread Akihiko Odaki
This reverts commit 83ddb3dbba2ee0f1767442ae6ee665058aeb1093. The added check is no longer necessary due to a change of iov_from_buf(). Signed-off-by: Akihiko Odaki --- hw/net/net_tx_pkt.c | 4 1 file changed, 4 deletions(-) diff --git a/hw/net/net_tx_pkt.c b/hw/net/net_tx_pkt.c index b7b

[PATCH 0/2] util/iov: Do not assert offset is in iov

2024-04-28 Thread Akihiko Odaki
3 files changed, 3 insertions(+), 11 deletions(-) --- base-commit: fd87be1dada5672f877e03c2ca8504458292c479 change-id: 20240428-iov-a317b02601dc Best regards, -- Akihiko Odaki

[PATCH 1/2] util/iov: Do not assert offset is in iov

2024-04-28 Thread Akihiko Odaki
iov_from_buf(), iov_to_buf(), iov_memset(), and iov_copy() asserts that the given offset fits in the iov while tolerating the specified number of bytes to operate with to be greater than the size of iov. This is inconsistent so remove the assertions. Asserting the offset fits in the iov makes sens

Re: [PATCH 1/1] Fix safeAreaInsets not being available on OS X 10.13

2024-04-28 Thread Akihiko Odaki
On 2024/04/28 20:57, Tobias Markus wrote: Hello, to prefix this: I previously filed https://gitlab.com/qemu-project/qemu/-/issues/2314 for this compilation error and I'm quite aware that QEMU only supports the most recent two versions of Mac OS X by default. However, given the small change r

Re: [PATCH v2] migration/colo: Fix bdrv_graph_rdlock_main_loop: Assertion `!qemu_in_coroutine()' failed.

2024-04-28 Thread Michael Tokarev
17.04.2024 05:56, Li Zhijian via wrote: bdrv_activate_all() should not be called from the coroutine context, move it to the QEMU thread colo_process_incoming_thread() with the bql_lock protected. The backtrace is as follows: #4 0x561af7948362 in bdrv_graph_rdlock_main_loop () at ../block

Re: [PATCH v2] migration/colo: Fix bdrv_graph_rdlock_main_loop: Assertion `!qemu_in_coroutine()' failed.

2024-04-28 Thread Michael Tokarev
17.04.2024 05:56, Li Zhijian via wrote: --- a/migration/colo.c +++ b/migration/colo.c @@ -835,6 +835,16 @@ static void *colo_process_incoming_thread(void *opaque) return NULL; } +/* Make sure all file formats throw away their mutable metadata */ +bql_lock(); +bdrv_

Re: [PATCH v2] migration/colo: Fix bdrv_graph_rdlock_main_loop: Assertion `!qemu_in_coroutine()' failed.

2024-04-28 Thread Peter Xu
On Sun, Apr 28, 2024 at 03:39:09PM +0300, Michael Tokarev wrote: > 17.04.2024 05:56, Li Zhijian via wrote: > > bdrv_activate_all() should not be called from the coroutine context, move > > it to the QEMU thread colo_process_incoming_thread() with the bql_lock > > protected. > > > > The backtrace i

[PATCH 1/1] Fix safeAreaInsets not being available on OS X 10.13

2024-04-28 Thread Tobias Markus
Hello, to prefix this: I previously filed https://gitlab.com/qemu-project/qemu/-/issues/2314 for this compilation error and I'm quite aware that QEMU only supports the most recent two versions of Mac OS X by default. However, given the small change required for this to work, I hope you can ma

Re: [PATCH] net/slirp: Use newer slirp_*_hostxfwd API

2024-04-28 Thread Samuel Thibault
Hello, Thomas Weißschuh, le jeu. 22 févr. 2024 11:44:13 +0100, a ecrit: > On Tue, Mar 22, 2022 at 06:58:36PM -0700, Nicholas Ngai wrote: > > Pinging this. It’s a bit old, though the patch still applies cleanly to > > master as far as I can tell. > > > > Link to patchew is > > https://patchew.org/

Re: [PATCH 01/14] target/i386: Simplify get_memio_eip()

2024-04-28 Thread Richard Henderson
On 4/27/24 08:57, Philippe Mathieu-Daudé wrote: The single call to get_memio_eip(), in cpu_report_tpr_access(), is protected by a check on tcg_enabled(). Since the call only exists when CONFIG_TCG is defined, we can slightly simplify. Nack, that's not how things work. By wrapping the whole fun

[PATCH v2] fix bit fields extraction and prevent overflow

2024-04-28 Thread Alexandra Diupina
Add a type cast and use extract64() instead of extract32() to avoid integer overflow on addition. Fix bit fields extraction according to documentation. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: d3c6369a96 ("introduce xlnx-dpdma") Signed-off-by: Alexandra Diupina --

[PATCH v4] fix endianness bug

2024-04-28 Thread Alexandra Diupina
Add xlnx_dpdma_read_descriptor() and xlnx_dpdma_write_descriptor() functions. xlnx_dpdma_read_descriptor() combines reading a descriptor from desc_addr by calling dma_memory_read() and swapping the desc fields from guest memory order to host memory order. xlnx_dpdma_write_descriptor() performs simi

Re: [PATCH 02/14] plugins: Update stale comment

2024-04-28 Thread Richard Henderson
On 4/27/24 08:57, Philippe Mathieu-Daudé wrote: "plugin_mask" was renamed as "event_mask" in commit c006147122 ("plugins: create CPUPluginState and migrate plugin_mask"). Signed-off-by: Philippe Mathieu-Daudé --- plugins/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-

Re: [PATCH 03/14] plugins/api: Only include 'exec/ram_addr.h' with system emulation

2024-04-28 Thread Richard Henderson
On 4/27/24 08:57, Philippe Mathieu-Daudé wrote: "exec/ram_addr.h" shouldn't be used with user emulation. Signed-off-by: Philippe Mathieu-Daudé --- plugins/api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Acked-by: Richard Henderson r~

Re: [PATCH 04/14] exec: Include missing license in 'exec/cpu-common.h'

2024-04-28 Thread Richard Henderson
On 4/27/24 08:57, Philippe Mathieu-Daudé wrote: Commit 1ad2134f91 ("Hardware convenience library") extracted "cpu-common.h" from "cpu-all.h", which uses the LGPL-2.1+ license. Signed-off-by: Philippe Mathieu-Daudé --- include/exec/cpu-common.h | 9 +++-- 1 file changed, 7 insertions(+), 2

Re: [PATCH 05/14] exec/cpu: Indent TARGET_PAGE_foo definitions

2024-04-28 Thread Richard Henderson
On 4/27/24 08:57, Philippe Mathieu-Daudé wrote: The TARGET_PAGE_foo definitions are defined with multiple level of #ifdef'ry. Indent it a bit for clarity. Signed-off-by: Philippe Mathieu-Daudé --- include/exec/cpu-all.h | 25 + 1 file changed, 13 insertions(+), 12 dele

Re: [PATCH 06/14] exec/cpu: Remove obsolete PAGE_RESERVED definition

2024-04-28 Thread Richard Henderson
On 4/27/24 08:57, Philippe Mathieu-Daudé wrote: We stopped using the PAGE_RESERVED definition in commit 50d25c8aec ("accel/tcg: Drop PAGE_RESERVED for CONFIG_BSD"). This completes commit 2e9a5713f0 ("Remove PAGE_RESERVED"). Signed-off-by: Philippe Mathieu-Daudé --- include/exec/cpu-all.h | 4 -

Re: [PATCH 07/14] exec/cpu: Remove duplicated PAGE_PASSTHROUGH definition

2024-04-28 Thread Richard Henderson
On 4/27/24 08:57, Philippe Mathieu-Daudé wrote: Missed in commit 58771921af ("include/exec: Move PAGE_* macros to common header"), PAGE_PASSTHROUGH ended being defined twice. Signed-off-by: Philippe Mathieu-Daudé --- include/exec/cpu-all.h | 6 -- 1 file changed, 6 deletions(-) Reviewed

Re: [PATCH 08/14] exec/cpu: Extract page-protection definitions to page-prot-common.h

2024-04-28 Thread Richard Henderson
On 4/27/24 08:57, Philippe Mathieu-Daudé wrote: Extract page-protection definitions from "exec/cpu-all.h" to "exec/page-prot-common.h". The list of files requiring the new header was generated using: $ git grep -wE \ 'PAGE_(READ|WRITE|EXEC|BITS|VALID|ANON|RESERVED|TARGET_.|PASSTHROUGH)' Sig

Re: [RFC PATCH 09/14] exec/cpu: Restrict user-specific page definitions

2024-04-28 Thread Richard Henderson
On 4/27/24 08:57, Philippe Mathieu-Daudé wrote: User-specific PAGE definitions shouldn't be used on system emulation. Signed-off-by: Philippe Mathieu-Daudé --- include/exec/page-prot-common.h | 8 1 file changed, 8 insertions(+) Come to that, PAGE_WRITE_INV is system only. Does t

Re: [PATCH 10/14] exec/user: Restrict 'syscall-trace.h' to user emulation

2024-04-28 Thread Richard Henderson
On 4/27/24 08:57, Philippe Mathieu-Daudé wrote: System emulation shouldn't use "user/syscall-trace.h". Signed-off-by: Philippe Mathieu-Daudé --- include/user/syscall-trace.h | 4 1 file changed, 4 insertions(+) diff --git a/include/user/syscall-trace.h b/include/user/syscall-trace.h in

Re: [PATCH 11/14] accel/tcg: Use cpu_loop_exit_requested() in cpu_loop_exec_tb()

2024-04-28 Thread Richard Henderson
On 4/27/24 08:57, Philippe Mathieu-Daudé wrote: Do not open-code cpu_loop_exit_requested(). Signed-off-by: Philippe Mathieu-Daudé --- accel/tcg/cpu-exec.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 225e5fbd3e..

Re: [PATCH 12/14] accel/tcg: Remove pointless initialization of cflags_next_tb

2024-04-28 Thread Richard Henderson
On 4/27/24 08:57, Philippe Mathieu-Daudé wrote: cflags_next_tb is always re-initialized in the CPU Reset() handler in cpu_common_reset_hold(), no need to initialize it in cpu_common_initfn(). Signed-off-by: Philippe Mathieu-Daudé --- hw/core/cpu-common.c | 1 - 1 file changed, 1 deletion(-)

Re: [PATCH 13/14] accel/tcg: Reset TCG specific fields in tcg_cpu_reset_hold()

2024-04-28 Thread Richard Henderson
On 4/27/24 08:57, Philippe Mathieu-Daudé wrote: Rather than resetting TCG specific fields in the common cpu_common_reset_hold(), do it in tcg_cpu_reset_hold(). Signed-off-by: Philippe Mathieu-Daudé --- accel/tcg/tcg-accel-ops.c | 3 +++ hw/core/cpu-common.c | 2 -- 2 files changed, 3 in

Re: [PATCH 14/14] accel/tcg: Access tcg_cflags with getter / setter

2024-04-28 Thread Richard Henderson
On 4/27/24 08:57, Philippe Mathieu-Daudé wrote: Access the CPUState::tcg_cflags via tcg_cflags_has() and tcg_cflags_set() helpers. Mechanical change using the following Coccinelle spatch script: @@ expression cpu; expression flags; @@ - cpu->tcg_cflags & flags + tcg_cf

Re: [PULL 02/17] hw/loongarch: Add load initrd

2024-04-28 Thread Richard Henderson
On 4/28/24 01:51, Song Gao wrote: we load initrd ramdisk after kernel_high address Signed-off-by: Song Gao Reviewed-by: Bibo Mao Message-Id: <20240426091551.2397867-3-gaos...@loongson.cn> --- hw/loongarch/boot.c | 29 - 1 file changed, 28 insertions(+), 1 deletio

Re: [PATCH 2/2] Revert "hw/net/net_tx_pkt: Fix overrun in update_sctp_checksum()"

2024-04-28 Thread Philippe Mathieu-Daudé
On 28/4/24 13:11, Akihiko Odaki wrote: This reverts commit 83ddb3dbba2ee0f1767442ae6ee665058aeb1093. The added check is no longer necessary due to a change of iov_from_buf(). Signed-off-by: Akihiko Odaki --- hw/net/net_tx_pkt.c | 4 1 file changed, 4 deletions(-) Reviewed-by: Philipp

Re: [RFC PATCH 09/14] exec/cpu: Restrict user-specific page definitions

2024-04-28 Thread Philippe Mathieu-Daudé
On 28/4/24 20:31, Richard Henderson wrote: On 4/27/24 08:57, Philippe Mathieu-Daudé wrote: User-specific PAGE definitions shouldn't be used on system emulation. Signed-off-by: Philippe Mathieu-Daudé ---   include/exec/page-prot-common.h | 8   1 file changed, 8 insertions(+) Come to

Re: [PATCH 10/14] exec/user: Restrict 'syscall-trace.h' to user emulation

2024-04-28 Thread Philippe Mathieu-Daudé
On 28/4/24 20:32, Richard Henderson wrote: On 4/27/24 08:57, Philippe Mathieu-Daudé wrote: System emulation shouldn't use "user/syscall-trace.h". Signed-off-by: Philippe Mathieu-Daudé ---   include/user/syscall-trace.h | 4   1 file changed, 4 insertions(+) diff --git a/include/user/sysca

Re: [PULL 20/38] accel/whpx: Use accel-specific per-vcpu @dirty field

2024-04-28 Thread Volker Rümelin
Am 26.04.24 um 21:41 schrieb Philippe Mathieu-Daudé: > WHPX has a specific use of the CPUState::vcpu_dirty field > (CPUState::vcpu_dirty is not used by common code). > To make this field accel-specific, add and use a new > @dirty variable in the AccelCPUState structure. > > Signed-off-by: Philippe

[PATCH v2 05/12] exec/cpu: Remove obsolete PAGE_RESERVED definition

2024-04-28 Thread Philippe Mathieu-Daudé
We stopped using the PAGE_RESERVED definition in commit 50d25c8aec ("accel/tcg: Drop PAGE_RESERVED for CONFIG_BSD"). This completes commit 2e9a5713f0 ("Remove PAGE_RESERVED"). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20240427155714.53669-7-phi...@linaro.o

[PATCH v2 08/12] accel/tcg: Use cpu_loop_exit_requested() in cpu_loop_exec_tb()

2024-04-28 Thread Philippe Mathieu-Daudé
Do not open-code cpu_loop_exit_requested(). Signed-off-by: Philippe Mathieu-Daudé --- accel/tcg/cpu-exec.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 225e5fbd3e..c18a7e2b85 100644 --- a/accel/tcg/cpu-exec.c +++ b/a

[PATCH v2 00/12] exec: Rework around CPUState user fields

2024-04-28 Thread Philippe Mathieu-Daudé
Missing review: 8 & 9 (new) v2: - Addressed Richard review comments - Renamed page-prot-common.h -> page-protection.h - Removed wrong/unuseful patches - New patch moving cpu_loop_exit_requested() Hi, First batch of patches (I expect them to be non controversial) related to extracting user specif

[PATCH v2 04/12] exec/cpu: Indent TARGET_PAGE_foo definitions

2024-04-28 Thread Philippe Mathieu-Daudé
The TARGET_PAGE_foo definitions are defined with multiple level of #ifdef'ry. Indent it a bit for clarity. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20240427155714.53669-6-phi...@linaro.org> --- include/exec/cpu-all.h | 25 + 1 fil

[PATCH v2 12/12] accel/tcg: Access tcg_cflags with getter / setter

2024-04-28 Thread Philippe Mathieu-Daudé
Access the CPUState::tcg_cflags via tcg_cflags_has() and tcg_cflags_set() helpers. Mechanical change using the following Coccinelle spatch script: @@ expression cpu; expression flags; @@ - cpu->tcg_cflags & flags + tcg_cflags_has(cpu, flags) @@ expression cpu; expressio

[PATCH v2 10/12] accel/tcg: Remove pointless initialization of cflags_next_tb

2024-04-28 Thread Philippe Mathieu-Daudé
cflags_next_tb is always re-initialized in the CPU Reset() handler in cpu_common_reset_hold(), no need to initialize it in cpu_common_initfn(). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20240427155714.53669-13-phi...@linaro.org> --- hw/core/cpu-common.c |

[PATCH v2 07/12] exec/cpu: Extract page-protection definitions to page-protection.h

2024-04-28 Thread Philippe Mathieu-Daudé
Extract page-protection definitions from "exec/cpu-all.h" to "exec/page-protection.h". The list of files requiring the new header was generated using: $ git grep -wE \ 'PAGE_(READ|WRITE|EXEC|BITS|VALID|ANON|RESERVED|TARGET_.|PASSTHROUGH)' Signed-off-by: Philippe Mathieu-Daudé Acked-by: Nichol

[PATCH v2 03/12] exec: Include missing license in 'exec/cpu-common.h'

2024-04-28 Thread Philippe Mathieu-Daudé
Commit 1ad2134f91 ("Hardware convenience library") extracted "cpu-common.h" from "cpu-all.h", which uses the LGPL-2.1+ license. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20240427155714.53669-5-phi...@linaro.org> --- include/exec/cpu-common.h | 9 +++--

[PATCH v2 11/12] accel/tcg: Reset TCG specific fields in tcg_cpu_reset_hold()

2024-04-28 Thread Philippe Mathieu-Daudé
Rather than resetting TCG specific fields in the common cpu_common_reset_hold(), do it in tcg_cpu_reset_hold(). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20240427155714.53669-14-phi...@linaro.org> --- accel/tcg/tcg-accel-ops.c | 3 +++ hw/core/cpu-common.

[PATCH v2 09/12] accel/tcg: Restrict cpu_loop_exit_requested() to TCG

2024-04-28 Thread Philippe Mathieu-Daudé
cpu_loop_exit_requested() is specific to TCG, move it to "exec/translate-all.h". Signed-off-by: Philippe Mathieu-Daudé --- include/exec/exec-all.h | 17 - include/exec/translate-all.h | 20 target/arm/tcg/helper-a64.c | 1 + target/s390x/tcg/mem_hel

[PATCH v2 01/12] plugins: Update stale comment

2024-04-28 Thread Philippe Mathieu-Daudé
"plugin_mask" was renamed as "event_mask" in commit c006147122 ("plugins: create CPUPluginState and migrate plugin_mask"). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20240427155714.53669-3-phi...@linaro.org> --- plugins/core.c | 2 +- 1 file changed, 1 ins

[PATCH v2 02/12] plugins/api: Only include 'exec/ram_addr.h' with system emulation

2024-04-28 Thread Philippe Mathieu-Daudé
"exec/ram_addr.h" shouldn't be used with user emulation. Signed-off-by: Philippe Mathieu-Daudé Acked-by: Richard Henderson Message-Id: <20240427155714.53669-4-phi...@linaro.org> --- plugins/api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/api.c b/plugins/api.c i

[PATCH v2 06/12] exec/cpu: Remove duplicated PAGE_PASSTHROUGH definition

2024-04-28 Thread Philippe Mathieu-Daudé
Missed in commit 58771921af ("include/exec: Move PAGE_* macros to common header"), PAGE_PASSTHROUGH ended being defined twice. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20240427155714.53669-8-phi...@linaro.org> --- include/exec/cpu-all.h | 6 -- 1 fil

Re: [PATCH v2 08/12] accel/tcg: Use cpu_loop_exit_requested() in cpu_loop_exec_tb()

2024-04-28 Thread Richard Henderson
On 4/28/24 14:49, Philippe Mathieu-Daudé wrote: Do not open-code cpu_loop_exit_requested(). Signed-off-by: Philippe Mathieu-Daudé --- accel/tcg/cpu-exec.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) Reviewed-by: Richard Henderson r~

Re: [PATCH v2 09/12] accel/tcg: Restrict cpu_loop_exit_requested() to TCG

2024-04-28 Thread Richard Henderson
On 4/28/24 14:49, Philippe Mathieu-Daudé wrote: cpu_loop_exit_requested() is specific to TCG, move it to "exec/translate-all.h". Signed-off-by: Philippe Mathieu-Daudé --- include/exec/exec-all.h | 17 - include/exec/translate-all.h | 20 target/arm

[PATCH 00/24] exec: Rework around CPUState user fields (part 2)

2024-04-28 Thread Philippe Mathieu-Daudé
Finish extracting TCG fields from CPUState: - Extract tcg_cpu_exit() from cpu_exit() - Introduce AccelOpsClass::exit_vcpu_thread() - cpu_exit() calls exit_vcpu_thread=tcg_cpu_exit for TCG - Forward declare TaskState and more uses of get_task_state() - Introduce TCG AccelCPUState - Move TCG specific

[PATCH 06/24] accel: Introduce AccelOpsClass::exit_vcpu_thread() handler

2024-04-28 Thread Philippe Mathieu-Daudé
Introduce a per-accelerator handler that can be call when a vCPU exits. Signed-off-by: Philippe Mathieu-Daudé --- include/sysemu/accel-ops.h | 1 + system/cpus.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/include/sysemu/accel-ops.h b/include/sysemu/accel-ops.h index ef9

[PATCH 04/24] accel/tcg: Duplicate cpu_exit() for user / system

2024-04-28 Thread Philippe Mathieu-Daudé
We will introduce a per-accelerator vCPU exit() handler for system emulation. Duplicate cpu_exit() because the handler won't be accessible from user emulation. Signed-off-by: Philippe Mathieu-Daudé --- accel/tcg/user-exec.c | 8 hw/core/cpu-common.c | 8 system/cpus.c

[PATCH 05/24] accel/tcg: Extract tcg_cpu_exit() from cpu_exit()

2024-04-28 Thread Philippe Mathieu-Daudé
Extract tcg_cpu_exit() from the user cpu_exit() implementation. In few commits we will re-use it in the system one (via a per-accel handler). Signed-off-by: Philippe Mathieu-Daudé --- accel/tcg/internal-common.h | 2 ++ accel/tcg/translate-all.c | 7 +++ accel/tcg/user-exec.c | 4 +--

  1   2   3   >