From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: xen-devel@lists.xensource.com
Cc: Tim.Deegan@xen.org, Ian.Campbell@citrix.com,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: [PATCH v3 4/4] xen/arm: grant table
Date: Thu, 26 Jul 2012 19:54:52 +0100 [thread overview]
Message-ID: <1343328892-10195-4-git-send-email-stefano.stabellini@eu.citrix.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1207261949150.26163@kaball.uk.xensource.com>
Implement XENMAPSPACE_grant_table and grant_table_op.
Changes in v3:
- remove HVM_PARAM_GRANT_START_PFN.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
---
xen/arch/arm/mm.c | 29 ++++++++++++++++++++++++++++-
xen/arch/arm/traps.c | 1 +
2 files changed, 29 insertions(+), 1 deletions(-)
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 96a4ca2..08bc55b 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -25,6 +25,7 @@
#include <xen/mm.h>
#include <xen/preempt.h>
#include <xen/errno.h>
+#include <xen/grant_table.h>
#include <xen/guest_access.h>
#include <xen/domain_page.h>
#include <asm/page.h>
@@ -465,11 +466,37 @@ static int xenmem_add_to_physmap_once(
struct domain *d,
const struct xen_add_to_physmap *xatp)
{
- unsigned long mfn = 0;
+ unsigned long mfn = 0, idx = 0;
int rc;
switch ( xatp->space )
{
+ case XENMAPSPACE_grant_table:
+ spin_lock(&d->grant_table->lock);
+
+ if ( d->grant_table->gt_version == 0 )
+ d->grant_table->gt_version = 1;
+
+ idx = xatp->idx;
+ if ( d->grant_table->gt_version == 2 &&
+ (xatp->idx & XENMAPIDX_grant_table_status) )
+ {
+ idx &= ~XENMAPIDX_grant_table_status;
+ if ( idx < nr_status_frames(d->grant_table) )
+ mfn = virt_to_mfn(d->grant_table->status[idx]);
+ }
+ else
+ {
+ if ( (idx >= nr_grant_frames(d->grant_table)) &&
+ (idx < max_nr_grant_frames) )
+ gnttab_grow_table(d, idx + 1);
+
+ if ( idx < nr_grant_frames(d->grant_table) )
+ mfn = virt_to_mfn(d->grant_table->shared_raw[idx]);
+ }
+
+ spin_unlock(&d->grant_table->lock);
+ break;
case XENMAPSPACE_shared_info:
if ( xatp->idx == 0 )
mfn = virt_to_mfn(d->shared_info);
diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index ad308c3..d77879e 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -431,6 +431,7 @@ static arm_hypercall_t *arm_hypercall_table[] = {
HYPERCALL(physdev_op),
HYPERCALL(sysctl),
HYPERCALL(hvm_op),
+ HYPERCALL(grant_table_op),
};
static void do_debug_trap(struct cpu_user_regs *regs, unsigned int code)
--
1.7.2.5
next prev parent reply other threads:[~2012-07-26 18:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-26 18:53 [PATCH v3 0/4] xen/arm: grant_table Stefano Stabellini
2012-07-26 18:54 ` [PATCH v3 1/4] xen/arm: implement page reference and grant table functions needed by grant_table.c Stefano Stabellini
2012-07-26 18:54 ` [PATCH v3 2/4] xen/arm: implement get/put_page_type Stefano Stabellini
2012-08-02 10:08 ` Ian Campbell
2012-07-26 18:54 ` [PATCH v3 3/4] xen/arm: create_p2m_entries should not call free_domheap_page Stefano Stabellini
2012-07-26 18:54 ` Stefano Stabellini [this message]
2012-08-01 10:29 ` [PATCH v3 0/4] xen/arm: grant_table 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=1343328892-10195-4-git-send-email-stefano.stabellini@eu.citrix.com \
--to=stefano.stabellini@eu.citrix.com \
--cc=Ian.Campbell@citrix.com \
--cc=Tim.Deegan@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).