From: Yinghai <yinghai.lu@oracle.com>
To: "H. Peter Anvin" <hpa@zytor.com>,
Andy Isaacson <adi@hexapodia.org>,
guenter.roeck@ericsson.com,
Linus Torvalds <torvalds@linux-foundation.org>
Cc: Yinghai <yinghai.lu@oracle.com>,
Bjorn Helgaas <bjorn.helgaas@hp.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>,
"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
"x86@kernel.org" <x86@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Thomas Renninger <trenn@suse.de>
Subject: Re: [PATCH -v2 1/2] x86: Reserve [0xa0000, 0x100000] in e820 map
Date: Tue, 13 Apr 2010 17:57:54 -0700 [thread overview]
Message-ID: <4BC51312.6080302@oracle.com> (raw)
In-Reply-To: <4BC4E8FB.8060802@zytor.com>
On 04/13/2010 02:58 PM, H. Peter Anvin wrote:
> On 04/13/2010 02:42 PM, Yinghai wrote:
>> On 04/13/2010 02:18 PM, H. Peter Anvin wrote:
>>> On 04/13/2010 02:11 PM, Yinghai wrote:
>>>>>
>>>>> I guess the real question (which I haven't looked at myself) is if the
>>>>> E820_RESERVED -> BUSY will cause an explicitly assigned BAR from being
>>>>> moved. That's bad, not so much for this particular range, but from BARs
>>>>> which may be assigned by SMM. Hacking that up in a simulator
>>>>> (Qemu/Bochs) and testing it is probably on the to do list...
>>>>
>>>> no, if some device BAR fall in that range, it should still use that range, and will not be relocated.
>>>>
>>>> will update the change log.
>>>>
>>>
>>> Good, that's what we want.
>>
>> the driver for that device later can not use pci_request_region(). because that region is BUSY already.
>>
>
> That's not good (in general - for devices in this particular range it's
> not such a big deal, but it is potentially really bad for devices marked
> reserved for them not to be moved.)
>
> We have talked about a need to resolve this before.
this one should make both cases work.
Andy, can you check this one together with
v3: x86: Reserve [0xa0000, 0x100000] in e820 map
Guenter, can you try the two patches on the system with special device?
Thanks
Yinghai
--------
Subject: [PATCH] x86, resource: Add reserve_region_with_split_check_child()
It will cover the whole region to BUSY, except that some regions that have
children under them.
those children normally is PCI bar but it is falling into E820_RESERVED.
We can not put BUSY on them, otherwise driver can not use pci_request_region()
later
/proc/iomem will have
00010000-00094fff : System RAM
00095000-0009ffff : reserved
000a0000-000bffff : PCI Bus 0000:00
000a0000-000bffff : reserved
000c0000-000cffff : reserved
000d0000-000dffff : PCI Bus 0000:00
000d0000-000dffff : reserved
000e0000-000fffff : reserved
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
arch/x86/kernel/e820.c | 10 +++++++---
include/linux/ioport.h | 3 +++
kernel/resource.c | 24 +++++++++++++++++++-----
3 files changed, 29 insertions(+), 8 deletions(-)
Index: linux-2.6/arch/x86/kernel/e820.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/e820.c
+++ linux-2.6/arch/x86/kernel/e820.c
@@ -1094,7 +1094,7 @@ void __init e820_reserve_resources(void)
* pci device BAR resource and insert them later in
* pcibios_resource_survey()
*/
- if (e820.map[i].type != E820_RESERVED || res->start < (1ULL<<20)) {
+ if (e820.map[i].type != E820_RESERVED) {
res->flags |= IORESOURCE_BUSY;
insert_resource(&iomem_resource, res);
}
@@ -1135,8 +1135,12 @@ void __init e820_reserve_resources_late(
res = e820_res;
for (i = 0; i < e820.nr_map; i++) {
- if (!res->parent && res->end)
- insert_resource_expand_to_fit(&iomem_resource, res);
+ if (!res->parent && res->end) {
+ if (res->start < (1ULL<<20)) {
+ reserve_region_with_split_check_child(&iomem_resource, res->start, res->end, res->name);
+ } else
+ insert_resource_expand_to_fit(&iomem_resource, res);
+ }
res++;
}
Index: linux-2.6/include/linux/ioport.h
===================================================================
--- linux-2.6.orig/include/linux/ioport.h
+++ linux-2.6/include/linux/ioport.h
@@ -120,6 +120,9 @@ void release_child_resources(struct reso
extern void reserve_region_with_split(struct resource *root,
resource_size_t start, resource_size_t end,
const char *name);
+void reserve_region_with_split_check_child(struct resource *root,
+ resource_size_t start, resource_size_t end,
+ const char *name);
extern struct resource *insert_resource_conflict(struct resource *parent, struct resource *new);
extern int insert_resource(struct resource *parent, struct resource *new);
extern void insert_resource_expand_to_fit(struct resource *root, struct resource *new);
Index: linux-2.6/kernel/resource.c
===================================================================
--- linux-2.6.orig/kernel/resource.c
+++ linux-2.6/kernel/resource.c
@@ -609,7 +609,7 @@ int adjust_resource(struct resource *res
static void __init __reserve_region_with_split(struct resource *root,
resource_size_t start, resource_size_t end,
- const char *name)
+ const char *name, bool check_child)
{
struct resource *parent = root;
struct resource *conflict;
@@ -631,13 +631,18 @@ static void __init __reserve_region_with
kfree(res);
/* conflict covered whole area */
- if (conflict->start <= start && conflict->end >= end)
+ if (conflict->start <= start && conflict->end >= end) {
+ if (check_child && !conflict->child && strstr(conflict->name, "PCI Bus"))
+ __reserve_region_with_split(conflict, start, end, name, false);
return;
+ }
if (conflict->start > start)
- __reserve_region_with_split(root, start, conflict->start-1, name);
+ __reserve_region_with_split(root, start, conflict->start-1, name, check_child);
if (conflict->end < end)
- __reserve_region_with_split(root, conflict->end+1, end, name);
+ __reserve_region_with_split(root, conflict->end+1, end, name, check_child);
+ if (check_child && !conflict->child && strstr(conflict->name, "PCI Bus"))
+ __reserve_region_with_split(conflict, conflict->start, conflict->end, name, false);
}
void __init reserve_region_with_split(struct resource *root,
@@ -645,7 +650,16 @@ void __init reserve_region_with_split(st
const char *name)
{
write_lock(&resource_lock);
- __reserve_region_with_split(root, start, end, name);
+ __reserve_region_with_split(root, start, end, name, false);
+ write_unlock(&resource_lock);
+}
+
+void __init reserve_region_with_split_check_child(struct resource *root,
+ resource_size_t start, resource_size_t end,
+ const char *name)
+{
+ write_lock(&resource_lock);
+ __reserve_region_with_split(root, start, end, name, true);
write_unlock(&resource_lock);
}
next prev parent reply other threads:[~2010-04-14 1:01 UTC|newest]
Thread overview: 110+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-07 21:06 [PATCH] x86: Reserve legacy VGA MMIO area for x86_64 as well as x86_32 Bjorn Helgaas
2010-04-07 22:45 ` Yinghai
2010-04-07 23:05 ` Bjorn Helgaas
2010-04-07 23:22 ` Yinghai
2010-04-08 3:24 ` Bjorn Helgaas
2010-04-08 4:42 ` H. Peter Anvin
2010-04-08 13:04 ` Bjorn Helgaas
2010-04-09 16:04 ` Bjorn Helgaas
2010-04-09 16:44 ` H. Peter Anvin
2010-04-09 17:22 ` Yinghai
2010-04-09 18:23 ` H. Peter Anvin
2010-04-09 18:55 ` Guenter Roeck
2010-04-09 19:55 ` Yinghai
2010-04-09 22:21 ` Andy Isaacson
2010-04-09 22:27 ` Yinghai Lu
2010-04-09 22:35 ` Andy Isaacson
2010-04-09 22:44 ` H. Peter Anvin
2010-04-09 22:54 ` Yinghai
2010-04-09 23:01 ` Yinghai
2010-04-10 0:00 ` Andy Isaacson
2010-04-10 1:10 ` Yinghai
2010-04-10 1:43 ` Andy Isaacson
2010-04-10 1:48 ` Yinghai
2010-04-10 1:57 ` Andy Isaacson
2010-04-10 2:46 ` Yinghai
2010-04-12 18:54 ` Andy Isaacson
2010-04-12 19:34 ` Yinghai
2010-04-12 19:48 ` Andy Isaacson
2010-04-12 19:55 ` yinghai.lu
2010-04-12 20:02 ` Andy Isaacson
2010-04-12 22:32 ` [PATCH -v2 1/2] x86: Reserve [0xa0000, 0x100000] in e820 map Yinghai
2010-04-13 21:02 ` Bjorn Helgaas
2010-04-13 21:08 ` Yinghai
2010-04-13 21:09 ` H. Peter Anvin
2010-04-13 21:11 ` Yinghai
2010-04-13 21:18 ` H. Peter Anvin
2010-04-13 21:22 ` [PATCH -v3 1/3] " Yinghai
2010-04-23 23:30 ` H. Peter Anvin
2010-04-26 15:35 ` Jesse Barnes
2010-04-13 21:23 ` [PATCH -v3 2/3] x86,pci, acpi: host bridge windows inherit BUSY flag from parent Yinghai
2010-04-13 21:24 ` [PATCH -v3 3/3] pci: don't allocate from a BUSY bus resource Yinghai
2010-04-13 21:42 ` [PATCH -v2 1/2] x86: Reserve [0xa0000, 0x100000] in e820 map Yinghai
2010-04-13 21:58 ` H. Peter Anvin
2010-04-13 22:29 ` Yinghai
2010-04-13 22:39 ` Yinghai
2010-04-13 22:41 ` H. Peter Anvin
2010-04-13 22:58 ` Yinghai
2010-04-13 23:02 ` H. Peter Anvin
2010-04-13 23:03 ` Yinghai
2010-04-13 23:07 ` H. Peter Anvin
2010-04-13 23:09 ` Yinghai
2010-04-21 5:33 ` [PATCH -v4 1/3] " Yinghai
2010-04-21 5:34 ` [PATCH 2/3] x86, resource: Add reserve_region_with_split_check_child() Yinghai
2010-04-21 5:35 ` [PATCH 3/3] x86,pci,acpi: Handle invalid _CRS Yinghai
2010-04-21 15:21 ` Bjorn Helgaas
2010-04-21 16:45 ` Yinghai Lu
2010-04-21 16:59 ` Bjorn Helgaas
2010-04-21 22:33 ` H. Peter Anvin
2010-04-21 23:04 ` Bjorn Helgaas
2010-04-21 23:10 ` H. Peter Anvin
2010-04-21 23:43 ` Yinghai
2010-04-22 0:02 ` H. Peter Anvin
2010-04-22 0:06 ` Yinghai
2010-04-21 19:31 ` [PATCH -v4 1/3] x86: Reserve [0xa0000, 0x100000] in e820 map Andy Isaacson
2010-04-23 23:05 ` [PATCH] x86/PCI: never allocate PCI MMIO resources below BIOS_END Bjorn Helgaas
2010-04-23 23:44 ` H. Peter Anvin
2010-04-24 0:36 ` Yinghai Lu
2010-04-26 12:50 ` R. Andrew Bailey
2010-04-26 15:40 ` Bjorn Helgaas
2010-04-26 18:34 ` Andy Isaacson
2010-04-26 19:31 ` Jesse Barnes
2010-04-26 20:27 ` Bjorn Helgaas
2010-04-26 20:37 ` Jesse Barnes
2010-04-26 21:07 ` Yinghai
2010-04-26 21:19 ` H. Peter Anvin
2010-04-26 21:12 ` H. Peter Anvin
2010-04-26 21:25 ` Jesse Barnes
2010-04-26 21:44 ` H. Peter Anvin
2010-04-26 21:53 ` Jesse Barnes
2010-04-26 21:59 ` Yinghai Lu
2010-04-26 22:04 ` [PATCH -v5] reserve a0000 - 0x10000 Yinghai
[not found] ` <4BD60CD4.9020708@oracle.com>
2010-04-26 22:04 ` [PATCH -v5 1/3] x86: Reserve [0xa0000, 0x100000] in e820 map Yinghai
2010-04-26 22:04 ` [PATCH -v5 2/3] x86: Remove probe_roms for 32bit Yinghai
2010-04-26 22:04 ` [PATCH -v5 3/3] x86, resource: Add reserve_region_with_split_check_child() Yinghai
2010-04-26 21:44 ` [PATCH] x86/PCI: never allocate PCI MMIO resources below BIOS_END jacob pan
2010-04-13 23:03 ` [PATCH -v2 1/2] x86: Reserve [0xa0000, 0x100000] in e820 map H. Peter Anvin
2010-04-14 0:57 ` Yinghai [this message]
2010-04-14 16:55 ` Bjorn Helgaas
2010-04-14 17:21 ` Yinghai Lu
2010-04-14 19:25 ` Andy Isaacson
2010-04-14 19:27 ` Yinghai
2010-04-14 19:43 ` Andy Isaacson
2010-04-14 19:49 ` Yinghai
2010-04-12 22:33 ` [PATCH -v2 2/2] x86,pci, acpi: Inherent BUSY flag when setup_resource for root bus Yinghai
2010-04-12 22:44 ` Jesse Barnes
2010-04-13 21:02 ` Bjorn Helgaas
2010-04-09 20:11 ` [PATCH] x86: Reserve legacy VGA MMIO area for x86_64 as well as x86_32 H. Peter Anvin
2010-04-09 20:31 ` Guenter Roeck
2010-04-09 20:44 ` H. Peter Anvin
2010-04-09 21:01 ` Guenter Roeck
2010-04-09 22:42 ` Alan Cox
2010-04-09 22:42 ` H. Peter Anvin
2010-04-09 22:54 ` Alan Cox
2010-04-09 22:55 ` H. Peter Anvin
2010-04-09 22:51 ` Alan Cox
2010-04-09 22:55 ` H. Peter Anvin
2010-04-07 23:43 ` H. Peter Anvin
2010-04-08 0:19 ` Andy Isaacson
2010-04-08 5:00 ` H. Peter Anvin
2010-04-08 21:40 ` Andy Isaacson
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=4BC51312.6080302@oracle.com \
--to=yinghai.lu@oracle.com \
--cc=adi@hexapodia.org \
--cc=bjorn.helgaas@hp.com \
--cc=guenter.roeck@ericsson.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=trenn@suse.de \
--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