xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Jean Guyader <jean.guyader@eu.citrix.com>
To: xen-devel@lists.xensource.com
Cc: allen.m.kay@intel.com, tim@xen.org,
	Jean Guyader <jean.guyader@eu.citrix.com>
Subject: [PATCH 4/6] mm: New XENMEM, XENMEM_add_to_physmap_gmfn_range
Date: Mon, 7 Nov 2011 18:25:25 +0000	[thread overview]
Message-ID: <1320690327-12649-5-git-send-email-jean.guyader@eu.citrix.com> (raw)
In-Reply-To: <1320690327-12649-4-git-send-email-jean.guyader@eu.citrix.com>

[-- Attachment #1: Type: text/plain, Size: 470 bytes --]


XENMEM_add_to_physmap_gmfn_range is like XENMEM_add_to_physmap on
the gmfn space but the number of pages on which xen will iterate.

Use the 16 bits padding between .domid and .space in struct xen_add_to_physmap
to keep compatibility with older versions.

Signed-off-by: Jean Guyader <jean.guyader@eu.citrix.com>
---
 xen/arch/x86/mm.c           |   22 +++++++++++++++++++++-
 xen/include/public/memory.h |    4 ++++
 2 files changed, 25 insertions(+), 1 deletions(-)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0004-mm-New-XENMEM-XENMEM_add_to_physmap_gmfn_range.patch --]
[-- Type: text/x-patch; name="0004-mm-New-XENMEM-XENMEM_add_to_physmap_gmfn_range.patch", Size: 1670 bytes --]

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index f75011e..cca64b8 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -4714,9 +4714,29 @@ long arch_memory_op(int op, XEN_GUEST_HANDLE(void) arg)
             return -EPERM;
         }
 
-        xenmem_add_to_physmap(d, xatp);
+        if ( xatp.space != XENMAPSPACE_gmfn_range )
+            xatp.size = 1;
+
+        for ( ; xatp.size > 0; xatp.size-- )
+        {
+            if ( hypercall_preempt_check() )
+            {
+                rc = -EAGAIN;
+                break;
+            }
+            xenmem_add_to_physmap(d, xatp);
+            xatp.idx++;
+            xatp.gpfn++;
+        }
 
         rcu_unlock_domain(d);
+        if ( rc == -EAGAIN )
+        {
+            if ( copy_to_guest(arg, &xatp, 1) )
+                return -EFAULT;
+            rc = hypercall_create_continuation(
+                    __HYPERVISOR_memory_op, "ih", op, arg);
+        }
 
         return rc;
     }
diff --git a/xen/include/public/memory.h b/xen/include/public/memory.h
index 08355e3..8bc8272 100644
--- a/xen/include/public/memory.h
+++ b/xen/include/public/memory.h
@@ -208,10 +208,14 @@ struct xen_add_to_physmap {
     /* Which domain to change the mapping for. */
     domid_t domid;
 
+    /* Number of pages to go through for gmfn_range */
+    uint16_t    size;
+
     /* Source mapping space. */
 #define XENMAPSPACE_shared_info 0 /* shared info page */
 #define XENMAPSPACE_grant_table 1 /* grant table page */
 #define XENMAPSPACE_gmfn        2 /* GMFN */
+#define XENMAPSPACE_gmfn_range  3 /* GMFN_range */
     unsigned int space;
 
 #define XENMAPIDX_grant_table_status 0x80000000

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

  reply	other threads:[~2011-11-07 18:25 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-07 18:25 IOMMU, vtd and iotlb flush rework (v3) Jean Guyader
2011-11-07 18:25 ` [PATCH 1/6] vtd: Refactor iotlb flush code Jean Guyader
2011-11-07 18:25   ` [PATCH 2/6] iommu: Introduce iommu_flush and iommu_flush_all Jean Guyader
2011-11-07 18:25     ` [PATCH 3/6] add_to_physmap: Move the code for XENMEM_add_to_physmap Jean Guyader
2011-11-07 18:25       ` Jean Guyader [this message]
2011-11-07 18:25         ` [PATCH 5/6] hvmloader: Change memory relocation loop when overlap with PCI hole Jean Guyader
2011-11-07 18:25           ` [PATCH 6/6] Introduce per cpu flag (iommu_dont_flush_iotlb) to avoid unnecessary iotlb flush Jean Guyader
2011-11-08 13:45             ` Tim Deegan
2011-11-08  9:20         ` [PATCH 4/6] mm: New XENMEM, XENMEM_add_to_physmap_gmfn_range Jan Beulich
2011-11-08 13:32           ` Tim Deegan
2011-11-08 13:39             ` Tim Deegan
2011-11-08 13:24       ` [PATCH 3/6] add_to_physmap: Move the code for XENMEM_add_to_physmap Tim Deegan
2011-11-08  3:10   ` [PATCH 1/6] vtd: Refactor iotlb flush code Kay, Allen M
2011-11-08  7:42     ` Jean Guyader
2011-11-09  2:41       ` Kay, Allen M
2011-11-09 22:15         ` Jean Guyader
2011-11-09 23:25           ` Kay, Allen M
2011-11-09  2:50       ` Kay, Allen M
  -- strict thread matches above, loose matches on Subject: below --
2011-11-07 15:16 IOMMU, vtd and iotlb flush rework (v2) Jean Guyader
2011-11-07 15:16 ` [PATCH 1/6] vtd: Refactor iotlb flush code Jean Guyader
2011-11-07 15:16   ` [PATCH 2/6] iommu: Introduce iommu_flush and iommu_flush_all Jean Guyader
2011-11-07 15:16     ` [PATCH 3/6] add_to_physmap: Move the code for XENMEM_add_to_physmap Jean Guyader
2011-11-07 15:16       ` [PATCH 4/6] mm: New XENMEM, XENMEM_add_to_physmap_gmfn_range Jean Guyader
2011-11-07 16:45         ` Jan Beulich
2011-11-07 16:58           ` Jean Guyader

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1320690327-12649-5-git-send-email-jean.guyader@eu.citrix.com \
    --to=jean.guyader@eu.citrix.com \
    --cc=allen.m.kay@intel.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).