aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBharata B Rao <bharata@linux.vnet.ibm.com>2018-02-21 05:36:26 -0500
committerMichael Ellerman <mpe@ellerman.id.au>2018-02-23 00:45:51 -0500
commit2f7d03e0511991f124455682cc94094eaa0981ea (patch)
tree7f3d3cd8c69e5e9a3efa0a17388461d0a798c873
parent083b20907185b076f21c265b30fe5b5f24c03d8c (diff)
powerpc/mm/drmem: Fix unexpected flag value in ibm,dynamic-memory-v2
Memory addtion and removal by count and indexed-count methods temporarily mark the LMBs that are being added/removed by a special flag value DRMEM_LMB_RESERVED. Accessing flags value directly at a few places without proper accessor method is causing two unexpected side-effects: - DRMEM_LMB_RESERVED bit is becoming part of the flags word of drconf_cell_v2 entries in ibm,dynamic-memory-v2 DT property. - This results in extra drconf_cell entries in ibm,dynamic-memory-v2. For example if 1G memory is added, it leads to one entry for 3 LMBs and 1 separate entry for the last LMB. All the 4 LMBs should be defined by one entry here. Fix this by always accessing the flags by its accessor method drmem_lmb_flags(). Fixes: 2b31e3aec1db ("powerpc/drmem: Add support for ibm, dynamic-memory-v2 property") Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com> Reviewed-by: Nathan Fontenot <nfont@linux.vnet.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r--arch/powerpc/mm/drmem.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/powerpc/mm/drmem.c b/arch/powerpc/mm/drmem.c
index 916844f99c64..3f1803672c9b 100644
--- a/arch/powerpc/mm/drmem.c
+++ b/arch/powerpc/mm/drmem.c
@@ -98,7 +98,7 @@ static void init_drconf_v2_cell(struct of_drconf_cell_v2 *dr_cell,
98 dr_cell->base_addr = cpu_to_be64(lmb->base_addr); 98 dr_cell->base_addr = cpu_to_be64(lmb->base_addr);
99 dr_cell->drc_index = cpu_to_be32(lmb->drc_index); 99 dr_cell->drc_index = cpu_to_be32(lmb->drc_index);
100 dr_cell->aa_index = cpu_to_be32(lmb->aa_index); 100 dr_cell->aa_index = cpu_to_be32(lmb->aa_index);
101 dr_cell->flags = cpu_to_be32(lmb->flags); 101 dr_cell->flags = cpu_to_be32(drmem_lmb_flags(lmb));
102} 102}
103 103
104static int drmem_update_dt_v2(struct device_node *memory, 104static int drmem_update_dt_v2(struct device_node *memory,
@@ -121,7 +121,7 @@ static int drmem_update_dt_v2(struct device_node *memory,
121 } 121 }
122 122
123 if (prev_lmb->aa_index != lmb->aa_index || 123 if (prev_lmb->aa_index != lmb->aa_index ||
124 prev_lmb->flags != lmb->flags) 124 drmem_lmb_flags(prev_lmb) != drmem_lmb_flags(lmb))
125 lmb_sets++; 125 lmb_sets++;
126 126
127 prev_lmb = lmb; 127 prev_lmb = lmb;
@@ -150,7 +150,7 @@ static int drmem_update_dt_v2(struct device_node *memory,
150 } 150 }
151 151
152 if (prev_lmb->aa_index != lmb->aa_index || 152 if (prev_lmb->aa_index != lmb->aa_index ||
153 prev_lmb->flags != lmb->flags) { 153 drmem_lmb_flags(prev_lmb) != drmem_lmb_flags(lmb)) {
154 /* end of one set, start of another */ 154 /* end of one set, start of another */
155 dr_cell->seq_lmbs = cpu_to_be32(seq_lmbs); 155 dr_cell->seq_lmbs = cpu_to_be32(seq_lmbs);
156 dr_cell++; 156 dr_cell++;