Re: [PATCH] page_to_phys() fix for >4GB pages (i386)

Jens Axboe (axboe@suse.de)
Mon, 18 Mar 2002 09:18:45 +0100


On Fri, Mar 15 2002, Badari Pulavarty wrote:
> Hi,
>
> I found that page_to_phys() is broken for pages > 4GB on x86.
> It is truncating the physical addresses to 32bit, loosing higher
> bits. (pci_map_sg() uses this).
>
> Here is the patch to fix it. Marcelo, could you consider this
> patch ? I have not looked at 2.5 yet, it may be needed there also.
>
> Thanks,
> Badari
>
>
> --- linux/include/asm-i386/io.h Fri Mar 15 11:19:28 2002
> +++ linux.new/include/asm-i386/io.h Fri Mar 15 11:20:38 2002
> @@ -76,7 +76,11 @@
> /*
> * Change "struct page" to physical address.
> */
> +#ifdef CONFIG_HIGHMEM64G
> +#define page_to_phys(page) ((u64)(page - mem_map) << PAGE_SHIFT)
> +#else
> #define page_to_phys(page) ((page - mem_map) << PAGE_SHIFT)
> +#endif
>
> extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long flags);

Ugh, this would indeed explain an unfixed problem with compaq arrays
corrupting data with > 4gb of ram. Thanks, good spotting!

-- 
Jens Axboe

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/