xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: xen-devel@lists.xen.org
Cc: Ian Campbell <ian.campbell@citrix.com>
Subject: [PATCH 16/21] HACK: arm: initial XENMAPSPACE_gmfn_foreign
Date: Thu, 28 Jun 2012 14:48:04 +0000	[thread overview]
Message-ID: <1340894890-4369-16-git-send-email-ian.campbell@citrix.com> (raw)
In-Reply-To: <1340894890-4369-1-git-send-email-ian.campbell@citrix.com>

Should use same interface as hybrid x86.
---
 xen/arch/arm/mm.c             |   32 ++++++++++++++++++++++++++------
 xen/arch/x86/mm.c             |    2 ++
 xen/include/public/arch-arm.h |    1 +
 xen/include/public/memory.h   |   12 +++++++-----
 4 files changed, 36 insertions(+), 11 deletions(-)

diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 40ac176..d369ee3 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -470,12 +470,32 @@ static int xenmem_add_to_physmap_once(
 
     switch ( xatp->space )
     {
-        case XENMAPSPACE_shared_info:
-            if ( xatp->idx == 0 )
-                mfn = virt_to_mfn(d->shared_info);
-            break;
-        default:
-            return -ENOSYS;
+    case XENMAPSPACE_shared_info:
+        if ( xatp->idx == 0 )
+            mfn = virt_to_mfn(d->shared_info);
+        break;
+    case XENMAPSPACE_gmfn_foreign:
+    {
+        paddr_t maddr;
+        struct domain *od;
+
+        rc = rcu_lock_target_domain_by_id(xatp->foreign_domid, &od);
+        if ( rc < 0 )
+            return rc;
+        maddr = p2m_lookup(od, xatp->idx << PAGE_SHIFT);
+        if ( maddr == INVALID_PADDR )
+        {
+            printk("bad p2m lookup\n");
+            dump_p2m_lookup(od, xatp->idx << PAGE_SHIFT);
+            rcu_unlock_domain(od);
+            return -EINVAL;
+        }
+        mfn = maddr >> PAGE_SHIFT;
+        rcu_unlock_domain(od);
+        break;
+    }
+    default:
+        return -ENOSYS;
     }
 
     domain_lock(d);
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index c543f03..8190fa0 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -4573,6 +4573,8 @@ static int xenmem_add_to_physmap_once(
             mfn = idx;
             page = mfn_to_page(mfn);
             break;
+        case XENMAPSPACE_gmfn_foreign:
+            return -ENOSYS;
         }
         default:
             break;
diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h
index eb1add9..7ebe966 100644
--- a/xen/include/public/arch-arm.h
+++ b/xen/include/public/arch-arm.h
@@ -121,6 +121,7 @@ typedef uint64_t xen_pfn_t;
 #define XEN_LEGACY_MAX_VCPUS 1
 
 typedef uint32_t xen_ulong_t;
+#define PRI_xen_ulong PRIx32
 
 struct vcpu_guest_context {
     struct cpu_user_regs user_regs;         /* User-level CPU registers     */
diff --git a/xen/include/public/memory.h b/xen/include/public/memory.h
index 86d02c8..b2adfbe 100644
--- a/xen/include/public/memory.h
+++ b/xen/include/public/memory.h
@@ -212,11 +212,13 @@ struct xen_add_to_physmap {
     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 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 */
+#define XENMAPSPACE_gmfn_foreign 4 /* GMFN from another guest */
+    uint16_t space;
+    domid_t foreign_domid; /* IFF gmfn_foreign */
 
 #define XENMAPIDX_grant_table_status 0x80000000
 
-- 
1.7.9.1

  parent reply	other threads:[~2012-06-28 14:48 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-28 14:47 [PATCH 0/21 V3] arm: boot a dom1 to "Calibrating delay loop" then hang Ian Campbell
2012-06-28 14:47 ` [PATCH 01/21] arm: allow p2m to be created with specific MATTR Ian Campbell
2012-06-28 14:47   ` [PATCH 02/21] arm: implement vpl011 (UART) emulator Ian Campbell
2012-06-28 14:47   ` [PATCH 03/21] arm: implement vcpu_show_execution_state Ian Campbell
2012-06-28 14:47   ` [PATCH 04/21] arm: use correct attributes for mappings in copy_from_paddr() Ian Campbell
2012-06-28 14:47   ` [PATCH 05/21] arm: split pending SPIs (global) out from pending PPIs and SGIs (per CPU) Ian Campbell
2012-06-28 14:47   ` [PATCH 06/21] arm: make vgic lock safe for use in interrupt context Ian Campbell
2012-07-02 15:42     ` Stefano Stabellini
2012-06-28 14:47   ` [PATCH 07/21] arm: map GICV in all domains, not just dom0 Ian Campbell
2012-06-28 14:47   ` [PATCH 08/21] arm: enable data-cache at the same time as enabling the MMU, not before Ian Campbell
2012-06-28 14:47   ` [PATCH 09/21] arm: Upgrade guest barriers to Outer-Shareable. Enable Protected Table Walk Ian Campbell
2012-06-28 14:47   ` [PATCH 10/21] arm: gic.lock can be taken in interrupt context, so lock appropriately Ian Campbell
2012-06-28 14:47   ` [PATCH 11/21] arm: context switch virtual timer registers Ian Campbell
2012-06-28 14:48   ` [PATCH 12/21] arm: the hyp timer seems to work in newer model versions, default to using it Ian Campbell
2012-06-28 14:48   ` [PATCH 13/21] arm: unwind allocations etc on arch_domain_create_failure Ian Campbell
2012-06-28 14:48   ` [PATCH 14/21] arm: move PSR flag definitions into interface, for tools use Ian Campbell
2012-06-28 14:48   ` [PATCH 15/21] arm: fix typo s/approprately/appropriately/g Ian Campbell
2012-06-28 14:48   ` Ian Campbell [this message]
2012-06-28 14:48   ` [PATCH 17/21] libxc: add ARM support to xc_dom (PV domain building) Ian Campbell
2012-06-28 14:48   ` [PATCH 18/21] arm: implement VGCF_online Ian Campbell
2012-06-28 14:48   ` [PATCH 19/21] HACK: add simple xcbuild Ian Campbell
2012-06-28 14:48   ` [PATCH 20/21] HACK: arm: disable hypercall continuations Ian Campbell
2012-06-28 14:48   ` [PATCH 21/21] xen: add assertion in default_vcpu0_location to protect against broken masks Ian Campbell
2012-07-03 10:07 ` [PATCH 0/21 V3] arm: boot a dom1 to "Calibrating delay loop" then hang Ian Campbell

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=1340894890-4369-16-git-send-email-ian.campbell@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /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).