[10/17] xen/x86: pv: Use maddr_to_mfn(...) instead of the open-coding version
diff mbox series

Message ID 20200322161418.31606-11-julien@xen.org
State New
Headers show
Series
  • Bunch of typesafe conversion
Related show

Commit Message

Julien Grall March 22, 2020, 4:14 p.m. UTC
From: Julien Grall <jgrall@amazon.com>

_mfn(addr >> PAGE_SHIFT) is equivalent to maddr_to_mfn(addr).

Signed-off-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/x86/pv/grant_table.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jan Beulich March 27, 2020, 11:34 a.m. UTC | #1
On 22.03.2020 17:14, julien@xen.org wrote:
> From: Julien Grall <jgrall@amazon.com>
> 
> _mfn(addr >> PAGE_SHIFT) is equivalent to maddr_to_mfn(addr).
> 
> Signed-off-by: Julien Grall <jgrall@amazon.com>

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

Patch
diff mbox series

diff --git a/xen/arch/x86/pv/grant_table.c b/xen/arch/x86/pv/grant_table.c
index 0325618c98..f80e233621 100644
--- a/xen/arch/x86/pv/grant_table.c
+++ b/xen/arch/x86/pv/grant_table.c
@@ -72,7 +72,7 @@  int create_grant_pv_mapping(uint64_t addr, mfn_t frame,
             goto out;
         }
 
-        gl1mfn = _mfn(addr >> PAGE_SHIFT);
+        gl1mfn = maddr_to_mfn(addr);
 
         page = get_page_from_mfn(gl1mfn, currd);
         if ( !page )
@@ -228,7 +228,7 @@  int replace_grant_pv_mapping(uint64_t addr, mfn_t frame,
             goto out;
         }
 
-        gl1mfn = _mfn(addr >> PAGE_SHIFT);
+        gl1mfn = maddr_to_mfn(addr);
 
         page = get_page_from_mfn(gl1mfn, currd);
         if ( !page )