From: Ian Campbell <ian.campbell@citrix.com>
To: xen-devel@lists.xen.org
Cc: Ian Campbell <ian.campbell@citrix.com>
Subject: [PATCH 01/21] arm: allow p2m to be created with specific MATTR.
Date: Thu, 28 Jun 2012 14:47:49 +0000 [thread overview]
Message-ID: <1340894890-4369-1-git-send-email-ian.campbell@citrix.com> (raw)
In-Reply-To: <1340894870.10942.63.camel@zakaz.uk.xensource.com>
Rename p2m_create_entry to p2m_create_table since it can now only be used to
insert non-leaf entries into the page table.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
xen/arch/arm/p2m.c | 22 ++++++++++++----------
xen/include/asm-arm/page.h | 21 +++++++++++++++++++--
2 files changed, 31 insertions(+), 12 deletions(-)
diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index cf12870..5f20246 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -91,7 +91,8 @@ int p2m_pod_decrease_reservation(struct domain *d,
return -ENOSYS;
}
-static int p2m_create_entry(struct domain *d,
+/* Allocate a new page table page and hook it in via the given entry */
+static int p2m_create_table(struct domain *d,
lpae_t *entry)
{
struct p2m_domain *p2m = &d->arch.p2m;
@@ -111,7 +112,7 @@ static int p2m_create_entry(struct domain *d,
clear_page(p);
unmap_domain_page(p);
- pte = mfn_to_p2m_entry(page_to_mfn(page));
+ pte = mfn_to_p2m_entry(page_to_mfn(page), MATTR_MEM);
write_pte(entry, pte);
@@ -122,7 +123,8 @@ static int create_p2m_entries(struct domain *d,
int alloc,
paddr_t start_gpaddr,
paddr_t end_gpaddr,
- paddr_t maddr)
+ paddr_t maddr,
+ int mattr)
{
int rc;
struct p2m_domain *p2m = &d->arch.p2m;
@@ -142,7 +144,7 @@ static int create_p2m_entries(struct domain *d,
{
if ( !first[first_table_offset(addr)].p2m.valid )
{
- rc = p2m_create_entry(d, &first[first_table_offset(addr)]);
+ rc = p2m_create_table(d, &first[first_table_offset(addr)]);
if ( rc < 0 ) {
printk("p2m_populate_ram: L1 failed\n");
goto out;
@@ -161,7 +163,7 @@ static int create_p2m_entries(struct domain *d,
if ( !second[second_table_offset(addr)].p2m.valid )
{
- rc = p2m_create_entry(d, &second[second_table_offset(addr)]);
+ rc = p2m_create_table(d, &second[second_table_offset(addr)]);
if ( rc < 0 ) {
printk("p2m_populate_ram: L2 failed\n");
goto out;
@@ -200,11 +202,11 @@ static int create_p2m_entries(struct domain *d,
goto out;
}
- pte = mfn_to_p2m_entry(page_to_mfn(page));
+ pte = mfn_to_p2m_entry(page_to_mfn(page), mattr);
write_pte(&third[third_table_offset(addr)], pte);
} else {
- lpae_t pte = mfn_to_p2m_entry(maddr >> PAGE_SHIFT);
+ lpae_t pte = mfn_to_p2m_entry(maddr >> PAGE_SHIFT, mattr);
write_pte(&third[third_table_offset(addr)], pte);
maddr += PAGE_SIZE;
}
@@ -226,7 +228,7 @@ int p2m_populate_ram(struct domain *d,
paddr_t start,
paddr_t end)
{
- return create_p2m_entries(d, 1, start, end, 0);
+ return create_p2m_entries(d, 1, start, end, 0, MATTR_MEM);
}
int map_mmio_regions(struct domain *d,
@@ -234,7 +236,7 @@ int map_mmio_regions(struct domain *d,
paddr_t end_gaddr,
paddr_t maddr)
{
- return create_p2m_entries(d, 0, start_gaddr, end_gaddr, maddr);
+ return create_p2m_entries(d, 0, start_gaddr, end_gaddr, maddr, MATTR_DEV);
}
int guest_physmap_add_page(struct domain *d,
@@ -244,7 +246,7 @@ int guest_physmap_add_page(struct domain *d,
{
return create_p2m_entries(d, 0, gpfn << PAGE_SHIFT,
(gpfn + (1<<page_order)) << PAGE_SHIFT,
- mfn << PAGE_SHIFT);
+ mfn << PAGE_SHIFT, MATTR_MEM);
}
void guest_physmap_remove_page(struct domain *d,
diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h
index 4c3fd0d..2b6c1780 100644
--- a/xen/include/asm-arm/page.h
+++ b/xen/include/asm-arm/page.h
@@ -36,6 +36,14 @@
#define MAIR0VAL 0xeeaa4400
#define MAIR1VAL 0xff000004
+/*
+ * Attribute Indexes.
+ *
+ * These are valid in the AttrIndx[2:0] field of an LPAE stage 1 page
+ * table entry. They are indexes into the bytes of the MAIR*
+ * registers, as defined above.
+ *
+ */
#define UNCACHED 0x0
#define BUFFERABLE 0x1
#define WRITETHROUGH 0x2
@@ -46,6 +54,15 @@
#define DEV_WC BUFFERABLE
#define DEV_CACHED WRITEBACK
+/*
+ * Stage 2 Memory Type.
+ *
+ * These are valid in the MemAttr[3:0] field of an LPAE stage 2 page
+ * table entry.
+ *
+ */
+#define MATTR_DEV 0x1
+#define MATTR_MEM 0xf
#ifndef __ASSEMBLY__
@@ -187,7 +204,7 @@ static inline lpae_t mfn_to_xen_entry(unsigned long mfn)
return e;
}
-static inline lpae_t mfn_to_p2m_entry(unsigned long mfn)
+static inline lpae_t mfn_to_p2m_entry(unsigned long mfn, unsigned int mattr)
{
paddr_t pa = ((paddr_t) mfn) << PAGE_SHIFT;
lpae_t e = (lpae_t) {
@@ -196,7 +213,7 @@ static inline lpae_t mfn_to_p2m_entry(unsigned long mfn)
.p2m.sh = LPAE_SH_OUTER,
.p2m.write = 1,
.p2m.read = 1,
- .p2m.mattr = 0xf,
+ .p2m.mattr = mattr,
.p2m.table = 1,
.p2m.valid = 1,
};
--
1.7.9.1
next prev parent reply other threads:[~2012-06-28 14:47 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 ` Ian Campbell [this message]
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 ` [PATCH 16/21] HACK: arm: initial XENMAPSPACE_gmfn_foreign Ian Campbell
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-1-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).