aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Vrabel <david.vrabel@citrix.com>2015-01-07 06:01:08 -0500
committerDavid Vrabel <david.vrabel@citrix.com>2015-01-08 08:52:36 -0500
commitbc7142cf798ae77628ae8c29bfdf6aa6dd2378e9 (patch)
tree2c6950016711b3b951d25441353e6fc689f860b6
parent701a261ad6c4c1915861673b7e8ab9fee5cef69a (diff)
x86/xen: don't count how many PFNs are identity mapped
This accounting is just used to print a diagnostic message that isn't very useful. Signed-off-by: David Vrabel <david.vrabel@citrix.com> Reviewed-by: Juergen Gross <jgross@suse.com>
-rw-r--r--arch/x86/xen/setup.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index dfd77dec8e2b..664dffc29b6b 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -229,15 +229,14 @@ static int __init xen_free_mfn(unsigned long mfn)
229 * as a fallback if the remapping fails. 229 * as a fallback if the remapping fails.
230 */ 230 */
231static void __init xen_set_identity_and_release_chunk(unsigned long start_pfn, 231static void __init xen_set_identity_and_release_chunk(unsigned long start_pfn,
232 unsigned long end_pfn, unsigned long nr_pages, unsigned long *identity, 232 unsigned long end_pfn, unsigned long nr_pages, unsigned long *released)
233 unsigned long *released)
234{ 233{
235 unsigned long len = 0;
236 unsigned long pfn, end; 234 unsigned long pfn, end;
237 int ret; 235 int ret;
238 236
239 WARN_ON(start_pfn > end_pfn); 237 WARN_ON(start_pfn > end_pfn);
240 238
239 /* Release pages first. */
241 end = min(end_pfn, nr_pages); 240 end = min(end_pfn, nr_pages);
242 for (pfn = start_pfn; pfn < end; pfn++) { 241 for (pfn = start_pfn; pfn < end; pfn++) {
243 unsigned long mfn = pfn_to_mfn(pfn); 242 unsigned long mfn = pfn_to_mfn(pfn);
@@ -250,16 +249,14 @@ static void __init xen_set_identity_and_release_chunk(unsigned long start_pfn,
250 WARN(ret != 1, "Failed to release pfn %lx err=%d\n", pfn, ret); 249 WARN(ret != 1, "Failed to release pfn %lx err=%d\n", pfn, ret);
251 250
252 if (ret == 1) { 251 if (ret == 1) {
252 (*released)++;
253 if (!__set_phys_to_machine(pfn, INVALID_P2M_ENTRY)) 253 if (!__set_phys_to_machine(pfn, INVALID_P2M_ENTRY))
254 break; 254 break;
255 len++;
256 } else 255 } else
257 break; 256 break;
258 } 257 }
259 258
260 /* Need to release pages first */ 259 set_phys_range_identity(start_pfn, end_pfn);
261 *released += len;
262 *identity += set_phys_range_identity(start_pfn, end_pfn);
263} 260}
264 261
265/* 262/*
@@ -318,7 +315,6 @@ static void __init xen_do_set_identity_and_remap_chunk(
318 unsigned long ident_pfn_iter, remap_pfn_iter; 315 unsigned long ident_pfn_iter, remap_pfn_iter;
319 unsigned long ident_end_pfn = start_pfn + size; 316 unsigned long ident_end_pfn = start_pfn + size;
320 unsigned long left = size; 317 unsigned long left = size;
321 unsigned long ident_cnt = 0;
322 unsigned int i, chunk; 318 unsigned int i, chunk;
323 319
324 WARN_ON(size == 0); 320 WARN_ON(size == 0);
@@ -347,8 +343,7 @@ static void __init xen_do_set_identity_and_remap_chunk(
347 xen_remap_mfn = mfn; 343 xen_remap_mfn = mfn;
348 344
349 /* Set identity map */ 345 /* Set identity map */
350 ident_cnt += set_phys_range_identity(ident_pfn_iter, 346 set_phys_range_identity(ident_pfn_iter, ident_pfn_iter + chunk);
351 ident_pfn_iter + chunk);
352 347
353 left -= chunk; 348 left -= chunk;
354 } 349 }
@@ -371,7 +366,7 @@ static void __init xen_do_set_identity_and_remap_chunk(
371static unsigned long __init xen_set_identity_and_remap_chunk( 366static unsigned long __init xen_set_identity_and_remap_chunk(
372 const struct e820entry *list, size_t map_size, unsigned long start_pfn, 367 const struct e820entry *list, size_t map_size, unsigned long start_pfn,
373 unsigned long end_pfn, unsigned long nr_pages, unsigned long remap_pfn, 368 unsigned long end_pfn, unsigned long nr_pages, unsigned long remap_pfn,
374 unsigned long *identity, unsigned long *released) 369 unsigned long *released)
375{ 370{
376 unsigned long pfn; 371 unsigned long pfn;
377 unsigned long i = 0; 372 unsigned long i = 0;
@@ -386,8 +381,7 @@ static unsigned long __init xen_set_identity_and_remap_chunk(
386 /* Do not remap pages beyond the current allocation */ 381 /* Do not remap pages beyond the current allocation */
387 if (cur_pfn >= nr_pages) { 382 if (cur_pfn >= nr_pages) {
388 /* Identity map remaining pages */ 383 /* Identity map remaining pages */
389 *identity += set_phys_range_identity(cur_pfn, 384 set_phys_range_identity(cur_pfn, cur_pfn + size);
390 cur_pfn + size);
391 break; 385 break;
392 } 386 }
393 if (cur_pfn + size > nr_pages) 387 if (cur_pfn + size > nr_pages)
@@ -398,7 +392,7 @@ static unsigned long __init xen_set_identity_and_remap_chunk(
398 if (!remap_range_size) { 392 if (!remap_range_size) {
399 pr_warning("Unable to find available pfn range, not remapping identity pages\n"); 393 pr_warning("Unable to find available pfn range, not remapping identity pages\n");
400 xen_set_identity_and_release_chunk(cur_pfn, 394 xen_set_identity_and_release_chunk(cur_pfn,
401 cur_pfn + left, nr_pages, identity, released); 395 cur_pfn + left, nr_pages, released);
402 break; 396 break;
403 } 397 }
404 /* Adjust size to fit in current e820 RAM region */ 398 /* Adjust size to fit in current e820 RAM region */
@@ -410,7 +404,6 @@ static unsigned long __init xen_set_identity_and_remap_chunk(
410 /* Update variables to reflect new mappings. */ 404 /* Update variables to reflect new mappings. */
411 i += size; 405 i += size;
412 remap_pfn += size; 406 remap_pfn += size;
413 *identity += size;
414 } 407 }
415 408
416 /* 409 /*
@@ -430,7 +423,6 @@ static void __init xen_set_identity_and_remap(
430 unsigned long *released) 423 unsigned long *released)
431{ 424{
432 phys_addr_t start = 0; 425 phys_addr_t start = 0;
433 unsigned long identity = 0;
434 unsigned long last_pfn = nr_pages; 426 unsigned long last_pfn = nr_pages;
435 const struct e820entry *entry; 427 const struct e820entry *entry;
436 unsigned long num_released = 0; 428 unsigned long num_released = 0;
@@ -460,14 +452,13 @@ static void __init xen_set_identity_and_remap(
460 last_pfn = xen_set_identity_and_remap_chunk( 452 last_pfn = xen_set_identity_and_remap_chunk(
461 list, map_size, start_pfn, 453 list, map_size, start_pfn,
462 end_pfn, nr_pages, last_pfn, 454 end_pfn, nr_pages, last_pfn,
463 &identity, &num_released); 455 &num_released);
464 start = end; 456 start = end;
465 } 457 }
466 } 458 }
467 459
468 *released = num_released; 460 *released = num_released;
469 461
470 pr_info("Set %ld page(s) to 1-1 mapping\n", identity);
471 pr_info("Released %ld page(s)\n", num_released); 462 pr_info("Released %ld page(s)\n", num_released);
472} 463}
473 464