From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Laszlo Ersek <lersek@redhat.com>
Cc: Igor Mammedov <imammedo@redhat.com>,
Drew Jones <drjones@redhat.com>,
"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>,
Paolo Bonzini <pbonzini@redhat.com>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: Re: PV passthrough of sibling igbvf's
Date: Tue, 16 Oct 2012 15:42:08 +0100 [thread overview]
Message-ID: <507D7240.2010305@citrix.com> (raw)
In-Reply-To: <507D6D84.8050602@redhat.com>
On 16/10/12 15:21, Laszlo Ersek wrote:
> Hi,
>
> this is with reference to
> <https://bugzilla.redhat.com/show_bug.cgi?id=865736> -- RHEL-5.9 Beta
> host & guest. Nonetheless I think my question applies to current
> upstream Linux -- if not, I'd greatly appreciate commit hashes.
>
> Consider several igbvf's that belong to the same PF (port): they are
> functions that share a (bus, device) pair (aka "slot") in dom0. The VPCI
> implementation of pciback_add_pci_dev() [drivers/xen/pciback/vpci.c]
> will assign these sibling functions to the same virtual slot. In other
> words, VFs that are siblings in dom0 end up as siblings in the PV domU.
>
> (Upstream path and function: "drivers/xen/xen-pciback/vpci.c",
> __xen_pcibk_add_pci_dev().)
>
> This logic appears to date back to
> <http://xenbits.xensource.com/xen-unstable.hg/rev/5b433b4fca34>.
>
>
> The RHEL-5.9 Beta PV domU does something like this:
>
> pci_scan_slot
> /* for each function: */
> pci_scan_single_device
> pci_scan_device
> pci_bus_read_config_dword(bus, devfn, PCI_VENDOR_ID, &l)
> pci_setup_device
> pci_read_config_byte(dev, PCI_HEADER_TYPE, &hdr_type)
> dev->multifunction = !!(hdr_type & 0x80);
> if (dev_scanned && !dev->multifunc && func == 0): break
>
> Current upstream Linux has gone through several changes here, but the
> gist is the same: if function 0 is successfully scanned and it
> explicitly reports itself non-multi (--> no_next_fn()), then the rest of
> the functions on the slot is skipped.
>
> Problem is, function 0 of the igbvf I'm looking at reports itself as
> non-multifunction, and thus the domU doesn't find the rest of the
> passed-through functions.
Which is correct, because the virtual function itself is only a single
function.
I would hazard a guess that the real bug is trying to fake up 8
individual virtual functions as an 8-fuction device, which seems like a
toolstack bug to me.
While it would certainly be possible to trap and emulate reads like
this, I would think it would be decidedly hacky, thus preferably avoided.
~Andrew
>
>
> pciback seems to have no overlay for PCI_HEADER_TYPE in array
> "header_common" [upstream: drivers/xen/xen-pciback/conf_space_header.c],
> thus pciback_config_read() / xen_pcibk_config_read() pass through the
> header type transparently when the domU reads it in pci_setup_device().
>
>
> I wonder if
>
> - a new dom0 overlay should be introduced for PCI_HEADER_TYPE, to the
> tune of upstream Linux commit fd5b221b (ie. vendor-id/device-id), that
> would perhaps check the # of sibling functions in the given vpci slot,
> and fake the MSB in "hdr_type",
>
> - or the domU's slot scanning logic should be changed,
>
> - or the igbvf I'm looking at reports an incorrect "hdr_type" (in which
> case we'd still have to fake something). The legacy
> "/etc/xen/xend-pci-quirks.sxp" interface is only suitable for giving
> extra write access to the domU, thus not good enough here.
>
> Thanks a lot!
> Laszlo
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
--
Andrew Cooper - Dom0 Kernel Engineer, Citrix XenServer
T: +44 (0)1223 225 900, http://www.citrix.com
next prev parent reply other threads:[~2012-10-16 14:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-16 14:21 PV passthrough of sibling igbvf's Laszlo Ersek
2012-10-16 14:42 ` Andrew Cooper [this message]
2012-10-16 15:04 ` Laszlo Ersek
2012-10-16 15:37 ` Andrew Cooper
2012-10-16 17:36 ` [PATCH] xen PV passthru: assign SR-IOV virtual functions to separate virtual slots Laszlo Ersek
2012-10-17 7:13 ` Jan Beulich
2012-10-17 9:55 ` [PATCH v2] " Laszlo Ersek
2012-10-17 10:01 ` Jan Beulich
2012-10-17 14:51 ` Konrad Rzeszutek Wilk
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=507D7240.2010305@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=drjones@redhat.com \
--cc=imammedo@redhat.com \
--cc=konrad.wilk@oracle.com \
--cc=lersek@redhat.com \
--cc=pbonzini@redhat.com \
--cc=xen-devel@lists.xen.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.