xen/arm: Relax hw domain mapping attributes to p2m_mmio_direct_c
v2 cover xen/arm: Relax hw domain mapping attributes to p2m_mmio_direct_c
From: "Edgar E. Iglesias" <[email protected]>
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:
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(-)
Signature · 7 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH v2 1/3 xen/arm: dt: Relax hw domain mapping attributes to p2m_mmio_direct_c
From: "Edgar E. Iglesias" <[email protected]>
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.
--- xen/arch/arm/domain_build.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/domain_build.c +1 -1
@@ -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;
Signature · 7 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [PATCH v2 1/3] xen/arm: dt: Relax hw domain mapping attributes to p2m_mmio_direct_c
Hi Edgar,
Quoted 6 lines · Edgar E. Iglesias
From: "Edgar E. Iglesias" <[email protected]>
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.
Quoted 6 lines
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.Signed-off-by Edgar E. Iglesias <[email protected]>
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH v2 2/3 Revert "xen/arm: Map mmio-sram nodes as un-cached memory"
In reply to Edgar E. IglesiasFrom: "Edgar E. Iglesias" <[email protected]>
This reverts commit 1e75ed8b64bc1a9b47e540e6f100f17ec6d97f1b.
--- xen/arch/arm/domain_build.c | 30 ------------------------------ 1 file changed, 30 deletions(-)
xen/arch/arm/domain_build.c +0 -30
@@ -48,20 +48,6 @@ struct map_range_datap2m_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;
Signature · 7 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [PATCH v2 2/3] Revert "xen/arm: Map mmio-sram nodes as un-cached memory"
Hi Edgar,
Quoted 3 lines · Edgar E. Iglesias
From: "Edgar E. Iglesias" <[email protected]>
This reverts commit
1e75ed8b64bc1a9b47e540e6f100f17ec6d97f1b.
I would add a word explain why it is reverted. Something like: "The default attribute mapping for MMIO as been relaxed and now rely on the hardware domain to set the correct memory attribute".
Also, your signed-off is missing.
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [PATCH v2 2/3] Revert "xen/arm: Map mmio-sram nodes as un-cached memory"
Quoted 5 lines · Julien Grall
Hi Edgar,
Quoted 2 lines · Edgar E. Iglesias
From: "Edgar E. Iglesias" <[email protected]>
Quoted 7 lines
Quoted 1 line
This reverts commit
1e75ed8b64bc1a9b47e540e6f100f17ec6d97f1b.I would add a word explain why it is reverted. Something like: "The default attribute mapping for MMIO as been relaxed and now rely on the hardware domain to set the correct memory attribute".
Also, your signed-off is missing.
Thanks Julien,
I've fixed this and will send out a v3 shortly.
Best regards,
Edgar
Quoted 5 lines
Cheers,
Signature · 1 line
Julien Grall
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH v2 2/3] Revert "xen/arm: Map mmio-sram nodes as un-cached memory"
In reply to Julien GrallQuoted 5 lines · Julien Grall
Hi Edgar,
Quoted 2 lines · Edgar E. Iglesias
From: "Edgar E. Iglesias" <[email protected]>
Quoted 7 lines
Quoted 1 line
This reverts commit
1e75ed8b64bc1a9b47e540e6f100f17ec6d97f1b.I would add a word explain why it is reverted. Something like: "The default attribute mapping for MMIO as been relaxed and now rely on the hardware domain to set the correct memory attribute".
Also, your signed-off is missing.
Assuming Edgar is OK with this, I fixed it up and committed. Edgar, please let me know if it's a problem.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH v2 2/3] Revert "xen/arm: Map mmio-sram nodes as un-cached memory"
Quoted 8 lines · Stefano Stabellini
Quoted 7 lines · Julien Grall
Hi Edgar,
Quoted 3 lines · Edgar E. Iglesias
From: "Edgar E. Iglesias" <[email protected]>
This reverts commit
1e75ed8b64bc1a9b47e540e6f100f17ec6d97f1b.
Quoted 8 lines
Quoted 5 lines
I would add a word explain why it is reverted. Something like: "The default attribute mapping for MMIO as been relaxed and now rely on the hardware domain to set the correct memory attribute".
Also, your signed-off is missing.
Assuming Edgar is OK with this, I fixed it up and committed. Edgar, please let me know if it's a problem.
Ah, thanks!
Our emails crossed paths as I submitted v3 :-)
Feel free to keep the commited version and ignore v3.
Best regards,
Edgar
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
PATCH v2 3/3 xen/arm: acpi: Relax hw domain mapping attributes to p2m_mmio_direct_c
In reply to Edgar E. IglesiasFrom: "Edgar E. Iglesias" <[email protected]>
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.
--- xen/arch/arm/p2m.c | 2 +- xen/include/public/memory.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
xen/arch/arm/p2m.c +1 -1
@@ -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",
xen/include/public/memory.h +3 -3
@@ -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. */ /* ` } */ /*
Signature · 7 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] xen/arm: acpi: Relax hw domain mapping attributes to p2m_mmio_direct_c
Hi Edgar,
Quoted 11 lines · Edgar E. Iglesias
From: "Edgar E. Iglesias" <[email protected]>
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.Signed-off-by Edgar E. Iglesias <[email protected]>
Regards,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel