[PATCH for-9.2 v7 6/9] virtio-pci: Implement SR-IOV PF

2024-08-12 Thread Akihiko Odaki
Allow user to attach SR-IOV VF to a virtio-pci PF. Signed-off-by: Akihiko Odaki --- include/hw/virtio/virtio-pci.h | 1 + hw/virtio/virtio-pci.c | 20 +++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/include/hw/virtio/virtio-pci.h b/include/hw/virtio/

[PATCH for-9.2 v7 4/9] pcie_sriov: Check PCI Express for SR-IOV PF

2024-08-12 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 e1b4ecf79ff9..2daea6ecdb6a 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci/pcie_sriov.c @@ -42,6 +42,11 @@ bool

[PATCH for-9.2 v7 9/9] pcie_sriov: Make a PCI device with user-created VF ARI-capable

2024-08-12 Thread Akihiko Odaki
Signed-off-by: Akihiko Odaki --- docs/system/sriov.rst | 3 ++- include/hw/pci/pcie_sriov.h | 7 +-- hw/pci/pcie_sriov.c | 8 +++- hw/virtio/virtio-pci.c | 16 ++-- 4 files changed, 24 insertions(+), 10 deletions(-) diff --git a/docs/system/sriov.rst b/d

[PATCH for-9.2 v7 5/9] pcie_sriov: Allow user to create SR-IOV device

2024-08-12 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 for-9.2 v7 3/9] pcie_sriov: Ensure PF and VF are mutually exclusive

2024-08-12 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 1eae9f0a0acf..e1b4ecf79ff9 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci/pcie_sr

[PATCH for-9.2 v7 0/9] virtio-net: add support for SR-IOV emulation

2024-08-12 Thread Akihiko Odaki
Based-on: <20240802-reuse-v11-0-fb83bb8c1...@daynix.com> ("[PATCH for-9.2 v11 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 fo

[PATCH for-9.2 v7 7/9] virtio-net: Implement SR-IOV VF

2024-08-12 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 for-9.2 v7 8/9] docs: Document composable SR-IOV device

2024-08-12 Thread Akihiko Odaki
Signed-off-by: Akihiko Odaki --- MAINTAINERS | 1 + docs/system/index.rst | 1 + docs/system/sriov.rst | 36 3 files changed, 38 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index e34c2bd4cda2..72b3c6736088 100644 --- a/MAINTAINERS +++ b/M

[PATCH for-9.2 v7 2/9] hw/pci: Fix SR-IOV VF number calculation

2024-08-12 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 for-9.2 v7 1/9] hw/pci: Do not add ROM BAR for SR-IOV VF

2024-08-12 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 d2eaf0c51dde..60b1747d60e6 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -2359,6 +2359,14

Re: [PULL 5/5] nbd/server: CVE-2024-7409: Close stray clients at server-stop

2024-08-12 Thread Michael Tokarev
[Trim CC list] 12.08.2024 17:44, Eric Blake wrote: On Sun, Aug 11, 2024 at 11:02:52AM GMT, Michael Tokarev wrote: .. Eric, from the 5-patch series, only this last patch is Cc'd for stable, but it obviously does not work without all 4 previous patches. Do you mean whole series should be applie

[PATCH for-9.2 v14 05/11] pcie_sriov: Do not manually unrealize

2024-08-12 Thread Akihiko Odaki
A device gets automatically unrealized when being unparented. Signed-off-by: Akihiko Odaki --- hw/pci/pcie_sriov.c | 4 1 file changed, 4 deletions(-) diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c index e9b23221d713..499becd5273f 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci/pcie_

[PATCH for-9.2 v14 09/11] pcie_sriov: Register VFs after migration

2024-08-12 Thread Akihiko Odaki
pcie_sriov doesn't have code to restore its state after migration, but igb, which uses pcie_sriov, naively claimed its migration capability. Add code to register VFs after migration and fix igb migration. Fixes: 3a977deebe6b ("Intrdocue igb device emulation") Signed-off-by: Akihiko Odaki --- in

[PATCH for-9.2 v14 06/11] pcie_sriov: Reuse SR-IOV VF device instances

2024-08-12 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 for-9.2 v14 08/11] pcie_sriov: Remove num_vfs from PCIESriovPF

2024-08-12 Thread Akihiko Odaki
num_vfs is not migrated so use PCI_SRIOV_CTRL_VFE and PCI_SRIOV_NUM_VF instead. Signed-off-by: Akihiko Odaki --- include/hw/pci/pcie_sriov.h | 1 - hw/pci/pcie_sriov.c | 38 +++--- hw/pci/trace-events | 2 +- 3 files changed, 28 insertions(+), 13

[PATCH for-9.2 v14 11/11] hw/qdev: Remove opts member

2024-08-12 Thread Akihiko Odaki
It is no longer used. Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Markus Armbruster --- 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/i

[PATCH for-9.2 v14 10/11] hw/pci: Use -1 as the default value for rombar

2024-08-12 Thread Akihiko Odaki
vfio_pci_size_rom() distinguishes whether rombar is explicitly set to 1 by checking dev->opts, bypassing the QOM property infrastructure. Use -1 as the default value for rombar to tell if the user explicitly set it to 1. The property is also converted from unsigned to signed. -1 is signed so it is

[PATCH for-9.2 v14 07/11] pcie_sriov: Release VFs failed to realize

2024-08-12 Thread Akihiko Odaki
Release VFs failed to realize just as we do in unregister_vfs(). Fixes: 7c0fa8dff811 ("pcie: Add support for Single Root I/O Virtualization (SR/IOV)") 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_sri

[PATCH for-9.2 v14 04/11] s390x/pci: Check for multifunction after device realization

2024-08-12 Thread Akihiko Odaki
The SR-IOV PFs set the multifunction bits during device realization so check them after that. This forbids adding SR-IOV devices to s390x. Signed-off-by: Akihiko Odaki --- hw/s390x/s390-pci-bus.c | 14 ++ 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/hw/s390x/s390-pci

[PATCH for-9.2 v14 02/11] hw/ppc/spapr_pci: Do not create DT for disabled PCI device

2024-08-12 Thread Akihiko Odaki
Disabled means it is a disabled SR-IOV VF or it is powered off, and hidden from the guest. Signed-off-by: Akihiko Odaki --- hw/ppc/spapr_pci.c | 4 1 file changed, 4 insertions(+) diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index 7cf9904c3546..f63182a03c41 100644 --- a/hw/ppc/spap

[PATCH for-9.2 v14 00/11] hw/pci: SR-IOV related fixes and improvements

2024-08-12 Thread Akihiko Odaki
Supersedes: <20240714-rombar-v2-0-af1504ef5...@daynix.com> ("[PATCH v2 0/4] hw/pci: Convert rom_bar into OnOffAuto") I submitted a RFC series[1] to add support for SR-IOV emulation to virtio-net-pci. During the development of the series, I fixed some trivial bugs and made improvements that I think

[PATCH for-9.2 v14 03/11] hw/ppc/spapr_pci: Do not reject VFs created after a PF

2024-08-12 Thread Akihiko Odaki
A PF may automatically create VFs and the PF may be function 0. Signed-off-by: Akihiko Odaki --- hw/ppc/spapr_pci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index f63182a03c41..ed4454bbf79e 100644 --- a/hw/ppc/spapr_pci.c +++

[PATCH for-9.2 v14 01/11] hw/pci: Rename has_power to enabled

2024-08-12 Thread Akihiko Odaki
The renamed state will not only represent powering state of PFs, but also represent SR-IOV VF enablement in the future. Signed-off-by: Akihiko Odaki --- include/hw/pci/pci.h| 7 ++- include/hw/pci/pci_device.h | 2 +- hw/pci/pci.c| 14 +++--- hw/pci/pci_host

Re: [PULL 0/1] Block patches

2024-08-12 Thread Richard Henderson
On 8/13/24 01:55, Stefan Hajnoczi wrote: The following changes since commit 0f397dcfecc9211d12c2c720c01eb32f0eaa7d23: Merge tag 'pull-nbd-2024-08-08' ofhttps://repo.or.cz/qemu/ericb into staging (2024-08-09 08:40:37 +1000) are available in the Git repository at: https://gitlab.com/stefa

[PULL 0/1] Block patches

2024-08-12 Thread Stefan Hajnoczi
The following changes since commit 0f397dcfecc9211d12c2c720c01eb32f0eaa7d23: Merge tag 'pull-nbd-2024-08-08' of https://repo.or.cz/qemu/ericb into staging (2024-08-09 08:40:37 +1000) are available in the Git repository at: https://gitlab.com/stefanha/qemu.git tags/block-pull-request for yo

[PULL 1/1] block/blkio: use FUA flag on write zeroes only if supported

2024-08-12 Thread Stefan Hajnoczi
From: Stefano Garzarella libblkio supports BLKIO_REQ_FUA with write zeros requests only since version 1.4.0, so let's inform the block layer that the blkio driver supports it only in this case. Otherwise we can have runtime errors as reported in https://issues.redhat.com/browse/RHEL-32878 Fixes:

Re: [PULL 10/11] crypto: push error reporting into TLS session I/O APIs

2024-08-12 Thread Daniel P . Berrangé
On Mon, Aug 12, 2024 at 05:38:41PM +0200, Thomas Huth wrote: > On 24/07/2024 11.47, Daniel P. Berrangé wrote: > > The current TLS session I/O APIs just return a synthetic errno > > value on error, which has been translated from a gnutls error > > value. This looses a large amount of valuable inform

Re: [PATCH] block/blkio: use FUA flag on write zeroes only if supported

2024-08-12 Thread Stefan Hajnoczi
On Thu, Aug 08, 2024 at 10:05:45AM +0200, Stefano Garzarella wrote: > libblkio supports BLKIO_REQ_FUA with write zeros requests only since > version 1.4.0, so let's inform the block layer that the blkio driver > supports it only in this case. Otherwise we can have runtime errors > as reported in ht

Re: [PULL 10/11] crypto: push error reporting into TLS session I/O APIs

2024-08-12 Thread Thomas Huth
On 24/07/2024 11.47, Daniel P. Berrangé wrote: The current TLS session I/O APIs just return a synthetic errno value on error, which has been translated from a gnutls error value. This looses a large amount of valuable information that distinguishes different scenarios. Pushing population of the

Re: [PULL 5/5] nbd/server: CVE-2024-7409: Close stray clients at server-stop

2024-08-12 Thread Eric Blake
On Sun, Aug 11, 2024 at 11:02:52AM GMT, Michael Tokarev wrote: > 09.08.2024 00:53, Eric Blake wrote: > > A malicious client can attempt to connect to an NBD server, and then > > intentionally delay progress in the handshake, including if it does > > not know the TLS secrets. Although the previous

[PATCH v1 1/1] block/file-posix: Avoid maybe-uninitialized warning

2024-08-12 Thread Edgar E. Iglesias
From: "Edgar E. Iglesias" Avoid a maybe-uninitialized warning in raw_refresh_zoned_limits() by initializing zoned. With GCC 14.1.0: In function ‘raw_refresh_zoned_limits’, inlined from ‘raw_refresh_limits’ at ../qemu/block/file-posix.c:1522:5: ../qemu/block/file-posix.c:1405:17: error: ‘zone

[PATCH v1 0/1] block/file-posix: Avoid maybe-uninitialized warning

2024-08-12 Thread Edgar E. Iglesias
From: "Edgar E. Iglesias" Hi, I ran into the following build-warning when building QEMU with GCC 14.1.0: [925/1857] Compiling C object libblock.a.p/block_file-posix.c.o FAILED: libblock.a.p/block_file-posix.c.o aarch64-poky-linux-gcc -mcpu=cortex-a57+crc -mbranch-protection=standard -fstack-pr

Re: [PATCH 09/18] qapi/machine: Rename CpuS390* to S390Cpu, and drop 'prefix'

2024-08-12 Thread Thomas Huth
On 30/07/2024 10.10, Markus Armbruster wrote: QAPI's 'prefix' feature can make the connection between enumeration type and its constants less than obvious. It's best used with restraint. CpuS390Entitlement has a 'prefix' to change the generated enumeration constants' prefix from CPU_S390_POLARI

Re: [PATCH 02/18] tests/qapi-schema: Drop temporary 'prefix'

2024-08-12 Thread Thomas Huth
On 30/07/2024 10.10, Markus Armbruster wrote: Recent commit "qapi: Smarter camel_to_upper() to reduce need for 'prefix'" added a temporary 'prefix' to delay changing the generated code. Revert it. This changes TestUnionEnumA's generated enumeration constant prefix from TEST_UNION_ENUMA to TEST_