From: Yinghai Lu <yinghai@kernel.org>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: linux-pci@vger.kernel.org, Yinghai Lu <yinghai@kernel.org>
Subject: [PATCH v2 1/3] PCI/pciehp: Separate VGA checking out from loop
Date: Sat, 27 Jul 2013 08:11:08 -0700 [thread overview]
Message-ID: <1374937868-24437-3-git-send-email-yinghai@kernel.org> (raw)
In-Reply-To: <1374937868-24437-1-git-send-email-yinghai@kernel.org>
Separate VGA checking out and do that at first,
if there is VGA in the chain, do even try to stop or remove any device
under that bus.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
drivers/pci/hotplug/pciehp_pci.c | 27 ++++++++++++++++-----------
1 file changed, 16 insertions(+), 11 deletions(-)
Index: linux-2.6/drivers/pci/hotplug/pciehp_pci.c
===================================================================
--- linux-2.6.orig/drivers/pci/hotplug/pciehp_pci.c
+++ linux-2.6/drivers/pci/hotplug/pciehp_pci.c
@@ -92,6 +92,22 @@ int pciehp_unconfigure_device(struct slo
if (ret)
presence = 0;
+ /* check if VGA is around */
+ if (presence) {
+ list_for_each_entry(dev, &parent->devices, bus_list) {
+ if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) {
+ pci_read_config_byte(dev, PCI_BRIDGE_CONTROL,
+ &bctl);
+ if (bctl & PCI_BRIDGE_CTL_VGA) {
+ ctrl_err(ctrl,
+ "Cannot remove display device %s\n",
+ pci_name(dev));
+ return -EINVAL;
+ }
+ }
+ }
+ }
+
/*
* Stopping an SR-IOV PF device removes all the associated VFs,
* which will update the bus->devices list and confuse the
@@ -101,17 +117,6 @@ int pciehp_unconfigure_device(struct slo
list_for_each_entry_safe_reverse(dev, temp, &parent->devices,
bus_list) {
pci_dev_get(dev);
- if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE && presence) {
- pci_read_config_byte(dev, PCI_BRIDGE_CONTROL, &bctl);
- if (bctl & PCI_BRIDGE_CTL_VGA) {
- ctrl_err(ctrl,
- "Cannot remove display device %s\n",
- pci_name(dev));
- pci_dev_put(dev);
- rc = -EINVAL;
- break;
- }
- }
pci_stop_and_remove_bus_device(dev);
/*
* Ensure that no new Requests will be generated from
next prev parent reply other threads:[~2013-07-27 15:11 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-27 15:11 [PATCH v2 2/3] PCI: Separate stop and remove devices in pciehp Yinghai Lu
2013-07-27 15:11 ` [PATCH v2 3/3] PCI: Stop sriov after stop PF if PF's driver skip that Yinghai Lu
2013-07-29 19:58 ` Bjorn Helgaas
2013-07-29 20:32 ` Don Dutile
2013-07-29 21:07 ` Alexander Duyck
2013-07-29 21:31 ` Don Dutile
2013-07-29 21:52 ` Jeff Kirsher
2013-07-29 23:14 ` Yinghai Lu
2013-07-29 23:23 ` Jeff Kirsher
2013-07-30 15:04 ` Don Dutile
2013-08-01 20:16 ` Bjorn Helgaas
2013-08-01 21:21 ` Don Dutile
2013-08-01 21:41 ` Bjorn Helgaas
2013-08-01 21:55 ` Alexander Duyck
2013-07-27 15:11 ` Yinghai Lu [this message]
2013-08-07 4:01 ` [PATCH v2 2/3] PCI: Separate stop and remove devices in pciehp Bjorn Helgaas
2013-08-07 6:34 ` Yinghai Lu
2013-08-08 1:49 ` Yinghai Lu
2013-08-08 1:54 ` Yinghai Lu
2013-08-09 17:04 ` Bjorn Helgaas
2013-08-09 23:44 ` Yinghai Lu
2013-08-14 19:44 ` Bjorn Helgaas
2013-08-14 20:15 ` Yinghai Lu
2013-08-14 20:36 ` Bjorn Helgaas
2013-08-14 20:58 ` Yinghai Lu
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=1374937868-24437-3-git-send-email-yinghai@kernel.org \
--to=yinghai@kernel.org \
--cc=bhelgaas@google.com \
--cc=linux-pci@vger.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).