[PATCH v2] qdev: Report an error for machine without HotplugHandler

2023-12-09 Thread Akihiko Odaki
The HotplugHandler of the machine will be used when the parent bus does not exist, but the machine may not have one. Report an error in such a case instead of aborting. Fixes: 7716b8ca74 ("qdev: HotplugHandler: Add support for unplugging BUS-less devices") Signed-off-by: Akihiko Odaki --- Change

[PATCH v8 17/19] ebpf: Return 0 when configuration fails

2023-12-09 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 | 1339 +++ tools/ebpf/rss.bpf.c|2 +- 2 files changed

[PATCH v8 18/19] ebpf: Refactor tun_rss_steering_prog()

2023-12-09 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 22c75d5912..012af38df1 100644 -

[PATCH v8 15/19] ebpf: Use standard section name

2023-12-09 Thread Akihiko Odaki
It makes easier to play with bpftool by allowing it to infer the program type. It also makes it unnecessary to set the program type manually when loading the program in ebpf_rss_load(). Signed-off-by: Akihiko Odaki --- ebpf/rss.bpf.skeleton.h | 1514 --

[PATCH v8 07/19] virtio-net: Copy header only when necessary

2023-12-09 Thread Akihiko Odaki
It is necessary to copy the header only for byte swapping. Worse, when byte swapping is not needed, the header can be larger than the buffer due to VIRTIO_NET_F_HASH_REPORT, which results in buffer overflow. Copy the header only when byte swapping is needed. Fixes: e22f0603fb ("virtio-net: refere

[PATCH v8 14/19] ebpf: Fix RSS error handling

2023-12-09 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 --- tools/ebpf/rss.bpf.c | 20 +++-

[PATCH v8 02/19] tap: Remove qemu_using_vnet_hdr()

2023-12-09 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 v8 12/19] virtio-net: Always set populate_hash

2023-12-09 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 40beff2262..eed5a9bc46 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-n

[PATCH v8 08/19] virtio-net: Disable RSS on reset

2023-12-09 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 v8 11/19] virtio-net: Report RSS warning at device realization

2023-12-09 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 | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.

[PATCH v8 10/19] virtio-net: Return an error when vhost cannot enable RSS

2023-12-09 Thread Akihiko Odaki
vhost requires eBPF for RSS. When eBPF is not available, virtio-net implicitly disables RSS even if the user explicitly requests it. Return an error instead of implicitly disabling RSS if RSS is requested but not available. Signed-off-by: Akihiko Odaki --- hw/net/virtio-net.c | 98 ++

[PATCH v8 03/19] net: Move virtio-net header length assertion

2023-12-09 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 98ed0280d3..2e70c4f221 100644 --- a/net/net.c +++ b/net/net.c

[PATCH v8 19/19] ebpf: Add a separate target for skeleton

2023-12-09 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 3391e7ce08..572ca5

[PATCH v8 09/19] virtio-net: Unify the logic to update NIC state for RSS

2023-12-09 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

[PATCH v8 16/19] ebpf: Simplify error handling

2023-12-09 Thread Akihiko Odaki
The error handling procedures required when rss_bpf__open() and rss_bpf__load(rss_bpf_ctx) are different so it's better to implement them separately. Signed-off-by: Akihiko Odaki --- ebpf/ebpf_rss.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/ebpf/ebpf_rss.c b/

[PATCH v8 06/19] tap: Shrink zeroed virtio-net header

2023-12-09 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 v8 05/19] tap: Call tap_receive_iov() from tap_receive()

2023-12-09 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 09ad8a

[PATCH v8 00/19] virtio-net RSS/hash report fixes and improvements

2023-12-09 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 v8 01/19] tap: Remove tap_probe_vnet_hdr_len()

2023-12-09 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 v8 13/19] virtio-net: Do not write hashes to peer buffer

2023-12-09 Thread Akihiko Odaki
The peer buffer is qualified with const and not meant to be modified. It also prevents enabling VIRTIO_NET_F_HASH_REPORT for peers without virtio-net header support. Signed-off-by: Akihiko Odaki --- hw/net/virtio-net.c | 36 +--- 1 file changed, 17 insertions(+),

[PATCH v8 04/19] net: Remove receive_raw()

2023-12-09 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

Re: [PATCH 02/10] tests/avocado: mips: add hint for fetchasset plugin

2023-12-09 Thread Akihiko Odaki
On 2023/12/09 4:09, Cleber Rosa wrote: Avocado's fetchasset plugin runs before the actual Avocado job (and any test). It analyses the test's code looking for occurrences of "self.fetch_asset()" in the either the actual test or setUp() method. It's not able to fully analyze all code, though. The

[PATCH RFC v2 00/12] virtio-net: add support for SR-IOV emulation

2023-12-09 Thread Akihiko Odaki
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 virtio-net. It is useful to test SR-IOV support on the guest, or to expose several vDPA devices in a VM. vDPA devices can also provi

[PATCH RFC v2 06/12] pcie_sriov: Reuse SR-IOV VF device instances

2023-12-09 Thread Akihiko Odaki
Disable SR-IOV VF devices by reusing code to power down PCI devices instead of removing them when the guest requests to disable VFs. This allows to realize devices and report VF realization errors at PF realization time. Signed-off-by: Akihiko Odaki --- docs/pcie_sriov.txt | 8 ++-- in

[PATCH RFC v2 10/12] pcie_sriov: Allow user to create SR-IOV device

2023-12-09 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 v2 03/12] hw/pci: Do not add ROM BAR for SR-IOV VF

2023-12-09 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 31e8f413a6..5a93cc1681 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -2377,6 +2377,14 @@

[PATCH RFC v2 02/12] hw/pci: Determine if rombar is explicitly enabled

2023-12-09 Thread Akihiko Odaki
vfio determines if rombar is explicitly enabled by inspecting QDict. Inspecting QDict is not nice because QDict is untyped and depends on the details on the external interface. Add an infrastructure to determine if rombar is explicitly enabled to hw/pci. PCIDevice::rom_bar is changed to have -1 by

[PATCH RFC v2 11/12] virtio-pci: Implement SR-IOV PF

2023-12-09 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 205dbf24fb..4f3ec71218 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/v

[PATCH RFC v2 12/12] virtio-net: Implement SR-IOV VF

2023-12-09 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 e03543a70a..dba4987d6e 1

[PATCH RFC v2 01/12] hw/pci: Initialize PCI multifunction after realization

2023-12-09 Thread Akihiko Odaki
The device realization code may enable PCI multifunction for SR-IOV. Signed-off-by: Akihiko Odaki --- hw/pci/pci.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index c49417abb2..4cf31128ba 100644 --- a/hw/pci/pci.c +++ b/hw/pci

[PATCH RFC v2 08/12] pcie_sriov: Ensure PF and VF are mutually exclusive

2023-12-09 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 566aeb9e99..160dfc84ec 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci/pcie_sriov.

[PATCH RFC v2 09/12] pcie_sriov: Check PCI Express for SR-IOV PF

2023-12-09 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 160dfc84ec..8272916cf3 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci/pcie_sriov.c @@ -46,6 +46,11 @@ bool pci

[PATCH RFC v2 04/12] vfio: Avoid inspecting option QDict for rombar

2023-12-09 Thread Akihiko Odaki
Use pci_rom_bar_explicitly_enabled() to determine if rombar is explicitly enabled. Signed-off-by: Akihiko Odaki --- hw/vfio/pci.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index c62c02f7b6..bc29ce9194 100644 --- a/hw/vfio/pci.c +++ b/hw/v

[PATCH RFC v2 05/12] hw/qdev: Remove opts member

2023-12-09 Thread Akihiko Odaki
It is no longer used. Signed-off-by: Akihiko Odaki --- include/hw/qdev-core.h | 4 hw/core/qdev.c | 1 - system/qdev-monitor.c | 12 +++- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index 151d968238..6bef

[PATCH RFC v2 07/12] pcie_sriov: Release VFs failed to realize

2023-12-09 Thread Akihiko Odaki
Release VFs failed to realize just as we do in unregister_vfs(). Signed-off-by: Akihiko Odaki --- hw/pci/pcie_sriov.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c index 5fc146efc4..566aeb9e99 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci/pcie_sr

Re: [PATCH] hw/misc/ivshmem: Use 32-bit addressing for the memory BAR

2023-12-09 Thread Geoffrey McRae
It seems this patch was missed/ignored, Can we please get some traction on this? Even if this is not the correct approach some advice on how to get this issue resolved would be much appreciated. We are seeing a lot of outcry of the fact that people have to roll back their OVMF BIOS to get thing

[RFC PATCH] qemu-img: convert: introduce compression_level option

2023-12-09 Thread Yifan Zhao
This patch introduces a new parameter to customize the compression level in qemu-img convert. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1959 Signed-off-by: Yifan Zhao --- This patch adds a new compression_level option to qemu-img: convert, allowing the user to specify the compressio

Re: [PATCH] xen: fix condition for enabling the Xen accelerator

2023-12-09 Thread Richard W.M. Jones
On Sat, Dec 09, 2023 at 03:32:22PM +0100, Paolo Bonzini wrote: > A misspelled condition in xen_native.h is hiding a bug in the enablement of > Xen for qemu-system-aarch64. The bug becomes apparent when building for > Xen 4.18. > > While the i386 emulator provides the xenpv machine type for multipl

[PATCH] xen: fix condition for enabling the Xen accelerator

2023-12-09 Thread Paolo Bonzini
A misspelled condition in xen_native.h is hiding a bug in the enablement of Xen for qemu-system-aarch64. The bug becomes apparent when building for Xen 4.18. While the i386 emulator provides the xenpv machine type for multiple architectures, and therefore can be compiled with Xen enabled even wh

Re: [PATCH qemu 0/3] hw/arm: Add device STM32L4x5 EXTI

2023-12-09 Thread Philippe Mathieu-Daudé
Hi Inès, On 7/12/23 22:30, ~inesvarhol wrote: This patch adds a new STM32L4x5 EXTI device and is part of a series implementing the STM32L4x5 with a few peripherals. The patch is split up in 3 commits : - implementing the EXTI device - adding tests (that fail in this commit) - connecting the EXT

Re: [PATCH v4 00/45] Raspberry Pi 4B machine

2023-12-09 Thread Philippe Mathieu-Daudé
Hi Sergey, On 8/12/23 03:31, Sergey Kambalin wrote: Introducing Raspberry Pi 4B model. It contains new BCM2838 SoC, PCIE subsystem, RNG200, Thermal sensor and Genet network controller. It can work with recent linux kernels 6.x.x. Two avocado tests was added to check that. Unit tests has been m