* ARM32 layout:
* 0 - 12M <COMMON>
*
- * 32M - 128M Frametable: 24 bytes per page for 16GB of RAM
+ * 32M - 128M Frametable: 32 bytes per page for 12GB of RAM
* 256M - 1G VMAP: ioremap and early_ioremap use this virtual address
* space
*
*
* 1G - 2G VMAP: ioremap and early_ioremap
*
- * 32G - 64G Frametable: 24 bytes per page for 5.3TB of RAM
+ * 32G - 64G Frametable: 56 bytes per page for 2TB of RAM
*
* 0x0000008000000000 - 0x00007fffffffffff (127.5TB, L0 slots [1..255])
* Unused
*/
#define PFN_ORDER(_pfn) ((_pfn)->v.free.order)
+/*
+ * The size of struct page_info impacts the number of entries that can fit
+ * into the frametable area and thus it affects the amount of physical memory
+ * we claim to support. Define PAGE_INFO_SIZE to be used for sanity checking.
+*/
+#ifdef CONFIG_ARM_64
+#define PAGE_INFO_SIZE 56
+#else
+#define PAGE_INFO_SIZE 32
+#endif
+
struct page_info
{
/* Each frame can be threaded onto a doubly-linked list. */
const unsigned long mapping_size = frametable_size < MB(32) ? MB(2) : MB(32);
int rc;
+ BUILD_BUG_ON(sizeof(struct page_info) != PAGE_INFO_SIZE);
+
+ if ( frametable_size > FRAMETABLE_SIZE )
+ panic("The frametable cannot cover the physical region %#"PRIpaddr" - %#"PRIpaddr"\n",
+ ps, pe);
+
frametable_base_pdx = mfn_to_pdx(maddr_to_mfn(ps));
/* Round up to 2M or 32M boundary, as appropriate. */
frametable_size = ROUNDUP(frametable_size, mapping_size);