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: Add new map space for add_to_physmap, XENMAPSPACE_gmfn_range.
Date: Fri, 4 Nov 2011 10:38:27 +0000	[thread overview]
Message-ID: <1320403109-8739-5-git-send-email-jean.guyader@eu.citrix.com> (raw)
In-Reply-To: <1320403109-8739-4-git-send-email-jean.guyader@eu.citrix.com>

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


XENMAPSPACE_gmfn_range is like XENMAPSPACE_gmfn but with a size which
is the number of pages on which xen will iterate.

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0004-mm-Add-new-map-space-for-add_to_physmap-XENMAPSPACE_.patch --]
[-- Type: text/x-patch; name="0004-mm-Add-new-map-space-for-add_to_physmap-XENMAPSPACE_.patch", Size: 1956 bytes --]

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index f75011e..77ae77f 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -4629,6 +4629,7 @@ static int xenmem_add_to_physmap(struct domain *d, struct xen_add_to_physmap xat
 
         spin_unlock(&d->grant_table->lock);
         break;
+    case XENMAPSPACE_gmfn_range:
     case XENMAPSPACE_gmfn:
     {
         p2m_type_t p2mt;
@@ -4700,6 +4701,7 @@ long arch_memory_op(int op, XEN_GUEST_HANDLE(void) arg)
     {
         struct xen_add_to_physmap xatp;
         struct domain *d;
+        unsigned int size, i;
 
         if ( copy_from_guest(&xatp, arg, 1) )
             return -EFAULT;
@@ -4714,7 +4716,18 @@ long arch_memory_op(int op, XEN_GUEST_HANDLE(void) arg)
             return -EPERM;
         }
 
-        xenmem_add_to_physmap(d, xatp);
+        size = 1;
+        if ( xatp.space == XENMAPSPACE_gmfn_range )
+        {
+            size = xatp.size;
+        }
+
+        for ( i = 0; i < size; i++ )
+        {
+            xenmem_add_to_physmap(d, xatp);
+            xatp.idx++;
+            xatp.gpfn++;
+        }
 
         rcu_unlock_domain(d);
 
diff --git a/xen/include/public/memory.h b/xen/include/public/memory.h
index 08355e3..860b8c0 100644
--- a/xen/include/public/memory.h
+++ b/xen/include/public/memory.h
@@ -212,6 +212,7 @@ struct xen_add_to_physmap {
 #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
@@ -221,6 +222,9 @@ struct xen_add_to_physmap {
 
     /* GPFN where the source mapping page should appear. */
     xen_pfn_t     gpfn;
+
+    /* Number of page, used for GMFN range */
+    unsigned int size;
 };
 typedef struct xen_add_to_physmap xen_add_to_physmap_t;
 DEFINE_XEN_GUEST_HANDLE(xen_add_to_physmap_t);

[-- 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-04 10:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-04 10:38 [PATCH 0/6] IOMMU, vtd and iotlb flush rework Jean Guyader
2011-11-04 10:38 ` [PATCH 1/6] vtd: Refactor iotlb flush code Jean Guyader
2011-11-04 10:38   ` [PATCH 2/6] iommu: Introduce iommu_flush and iommu_flush_all Jean Guyader
2011-11-04 10:38     ` [PATCH 3/6] add_to_physmap: Move the code for XENMEM_add_to_physmap Jean Guyader
2011-11-04 10:38       ` Jean Guyader [this message]
2011-11-04 10:38         ` [PATCH 5/6] hvmloader: Change memory relocation loop when overlap with PCI hole Jean Guyader
2011-11-04 10:38           ` [PATCH 6/6] Introduce domain flag (dont_flush_iotlb) to avoid unnecessary iotlb flush Jean Guyader
2011-11-04 12:41             ` Jan Beulich
2011-11-04 14:52           ` [PATCH 5/6] hvmloader: Change memory relocation loop when overlap with PCI hole Keir Fraser
2011-11-04 12:32         ` [PATCH 4/6] mm: Add new map space for add_to_physmap, XENMAPSPACE_gmfn_range Jan Beulich
2011-11-04 14:47         ` Keir Fraser

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=1320403109-8739-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).