public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yinghai Lu <yinghai@kernel.org>
To: Bjorn Helgaas <bhelgaas@google.com>,
	"Rafael J. Wysocki" <rjw@sisk.pl>, Len Brown <lenb@kernel.org>,
	Taku Izumi <izumi.taku@jp.fujitsu.com>,
	Jiang Liu <jiang.liu@huawei.com>
Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-acpi@vger.kernel.org, Yinghai Lu <yinghai@kernel.org>,
	x86@kernel.org
Subject: [PATCH 7/8] PCI, x86: Claim FW allocated resources in hot add path.
Date: Sat,  3 Nov 2012 21:39:30 -0700	[thread overview]
Message-ID: <1352003971-22278-8-git-send-email-yinghai@kernel.org> (raw)
In-Reply-To: <1352003971-22278-1-git-send-email-yinghai@kernel.org>

During testing remove/rescan root bus 00, found
[  338.142574] bus: 'pci': really_probe: probing driver ata_piix with device 0000:00:01.1
[  338.146788] ata_piix 0000:00:01.1: device not available (can't reserve [io  0x01f0-0x01f7])
[  338.150565] ata_piix: probe of 0000:00:01.1 failed with error -22

because that fixed resource is not claimed.
For bootint path it is claimed in  from
        arch/x86/pci/i386.c::pcibios_allocate_resources()

Claim those resources, so on the remove/rescan will still use old
resources.

It is some kind honoring FW setting in the registers during hot add.
esp root-bus hot add is through acpi, BIOS has chance to set some registers
before handing over.

-v2: add rom resource claiming.
-v3: separate __init removing to another patch, also
   put pci_probe checking with caller from rom resource allocating

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: x86@kernel.org
---
 arch/x86/pci/i386.c |   13 +++++++++++++
 drivers/pci/bus.c   |    2 ++
 include/linux/pci.h |    1 +
 3 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
index 1806e91..e0b7f30 100644
--- a/arch/x86/pci/i386.c
+++ b/arch/x86/pci/i386.c
@@ -352,6 +352,19 @@ static int __init pcibios_assign_resources(void)
 	return 0;
 }
 
+void pcibios_resource_survey_bus(struct pci_bus *bus)
+{
+	dev_printk(KERN_DEBUG, &bus->dev, "Allocating resources\n");
+
+	pcibios_allocate_bus_resources(bus);
+
+	pcibios_allocate_resources(bus, 0);
+	pcibios_allocate_resources(bus, 1);
+
+	if (!(pci_probe & PCI_ASSIGN_ROMS))
+		pcibios_allocate_rom_resources(bus);
+}
+
 void __init pcibios_resource_survey(void)
 {
 	struct pci_bus *bus;
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
index 6241fd0..a85247d 100644
--- a/drivers/pci/bus.c
+++ b/drivers/pci/bus.c
@@ -158,6 +158,8 @@ pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res,
 	return ret;
 }
 
+void __weak pcibios_resource_survey_bus(struct pci_bus *bus) { }
+
 /**
  * pci_bus_add_device - add a single device
  * @dev: device to add
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 7860942..f30af2f 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -654,6 +654,7 @@ extern struct list_head pci_root_buses;	/* list of all known PCI buses */
 /* Some device drivers need know if pci is initiated */
 extern int no_pci_devices(void);
 
+void pcibios_resource_survey_bus(struct pci_bus *bus);
 void pcibios_fixup_bus(struct pci_bus *);
 int __must_check pcibios_enable_device(struct pci_dev *, int mask);
 /* Architecture specific versions may override this (weak) */
-- 
1.7.7


  parent reply	other threads:[~2012-11-04  4:42 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20121030040237.GA10472@google.com>
2012-11-04  4:39 ` [PATCH 0/8] PCI, ACPI, x86: Reserve fw allocated resource for hot-add root bus Yinghai Lu
2012-11-04  4:39   ` [PATCH 1/8] PCI, x86: Separate out pcibios_allocate_bridge_resources() Yinghai Lu
2012-11-04  4:39   ` [PATCH 2/8] PCI, x86: Separate out pcibios_allocate_dev_resources() Yinghai Lu
2012-11-04  4:39   ` [PATCH 3/8] PCI, x86: Let pcibios_allocate_bus_resources() take bus instead Yinghai Lu
2012-11-04  4:39   ` [PATCH 4/8] PCI, x86: Separate out rom resource claim Yinghai Lu
2012-11-04  4:39   ` [PATCH 5/8] PCI, x86: Add pcibios_fw_addr_done Yinghai Lu
2012-11-04  4:39   ` [PATCH 6/8] PCI, x86: Remove __init for hw/fw allocated functions Yinghai Lu
2012-11-04  4:39   ` Yinghai Lu [this message]
2012-11-04  4:39   ` [PATCH 8/8] PCI, ACPI: reserve fw allocated resource for hot added root bus Yinghai Lu
2012-12-07  7:15   ` [PATCH 0/8] PCI, ACPI, x86: Reserve fw allocated resource for hot-add " Yinghai Lu
2013-01-07 23:49     ` Bjorn Helgaas
2013-01-08 17:57       ` Bjorn Helgaas
2013-01-08 18:27         ` Yinghai Lu
2013-01-09 17:35           ` Bjorn Helgaas
2013-01-09 17:53             ` Yinghai Lu
2013-01-09 18:39               ` Bjorn Helgaas
2013-01-09 19:01                 ` Yinghai Lu
2013-01-09 20:10                   ` Rafael J. Wysocki
2013-01-10  0:34                     ` Bjorn Helgaas
2013-01-10 13:07                       ` Rafael J. Wysocki
2013-01-10 14:49                         ` Bjorn Helgaas
2013-01-09 20:59                 ` Benjamin Herrenschmidt
2013-07-02 21:31                 ` Bjorn Helgaas
2013-07-02 22:55                   ` 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=1352003971-22278-8-git-send-email-yinghai@kernel.org \
    --to=yinghai@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=izumi.taku@jp.fujitsu.com \
    --cc=jiang.liu@huawei.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=rjw@sisk.pl \
    --cc=x86@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