xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
To: xen-devel@lists.xen.org
Cc: edgar.iglesias@xilinx.com, julien.grall@arm.com, sstabellini@kernel.org
Subject: [PATCH v4 3/7] xen/arm: Rename and generalize un/map_regions_rw_cache
Date: Fri, 23 Sep 2016 20:53:18 +0200	[thread overview]
Message-ID: <1474656802-24081-4-git-send-email-edgar.iglesias@gmail.com> (raw)
In-Reply-To: <1474656802-24081-1-git-send-email-edgar.iglesias@gmail.com>

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

Rename and generalize un/map_regions_rw_cache into
un/map_regions_p2mt. The new functions take the mapping
attributes as an argument.

No functional change.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
---
 xen/arch/arm/domain_build.c | 18 ++++++++++--------
 xen/arch/arm/p2m.c          | 19 ++++++++++---------
 xen/include/asm-arm/p2m.h   | 23 ++++++++++++++---------
 3 files changed, 34 insertions(+), 26 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 35ab08d..f022342 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -1518,10 +1518,11 @@ static void acpi_map_other_tables(struct domain *d)
     {
         addr = acpi_gbl_root_table_list.tables[i].address;
         size = acpi_gbl_root_table_list.tables[i].length;
-        res = map_regions_rw_cache(d,
-                                   _gfn(paddr_to_pfn(addr)),
-                                   DIV_ROUND_UP(size, PAGE_SIZE),
-                                   _mfn(paddr_to_pfn(addr)));
+        res = map_regions_p2mt(d,
+                               _gfn(paddr_to_pfn(addr)),
+                               DIV_ROUND_UP(size, PAGE_SIZE),
+                               _mfn(paddr_to_pfn(addr)),
+                               p2m_mmio_direct_c);
         if ( res )
         {
              panic(XENLOG_ERR "Unable to map ACPI region 0x%"PRIx64
@@ -1874,10 +1875,11 @@ static int prepare_acpi(struct domain *d, struct kernel_info *kinfo)
     acpi_create_efi_mmap_table(d, &kinfo->mem, tbl_add);
 
     /* Map the EFI and ACPI tables to Dom0 */
-    rc = map_regions_rw_cache(d,
-                              _gfn(paddr_to_pfn(d->arch.efi_acpi_gpa)),
-                              PFN_UP(d->arch.efi_acpi_len),
-                              _mfn(paddr_to_pfn(virt_to_maddr(d->arch.efi_acpi_table))));
+    rc = map_regions_p2mt(d,
+                          _gfn(paddr_to_pfn(d->arch.efi_acpi_gpa)),
+                          PFN_UP(d->arch.efi_acpi_len),
+                          _mfn(paddr_to_pfn(virt_to_maddr(d->arch.efi_acpi_table))),
+                          p2m_mmio_direct_c);
     if ( rc != 0 )
     {
         printk(XENLOG_ERR "Unable to map EFI/ACPI table 0x%"PRIx64
diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 9912658..8e7eb68 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -1235,18 +1235,19 @@ static inline int p2m_remove_mapping(struct domain *d,
                              0, p2m_invalid, d->arch.p2m.default_access);
 }
 
-int map_regions_rw_cache(struct domain *d,
-                         gfn_t gfn,
-                         unsigned long nr,
-                         mfn_t mfn)
+int map_regions_p2mt(struct domain *d,
+                     gfn_t gfn,
+                     unsigned long nr,
+                     mfn_t mfn,
+                     p2m_type_t p2mt)
 {
-    return p2m_insert_mapping(d, gfn, nr, mfn, p2m_mmio_direct_c);
+    return p2m_insert_mapping(d, gfn, nr, mfn, p2mt);
 }
 
-int unmap_regions_rw_cache(struct domain *d,
-                           gfn_t gfn,
-                           unsigned long nr,
-                           mfn_t mfn)
+int unmap_regions_p2mt(struct domain *d,
+                       gfn_t gfn,
+                       unsigned long nr,
+                       mfn_t mfn)
 {
     return p2m_remove_mapping(d, gfn, nr, mfn);
 }
diff --git a/xen/include/asm-arm/p2m.h b/xen/include/asm-arm/p2m.h
index 9708fdc..a684ed0 100644
--- a/xen/include/asm-arm/p2m.h
+++ b/xen/include/asm-arm/p2m.h
@@ -167,15 +167,20 @@ mfn_t p2m_lookup(struct domain *d, gfn_t gfn, p2m_type_t *t);
 /* Clean & invalidate caches corresponding to a region of guest address space */
 int p2m_cache_flush(struct domain *d, gfn_t start, unsigned long nr);
 
-int map_regions_rw_cache(struct domain *d,
-                         gfn_t gfn,
-                         unsigned long nr,
-                         mfn_t mfn);
-
-int unmap_regions_rw_cache(struct domain *d,
-                           gfn_t gfn,
-                           unsigned long nr,
-                           mfn_t mfn);
+/*
+ * Map a region in the guest p2m with a specific p2m type.
+ * The memory attributes will be derived from the p2m type.
+ */
+int map_regions_p2mt(struct domain *d,
+                     gfn_t gfn,
+                     unsigned long nr,
+                     mfn_t mfn,
+                     p2m_type_t p2mt);
+
+int unmap_regions_p2mt(struct domain *d,
+                       gfn_t gfn,
+                       unsigned long nr,
+                       mfn_t mfn);
 
 int map_dev_mmio_region(struct domain *d,
                         gfn_t gfn,
-- 
2.7.4


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

  parent reply	other threads:[~2016-09-23 18:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-23 18:53 [PATCH v4 0/7] xen/arm: Add support for mapping mmio-sram nodes into dom0 Edgar E. Iglesias
2016-09-23 18:53 ` [PATCH v4 1/7] xen/arm: p2m: Rename p2m_mmio_direct_nc -> p2m_mmio_direct_dev Edgar E. Iglesias
2016-09-27 23:25   ` Julien Grall
2016-09-23 18:53 ` [PATCH v4 2/7] xen/arm: p2m: Add support for normal non-cacheable memory Edgar E. Iglesias
2016-09-27 23:37   ` Julien Grall
2016-09-23 18:53 ` Edgar E. Iglesias [this message]
2016-09-27 23:45   ` [PATCH v4 3/7] xen/arm: Rename and generalize un/map_regions_rw_cache Julien Grall
2016-09-23 18:53 ` [PATCH v4 4/7] xen/device-tree: Add __DT_MATCH macros without braces Edgar E. Iglesias
2016-09-23 18:53 ` [PATCH v4 5/7] xen/device-tree: Make dt_match_node match props Edgar E. Iglesias
2016-09-23 18:53 ` [PATCH v4 6/7] xen/arm: domain_build: Plumb for different mapping attributes Edgar E. Iglesias
2016-09-23 18:53 ` [PATCH v4 7/7] xen/arm: Map mmio-sram nodes as un-cached memory Edgar E. Iglesias
2016-09-27 23:52   ` Julien Grall
2016-09-28  1:31 ` [PATCH v4 0/7] xen/arm: Add support for mapping mmio-sram nodes into dom0 Stefano Stabellini

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=1474656802-24081-4-git-send-email-edgar.iglesias@gmail.com \
    --to=edgar.iglesias@gmail.com \
    --cc=edgar.iglesias@xilinx.com \
    --cc=julien.grall@arm.com \
    --cc=sstabellini@kernel.org \
    --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).