linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bhelgaas@google.com>
To: Yinghai Lu <yinghai@kernel.org>
Cc: linux-pci@vger.kernel.org, Jason Baron <jbaron@redhat.com>
Subject: Re: [PATCH 4/5] PCI, acpiphp: add is_hotplug_bridge detection
Date: Wed, 11 Jul 2012 09:50:19 -0600	[thread overview]
Message-ID: <CAErSpo7SS1N+h+VyGoCBq5HCMezvFAonRZR-pqsYezVHX2-_2w@mail.gmail.com> (raw)
In-Reply-To: <1340437325-29282-5-git-send-email-yinghai@kernel.org>

On Sat, Jun 23, 2012 at 1:42 AM, Yinghai Lu <yinghai@kernel.org> wrote:
> When system support hotplug bridge with children hotplug slots, we need to make sure
> that parent bridge get preallocated resource so later when device is plugged into
> children slot, those children devices will get resource allocated.
>
> We do not meet this problem, because for pcie hotplug card, when acpiphp is used,
> pci_scan_bridge will set that for us when detect hotplug bit in slot cap.
>
> Reported-and-tested-by: Jason Baron <jbaron@redhat.com>
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
> Acked-by: Jason Baron <jbaron@redhat.com>
> ---
>  drivers/pci/hotplug/acpiphp_glue.c |   27 ++++++++++++++++++++++++++-
>  1 files changed, 26 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
> index ad6fd66..0f2b72d 100644
> --- a/drivers/pci/hotplug/acpiphp_glue.c
> +++ b/drivers/pci/hotplug/acpiphp_glue.c
> @@ -783,6 +783,29 @@ static void acpiphp_set_acpi_region(struct acpiphp_slot *slot)
>         }
>  }
>
> +static void check_hotplug_bridge(struct acpiphp_slot *slot, struct pci_dev *dev)
> +{
> +       struct acpiphp_func *func;
> +
> +       if (!dev->subordinate)
> +               return;
> +
> +       /* quirk, or pcie could set it already */
> +       if (dev->is_hotplug_bridge)
> +               return;
> +
> +       if (PCI_SLOT(dev->devfn) != slot->device)
> +               return;
> +
> +       list_for_each_entry(func, &slot->funcs, sibling) {
> +               if (PCI_FUNC(dev->devfn) == func->function) {
> +                       /* check if this bridge has ejectable slots */
> +                       if ((detect_ejectable_slots(func->handle) > 0))
> +                               dev->is_hotplug_bridge = 1;
> +                       break;
> +               }
> +       }
> +}
>  /**
>   * enable_device - enable, configure a slot
>   * @slot: slot to be enabled
> @@ -817,8 +840,10 @@ static int __ref enable_device(struct acpiphp_slot *slot)
>                         if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE ||
>                             dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) {
>                                 max = pci_scan_bridge(bus, dev, max, pass);
> -                               if (pass && dev->subordinate)
> +                               if (pass && dev->subordinate) {
> +                                       check_hotplug_bridge(slot, dev);

I don't like this patch because it increases the differences between
the hotplug drivers, rather than decreasing them.

For PCI Express devices, we set dev->is_hotplug_bridge in the
pci_setup_device() path (in set_pcie_hotplug_bridge()).  I think it
would make sense to try to expand that path to also handle SHPC and
ACPI hotplug as well.  ACPI is harder because it's not PCI-specified,
so we'd need some sort of pcibios or other optional hook.

I don't have a clear picture of how this works -- if I understand
correctly, the situation is that we have a bridge managed by acpiphp.
That part makes sense because the bridge is on the motherboard and can
have a DSDT device.  Now we plug something into the slot below the
bridge.  I *think* this patch handles the case where this new
hot-added thing is also a bridge managed by acpiphp.  But where does
the ACPI device for this hot-added bridge come from?  It's an
arbitrary device the BIOS knows nothing about, so it can't be in the
DSDT.

>                                         pci_bus_size_bridges(dev->subordinate);
> +                               }
>                         }
>                 }
>         }
> --
> 1.7.7
>

  reply	other threads:[~2012-07-11 15:50 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-23  7:42 [PATCH 0/5] PCI: hotplug related misc patches Yinghai Lu
2012-06-23  7:42 ` [PATCH 1/5] PCI, acpiphp: remove not used res_lock Yinghai Lu
2012-06-23  7:42 ` [PATCH 2/5] pciehp: Don't enable presence notification while surprise removal is not supported Yinghai Lu
2012-06-26  1:26   ` Kaneshige, Kenji
2012-06-26 18:03     ` Yinghai Lu
2012-07-10 22:56   ` Bjorn Helgaas
2012-07-10 23:12     ` Yinghai Lu
2012-07-10 23:28       ` Bjorn Helgaas
2012-07-10 23:40         ` Yinghai Lu
2012-07-11 16:21     ` Bjorn Helgaas
2012-07-11 17:58       ` Yinghai Lu
2012-07-11 18:15         ` Bjorn Helgaas
2012-07-11 18:49           ` Yinghai Lu
2012-07-11 19:56             ` Bjorn Helgaas
2012-07-11 20:28               ` Yinghai Lu
2012-07-11 20:48                 ` Bjorn Helgaas
2012-07-11 20:56                   ` Yinghai Lu
2012-07-11 22:24                     ` Bjorn Helgaas
2012-07-12  0:05                       ` Yinghai Lu
2012-07-12 20:20                         ` Bjorn Helgaas
2012-07-13  0:19                           ` Yinghai Lu
2012-07-13 15:30                             ` Bjorn Helgaas
2012-07-13 18:07                               ` Yinghai Lu
2012-06-23  7:42 ` [PATCH 3/5] PCI, acpiphp: Merge acpiphp_debug and debug Yinghai Lu
2012-06-23  7:42 ` [PATCH 4/5] PCI, acpiphp: add is_hotplug_bridge detection Yinghai Lu
2012-07-11 15:50   ` Bjorn Helgaas [this message]
2012-07-11 17:14     ` Jason Baron
2012-07-11 19:42       ` Bjorn Helgaas
2012-07-16 16:05         ` Bjorn Helgaas
2012-07-17 14:14         ` Jason Baron
2012-08-15 19:36           ` Bjorn Helgaas
2012-08-20 14:35             ` Jason Baron
2012-08-22 23:19               ` Bjorn Helgaas
2012-09-04 20:55                 ` Jason Baron
2012-06-23  7:42 ` [PATCH 5/5] PCI: add root bus children dev's res to fail list Yinghai Lu
2012-07-10 19:30 ` [PATCH 0/5] PCI: hotplug related misc patches Yinghai Lu
2012-07-11 18:32   ` Bjorn Helgaas

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=CAErSpo7SS1N+h+VyGoCBq5HCMezvFAonRZR-pqsYezVHX2-_2w@mail.gmail.com \
    --to=bhelgaas@google.com \
    --cc=jbaron@redhat.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=yinghai@kernel.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).