From: Linus Torvalds <torvalds@osdl.org>
To: Russell King <rmk+lkml@arm.linux.org.uk>
Cc: Steven Rostedt <rostedt@goodmis.org>,
LKML <linux-kernel@vger.kernel.org>, Greg KH <gregkh@suse.de>
Subject: Re: IBM Thinkpad G41 PCMCIA problems [Was: Yenta TI: ... no PCI interrupts. Fish. Please report.]
Date: Sun, 20 Feb 2005 09:56:01 -0800 (PST) [thread overview]
Message-ID: <Pine.LNX.4.58.0502200954350.2378@ppc970.osdl.org> (raw)
In-Reply-To: <Pine.LNX.4.58.0502200905060.2378@ppc970.osdl.org>
On Sun, 20 Feb 2005, Linus Torvalds wrote:
>
> But the PCI allocations are not at all limited by MAXMEM - they want to be
> in the low 4GB, but that's the only real limit. So using "max_low_pfn" to
> determine where to start PCI allocations is pretty bogus.
>
> I'll try to write something that actually looks at the e820 memory map
> properly.
Russell, what do your eagle-eyes think of a patch like this?
Steven, does this fix it without the need for any kernel command line (or
any other patches, for that matter - ie revert all the transparency-
changing ones)?
Linus
----
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2005/02/20 09:43:19-08:00 torvalds@ppc970.osdl.org
# Use e820 memory map to determine PCI allocation area.
#
# Don't use the VM numbers (max_low_pfn and friends), since they depend
# on the partial kernel linear mapping and only partially on the actual
# physical memory layout.
#
# arch/i386/kernel/setup.c
# 2005/02/20 09:43:12-08:00 torvalds@ppc970.osdl.org +19 -6
# Use e820 memory map to determine PCI allocation area.
#
# Don't use the VM numbers (max_low_pfn and friends), since they depend
# on the partial kernel linear mapping and only partially on the actual
# physical memory layout.
#
diff -Nru a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c
--- a/arch/i386/kernel/setup.c 2005-02-20 09:54:35 -08:00
+++ b/arch/i386/kernel/setup.c 2005-02-20 09:54:35 -08:00
@@ -1166,9 +1166,10 @@
/*
* Request address space for all standard resources
*/
-static void __init register_memory(unsigned long max_low_pfn)
+static void __init register_memory(void)
{
- unsigned long low_mem_size;
+ long long gapsize;
+ unsigned long long last;
int i;
if (efi_enabled)
@@ -1184,9 +1185,21 @@
request_resource(&ioport_resource, &standard_io_resources[i]);
/* Tell the PCI layer not to allocate too close to the RAM area.. */
- low_mem_size = ((max_low_pfn << PAGE_SHIFT) + 0xfffff) & ~0xfffff;
- if (low_mem_size > pci_mem_start)
- pci_mem_start = low_mem_size;
+ last = 0x100000000ull;
+ gapsize = 0x400000;
+ i = e820.nr_map;
+ while (--i >= 0) {
+ unsigned long long start = e820.map[i].addr;
+ unsigned long long end = start + e820.map[i].size;
+ long long gap = last - end;
+
+ if (gap > gapsize) {
+ gapsize = gap;
+ pci_mem_start = ((unsigned long) end + 0xfffff) & ~0xfffff;
+ }
+ last = start;
+ }
+ printk("Allocating PCI resources starting at %08lx\n", pci_mem_start);
}
/* Use inline assembly to define this because the nops are defined
@@ -1432,7 +1445,7 @@
get_smp_config();
#endif
- register_memory(max_low_pfn);
+ register_memory();
#ifdef CONFIG_VT
#if defined(CONFIG_VGA_CONSOLE)
next prev parent reply other threads:[~2005-02-20 17:56 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-20 0:22 Steven Rostedt
2005-02-20 0:59 ` Linus Torvalds
2005-02-20 1:36 ` Steven Rostedt
2005-02-20 2:10 ` Linus Torvalds
2005-02-20 3:38 ` Steven Rostedt
2005-02-20 4:02 ` Linus Torvalds
2005-03-12 3:31 ` Adam Belay
2005-02-20 6:51 ` Linus Torvalds
2005-02-20 7:06 ` Linus Torvalds
2005-02-20 11:48 ` Steven Rostedt
2005-02-20 8:22 ` Russell King
2005-02-20 10:20 ` Russell King
2005-02-20 11:59 ` Steven Rostedt
2005-02-20 11:54 ` Steven Rostedt
2005-02-20 17:23 ` Linus Torvalds
2005-02-20 17:56 ` Linus Torvalds [this message]
2005-02-20 21:26 ` IBM Thinkpad G41 PCMCIA problems [Was: Yenta TI: ... no PCI David Härdeman
2005-02-21 4:19 ` IBM Thinkpad G41 PCMCIA problems [Was: Yenta TI: ... no PCI interrupts. Fish. Please report.] Steven Rostedt
2005-03-12 3:36 ` Adam Belay
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=Pine.LNX.4.58.0502200954350.2378@ppc970.osdl.org \
--to=torvalds@osdl.org \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=rmk+lkml@arm.linux.org.uk \
--cc=rostedt@goodmis.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
all inboxes | Powered by JetHome®