@@ -163,10 +163,10 @@ static struct crash_mem *fill_up_crash_elf_data(void)
163
163
return NULL ;
164
164
165
165
/*
166
- * Exclusion of crash region and/or crashk_low_res may cause
167
- * another range split . So add extra two slots here.
166
+ * Exclusion of crash region, crashk_low_res and/or crashk_cma_ranges
167
+ * may cause range splits . So add extra slots here.
168
168
*/
169
- nr_ranges += 2 ;
169
+ nr_ranges += 2 + crashk_cma_cnt ;
170
170
cmem = vzalloc (struct_size (cmem , ranges , nr_ranges ));
171
171
if (!cmem )
172
172
return NULL ;
@@ -184,6 +184,7 @@ static struct crash_mem *fill_up_crash_elf_data(void)
184
184
static int elf_header_exclude_ranges (struct crash_mem * cmem )
185
185
{
186
186
int ret = 0 ;
187
+ int i ;
187
188
188
189
/* Exclude the low 1M because it is always reserved */
189
190
ret = crash_exclude_mem_range (cmem , 0 , SZ_1M - 1 );
@@ -198,8 +199,17 @@ static int elf_header_exclude_ranges(struct crash_mem *cmem)
198
199
if (crashk_low_res .end )
199
200
ret = crash_exclude_mem_range (cmem , crashk_low_res .start ,
200
201
crashk_low_res .end );
202
+ if (ret )
203
+ return ret ;
201
204
202
- return ret ;
205
+ for (i = 0 ; i < crashk_cma_cnt ; ++ i ) {
206
+ ret = crash_exclude_mem_range (cmem , crashk_cma_ranges [i ].start ,
207
+ crashk_cma_ranges [i ].end );
208
+ if (ret )
209
+ return ret ;
210
+ }
211
+
212
+ return 0 ;
203
213
}
204
214
205
215
static int prepare_elf64_ram_headers_callback (struct resource * res , void * arg )
@@ -374,6 +384,14 @@ int crash_setup_memmap_entries(struct kimage *image, struct boot_params *params)
374
384
add_e820_entry (params , & ei );
375
385
}
376
386
387
+ for (i = 0 ; i < crashk_cma_cnt ; ++ i ) {
388
+ ei .addr = crashk_cma_ranges [i ].start ;
389
+ ei .size = crashk_cma_ranges [i ].end -
390
+ crashk_cma_ranges [i ].start + 1 ;
391
+ ei .type = E820_TYPE_RAM ;
392
+ add_e820_entry (params , & ei );
393
+ }
394
+
377
395
out :
378
396
vfree (cmem );
379
397
return ret ;
0 commit comments