From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: xen-devel@lists.xensource.com
Cc: tim@xen.org, Ian.Campbell@citrix.com,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: [PATCH v2 2/4] xen/arm: implement gnttab_create_shared_page and gnttab_shared_gmfn
Date: Wed, 16 Jan 2013 18:58:53 +0000 [thread overview]
Message-ID: <1358362736-2870-2-git-send-email-stefano.stabellini@eu.citrix.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1301161853130.4978@kaball.uk.xensource.com>
Introduce a simple pfn array, grant_table_gpfn, to keep track of the
grant table pages mapped in guest gpfn space.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
xen/arch/arm/domain.c | 3 +++
xen/arch/arm/mm.c | 2 ++
xen/include/asm-arm/domain.h | 1 +
xen/include/asm-arm/grant_table.h | 13 +++++++++++--
4 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index 59d8d73..644b066 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -6,6 +6,7 @@
#include <xen/wait.h>
#include <xen/errno.h>
#include <xen/bitops.h>
+#include <xen/grant_table.h>
#include <asm/current.h>
#include <asm/regs.h>
@@ -328,11 +329,13 @@ struct domain *alloc_domain_struct(void)
d = alloc_xenheap_pages(0, 0);
if ( d != NULL )
clear_page(d);
+ d->arch.grant_table_gpfn = xmalloc_array(xen_pfn_t, max_nr_grant_frames);
return d;
}
void free_domain_struct(struct domain *d)
{
+ xfree(d->arch.grant_table_gpfn);
free_xenheap_page(d);
}
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 4d3073b..137332e 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -579,6 +579,8 @@ static int xenmem_add_to_physmap_one(
if ( idx < nr_grant_frames(d->grant_table) )
mfn = virt_to_mfn(d->grant_table->shared_raw[idx]);
}
+
+ d->arch.grant_table_gpfn[idx] = gpfn;
spin_unlock(&d->grant_table->lock);
break;
diff --git a/xen/include/asm-arm/domain.h b/xen/include/asm-arm/domain.h
index 577ad19..29fe808 100644
--- a/xen/include/asm-arm/domain.h
+++ b/xen/include/asm-arm/domain.h
@@ -39,6 +39,7 @@ struct arch_domain
{
struct p2m_domain p2m;
struct hvm_domain hvm_domain;
+ xen_pfn_t *grant_table_gpfn;
struct {
/*
diff --git a/xen/include/asm-arm/grant_table.h b/xen/include/asm-arm/grant_table.h
index e49aa8d..3fa270d 100644
--- a/xen/include/asm-arm/grant_table.h
+++ b/xen/include/asm-arm/grant_table.h
@@ -15,8 +15,6 @@ int replace_grant_host_mapping(unsigned long gpaddr, unsigned long mfn,
unsigned long new_gpaddr, unsigned int flags);
void gnttab_mark_dirty(struct domain *d, unsigned long l);
#define gnttab_create_status_page(d, t, i) do {} while (0)
-#define gnttab_create_shared_page(d, t, i) do {} while (0)
-#define gnttab_shared_gmfn(d, t, i) (0)
#define gnttab_status_gmfn(d, t, i) (0)
#define gnttab_release_host_mappings(domain) 1
static inline int replace_grant_supported(void)
@@ -24,6 +22,17 @@ static inline int replace_grant_supported(void)
return 1;
}
+#define gnttab_create_shared_page(d, t, i) \
+ do { \
+ share_xen_page_with_guest( \
+ virt_to_page((char *)(t)->shared_raw[i]), \
+ (d), XENSHARE_writable); \
+ } while ( 0 )
+
+#define gnttab_shared_gmfn(d, t, i) \
+ ( ((i >= nr_grant_frames(d->grant_table)) && \
+ (i < max_nr_grant_frames)) ? 0 : (d->arch.grant_table_gpfn[i]))
+
#endif /* __ASM_GRANT_TABLE_H__ */
/*
* Local variables:
--
1.7.2.5
next prev parent reply other threads:[~2013-01-16 18:58 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-16 18:57 [PATCH v2 0/4] xen/arm: compile and run xl Stefano Stabellini
2013-01-16 18:58 ` [PATCH v2 1/4] xen: move XEN_SYSCTL_physinfo, XEN_SYSCTL_numainfo and XEN_SYSCTL_topologyinfo to common code Stefano Stabellini
2013-01-24 17:37 ` Ian Campbell
2013-02-14 11:28 ` Stefano Stabellini
2013-01-16 18:58 ` Stefano Stabellini [this message]
2013-01-24 17:39 ` [PATCH v2 2/4] xen/arm: implement gnttab_create_shared_page and gnttab_shared_gmfn Ian Campbell
2013-01-16 18:58 ` [PATCH v2 3/4] libxc: fixes for the ARM platform Stefano Stabellini
2013-01-24 17:40 ` Ian Campbell
2013-02-14 11:44 ` Ian Campbell
2013-01-16 18:58 ` [PATCH v2 4/4] xen/arm: compile and run libxl/xl Stefano Stabellini
2013-01-24 17:43 ` 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=1358362736-2870-2-git-send-email-stefano.stabellini@eu.citrix.com \
--to=stefano.stabellini@eu.citrix.com \
--cc=Ian.Campbell@citrix.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).