lkml.org 
[lkml]   [2011]   [Jan]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 09/12] xen p2m: transparently change the p2m mappings in the m2p override
    Date
    From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

    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>
    ---
    arch/x86/xen/p2m.c | 12 ++++++++++++
    1 files changed, 12 insertions(+), 0 deletions(-)

    diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
    index 8db19d5..b3b19d4 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)
    --
    1.5.6.5


    \
     
     \ /
      Last update: 2011-01-10 11:39    [W:0.025 / U:31.496 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site