xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Chao Gao <chao.gao@intel.com>
To: "Roger Pau Monné" <roger.pau@citrix.com>,
	"Jan Beulich" <JBeulich@suse.com>
Cc: Kevin Tian <kevin.tian@intel.com>,
	Venu Busireddy <venu.busireddy@oracle.com>,
	Eric R Crawford <eric.r.crawford@intel.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: [PATCH v4] VT-d: fix VF of RC integrated PF matched to wrong VT-d unit
Date: Wed, 5 Jul 2017 16:45:12 +0800	[thread overview]
Message-ID: <20170705084509.GA78885@skl-2s3.sh.intel.com> (raw)
In-Reply-To: <20170705082929.lo4keq5kv5jsgrmh@dhcp-3-128.uk.xensource.com>

On Wed, Jul 05, 2017 at 09:29:29AM +0100, Roger Pau Monné wrote:
>On Wed, Jul 05, 2017 at 02:19:17AM -0600, Jan Beulich wrote:
>> >>> On 05.07.17 at 09:56, <chao.gao@intel.com> wrote:
>> > How about changing the second paragraph to:
>> > 
>> > If a PF is an extended function, the BDF of a traditional function
>> > within the same device should be used to search VT-d unit. Otherwise,
>> > the real BDF of PF should be used. According PCI-e spec, an extended
>> > function is a function within an ARI device and Function Number > 7.
>> > But the original code only checks the latter requirement, without
>> > checking the former requirement. It incurs that a function whose Function
>> > Number > 7 but which isn't within an ARI device (such as RC integrated
>> > function with Function Number > 7) is wrongly classified to an extended
>> > function and then we wrongly use 0 as 'devfn' to search VT-d unit for this
>> > case.
>> 
>> There's one part here which I continue to not understand: The
>> function number being just 3 bits, how can it possibly be larger
>> than 7?
>
>It's a special case on the PCIe spec, quoting it:
>
>"Note: for Requests targeting Extended Functions in an ARI Device,
>A[19:12] represents the (8-bit) Function Number, which replaces the
>(5-bit) Device Number and (3-bit) Function Number fields above."
>
>It's in the PCIe 3.1a spec, page 657. The function number is expanded
>from 7 to 255.
>
>What I fail to see is how this device is registered with Xen, is the
>devfn field used to store the function number only?

The devfn is passed down by dom0. Judging from how is_extfn is set in
xen_add_device() in linux kernel, I think linux kernel reuses the Device
Fields as the higher 5 bits of an extended function's Function Number. 

Thanks
Chao

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

      reply	other threads:[~2017-07-05  8:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-30  1:17 [PATCH v4] VT-d: fix VF of RC integrated PF matched to wrong VT-d unit Chao Gao
2017-06-30  9:19 ` Tian, Kevin
2017-06-30 10:40   ` Jan Beulich
2017-07-03  4:36   ` Chao Gao
2017-07-05  2:46     ` Tian, Kevin
2017-07-05  4:28       ` Chao Gao
2017-07-05  5:18         ` Tian, Kevin
2017-07-05  7:56           ` Chao Gao
2017-07-05  8:06             ` Tian, Kevin
2017-07-05  8:19             ` Jan Beulich
2017-07-05  8:29               ` Roger Pau Monné
2017-07-05  8:45                 ` Chao Gao [this message]

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=20170705084509.GA78885@skl-2s3.sh.intel.com \
    --to=chao.gao@intel.com \
    --cc=JBeulich@suse.com \
    --cc=eric.r.crawford@intel.com \
    --cc=kevin.tian@intel.com \
    --cc=roger.pau@citrix.com \
    --cc=venu.busireddy@oracle.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 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).