All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] xen/arm: Relax hw domain mapping attributes to p2m_mmio_direct_c
@ 2017-01-26 13:15 Edgar E. Iglesias
  2017-01-26 13:16 ` [PATCH v2 1/3] xen/arm: dt: " Edgar E. Iglesias
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Edgar E. Iglesias @ 2017-01-26 13:15 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:

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] 10+ messages in thread

* [PATCH v2 1/3] xen/arm: dt: Relax hw domain mapping attributes to p2m_mmio_direct_c
  2017-01-26 13:15 [PATCH v2 0/3] xen/arm: Relax hw domain mapping attributes to p2m_mmio_direct_c Edgar E. Iglesias
@ 2017-01-26 13:16 ` Edgar E. Iglesias
  2017-01-31 16:32   ` Julien Grall
  2017-01-26 13:16 ` [PATCH v2 2/3] Revert "xen/arm: Map mmio-sram nodes as un-cached memory" Edgar E. Iglesias
  2017-01-26 13:16 ` [PATCH v2 3/3] xen/arm: acpi: Relax hw domain mapping attributes to p2m_mmio_direct_c Edgar E. Iglesias
  2 siblings, 1 reply; 10+ messages in thread
From: Edgar E. Iglesias @ 2017-01-26 13:16 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.

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] 10+ messages in thread

* [PATCH v2 2/3] Revert "xen/arm: Map mmio-sram nodes as un-cached memory"
  2017-01-26 13:15 [PATCH v2 0/3] xen/arm: Relax hw domain mapping attributes to p2m_mmio_direct_c Edgar E. Iglesias
  2017-01-26 13:16 ` [PATCH v2 1/3] xen/arm: dt: " Edgar E. Iglesias
@ 2017-01-26 13:16 ` Edgar E. Iglesias
  2017-01-31 16:35   ` Julien Grall
  2017-01-26 13:16 ` [PATCH v2 3/3] xen/arm: acpi: Relax hw domain mapping attributes to p2m_mmio_direct_c Edgar E. Iglesias
  2 siblings, 1 reply; 10+ messages in thread
From: Edgar E. Iglesias @ 2017-01-26 13:16 UTC (permalink / raw)
  To: xen-devel; +Cc: edgar.iglesias, julien.grall, sstabellini

From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>

This reverts commit 1e75ed8b64bc1a9b47e540e6f100f17ec6d97f1b.
---
 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] 10+ messages in thread

* [PATCH v2 3/3] xen/arm: acpi: Relax hw domain mapping attributes to p2m_mmio_direct_c
  2017-01-26 13:15 [PATCH v2 0/3] xen/arm: Relax hw domain mapping attributes to p2m_mmio_direct_c Edgar E. Iglesias
  2017-01-26 13:16 ` [PATCH v2 1/3] xen/arm: dt: " Edgar E. Iglesias
  2017-01-26 13:16 ` [PATCH v2 2/3] Revert "xen/arm: Map mmio-sram nodes as un-cached memory" Edgar E. Iglesias
@ 2017-01-26 13:16 ` Edgar E. Iglesias
  2017-01-31 16:36   ` Julien Grall
  2 siblings, 1 reply; 10+ messages in thread
From: Edgar E. Iglesias @ 2017-01-26 13:16 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.

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] 10+ messages in thread

* Re: [PATCH v2 1/3] xen/arm: dt: Relax hw domain mapping attributes to p2m_mmio_direct_c
  2017-01-26 13:16 ` [PATCH v2 1/3] xen/arm: dt: " Edgar E. Iglesias
@ 2017-01-31 16:32   ` Julien Grall
  0 siblings, 0 replies; 10+ messages in thread
From: Julien Grall @ 2017-01-31 16:32 UTC (permalink / raw)
  To: Edgar E. Iglesias, xen-devel; +Cc: edgar.iglesias, sstabellini

Hi Edgar,

On 26/01/17 13:16, Edgar E. Iglesias wrote:
> 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.
>
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>

Reviewed-by: Julien Grall <julien.grall@arm.com>

Cheers,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 2/3] Revert "xen/arm: Map mmio-sram nodes as un-cached memory"
  2017-01-26 13:16 ` [PATCH v2 2/3] Revert "xen/arm: Map mmio-sram nodes as un-cached memory" Edgar E. Iglesias
@ 2017-01-31 16:35   ` Julien Grall
  2017-01-31 19:15     ` Edgar E. Iglesias
  2017-01-31 22:18     ` Stefano Stabellini
  0 siblings, 2 replies; 10+ messages in thread
From: Julien Grall @ 2017-01-31 16:35 UTC (permalink / raw)
  To: Edgar E. Iglesias, xen-devel; +Cc: edgar.iglesias, sstabellini

Hi Edgar,

On 26/01/17 13:16, Edgar E. Iglesias wrote:
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
>
> 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,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 3/3] xen/arm: acpi: Relax hw domain mapping attributes to p2m_mmio_direct_c
  2017-01-26 13:16 ` [PATCH v2 3/3] xen/arm: acpi: Relax hw domain mapping attributes to p2m_mmio_direct_c Edgar E. Iglesias
@ 2017-01-31 16:36   ` Julien Grall
  0 siblings, 0 replies; 10+ messages in thread
From: Julien Grall @ 2017-01-31 16:36 UTC (permalink / raw)
  To: Edgar E. Iglesias, xen-devel; +Cc: edgar.iglesias, sstabellini

Hi Edgar,

On 26/01/17 13:16, Edgar E. Iglesias wrote:
> 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.
>
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>

Acked-by: Julien Grall <julien.grall@arm.com>

Regards,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 2/3] Revert "xen/arm: Map mmio-sram nodes as un-cached memory"
  2017-01-31 16:35   ` Julien Grall
@ 2017-01-31 19:15     ` Edgar E. Iglesias
  2017-01-31 22:18     ` Stefano Stabellini
  1 sibling, 0 replies; 10+ messages in thread
From: Edgar E. Iglesias @ 2017-01-31 19:15 UTC (permalink / raw)
  To: Julien Grall; +Cc: edgar.iglesias, sstabellini, xen-devel

On Tue, Jan 31, 2017 at 04:35:09PM +0000, Julien Grall wrote:
> Hi Edgar,
> 
> On 26/01/17 13:16, Edgar E. Iglesias wrote:
> >From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
> >
> >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


> 
> Cheers,
> 
> -- 
> Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 2/3] Revert "xen/arm: Map mmio-sram nodes as un-cached memory"
  2017-01-31 16:35   ` Julien Grall
  2017-01-31 19:15     ` Edgar E. Iglesias
@ 2017-01-31 22:18     ` Stefano Stabellini
  2017-01-31 22:20       ` Edgar E. Iglesias
  1 sibling, 1 reply; 10+ messages in thread
From: Stefano Stabellini @ 2017-01-31 22:18 UTC (permalink / raw)
  To: Julien Grall; +Cc: edgar.iglesias, Edgar E. Iglesias, sstabellini, xen-devel

On Tue, 31 Jan 2017, Julien Grall wrote:
> Hi Edgar,
> 
> On 26/01/17 13:16, Edgar E. Iglesias wrote:
> > From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
> > 
> > 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
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 2/3] Revert "xen/arm: Map mmio-sram nodes as un-cached memory"
  2017-01-31 22:18     ` Stefano Stabellini
@ 2017-01-31 22:20       ` Edgar E. Iglesias
  0 siblings, 0 replies; 10+ messages in thread
From: Edgar E. Iglesias @ 2017-01-31 22:20 UTC (permalink / raw)
  To: Stefano Stabellini; +Cc: Edgar E. Iglesias, Julien Grall, xen-devel

On Tue, Jan 31, 2017 at 02:18:40PM -0800, Stefano Stabellini wrote:
> On Tue, 31 Jan 2017, Julien Grall wrote:
> > Hi Edgar,
> > 
> > On 26/01/17 13:16, Edgar E. Iglesias wrote:
> > > From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
> > > 
> > > 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.

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
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-01-31 22:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-26 13:15 [PATCH v2 0/3] xen/arm: Relax hw domain mapping attributes to p2m_mmio_direct_c Edgar E. Iglesias
2017-01-26 13:16 ` [PATCH v2 1/3] xen/arm: dt: " Edgar E. Iglesias
2017-01-31 16:32   ` Julien Grall
2017-01-26 13:16 ` [PATCH v2 2/3] Revert "xen/arm: Map mmio-sram nodes as un-cached memory" Edgar E. Iglesias
2017-01-31 16:35   ` Julien Grall
2017-01-31 19:15     ` Edgar E. Iglesias
2017-01-31 22:18     ` Stefano Stabellini
2017-01-31 22:20       ` Edgar E. Iglesias
2017-01-26 13:16 ` [PATCH v2 3/3] xen/arm: acpi: Relax hw domain mapping attributes to p2m_mmio_direct_c Edgar E. Iglesias
2017-01-31 16:36   ` Julien Grall

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.