diff options
Diffstat (limited to 'arch/x86')
| -rw-r--r-- | arch/x86/xen/p2m.c | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c index 141eb0de8b06..a01e6532b46a 100644 --- a/arch/x86/xen/p2m.c +++ b/arch/x86/xen/p2m.c | |||
| @@ -522,11 +522,20 @@ static bool __init __early_alloc_p2m(unsigned long pfn) | |||
| 522 | /* Boundary cross-over for the edges: */ | 522 | /* Boundary cross-over for the edges: */ |
| 523 | if (idx) { | 523 | if (idx) { |
| 524 | unsigned long *p2m = extend_brk(PAGE_SIZE, PAGE_SIZE); | 524 | unsigned long *p2m = extend_brk(PAGE_SIZE, PAGE_SIZE); |
| 525 | unsigned long *mid_mfn_p; | ||
| 525 | 526 | ||
| 526 | p2m_init(p2m); | 527 | p2m_init(p2m); |
| 527 | 528 | ||
| 528 | p2m_top[topidx][mididx] = p2m; | 529 | p2m_top[topidx][mididx] = p2m; |
| 529 | 530 | ||
| 531 | /* For save/restore we need to MFN of the P2M saved */ | ||
| 532 | |||
| 533 | mid_mfn_p = p2m_top_mfn_p[topidx]; | ||
| 534 | WARN(mid_mfn_p[mididx] != virt_to_mfn(p2m_missing), | ||
| 535 | "P2M_TOP_P[%d][%d] != MFN of p2m_missing!\n", | ||
| 536 | topidx, mididx); | ||
| 537 | mid_mfn_p[mididx] = virt_to_mfn(p2m); | ||
| 538 | |||
| 530 | } | 539 | } |
| 531 | return idx != 0; | 540 | return idx != 0; |
| 532 | } | 541 | } |
| @@ -549,12 +558,29 @@ unsigned long __init set_phys_range_identity(unsigned long pfn_s, | |||
| 549 | pfn += P2M_MID_PER_PAGE * P2M_PER_PAGE) | 558 | pfn += P2M_MID_PER_PAGE * P2M_PER_PAGE) |
| 550 | { | 559 | { |
| 551 | unsigned topidx = p2m_top_index(pfn); | 560 | unsigned topidx = p2m_top_index(pfn); |
| 552 | if (p2m_top[topidx] == p2m_mid_missing) { | 561 | unsigned long *mid_mfn_p; |
| 553 | unsigned long **mid = extend_brk(PAGE_SIZE, PAGE_SIZE); | 562 | unsigned long **mid; |
| 563 | |||
| 564 | mid = p2m_top[topidx]; | ||
| 565 | mid_mfn_p = p2m_top_mfn_p[topidx]; | ||
| 566 | if (mid == p2m_mid_missing) { | ||
| 567 | mid = extend_brk(PAGE_SIZE, PAGE_SIZE); | ||
| 554 | 568 | ||
| 555 | p2m_mid_init(mid); | 569 | p2m_mid_init(mid); |
| 556 | 570 | ||
| 557 | p2m_top[topidx] = mid; | 571 | p2m_top[topidx] = mid; |
| 572 | |||
| 573 | BUG_ON(mid_mfn_p != p2m_mid_missing_mfn); | ||
| 574 | } | ||
| 575 | /* And the save/restore P2M tables.. */ | ||
| 576 | if (mid_mfn_p == p2m_mid_missing_mfn) { | ||
| 577 | mid_mfn_p = extend_brk(PAGE_SIZE, PAGE_SIZE); | ||
| 578 | p2m_mid_mfn_init(mid_mfn_p); | ||
| 579 | |||
| 580 | p2m_top_mfn_p[topidx] = mid_mfn_p; | ||
| 581 | p2m_top_mfn[topidx] = virt_to_mfn(mid_mfn_p); | ||
| 582 | /* Note: we don't set mid_mfn_p[midix] here, | ||
| 583 | * look in __early_alloc_p2m */ | ||
| 558 | } | 584 | } |
| 559 | } | 585 | } |
| 560 | 586 | ||
