qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Knut Omang <knut.omang@oracle.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Peter Crosthwaite <peter.crosthwaite@xilinx.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Laszlo Ersek <lersek@redhat.com>, Alexander Graf <agraf@suse.de>,
	qemu-devel@nongnu.org, Fabien Chouteau <chouteau@adacore.com>,
	Luiz Capitulino <lcapitulino@redhat.com>,
	Beniamino Galvani <b.galvani@gmail.com>,
	Alex Williamson <alex.williamson@redhat.com>,
	"Gonglei (Arei)" <arei.gonglei@huawei.com>,
	Jan Kiszka <jan.kiszka@web.de>,
	Anthony Liguori <aliguori@amazon.com>,
	Paolo Bonzini <pbonzini@redhat.com>, Amos Kong <akong@redhat.com>,
	Gabriel Somlo <somlo@cmu.edu>
Subject: Re: [Qemu-devel] [PATCH v2 1/4] pci: Make use of the devfn property when registering new devices
Date: Tue, 2 Sep 2014 16:55:49 +0300	[thread overview]
Message-ID: <20140902135549.GA15754@redhat.com> (raw)
In-Reply-To: <1409665468.848.198.camel@ori.omang.mine.nu>

On Tue, Sep 02, 2014 at 03:44:28PM +0200, Knut Omang wrote:
> On Tue, 2014-09-02 at 16:03 +0300, Michael S. Tsirkin wrote:
> > On Tue, Sep 02, 2014 at 01:00:03PM +0200, Knut Omang wrote:
> > > Without this, the devfn argument to pci_create_*()
> > > does not affect the assigned devfn.
> > > 
> > > Needed to support (VF_STRIDE,VF_OFFSET) values other than (1,1)
> > > for SR/IOV.
> > > 
> > > Signed-off-by: Knut Omang <knut.omang@oracle.com>
> > 
> > Sorry, I don't understand the explanation exactly.
> > pci_dev->devfn is not set correctly? why?
> 
> This probably has been broken by some of the qom adaptation if I
> understand it right: The devfn parameter in pci_create_multifunction()
> is only used to set the "addr" property, which in turn is not used
> anywhere as far as I can see. So the pci_dev->devfn has it's default
> value.

There are a bunch of places that depend on devfn being correct
though so I think this needs to be fixed.


> 
> What I observe is that when I enable VFs with the igb example device,
> now with stride = 2 and offset 0x80 (as my real lab hardware implements)
> and enable some VFs, this yields devfn's of 0x80, 0x82, 0x84... sent as
> parameters to pci_create..(), I still end up with this (eg. 
> the "natural" next function will be selected instead of the provided
> devfn):
> 
> 01:00.0 Ethernet controller: Intel Corporation 82576 Gigabit Network Connection (rev 01)
> 01:00.1 Ethernet controller: Intel Corporation 82576 Virtual Function (rev 01)
> 01:00.2 Ethernet controller: Intel Corporation 82576 Virtual Function (rev 01)
> 01:00.3 Ethernet controller: Intel Corporation 82576 Virtual Function (rev 01)
> 01:00.4 Ethernet controller: Intel Corporation 82576 Virtual Function (rev 01)
> 
> With this patch applied, I get the expected:
> 
> 01:00.0 Ethernet controller: Intel Corporation 82576 Gigabit Network Connection (rev 01)
> 01:10.0 Ethernet controller: Intel Corporation 82576 Virtual Function (rev 01)
> 01:10.2 Ethernet controller: Intel Corporation 82576 Virtual Function (rev 01)
> 01:10.4 Ethernet controller: Intel Corporation 82576 Virtual Function (rev 01)
> 01:10.6 Ethernet controller: Intel Corporation 82576 Virtual Function (rev 01)

> > > ---
> > >  hw/pci/pci.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/hw/pci/pci.c b/hw/pci/pci.c
> > > index daeaeac..6b21dee 100644
> > > --- a/hw/pci/pci.c
> > > +++ b/hw/pci/pci.c
> > > @@ -1757,7 +1757,7 @@ static int pci_qdev_init(DeviceState *qdev)
> > >      bus = PCI_BUS(qdev_get_parent_bus(qdev));
> > >      pci_dev = do_pci_register_device(pci_dev, bus,
> > >                                       object_get_typename(OBJECT(qdev)),
> > > -                                     pci_dev->devfn);
> > > +                                     object_property_get_int(OBJECT(qdev), "addr", NULL));
> > >      if (pci_dev == NULL)
> > >          return -1;
> > >  
> > > -- 
> > > 1.9.0
> 

  reply	other threads:[~2014-09-02 13:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-02 11:00 [Qemu-devel] [PATCH v2 0/4] pcie: Add support for Single Root I/O Virtualization Knut Omang
2014-09-02 11:00 ` [Qemu-devel] [PATCH v2 1/4] pci: Make use of the devfn property when registering new devices Knut Omang
2014-09-02 13:03   ` Michael S. Tsirkin
2014-09-02 13:44     ` Knut Omang
2014-09-02 13:55       ` Michael S. Tsirkin [this message]
2014-10-03 11:59         ` Knut Omang
2014-09-02 11:00 ` [Qemu-devel] [PATCH v2 2/4] pci: Avoid losing config updates to MSI/MSIX cap regs Knut Omang
2014-09-02 12:57   ` Michael S. Tsirkin
2014-09-02 11:00 ` [Qemu-devel] [PATCH v2 3/4] pci: Update pci_regs header Knut Omang
2014-09-02 11:00 ` [Qemu-devel] [PATCH v2 4/4] pcie: Add support for Single Root I/O Virtualization (SR/IOV) Knut Omang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140902135549.GA15754@redhat.com \
    --to=mst@redhat.com \
    --cc=agraf@suse.de \
    --cc=akong@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=aliguori@amazon.com \
    --cc=arei.gonglei@huawei.com \
    --cc=b.galvani@gmail.com \
    --cc=chouteau@adacore.com \
    --cc=jan.kiszka@web.de \
    --cc=knut.omang@oracle.com \
    --cc=lcapitulino@redhat.com \
    --cc=lersek@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.crosthwaite@xilinx.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=somlo@cmu.edu \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).