From: "Michael S. Tsirkin" <mst@redhat.com>
To: Cao jin <caoj.fnst@cn.fujitsu.com>
Cc: izumi.taku@jp.fujitsu.com, alex.williamson@redhat.com,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v5 2/2] enable multi-function hot-add
Date: Tue, 27 Oct 2015 11:47:40 +0200 [thread overview]
Message-ID: <20151027114452-mutt-send-email-mst@redhat.com> (raw)
In-Reply-To: <562F4635.1060503@cn.fujitsu.com>
On Tue, Oct 27, 2015 at 05:39:01PM +0800, Cao jin wrote:
> >>>static
> >>>bool pcie_has_upstream_port(PCIDevice *dev)
> >>>{
> >>> PCIDevice *parent_dev = pci_bridge_get_device(pci_dev->bus);
> >>>
> >>> /*
> >>> * Device associated with an upstream port.
> >>> * As there are several types of these, it's easier to check the
> >>> * parent device: upstream ports are always connected to
> >>> * root or downstream ports.
> >>> */
> >>> return parent_dev &&
> >>> pci_is_express(parent_dev) &&
> >>> parent_dev->exp.exp_cap &&
> >>> (pcie_cap_get_type(parent_dev) == PCI_EXP_TYPE_ROOT_PORT ||
> >>> pcie_cap_get_type(parent_dev) == PCI_EXP_TYPE_DOWNSTREAM);
> >>>}
> >>>
> >>
> >>Assume my understanding is right, which means both ARI and non-ARI device
> >>have the upstream port(root port or downstream port), could the existence of
> >>upstream port be the judgment condition?
> >
> >This tells us whether we are behind a port that
> >can address devices in slot != 0.
> >
> >
>
> Seems I find something, according to spec: Endpoints are classified as
> either legacy, PCI Express, or Root Complex Integrated Endpoints. I think
> this is also what you means in comment "As there are several types of these"
> And "we are behind a port" means the device is not a Root Complex
> Integrated, only the other two types can be behind a port.
>
> Am I right about this?
No, device can be a bridge itself. It's simple: root and downstream
ports only have 1 slot (and it's a physical one) so you know there's
always 1 device there. It could have multiple functions.
--
MST
next prev parent reply other threads:[~2015-10-27 9:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-26 3:29 [Qemu-devel] [PATCH v5 0/2] PCI-e device multi-function hot-add support Cao jin
2015-10-26 3:29 ` [Qemu-devel] [PATCH v5 1/2] remove function during multi-function hot-add Cao jin
2015-10-26 3:29 ` [Qemu-devel] [PATCH v5 2/2] enable " Cao jin
2015-10-26 8:29 ` Michael S. Tsirkin
2015-10-26 11:57 ` Cao jin
2015-10-26 12:14 ` Michael S. Tsirkin
2015-10-27 9:39 ` Cao jin
2015-10-27 9:47 ` Michael S. Tsirkin [this message]
2015-10-27 10:39 ` Cao jin
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=20151027114452-mutt-send-email-mst@redhat.com \
--to=mst@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=caoj.fnst@cn.fujitsu.com \
--cc=izumi.taku@jp.fujitsu.com \
--cc=qemu-devel@nongnu.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).