From: Yinghai Lu <yinghai@kernel.org>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
Chao Zhou <chao.zhou@intel.com>, Joerg Roedel <joro@8bytes.org>
Subject: Re: [PATCH] PCI: fix sriov enabling with virtual bus
Date: Wed, 5 Nov 2014 23:11:57 -0800 [thread overview]
Message-ID: <CAE9FiQVdd5dfAebJVD=CR+s=HeHXKVJ2sN0WD6RbE-WpS7+sZg@mail.gmail.com> (raw)
In-Reply-To: <20141105215713.GC6168@google.com>
On Wed, Nov 5, 2014 at 1:57 PM, Bjorn Helgaas <bhelgaas@google.com> wrote:
>
> It's relatively common to start with a pci_dev and look for an ACPI handle
> that corresponds to that device or the closest enclosing scope, so maybe
> there should be a way to do that directly.
>
> For pci_get_hp_params(), I think the current code is actually slightly
> buggy because we don't look for _HPP/_HPX on the device itself; we only
> look at the bridges upstream from it.
>
> What I had in mind was something like the following (untested and not for
> application).
> + * Search for an ACPI handle. The PCI device itself may have one, or an
> + * upstream device (either a PCI-to-PCI bridge or a PCI host bridge) may
> + * have one.
> + */
> +acpi_handle pci_find_acpi_handle(struct pci_dev *pdev)
> +{
> + struct device *dev;
> + acpi_handle handle;
> + struct pci_bus *bus;
> +
> + dev = &pdev->dev;
> + handle = ACPI_HANDLE(dev);
> + while (!handle) {
> + pdev = pci_physfn(pdev);
I'm a little worried about to apply hpx value for PFs to VFs.
> + bus = pdev->bus;
> + if (pci_is_root_bus(bus))
> + dev = bus->bridge;
> + else {
> + pdev = bus->self;
> + dev = &pdev->dev;
> + }
> + handle = ACPI_HANDLE(dev);
> + }
> + return handle;
> +}
Also found another problem,
pci_device_add==>pci_configure_device==>program_hpp_type2() path.
and program_hpp_type2() will check dev->subordinate().
but at the time child bridge is not scanned yet.
Maybe we should move pci_configure_device later ?
Yinghai Lu
prev parent reply other threads:[~2014-11-06 7:11 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-29 22:26 [PATCH] PCI: fix sriov enabling with virtual bus Yinghai Lu
2014-10-30 17:09 ` Bjorn Helgaas
2014-10-30 18:57 ` Yinghai Lu
2014-10-30 19:27 ` Bjorn Helgaas
2014-11-05 20:22 ` Bjorn Helgaas
2014-11-05 21:44 ` Rafael J. Wysocki
2014-11-05 21:57 ` Bjorn Helgaas
2014-11-05 22:42 ` Rafael J. Wysocki
2014-11-06 7:11 ` Yinghai Lu [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='CAE9FiQVdd5dfAebJVD=CR+s=HeHXKVJ2sN0WD6RbE-WpS7+sZg@mail.gmail.com' \
--to=yinghai@kernel.org \
--cc=bhelgaas@google.com \
--cc=chao.zhou@intel.com \
--cc=joro@8bytes.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=rafael.j.wysocki@intel.com \
--cc=rjw@rjwysocki.net \
/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).