From: Julien Grall <julien.grall@linaro.org>
To: xen-devel@lists.xenproject.org
Cc: stefano.stabellini@citrix.com,
Julien Grall <julien.grall@linaro.org>,
tim@xen.org, ian.campbell@citrix.com, patches@linaro.org
Subject: [PATCH v2 05/10] xen/arm: p2m: Extend p2m_lookup parameters to retrieve the p2m type
Date: Mon, 9 Dec 2013 03:34:02 +0000 [thread overview]
Message-ID: <1386560047-17500-6-git-send-email-julien.grall@linaro.org> (raw)
In-Reply-To: <1386560047-17500-1-git-send-email-julien.grall@linaro.org>
Signed-off-by: Julien Grall <julien.grall@linaro.org>
---
Changes in v2:
- This patch was "Add p2m_get_entry" on the previous version
- Don't add a new function but only extend p2m_lookup
---
xen/arch/arm/p2m.c | 13 +++++++++++--
xen/arch/arm/traps.c | 6 +++---
xen/include/asm-arm/p2m.h | 2 +-
3 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index e43804c..f0bbaca 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -71,11 +71,17 @@ static lpae_t *p2m_map_first(struct p2m_domain *p2m, paddr_t addr)
* There are no processor functions to do a stage 2 only lookup therefore we
* do a a software walk.
*/
-paddr_t p2m_lookup(struct domain *d, paddr_t paddr)
+paddr_t p2m_lookup(struct domain *d, paddr_t paddr, p2m_type_t *t)
{
struct p2m_domain *p2m = &d->arch.p2m;
lpae_t pte, *first = NULL, *second = NULL, *third = NULL;
paddr_t maddr = INVALID_PADDR;
+ p2m_type_t _t;
+
+ /* Allow t to be NULL */
+ t = t ?: &_t;
+
+ *t = p2m_invalid;
spin_lock(&p2m->lock);
@@ -99,7 +105,10 @@ paddr_t p2m_lookup(struct domain *d, paddr_t paddr)
done:
if ( pte.p2m.valid )
+ {
maddr = (pte.bits & PADDR_MASK & PAGE_MASK) | (paddr & ~PAGE_MASK);
+ *t = pte.p2m.p2mt;
+ }
if (third) unmap_domain_page(third);
if (second) unmap_domain_page(second);
@@ -502,7 +511,7 @@ err:
unsigned long gmfn_to_mfn(struct domain *d, unsigned long gpfn)
{
- paddr_t p = p2m_lookup(d, pfn_to_paddr(gpfn));
+ paddr_t p = p2m_lookup(d, pfn_to_paddr(gpfn), NULL);
return p >> PAGE_SHIFT;
}
diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 458128e..0a811e7 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -1267,7 +1267,7 @@ void dump_guest_s1_walk(struct domain *d, vaddr_t addr)
printk("dom%d VA 0x%08"PRIvaddr"\n", d->domain_id, addr);
printk(" TTBCR: 0x%08"PRIregister"\n", ttbcr);
printk(" TTBR0: 0x%016"PRIx64" = 0x%"PRIpaddr"\n",
- ttbr0, p2m_lookup(d, ttbr0 & PAGE_MASK));
+ ttbr0, p2m_lookup(d, ttbr0 & PAGE_MASK, NULL));
if ( ttbcr & TTBCR_EAE )
{
@@ -1280,7 +1280,7 @@ void dump_guest_s1_walk(struct domain *d, vaddr_t addr)
return;
}
- paddr = p2m_lookup(d, ttbr0 & PAGE_MASK);
+ paddr = p2m_lookup(d, ttbr0 & PAGE_MASK, NULL);
if ( paddr == INVALID_PADDR )
{
printk("Failed TTBR0 maddr lookup\n");
@@ -1295,7 +1295,7 @@ void dump_guest_s1_walk(struct domain *d, vaddr_t addr)
!(first[offset] & 0x2) )
goto done;
- paddr = p2m_lookup(d, first[offset] & PAGE_MASK);
+ paddr = p2m_lookup(d, first[offset] & PAGE_MASK, NULL);
if ( paddr == INVALID_PADDR )
{
diff --git a/xen/include/asm-arm/p2m.h b/xen/include/asm-arm/p2m.h
index 56bbf4d..f4bcd7d 100644
--- a/xen/include/asm-arm/p2m.h
+++ b/xen/include/asm-arm/p2m.h
@@ -58,7 +58,7 @@ int p2m_alloc_table(struct domain *d);
void p2m_load_VTTBR(struct domain *d);
/* Look up the MFN corresponding to a domain's PFN. */
-paddr_t p2m_lookup(struct domain *d, paddr_t gpfn);
+paddr_t p2m_lookup(struct domain *d, paddr_t gpfn, p2m_type_t *t);
/* Setup p2m RAM mapping for domain d from start-end. */
int p2m_populate_ram(struct domain *d, paddr_t start, paddr_t end);
--
1.7.10.4
next prev parent reply other threads:[~2013-12-09 3:34 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-09 3:33 [PATCH v2 00/10] xen/arm: Handle correctly foreign mapping Julien Grall
2013-12-09 3:33 ` [PATCH v2 01/10] xen/arm: Introduce steps in domain_relinquish_resource Julien Grall
2013-12-09 15:42 ` Ian Campbell
2013-12-09 3:33 ` [PATCH v2 02/10] xen/arm: move mfn_to_p2m_entry in arch/arm/p2m.c Julien Grall
2013-12-09 3:34 ` [PATCH v2 03/10] xen/arm: Implement p2m_type_t as an enum Julien Grall
2013-12-09 15:59 ` Ian Campbell
2013-12-09 16:34 ` Julien Grall
2013-12-09 16:54 ` Ian Campbell
2013-12-10 2:02 ` Julien Grall
2013-12-09 3:34 ` [PATCH v2 04/10] xen/arm: Store p2m type in each page of the guest Julien Grall
2013-12-09 16:03 ` Ian Campbell
2013-12-09 16:37 ` Julien Grall
2013-12-09 16:53 ` Ian Campbell
2013-12-10 1:55 ` Julien Grall
2013-12-10 9:37 ` Ian Campbell
2013-12-10 13:50 ` Julien Grall
2013-12-10 13:58 ` Ian Campbell
2013-12-09 3:34 ` Julien Grall [this message]
2013-12-09 16:04 ` [PATCH v2 05/10] xen/arm: p2m: Extend p2m_lookup parameters to retrieve the p2m type Ian Campbell
2013-12-09 3:34 ` [PATCH v2 06/10] xen/arm: Retrieve p2m type in get_page_from_gfn Julien Grall
2013-12-09 16:06 ` Ian Campbell
2013-12-09 16:50 ` Julien Grall
2013-12-09 16:58 ` Ian Campbell
2013-12-10 2:04 ` Julien Grall
2013-12-09 3:34 ` [PATCH v2 07/10] xen/arm: Introduce relinquish_p2m_mapping to remove refcount every mapped page Julien Grall
2013-12-09 16:28 ` Ian Campbell
2013-12-10 1:31 ` Julien Grall
2013-12-10 2:36 ` Julien Grall
2013-12-10 9:34 ` Ian Campbell
2013-12-09 3:34 ` [PATCH v2 08/10] xen/arm: Implement xen_rem_foreign_from_p2m Julien Grall
2013-12-09 16:31 ` Ian Campbell
2013-12-09 17:08 ` Julien Grall
2013-12-09 17:18 ` Ian Campbell
2013-12-10 1:33 ` Julien Grall
2013-12-09 3:34 ` [PATCH v2 09/10] xen/arm: Set foreign page type to p2m_map_foreign Julien Grall
2013-12-09 16:40 ` Ian Campbell
2013-12-10 1:46 ` Julien Grall
2013-12-10 1:51 ` Julien Grall
2013-12-10 9:37 ` Ian Campbell
2013-12-10 14:44 ` Julien Grall
2013-12-10 15:13 ` Ian Campbell
2013-12-09 3:34 ` [PATCH v2 10/10] xen/arm: grant-table: Support read-only mapping Julien Grall
2013-12-09 16:41 ` Ian Campbell
2013-12-09 11:32 ` [PATCH v2 00/10] xen/arm: Handle correctly foreign mapping George Dunlap
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=1386560047-17500-6-git-send-email-julien.grall@linaro.org \
--to=julien.grall@linaro.org \
--cc=ian.campbell@citrix.com \
--cc=patches@linaro.org \
--cc=stefano.stabellini@citrix.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xenproject.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).