i386/kernel/acpitable.c mapping problems
Quoted 6 lines · James Cleverdon
This fixes two bugs in the 2.4.17
acpitable.c. Marcello and Linus please apply:
...
2) The authors didn't realize that fixmap pages count down from the fixed base, so they ran off the end of virtual memory for any table over 2 pages long.
[patch with FIX_IO_APIC_BASE (ab)use deleted]
This could probably be done more cleanly using my boot-time-ioremap patch. I've posted it previously as part of a larger patch set (subject "[PATCH] DMI/APIC updates"), but Linus didn't take it: it extends the fixmap mechanism with a number of temporary boot-time maps and then implements early boot-time versions of ioremap and iounmap using them.
It's pretty well tested by now. I'm including the 2.5.2 version below for Linus' benefit; the 2.4.18-pre4 version can be fetched from
http://www.csd.uu.se/~mikpe/linux/kernel-patches/2.4/
Linus: If you have a suggestion for a better approach I'm all ears. If not, consider this a request for including this patch in 2.5.3.
/Mikael
arch/i386/mm/init.c +2 -5
@@ -128,7 +128,6 @@static inline void set_pte_phys (unsigned long vaddr,unsigned long phys,pgprot_t flags) { -pgprot_t prot;pgd_t *pgd;pmd_t *pmd;pte_t *pte;
@@ -144,10 +143,8 @@return ; } pte =pte_offset (pmd, vaddr); -if (pte_val (*pte)) -pte_ERROR (*pte); -pgprot_val (prot) =pgprot_val (PAGE_KERNEL ) |pgprot_val (flags); -set_pte (pte,mk_pte_phys (phys, prot)); +/* <phys,flags> stored as-is, to permit clearing entries */ +set_pte (pte,mk_pte_phys (phys, flags));/* * It's enough to flush this one mapping.
arch/i386/mm/ioremap.c +65 -0
68 lines not on this page · raw message
include/asm-i386/fixmap.h +7 -2
@@ -65,6 +65,11 @@FIX_KMAP_BEGIN ,/* reserved pte's for temporary kernel mappings */ FIX_KMAP_END =FIX_KMAP_BEGIN +(KM_TYPE_NR *NR_CPUS )-1 , #endif + __end_of_permanent_fixed_addresses, +/* temporary boot-time mappings, used before ioremap() is functional */ +#define NR_FIX_BTMAPS 16 +FIX_BTMAP_END = __end_of_permanent_fixed_addresses, +FIX_BTMAP_BEGIN =FIX_BTMAP_END +NR_FIX_BTMAPS -1 , __end_of_fixed_addresses };
@@ -86,8 +91,8 @@* at the top of mem.. */ #define FIXADDR_TOP (0xffffe000UL) -#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) -#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) +#define __FIXADDR_SIZE (__end_of_permanent_fixed_addresses << PAGE_SHIFT) +#define FIXADDR_START (FIXADDR_TOP - __FIXADDR_SIZE)#define __fix_to_virt (x) (FIXADDR_TOP - ((x) << PAGE_SHIFT))
include/asm-i386/io.h +8 -0
@@ -95,6 +95,14 @@extern void iounmap (void *addr);/* +* bt_ioremap() and bt_iounmap() are for temporary early boot-time +* mappings, before the real ioremap() is functional. +* A boot-time mapping is currently limited to at most 16 pages. +*/ +extern void *bt_ioremap (unsigned long offset,unsigned long size); +extern void bt_iounmap (void *addr,unsigned long size); + +/* * IO bus memory addresses are also 1:1 with the physical address */ #define virt_to_bus virt_to_phys