diff mbox

mem_access: switch to plain bool

Message ID 20170911111628.26480-1-wei.liu2@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wei Liu Sept. 11, 2017, 11:16 a.m. UTC
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
Cc: Razvan Cojocaru <rcojocaru@bitdefender.com>
Cc: Tamas K Lengyel <tamas@tklengyel.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Julien Grall <julien.grall@arm.com>
Cc: George Dunlap <george.dunlap@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/arm/mem_access.c        |  4 ++--
 xen/arch/x86/mm/mem_access.c     | 16 ++++++++--------
 xen/include/asm-arm/mem_access.h |  8 ++++----
 xen/include/asm-x86/mem_access.h |  8 ++++----
 4 files changed, 18 insertions(+), 18 deletions(-)

Comments

Razvan Cojocaru Sept. 11, 2017, 2:33 p.m. UTC | #1
On 11.09.2017 14:16, Wei Liu wrote:
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> ---
> Cc: Razvan Cojocaru <rcojocaru@bitdefender.com>
> Cc: Tamas K Lengyel <tamas@tklengyel.com>
> Cc: Stefano Stabellini <sstabellini@kernel.org>
> Cc: Julien Grall <julien.grall@arm.com>
> Cc: George Dunlap <george.dunlap@eu.citrix.com>
> Cc: Jan Beulich <jbeulich@suse.com>
> Cc: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
>   xen/arch/arm/mem_access.c        |  4 ++--
>   xen/arch/x86/mm/mem_access.c     | 16 ++++++++--------
>   xen/include/asm-arm/mem_access.h |  8 ++++----
>   xen/include/asm-x86/mem_access.h |  8 ++++----
>   4 files changed, 18 insertions(+), 18 deletions(-)

Acked-by: Razvan Cojocaru <rcojocaru@bitdefender.com>

Thanks for doing this!
Stefano Stabellini Sept. 11, 2017, 6:17 p.m. UTC | #2
On Mon, 11 Sep 2017, Wei Liu wrote:
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>

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

> ---
> Cc: Razvan Cojocaru <rcojocaru@bitdefender.com>
> Cc: Tamas K Lengyel <tamas@tklengyel.com>
> Cc: Stefano Stabellini <sstabellini@kernel.org>
> Cc: Julien Grall <julien.grall@arm.com>
> Cc: George Dunlap <george.dunlap@eu.citrix.com>
> Cc: Jan Beulich <jbeulich@suse.com>
> Cc: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
>  xen/arch/arm/mem_access.c        |  4 ++--
>  xen/arch/x86/mm/mem_access.c     | 16 ++++++++--------
>  xen/include/asm-arm/mem_access.h |  8 ++++----
>  xen/include/asm-x86/mem_access.h |  8 ++++----
>  4 files changed, 18 insertions(+), 18 deletions(-)
> 
> diff --git a/xen/arch/arm/mem_access.c b/xen/arch/arm/mem_access.c
> index db9ad3f3c9..0f2cbb81d3 100644
> --- a/xen/arch/arm/mem_access.c
> +++ b/xen/arch/arm/mem_access.c
> @@ -219,10 +219,10 @@ err:
>      return page;
>  }
>  
> -bool_t p2m_mem_access_check(paddr_t gpa, vaddr_t gla, const struct npfec npfec)
> +bool p2m_mem_access_check(paddr_t gpa, vaddr_t gla, const struct npfec npfec)
>  {
>      int rc;
> -    bool_t violation;
> +    bool violation;
>      xenmem_access_t xma;
>      vm_event_request_t *req;
>      struct vcpu *v = current;
> diff --git a/xen/arch/x86/mm/mem_access.c b/xen/arch/x86/mm/mem_access.c
> index 414e38f998..9211fc0abe 100644
> --- a/xen/arch/x86/mm/mem_access.c
> +++ b/xen/arch/x86/mm/mem_access.c
> @@ -83,7 +83,7 @@ bool p2m_mem_access_emulate_check(struct vcpu *v,
>                                    const vm_event_response_t *rsp)
>  {
>      xenmem_access_t access;
> -    bool violation = 1;
> +    bool violation = true;
>      const struct vm_event_mem_access *data = &rsp->u.mem_access;
>      struct domain *d = v->domain;
>      struct p2m_domain *p2m = NULL;
> @@ -129,7 +129,7 @@ bool p2m_mem_access_emulate_check(struct vcpu *v,
>              break;
>  
>          case XENMEM_access_rwx:
> -            violation = 0;
> +            violation = false;
>              break;
>          }
>      }
> @@ -137,9 +137,9 @@ bool p2m_mem_access_emulate_check(struct vcpu *v,
>      return violation;
>  }
>  
> -bool_t p2m_mem_access_check(paddr_t gpa, unsigned long gla,
> -                            struct npfec npfec,
> -                            vm_event_request_t **req_ptr)
> +bool p2m_mem_access_check(paddr_t gpa, unsigned long gla,
> +                          struct npfec npfec,
> +                          vm_event_request_t **req_ptr)
>  {
>      struct vcpu *v = current;
>      unsigned long gfn = gpa >> PAGE_SHIFT;
> @@ -167,7 +167,7 @@ bool_t p2m_mem_access_check(paddr_t gpa, unsigned long gla,
>          rc = p2m->set_entry(p2m, gfn, mfn, PAGE_ORDER_4K, p2mt, p2m_access_rw, -1);
>          ASSERT(rc == 0);
>          gfn_unlock(p2m, gfn, 0);
> -        return 1;
> +        return true;
>      }
>      else if ( p2ma == p2m_access_n2rwx )
>      {
> @@ -188,7 +188,7 @@ bool_t p2m_mem_access_check(paddr_t gpa, unsigned long gla,
>                                    "no vm_event listener VCPU %d, dom %d\n",
>                                    v->vcpu_id, d->domain_id);
>              domain_crash(v->domain);
> -            return 0;
> +            return false;
>          }
>          else
>          {
> @@ -204,7 +204,7 @@ bool_t p2m_mem_access_check(paddr_t gpa, unsigned long gla,
>                  ASSERT(rc == 0);
>              }
>              gfn_unlock(p2m, gfn, 0);
> -            return 1;
> +            return true;
>          }
>      }
>  
> diff --git a/xen/include/asm-arm/mem_access.h b/xen/include/asm-arm/mem_access.h
> index 3a155f84eb..1610635c5b 100644
> --- a/xen/include/asm-arm/mem_access.h
> +++ b/xen/include/asm-arm/mem_access.h
> @@ -22,20 +22,20 @@ bool p2m_mem_access_emulate_check(struct vcpu *v,
>                                    const vm_event_response_t *rsp)
>  {
>      /* Not supported on ARM. */
> -    return 0;
> +    return false;
>  }
>  
>  /* vm_event and mem_access are supported on any ARM guest */
> -static inline bool_t p2m_mem_access_sanity_check(struct domain *d)
> +static inline bool p2m_mem_access_sanity_check(struct domain *d)
>  {
> -    return 1;
> +    return true;
>  }
>  
>  /*
>   * Send mem event based on the access. Boolean return value indicates if trap
>   * needs to be injected into guest.
>   */
> -bool_t p2m_mem_access_check(paddr_t gpa, vaddr_t gla, const struct npfec npfec);
> +bool p2m_mem_access_check(paddr_t gpa, vaddr_t gla, const struct npfec npfec);
>  
>  struct page_info*
>  p2m_mem_access_check_and_get_page(vaddr_t gva, unsigned long flag,
> diff --git a/xen/include/asm-x86/mem_access.h b/xen/include/asm-x86/mem_access.h
> index 9f7b409b4e..4043c9fb4d 100644
> --- a/xen/include/asm-x86/mem_access.h
> +++ b/xen/include/asm-x86/mem_access.h
> @@ -34,9 +34,9 @@
>   * ring. Once having released get_gfn* locks caller must also xfree the
>   * request.
>   */
> -bool_t p2m_mem_access_check(paddr_t gpa, unsigned long gla,
> -                            struct npfec npfec,
> -                            vm_event_request_t **req_ptr);
> +bool p2m_mem_access_check(paddr_t gpa, unsigned long gla,
> +                          struct npfec npfec,
> +                          vm_event_request_t **req_ptr);
>  
>  /* Check for emulation and mark vcpu for skipping one instruction
>   * upon rescheduling if required. */
> @@ -44,7 +44,7 @@ bool p2m_mem_access_emulate_check(struct vcpu *v,
>                                    const vm_event_response_t *rsp);
>  
>  /* Sanity check for mem_access hardware support */
> -static inline bool_t p2m_mem_access_sanity_check(struct domain *d)
> +static inline bool p2m_mem_access_sanity_check(struct domain *d)
>  {
>      return is_hvm_domain(d) && cpu_has_vmx && hap_enabled(d);
>  }
> -- 
> 2.11.0
>
diff mbox

Patch

diff --git a/xen/arch/arm/mem_access.c b/xen/arch/arm/mem_access.c
index db9ad3f3c9..0f2cbb81d3 100644
--- a/xen/arch/arm/mem_access.c
+++ b/xen/arch/arm/mem_access.c
@@ -219,10 +219,10 @@  err:
     return page;
 }
 
-bool_t p2m_mem_access_check(paddr_t gpa, vaddr_t gla, const struct npfec npfec)
+bool p2m_mem_access_check(paddr_t gpa, vaddr_t gla, const struct npfec npfec)
 {
     int rc;
-    bool_t violation;
+    bool violation;
     xenmem_access_t xma;
     vm_event_request_t *req;
     struct vcpu *v = current;
diff --git a/xen/arch/x86/mm/mem_access.c b/xen/arch/x86/mm/mem_access.c
index 414e38f998..9211fc0abe 100644
--- a/xen/arch/x86/mm/mem_access.c
+++ b/xen/arch/x86/mm/mem_access.c
@@ -83,7 +83,7 @@  bool p2m_mem_access_emulate_check(struct vcpu *v,
                                   const vm_event_response_t *rsp)
 {
     xenmem_access_t access;
-    bool violation = 1;
+    bool violation = true;
     const struct vm_event_mem_access *data = &rsp->u.mem_access;
     struct domain *d = v->domain;
     struct p2m_domain *p2m = NULL;
@@ -129,7 +129,7 @@  bool p2m_mem_access_emulate_check(struct vcpu *v,
             break;
 
         case XENMEM_access_rwx:
-            violation = 0;
+            violation = false;
             break;
         }
     }
@@ -137,9 +137,9 @@  bool p2m_mem_access_emulate_check(struct vcpu *v,
     return violation;
 }
 
-bool_t p2m_mem_access_check(paddr_t gpa, unsigned long gla,
-                            struct npfec npfec,
-                            vm_event_request_t **req_ptr)
+bool p2m_mem_access_check(paddr_t gpa, unsigned long gla,
+                          struct npfec npfec,
+                          vm_event_request_t **req_ptr)
 {
     struct vcpu *v = current;
     unsigned long gfn = gpa >> PAGE_SHIFT;
@@ -167,7 +167,7 @@  bool_t p2m_mem_access_check(paddr_t gpa, unsigned long gla,
         rc = p2m->set_entry(p2m, gfn, mfn, PAGE_ORDER_4K, p2mt, p2m_access_rw, -1);
         ASSERT(rc == 0);
         gfn_unlock(p2m, gfn, 0);
-        return 1;
+        return true;
     }
     else if ( p2ma == p2m_access_n2rwx )
     {
@@ -188,7 +188,7 @@  bool_t p2m_mem_access_check(paddr_t gpa, unsigned long gla,
                                   "no vm_event listener VCPU %d, dom %d\n",
                                   v->vcpu_id, d->domain_id);
             domain_crash(v->domain);
-            return 0;
+            return false;
         }
         else
         {
@@ -204,7 +204,7 @@  bool_t p2m_mem_access_check(paddr_t gpa, unsigned long gla,
                 ASSERT(rc == 0);
             }
             gfn_unlock(p2m, gfn, 0);
-            return 1;
+            return true;
         }
     }
 
diff --git a/xen/include/asm-arm/mem_access.h b/xen/include/asm-arm/mem_access.h
index 3a155f84eb..1610635c5b 100644
--- a/xen/include/asm-arm/mem_access.h
+++ b/xen/include/asm-arm/mem_access.h
@@ -22,20 +22,20 @@  bool p2m_mem_access_emulate_check(struct vcpu *v,
                                   const vm_event_response_t *rsp)
 {
     /* Not supported on ARM. */
-    return 0;
+    return false;
 }
 
 /* vm_event and mem_access are supported on any ARM guest */
-static inline bool_t p2m_mem_access_sanity_check(struct domain *d)
+static inline bool p2m_mem_access_sanity_check(struct domain *d)
 {
-    return 1;
+    return true;
 }
 
 /*
  * Send mem event based on the access. Boolean return value indicates if trap
  * needs to be injected into guest.
  */
-bool_t p2m_mem_access_check(paddr_t gpa, vaddr_t gla, const struct npfec npfec);
+bool p2m_mem_access_check(paddr_t gpa, vaddr_t gla, const struct npfec npfec);
 
 struct page_info*
 p2m_mem_access_check_and_get_page(vaddr_t gva, unsigned long flag,
diff --git a/xen/include/asm-x86/mem_access.h b/xen/include/asm-x86/mem_access.h
index 9f7b409b4e..4043c9fb4d 100644
--- a/xen/include/asm-x86/mem_access.h
+++ b/xen/include/asm-x86/mem_access.h
@@ -34,9 +34,9 @@ 
  * ring. Once having released get_gfn* locks caller must also xfree the
  * request.
  */
-bool_t p2m_mem_access_check(paddr_t gpa, unsigned long gla,
-                            struct npfec npfec,
-                            vm_event_request_t **req_ptr);
+bool p2m_mem_access_check(paddr_t gpa, unsigned long gla,
+                          struct npfec npfec,
+                          vm_event_request_t **req_ptr);
 
 /* Check for emulation and mark vcpu for skipping one instruction
  * upon rescheduling if required. */
@@ -44,7 +44,7 @@  bool p2m_mem_access_emulate_check(struct vcpu *v,
                                   const vm_event_response_t *rsp);
 
 /* Sanity check for mem_access hardware support */
-static inline bool_t p2m_mem_access_sanity_check(struct domain *d)
+static inline bool p2m_mem_access_sanity_check(struct domain *d)
 {
     return is_hvm_domain(d) && cpu_has_vmx && hap_enabled(d);
 }