aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/xen/p2m.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
index 7d844739e513..8b5db51be4dd 100644
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -70,6 +70,7 @@
70 70
71#include <asm/cache.h> 71#include <asm/cache.h>
72#include <asm/setup.h> 72#include <asm/setup.h>
73#include <asm/uaccess.h>
73 74
74#include <asm/xen/page.h> 75#include <asm/xen/page.h>
75#include <asm/xen/hypercall.h> 76#include <asm/xen/hypercall.h>
@@ -316,9 +317,9 @@ static void __init xen_rebuild_p2m_list(unsigned long *p2m)
316 paravirt_alloc_pte(&init_mm, __pa(p2m_identity_pte) >> PAGE_SHIFT); 317 paravirt_alloc_pte(&init_mm, __pa(p2m_identity_pte) >> PAGE_SHIFT);
317 for (i = 0; i < PTRS_PER_PTE; i++) { 318 for (i = 0; i < PTRS_PER_PTE; i++) {
318 set_pte(p2m_missing_pte + i, 319 set_pte(p2m_missing_pte + i,
319 pfn_pte(PFN_DOWN(__pa(p2m_missing)), PAGE_KERNEL)); 320 pfn_pte(PFN_DOWN(__pa(p2m_missing)), PAGE_KERNEL_RO));
320 set_pte(p2m_identity_pte + i, 321 set_pte(p2m_identity_pte + i,
321 pfn_pte(PFN_DOWN(__pa(p2m_identity)), PAGE_KERNEL)); 322 pfn_pte(PFN_DOWN(__pa(p2m_identity)), PAGE_KERNEL_RO));
322 } 323 }
323 324
324 for (pfn = 0; pfn < xen_max_p2m_pfn; pfn += chunk) { 325 for (pfn = 0; pfn < xen_max_p2m_pfn; pfn += chunk) {
@@ -365,7 +366,7 @@ static void __init xen_rebuild_p2m_list(unsigned long *p2m)
365 p2m_missing : p2m_identity; 366 p2m_missing : p2m_identity;
366 ptep = populate_extra_pte((unsigned long)(p2m + pfn)); 367 ptep = populate_extra_pte((unsigned long)(p2m + pfn));
367 set_pte(ptep, 368 set_pte(ptep,
368 pfn_pte(PFN_DOWN(__pa(mfns)), PAGE_KERNEL)); 369 pfn_pte(PFN_DOWN(__pa(mfns)), PAGE_KERNEL_RO));
369 continue; 370 continue;
370 } 371 }
371 372
@@ -624,6 +625,9 @@ bool __set_phys_to_machine(unsigned long pfn, unsigned long mfn)
624 return true; 625 return true;
625 } 626 }
626 627
628 if (likely(!__put_user(mfn, xen_p2m_addr + pfn)))
629 return true;
630
627 ptep = lookup_address((unsigned long)(xen_p2m_addr + pfn), &level); 631 ptep = lookup_address((unsigned long)(xen_p2m_addr + pfn), &level);
628 BUG_ON(!ptep || level != PG_LEVEL_4K); 632 BUG_ON(!ptep || level != PG_LEVEL_4K);
629 633
@@ -633,9 +637,7 @@ bool __set_phys_to_machine(unsigned long pfn, unsigned long mfn)
633 if (pte_pfn(*ptep) == PFN_DOWN(__pa(p2m_identity))) 637 if (pte_pfn(*ptep) == PFN_DOWN(__pa(p2m_identity)))
634 return mfn == IDENTITY_FRAME(pfn); 638 return mfn == IDENTITY_FRAME(pfn);
635 639
636 xen_p2m_addr[pfn] = mfn; 640 return false;
637
638 return true;
639} 641}
640 642
641bool set_phys_to_machine(unsigned long pfn, unsigned long mfn) 643bool set_phys_to_machine(unsigned long pfn, unsigned long mfn)