From: H. Peter Anvin on
On 04/09/2010 09:04 AM, Bjorn Helgaas wrote:
>>
>> for 64 bit, you may check boot_params.screen_info.orig_video_isVGA to see if you need to reserve that VGA range.
>> not sure if every bootloader fill that...
>
> Why is this different for 64-bit vs 32-bit? Can you point me to any
> references where I can learn about this?
>

It's not. Any differences between 32 and 64 bits in this area are just
plain wrong.

-hpa


--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Yinghai on
On 04/09/2010 09:44 AM, H. Peter Anvin wrote:
> On 04/09/2010 09:04 AM, Bjorn Helgaas wrote:
>>>
>>> for 64 bit, you may check boot_params.screen_info.orig_video_isVGA to see if you need to reserve that VGA range.
>>> not sure if every bootloader fill that...
>>
>> Why is this different for 64-bit vs 32-bit? Can you point me to any
>> references where I can learn about this?
>>
>
> It's not. Any differences between 32 and 64 bits in this area are just
> plain wrong.
>

then please check this one

update e820 at first, and later put them resource tree, but give pci BAR chance to claim
the range, before assign unassigned resources.

in case some system doesn't have VGA, and use [0xa0000, ..] for mmio of some other pci devices.

Yinghai

Subject: [RFC PATCH] x86: reserve [0xa0000, 0x100000] in e820

And put those range in resource tree after pci BAR claim those range

---
arch/x86/include/asm/setup.h | 1 -
arch/x86/kernel/e820.c | 2 +-
arch/x86/kernel/head32.c | 1 -
arch/x86/kernel/setup.c | 19 +------------------
4 files changed, 2 insertions(+), 21 deletions(-)

Index: linux-2.6/arch/x86/include/asm/setup.h
===================================================================
--- linux-2.6.orig/arch/x86/include/asm/setup.h
+++ linux-2.6/arch/x86/include/asm/setup.h
@@ -44,7 +44,6 @@ static inline void visws_early_detect(vo
extern unsigned long saved_video_mode;

extern void reserve_standard_io_resources(void);
-extern void i386_reserve_resources(void);
extern void setup_default_timer_irq(void);

#ifdef CONFIG_X86_MRST
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);
}
Index: linux-2.6/arch/x86/kernel/head32.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/head32.c
+++ linux-2.6/arch/x86/kernel/head32.c
@@ -22,7 +22,6 @@ static void __init i386_default_early_se
{
/* Initilize 32bit specific setup functions */
x86_init.resources.probe_roms = probe_roms;
- x86_init.resources.reserve_resources = i386_reserve_resources;
x86_init.mpparse.setup_ioapic_ids = setup_ioapic_ids_from_mpc;

reserve_ebda_region();
Index: linux-2.6/arch/x86/kernel/setup.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/setup.c
+++ linux-2.6/arch/x86/kernel/setup.c
@@ -693,7 +693,7 @@ static void __init trim_bios_range(void)
* area (640->1Mb) as ram even though it is not.
* take them out.
*/
- e820_remove_range(BIOS_BEGIN, BIOS_END - BIOS_BEGIN, E820_RAM, 1);
+ e820_add_range(BIOS_BEGIN, BIOS_END - BIOS_BEGIN, E820_RESERVED);
sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
}

@@ -1052,20 +1052,3 @@ void __init setup_arch(char **cmdline_p)

mcheck_init();
}
-
-#ifdef CONFIG_X86_32
-
-static struct resource video_ram_resource = {
- .name = "Video RAM area",
- .start = 0xa0000,
- .end = 0xbffff,
- .flags = IORESOURCE_BUSY | IORESOURCE_MEM
-};
-
-void __init i386_reserve_resources(void)
-{
- request_resource(&iomem_resource, &video_ram_resource);
- reserve_standard_io_resources();
-}
-
-#endif /* CONFIG_X86_32 */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: H. Peter Anvin on
[Adding Guenter Roeck as he was commenting on something writing to the
VGA area...]

On 04/09/2010 10:22 AM, Yinghai wrote:
>
> then please check this one
>
> update e820 at first, and later put them resource tree, but give pci BAR chance to claim
> the range, before assign unassigned resources.
>
> in case some system doesn't have VGA, and use [0xa0000, ..] for mmio of some other pci devices.
>

Do we have any evidence of any such system?

Either which way, the patch looks saner...

-hpa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Guenter Roeck on
On Fri, 2010-04-09 at 14:23 -0400, H. Peter Anvin wrote:
> [Adding Guenter Roeck as he was commenting on something writing to the
> VGA area...]
>
> On 04/09/2010 10:22 AM, Yinghai wrote:
> >
> > then please check this one
> >
> > update e820 at first, and later put them resource tree, but give pci BAR chance to claim
> > the range, before assign unassigned resources.
> >
> > in case some system doesn't have VGA, and use [0xa0000, ..] for mmio of some other pci devices.
> >
>
> Do we have any evidence of any such system?
>
> Either which way, the patch looks saner...
>
Yes, we have a system which does not have VGA and uses the VGA memory
space for another device. I don't know exactly what for, but I can find
out if it is relevant.

Guenter


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Yinghai on
update version for test

Subject: [PATCH] x86: reserve [0xa0000, 0x100000] in e820

Update e820 at first, and later put them resource tree.
But give pci BAR chance to claim the range, before assign unassigned resources.

In case some system doesn't have VGA, and use [0xa0000, ..] for mmio of some
other pci devices.

Signed-off-by: Yinghai Lu <yinghai(a)kernel.org>
Cc: Guenter Roeck <guenter.roeck(a)ericsson.com>
Cc: Andy Isaacson <adi(a)hexapodia.org>
Cc: Bjorn Helgaas <bjorn.helgaas(a)hp.com>
Acked-by: H. Peter Anvin <hpa(a)zytor.com>

---
arch/x86/include/asm/setup.h | 1 -
arch/x86/kernel/e820.c | 2 +-
arch/x86/kernel/head32.c | 1 -
arch/x86/kernel/setup.c | 19 +------------------
4 files changed, 2 insertions(+), 21 deletions(-)

Index: linux-2.6/arch/x86/include/asm/setup.h
===================================================================
--- linux-2.6.orig/arch/x86/include/asm/setup.h
+++ linux-2.6/arch/x86/include/asm/setup.h
@@ -44,7 +44,6 @@ static inline void visws_early_detect(vo
extern unsigned long saved_video_mode;

extern void reserve_standard_io_resources(void);
-extern void i386_reserve_resources(void);
extern void setup_default_timer_irq(void);

#ifdef CONFIG_X86_MRST
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);
}
Index: linux-2.6/arch/x86/kernel/head32.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/head32.c
+++ linux-2.6/arch/x86/kernel/head32.c
@@ -22,7 +22,6 @@ static void __init i386_default_early_se
{
/* Initilize 32bit specific setup functions */
x86_init.resources.probe_roms = probe_roms;
- x86_init.resources.reserve_resources = i386_reserve_resources;
x86_init.mpparse.setup_ioapic_ids = setup_ioapic_ids_from_mpc;

reserve_ebda_region();
Index: linux-2.6/arch/x86/kernel/setup.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/setup.c
+++ linux-2.6/arch/x86/kernel/setup.c
@@ -693,7 +693,7 @@ static void __init trim_bios_range(void)
* area (640->1Mb) as ram even though it is not.
* take them out.
*/
- e820_remove_range(BIOS_BEGIN, BIOS_END - BIOS_BEGIN, E820_RAM, 1);
+ e820_add_region(BIOS_BEGIN, BIOS_END - BIOS_BEGIN, E820_RESERVED);
sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
}

@@ -1052,20 +1052,3 @@ void __init setup_arch(char **cmdline_p)

mcheck_init();
}
-
-#ifdef CONFIG_X86_32
-
-static struct resource video_ram_resource = {
- .name = "Video RAM area",
- .start = 0xa0000,
- .end = 0xbffff,
- .flags = IORESOURCE_BUSY | IORESOURCE_MEM
-};
-
-void __init i386_reserve_resources(void)
-{
- request_resource(&iomem_resource, &video_ram_resource);
- reserve_standard_io_resources();
-}
-
-#endif /* CONFIG_X86_32 */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/