diff mbox

[2/3] x86/mm: Replace opencoded forms of map_l?t_from_l?e()

Message ID 1503580497-22936-3-git-send-email-andrew.cooper3@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andrew Cooper Aug. 24, 2017, 1:14 p.m. UTC
No functional change (confirmed by diffing the disassembly).

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Wei Liu <wei.liu2@citrix.com>
CC: Tim Deegan <tim@xen.org>
CC: George Dunlap <george.dunlap@eu.citrix.com>
---
 xen/arch/x86/mm.c            | 8 ++++----
 xen/arch/x86/mm/p2m-pt.c     | 6 +++---
 xen/arch/x86/pv/dom0_build.c | 6 +++---
 3 files changed, 10 insertions(+), 10 deletions(-)

Comments

Jan Beulich Aug. 24, 2017, 1:28 p.m. UTC | #1
>>> On 24.08.17 at 15:14, <andrew.cooper3@citrix.com> wrote:
> No functional change (confirmed by diffing the disassembly).
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>
Wei Liu Aug. 24, 2017, 2:19 p.m. UTC | #2
On Thu, Aug 24, 2017 at 02:14:56PM +0100, Andrew Cooper wrote:
> No functional change (confirmed by diffing the disassembly).
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Wei Liu <wei.liu2@citrix.com>
George Dunlap Aug. 25, 2017, 2:57 p.m. UTC | #3
On 08/24/2017 02:14 PM, Andrew Cooper wrote:
> No functional change (confirmed by diffing the disassembly).
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: George Dunlap <george.dunlap@citrix.com>

> ---
> CC: Jan Beulich <JBeulich@suse.com>
> CC: Wei Liu <wei.liu2@citrix.com>
> CC: Tim Deegan <tim@xen.org>
> CC: George Dunlap <george.dunlap@eu.citrix.com>
> ---
>  xen/arch/x86/mm.c            | 8 ++++----
>  xen/arch/x86/mm/p2m-pt.c     | 6 +++---
>  xen/arch/x86/pv/dom0_build.c | 6 +++---
>  3 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
> index e6b7829..1e0ae2f 100644
> --- a/xen/arch/x86/mm.c
> +++ b/xen/arch/x86/mm.c
> @@ -6131,7 +6131,7 @@ int create_perdomain_mapping(struct domain *d, unsigned long va,
>          l3tab[l3_table_offset(va)] = l3e_from_page(pg, __PAGE_HYPERVISOR_RW);
>      }
>      else
> -        l2tab = map_domain_page(_mfn(l3e_get_pfn(l3tab[l3_table_offset(va)])));
> +        l2tab = map_l2t_from_l3e(l3tab[l3_table_offset(va)]);
>  
>      unmap_domain_page(l3tab);
>  
> @@ -6173,7 +6173,7 @@ int create_perdomain_mapping(struct domain *d, unsigned long va,
>              *pl2e = l2e_from_page(pg, __PAGE_HYPERVISOR_RW);
>          }
>          else if ( !l1tab )
> -            l1tab = map_domain_page(_mfn(l2e_get_pfn(*pl2e)));
> +            l1tab = map_l1t_from_l2e(*pl2e);
>  
>          if ( ppg &&
>               !(l1e_get_flags(l1tab[l1_table_offset(va)]) & _PAGE_PRESENT) )
> @@ -6224,7 +6224,7 @@ void destroy_perdomain_mapping(struct domain *d, unsigned long va,
>  
>      if ( l3e_get_flags(*pl3e) & _PAGE_PRESENT )
>      {
> -        const l2_pgentry_t *l2tab = map_domain_page(_mfn(l3e_get_pfn(*pl3e)));
> +        const l2_pgentry_t *l2tab = map_l2t_from_l3e(*pl3e);
>          const l2_pgentry_t *pl2e = l2tab + l2_table_offset(va);
>          unsigned int i = l1_table_offset(va);
>  
> @@ -6232,7 +6232,7 @@ void destroy_perdomain_mapping(struct domain *d, unsigned long va,
>          {
>              if ( l2e_get_flags(*pl2e) & _PAGE_PRESENT )
>              {
> -                l1_pgentry_t *l1tab = map_domain_page(_mfn(l2e_get_pfn(*pl2e)));
> +                l1_pgentry_t *l1tab = map_l1t_from_l2e(*pl2e);
>  
>                  for ( ; nr && i < L1_PAGETABLE_ENTRIES; --nr, ++i )
>                  {
> diff --git a/xen/arch/x86/mm/p2m-pt.c b/xen/arch/x86/mm/p2m-pt.c
> index 628a53e..f0d8076 100644
> --- a/xen/arch/x86/mm/p2m-pt.c
> +++ b/xen/arch/x86/mm/p2m-pt.c
> @@ -1026,7 +1026,7 @@ long p2m_pt_audit_p2m(struct p2m_domain *p2m)
>                  gfn += 1 << (L4_PAGETABLE_SHIFT - PAGE_SHIFT);
>                  continue;
>              }
> -            l3e = map_domain_page(_mfn(l4e_get_pfn(l4e[i4])));
> +            l3e = map_l3t_from_l4e(l4e[i4]);
>              for ( i3 = 0;
>                    i3 < L3_PAGETABLE_ENTRIES;
>                    i3++ )
> @@ -1061,7 +1061,7 @@ long p2m_pt_audit_p2m(struct p2m_domain *p2m)
>                      }
>                  }
>  
> -                l2e = map_domain_page(_mfn(l3e_get_pfn(l3e[i3])));
> +                l2e = map_l2t_from_l3e(l3e[i3]);
>                  for ( i2 = 0; i2 < L2_PAGETABLE_ENTRIES; i2++ )
>                  {
>                      if ( !(l2e_get_flags(l2e[i2]) & _PAGE_PRESENT) )
> @@ -1097,7 +1097,7 @@ long p2m_pt_audit_p2m(struct p2m_domain *p2m)
>                          continue;
>                      }
>  
> -                    l1e = map_domain_page(_mfn(l2e_get_pfn(l2e[i2])));
> +                    l1e = map_l1t_from_l2e(l2e[i2]);
>  
>                      for ( i1 = 0; i1 < L1_PAGETABLE_ENTRIES; i1++, gfn++ )
>                      {
> diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
> index e67ffdd..ec7f96d 100644
> --- a/xen/arch/x86/pv/dom0_build.c
> +++ b/xen/arch/x86/pv/dom0_build.c
> @@ -142,7 +142,7 @@ static __init void setup_pv_physmap(struct domain *d, unsigned long pgtbl_pfn,
>              clear_page(pl3e);
>              *pl4e = l4e_from_page(page, L4_PROT);
>          } else
> -            pl3e = map_domain_page(_mfn(l4e_get_pfn(*pl4e)));
> +            pl3e = map_l3t_from_l4e(*pl4e);
>  
>          pl3e += l3_table_offset(vphysmap_start);
>          if ( !l3e_get_intpte(*pl3e) )
> @@ -169,7 +169,7 @@ static __init void setup_pv_physmap(struct domain *d, unsigned long pgtbl_pfn,
>              *pl3e = l3e_from_page(page, L3_PROT);
>          }
>          else
> -            pl2e = map_domain_page(_mfn(l3e_get_pfn(*pl3e)));
> +            pl2e = map_l2t_from_l3e(*pl3e);
>  
>          pl2e += l2_table_offset(vphysmap_start);
>          if ( !l2e_get_intpte(*pl2e) )
> @@ -195,7 +195,7 @@ static __init void setup_pv_physmap(struct domain *d, unsigned long pgtbl_pfn,
>              *pl2e = l2e_from_page(page, L2_PROT);
>          }
>          else
> -            pl1e = map_domain_page(_mfn(l2e_get_pfn(*pl2e)));
> +            pl1e = map_l1t_from_l2e(*pl2e);
>  
>          pl1e += l1_table_offset(vphysmap_start);
>          BUG_ON(l1e_get_intpte(*pl1e));
>
diff mbox

Patch

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index e6b7829..1e0ae2f 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -6131,7 +6131,7 @@  int create_perdomain_mapping(struct domain *d, unsigned long va,
         l3tab[l3_table_offset(va)] = l3e_from_page(pg, __PAGE_HYPERVISOR_RW);
     }
     else
-        l2tab = map_domain_page(_mfn(l3e_get_pfn(l3tab[l3_table_offset(va)])));
+        l2tab = map_l2t_from_l3e(l3tab[l3_table_offset(va)]);
 
     unmap_domain_page(l3tab);
 
@@ -6173,7 +6173,7 @@  int create_perdomain_mapping(struct domain *d, unsigned long va,
             *pl2e = l2e_from_page(pg, __PAGE_HYPERVISOR_RW);
         }
         else if ( !l1tab )
-            l1tab = map_domain_page(_mfn(l2e_get_pfn(*pl2e)));
+            l1tab = map_l1t_from_l2e(*pl2e);
 
         if ( ppg &&
              !(l1e_get_flags(l1tab[l1_table_offset(va)]) & _PAGE_PRESENT) )
@@ -6224,7 +6224,7 @@  void destroy_perdomain_mapping(struct domain *d, unsigned long va,
 
     if ( l3e_get_flags(*pl3e) & _PAGE_PRESENT )
     {
-        const l2_pgentry_t *l2tab = map_domain_page(_mfn(l3e_get_pfn(*pl3e)));
+        const l2_pgentry_t *l2tab = map_l2t_from_l3e(*pl3e);
         const l2_pgentry_t *pl2e = l2tab + l2_table_offset(va);
         unsigned int i = l1_table_offset(va);
 
@@ -6232,7 +6232,7 @@  void destroy_perdomain_mapping(struct domain *d, unsigned long va,
         {
             if ( l2e_get_flags(*pl2e) & _PAGE_PRESENT )
             {
-                l1_pgentry_t *l1tab = map_domain_page(_mfn(l2e_get_pfn(*pl2e)));
+                l1_pgentry_t *l1tab = map_l1t_from_l2e(*pl2e);
 
                 for ( ; nr && i < L1_PAGETABLE_ENTRIES; --nr, ++i )
                 {
diff --git a/xen/arch/x86/mm/p2m-pt.c b/xen/arch/x86/mm/p2m-pt.c
index 628a53e..f0d8076 100644
--- a/xen/arch/x86/mm/p2m-pt.c
+++ b/xen/arch/x86/mm/p2m-pt.c
@@ -1026,7 +1026,7 @@  long p2m_pt_audit_p2m(struct p2m_domain *p2m)
                 gfn += 1 << (L4_PAGETABLE_SHIFT - PAGE_SHIFT);
                 continue;
             }
-            l3e = map_domain_page(_mfn(l4e_get_pfn(l4e[i4])));
+            l3e = map_l3t_from_l4e(l4e[i4]);
             for ( i3 = 0;
                   i3 < L3_PAGETABLE_ENTRIES;
                   i3++ )
@@ -1061,7 +1061,7 @@  long p2m_pt_audit_p2m(struct p2m_domain *p2m)
                     }
                 }
 
-                l2e = map_domain_page(_mfn(l3e_get_pfn(l3e[i3])));
+                l2e = map_l2t_from_l3e(l3e[i3]);
                 for ( i2 = 0; i2 < L2_PAGETABLE_ENTRIES; i2++ )
                 {
                     if ( !(l2e_get_flags(l2e[i2]) & _PAGE_PRESENT) )
@@ -1097,7 +1097,7 @@  long p2m_pt_audit_p2m(struct p2m_domain *p2m)
                         continue;
                     }
 
-                    l1e = map_domain_page(_mfn(l2e_get_pfn(l2e[i2])));
+                    l1e = map_l1t_from_l2e(l2e[i2]);
 
                     for ( i1 = 0; i1 < L1_PAGETABLE_ENTRIES; i1++, gfn++ )
                     {
diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index e67ffdd..ec7f96d 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -142,7 +142,7 @@  static __init void setup_pv_physmap(struct domain *d, unsigned long pgtbl_pfn,
             clear_page(pl3e);
             *pl4e = l4e_from_page(page, L4_PROT);
         } else
-            pl3e = map_domain_page(_mfn(l4e_get_pfn(*pl4e)));
+            pl3e = map_l3t_from_l4e(*pl4e);
 
         pl3e += l3_table_offset(vphysmap_start);
         if ( !l3e_get_intpte(*pl3e) )
@@ -169,7 +169,7 @@  static __init void setup_pv_physmap(struct domain *d, unsigned long pgtbl_pfn,
             *pl3e = l3e_from_page(page, L3_PROT);
         }
         else
-            pl2e = map_domain_page(_mfn(l3e_get_pfn(*pl3e)));
+            pl2e = map_l2t_from_l3e(*pl3e);
 
         pl2e += l2_table_offset(vphysmap_start);
         if ( !l2e_get_intpte(*pl2e) )
@@ -195,7 +195,7 @@  static __init void setup_pv_physmap(struct domain *d, unsigned long pgtbl_pfn,
             *pl2e = l2e_from_page(page, L2_PROT);
         }
         else
-            pl1e = map_domain_page(_mfn(l2e_get_pfn(*pl2e)));
+            pl1e = map_l1t_from_l2e(*pl2e);
 
         pl1e += l1_table_offset(vphysmap_start);
         BUG_ON(l1e_get_intpte(*pl1e));