diff mbox series

[XEN,v3,1/6] xen/arm: change names in function access_guest_memory_by_ipa().

Message ID 89e96c5d4b95a35540757235e838fd65f5e4077e.1687771796.git.federico.serafini@bugseng.com (mailing list archive)
State New, archived
Headers show
Series fix violations of MISRA C:2012 Rule 8.3 on parameter names. | expand

Commit Message

Federico Serafini June 26, 2023, 9:52 a.m. UTC
Change the function name 'access_guest_memory_by_ipa' to
'access_guest_memory_by_gpa' and change its formal parameter name from
'ipa' to 'gpa' because of the following:
1) 'gpa' is used more frequently and therefore is preferable;
2) changing parameter name makes the declaration consistent with the
   corresponding definition thus fixing a violation of MISRA C:2012 Rule
   8.3.

Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
---
 xen/arch/arm/guest_walk.c               |  6 +++---
 xen/arch/arm/guestcopy.c                |  2 +-
 xen/arch/arm/include/asm/guest_access.h |  2 +-
 xen/arch/arm/tee/optee.c                | 10 +++++-----
 xen/arch/arm/vgic-v3-its.c              | 16 ++++++++--------
 5 files changed, 18 insertions(+), 18 deletions(-)

Comments

Julien Grall June 26, 2023, 2:12 p.m. UTC | #1
Hi,

On 26/06/2023 10:52, Federico Serafini wrote:
> Change the function name 'access_guest_memory_by_ipa' to
> 'access_guest_memory_by_gpa' and change its formal parameter name from
> 'ipa' to 'gpa' because of the following:
> 1) 'gpa' is used more frequently and therefore is preferable;
> 2) changing parameter name makes the declaration consistent with the
>     corresponding definition thus fixing a violation of MISRA C:2012 Rule
>     8.3.
> 
> Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>

Reviewed-by: Julien Grall <jgrall@amazon.com>

Cheers,
diff mbox series

Patch

diff --git a/xen/arch/arm/guest_walk.c b/xen/arch/arm/guest_walk.c
index c80a0ce55b..d99b411f3b 100644
--- a/xen/arch/arm/guest_walk.c
+++ b/xen/arch/arm/guest_walk.c
@@ -85,7 +85,7 @@  static bool guest_walk_sd(const struct vcpu *v,
     paddr |= (gva & mask) >> 18;
 
     /* Access the guest's memory to read only one PTE. */
-    ret = access_guest_memory_by_ipa(d, paddr, &pte, sizeof(short_desc_t), false);
+    ret = access_guest_memory_by_gpa(d, paddr, &pte, sizeof(short_desc_t), false);
     if ( ret )
         return false;
 
@@ -110,7 +110,7 @@  static bool guest_walk_sd(const struct vcpu *v,
         paddr = ((paddr_t)pte.walk.base << 10) | ((gva & mask) >> 10);
 
         /* Access the guest's memory to read only one PTE. */
-        ret = access_guest_memory_by_ipa(d, paddr, &pte, sizeof(short_desc_t), false);
+        ret = access_guest_memory_by_gpa(d, paddr, &pte, sizeof(short_desc_t), false);
         if ( ret )
             return false;
 
@@ -481,7 +481,7 @@  static bool guest_walk_ld(const struct vcpu *v,
         paddr |= LPAE_TABLE_INDEX_GS(grainsizes[gran], level, gva) << 3;
 
         /* Access the guest's memory to read only one PTE. */
-        ret = access_guest_memory_by_ipa(d, paddr, &pte, sizeof(lpae_t), false);
+        ret = access_guest_memory_by_gpa(d, paddr, &pte, sizeof(lpae_t), false);
         if ( ret )
             return false;
 
diff --git a/xen/arch/arm/guestcopy.c b/xen/arch/arm/guestcopy.c
index 225fd343dd..6716b03561 100644
--- a/xen/arch/arm/guestcopy.c
+++ b/xen/arch/arm/guestcopy.c
@@ -142,7 +142,7 @@  unsigned long copy_to_guest_phys_flush_dcache(struct domain *d,
                       COPY_to_guest | COPY_ipa | COPY_flush_dcache);
 }
 
-int access_guest_memory_by_ipa(struct domain *d, paddr_t gpa, void *buf,
+int access_guest_memory_by_gpa(struct domain *d, paddr_t gpa, void *buf,
                                uint32_t size, bool is_write)
 {
     unsigned long left;
diff --git a/xen/arch/arm/include/asm/guest_access.h b/xen/arch/arm/include/asm/guest_access.h
index 4421e43611..8278a45dbf 100644
--- a/xen/arch/arm/include/asm/guest_access.h
+++ b/xen/arch/arm/include/asm/guest_access.h
@@ -16,7 +16,7 @@  unsigned long copy_to_guest_phys_flush_dcache(struct domain *d,
                                               void *buf,
                                               unsigned int len);
 
-int access_guest_memory_by_ipa(struct domain *d, paddr_t ipa, void *buf,
+int access_guest_memory_by_gpa(struct domain *d, paddr_t gpa, void *buf,
                                uint32_t size, bool is_write);
 
 #define __raw_copy_to_guest raw_copy_to_guest
diff --git a/xen/arch/arm/tee/optee.c b/xen/arch/arm/tee/optee.c
index 9cb9f16d43..301d205a36 100644
--- a/xen/arch/arm/tee/optee.c
+++ b/xen/arch/arm/tee/optee.c
@@ -951,7 +951,7 @@  static bool copy_std_request(struct cpu_user_regs *regs,
 
     map_xen_arg(call);
 
-    if ( access_guest_memory_by_ipa(current->domain, call->guest_arg_ipa,
+    if ( access_guest_memory_by_gpa(current->domain, call->guest_arg_ipa,
                                     call->xen_arg,
                                     OPTEE_MSG_NONCONTIG_PAGE_SIZE, false) )
     {
@@ -1106,7 +1106,7 @@  static int handle_rpc_return(struct optee_domain *ctx,
 
         shm_rpc->xen_arg = __map_domain_page(shm_rpc->xen_arg_pg);
 
-        if ( access_guest_memory_by_ipa(current->domain,
+        if ( access_guest_memory_by_gpa(current->domain,
                         gfn_to_gaddr(shm_rpc->gfn),
                         shm_rpc->xen_arg,
                         OPTEE_MSG_GET_ARG_SIZE(shm_rpc->xen_arg->num_params),
@@ -1329,7 +1329,7 @@  static bool issue_rpc_cmd_free(struct optee_domain *ctx,
     shm_rpc->xen_arg->params[0].u.value.a = call->rpc_buffer_type;
     shm_rpc->xen_arg->params[0].u.value.b = cookie;
 
-    if ( access_guest_memory_by_ipa(current->domain,
+    if ( access_guest_memory_by_gpa(current->domain,
                                     gfn_to_gaddr(shm_rpc->gfn),
                                     shm_rpc->xen_arg,
                                     OPTEE_MSG_GET_ARG_SIZE(1),
@@ -1462,7 +1462,7 @@  static void handle_rpc_cmd(struct optee_domain *ctx, struct cpu_user_regs *regs,
     shm_rpc->xen_arg = __map_domain_page(shm_rpc->xen_arg_pg);
 
     /* First, copy only header to read number of arguments */
-    if ( access_guest_memory_by_ipa(current->domain,
+    if ( access_guest_memory_by_gpa(current->domain,
                                     gfn_to_gaddr(shm_rpc->gfn),
                                     shm_rpc->xen_arg,
                                     sizeof(struct optee_msg_arg),
@@ -1480,7 +1480,7 @@  static void handle_rpc_cmd(struct optee_domain *ctx, struct cpu_user_regs *regs,
     }
 
     /* Read the whole command structure */
-    if ( access_guest_memory_by_ipa(current->domain, gfn_to_gaddr(shm_rpc->gfn),
+    if ( access_guest_memory_by_gpa(current->domain, gfn_to_gaddr(shm_rpc->gfn),
                                     shm_rpc->xen_arg, arg_size, false) )
     {
         shm_rpc->xen_arg->ret = TEEC_ERROR_GENERIC;
diff --git a/xen/arch/arm/vgic-v3-its.c b/xen/arch/arm/vgic-v3-its.c
index 299b384250..05429030b5 100644
--- a/xen/arch/arm/vgic-v3-its.c
+++ b/xen/arch/arm/vgic-v3-its.c
@@ -121,7 +121,7 @@  static int its_set_collection(struct virt_its *its, uint16_t collid,
     if ( collid >= its->max_collections )
         return -ENOENT;
 
-    return access_guest_memory_by_ipa(its->d,
+    return access_guest_memory_by_gpa(its->d,
                                       addr + collid * sizeof(coll_table_entry_t),
                                       &vcpu_id, sizeof(vcpu_id), true);
 }
@@ -139,7 +139,7 @@  static struct vcpu *get_vcpu_from_collection(struct virt_its *its,
     if ( collid >= its->max_collections )
         return NULL;
 
-    ret = access_guest_memory_by_ipa(its->d,
+    ret = access_guest_memory_by_gpa(its->d,
                                      addr + collid * sizeof(coll_table_entry_t),
                                      &vcpu_id, sizeof(coll_table_entry_t), false);
     if ( ret )
@@ -161,7 +161,7 @@  static int its_set_itt_address(struct virt_its *its, uint32_t devid,
     if ( devid >= its->max_devices )
         return -ENOENT;
 
-    return access_guest_memory_by_ipa(its->d,
+    return access_guest_memory_by_gpa(its->d,
                                       addr + devid * sizeof(dev_table_entry_t),
                                       &itt_entry, sizeof(itt_entry), true);
 }
@@ -179,7 +179,7 @@  static int its_get_itt(struct virt_its *its, uint32_t devid,
     if ( devid >= its->max_devices )
         return -EINVAL;
 
-    return access_guest_memory_by_ipa(its->d,
+    return access_guest_memory_by_gpa(its->d,
                                       addr + devid * sizeof(dev_table_entry_t),
                                       itt, sizeof(*itt), false);
 }
@@ -226,7 +226,7 @@  static bool read_itte(struct virt_its *its, uint32_t devid, uint32_t evid,
     if ( addr == INVALID_PADDR )
         return false;
 
-    if ( access_guest_memory_by_ipa(its->d, addr, &itte, sizeof(itte), false) )
+    if ( access_guest_memory_by_gpa(its->d, addr, &itte, sizeof(itte), false) )
         return false;
 
     vcpu = get_vcpu_from_collection(its, itte.collection);
@@ -260,7 +260,7 @@  static bool write_itte(struct virt_its *its, uint32_t devid,
     itte.collection = collid;
     itte.vlpi = vlpi;
 
-    if ( access_guest_memory_by_ipa(its->d, addr, &itte, sizeof(itte), true) )
+    if ( access_guest_memory_by_gpa(its->d, addr, &itte, sizeof(itte), true) )
         return false;
 
     return true;
@@ -405,7 +405,7 @@  static int update_lpi_property(struct domain *d, struct pending_irq *p)
 
     addr = d->arch.vgic.rdist_propbase & GENMASK(51, 12);
 
-    ret = access_guest_memory_by_ipa(d, addr + p->irq - LPI_OFFSET,
+    ret = access_guest_memory_by_gpa(d, addr + p->irq - LPI_OFFSET,
                                      &property, sizeof(property), false);
     if ( ret )
         return ret;
@@ -910,7 +910,7 @@  static int vgic_its_handle_cmds(struct domain *d, struct virt_its *its)
     {
         int ret;
 
-        ret = access_guest_memory_by_ipa(d, addr + its->creadr,
+        ret = access_guest_memory_by_gpa(d, addr + its->creadr,
                                          command, sizeof(command), false);
         if ( ret )
             return ret;