Support ibm,dynamic-reconfiguration-memory nodes
PATCH 1/1 Support ibm,dynamic-reconfiguration-memory nodes
For PAPR partitions with large amounts of memory, the firmware has an alternative, more compact representation for the information about the memory in the partition and its NUMA associativity information. This adds the code to the kernel to parse this alternative representation, and also sets the bit that tells firmware that we can handle the alternative representation.
Signed-off-by Paul Mackerras <[email protected]>
---
arch/powerpc/kernel/prom.c +54 -0
@@ -804,6 +804,55 @@ static unsigned long __init dt_mem_next_return of_read_ulong (p, s); } +#ifdef CONFIG_PPC64 +/* +* Interpret the ibm,dynamic-memory property in the +* /ibm,dynamic-reconfiguration-memory node. +* This contains a list of memory blocks along with NUMA affinity +* information. +*/ +static int __init early_init_dt_scan_drconf_memory (unsigned long node) +{ +cell_t *dm, *ls; +unsigned long l, n; +unsigned long base, size, lmb_size, flags; + + ls = (cell_t *)of_get_flat_dt_prop (node,"ibm,lmb-size" , &l); +if (ls ==NULL || l < dt_root_size_cells *sizeof (cell_t)) +return 0 ; + lmb_size =dt_mem_next_cell (dt_root_size_cells, &ls); + + dm = (cell_t *)of_get_flat_dt_prop (node,"ibm,dynamic-memory" , &l); +if (dm ==NULL || l <sizeof (cell_t)) +return 0 ; + + n = *dm++;/* number of entries */ +if (l < (n * (dt_root_addr_cells +4 ) +1 ) *sizeof (cell_t)) +return 0 ; + +for (; n !=0 ; --n) { + base =dt_mem_next_cell (dt_root_addr_cells, &dm); + flags = dm[3 ]; +/* skip DRC index, pad, assoc. list index, flags */ + dm +=4 ; +/* skip this block if the reserved bit is set */ +if (flags &0x80 ) +continue ; + size = lmb_size; +if (iommu_is_off) { +if (base >=0x80000000ul ) +continue ; +if ((base + size) >0x80000000ul ) + size =0x80000000ul - base; + } +lmb_add (base, size); + } + +return 0 ; +} +#else +#define early_init_dt_scan_drconf_memory (node) 0 +#endif /* CONFIG_PPC64 */ static int __init early_init_dt_scan_memory (unsigned long node,const char *uname,int depth,void *data)
@@ -812,6 +861,11 @@ static int __init early_init_dt_scan_memcell_t *reg, *endp;unsigned long l; +/* Look for the ibm,dynamic-reconfiguration-memory node */ +if (depth ==1 && +strcmp (uname,"ibm,dynamic-reconfiguration-memory" ) ==0 ) +return early_init_dt_scan_drconf_memory (node); +/* We are scanning "memory" nodes only */ if (type ==NULL ) {/*
arch/powerpc/kernel/prom_init.c +1 -1
@@ -678,7 +678,7 @@ static unsigned char ibm_architecture_ve/* option vector 5: PAPR/OF options */ 3 -2 ,/* length */ 0 ,/* don't ignore, don't halt */ - OV5_LPAR | OV5_SPLPAR | OV5_LARGE_PAGES, + OV5_LPAR | OV5_SPLPAR | OV5_LARGE_PAGES | OV5_DRCONF_MEMORY, };/* Old method - ELF header with PT_NOTE sections */
arch/powerpc/mm/numa.c +61 -0
73 lines not on this page · raw message