aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/prom.c
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2006-11-29 06:27:42 -0500
committerPaul Mackerras <paulus@samba.org>2006-12-10 21:49:49 -0500
commit0204568a088fecd5478153504f9476ee2c46d5bf (patch)
tree6c22d9590bbedd3b4ba22e53737c37c6862f5e48 /arch/powerpc/kernel/prom.c
parenta223535425eb28082a0925b0ce2f02f962936cf4 (diff)
[POWERPC] 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. The other part of this patch is telling the firmware that we can handle the alternative representation. There is however a subtlety here, because the firmware will invoke a reboot if the memory representation we request is different from the representation that firmware is currently using. This is because firmware can't change the representation on the fly. Further, some firmware versions used on POWER5+ machines have a bug where this reboot leaves the machine with an altered value of load-base, which will prevent any kernel booting until it is reset to the normal value (0x4000). Because of this bug, we do NOT set fake_elf.rpanote.new_mem_def = 1, and thus we do not request the new representation on POWER5+ and earlier machines. We do request the new representation on POWER6, which uses the ibm,client-architecture-support call. Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/prom.c')
-rw-r--r--arch/powerpc/kernel/prom.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index c18dbe77fdc2..1fc732a552db 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -804,6 +804,56 @@ static unsigned long __init dt_mem_next_cell(int s, cell_t **cellp)
804 return of_read_ulong(p, s); 804 return of_read_ulong(p, s);
805} 805}
806 806
807#ifdef CONFIG_PPC_PSERIES
808/*
809 * Interpret the ibm,dynamic-memory property in the
810 * /ibm,dynamic-reconfiguration-memory node.
811 * This contains a list of memory blocks along with NUMA affinity
812 * information.
813 */
814static int __init early_init_dt_scan_drconf_memory(unsigned long node)
815{
816 cell_t *dm, *ls;
817 unsigned long l, n;
818 unsigned long base, size, lmb_size, flags;
819
820 ls = (cell_t *)of_get_flat_dt_prop(node, "ibm,lmb-size", &l);
821 if (ls == NULL || l < dt_root_size_cells * sizeof(cell_t))
822 return 0;
823 lmb_size = dt_mem_next_cell(dt_root_size_cells, &ls);
824
825 dm = (cell_t *)of_get_flat_dt_prop(node, "ibm,dynamic-memory", &l);
826 if (dm == NULL || l < sizeof(cell_t))
827 return 0;
828
829 n = *dm++; /* number of entries */
830 if (l < (n * (dt_root_addr_cells + 4) + 1) * sizeof(cell_t))
831 return 0;
832
833 for (; n != 0; --n) {
834 base = dt_mem_next_cell(dt_root_addr_cells, &dm);
835 flags = dm[3];
836 /* skip DRC index, pad, assoc. list index, flags */
837 dm += 4;
838 /* skip this block if the reserved bit is set in flags (0x80)
839 or if the block is not assigned to this partition (0x8) */
840 if ((flags & 0x80) || !(flags & 0x8))
841 continue;
842 size = lmb_size;
843 if (iommu_is_off) {
844 if (base >= 0x80000000ul)
845 continue;
846 if ((base + size) > 0x80000000ul)
847 size = 0x80000000ul - base;
848 }
849 lmb_add(base, size);
850 }
851 lmb_dump_all();
852 return 0;
853}
854#else
855#define early_init_dt_scan_drconf_memory(node) 0
856#endif /* CONFIG_PPC_PSERIES */
807 857
808static int __init early_init_dt_scan_memory(unsigned long node, 858static int __init early_init_dt_scan_memory(unsigned long node,
809 const char *uname, int depth, void *data) 859 const char *uname, int depth, void *data)
@@ -812,6 +862,11 @@ static int __init early_init_dt_scan_memory(unsigned long node,
812 cell_t *reg, *endp; 862 cell_t *reg, *endp;
813 unsigned long l; 863 unsigned long l;
814 864
865 /* Look for the ibm,dynamic-reconfiguration-memory node */
866 if (depth == 1 &&
867 strcmp(uname, "ibm,dynamic-reconfiguration-memory") == 0)
868 return early_init_dt_scan_drconf_memory(node);
869
815 /* We are scanning "memory" nodes only */ 870 /* We are scanning "memory" nodes only */
816 if (type == NULL) { 871 if (type == NULL) {
817 /* 872 /*