[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v3 2/6] xen/arm: Rename and generalize un/map_regions_rw_cache



On Fri, Sep 16, 2016 at 04:24:17PM +0200, Julien Grall wrote:
> Hi Edgar,
> 
> On 07/09/2016 08:56, Edgar E. Iglesias wrote:
> >From: "Edgar E. Iglesias" <edgar.iglesias@xxxxxxxxxx>
> >
> >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@xxxxxxxxxx>
> >---
> > xen/arch/arm/domain_build.c | 18 ++++++++++--------
> > xen/arch/arm/p2m.c          | 19 ++++++++++---------
> > xen/include/asm-arm/p2m.h   | 19 ++++++++++---------
> > 3 files changed, 30 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 bfef77b..58d4940 100644
> >--- a/xen/arch/arm/p2m.c
> >+++ b/xen/arch/arm/p2m.c
> >@@ -1234,18 +1234,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 b012d50..f2bd16c 100644
> >--- a/xen/include/asm-arm/p2m.h
> >+++ b/xen/include/asm-arm/p2m.h
> >@@ -166,15 +166,16 @@ 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);
> >+int map_regions_p2mt(struct domain *d,
> >+                     gfn_t gfn,
> >+                     unsigned long nr,
> >+                     mfn_t mfn,
> >+                     p2m_type_t p2mt);
> 
> Can you document the purpose of this function in the code? Something like:
> "Map the region in the guest p2m with a specific type (will affect the
> attributes of the region).".

Yes, I've added the following for v4:

/*
 * Map a region in the guest p2m with a specific p2m type.
 * The memory attributes will be derived from the p2m type.
 */

Thanks,
Edgar


> 
> >+
> >+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,
> >
> 
> Regards,
> 
> -- 
> Julien Grall

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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.