Skip to content

Instantly share code, notes, and snippets.

@mguentner
Last active August 29, 2015 14:03
Show Gist options
  • Save mguentner/5edb8e57193d5f8c07dd to your computer and use it in GitHub Desktop.
Save mguentner/5edb8e57193d5f8c07dd to your computer and use it in GitHub Desktop.
diff --git a/arch/arm/xen/p2m.c b/arch/arm/xen/p2m.c
index 97baf44..38291f6 100644
--- a/arch/arm/xen/p2m.c
+++ b/arch/arm/xen/p2m.c
@@ -41,10 +41,16 @@ static int xen_add_phys_to_mach_entry(struct xen_p2m_entry *new)
parent = *link;
entry = rb_entry(parent, struct xen_p2m_entry, rbnode_phys);
- if (new->mfn == entry->mfn)
- goto err_out;
- if (new->pfn == entry->pfn)
+ if (new->mfn == entry->mfn || new->pfn == entry->pfn)
goto err_out;
+ if (new->pfn == entry->pfn) {
+ /* Updating mfn */
+ pr_warn("%s: updating pfn=%pa -> mfn=%pa to mfn=%pa\n", __func__,
+ &entry->pfn, &entry->mfn, &new->mfn);
+ entry->mfn = new->mfn;
+ goto out;
+ }
+
if (new->pfn < entry->pfn)
link = &(*link)->rb_left;
@@ -99,10 +105,15 @@ static int xen_add_mach_to_phys_entry(struct xen_p2m_entry *new)
parent = *link;
entry = rb_entry(parent, struct xen_p2m_entry, rbnode_mach);
- if (new->mfn == entry->mfn)
- goto err_out;
- if (new->pfn == entry->pfn)
+ if (new->mfn == entry->mfn && new->pfn == entry->pfn)
goto err_out;
+ if (new->mfn == entry->mfn) {
+ /* Updating pfn */
+ pr_warn("%s: updating mfn=%pa -> pfn=%pa to pfn=%pa\n", __func__,
+ &entry->mfn, &entry->pfn, &new->pfn);
+ entry->pfn = new->pfn;
+ goto out;
+ }
if (new->mfn < entry->mfn)
link = &(*link)->rb_left;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment