summaryrefslogtreecommitdiff
path: root/arch/x86/xen/p2m.c
diff options
context:
space:
mode:
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>2010-12-10 14:52:45 +0000
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2011-01-11 14:31:53 -0500
commit9b705f0e98c489b18ba22a6eab9d694b546c8552 (patch)
treee8e017032a3e433c7c637c9121eb7fbe5ee8567e /arch/x86/xen/p2m.c
parentf0a70c882ea546bbd802643990ceded32c39facc (diff)
downloadlinux-3.10-9b705f0e98c489b18ba22a6eab9d694b546c8552.tar.gz
linux-3.10-9b705f0e98c489b18ba22a6eab9d694b546c8552.tar.bz2
linux-3.10-9b705f0e98c489b18ba22a6eab9d694b546c8552.zip
xen p2m: transparently change the p2m mappings in the m2p override
In m2p_add_override store the original mfn into page->index and then change the p2m mapping, setting mfns as FOREIGN_FRAME. In m2p_remove_override restore the original mapping. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'arch/x86/xen/p2m.c')
-rw-r--r--arch/x86/xen/p2m.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
index 8db19d50c46..b3b19d43b95 100644
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -407,8 +407,11 @@ static unsigned long mfn_hash(unsigned long mfn)
void m2p_add_override(unsigned long mfn, struct page *page)
{
unsigned long flags;
+ unsigned long pfn = page_to_pfn(page);
page->private = mfn;
+ page->index = pfn_to_mfn(pfn);
+ __set_phys_to_machine(pfn, FOREIGN_FRAME(mfn));
spin_lock_irqsave(&m2p_override_lock, flags);
list_add(&page->lru, &m2p_overrides[mfn_hash(mfn)]);
spin_unlock_irqrestore(&m2p_override_lock, flags);
@@ -417,9 +420,18 @@ void m2p_add_override(unsigned long mfn, struct page *page)
void m2p_remove_override(struct page *page)
{
unsigned long flags;
+ unsigned long mfn;
+ unsigned long pfn;
+
+ pfn = page_to_pfn(page);
+ mfn = get_phys_to_machine(pfn);
+ if (mfn == INVALID_P2M_ENTRY || !(mfn & FOREIGN_FRAME_BIT))
+ return;
+
spin_lock_irqsave(&m2p_override_lock, flags);
list_del(&page->lru);
spin_unlock_irqrestore(&m2p_override_lock, flags);
+ __set_phys_to_machine(pfn, page->index);
}
struct page *m2p_find_override(unsigned long mfn)