Re: BUG?: "Cannot map mmconfig aperture"

From: Thomas Gleixner
Date: Thu Feb 21 2008 - 15:27:32 EST


On Thu, 21 Feb 2008, Diego Calleja wrote:
> > Hmm, that's confusing. Can you please provide a complete boot log ?
> >
> > Thanks,
>
> Sure

Thanks. Nothing new there. Can you please apply the patch below and
provide the output of the ioremap code ?

Thanks,

tglx

Index: linux-2.6/arch/x86/mm/ioremap.c
===================================================================
--- linux-2.6.orig/arch/x86/mm/ioremap.c
+++ linux-2.6/arch/x86/mm/ioremap.c
@@ -112,6 +112,7 @@ static void __iomem *__ioremap(unsigned
unsigned long pfn, offset, last_addr, vaddr;
struct vm_struct *area;
pgprot_t prot;
+ int err;

/* Don't allow wraparound or zero size */
last_addr = phys_addr + size - 1;
@@ -130,8 +131,11 @@ static void __iomem *__ioremap(unsigned
for (pfn = phys_addr >> PAGE_SHIFT; pfn < max_pfn_mapped &&
(pfn << PAGE_SHIFT) < last_addr; pfn++) {
if (page_is_ram(pfn) && pfn_valid(pfn) &&
- !PageReserved(pfn_to_page(pfn)))
+ !PageReserved(pfn_to_page(pfn))) {
+ printk(KERN_INFO "ioremap: (RAM) %lx %lu\n", phys_addr,
+ size);
return NULL;
+ }
}

WARN_ON_ONCE(page_is_ram(pfn));
@@ -157,16 +161,23 @@ static void __iomem *__ioremap(unsigned
* Ok, go for it..
*/
area = get_vm_area(size, VM_IOREMAP);
- if (!area)
+ if (!area) {
+ printk(KERN_INFO "ioremap: !area PR %lx %lu\n", phys_addr,
+ size);
return NULL;
+ }
area->phys_addr = phys_addr;
vaddr = (unsigned long) area->addr;
if (ioremap_page_range(vaddr, vaddr + size, phys_addr, prot)) {
remove_vm_area((void *)(vaddr & PAGE_MASK));
+ printk(KERN_INFO "ioremap: IPR %lx %lu\n", phys_addr, size);
return NULL;
}

- if (ioremap_change_attr(vaddr, size, mode) < 0) {
+ err = ioremap_change_attr(vaddr, size, mode);
+ if (err < 0) {
+ printk(KERN_INFO "ioremap: CPA %lx %lu %d\n", phys_addr, size,
+ err);
vunmap(area->addr);
return NULL;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/