Commit c987d12f authored by Yinghai Lu's avatar Yinghai Lu Committed by Ingo Molnar

x86: remove end_pfn in 64bit

and use max_pfn directly.
Signed-off-by: default avatarYinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent f47f9d53
...@@ -407,7 +407,9 @@ void __init gart_iommu_hole_init(void) ...@@ -407,7 +407,9 @@ void __init gart_iommu_hole_init(void)
agp_aper_base == aper_base && agp_aper_base == aper_base &&
agp_aper_order == aper_order) { agp_aper_order == aper_order) {
/* the same between two setting from NB and agp */ /* the same between two setting from NB and agp */
if (!no_iommu && end_pfn > MAX_DMA32_PFN && !printed_gart_size_msg) { if (!no_iommu &&
max_pfn > MAX_DMA32_PFN &&
!printed_gart_size_msg) {
printk(KERN_ERR "you are using iommu with agp, but GART size is less than 64M\n"); printk(KERN_ERR "you are using iommu with agp, but GART size is less than 64M\n");
printk(KERN_ERR "please increase GART size in your BIOS setup\n"); printk(KERN_ERR "please increase GART size in your BIOS setup\n");
printk(KERN_ERR "if BIOS doesn't have that option, contact your HW vendor!\n"); printk(KERN_ERR "if BIOS doesn't have that option, contact your HW vendor!\n");
...@@ -448,7 +450,7 @@ out: ...@@ -448,7 +450,7 @@ out:
/* Got the aperture from the AGP bridge */ /* Got the aperture from the AGP bridge */
} else if (swiotlb && !valid_agp) { } else if (swiotlb && !valid_agp) {
/* Do nothing */ /* Do nothing */
} else if ((!no_iommu && end_pfn > MAX_DMA32_PFN) || } else if ((!no_iommu && max_pfn > MAX_DMA32_PFN) ||
force_iommu || force_iommu ||
valid_agp || valid_agp ||
fallback_aper_force) { fallback_aper_force) {
......
...@@ -527,7 +527,7 @@ __init void e820_setup_gap(void) ...@@ -527,7 +527,7 @@ __init void e820_setup_gap(void)
#ifdef CONFIG_X86_64 #ifdef CONFIG_X86_64
if (!found) { if (!found) {
gapstart = (end_pfn << PAGE_SHIFT) + 1024*1024; gapstart = (max_pfn << PAGE_SHIFT) + 1024*1024;
printk(KERN_ERR "PCI: Warning: Cannot find a gap in the 32bit " printk(KERN_ERR "PCI: Warning: Cannot find a gap in the 32bit "
"address range\n" "address range\n"
KERN_ERR "PCI: Unassigned devices with 32bit resource " KERN_ERR "PCI: Unassigned devices with 32bit resource "
......
...@@ -50,7 +50,7 @@ static void __init fix_hypertransport_config(int num, int slot, int func) ...@@ -50,7 +50,7 @@ static void __init fix_hypertransport_config(int num, int slot, int func)
static void __init via_bugs(int num, int slot, int func) static void __init via_bugs(int num, int slot, int func)
{ {
#ifdef CONFIG_GART_IOMMU #ifdef CONFIG_GART_IOMMU
if ((end_pfn > MAX_DMA32_PFN || force_iommu) && if ((max_pfn > MAX_DMA32_PFN || force_iommu) &&
!gart_iommu_aperture_allowed) { !gart_iommu_aperture_allowed) {
printk(KERN_INFO printk(KERN_INFO
"Looks like a VIA chipset. Disabling IOMMU." "Looks like a VIA chipset. Disabling IOMMU."
......
...@@ -110,7 +110,7 @@ static int init_pgtable(struct kimage *image, unsigned long start_pgtable) ...@@ -110,7 +110,7 @@ static int init_pgtable(struct kimage *image, unsigned long start_pgtable)
{ {
pgd_t *level4p; pgd_t *level4p;
level4p = (pgd_t *)__va(start_pgtable); level4p = (pgd_t *)__va(start_pgtable);
return init_level4_page(image, level4p, 0, end_pfn << PAGE_SHIFT); return init_level4_page(image, level4p, 0, max_pfn << PAGE_SHIFT);
} }
static void set_idt(void *newidt, u16 limit) static void set_idt(void *newidt, u16 limit)
......
...@@ -1394,7 +1394,7 @@ void __init detect_calgary(void) ...@@ -1394,7 +1394,7 @@ void __init detect_calgary(void)
return; return;
} }
specified_table_size = determine_tce_table_size(end_pfn * PAGE_SIZE); specified_table_size = determine_tce_table_size(max_pfn * PAGE_SIZE);
for (bus = 0; bus < MAX_PHB_BUS_NUM; bus++) { for (bus = 0; bus < MAX_PHB_BUS_NUM; bus++) {
struct calgary_bus_info *info = &bus_info[bus]; struct calgary_bus_info *info = &bus_info[bus];
...@@ -1459,7 +1459,7 @@ int __init calgary_iommu_init(void) ...@@ -1459,7 +1459,7 @@ int __init calgary_iommu_init(void)
if (ret) { if (ret) {
printk(KERN_ERR "PCI-DMA: Calgary init failed %d, " printk(KERN_ERR "PCI-DMA: Calgary init failed %d, "
"falling back to no_iommu\n", ret); "falling back to no_iommu\n", ret);
if (end_pfn > MAX_DMA32_PFN) if (max_pfn > MAX_DMA32_PFN)
printk(KERN_ERR "WARNING more than 4GB of memory, " printk(KERN_ERR "WARNING more than 4GB of memory, "
"32bit PCI may malfunction.\n"); "32bit PCI may malfunction.\n");
return ret; return ret;
......
...@@ -75,7 +75,7 @@ early_param("dma32_size", parse_dma32_size_opt); ...@@ -75,7 +75,7 @@ early_param("dma32_size", parse_dma32_size_opt);
void __init dma32_reserve_bootmem(void) void __init dma32_reserve_bootmem(void)
{ {
unsigned long size, align; unsigned long size, align;
if (end_pfn <= MAX_DMA32_PFN) if (max_pfn <= MAX_DMA32_PFN)
return; return;
/* /*
...@@ -94,7 +94,7 @@ void __init dma32_reserve_bootmem(void) ...@@ -94,7 +94,7 @@ void __init dma32_reserve_bootmem(void)
static void __init dma32_free_bootmem(void) static void __init dma32_free_bootmem(void)
{ {
if (end_pfn <= MAX_DMA32_PFN) if (max_pfn <= MAX_DMA32_PFN)
return; return;
if (!dma32_bootmem_ptr) if (!dma32_bootmem_ptr)
......
...@@ -751,10 +751,10 @@ void __init gart_iommu_init(void) ...@@ -751,10 +751,10 @@ void __init gart_iommu_init(void)
return; return;
if (no_iommu || if (no_iommu ||
(!force_iommu && end_pfn <= MAX_DMA32_PFN) || (!force_iommu && max_pfn <= MAX_DMA32_PFN) ||
!gart_iommu_aperture || !gart_iommu_aperture ||
(no_agp && init_k8_gatt(&info) < 0)) { (no_agp && init_k8_gatt(&info) < 0)) {
if (end_pfn > MAX_DMA32_PFN) { if (max_pfn > MAX_DMA32_PFN) {
printk(KERN_WARNING "More than 4GB of memory " printk(KERN_WARNING "More than 4GB of memory "
"but GART IOMMU not available.\n" "but GART IOMMU not available.\n"
KERN_WARNING "falling back to iommu=soft.\n"); KERN_WARNING "falling back to iommu=soft.\n");
......
...@@ -38,7 +38,7 @@ const struct dma_mapping_ops swiotlb_dma_ops = { ...@@ -38,7 +38,7 @@ const struct dma_mapping_ops swiotlb_dma_ops = {
void __init pci_swiotlb_init(void) void __init pci_swiotlb_init(void)
{ {
/* don't initialize swiotlb if iommu=off (no_iommu=1) */ /* don't initialize swiotlb if iommu=off (no_iommu=1) */
if (!iommu_detected && !no_iommu && end_pfn > MAX_DMA32_PFN) if (!iommu_detected && !no_iommu && max_pfn > MAX_DMA32_PFN)
swiotlb = 1; swiotlb = 1;
if (swiotlb_force) if (swiotlb_force)
swiotlb = 1; swiotlb = 1;
......
...@@ -48,11 +48,6 @@ ...@@ -48,11 +48,6 @@
#include <asm/numa.h> #include <asm/numa.h>
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
/*
* PFN of last memory page.
*/
unsigned long end_pfn;
/* /*
* end_pfn only includes RAM, while max_pfn_mapped includes all e820 entries. * end_pfn only includes RAM, while max_pfn_mapped includes all e820 entries.
* The direct mapping extends to max_pfn_mapped, so that we can directly access * The direct mapping extends to max_pfn_mapped, so that we can directly access
...@@ -586,9 +581,9 @@ void __init paging_init(void) ...@@ -586,9 +581,9 @@ void __init paging_init(void)
memset(max_zone_pfns, 0, sizeof(max_zone_pfns)); memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
max_zone_pfns[ZONE_DMA] = MAX_DMA_PFN; max_zone_pfns[ZONE_DMA] = MAX_DMA_PFN;
max_zone_pfns[ZONE_DMA32] = MAX_DMA32_PFN; max_zone_pfns[ZONE_DMA32] = MAX_DMA32_PFN;
max_zone_pfns[ZONE_NORMAL] = end_pfn; max_zone_pfns[ZONE_NORMAL] = max_pfn;
memory_present(0, 0, end_pfn); memory_present(0, 0, max_pfn);
sparse_init(); sparse_init();
free_area_init_nodes(max_zone_pfns); free_area_init_nodes(max_zone_pfns);
} }
...@@ -670,8 +665,8 @@ void __init mem_init(void) ...@@ -670,8 +665,8 @@ void __init mem_init(void)
#else #else
totalram_pages = free_all_bootmem(); totalram_pages = free_all_bootmem();
#endif #endif
reservedpages = end_pfn - totalram_pages - reservedpages = max_pfn - totalram_pages -
absent_pages_in_range(0, end_pfn); absent_pages_in_range(0, max_pfn);
after_bootmem = 1; after_bootmem = 1;
codesize = (unsigned long) &_etext - (unsigned long) &_text; codesize = (unsigned long) &_etext - (unsigned long) &_text;
...@@ -690,7 +685,7 @@ void __init mem_init(void) ...@@ -690,7 +685,7 @@ void __init mem_init(void)
printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, " printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, "
"%ldk reserved, %ldk data, %ldk init)\n", "%ldk reserved, %ldk data, %ldk init)\n",
(unsigned long) nr_free_pages() << (PAGE_SHIFT-10), (unsigned long) nr_free_pages() << (PAGE_SHIFT-10),
end_pfn << (PAGE_SHIFT-10), max_pfn << (PAGE_SHIFT-10),
codesize >> 10, codesize >> 10,
reservedpages << (PAGE_SHIFT-10), reservedpages << (PAGE_SHIFT-10),
datasize >> 10, datasize >> 10,
...@@ -784,7 +779,7 @@ int __init reserve_bootmem_generic(unsigned long phys, unsigned long len, ...@@ -784,7 +779,7 @@ int __init reserve_bootmem_generic(unsigned long phys, unsigned long len,
#endif #endif
unsigned long pfn = phys >> PAGE_SHIFT; unsigned long pfn = phys >> PAGE_SHIFT;
if (pfn >= end_pfn) { if (pfn >= max_pfn) {
/* /*
* This can happen with kdump kernels when accessing * This can happen with kdump kernels when accessing
* firmware tables: * firmware tables:
......
...@@ -143,8 +143,8 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end) ...@@ -143,8 +143,8 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end)
limit |= (1<<24)-1; limit |= (1<<24)-1;
limit++; limit++;
if (limit > end_pfn << PAGE_SHIFT) if (limit > max_pfn << PAGE_SHIFT)
limit = end_pfn << PAGE_SHIFT; limit = max_pfn << PAGE_SHIFT;
if (limit <= base) if (limit <= base)
continue; continue;
......
...@@ -86,7 +86,7 @@ static int __init allocate_cachealigned_memnodemap(void) ...@@ -86,7 +86,7 @@ static int __init allocate_cachealigned_memnodemap(void)
addr = 0x8000; addr = 0x8000;
nodemap_size = round_up(sizeof(s16) * memnodemapsize, L1_CACHE_BYTES); nodemap_size = round_up(sizeof(s16) * memnodemapsize, L1_CACHE_BYTES);
nodemap_addr = find_e820_area(addr, end_pfn<<PAGE_SHIFT, nodemap_addr = find_e820_area(addr, max_pfn<<PAGE_SHIFT,
nodemap_size, L1_CACHE_BYTES); nodemap_size, L1_CACHE_BYTES);
if (nodemap_addr == -1UL) { if (nodemap_addr == -1UL) {
printk(KERN_ERR printk(KERN_ERR
...@@ -579,7 +579,7 @@ void __init paging_init(void) ...@@ -579,7 +579,7 @@ void __init paging_init(void)
memset(max_zone_pfns, 0, sizeof(max_zone_pfns)); memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
max_zone_pfns[ZONE_DMA] = MAX_DMA_PFN; max_zone_pfns[ZONE_DMA] = MAX_DMA_PFN;
max_zone_pfns[ZONE_DMA32] = MAX_DMA32_PFN; max_zone_pfns[ZONE_DMA32] = MAX_DMA32_PFN;
max_zone_pfns[ZONE_NORMAL] = end_pfn; max_zone_pfns[ZONE_NORMAL] = max_pfn;
sparse_memory_present_with_active_regions(MAX_NUMNODES); sparse_memory_present_with_active_regions(MAX_NUMNODES);
sparse_init(); sparse_init();
......
...@@ -299,7 +299,7 @@ static int __init nodes_cover_memory(const struct bootnode *nodes) ...@@ -299,7 +299,7 @@ static int __init nodes_cover_memory(const struct bootnode *nodes)
pxmram = 0; pxmram = 0;
} }
e820ram = end_pfn - absent_pages_in_range(0, end_pfn); e820ram = max_pfn - absent_pages_in_range(0, max_pfn);
/* We seem to lose 3 pages somewhere. Allow a bit of slack. */ /* We seem to lose 3 pages somewhere. Allow a bit of slack. */
if ((long)(e820ram - pxmram) >= 1*1024*1024) { if ((long)(e820ram - pxmram) >= 1*1024*1024) {
printk(KERN_ERR printk(KERN_ERR
......
...@@ -83,7 +83,7 @@ static int set_up_temporary_mappings(void) ...@@ -83,7 +83,7 @@ static int set_up_temporary_mappings(void)
/* Set up the direct mapping from scratch */ /* Set up the direct mapping from scratch */
start = (unsigned long)pfn_to_kaddr(0); start = (unsigned long)pfn_to_kaddr(0);
end = (unsigned long)pfn_to_kaddr(end_pfn); end = (unsigned long)pfn_to_kaddr(max_pfn);
for (; start < end; start = next) { for (; start < end; start = next) {
pud_t *pud = (pud_t *)get_safe_page(GFP_ATOMIC); pud_t *pud = (pud_t *)get_safe_page(GFP_ATOMIC);
......
...@@ -58,7 +58,8 @@ ...@@ -58,7 +58,8 @@
void clear_page(void *page); void clear_page(void *page);
void copy_page(void *to, void *from); void copy_page(void *to, void *from);
extern unsigned long end_pfn; /* duplicated to the one in bootmem.h */
extern unsigned long max_pfn;
extern unsigned long phys_base; extern unsigned long phys_base;
extern unsigned long __phys_addr(unsigned long); extern unsigned long __phys_addr(unsigned long);
...@@ -87,7 +88,7 @@ extern void initmem_init(unsigned long start_pfn, unsigned long end_pfn); ...@@ -87,7 +88,7 @@ extern void initmem_init(unsigned long start_pfn, unsigned long end_pfn);
#endif /* !__ASSEMBLY__ */ #endif /* !__ASSEMBLY__ */
#ifdef CONFIG_FLATMEM #ifdef CONFIG_FLATMEM
#define pfn_valid(pfn) ((pfn) < end_pfn) #define pfn_valid(pfn) ((pfn) < max_pfn)
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment