linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PCI fixes for 2.6.9
Date: Tue, 19 Oct 2004 15:42:14 -0700	[thread overview]
Message-ID: <10982257341560@kroah.com> (raw)
In-Reply-To: <1098225733903@kroah.com>

ChangeSet 1.1997.37.15, 2004/10/06 11:50:52-07:00, shaohua.li@intel.com

[PATCH] PCI: Reorder some initialization code to allow resources to be proper allocated.

On Tuesday, August 31, 2004, Linus Torvalds wrote:
> That list per se obviously looks ok by me, although I'd worry that some
> other fs_initcall depends on the ACPI stuff having been run (ie while the
> abover ordering is great, I worry that some _other_ part doesn't fit in
> the above ordering). Doing a quick check finds "chr_dev_init()", for
> example, which will do fbmem_init(), which might depend on the ACPI/PnP
> stuff having run already.
>
> So it _might_ be safer to make this ordering more explicit, rather than

Yes, I agree. The problem is there isn't a straightforward method for
it. It possibly is hard to get it.

> depending on the different phases of the initcalls. But I'd happily be
> proven wrogn with some simple argument for why this is guaranteed to be
> ok.. For example, maybe ACPI and PnP is linked before chr/mem.c, in which
> case it should all be ok.

Original PCI assign resources code is the last 'subsys_initcall'
according to the makefile, so move some code of it to 'fs_initcall'
(just below 'subsystem_initcall') should be ok. As you said, ACPI and
PnP is linked before chr/mem.c. The method requires all other
'fs_initcall' don't touch PCI resources, since
'pcibios_assign_resources' is a 'fs_initcall' and maybe don't run, but
it looks ok currently. Again, I will be appreciated if we can find a
solution to make the ordering explicit.


Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>


 arch/i386/pci/i386.c       |   10 ++++++++--
 drivers/acpi/motherboard.c |    6 +++++-
 drivers/pnp/system.c       |    6 +++++-
 3 files changed, 18 insertions(+), 4 deletions(-)


diff -Nru a/arch/i386/pci/i386.c b/arch/i386/pci/i386.c
--- a/arch/i386/pci/i386.c	2004-10-19 15:26:35 -07:00
+++ b/arch/i386/pci/i386.c	2004-10-19 15:26:35 -07:00
@@ -164,7 +164,7 @@
 	}
 }
 
-static void __init pcibios_assign_resources(void)
+static int __init pcibios_assign_resources(void)
 {
 	struct pci_dev *dev = NULL;
 	int idx;
@@ -204,6 +204,7 @@
 				pci_assign_resource(dev, PCI_ROM_RESOURCE);
 		}
 	}
+	return 0;
 }
 
 void __init pcibios_resource_survey(void)
@@ -212,8 +213,13 @@
 	pcibios_allocate_bus_resources(&pci_root_buses);
 	pcibios_allocate_resources(0);
 	pcibios_allocate_resources(1);
-	pcibios_assign_resources();
 }
+
+/**
+ * called in fs_initcall (one below subsys_initcall),
+ * give a chance for motherboard reserve resources
+ */
+fs_initcall(pcibios_assign_resources);
 
 int pcibios_enable_resources(struct pci_dev *dev, int mask)
 {
diff -Nru a/drivers/acpi/motherboard.c b/drivers/acpi/motherboard.c
--- a/drivers/acpi/motherboard.c	2004-10-19 15:26:35 -07:00
+++ b/drivers/acpi/motherboard.c	2004-10-19 15:26:35 -07:00
@@ -170,4 +170,8 @@
 	return 0;
 }
 
-subsys_initcall(acpi_motherboard_init);
+/**
+ * Reserve motherboard resources after PCI claim BARs,
+ * but before PCI assign resources for uninitialized PCI devices
+ */
+fs_initcall(acpi_motherboard_init);
diff -Nru a/drivers/pnp/system.c b/drivers/pnp/system.c
--- a/drivers/pnp/system.c	2004-10-19 15:26:35 -07:00
+++ b/drivers/pnp/system.c	2004-10-19 15:26:35 -07:00
@@ -104,4 +104,8 @@
 	return pnp_register_driver(&system_pnp_driver);
 }
 
-subsys_initcall(pnp_system_init);
+/**
+ * Reserve motherboard resources after PCI claim BARs,
+ * but before PCI assign resources for uninitialized PCI devices
+ */
+fs_initcall(pnp_system_init);


  reply	other threads:[~2004-10-19 23:31 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-19 22:37 [BK PATCH] PCI fixes for 2.6.9 Greg KH
2004-10-19 22:42 ` [PATCH] " Greg KH
2004-10-19 22:42   ` Greg KH
2004-10-19 22:42     ` Greg KH
2004-10-19 22:42       ` Greg KH
2004-10-19 22:42         ` Greg KH
2004-10-19 22:42           ` Greg KH
2004-10-19 22:42             ` Greg KH
2004-10-19 22:42               ` Greg KH
2004-10-19 22:42                 ` Greg KH
2004-10-19 22:42                   ` Greg KH
2004-10-19 22:42                     ` Greg KH
2004-10-19 22:42                       ` Greg KH
2004-10-19 22:42                         ` Greg KH
2004-10-19 22:42                           ` Greg KH
2004-10-19 22:42                             ` Greg KH
2004-10-19 22:42                               ` Greg KH
2004-10-19 22:42                                 ` Greg KH
2004-10-19 22:42                                   ` Greg KH [this message]
2004-10-19 22:42                                     ` Greg KH
2004-10-19 22:42                                       ` Greg KH
2004-10-19 22:42                                         ` Greg KH
2004-10-19 22:42                                           ` Greg KH
2004-10-19 22:42                                             ` Greg KH
2004-10-19 22:42                                               ` Greg KH
2004-10-19 22:42                                                 ` Greg KH
2004-10-19 22:42                                                   ` Greg KH
2004-10-19 22:42                                                     ` Greg KH
2004-10-19 22:42                                                       ` Greg KH
2004-10-19 22:42                                                         ` Greg KH
2004-10-19 22:42                                                           ` Greg KH
2004-10-19 22:42                                                             ` Greg KH
2004-10-19 22:42                                                               ` Greg KH
2004-10-19 22:42                                                                 ` Greg KH
2004-10-19 22:42                                                                   ` Greg KH
2004-10-19 22:42                                                                     ` Greg KH
2004-10-19 22:42                                                                       ` Greg KH
2004-10-19 22:42                                                                         ` Greg KH
2004-10-19 22:42                                                                           ` Greg KH
2004-10-19 22:42                                                                             ` Greg KH
2004-10-19 22:42                                                                               ` Greg KH
2004-10-19 22:42                                                                                 ` Greg KH
2004-10-19 22:42                                                                                   ` Greg KH
2004-10-19 22:42                                                                                     ` Greg KH
2004-10-19 22:42                                                                                       ` Greg KH
2004-10-19 22:42                                                                                         ` Greg KH
2004-10-19 22:42                                                                                           ` Greg KH
2004-10-19 22:42                                                                                             ` Greg KH
2004-10-19 22:42                                                                                               ` Greg KH
2004-10-19 22:42                                                                                                 ` Greg KH
2004-10-19 22:42                                                                                                   ` Greg KH
2004-10-19 22:42                                                                                                     ` Greg KH
2004-10-19 22:42                                                                                                       ` Greg KH
2004-10-19 22:42                                                                                                         ` Greg KH
2004-10-19 22:42                                                                                                           ` Greg KH
2004-10-19 22:42                                                                                                             ` Greg KH
2004-10-19 22:42                                                                                                               ` Greg KH
2004-10-19 22:42                                                                                                                 ` Greg KH
2004-10-19 22:42                                                                                                                   ` Greg KH
2004-10-19 22:42                                                                                                                     ` Greg KH
2004-10-19 22:42                                                                                                                       ` Greg KH
2004-10-19 22:42                                                                                                                         ` Greg KH
2004-10-19 22:42                                                                                                                           ` Greg KH
2004-10-19 22:42                                                                                                                             ` Greg KH
2004-10-19 22:42                                                                                                                               ` Greg KH
2004-10-19 22:42                                                                                                                                 ` Greg KH
2004-10-19 22:42                                                                                                                                   ` Greg KH
2004-10-19 22:42                                                                                                                                     ` Greg KH
2004-10-20  8:10                                                                 ` Russell King
2004-10-22 23:45                                                                   ` Greg KH
2004-10-24 16:47                                                                     ` Alan Cox
2004-11-20 18:45                                                                     ` Russell King

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=10982257341560@kroah.com \
    --to=greg@kroah.com \
    --cc=linux-kernel@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).