forked from Minki/linux
26f9d5fd82
Initial HIGHMEM support on ARC was introduced for PAE40 where the low memory (0x8000_0000 based) and high memory (0x1_0000_0000) were physically contiguous. So CONFIG_FLATMEM sufficed (despite a peipheral hole in the middle, which wasted a bit of struct page memory, but things worked). However w/o PAE, highmem was not possible and we could only reach ~1.75GB of DDR. Now there is a use case to access ~4GB of DDR w/o PAE40 The idea is to have low memory at canonical 0x8000_0000 and highmem at 0 so enire 4GB address space is available for physical addressing This needs additional platform/interconnect mapping to convert the non contiguous physical addresses into linear bus adresses. From Linux point of view, non contiguous divide means FLATMEM no longer works and DISCONTIGMEM is needed to track the pfns in the 2 regions. This scheme would also work for PAE40, only better in that we don't waste struct page memory for the peripheral hole. The DT description will be something like memory { ... reg = <0x80000000 0x200000000 /* 512MB: lowmem */ 0x00000000 0x10000000>; /* 256MB: highmem */ } Signed-off-by: Noam Camus <noamc@ezchip.com> Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
44 lines
989 B
C
44 lines
989 B
C
/*
|
|
* Copyright (C) 2016 Synopsys, Inc. (www.synopsys.com)
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*/
|
|
|
|
#ifndef _ASM_ARC_MMZONE_H
|
|
#define _ASM_ARC_MMZONE_H
|
|
|
|
#ifdef CONFIG_DISCONTIGMEM
|
|
|
|
extern struct pglist_data node_data[];
|
|
#define NODE_DATA(nid) (&node_data[nid])
|
|
|
|
static inline int pfn_to_nid(unsigned long pfn)
|
|
{
|
|
int is_end_low = 1;
|
|
|
|
if (IS_ENABLED(CONFIG_ARC_HAS_PAE40))
|
|
is_end_low = pfn <= virt_to_pfn(0xFFFFFFFFUL);
|
|
|
|
/*
|
|
* node 0: lowmem: 0x8000_0000 to 0xFFFF_FFFF
|
|
* node 1: HIGHMEM w/o PAE40: 0x0 to 0x7FFF_FFFF
|
|
* HIGHMEM with PAE40: 0x1_0000_0000 to ...
|
|
*/
|
|
if (pfn >= ARCH_PFN_OFFSET && is_end_low)
|
|
return 0;
|
|
|
|
return 1;
|
|
}
|
|
|
|
static inline int pfn_valid(unsigned long pfn)
|
|
{
|
|
int nid = pfn_to_nid(pfn);
|
|
|
|
return (pfn <= node_end_pfn(nid));
|
|
}
|
|
#endif /* CONFIG_DISCONTIGMEM */
|
|
|
|
#endif
|