From: Julien Grall <julien.grall@linaro.org>
To: xen-devel@lists.xenproject.org
Cc: stefano.stabellini@eu.citrix.com, tim@xen.org,
ian.campbell@citrix.com, Julien Grall <julien.grall@linaro.org>,
patches@linaro.org
Subject: [PATCH 1/3] xen/arm: p2m: extend create_p2m_entries to support read-only mapping
Date: Thu, 24 Oct 2013 10:02:43 +0100 [thread overview]
Message-ID: <1382605365-19244-2-git-send-email-julien.grall@linaro.org> (raw)
In-Reply-To: <1382605365-19244-1-git-send-email-julien.grall@linaro.org>
Signed-off-by: Julien Grall <julien.grall@linaro.org>
---
xen/arch/arm/p2m.c | 19 +++++++++++--------
xen/include/asm-arm/page.h | 5 +++--
2 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 2d09fef..fdbb07b 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -111,7 +111,7 @@ static int p2m_create_table(struct domain *d,
clear_page(p);
unmap_domain_page(p);
- pte = mfn_to_p2m_entry(page_to_mfn(page), MATTR_MEM);
+ pte = mfn_to_p2m_entry(page_to_mfn(page), MATTR_MEM, 1);
write_pte(entry, pte);
@@ -129,7 +129,8 @@ static int create_p2m_entries(struct domain *d,
paddr_t start_gpaddr,
paddr_t end_gpaddr,
paddr_t maddr,
- int mattr)
+ int mattr,
+ bool_t rw)
{
int rc, flush;
struct p2m_domain *p2m = &d->arch.p2m;
@@ -201,14 +202,15 @@ static int create_p2m_entries(struct domain *d,
goto out;
}
- pte = mfn_to_p2m_entry(page_to_mfn(page), mattr);
+ pte = mfn_to_p2m_entry(page_to_mfn(page), mattr, rw);
write_pte(&third[third_table_offset(addr)], pte);
}
break;
case INSERT:
{
- lpae_t pte = mfn_to_p2m_entry(maddr >> PAGE_SHIFT, mattr);
+ lpae_t pte = mfn_to_p2m_entry(maddr >> PAGE_SHIFT,
+ mattr, rw);
write_pte(&third[third_table_offset(addr)], pte);
maddr += PAGE_SIZE;
}
@@ -243,7 +245,7 @@ int p2m_populate_ram(struct domain *d,
paddr_t start,
paddr_t end)
{
- return create_p2m_entries(d, ALLOCATE, start, end, 0, MATTR_MEM);
+ return create_p2m_entries(d, ALLOCATE, start, end, 0, MATTR_MEM, 1);
}
int map_mmio_regions(struct domain *d,
@@ -251,7 +253,8 @@ int map_mmio_regions(struct domain *d,
paddr_t end_gaddr,
paddr_t maddr)
{
- return create_p2m_entries(d, INSERT, start_gaddr, end_gaddr, maddr, MATTR_DEV);
+ return create_p2m_entries(d, INSERT, start_gaddr, end_gaddr,
+ maddr, MATTR_DEV, 1);
}
int guest_physmap_add_page(struct domain *d,
@@ -261,7 +264,7 @@ int guest_physmap_add_page(struct domain *d,
{
return create_p2m_entries(d, INSERT, gpfn << PAGE_SHIFT,
(gpfn + (1<<page_order)) << PAGE_SHIFT,
- mfn << PAGE_SHIFT, MATTR_MEM);
+ mfn << PAGE_SHIFT, MATTR_MEM, 1);
}
void guest_physmap_remove_page(struct domain *d,
@@ -270,7 +273,7 @@ void guest_physmap_remove_page(struct domain *d,
{
create_p2m_entries(d, REMOVE, gpfn << PAGE_SHIFT,
(gpfn + (1<<page_order)) << PAGE_SHIFT,
- mfn << PAGE_SHIFT, MATTR_MEM);
+ mfn << PAGE_SHIFT, MATTR_MEM, 0);
}
int p2m_alloc_table(struct domain *d)
diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h
index 3d0f8a9..3e9dda7 100644
--- a/xen/include/asm-arm/page.h
+++ b/xen/include/asm-arm/page.h
@@ -213,14 +213,15 @@ static inline lpae_t mfn_to_xen_entry(unsigned long mfn)
return e;
}
-static inline lpae_t mfn_to_p2m_entry(unsigned long mfn, unsigned int mattr)
+static inline lpae_t mfn_to_p2m_entry(unsigned long mfn, unsigned int mattr,
+ bool_t rw)
{
paddr_t pa = ((paddr_t) mfn) << PAGE_SHIFT;
lpae_t e = (lpae_t) {
.p2m.xn = 0,
.p2m.af = 1,
.p2m.sh = LPAE_SH_OUTER,
- .p2m.write = 1,
+ .p2m.write = !!rw,
.p2m.read = 1,
.p2m.mattr = mattr,
.p2m.table = 1,
--
1.8.3.1
next prev parent reply other threads:[~2013-10-24 9:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-24 9:02 [PATCH 0/3] ARM: Support read-only mapping in the grant table Julien Grall
2013-10-24 9:02 ` Julien Grall [this message]
2013-11-11 13:23 ` [PATCH 1/3] xen/arm: p2m: extend create_p2m_entries to support read-only mapping Ian Campbell
2013-11-12 13:13 ` Julien Grall
2013-10-24 9:02 ` [PATCH 2/3] xen/arm: p2m: add guest_physmap_add_page_rw Julien Grall
2013-11-11 13:30 ` Ian Campbell
2013-10-24 9:02 ` [PATCH 3/3] xen/arm: grant-table: Support read-only mapping Julien Grall
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=1382605365-19244-2-git-send-email-julien.grall@linaro.org \
--to=julien.grall@linaro.org \
--cc=ian.campbell@citrix.com \
--cc=patches@linaro.org \
--cc=stefano.stabellini@eu.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).