diff mbox

x86: drop (mostly) unused guest_lNe_get_paddr()

Message ID 5767EA0002000078000F69D7@prv-mh.provo.novell.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Beulich June 20, 2016, 11:05 a.m. UTC
The very few remaining uses don't make their presence really necessary:
Simplify the two L2 ones, and open code the sole common code use.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
x86: drop (mostly) unused guest_lNe_get_paddr()

The very few remaining uses don't make their presence really necessary:
Simplify the two L2 ones, and open code the sole common code use.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/include/asm-x86/guest_pt.h
+++ b/xen/include/asm-x86/guest_pt.h
@@ -66,15 +66,10 @@ typedef struct { guest_intpte_t l2; } gu
 
 #define PRI_gpte "08x"
 
-static inline paddr_t guest_l1e_get_paddr(guest_l1e_t gl1e)
-{ return ((paddr_t) gl1e.l1) & (PADDR_MASK & PAGE_MASK); }
-static inline paddr_t guest_l2e_get_paddr(guest_l2e_t gl2e)
-{ return ((paddr_t) gl2e.l2) & (PADDR_MASK & PAGE_MASK); }
-
 static inline gfn_t guest_l1e_get_gfn(guest_l1e_t gl1e)
-{ return _gfn(guest_l1e_get_paddr(gl1e) >> PAGE_SHIFT); }
+{ return _gfn(gl1e.l1 >> PAGE_SHIFT); }
 static inline gfn_t guest_l2e_get_gfn(guest_l2e_t gl2e)
-{ return _gfn(guest_l2e_get_paddr(gl2e) >> PAGE_SHIFT); }
+{ return _gfn(gl2e.l2 >> PAGE_SHIFT); }
 
 static inline u32 guest_l1e_get_flags(guest_l1e_t gl1e)
 { return gl1e.l1 & 0xfff; }
@@ -126,17 +121,6 @@ typedef intpte_t guest_intpte_t;
 
 #define PRI_gpte "016"PRIx64
 
-static inline paddr_t guest_l1e_get_paddr(guest_l1e_t gl1e)
-{ return l1e_get_paddr(gl1e); }
-static inline paddr_t guest_l2e_get_paddr(guest_l2e_t gl2e)
-{ return l2e_get_paddr(gl2e); }
-static inline paddr_t guest_l3e_get_paddr(guest_l3e_t gl3e)
-{ return l3e_get_paddr(gl3e); }
-#if GUEST_PAGING_LEVELS >= 4
-static inline paddr_t guest_l4e_get_paddr(guest_l4e_t gl4e)
-{ return l4e_get_paddr(gl4e); }
-#endif
-
 static inline gfn_t guest_l1e_get_gfn(guest_l1e_t gl1e)
 { return _gfn(l1e_get_paddr(gl1e) >> PAGE_SHIFT); }
 static inline gfn_t guest_l2e_get_gfn(guest_l2e_t gl2e)
@@ -278,7 +262,8 @@ guest_walk_to_gpa(walk_t *gw)
 {
     if ( !(guest_l1e_get_flags(gw->l1e) & _PAGE_PRESENT) )
         return 0;
-    return guest_l1e_get_paddr(gw->l1e) + (gw->va & ~PAGE_MASK);
+    return ((paddr_t)gfn_x(guest_l1e_get_gfn(gw->l1e)) << PAGE_SHIFT) +
+           (gw->va & ~PAGE_MASK);
 }
 
 /* Given a walk_t from a successful walk, return the page-order of the

Comments

Andrew Cooper June 20, 2016, 12:17 p.m. UTC | #1
On 20/06/16 12:05, Jan Beulich wrote:
> The very few remaining uses don't make their presence really necessary:
> Simplify the two L2 ones, and open code the sole common code use.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Tim Deegan June 20, 2016, 12:33 p.m. UTC | #2
At 05:05 -0600 on 20 Jun (1466399104), Jan Beulich wrote:
> The very few remaining uses don't make their presence really necessary:
> Simplify the two L2 ones, and open code the sole common code use.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Tim Deegan <tim@xen.org>
George Dunlap June 20, 2016, 1:14 p.m. UTC | #3
On 20/06/16 12:05, Jan Beulich wrote:
> The very few remaining uses don't make their presence really necessary:
> Simplify the two L2 ones, and open code the sole common code use.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: George Dunlap <george.dunlap@citrix.com>
diff mbox

Patch

--- a/xen/include/asm-x86/guest_pt.h
+++ b/xen/include/asm-x86/guest_pt.h
@@ -66,15 +66,10 @@  typedef struct { guest_intpte_t l2; } gu
 
 #define PRI_gpte "08x"
 
-static inline paddr_t guest_l1e_get_paddr(guest_l1e_t gl1e)
-{ return ((paddr_t) gl1e.l1) & (PADDR_MASK & PAGE_MASK); }
-static inline paddr_t guest_l2e_get_paddr(guest_l2e_t gl2e)
-{ return ((paddr_t) gl2e.l2) & (PADDR_MASK & PAGE_MASK); }
-
 static inline gfn_t guest_l1e_get_gfn(guest_l1e_t gl1e)
-{ return _gfn(guest_l1e_get_paddr(gl1e) >> PAGE_SHIFT); }
+{ return _gfn(gl1e.l1 >> PAGE_SHIFT); }
 static inline gfn_t guest_l2e_get_gfn(guest_l2e_t gl2e)
-{ return _gfn(guest_l2e_get_paddr(gl2e) >> PAGE_SHIFT); }
+{ return _gfn(gl2e.l2 >> PAGE_SHIFT); }
 
 static inline u32 guest_l1e_get_flags(guest_l1e_t gl1e)
 { return gl1e.l1 & 0xfff; }
@@ -126,17 +121,6 @@  typedef intpte_t guest_intpte_t;
 
 #define PRI_gpte "016"PRIx64
 
-static inline paddr_t guest_l1e_get_paddr(guest_l1e_t gl1e)
-{ return l1e_get_paddr(gl1e); }
-static inline paddr_t guest_l2e_get_paddr(guest_l2e_t gl2e)
-{ return l2e_get_paddr(gl2e); }
-static inline paddr_t guest_l3e_get_paddr(guest_l3e_t gl3e)
-{ return l3e_get_paddr(gl3e); }
-#if GUEST_PAGING_LEVELS >= 4
-static inline paddr_t guest_l4e_get_paddr(guest_l4e_t gl4e)
-{ return l4e_get_paddr(gl4e); }
-#endif
-
 static inline gfn_t guest_l1e_get_gfn(guest_l1e_t gl1e)
 { return _gfn(l1e_get_paddr(gl1e) >> PAGE_SHIFT); }
 static inline gfn_t guest_l2e_get_gfn(guest_l2e_t gl2e)
@@ -278,7 +262,8 @@  guest_walk_to_gpa(walk_t *gw)
 {
     if ( !(guest_l1e_get_flags(gw->l1e) & _PAGE_PRESENT) )
         return 0;
-    return guest_l1e_get_paddr(gw->l1e) + (gw->va & ~PAGE_MASK);
+    return ((paddr_t)gfn_x(guest_l1e_get_gfn(gw->l1e)) << PAGE_SHIFT) +
+           (gw->va & ~PAGE_MASK);
 }
 
 /* Given a walk_t from a successful walk, return the page-order of the