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

2021-11-04 Thread Łukasz Gieryk
On Wed, Nov 03, 2021 at 01:07:31PM +0100, Klaus Jensen wrote: > On Oct 7 18:24, Lukasz Maniak wrote: > > From: Łukasz Gieryk > > > > With two new properties (sriov_max_vi_per_vf, sriov_max_vq_per_vf) one > > can configure the maximum number of virtual queues and int

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

2021-11-05 Thread Łukasz Gieryk
On Thu, Nov 04, 2021 at 04:48:43PM +0100, Łukasz Gieryk wrote: > On Wed, Nov 03, 2021 at 01:07:31PM +0100, Klaus Jensen wrote: > > On Oct 7 18:24, Lukasz Maniak wrote: > > > From: Łukasz Gieryk > > > > > > With two new properties (sriov_max_vi_per_vf

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

2021-11-05 Thread Łukasz Gieryk
On Fri, Nov 05, 2021 at 09:46:28AM +0100, Łukasz Gieryk wrote: > On Thu, Nov 04, 2021 at 04:48:43PM +0100, Łukasz Gieryk wrote: > > On Wed, Nov 03, 2021 at 01:07:31PM +0100, Klaus Jensen wrote: > > > On Oct 7 18:24, Lukasz Maniak wrote: > > > > From: Łukasz Gieryk

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

2021-11-08 Thread Łukasz Gieryk
On Mon, Nov 08, 2021 at 09:25:58AM +0100, Klaus Jensen wrote: > On Nov 5 15:04, Łukasz Gieryk wrote: > > On Fri, Nov 05, 2021 at 09:46:28AM +0100, Łukasz Gieryk wrote: > > > On Thu, Nov 04, 2021 at 04:48:43PM +0100, Łukasz Gieryk wrote: > > > > On Wed, Nov 03, 2

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

2021-11-16 Thread Ł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 77ba64b931..a590140962 100644 --- a/include/hw/pci/pci_regs.h +++ b/include/hw/pci/pci_regs.h @@ -4,5 +4,6 @@ #include

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

2021-11-16 Thread Łukasz Gieryk
From: 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 trigge

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

2021-11-16 Thread Łukasz Gieryk
From: 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. S

[PATCH v2 03/15] pcie: Add helpers to the SR/IOV API

2021-11-16 Thread Łukasz Gieryk
Two convenience functions for retrieving: - the total number of VFs, - the PCIDevice object of the N-th VF. Signed-off-by: Łukasz Gieryk Reviewed-by: Knut Omang --- hw/pci/pcie_sriov.c | 14 ++ include/hw/pci/pcie_sriov.h | 8 2 files changed, 22 insertions

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

2021-11-16 Thread Łukasz Gieryk
handled properly. Signed-off-by: Łukasz Gieryk Reviewed-by: Klaus Jensen --- hw/nvme/ctrl.c | 45 hw/nvme/nvme.h | 5 + hw/nvme/trace-events | 1 + 3 files changed, 47 insertions(+), 4 deletions(-) diff --git a/hw/nvme/ctr

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

2021-11-16 Thread Łukasz Gieryk
lities hw/nvme: Add support for Secondary Controller List docs: Add documentation for SR-IOV and Virtualization Enhancements Łukasz Gieryk (9): pcie: Add helpers to the SR/IOV API pcie: Add 1.2 version token for the Power Management Capability hw/nvme: Implement the Function Level Reset

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

2021-11-16 Thread Łukasz Gieryk
d big enough to handle the limits, to completely avoid the complicated reallocation. A helper function (nvme_update_msixcap_ts) updates the corresponding capability register, to signal configuration changes. Signed-off-by: Łukasz Gieryk --- hw/nvme

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

2021-11-16 Thread Łukasz Gieryk
(2) ] [MSIX PBA ] [power-of-2 padding] Signed-off-by: Łukasz Gieryk --- hw/nvme/ctrl.c | 10 +- hw/nvme/nvme.h | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index d502917d98..2f3b6b5a82 100644 --- a/hw/nvme/ctrl.c ++

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

2021-11-16 Thread Łukasz Gieryk
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| 97 +--- hw/pci/pcie.c

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

2021-11-16 Thread Łukasz Gieryk
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 v2 14/15] docs: Add documentation for SR-IOV and Virtualization Enhancements

2021-11-16 Thread Łukasz Gieryk
From: Lukasz Maniak Signed-off-by: Lukasz Maniak --- docs/system/devices/nvme.rst | 35 +++ 1 file changed, 35 insertions(+) diff --git a/docs/system/devices/nvme.rst b/docs/system/devices/nvme.rst index bff72d1c24..29fe2565b5 100644 --- a/docs/system/devices/nv

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

2021-11-16 Thread Łukasz Gieryk
With the new Virtualization Management 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 | 204

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

2021-11-16 Thread Łukasz Gieryk
(interrupts) now varies between VF/PF, BAR size calculation is also adjusted. Signed-off-by: Łukasz Gieryk --- hw/nvme/ctrl.c | 138 --- hw/nvme/nvme.h | 4 ++ include/block/nvme.h | 5 ++ 3 files changed, 140 insertions(+), 7 deletions(-) diff

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

2021-11-16 Thread Łukasz Gieryk
an interesting question whether a VF should support AER in the first place, I don’t think it must be answered today. Signed-off-by: Łukasz Gieryk --- hw/nvme/ctrl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index 9d0432a2e5

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

2021-11-16 Thread Łukasz Gieryk
From: 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 require

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

2021-11-16 Thread Ł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 --- hw/nvme/ctrl.c | 45 +++-- 1 file changed, 31 insertions(+), 14

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

2021-11-17 Thread Łukasz Gieryk
On Tue, Nov 16, 2021 at 01:28:19PM -0800, Keith Busch wrote: > On Tue, Nov 16, 2021 at 04:34:39PM +0100, Łukasz Gieryk wrote: > > if (!pci_is_vf(&n->parent_obj) && n->params.sriov_max_vfs) { > > -pcie_sriov_pf_disable_vfs(&n->parent_obj); >

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

2021-11-24 Thread Łukasz Gieryk
On Wed, Nov 24, 2021 at 09:06:23AM +0100, Klaus Jensen wrote: > On Nov 16 16:34, Łukasz Gieryk wrote: > > With the new Virtualization Management command one can: > > - assign flexible resources (queues, interrupts) to primary and > >secondary controllers, > >

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

2021-11-24 Thread Łukasz Gieryk
On Wed, Nov 24, 2021 at 09:04:31AM +0100, Klaus Jensen wrote: > On Nov 16 16:34, Łukasz Gieryk wrote: > > 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

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

2021-11-25 Thread Łukasz Gieryk
On Wed, Nov 24, 2021 at 03:26:30PM +0100, Łukasz Gieryk wrote: > On Wed, Nov 24, 2021 at 09:04:31AM +0100, Klaus Jensen wrote: > > On Nov 16 16:34, Łukasz Gieryk wrote: > > > With four new properties: > > > - sriov_v{i,q}_flexible, > > > - sriov_max_v{i,q}

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

2021-11-25 Thread Łukasz Gieryk
On Wed, Nov 24, 2021 at 09:03:06AM +0100, Klaus Jensen wrote: > Hi Lukasz, > > I've been through this. I have a couple of review comments, but overall > looks good for inclusion in nvme-next. Would be nice to get this in > early in the cycle so it can mature there for 7.0. We (I’m speaking on beh

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

2021-12-20 Thread Łukasz Gieryk
On Mon, Dec 20, 2021 at 08:12:06AM +0100, Klaus Jensen wrote: > On Nov 25 15:15, Łukasz Gieryk wrote: > > On Wed, Nov 24, 2021 at 09:03:06AM +0100, Klaus Jensen wrote: > > > Hi Lukasz, > > > > > > I've been through this. I have a couple of review c

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

2022-01-26 Thread Łukasz Gieryk
I'm sorry for the delayed response. We (I and the other Lukasz) somehow had hoped that Knut, the original author of this patch, would have responded. Let me address your questions, up to my best knowledge. > > -static pcibus_t pci_bar_address(PCIDevice *d, > > -i

Re: [PATCH 10/15] hw/nvme: Make max_ioqpairs and msix_qsize configurable in runtime

2021-10-18 Thread Łukasz Gieryk
On Mon, Oct 18, 2021 at 12:06:22PM +0200, Philippe Mathieu-Daudé wrote: > On 10/7/21 18:24, Lukasz Maniak wrote: > > From: Łukasz Gieryk > > > > The Nvme device defines two properties: max_ioqpairs, msix_qsize. Having > > them as constants is problematic for SR-IOV s

Re: [PATCH 10/15] hw/nvme: Make max_ioqpairs and msix_qsize configurable in runtime

2021-10-21 Thread Łukasz Gieryk
On Wed, Oct 20, 2021 at 09:06:06PM +0200, Klaus Jensen wrote: > On Oct 7 18:24, Lukasz Maniak wrote: > > From: Łukasz Gieryk > > > > The Nvme device defines two properties: max_ioqpairs, msix_qsize. Having > > them as constants is problematic for SR-IOV support.

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

2022-03-09 Thread Łukasz Gieryk
On Tue, Mar 01, 2022 at 02:07:08PM +0100, Klaus Jensen wrote: > On Feb 17 18:45, Lukasz Maniak wrote: > > From: Łukasz Gieryk > > > > With the new command one can: > > - assign flexible resources (queues, interrupts) to primary and > >secondary controllers,

Re: [PATCH v7 12/12] hw/acpi: Make the PCI hot-plug aware of SR-IOV

2022-04-04 Thread Łukasz Gieryk
On Thu, Mar 31, 2022 at 02:38:41PM +0200, Igor Mammedov wrote: > it's unclear what's bing hotpluged and unplugged, it would be better if > you included QEMU CLI and relevan qmp/monito commands to reproduce it. Qemu CLI: - -device pcie-root-port,slot=0,id=rp0 -device nvme-subsys,id=subsys0

Re: [PATCH v2] hw/nvme: clean up CC register write logic

2022-06-07 Thread Łukasz Gieryk
On Fri, Jun 03, 2022 at 10:24:51PM +0200, Klaus Jensen wrote: > On Jun 1 15:28, Lukasz Maniak wrote: > > On Wed, May 25, 2022 at 09:35:24AM +0200, Klaus Jensen wrote: > > > > > > +stl_le_p(&n->bar.intms, 0); > > > +stl_le_p(&n->bar.intmc, 0); > > > +stl_le_p(&n->bar.cc, 0)

Re: [PATCH v3] hw/nvme: clean up CC register write logic

2022-06-08 Thread Łukasz Gieryk
ts &= ~NVME_CSTS_READY; > -} > > -if (NVME_CC_SHN(data) && !(NVME_CC_SHN(cc))) { > -trace_pci_nvme_mmio_shutdown_set(); > -nvme_ctrl_shutdown(n); > - cc = data; > -csts |= NVME_CSTS_SHST_COMPLETE; > -} else if (!NVME_CC_SHN(data) && NVME_CC_SHN(cc)) { > -trace_pci_nvme_mmio_shutdown_cleared(); > -csts &= ~NVME_CSTS_SHST_COMPLETE; > -cc = data; > +break; > } > > -stl_le_p(&n->bar.cc, cc); > stl_le_p(&n->bar.csts, csts); > > break; > -- > 2.36.1 Reviewed-by: Łukasz Gieryk