WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] [IA64] Expand memory_op for PV-on-HVM on

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [IA64] Expand memory_op for PV-on-HVM on IPF
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 13 Sep 2006 13:40:17 +0000
Delivery-date: Wed, 13 Sep 2006 06:40:50 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User awilliam@xxxxxxxxxxx
# Node ID af50fb41612cac5b079b6663fddbed2f4f79f13d
# Parent  586c5fe8cf3e671231c0b9bcbfef9fec0aa251e4
[IA64] Expand memory_op for PV-on-HVM on IPF

Signed-off-by: Tsunehisa Doi <Doi.Tsunehisa@xxxxxxxxxxxxxx>
Signed-off-by: Tomonari Horikoshi <t.horikoshi@xxxxxxxxxxxxxx>
---
 xen/arch/ia64/xen/mm.c   |   80 +++++++++++++++++++++++++++++++++++++++++++++++
 xen/arch/ia64/xen/vhpt.c |   29 +++++++++++------
 2 files changed, 100 insertions(+), 9 deletions(-)

diff -r 586c5fe8cf3e -r af50fb41612c xen/arch/ia64/xen/mm.c
--- a/xen/arch/ia64/xen/mm.c    Tue Aug 29 09:08:29 2006 -0600
+++ b/xen/arch/ia64/xen/mm.c    Fri Sep 01 08:46:02 2006 -0600
@@ -173,6 +173,9 @@
 #include <asm/vcpu.h>
 #include <asm/shadow.h>
 #include <linux/efi.h>
+#include <xen/guest_access.h>
+#include <asm/page.h>
+#include <public/memory.h>
 
 static void domain_page_flush(struct domain* d, unsigned long mpaddr,
                               unsigned long old_mfn, unsigned long new_mfn);
@@ -1752,6 +1755,83 @@ int memory_is_conventional_ram(paddr_t p
     return (efi_mem_type(p) == EFI_CONVENTIONAL_MEMORY);
 }
 
+
+long
+arch_memory_op(int op, XEN_GUEST_HANDLE(void) arg)
+{
+    switch (op) {
+    case XENMEM_add_to_physmap:
+    {
+        struct xen_add_to_physmap xatp;
+        unsigned long prev_mfn, mfn = 0, gpfn;
+        struct domain *d;
+
+        if (copy_from_guest(&xatp, arg, 1))
+            return -EFAULT;
+
+        if (xatp.domid == DOMID_SELF) {
+            d = current->domain;
+            get_knownalive_domain(d);
+        }
+        else if (!IS_PRIV(current->domain))
+            return -EPERM;
+        else if ((d = find_domain_by_id(xatp.domid)) == NULL)
+            return -ESRCH;
+
+        /* This hypercall is used for VT-i domain only */
+        if (!VMX_DOMAIN(d->vcpu[0])) {
+            put_domain(d);
+            return -ENOSYS;
+        }
+
+        switch (xatp.space) {
+        case XENMAPSPACE_shared_info:
+            if (xatp.idx == 0)
+                mfn = virt_to_mfn(d->shared_info);
+            break;
+        case XENMAPSPACE_grant_table:
+            if (xatp.idx < NR_GRANT_FRAMES)
+                mfn = virt_to_mfn(d->grant_table->shared) + xatp.idx;
+            break;
+        default:
+            break;
+        }
+
+        LOCK_BIGLOCK(d);
+
+        /* Remove previously mapped page if it was present. */
+        prev_mfn = gmfn_to_mfn(d, xatp.gpfn);
+        if (prev_mfn && mfn_valid(prev_mfn)) {
+            if (IS_XEN_HEAP_FRAME(mfn_to_page(prev_mfn)))
+                /* Xen heap frames are simply unhooked from this phys slot. */
+                guest_physmap_remove_page(d, xatp.gpfn, prev_mfn);
+            else
+                /* Normal domain memory is freed, to avoid leaking memory. */
+                guest_remove_page(d, xatp.gpfn);
+        }
+
+        /* Unmap from old location, if any. */
+        gpfn = get_gpfn_from_mfn(mfn);
+        if (gpfn != INVALID_M2P_ENTRY)
+            guest_physmap_remove_page(d, gpfn, mfn);
+
+        /* Map at new location. */
+        guest_physmap_add_page(d, xatp.gpfn, mfn);
+
+        UNLOCK_BIGLOCK(d);
+        
+        put_domain(d);
+
+        break;
+    }
+
+    default:
+        return -ENOSYS;
+    }
+
+    return 0;
+}
+
 /*
  * Local variables:
  * mode: C
diff -r 586c5fe8cf3e -r af50fb41612c xen/arch/ia64/xen/vhpt.c
--- a/xen/arch/ia64/xen/vhpt.c  Tue Aug 29 09:08:29 2006 -0600
+++ b/xen/arch/ia64/xen/vhpt.c  Fri Sep 01 08:46:02 2006 -0600
@@ -14,6 +14,7 @@
 #include <asm/page.h>
 #include <asm/vhpt.h>
 #include <asm/vcpu.h>
+#include <asm/vmmu.h>
 
 /* Defined in tlb.c  */
 extern void ia64_global_tlb_purge(UINT64 start, UINT64 end, UINT64 nbits);
@@ -131,15 +132,25 @@ void vhpt_init(void)
 
 void vcpu_flush_vtlb_all(struct vcpu *v)
 {
-       /* First VCPU tlb.  */
-       vcpu_purge_tr_entry(&PSCBX(v,dtlb));
-       vcpu_purge_tr_entry(&PSCBX(v,itlb));
-
-       /* Then VHPT.  */
-       vhpt_flush ();
-
-       /* Then mTLB.  */
-       local_flush_tlb_all ();
+       if (VMX_DOMAIN(v)) {
+               /* This code may be call for remapping shared_info and
+                  grant_table share page from guest_physmap_remove_page()
+                  in arch_memory_op() XENMEM_add_to_physmap to realize
+                  PV-on-HVM feature. */
+               /* Purge vTLB for VT-i domain */
+               thash_purge_all(v);
+       }
+       else {
+               /* First VCPU tlb.  */
+               vcpu_purge_tr_entry(&PSCBX(v,dtlb));
+               vcpu_purge_tr_entry(&PSCBX(v,itlb));
+
+               /* Then VHPT.  */
+               vhpt_flush();
+
+               /* Then mTLB.  */
+               local_flush_tlb_all();
+       }
 
        /* We could clear bit in d->domain_dirty_cpumask only if domain d in
           not running on this processor.  There is currently no easy way to

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [IA64] Expand memory_op for PV-on-HVM on IPF, Xen patchbot-unstable <=