Re: [PATCH v5 05/15] hw/nvme: Add support for SR-IOV

2022-02-17 Thread Klaus Jensen
On Feb 17 18:44, Lukasz Maniak wrote: > This patch implements initial support for Single Root I/O Virtualization > on an NVMe device. > > Essentially, it allows to define the maximum number of virtual functions > supported by the NVMe controller via sriov_max_vfs parameter. > > Passing a non-zero

Re: [PATCH v5 15/15] hw/nvme: Update the initalization place for the AER queue

2022-02-17 Thread Klaus Jensen
On Feb 17 18:45, Lukasz Maniak wrote: > From: Łukasz Gieryk > > This patch updates the initialization place for the AER queue, so it’s > initialized once, at controller initialization, and not every time > controller is enabled. > > While the original version works for a non-SR-IOV device, as it

Re: [PATCH] hw/ide: implement ich6 ide controller support

2022-02-17 Thread John Snow
On Mon, Feb 14, 2022 at 1:48 PM Liav Albani wrote: > > Hello BALATON, > > Thank you for helping keeping this patch noticeable to everyone :) > > I tried to reach out to John via a private email last Saturday (two days > ago) so I don't "spam" the mailing list for no good reason. > It might be that

Re: [PATCH v2] ide: Increment BB in-flight counter for TRIM BH

2022-02-17 Thread John Snow
On Tue, Feb 15, 2022 at 12:14 PM Hanna Reitz wrote: > > Ping > > (I can take it too, if you’d like, John, but you’re listed as the only > maintainer for hw/ide, so... Just say the word, though!) > Sorry, I sent you a mail off-list at the time where I said you were free to take it whenever you li

Re: [PATCH v5 03/16] tests/fp/berkeley-testfloat-3: Ignore ignored #pragma directives

2022-02-17 Thread Peter Maydell
On Mon, 14 Feb 2022 at 18:56, Philippe Mathieu-Daudé wrote: > > Since we already use -Wno-unknown-pragmas, we can also use > -Wno-ignored-pragmas. This silences hundred of warnings using > clang 13 on macOS Monterey: > > [409/771] Compiling C object > tests/fp/libtestfloat.a.p/berkeley-testfloa

Re: [PATCH v5 01/16] MAINTAINERS: Add Akihiko Odaki to macOS-relateds

2022-02-17 Thread Peter Maydell
On Mon, 14 Feb 2022 at 18:56, Philippe Mathieu-Daudé wrote: > > From: Akihiko Odaki > > Signed-off-by: Akihiko Odaki > Reviewed-by: Christian Schoenebeck > Reviewed-by: Philippe Mathieu-Daudé > Message-Id: <20220213021215.1974-1-akihiko.od...@gmail.com> > Signed-off-by: Philippe Mathieu-Daudé

Re: [PATCH v5 02/16] configure: Allow passing extra Objective C compiler flags

2022-02-17 Thread Peter Maydell
On Mon, 14 Feb 2022 at 18:56, Philippe Mathieu-Daudé wrote: > > We can pass C/CPP/LD flags via CFLAGS/CXXFLAGS/LDFLAGS environment > variables, or via configure --extra-cflags / --extra-cxxflags / > --extra-ldflags options. Provide similar behavior for Objective C: > use existing flags from $OBJCF

[PATCH v1] aio-posix: fix build failure io_uring 2.2

2022-02-17 Thread Haiyue Wang
The io_uring fixed "Don't truncate addr fields to 32-bit on 32-bit": https://git.kernel.dk/cgit/liburing/commit/?id=d84c29b19ed0b13619cff40141bb1fc3615b This leads to build failure: ../util/fdmon-io_uring.c: In function ‘add_poll_remove_sqe’: ../util/fdmon-io_uring.c:182:36: error: passing arg

[PATCH v5 14/15] docs: Add documentation for SR-IOV and Virtualization Enhancements

2022-02-17 Thread Lukasz Maniak
Signed-off-by: Lukasz Maniak --- docs/system/devices/nvme.rst | 82 1 file changed, 82 insertions(+) diff --git a/docs/system/devices/nvme.rst b/docs/system/devices/nvme.rst index b5acb2a9c19..aba253304e4 100644 --- a/docs/system/devices/nvme.rst +++ b/docs/s

[PATCH v5 12/15] hw/nvme: Initialize capability structures for primary/secondary controllers

2022-02-17 Thread Lukasz Maniak
From: Łukasz Gieryk With four new properties: - sriov_v{i,q}_flexible, - sriov_max_v{i,q}_per_vf, one can configure the number of available flexible resources, as well as the limits. The primary and secondary controller capability structures are initialized accordingly. Since the number of ava

[PATCH v5 11/15] hw/nvme: Calculate BAR attributes in a function

2022-02-17 Thread Lukasz Maniak
From: Łukasz Gieryk An NVMe device with SR-IOV capability calculates the BAR size differently for PF and VF, so it makes sense to extract the common code to a separate function. Signed-off-by: Łukasz Gieryk Reviewed-by: Klaus Jensen --- hw/nvme/ctrl.c | 45 +++-

[PATCH v5 09/15] hw/nvme: Make max_ioqpairs and msix_qsize configurable in runtime

2022-02-17 Thread Lukasz Maniak
From: Łukasz Gieryk The NVMe device defines two properties: max_ioqpairs, msix_qsize. Having them as constants is problematic for SR-IOV support. SR-IOV introduces virtual resources (queues, interrupts) that can be assigned to PF and its dependent VFs. Each device, following a reset, should work

[PATCH v5 13/15] hw/nvme: Add support for the Virtualization Management command

2022-02-17 Thread Lukasz Maniak
From: Łukasz Gieryk With the new command one can: - assign flexible resources (queues, interrupts) to primary and secondary controllers, - toggle the online/offline state of given controller. Signed-off-by: Łukasz Gieryk --- hw/nvme/ctrl.c | 257 +

[PATCH v5 07/15] hw/nvme: Add support for Secondary Controller List

2022-02-17 Thread Lukasz Maniak
Introduce handling for Secondary Controller List (Identify command with CNS value of 15h). Secondary controller ids are unique in the subsystem, hence they are reserved by it upon initialization of the primary controller to the number of sriov_max_vfs. ID reservation requires the addition of an i

[PATCH v5 05/15] hw/nvme: Add support for SR-IOV

2022-02-17 Thread Lukasz Maniak
This patch implements initial support for Single Root I/O Virtualization on an NVMe device. Essentially, it allows to define the maximum number of virtual functions supported by the NVMe controller via sriov_max_vfs parameter. Passing a non-zero value to sriov_max_vfs triggers reporting of SR-IOV

[PATCH v5 10/15] hw/nvme: Remove reg_size variable and update BAR0 size calculation

2022-02-17 Thread Lukasz Maniak
From: Łukasz Gieryk The n->reg_size parameter unnecessarily splits the BAR0 size calculation in two phases; removed to simplify the code. With all the calculations done in one place, it seems the pow2ceil, applied originally to reg_size, is unnecessary. The rounding should happen as the last ste

[PATCH v5 08/15] hw/nvme: Implement the Function Level Reset

2022-02-17 Thread Lukasz Maniak
From: Łukasz Gieryk This patch implements the Function Level Reset, a feature currently not implemented for the Nvme device, while listed as a mandatory ("shall") in the 1.4 spec. The implementation reuses FLR-related building blocks defined for the pci-bridge module, and follows the same logic:

[PATCH v5 15/15] hw/nvme: Update the initalization place for the AER queue

2022-02-17 Thread Lukasz Maniak
From: Łukasz Gieryk This patch updates the initialization place for the AER queue, so it’s initialized once, at controller initialization, and not every time controller is enabled. While the original version works for a non-SR-IOV device, as it’s hard to interact with the controller if it’s not

[PATCH v5 06/15] hw/nvme: Add support for Primary Controller Capabilities

2022-02-17 Thread Lukasz Maniak
Implementation of Primary Controller Capabilities data structure (Identify command with CNS value of 14h). Currently, the command returns only ID of a primary controller. Handling of remaining fields are added in subsequent patches implementing virtualization enhancements. Signed-off-by: Lukasz M

[PATCH v5 01/15] pcie: Add support for Single Root I/O Virtualization (SR/IOV)

2022-02-17 Thread Lukasz Maniak
From: Knut Omang This patch provides the building blocks for creating an SR/IOV PCIe Extended Capability header and register/unregister SR/IOV Virtual Functions. Signed-off-by: Knut Omang --- hw/pci/meson.build | 1 + hw/pci/pci.c| 100 +--- hw/pci/pcie.c

[PATCH v5 03/15] pcie: Add a helper to the SR/IOV API

2022-02-17 Thread Lukasz Maniak
From: Łukasz Gieryk Convenience function for retrieving the PCIDevice object of the N-th VF. Signed-off-by: Łukasz Gieryk Reviewed-by: Knut Omang --- hw/pci/pcie_sriov.c | 10 +- include/hw/pci/pcie_sriov.h | 6 ++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --

[PATCH v5 04/15] pcie: Add 1.2 version token for the Power Management Capability

2022-02-17 Thread Lukasz Maniak
From: Łukasz Gieryk Signed-off-by: Łukasz Gieryk --- include/hw/pci/pci_regs.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/hw/pci/pci_regs.h b/include/hw/pci/pci_regs.h index 77ba64b9314..a5901409622 100644 --- a/include/hw/pci/pci_regs.h +++ b/include/hw/pci/pci_regs.h @@ -4,5

[PATCH v5 02/15] pcie: Add some SR/IOV API documentation in docs/pcie_sriov.txt

2022-02-17 Thread Lukasz Maniak
From: Knut Omang Add a small intro + minimal documentation for how to implement SR/IOV support for an emulated device. Signed-off-by: Knut Omang --- docs/pcie_sriov.txt | 115 1 file changed, 115 insertions(+) create mode 100644 docs/pcie_sriov.txt

[PATCH v5 00/15] hw/nvme: SR-IOV with Virtualization Enhancements

2022-02-17 Thread Lukasz Maniak
Changes since v4: - Added hello world example for SR-IOV to the docs - Moved AER initialization from nvme_init_ctrl to nvme_init_state - Fixed division by zero issue in calculation of vqfrt and vifrt capabilities Knut Omang (2): pcie: Add support for Single Root I/O Virtualization (SR/IOV) p

Re: [PATCH v5 11/20] block/mirror.c: use of job helpers in drivers to avoid TOC/TOU

2022-02-17 Thread Stefan Hajnoczi
On Tue, Feb 08, 2022 at 09:35:04AM -0500, Emanuele Giuseppe Esposito wrote: > Once job lock is used and aiocontext is removed, mirror has > to perform job operations under the same critical section, > using the helpers prepared in previous commit. > > Note: at this stage, job_{lock/unlock} and job

Re: [PATCH 1/6] block/io.c: fix bdrv_child_cb_drained_begin invocations from a coroutine

2022-02-17 Thread Emanuele Giuseppe Esposito
On 14/02/2022 12:57, Paolo Bonzini wrote: > On 2/14/22 11:27, Emanuele Giuseppe Esposito wrote: >> Anyways, I think that in addition to the fix in this patch, we should >> also fix bdrv_parent_drained_begin_single(poll=true) in >> bdrv_replace_child_noperm, with something similar to what is done

Re: [PATCH v2] nbd/server: Allow MULTI_CONN for shared writable exports

2022-02-17 Thread Eric Blake
On Wed, Feb 16, 2022 at 02:44:52PM +0100, Markus Armbruster wrote: > > > > +## > > +# @NbdExportMultiConn: > > +# > > +# Possible settings for advertising NBD multiple client support. > > +# > > +# @off: Do not advertise multiple clients. > > +# > > +# @on: Allow multiple clients (for writable clie

Re: [PATCH v5 09/20] jobs: add job lock in find_* functions

2022-02-17 Thread Stefan Hajnoczi
On Tue, Feb 08, 2022 at 09:35:02AM -0500, Emanuele Giuseppe Esposito wrote: > diff --git a/blockdev.c b/blockdev.c > index c5fba4d157..08408cd44b 100644 > --- a/blockdev.c > +++ b/blockdev.c > @@ -3311,7 +3311,10 @@ out: > aio_context_release(aio_context); > } > > -/* Get a block job using

Re: [PATCH v5 08/20] jobs: protect jobs with job_lock/unlock

2022-02-17 Thread Stefan Hajnoczi
On Tue, Feb 08, 2022 at 09:35:01AM -0500, Emanuele Giuseppe Esposito wrote: > diff --git a/block/replication.c b/block/replication.c > index 55c8f894aa..a03b28726e 100644 > --- a/block/replication.c > +++ b/block/replication.c > @@ -149,7 +149,9 @@ static void replication_close(BlockDriverState *bs

Re: [PATCH v5 06/20] jobs: remove aiocontext locks since the functions are under BQL

2022-02-17 Thread Stefan Hajnoczi
On Tue, Feb 08, 2022 at 09:34:59AM -0500, Emanuele Giuseppe Esposito wrote: > In preparation to the job_lock/unlock patch, remove these > aiocontext locks. > The main reason these two locks are removed here is because > they are inside a loop iterating on the jobs list. Once the > job_lock is added

Re: [PATCH v5 04/20] job.c: move inner aiocontext lock in callbacks

2022-02-17 Thread Stefan Hajnoczi
On Tue, Feb 08, 2022 at 09:34:57AM -0500, Emanuele Giuseppe Esposito wrote: > Instead of having the lock in job_tnx_apply, move it inside s/tnx/txn/ > in the callback. This will be helpful for next commits, when > we introduce job_lock/unlock pairs. > > job_transition_to_pending() and job_needs_

Re: [PATCH v5 07/20] job.h: add _locked duplicates for job API functions called with and without job_mutex

2022-02-17 Thread Stefan Hajnoczi
On Tue, Feb 08, 2022 at 09:35:00AM -0500, Emanuele Giuseppe Esposito wrote: > static void job_exit(void *opaque) > { > Job *job = (Job *)opaque; > AioContext *ctx; > +JOB_LOCK_GUARD(); > > job_ref(job); > aio_context_acquire(job->aio_context); The previous patch said:

Re: [PATCH v5 05/20] aio-wait.h: introduce AIO_WAIT_WHILE_UNLOCKED

2022-02-17 Thread Stefan Hajnoczi
On Tue, Feb 08, 2022 at 09:34:58AM -0500, Emanuele Giuseppe Esposito wrote: > Same as AIO_WAIT_WHILE macro, but if we are in the Main loop > do not release and then acquire ctx_ 's aiocontext. > > Once all Aiocontext locks go away, this macro will replace > AIO_WAIT_WHILE. > > Signed-off-by: Eman

[PULL 10/10] docs: expand firmware descriptor to allow flash without NVRAM

2022-02-17 Thread Daniel P . Berrangé
The current firmware descriptor schema for flash requires that both the executable to NVRAM template paths be provided. This is fine for the most common usage of EDK2 builds in virtualization where the separate _CODE and _VARS files are provided. With confidential computing technology like AMD SEV

[PULL 09/10] MAINTAINERS: take over seccomp from Eduardo Otubo

2022-02-17 Thread Daniel P . Berrangé
Eduardo has indicated that he no longer has time to be involved in a QEMU maintainership role. As one of the more frequent contributors of patches and design ideas to seccomp, I'll take over in an "Odd Fixes" role. Acked-by: Eduardo Otubo Signed-off-by: Daniel P. Berrangé --- MAINTAINERS | 4 ++

[PULL 02/10] block: support sha256 fingerprint with pre-blockdev options

2022-02-17 Thread Daniel P . Berrangé
When support for sha256 fingerprint checking was aded in commit bf783261f0aee6e81af3916bff7606d71ccdc153 Author: Daniel P. Berrangé Date: Tue Jun 22 12:51:56 2021 +0100 block/ssh: add support for sha256 host key fingerprints it was only made to work with -blockdev. Getting it workin

[PULL 01/10] block: better document SSH host key fingerprint checking

2022-02-17 Thread Daniel P . Berrangé
The docs still illustrate host key fingerprint checking using the old md5 hashes which are considered insecure and obsolete. Change it to illustrate using a sha256 hash. Also show how to extract the hash value from the known_hosts file. Reviewed-by: Hanna Reitz Signed-off-by: Daniel P. Berrangé

[PULL 06/10] seccomp: fix blocking of process spawning

2022-02-17 Thread Daniel P . Berrangé
When '-sandbox on,spawn=deny' is given, we are supposed to block the ability to spawn processes. We naively blocked the 'fork' syscall, forgetting that any modern libc will use the 'clone' syscall instead. We can't simply block the 'clone' syscall though, as that will break thread creation. We thu

[PULL 03/10] block: print the server key type and fingerprint on failure

2022-02-17 Thread Daniel P . Berrangé
When validating the server key fingerprint fails, it is difficult for the user to know what they got wrong. The fingerprint accepted by QEMU is received in a different format than OpenSSH displays. There can also be keys for multiple different ciphers in known_hosts. It may not be obvious which cip

[PULL 05/10] seccomp: add unit test for seccomp filtering

2022-02-17 Thread Daniel P . Berrangé
The handling of some syscalls / libc function is quite subtle. For example, 'fork' at a libc level doesn't always correspond to 'fork' at a syscall level, since the 'clone' syscall is preferred usually. The unit test will help to detect these kind of problems. A point of difficulty in writing a te

[PULL 07/10] seccomp: block use of clone3 syscall

2022-02-17 Thread Daniel P . Berrangé
Modern glibc will use clone3 instead of clone, when it detects that it is available. We need to compare flags in order to decide whether to allow clone (thread create vs process fork), but in clone3 the flags are hidden inside a struct. Seccomp can't currently match on data inside a struct, so our

[PULL 04/10] seccomp: allow action to be customized per syscall

2022-02-17 Thread Daniel P . Berrangé
We're currently tailoring whether to use kill process or return EPERM based on the syscall set. This is not flexible enough for future requirements where we also need to be able to return a variety of actions on a per-syscall granularity. Acked-by: Eduardo Otubo Signed-off-by: Daniel P. Berrangé

[PULL 08/10] seccomp: block setns, unshare and execveat syscalls

2022-02-17 Thread Daniel P . Berrangé
setns/unshare are used to change namespaces which is not something QEMU needs to be able todo. execveat is a new variant of execve so should be blocked just like execve already is. Acked-by: Eduardo Otubo Signed-off-by: Daniel P. Berrangé --- softmmu/qemu-seccomp.c | 5 + 1 file changed, 5

[PULL 00/10] Misc next patches

2022-02-17 Thread Daniel P . Berrangé
The following changes since commit ad38520bdeb2b1e0b487db317f29119e94c1c88d: Merge remote-tracking branch 'remotes/stefanha-gitlab/tags/block-pull-request' into staging (2022-02-15 19:30:33 +) are available in the Git repository at: https://gitlab.com/berrange/qemu tags/misc-next-pull-