[Xen-devel,13/24] xen/arm: traps: Replace p2m_lookup(..., ..., NULL) by gfn_to_mfn(..., ...)

Message ID 20170613161323.25196-14-julien.grall@arm.com
State Accepted
Commit 67c3ca7a7795f0ca31e3733ec6ae9716157e2726
Headers show
Series
  • xen/arm: Extend the usage of typesafe MFN
Related show

Commit Message

Julien Grall June 13, 2017, 4:13 p.m.
gfn_to_mfn is a wrapper of p2m_lookup which does not return the
p2m_type.

Signed-off-by: Julien Grall <julien.grall@arm.com>
---
 xen/arch/arm/traps.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Stefano Stabellini June 15, 2017, 10:49 p.m. | #1
On Tue, 13 Jun 2017, Julien Grall wrote:
> gfn_to_mfn is a wrapper of p2m_lookup which does not return the
> p2m_type.
> 
> Signed-off-by: Julien Grall <julien.grall@arm.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
>  xen/arch/arm/traps.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
> index 6cf9ee7244..ce19021f01 100644
> --- a/xen/arch/arm/traps.c
> +++ b/xen/arch/arm/traps.c
> @@ -2481,7 +2481,7 @@ void dump_guest_s1_walk(struct domain *d, vaddr_t addr)
>      uint32_t *first = NULL, *second = NULL;
>      mfn_t mfn;
>  
> -    mfn = p2m_lookup(d, _gfn(paddr_to_pfn(ttbr0)), NULL);
> +    mfn = gfn_to_mfn(d, _gfn(paddr_to_pfn(ttbr0)));
>  
>      printk("dom%d VA 0x%08"PRIvaddr"\n", d->domain_id, addr);
>      printk("    TTBCR: 0x%08"PRIregister"\n", ttbcr);
> @@ -2513,7 +2513,7 @@ void dump_guest_s1_walk(struct domain *d, vaddr_t addr)
>            (first[offset] & 0x2) )
>          goto done;
>  
> -    mfn = p2m_lookup(d, _gfn(paddr_to_pfn(first[offset])), NULL);
> +    mfn = gfn_to_mfn(d, _gfn(paddr_to_pfn(first[offset])));
>  
>      if ( mfn_eq(mfn, INVALID_MFN) )
>      {
> @@ -2619,7 +2619,7 @@ static void do_trap_instr_abort_guest(struct cpu_user_regs *regs,
>           * with the Stage-2 page table. Walk the Stage-2 PT to check
>           * if the entry exists. If it's the case, return to the guest
>           */
> -        mfn = p2m_lookup(current->domain, _gfn(paddr_to_pfn(gpa)), NULL);
> +        mfn = gfn_to_mfn(current->domain, _gfn(paddr_to_pfn(gpa)));
>          if ( !mfn_eq(mfn, INVALID_MFN) )
>              return;
>      }
> @@ -2759,7 +2759,7 @@ static void do_trap_data_abort_guest(struct cpu_user_regs *regs,
>           * with the Stage-2 page table. Walk the Stage-2 PT to check
>           * if the entry exists. If it's the case, return to the guest
>           */
> -        mfn = p2m_lookup(current->domain, _gfn(paddr_to_pfn(info.gpa)), NULL);
> +        mfn = gfn_to_mfn(current->domain, _gfn(paddr_to_pfn(info.gpa)));
>          if ( !mfn_eq(mfn, INVALID_MFN) )
>              return;
>  
> -- 
> 2.11.0
>

Patch

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 6cf9ee7244..ce19021f01 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -2481,7 +2481,7 @@  void dump_guest_s1_walk(struct domain *d, vaddr_t addr)
     uint32_t *first = NULL, *second = NULL;
     mfn_t mfn;
 
-    mfn = p2m_lookup(d, _gfn(paddr_to_pfn(ttbr0)), NULL);
+    mfn = gfn_to_mfn(d, _gfn(paddr_to_pfn(ttbr0)));
 
     printk("dom%d VA 0x%08"PRIvaddr"\n", d->domain_id, addr);
     printk("    TTBCR: 0x%08"PRIregister"\n", ttbcr);
@@ -2513,7 +2513,7 @@  void dump_guest_s1_walk(struct domain *d, vaddr_t addr)
           (first[offset] & 0x2) )
         goto done;
 
-    mfn = p2m_lookup(d, _gfn(paddr_to_pfn(first[offset])), NULL);
+    mfn = gfn_to_mfn(d, _gfn(paddr_to_pfn(first[offset])));
 
     if ( mfn_eq(mfn, INVALID_MFN) )
     {
@@ -2619,7 +2619,7 @@  static void do_trap_instr_abort_guest(struct cpu_user_regs *regs,
          * with the Stage-2 page table. Walk the Stage-2 PT to check
          * if the entry exists. If it's the case, return to the guest
          */
-        mfn = p2m_lookup(current->domain, _gfn(paddr_to_pfn(gpa)), NULL);
+        mfn = gfn_to_mfn(current->domain, _gfn(paddr_to_pfn(gpa)));
         if ( !mfn_eq(mfn, INVALID_MFN) )
             return;
     }
@@ -2759,7 +2759,7 @@  static void do_trap_data_abort_guest(struct cpu_user_regs *regs,
          * with the Stage-2 page table. Walk the Stage-2 PT to check
          * if the entry exists. If it's the case, return to the guest
          */
-        mfn = p2m_lookup(current->domain, _gfn(paddr_to_pfn(info.gpa)), NULL);
+        mfn = gfn_to_mfn(current->domain, _gfn(paddr_to_pfn(info.gpa)));
         if ( !mfn_eq(mfn, INVALID_MFN) )
             return;