diff mbox series

[Xen-devel,for-next,14/16] xen/arm: traps: Remove the field gva from mmio_info_t

Message ID 20171123183210.12045-15-julien.grall@linaro.org
State Superseded
Headers show
Series xen/arm: Stage-2 handling cleanup | expand

Commit Message

Julien Grall Nov. 23, 2017, 6:32 p.m. UTC
mmio_info_t is used to gather information in order do emulation a
region. Guest virtual address is unlikely to be a useful information and
not currently used. So remove the field gva from mmio_info_t and replace
by a local variable.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
---
 xen/arch/arm/traps.c       | 13 +++++++------
 xen/include/asm-arm/mmio.h |  1 -
 2 files changed, 7 insertions(+), 7 deletions(-)

Comments

Stefano Stabellini Dec. 7, 2017, 10:29 p.m. UTC | #1
On Thu, 23 Nov 2017, Julien Grall wrote:
> mmio_info_t is used to gather information in order do emulation a
                                                                 ^ of a

Aside from this

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


> region. Guest virtual address is unlikely to be a useful information and
> not currently used. So remove the field gva from mmio_info_t and replace
> by a local variable.
> 
> Signed-off-by: Julien Grall <julien.grall@linaro.org>
> ---
>  xen/arch/arm/traps.c       | 13 +++++++------
>  xen/include/asm-arm/mmio.h |  1 -
>  2 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
> index f6f6de3691..e30dd9b7e2 100644
> --- a/xen/arch/arm/traps.c
> +++ b/xen/arch/arm/traps.c
> @@ -2001,6 +2001,7 @@ static void do_trap_data_abort_guest(struct cpu_user_regs *regs,
>  {
>      const struct hsr_dabt dabt = hsr.dabt;
>      int rc;
> +    vaddr_t gva;
>      mmio_info_t info;
>      uint8_t fsc = hsr.dabt.dfsc & ~FSC_LL_MASK;
>      mfn_t mfn;
> @@ -2014,13 +2015,13 @@ static void do_trap_data_abort_guest(struct cpu_user_regs *regs,
>  
>      info.dabt = dabt;
>  
> -    info.gva = get_hfar(true /* is_data */);
> +    gva = get_hfar(true /* is_data */);
>  
>      if ( hpfar_is_valid(dabt.s1ptw, fsc) )
> -        info.gpa = get_faulting_ipa(info.gva);
> +        info.gpa = get_faulting_ipa(gva);
>      else
>      {
> -        rc = gva_to_ipa(info.gva, &info.gpa, GV2M_READ);
> +        rc = gva_to_ipa(gva, &info.gpa, GV2M_READ);
>          /*
>           * We may not be able to translate because someone is
>           * playing with the Stage-2 page table of the domain.
> @@ -2041,7 +2042,7 @@ static void do_trap_data_abort_guest(struct cpu_user_regs *regs,
>              .kind = dabt.s1ptw ? npfec_kind_in_gpt : npfec_kind_with_gla
>          };
>  
> -        p2m_mem_access_check(info.gpa, info.gva, npfec);
> +        p2m_mem_access_check(info.gpa, gva, npfec);
>          /*
>           * The only way to get here right now is because of mem_access,
>           * thus reinjecting the exception to the guest is never required.
> @@ -2078,8 +2079,8 @@ static void do_trap_data_abort_guest(struct cpu_user_regs *regs,
>      }
>  
>      gdprintk(XENLOG_DEBUG, "HSR=0x%x pc=%#"PRIregister" gva=%#"PRIvaddr
> -             " gpa=%#"PRIpaddr"\n", hsr.bits, regs->pc, info.gva, info.gpa);
> -    inject_dabt_exception(regs, info.gva, hsr.len);
> +             " gpa=%#"PRIpaddr"\n", hsr.bits, regs->pc, gva, info.gpa);
> +    inject_dabt_exception(regs, gva, hsr.len);
>  }
>  
>  static void enter_hypervisor_head(struct cpu_user_regs *regs)
> diff --git a/xen/include/asm-arm/mmio.h b/xen/include/asm-arm/mmio.h
> index c620eed4cd..37e2b7a707 100644
> --- a/xen/include/asm-arm/mmio.h
> +++ b/xen/include/asm-arm/mmio.h
> @@ -29,7 +29,6 @@
>  typedef struct
>  {
>      struct hsr_dabt dabt;
> -    vaddr_t gva;
>      paddr_t gpa;
>  } mmio_info_t;
>  
> -- 
> 2.11.0
>
diff mbox series

Patch

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index f6f6de3691..e30dd9b7e2 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -2001,6 +2001,7 @@  static void do_trap_data_abort_guest(struct cpu_user_regs *regs,
 {
     const struct hsr_dabt dabt = hsr.dabt;
     int rc;
+    vaddr_t gva;
     mmio_info_t info;
     uint8_t fsc = hsr.dabt.dfsc & ~FSC_LL_MASK;
     mfn_t mfn;
@@ -2014,13 +2015,13 @@  static void do_trap_data_abort_guest(struct cpu_user_regs *regs,
 
     info.dabt = dabt;
 
-    info.gva = get_hfar(true /* is_data */);
+    gva = get_hfar(true /* is_data */);
 
     if ( hpfar_is_valid(dabt.s1ptw, fsc) )
-        info.gpa = get_faulting_ipa(info.gva);
+        info.gpa = get_faulting_ipa(gva);
     else
     {
-        rc = gva_to_ipa(info.gva, &info.gpa, GV2M_READ);
+        rc = gva_to_ipa(gva, &info.gpa, GV2M_READ);
         /*
          * We may not be able to translate because someone is
          * playing with the Stage-2 page table of the domain.
@@ -2041,7 +2042,7 @@  static void do_trap_data_abort_guest(struct cpu_user_regs *regs,
             .kind = dabt.s1ptw ? npfec_kind_in_gpt : npfec_kind_with_gla
         };
 
-        p2m_mem_access_check(info.gpa, info.gva, npfec);
+        p2m_mem_access_check(info.gpa, gva, npfec);
         /*
          * The only way to get here right now is because of mem_access,
          * thus reinjecting the exception to the guest is never required.
@@ -2078,8 +2079,8 @@  static void do_trap_data_abort_guest(struct cpu_user_regs *regs,
     }
 
     gdprintk(XENLOG_DEBUG, "HSR=0x%x pc=%#"PRIregister" gva=%#"PRIvaddr
-             " gpa=%#"PRIpaddr"\n", hsr.bits, regs->pc, info.gva, info.gpa);
-    inject_dabt_exception(regs, info.gva, hsr.len);
+             " gpa=%#"PRIpaddr"\n", hsr.bits, regs->pc, gva, info.gpa);
+    inject_dabt_exception(regs, gva, hsr.len);
 }
 
 static void enter_hypervisor_head(struct cpu_user_regs *regs)
diff --git a/xen/include/asm-arm/mmio.h b/xen/include/asm-arm/mmio.h
index c620eed4cd..37e2b7a707 100644
--- a/xen/include/asm-arm/mmio.h
+++ b/xen/include/asm-arm/mmio.h
@@ -29,7 +29,6 @@ 
 typedef struct
 {
     struct hsr_dabt dabt;
-    vaddr_t gva;
     paddr_t gpa;
 } mmio_info_t;