aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/xen
diff options
context:
space:
mode:
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2011-09-23 17:36:07 -0400
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2011-09-23 22:22:33 -0400
commit0f4b49eaf25e661fbe63a5370b7781166b34d616 (patch)
tree6cb3f57d06e26c80d7ea19b6dba5add060b2f5c1 /arch/x86/xen
parenta867db10e89e12a3d97dedafdd411aa1527a6540 (diff)
xen/p2m: Use SetPagePrivate and its friends for M2P overrides.
We use the page->private field and hence should use the proper macros and set proper bits. Also WARN_ON in case somebody tries to overwrite our data. Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'arch/x86/xen')
-rw-r--r--arch/x86/xen/p2m.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
index cc2f8dcf8dd..6e56b65edaf 100644
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -692,8 +692,9 @@ int m2p_add_override(unsigned long mfn, struct page *page, bool clear_pte)
692 "m2p_add_override: pfn %lx not mapped", pfn)) 692 "m2p_add_override: pfn %lx not mapped", pfn))
693 return -EINVAL; 693 return -EINVAL;
694 } 694 }
695 695 WARN_ON(PagePrivate(page));
696 page->private = mfn; 696 SetPagePrivate(page);
697 set_page_private(page, mfn);
697 page->index = pfn_to_mfn(pfn); 698 page->index = pfn_to_mfn(pfn);
698 699
699 if (unlikely(!set_phys_to_machine(pfn, FOREIGN_FRAME(mfn)))) 700 if (unlikely(!set_phys_to_machine(pfn, FOREIGN_FRAME(mfn))))
@@ -736,7 +737,8 @@ int m2p_remove_override(struct page *page, bool clear_pte)
736 list_del(&page->lru); 737 list_del(&page->lru);
737 spin_unlock_irqrestore(&m2p_override_lock, flags); 738 spin_unlock_irqrestore(&m2p_override_lock, flags);
738 set_phys_to_machine(pfn, page->index); 739 set_phys_to_machine(pfn, page->index);
739 740 WARN_ON(!PagePrivate(page));
741 ClearPagePrivate(page);
740 if (clear_pte && !PageHighMem(page)) 742 if (clear_pte && !PageHighMem(page))
741 set_pte_at(&init_mm, address, ptep, 743 set_pte_at(&init_mm, address, ptep,
742 pfn_pte(pfn, PAGE_KERNEL)); 744 pfn_pte(pfn, PAGE_KERNEL));
@@ -758,7 +760,7 @@ struct page *m2p_find_override(unsigned long mfn)
758 spin_lock_irqsave(&m2p_override_lock, flags); 760 spin_lock_irqsave(&m2p_override_lock, flags);
759 761
760 list_for_each_entry(p, bucket, lru) { 762 list_for_each_entry(p, bucket, lru) {
761 if (p->private == mfn) { 763 if (page_private(p) == mfn) {
762 ret = p; 764 ret = p;
763 break; 765 break;
764 } 766 }