Re: [Qemu-devel] [PATCH v6 0/4] pcie: Add support for Single Root I/O Virtualization

2015-10-22 Thread Knut Omang
Michael,

I just realized that this now went out without 

Reviewed-by: Marcel Apfelbaum 

to patches 2-4, 

Sorry about that - can you add it for me?

Thanks,
Knut

On Thu, 2015-10-22 at 10:01 +0200, Knut Omang wrote:
> This patch set implements generic support for SR/IOV as an extension
> to the
> core PCIe functionality, similar to the way other capabilities such
> as AER
> is implemented.
> 
> There is no implementation of any device that provides
> SR/IOV support included, but I have implemented a test
> example which can be found together with this patch set here:
> 
>   git://github.com/knuto/qemu.git sriov_patches_v6
> 
> Testing with the example device was documented here:
> 
>   
> http://lists.nongnu.org/archive/html/qemu-devel/2014-08/msg05110.html
> 
> Changes since v5:
>   - Fix reset logic that got broken in v5. Reset logic is now equal
> to
> that of v4 except that two ambiguous initialization statements
> (introduced during rebase) have been removed
>   - From private feedback, added observer functions for SR/IOV values
> in pcie_sriov.h. To ease access to the vf number, the SR/IOV VF
> device
> struct extension now caches this value.
> 
> Changes since v4:
>   - Mostly based on feeback in Marcel Apfelbaum's review:
>   - The patch with changes to pci_regs.h got eliminated by rebase
>   - Added some documentation as an additional patch
>   - Some trivial fixes moved to separate patch
>   - Modified code to use error and trace functions instead of printfs
> 
> Changes since v3:
>   - Reworked 'pci: Update pci_regs header' to merge kernel version
> improvements
> with the current qemu version instead of copying from the kernel
> version.
> 
> Changes since v2:
>   - Rebased onto 090d0bfd
>   - Un-qdev'ified - avoids issues when resetting NUM_VFS
>   - Fixed handling of vf_offset/vf_stride
> 
> Changes since v1:
>   - Rebased on top of latest master, eliminating prereqs.
>   - Implement proper support for VF_STRIDE, VF_OFFSET and SUP_PGSIZE
> Time better spent fixing it than explaining what the previous
> limitations were.
> - Added new first patch to fix pci bug related to this
>   - Split out patch to pci_default_config_write to a separate patch 2
> to highlight bug fix.
>   - Refactored out logic into new source files
> hw/pci/pcie_sriov.c include/hw/pci/pcie_sriov.h
> similar to pcie_aer.c/h.
>   - Rename functions and introduce structs to better separate
> pf and vf functionality.
>   - Replaced is_vf member with pci_is_vf() function abstraction
>   - Fix numerous syntax, whitespace and comment issues
> according to Michael's review.
>   - Fix memory leaks.
>   - Removed igb example device - a rebased version available
> on github instead.
> 
> Knut Omang (4):
>   pci: Make use of the devfn property when registering new devices
>   pcie: Add support for Single Root I/O Virtualization (SR/IOV)
>   pcie: Add some SR/IOV API documentation in docs/pcie_sriov.txt
>   pcie: A few minor fixes (type+code simplify)
> 
>  docs/pcie_sriov.txt | 115 ++
>  hw/pci/Makefile.objs|   2 +-
>  hw/pci/pci.c|  97 
>  hw/pci/pcie.c   |   9 +-
>  hw/pci/pcie_sriov.c | 277
> 
>  include/hw/pci/pci.h|  11 +-
>  include/hw/pci/pcie.h   |   6 +
>  include/hw/pci/pcie_sriov.h |  67 +++
>  include/qemu/typedefs.h |   2 +
>  trace-events|   5 +
>  10 files changed, 561 insertions(+), 30 deletions(-)
>  create mode 100644 docs/pcie_sriov.txt
>  create mode 100644 hw/pci/pcie_sriov.c
>  create mode 100644 include/hw/pci/pcie_sriov.h
> 
> --
> 2.4.3



[Qemu-devel] [PATCH v6 0/4] pcie: Add support for Single Root I/O Virtualization

2015-10-22 Thread Knut Omang
This patch set implements generic support for SR/IOV as an extension to the
core PCIe functionality, similar to the way other capabilities such as AER
is implemented.

There is no implementation of any device that provides
SR/IOV support included, but I have implemented a test
example which can be found together with this patch set here:

  git://github.com/knuto/qemu.git sriov_patches_v6

Testing with the example device was documented here:

  http://lists.nongnu.org/archive/html/qemu-devel/2014-08/msg05110.html

Changes since v5:
  - Fix reset logic that got broken in v5. Reset logic is now equal to
that of v4 except that two ambiguous initialization statements
(introduced during rebase) have been removed
  - From private feedback, added observer functions for SR/IOV values
in pcie_sriov.h. To ease access to the vf number, the SR/IOV VF device
struct extension now caches this value.

Changes since v4:
  - Mostly based on feeback in Marcel Apfelbaum's review:
  - The patch with changes to pci_regs.h got eliminated by rebase
  - Added some documentation as an additional patch
  - Some trivial fixes moved to separate patch
  - Modified code to use error and trace functions instead of printfs

Changes since v3:
  - Reworked 'pci: Update pci_regs header' to merge kernel version improvements
with the current qemu version instead of copying from the kernel version.

Changes since v2:
  - Rebased onto 090d0bfd
  - Un-qdev'ified - avoids issues when resetting NUM_VFS
  - Fixed handling of vf_offset/vf_stride

Changes since v1:
  - Rebased on top of latest master, eliminating prereqs.
  - Implement proper support for VF_STRIDE, VF_OFFSET and SUP_PGSIZE
Time better spent fixing it than explaining what the previous
limitations were.
- Added new first patch to fix pci bug related to this
  - Split out patch to pci_default_config_write to a separate patch 2
to highlight bug fix.
  - Refactored out logic into new source files
hw/pci/pcie_sriov.c include/hw/pci/pcie_sriov.h
similar to pcie_aer.c/h.
  - Rename functions and introduce structs to better separate
pf and vf functionality.
  - Replaced is_vf member with pci_is_vf() function abstraction
  - Fix numerous syntax, whitespace and comment issues
according to Michael's review.
  - Fix memory leaks.
  - Removed igb example device - a rebased version available
on github instead.

Knut Omang (4):
  pci: Make use of the devfn property when registering new devices
  pcie: Add support for Single Root I/O Virtualization (SR/IOV)
  pcie: Add some SR/IOV API documentation in docs/pcie_sriov.txt
  pcie: A few minor fixes (type+code simplify)

 docs/pcie_sriov.txt | 115 ++
 hw/pci/Makefile.objs|   2 +-
 hw/pci/pci.c|  97 
 hw/pci/pcie.c   |   9 +-
 hw/pci/pcie_sriov.c | 277 
 include/hw/pci/pci.h|  11 +-
 include/hw/pci/pcie.h   |   6 +
 include/hw/pci/pcie_sriov.h |  67 +++
 include/qemu/typedefs.h |   2 +
 trace-events|   5 +
 10 files changed, 561 insertions(+), 30 deletions(-)
 create mode 100644 docs/pcie_sriov.txt
 create mode 100644 hw/pci/pcie_sriov.c
 create mode 100644 include/hw/pci/pcie_sriov.h

--
2.4.3



Re: [Qemu-devel] [PATCH v6 0/4] pcie: Add support for Single Root I/O Virtualization

2015-10-22 Thread Knut Omang
On Thu, 2015-10-22 at 16:14 +0300, Michael S. Tsirkin wrote:
> On Thu, Oct 22, 2015 at 10:01:31AM +0200, Knut Omang wrote:
> > This patch set implements generic support for SR/IOV as an
> > extension to the
> > core PCIe functionality, similar to the way other capabilities such
> > as AER
> > is implemented.
> 
> We are in soft freeze now so I'd rather defer this until
> 2.5 is out.

Ok, I kind of suspected that the 2.5 train had left, no problem..

> This should give you some time to come up with an actual
> user for this API.
> 
> If it helps, I can park these patches on a branch in my tree so
> you don't need to keep reposting them.

Yes, that would be great,

Thanks,
Knut

> > There is no implementation of any device that provides
> > SR/IOV support included, but I have implemented a test
> > example which can be found together with this patch set here:
> > 
> >   git://github.com/knuto/qemu.git sriov_patches_v6
> > 
> > Testing with the example device was documented here:
> > 
> >   http://lists.nongnu.org/archive/html/qemu-devel/2014-08/msg05110.
> > html
> > 
> > Changes since v5:
> >   - Fix reset logic that got broken in v5. Reset logic is now equal
> > to
> > that of v4 except that two ambiguous initialization statements
> > (introduced during rebase) have been removed
> >   - From private feedback, added observer functions for SR/IOV
> > values
> > in pcie_sriov.h. To ease access to the vf number, the SR/IOV VF
> > device
> > struct extension now caches this value.
> > 
> > Changes since v4:
> >   - Mostly based on feeback in Marcel Apfelbaum's review:
> >   - The patch with changes to pci_regs.h got eliminated by rebase
> >   - Added some documentation as an additional patch
> >   - Some trivial fixes moved to separate patch
> >   - Modified code to use error and trace functions instead of
> > printfs
> > 
> > Changes since v3:
> >   - Reworked 'pci: Update pci_regs header' to merge kernel version
> > improvements
> > with the current qemu version instead of copying from the
> > kernel version.
> > 
> > Changes since v2:
> >   - Rebased onto 090d0bfd
> >   - Un-qdev'ified - avoids issues when resetting NUM_VFS
> >   - Fixed handling of vf_offset/vf_stride
> > 
> > Changes since v1:
> >   - Rebased on top of latest master, eliminating prereqs.
> >   - Implement proper support for VF_STRIDE, VF_OFFSET and
> > SUP_PGSIZE
> > Time better spent fixing it than explaining what the previous
> > limitations were.
> > - Added new first patch to fix pci bug related to this
> >   - Split out patch to pci_default_config_write to a separate patch
> > 2
> > to highlight bug fix.
> >   - Refactored out logic into new source files
> > hw/pci/pcie_sriov.c include/hw/pci/pcie_sriov.h
> > similar to pcie_aer.c/h.
> >   - Rename functions and introduce structs to better separate
> > pf and vf functionality.
> >   - Replaced is_vf member with pci_is_vf() function abstraction
> >   - Fix numerous syntax, whitespace and comment issues
> > according to Michael's review.
> >   - Fix memory leaks.
> >   - Removed igb example device - a rebased version available
> > on github instead.
> > 
> > Knut Omang (4):
> >   pci: Make use of the devfn property when registering new devices
> >   pcie: Add support for Single Root I/O Virtualization (SR/IOV)
> >   pcie: Add some SR/IOV API documentation in docs/pcie_sriov.txt
> >   pcie: A few minor fixes (type+code simplify)
> > 
> >  docs/pcie_sriov.txt | 115 ++
> >  hw/pci/Makefile.objs|   2 +-
> >  hw/pci/pci.c|  97 
> >  hw/pci/pcie.c   |   9 +-
> >  hw/pci/pcie_sriov.c | 277
> > 
> >  include/hw/pci/pci.h|  11 +-
> >  include/hw/pci/pcie.h   |   6 +
> >  include/hw/pci/pcie_sriov.h |  67 +++
> >  include/qemu/typedefs.h |   2 +
> >  trace-events|   5 +
> >  10 files changed, 561 insertions(+), 30 deletions(-)
> >  create mode 100644 docs/pcie_sriov.txt
> >  create mode 100644 hw/pci/pcie_sriov.c
> >  create mode 100644 include/hw/pci/pcie_sriov.h
> > 
> > --
> > 2.4.3



Re: [Qemu-devel] [PATCH v6 0/4] pcie: Add support for Single Root I/O Virtualization

2015-10-22 Thread Michael S. Tsirkin
On Thu, Oct 22, 2015 at 10:01:31AM +0200, Knut Omang wrote:
> This patch set implements generic support for SR/IOV as an extension to the
> core PCIe functionality, similar to the way other capabilities such as AER
> is implemented.

We are in soft freeze now so I'd rather defer this until
2.5 is out.

This should give you some time to come up with an actual
user for this API.

If it helps, I can park these patches on a branch in my tree so
you don't need to keep reposting them.

> There is no implementation of any device that provides
> SR/IOV support included, but I have implemented a test
> example which can be found together with this patch set here:
> 
>   git://github.com/knuto/qemu.git sriov_patches_v6
> 
> Testing with the example device was documented here:
> 
>   http://lists.nongnu.org/archive/html/qemu-devel/2014-08/msg05110.html
> 
> Changes since v5:
>   - Fix reset logic that got broken in v5. Reset logic is now equal to
> that of v4 except that two ambiguous initialization statements
> (introduced during rebase) have been removed
>   - From private feedback, added observer functions for SR/IOV values
> in pcie_sriov.h. To ease access to the vf number, the SR/IOV VF device
> struct extension now caches this value.
> 
> Changes since v4:
>   - Mostly based on feeback in Marcel Apfelbaum's review:
>   - The patch with changes to pci_regs.h got eliminated by rebase
>   - Added some documentation as an additional patch
>   - Some trivial fixes moved to separate patch
>   - Modified code to use error and trace functions instead of printfs
> 
> Changes since v3:
>   - Reworked 'pci: Update pci_regs header' to merge kernel version 
> improvements
> with the current qemu version instead of copying from the kernel version.
> 
> Changes since v2:
>   - Rebased onto 090d0bfd
>   - Un-qdev'ified - avoids issues when resetting NUM_VFS
>   - Fixed handling of vf_offset/vf_stride
> 
> Changes since v1:
>   - Rebased on top of latest master, eliminating prereqs.
>   - Implement proper support for VF_STRIDE, VF_OFFSET and SUP_PGSIZE
> Time better spent fixing it than explaining what the previous
> limitations were.
> - Added new first patch to fix pci bug related to this
>   - Split out patch to pci_default_config_write to a separate patch 2
> to highlight bug fix.
>   - Refactored out logic into new source files
> hw/pci/pcie_sriov.c include/hw/pci/pcie_sriov.h
> similar to pcie_aer.c/h.
>   - Rename functions and introduce structs to better separate
> pf and vf functionality.
>   - Replaced is_vf member with pci_is_vf() function abstraction
>   - Fix numerous syntax, whitespace and comment issues
> according to Michael's review.
>   - Fix memory leaks.
>   - Removed igb example device - a rebased version available
> on github instead.
> 
> Knut Omang (4):
>   pci: Make use of the devfn property when registering new devices
>   pcie: Add support for Single Root I/O Virtualization (SR/IOV)
>   pcie: Add some SR/IOV API documentation in docs/pcie_sriov.txt
>   pcie: A few minor fixes (type+code simplify)
> 
>  docs/pcie_sriov.txt | 115 ++
>  hw/pci/Makefile.objs|   2 +-
>  hw/pci/pci.c|  97 
>  hw/pci/pcie.c   |   9 +-
>  hw/pci/pcie_sriov.c | 277 
> 
>  include/hw/pci/pci.h|  11 +-
>  include/hw/pci/pcie.h   |   6 +
>  include/hw/pci/pcie_sriov.h |  67 +++
>  include/qemu/typedefs.h |   2 +
>  trace-events|   5 +
>  10 files changed, 561 insertions(+), 30 deletions(-)
>  create mode 100644 docs/pcie_sriov.txt
>  create mode 100644 hw/pci/pcie_sriov.c
>  create mode 100644 include/hw/pci/pcie_sriov.h
> 
> --
> 2.4.3



Re: [Qemu-devel] [PATCH v6 0/4] pcie: Add support for Single Root I/O Virtualization

2015-10-22 Thread Michael S. Tsirkin
On Thu, Oct 22, 2015 at 02:22:12PM +, Dotan Barak wrote:
> I tested those patches on QEMU v2.3.0 and they work
> (i.e. it adds to ability for emulated device to work SR-IOV).
> 
> However, when I based my model on newer version of QEMU (i.e. upstream) with 
> the new SR-IOV patches from Knut,
> There is a failure (SR-IOV enable fails).
> 
> Thanks
> Dotan

Submit your code for inclusion, we can discuss.

-- 
MST



Re: [Qemu-devel] [PATCH v6 0/4] pcie: Add support for Single Root I/O Virtualization

2015-10-22 Thread Dotan Barak
I tested those patches on QEMU v2.3.0 and they work
(i.e. it adds to ability for emulated device to work SR-IOV).

However, when I based my model on newer version of QEMU (i.e. upstream) with 
the new SR-IOV patches from Knut,
There is a failure (SR-IOV enable fails).

Thanks
Dotan


> -Original Message-
> From: Knut Omang [mailto:knut.om...@oracle.com]
> Sent: Thursday, October 22, 2015 4:48 PM
> To: Michael S. Tsirkin 
> Cc: qemu-devel@nongnu.org; Paolo Bonzini ; Richard
> Henderson ; Eduardo Habkost ; Alex
> Williamson ; Marcel Apfelbaum
> ; Jan Kiszka ; Gonglei (Arei)
> ; Dotan Barak ; Richard
> W.M. Jones 
> Subject: Re: [PATCH v6 0/4] pcie: Add support for Single Root I/O 
> Virtualization
> 
> On Thu, 2015-10-22 at 16:14 +0300, Michael S. Tsirkin wrote:
> > On Thu, Oct 22, 2015 at 10:01:31AM +0200, Knut Omang wrote:
> > > This patch set implements generic support for SR/IOV as an extension
> > > to the core PCIe functionality, similar to the way other
> > > capabilities such as AER is implemented.
> >
> > We are in soft freeze now so I'd rather defer this until
> > 2.5 is out.
> 
> Ok, I kind of suspected that the 2.5 train had left, no problem..
> 
> > This should give you some time to come up with an actual user for this
> > API.
> >
> > If it helps, I can park these patches on a branch in my tree so you
> > don't need to keep reposting them.
> 
> Yes, that would be great,
> 
> Thanks,
> Knut
> 
> > > There is no implementation of any device that provides SR/IOV
> > > support included, but I have implemented a test example which can be
> > > found together with this patch set here:
> > >
> > >   git://github.com/knuto/qemu.git sriov_patches_v6
> > >
> > > Testing with the example device was documented here:
> > >
> > >   http://lists.nongnu.org/archive/html/qemu-devel/2014-08/msg05110.
> > > html
> > >
> > > Changes since v5:
> > >   - Fix reset logic that got broken in v5. Reset logic is now equal
> > > to
> > > that of v4 except that two ambiguous initialization statements
> > > (introduced during rebase) have been removed
> > >   - From private feedback, added observer functions for SR/IOV
> > > values
> > > in pcie_sriov.h. To ease access to the vf number, the SR/IOV VF
> > > device
> > > struct extension now caches this value.
> > >
> > > Changes since v4:
> > >   - Mostly based on feeback in Marcel Apfelbaum's review:
> > >   - The patch with changes to pci_regs.h got eliminated by rebase
> > >   - Added some documentation as an additional patch
> > >   - Some trivial fixes moved to separate patch
> > >   - Modified code to use error and trace functions instead of
> > > printfs
> > >
> > > Changes since v3:
> > >   - Reworked 'pci: Update pci_regs header' to merge kernel version
> > > improvements
> > > with the current qemu version instead of copying from the kernel
> > > version.
> > >
> > > Changes since v2:
> > >   - Rebased onto 090d0bfd
> > >   - Un-qdev'ified - avoids issues when resetting NUM_VFS
> > >   - Fixed handling of vf_offset/vf_stride
> > >
> > > Changes since v1:
> > >   - Rebased on top of latest master, eliminating prereqs.
> > >   - Implement proper support for VF_STRIDE, VF_OFFSET and SUP_PGSIZE
> > > Time better spent fixing it than explaining what the previous
> > > limitations were.
> > > - Added new first patch to fix pci bug related to this
> > >   - Split out patch to pci_default_config_write to a separate patch
> > > 2
> > > to highlight bug fix.
> > >   - Refactored out logic into new source files
> > > hw/pci/pcie_sriov.c include/hw/pci/pcie_sriov.h
> > > similar to pcie_aer.c/h.
> > >   - Rename functions and introduce structs to better separate
> > > pf and vf functionality.
> > >   - Replaced is_vf member with pci_is_vf() function abstraction
> > >   - Fix numerous syntax, whitespace and comment issues
> > > according to Michael's review.
> > >   - Fix memory leaks.
> > >   - Removed igb example device - a rebased version available
> > > on github instead.
> > >
> > > Knut Omang (4):
> > >   pci: Make use of the devfn property when registering new devices
> > >   pcie: Add support for Single Root I/O Virtualization (SR/IOV)
> > >   pcie: Add some SR/IOV API documentation in docs/pcie_sriov.txt
> > >   pcie: A few minor fixes (type+code simplify)
> > >
> > >  docs/pcie_sriov.txt | 115 ++
> > >  hw/pci/Makefile.objs|   2 +-
> > >  hw/pci/pci.c|  97 
> > >  hw/pci/pcie.c   |   9 +-
> > >  hw/pci/pcie_sriov.c | 277
> > > 
> > >  include/hw/pci/pci.h|  11 +-
> > >  include/hw/pci/pcie.h   |   6 +
> > >  include/hw/pci/pcie_sriov.h |  67 +++
> > >