* [PATCH v3 0/3] xen/arm: Relax hw domain mapping attributes to p2m_mmio_direct_c
@ 2017-01-31 22:17 Edgar E. Iglesias
2017-01-31 22:17 ` [PATCH v3 1/3] xen/arm: dt: " Edgar E. Iglesias
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Edgar E. Iglesias @ 2017-01-31 22:17 UTC (permalink / raw)
To: xen-devel; +Cc: edgar.iglesias, julien.grall, sstabellini
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
This relaxes the hw domains S2 mapping attributes to p2m_mmio_direct_c.
Eventually, I think we should allow guests to execute code from on chip
memories. We could follow-up with a patch that allows execution for
p2m_mmio_direct_c and p2m_mmio_direct_nc. Does that sound OK?
Cheers,
Edgar
ChangeLog:
v2 -> v3:
* Add rationale and SoB line to commit message of patch #2
v1 -> v2:
* Fixed typo in commit message
* Add rationale in commit message
* Keep p2m attributes plumbing
* Add relaxation of attributes for ACPI hw domains
Edgar E. Iglesias (3):
xen/arm: dt: Relax hw domain mapping attributes to p2m_mmio_direct_c
Revert "xen/arm: Map mmio-sram nodes as un-cached memory"
xen/arm: acpi: Relax hw domain mapping attributes to p2m_mmio_direct_c
xen/arch/arm/domain_build.c | 32 +-------------------------------
xen/arch/arm/p2m.c | 2 +-
xen/include/public/memory.h | 6 +++---
3 files changed, 5 insertions(+), 35 deletions(-)
--
2.7.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v3 1/3] xen/arm: dt: Relax hw domain mapping attributes to p2m_mmio_direct_c
2017-01-31 22:17 [PATCH v3 0/3] xen/arm: Relax hw domain mapping attributes to p2m_mmio_direct_c Edgar E. Iglesias
@ 2017-01-31 22:17 ` Edgar E. Iglesias
2017-01-31 22:17 ` [PATCH v3 2/3] Revert "xen/arm: Map mmio-sram nodes as un-cached memory" Edgar E. Iglesias
2017-01-31 22:18 ` [PATCH v3 3/3] xen/arm: acpi: Relax hw domain mapping attributes to p2m_mmio_direct_c Edgar E. Iglesias
2 siblings, 0 replies; 4+ messages in thread
From: Edgar E. Iglesias @ 2017-01-31 22:17 UTC (permalink / raw)
To: xen-devel; +Cc: edgar.iglesias, julien.grall, sstabellini
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
Since the hardware domain is a trusted domain, we extend the
trust to include making final decisions on what attributes to
use when mapping memory regions.
For device-tree configured hardware domains, this patch relaxes
the hardware domains mapping attributes to p2m_mmio_direct_c.
This will allow the hardware domain to control the attributes
via its S1 mappings.
Reviewed-by: Julien Grall <julien.grall@arm.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
---
xen/arch/arm/domain_build.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 63301e6..4fc467c 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -1330,7 +1330,7 @@ static int handle_node(struct domain *d, struct kernel_info *kinfo,
static int prepare_dtb(struct domain *d, struct kernel_info *kinfo)
{
- const p2m_type_t default_p2mt = p2m_mmio_direct_dev;
+ const p2m_type_t default_p2mt = p2m_mmio_direct_c;
const void *fdt;
int new_size;
int ret;
--
2.7.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v3 2/3] Revert "xen/arm: Map mmio-sram nodes as un-cached memory"
2017-01-31 22:17 [PATCH v3 0/3] xen/arm: Relax hw domain mapping attributes to p2m_mmio_direct_c Edgar E. Iglesias
2017-01-31 22:17 ` [PATCH v3 1/3] xen/arm: dt: " Edgar E. Iglesias
@ 2017-01-31 22:17 ` Edgar E. Iglesias
2017-01-31 22:18 ` [PATCH v3 3/3] xen/arm: acpi: Relax hw domain mapping attributes to p2m_mmio_direct_c Edgar E. Iglesias
2 siblings, 0 replies; 4+ messages in thread
From: Edgar E. Iglesias @ 2017-01-31 22:17 UTC (permalink / raw)
To: xen-devel; +Cc: edgar.iglesias, julien.grall, sstabellini
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
This reverts commit 1e75ed8b64bc1a9b47e540e6f100f17ec6d97f1b.
The default attribute mappings for MMIO have been relaxed, we now rely
on the hardware domain to set correct memory attributes.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
---
xen/arch/arm/domain_build.c | 30 ------------------------------
1 file changed, 30 deletions(-)
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 4fc467c..c97a1f5 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -48,20 +48,6 @@ struct map_range_data
p2m_type_t p2mt;
};
-static const struct dt_device_match dev_map_attrs[] __initconst =
-{
- {
- __DT_MATCH_COMPATIBLE("mmio-sram"),
- __DT_MATCH_PROP("no-memory-wc"),
- .data = (void *) (uintptr_t) p2m_mmio_direct_dev,
- },
- {
- __DT_MATCH_COMPATIBLE("mmio-sram"),
- .data = (void *) (uintptr_t) p2m_mmio_direct_nc,
- },
- { /* sentinel */ },
-};
-
//#define DEBUG_11_ALLOCATION
#ifdef DEBUG_11_ALLOCATION
# define D11PRINT(fmt, args...) printk(XENLOG_DEBUG fmt, ##args)
@@ -1170,21 +1156,6 @@ static int handle_device(struct domain *d, struct dt_device_node *dev,
return 0;
}
-static p2m_type_t lookup_map_attr(struct dt_device_node *node,
- p2m_type_t parent_p2mt)
-{
- const struct dt_device_match *r;
-
- /* Search and if nothing matches, use the parent's attributes. */
- r = dt_match_node(dev_map_attrs, node);
-
- /*
- * If this node does not dictate specific mapping attributes,
- * it inherits its parent's attributes.
- */
- return r ? (uintptr_t) r->data : parent_p2mt;
-}
-
static int handle_node(struct domain *d, struct kernel_info *kinfo,
struct dt_device_node *node,
p2m_type_t p2mt)
@@ -1275,7 +1246,6 @@ static int handle_node(struct domain *d, struct kernel_info *kinfo,
"WARNING: Path %s is reserved, skip the node as we may re-use the path.\n",
path);
- p2mt = lookup_map_attr(node, p2mt);
res = handle_device(d, node, p2mt);
if ( res)
return res;
--
2.7.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v3 3/3] xen/arm: acpi: Relax hw domain mapping attributes to p2m_mmio_direct_c
2017-01-31 22:17 [PATCH v3 0/3] xen/arm: Relax hw domain mapping attributes to p2m_mmio_direct_c Edgar E. Iglesias
2017-01-31 22:17 ` [PATCH v3 1/3] xen/arm: dt: " Edgar E. Iglesias
2017-01-31 22:17 ` [PATCH v3 2/3] Revert "xen/arm: Map mmio-sram nodes as un-cached memory" Edgar E. Iglesias
@ 2017-01-31 22:18 ` Edgar E. Iglesias
2 siblings, 0 replies; 4+ messages in thread
From: Edgar E. Iglesias @ 2017-01-31 22:18 UTC (permalink / raw)
To: xen-devel; +Cc: edgar.iglesias, julien.grall, sstabellini
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
Since the hardware domain is a trusted domain, we extend the
trust to include making final decisions on what attributes to
use when mapping memory regions.
For ACPI configured hardware domains, this patch relaxes the hardware
domains mapping attributes to p2m_mmio_direct_c. This will allow the
hardware domain to control the attributes via its S1 mappings.
Acked-by: Julien Grall <julien.grall@arm.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
---
xen/arch/arm/p2m.c | 2 +-
xen/include/public/memory.h | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 09ceb37..cb5a45d 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -1185,7 +1185,7 @@ int map_dev_mmio_region(struct domain *d,
if ( !(nr && iomem_access_permitted(d, mfn_x(mfn), mfn_x(mfn) + nr - 1)) )
return 0;
- res = map_mmio_regions(d, gfn, nr, mfn);
+ res = p2m_insert_mapping(d, gfn, nr, mfn, p2m_mmio_direct_c);
if ( res < 0 )
{
printk(XENLOG_G_ERR "Unable to map MFNs [%#"PRI_mfn" - %#"PRI_mfn" in Dom%d\n",
diff --git a/xen/include/public/memory.h b/xen/include/public/memory.h
index e633047..6eee0c8 100644
--- a/xen/include/public/memory.h
+++ b/xen/include/public/memory.h
@@ -222,9 +222,9 @@ DEFINE_XEN_GUEST_HANDLE(xen_machphys_mapping_t);
* XENMEM_add_to_physmap_batch only. */
#define XENMAPSPACE_dev_mmio 5 /* device mmio region
ARM only; the region is mapped in
- Stage-2 using the memory attribute
- "Device-nGnRE" (previously named
- "Device" on ARMv7) */
+ Stage-2 using the Normal Memory
+ Inner/Outer Write-Back Cacheable
+ memory attribute. */
/* ` } */
/*
--
2.7.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-01-31 22:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-31 22:17 [PATCH v3 0/3] xen/arm: Relax hw domain mapping attributes to p2m_mmio_direct_c Edgar E. Iglesias
2017-01-31 22:17 ` [PATCH v3 1/3] xen/arm: dt: " Edgar E. Iglesias
2017-01-31 22:17 ` [PATCH v3 2/3] Revert "xen/arm: Map mmio-sram nodes as un-cached memory" Edgar E. Iglesias
2017-01-31 22:18 ` [PATCH v3 3/3] xen/arm: acpi: Relax hw domain mapping attributes to p2m_mmio_direct_c Edgar E. Iglesias
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).