From nobody Sat May 18 05:04:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1687773185179561.4055975870165; Mon, 26 Jun 2023 02:53:05 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.555380.867111 (Exim 4.92) (envelope-from ) id 1qDito-0000fk-9S; Mon, 26 Jun 2023 09:52:44 +0000 Received: by outflank-mailman (output) from mailman id 555380.867111; Mon, 26 Jun 2023 09:52:44 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qDito-0000fd-6a; Mon, 26 Jun 2023 09:52:44 +0000 Received: by outflank-mailman (input) for mailman id 555380; Mon, 26 Jun 2023 09:52:43 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qDitn-0000Ov-1P for xen-devel@lists.xenproject.org; Mon, 26 Jun 2023 09:52:43 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 30c1f93d-1407-11ee-8611-37d641c3527e; Mon, 26 Jun 2023 11:52:41 +0200 (CEST) Received: from Dell.bugseng.com (unknown [37.163.27.55]) by support.bugseng.com (Postfix) with ESMTPSA id C6D044EE0739; Mon, 26 Jun 2023 11:52:39 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 30c1f93d-1407-11ee-8611-37d641c3527e From: Federico Serafini To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Federico Serafini , Stefano Stabellini , Julien Grall , Bertrand Marquis , Volodymyr Babchuk , Michal Orzel , Xenia Ragiadakou , Ayan Kumar Halder Subject: [XEN PATCH v3 1/6] xen/arm: change names in function access_guest_memory_by_ipa(). Date: Mon, 26 Jun 2023 11:52:13 +0200 Message-Id: <89e96c5d4b95a35540757235e838fd65f5e4077e.1687771796.git.federico.serafini@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1687773186542100001 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Julien Grall --- 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(-) 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 |=3D (gva & mask) >> 18; =20 /* Access the guest's memory to read only one PTE. */ - ret =3D access_guest_memory_by_ipa(d, paddr, &pte, sizeof(short_desc_t= ), false); + ret =3D access_guest_memory_by_gpa(d, paddr, &pte, sizeof(short_desc_t= ), false); if ( ret ) return false; =20 @@ -110,7 +110,7 @@ static bool guest_walk_sd(const struct vcpu *v, paddr =3D ((paddr_t)pte.walk.base << 10) | ((gva & mask) >> 10); =20 /* Access the guest's memory to read only one PTE. */ - ret =3D access_guest_memory_by_ipa(d, paddr, &pte, sizeof(short_de= sc_t), false); + ret =3D access_guest_memory_by_gpa(d, paddr, &pte, sizeof(short_de= sc_t), false); if ( ret ) return false; =20 @@ -481,7 +481,7 @@ static bool guest_walk_ld(const struct vcpu *v, paddr |=3D LPAE_TABLE_INDEX_GS(grainsizes[gran], level, gva) << 3; =20 /* Access the guest's memory to read only one PTE. */ - ret =3D access_guest_memory_by_ipa(d, paddr, &pte, sizeof(lpae_t),= false); + ret =3D access_guest_memory_by_gpa(d, paddr, &pte, sizeof(lpae_t),= false); if ( ret ) return false; =20 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 do= main *d, COPY_to_guest | COPY_ipa | COPY_flush_dcache); } =20 -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 doma= in *d, void *buf, unsigned int len); =20 -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); =20 #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, =20 map_xen_arg(call); =20 - 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, =20 shm_rpc->xen_arg =3D __map_domain_page(shm_rpc->xen_arg_pg); =20 - 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_param= s), @@ -1329,7 +1329,7 @@ static bool issue_rpc_cmd_free(struct optee_domain *c= tx, shm_rpc->xen_arg->params[0].u.value.a =3D call->rpc_buffer_type; shm_rpc->xen_arg->params[0].u.value.b =3D cookie; =20 - 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 =3D __map_domain_page(shm_rpc->xen_arg_pg); =20 /* 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, } =20 /* 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 =3D 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, uin= t16_t collid, if ( collid >=3D its->max_collections ) return -ENOENT; =20 - return access_guest_memory_by_ipa(its->d, + return access_guest_memory_by_gpa(its->d, addr + collid * sizeof(coll_table_en= try_t), &vcpu_id, sizeof(vcpu_id), true); } @@ -139,7 +139,7 @@ static struct vcpu *get_vcpu_from_collection(struct vir= t_its *its, if ( collid >=3D its->max_collections ) return NULL; =20 - ret =3D access_guest_memory_by_ipa(its->d, + ret =3D access_guest_memory_by_gpa(its->d, addr + collid * sizeof(coll_table_ent= ry_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, ui= nt32_t devid, if ( devid >=3D its->max_devices ) return -ENOENT; =20 - return access_guest_memory_by_ipa(its->d, + return access_guest_memory_by_gpa(its->d, addr + devid * sizeof(dev_table_entr= y_t), &itt_entry, sizeof(itt_entry), true); } @@ -179,7 +179,7 @@ static int its_get_itt(struct virt_its *its, uint32_t d= evid, if ( devid >=3D its->max_devices ) return -EINVAL; =20 - return access_guest_memory_by_ipa(its->d, + return access_guest_memory_by_gpa(its->d, addr + devid * sizeof(dev_table_entr= y_t), itt, sizeof(*itt), false); } @@ -226,7 +226,7 @@ static bool read_itte(struct virt_its *its, uint32_t de= vid, uint32_t evid, if ( addr =3D=3D INVALID_PADDR ) return false; =20 - if ( access_guest_memory_by_ipa(its->d, addr, &itte, sizeof(itte), fal= se) ) + if ( access_guest_memory_by_gpa(its->d, addr, &itte, sizeof(itte), fal= se) ) return false; =20 vcpu =3D get_vcpu_from_collection(its, itte.collection); @@ -260,7 +260,7 @@ static bool write_itte(struct virt_its *its, uint32_t d= evid, itte.collection =3D collid; itte.vlpi =3D vlpi; =20 - if ( access_guest_memory_by_ipa(its->d, addr, &itte, sizeof(itte), tru= e) ) + if ( access_guest_memory_by_gpa(its->d, addr, &itte, sizeof(itte), tru= e) ) return false; =20 return true; @@ -405,7 +405,7 @@ static int update_lpi_property(struct domain *d, struct= pending_irq *p) =20 addr =3D d->arch.vgic.rdist_propbase & GENMASK(51, 12); =20 - ret =3D access_guest_memory_by_ipa(d, addr + p->irq - LPI_OFFSET, + ret =3D 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, struc= t virt_its *its) { int ret; =20 - ret =3D access_guest_memory_by_ipa(d, addr + its->creadr, + ret =3D access_guest_memory_by_gpa(d, addr + its->creadr, command, sizeof(command), false); if ( ret ) return ret; --=20 2.34.1 From nobody Sat May 18 05:04:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1687773187574652.3330941004288; Mon, 26 Jun 2023 02:53:07 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.555382.867121 (Exim 4.92) (envelope-from ) id 1qDitq-0000wD-HU; Mon, 26 Jun 2023 09:52:46 +0000 Received: by outflank-mailman (output) from mailman id 555382.867121; Mon, 26 Jun 2023 09:52:46 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qDitq-0000w6-DJ; Mon, 26 Jun 2023 09:52:46 +0000 Received: by outflank-mailman (input) for mailman id 555382; Mon, 26 Jun 2023 09:52:45 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qDitp-0000fc-1A for xen-devel@lists.xenproject.org; Mon, 26 Jun 2023 09:52:45 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 31f811af-1407-11ee-b237-6b7b168915f2; Mon, 26 Jun 2023 11:52:43 +0200 (CEST) Received: from Dell.bugseng.com (unknown [37.163.27.55]) by support.bugseng.com (Postfix) with ESMTPSA id 1F0A24EE073D; Mon, 26 Jun 2023 11:52:41 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 31f811af-1407-11ee-b237-6b7b168915f2 From: Federico Serafini To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Federico Serafini , Stefano Stabellini , Julien Grall , Bertrand Marquis , Volodymyr Babchuk , Michal Orzel , Xenia Ragiadakou , Ayan Kumar Halder Subject: [XEN PATCH v3 2/6] xen/arm: change parameter name 'vcpu' in domain() function definition. Date: Mon, 26 Jun 2023 11:52:14 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1687773189976100001 Content-Type: text/plain; charset="utf-8" In the current version of domain() function, the declaration (correctly) uses the parameter name 'v' while the definition uses the parameter name 'vcpu'. Since it is common to use 'v' to denote a vCPU, change the parameter name 'vcpu' of function definition to 'v', thus fixing a violation of MISRA C:2012 Rule 8.3. Signed-off-by: Federico Serafini Reviewed-by: Julien Grall --- xen/arch/arm/domain.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index add9929b79..8c18e92079 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -1155,15 +1155,15 @@ void vcpu_block_unless_event_pending(struct vcpu *v) vcpu_unblock(current); } =20 -void vcpu_kick(struct vcpu *vcpu) +void vcpu_kick(struct vcpu *v) { - bool running =3D vcpu->is_running; + bool running =3D v->is_running; =20 - vcpu_unblock(vcpu); - if ( running && vcpu !=3D current ) + vcpu_unblock(v); + if ( running && v !=3D current ) { perfc_incr(vcpu_kick); - smp_send_event_check_mask(cpumask_of(vcpu->processor)); + smp_send_event_check_mask(cpumask_of(v->processor)); } } =20 --=20 2.34.1 From nobody Sat May 18 05:04:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1687773193880791.572142823198; Mon, 26 Jun 2023 02:53:13 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.555384.867130 (Exim 4.92) (envelope-from ) id 1qDits-0001D7-Nd; Mon, 26 Jun 2023 09:52:48 +0000 Received: by outflank-mailman (output) from mailman id 555384.867130; Mon, 26 Jun 2023 09:52:48 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qDits-0001Cy-Kx; Mon, 26 Jun 2023 09:52:48 +0000 Received: by outflank-mailman (input) for mailman id 555384; Mon, 26 Jun 2023 09:52:46 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qDitq-0000Ov-M8 for xen-devel@lists.xenproject.org; Mon, 26 Jun 2023 09:52:46 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 331ca6ce-1407-11ee-8611-37d641c3527e; Mon, 26 Jun 2023 11:52:45 +0200 (CEST) Received: from Dell.bugseng.com (unknown [37.163.27.55]) by support.bugseng.com (Postfix) with ESMTPSA id 501624EE0741; Mon, 26 Jun 2023 11:52:43 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 331ca6ce-1407-11ee-8611-37d641c3527e From: Federico Serafini To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Federico Serafini , Stefano Stabellini , Julien Grall , Bertrand Marquis , Volodymyr Babchuk , Michal Orzel , Xenia Ragiadakou , Ayan Kumar Halder Subject: [XEN PATCH v3 3/6] xen/arm: change parameter name 'pa' in ioremap_addr() definition. Date: Mon, 26 Jun 2023 11:52:15 +0200 Message-Id: <74fdc69fd08d1a0e35d4f226ea0c47a6f6a3a241.1687771796.git.federico.serafini@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1687773195760100001 Content-Type: text/plain; charset="utf-8" In the current version of ioremap_addr() function, the declaration uses the parameter name 'start' (consistenly with the other ioremap_* function declarations), while the definition uses the parameter name 'pa'. Change the parameter name 'pa' of function definition to 'start', thus fixing a violation of MISRA C:2012 Rule 8.3 and keeping the consistency with other ioremap_* functions. Signed-off-by: Federico Serafini Reviewed-by: Julien Grall --- xen/arch/arm/mm.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index e460249736..2e9860a754 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -736,10 +736,10 @@ void *__init arch_vmap_virt_end(void) * This function should only be used to remap device address ranges * TODO: add a check to verify this assumption */ -void *ioremap_attr(paddr_t pa, size_t len, unsigned int attributes) +void *ioremap_attr(paddr_t start, size_t len, unsigned int attributes) { - mfn_t mfn =3D _mfn(PFN_DOWN(pa)); - unsigned int offs =3D pa & (PAGE_SIZE - 1); + mfn_t mfn =3D _mfn(PFN_DOWN(start)); + unsigned int offs =3D start & (PAGE_SIZE - 1); unsigned int nr =3D PFN_UP(offs + len); void *ptr =3D __vmap(&mfn, nr, 1, 1, attributes, VMAP_DEFAULT); =20 @@ -1579,7 +1579,7 @@ void put_page_type(struct page_info *page) return; } =20 -int create_grant_host_mapping(unsigned long addr, mfn_t frame, +int create_grant_host_mapping(unsigned long gpaddr, mfn_t frame, unsigned int flags, unsigned int cache_flags) { int rc; @@ -1591,7 +1591,7 @@ int create_grant_host_mapping(unsigned long addr, mfn= _t frame, if ( flags & GNTMAP_readonly ) t =3D p2m_grant_map_ro; =20 - rc =3D guest_physmap_add_entry(current->domain, gaddr_to_gfn(addr), + rc =3D guest_physmap_add_entry(current->domain, gaddr_to_gfn(gpaddr), frame, 0, t); =20 if ( rc ) --=20 2.34.1 From nobody Sat May 18 05:04:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 168777319381629.223677326826305; Mon, 26 Jun 2023 02:53:13 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.555385.867141 (Exim 4.92) (envelope-from ) id 1qDitu-0001Tz-1U; Mon, 26 Jun 2023 09:52:50 +0000 Received: by outflank-mailman (output) from mailman id 555385.867141; Mon, 26 Jun 2023 09:52:50 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qDitt-0001Tq-UE; Mon, 26 Jun 2023 09:52:49 +0000 Received: by outflank-mailman (input) for mailman id 555385; Mon, 26 Jun 2023 09:52:48 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qDits-0000Ov-MW for xen-devel@lists.xenproject.org; Mon, 26 Jun 2023 09:52:48 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 344ca788-1407-11ee-8611-37d641c3527e; Mon, 26 Jun 2023 11:52:47 +0200 (CEST) Received: from Dell.bugseng.com (unknown [37.163.27.55]) by support.bugseng.com (Postfix) with ESMTPSA id 4170B4EE073F; Mon, 26 Jun 2023 11:52:45 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 344ca788-1407-11ee-8611-37d641c3527e From: Federico Serafini To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Federico Serafini , Stefano Stabellini , Julien Grall , Bertrand Marquis , Volodymyr Babchuk , Michal Orzel , Xenia Ragiadakou , Ayan Kumar Halder Subject: [XEN PATCH v3 4/6] xen/arm: vgic: change parameter name in 'init' and 'free' functions. Date: Mon, 26 Jun 2023 11:52:16 +0200 Message-Id: <0332cf060e181d60e249a004182be011f93602a2.1687771796.git.federico.serafini@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1687773196571100003 Content-Type: text/plain; charset="utf-8" In the current versions of vcpu_vgic_init() and vcpu_vgic_free(), the declarations (correctly) use the parameter name 'v' while the corresponding definitions use the parameter name 'vcpu'. Since it is common to use 'v' to denote a vCPU, change the parameter name 'vcpu' of function definitions to 'v', thus fixing violations of MISRA C:2012 Rule 8.3. Signed-off-by: Federico Serafini Reviewed-by: Julien Grall --- xen/arch/arm/vgic/vgic-init.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/xen/arch/arm/vgic/vgic-init.c b/xen/arch/arm/vgic/vgic-init.c index ea739d081e..76b85ea823 100644 --- a/xen/arch/arm/vgic/vgic-init.c +++ b/xen/arch/arm/vgic/vgic-init.c @@ -196,16 +196,16 @@ int domain_vgic_init(struct domain *d, unsigned int n= r_spis) * vcpu_vgic_init() - Register VCPU-specific KVM iodevs * was: kvm_vgic_vcpu_init() * Xen: adding vgic_vx_enable() call - * @vcpu: pointer to the VCPU being created and initialized + * @v: pointer to the VCPU being created and initialized */ -int vcpu_vgic_init(struct vcpu *vcpu) +int vcpu_vgic_init(struct vcpu *v) { int ret =3D 0; =20 - vgic_vcpu_early_init(vcpu); + vgic_vcpu_early_init(v); =20 if ( gic_hw_version() =3D=3D GIC_V2 ) - vgic_v2_enable(vcpu); + vgic_v2_enable(v); else ret =3D -ENXIO; =20 @@ -239,9 +239,9 @@ void domain_vgic_free(struct domain *d) dist->nr_spis =3D 0; } =20 -int vcpu_vgic_free(struct vcpu *vcpu) +int vcpu_vgic_free(struct vcpu *v) { - struct vgic_cpu *vgic_cpu =3D &vcpu->arch.vgic; + struct vgic_cpu *vgic_cpu =3D &v->arch.vgic; =20 INIT_LIST_HEAD(&vgic_cpu->ap_list_head); =20 --=20 2.34.1 From nobody Sat May 18 05:04:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1687773198346660.836693262143; Mon, 26 Jun 2023 02:53:18 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.555386.867151 (Exim 4.92) (envelope-from ) id 1qDitv-0001l1-9s; Mon, 26 Jun 2023 09:52:51 +0000 Received: by outflank-mailman (output) from mailman id 555386.867151; Mon, 26 Jun 2023 09:52:51 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qDitv-0001kq-5v; Mon, 26 Jun 2023 09:52:51 +0000 Received: by outflank-mailman (input) for mailman id 555386; Mon, 26 Jun 2023 09:52:50 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qDitu-0000Ov-62 for xen-devel@lists.xenproject.org; Mon, 26 Jun 2023 09:52:50 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 3518813d-1407-11ee-8611-37d641c3527e; Mon, 26 Jun 2023 11:52:48 +0200 (CEST) Received: from Dell.bugseng.com (unknown [37.163.27.55]) by support.bugseng.com (Postfix) with ESMTPSA id 1A37A4EE0740; Mon, 26 Jun 2023 11:52:47 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 3518813d-1407-11ee-8611-37d641c3527e From: Federico Serafini To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Federico Serafini , Stefano Stabellini , Julien Grall , Bertrand Marquis , Volodymyr Babchuk , Michal Orzel , Xenia Ragiadakou , Ayan Kumar Halder Subject: [XEN PATCH v3 5/6] xen/arm: make parameter names of function declarations consistent. Date: Mon, 26 Jun 2023 11:52:17 +0200 Message-Id: <5d0075418f0674e0ca1f63744b87b27085a0d865.1687771796.git.federico.serafini@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1687773199795100003 Content-Type: text/plain; charset="utf-8" Change the parameter names of function declarations to be consistent with the names used in the corresponding function definitions, thus fixing violations of MISRA C:2012 Rule 8.3. Signed-off-by: Federico Serafini Reviewed-by: Julien Grall --- xen/arch/arm/include/asm/fixmap.h | 2 +- xen/arch/arm/include/asm/gic.h | 2 +- xen/arch/arm/include/asm/gic_v3_its.h | 5 +++-- xen/arch/arm/include/asm/grant_table.h | 2 +- xen/arch/arm/include/asm/guest_access.h | 2 +- xen/arch/arm/include/asm/irq.h | 2 +- xen/arch/arm/include/asm/regs.h | 2 +- xen/arch/arm/include/asm/vgic.h | 4 ++-- 8 files changed, 11 insertions(+), 10 deletions(-) diff --git a/xen/arch/arm/include/asm/fixmap.h b/xen/arch/arm/include/asm/f= ixmap.h index d0c9a52c8c..734eb9b1d4 100644 --- a/xen/arch/arm/include/asm/fixmap.h +++ b/xen/arch/arm/include/asm/fixmap.h @@ -30,7 +30,7 @@ extern lpae_t xen_fixmap[XEN_PT_LPAE_ENTRIES]; =20 /* Map a page in a fixmap entry */ -extern void set_fixmap(unsigned int map, mfn_t mfn, unsigned int attribute= s); +extern void set_fixmap(unsigned int map, mfn_t mfn, unsigned int flags); /* Remove a mapping from a fixmap entry */ extern void clear_fixmap(unsigned int map); =20 diff --git a/xen/arch/arm/include/asm/gic.h b/xen/arch/arm/include/asm/gic.h index 76e3fa5dc4..f1ef347edc 100644 --- a/xen/arch/arm/include/asm/gic.h +++ b/xen/arch/arm/include/asm/gic.h @@ -257,7 +257,7 @@ int gic_remove_irq_from_guest(struct domain *d, unsigne= d int virq, extern void gic_clear_pending_irqs(struct vcpu *v); =20 extern void init_maintenance_interrupt(void); -extern void gic_raise_guest_irq(struct vcpu *v, unsigned int irq, +extern void gic_raise_guest_irq(struct vcpu *v, unsigned int virtual_irq, unsigned int priority); extern void gic_raise_inflight_irq(struct vcpu *v, unsigned int virtual_ir= q); =20 diff --git a/xen/arch/arm/include/asm/gic_v3_its.h b/xen/arch/arm/include/a= sm/gic_v3_its.h index fae3f6ecef..c24d4752d0 100644 --- a/xen/arch/arm/include/asm/gic_v3_its.h +++ b/xen/arch/arm/include/asm/gic_v3_its.h @@ -190,8 +190,9 @@ struct pending_irq *gicv3_its_get_event_pending_irq(str= uct domain *d, uint32_t eventid); int gicv3_remove_guest_event(struct domain *d, paddr_t vdoorbell_address, uint32_t vdevid, uint32_t eventid); -struct pending_irq *gicv3_assign_guest_event(struct domain *d, paddr_t doo= rbell, - uint32_t devid, uint32_t even= tid, +struct pending_irq *gicv3_assign_guest_event(struct domain *d, + paddr_t vdoorbell_address, + uint32_t vdevid, uint32_t eve= ntid, uint32_t virt_lpi); void gicv3_lpi_update_host_entry(uint32_t host_lpi, int domain_id, uint32_t virt_lpi); diff --git a/xen/arch/arm/include/asm/grant_table.h b/xen/arch/arm/include/= asm/grant_table.h index e13dfeefa5..265e598e56 100644 --- a/xen/arch/arm/include/asm/grant_table.h +++ b/xen/arch/arm/include/asm/grant_table.h @@ -36,7 +36,7 @@ static inline bool gnttab_release_host_mappings(const str= uct domain *d) return true; } =20 -int create_grant_host_mapping(unsigned long gpaddr, mfn_t mfn, +int create_grant_host_mapping(unsigned long gpaddr, mfn_t frame, unsigned int flags, unsigned int cache_flags= ); int replace_grant_host_mapping(unsigned long gpaddr, mfn_t mfn, unsigned long new_gpaddr, unsigned int flag= s); diff --git a/xen/arch/arm/include/asm/guest_access.h b/xen/arch/arm/include= /asm/guest_access.h index 8278a45dbf..18c88b70d7 100644 --- a/xen/arch/arm/include/asm/guest_access.h +++ b/xen/arch/arm/include/asm/guest_access.h @@ -12,7 +12,7 @@ unsigned long raw_clear_guest(void *to, unsigned int len); =20 /* Copy data to guest physical address, then clean the region. */ unsigned long copy_to_guest_phys_flush_dcache(struct domain *d, - paddr_t phys, + paddr_t gpa, void *buf, unsigned int len); =20 diff --git a/xen/arch/arm/include/asm/irq.h b/xen/arch/arm/include/asm/irq.h index 11bc85d111..105b33b37d 100644 --- a/xen/arch/arm/include/asm/irq.h +++ b/xen/arch/arm/include/asm/irq.h @@ -76,7 +76,7 @@ void init_IRQ(void); =20 int route_irq_to_guest(struct domain *d, unsigned int virq, unsigned int irq, const char *devname); -int release_guest_irq(struct domain *d, unsigned int irq); +int release_guest_irq(struct domain *d, unsigned int virq); =20 void arch_move_irqs(struct vcpu *v); =20 diff --git a/xen/arch/arm/include/asm/regs.h b/xen/arch/arm/include/asm/reg= s.h index 0693a68131..ef34b38aa1 100644 --- a/xen/arch/arm/include/asm/regs.h +++ b/xen/arch/arm/include/asm/regs.h @@ -58,7 +58,7 @@ static inline bool guest_mode(const struct cpu_user_regs = *r) } =20 register_t get_user_reg(struct cpu_user_regs *regs, int reg); -void set_user_reg(struct cpu_user_regs *regs, int reg, register_t val); +void set_user_reg(struct cpu_user_regs *regs, int reg, register_t value); =20 #endif =20 diff --git a/xen/arch/arm/include/asm/vgic.h b/xen/arch/arm/include/asm/vgi= c.h index 328fd46d1b..aa9f49409e 100644 --- a/xen/arch/arm/include/asm/vgic.h +++ b/xen/arch/arm/include/asm/vgic.h @@ -355,8 +355,8 @@ bool vgic_evtchn_irq_pending(struct vcpu *v); int domain_vgic_register(struct domain *d, int *mmio_count); int domain_vgic_init(struct domain *d, unsigned int nr_spis); void domain_vgic_free(struct domain *d); -int vcpu_vgic_init(struct vcpu *vcpu); -int vcpu_vgic_free(struct vcpu *vcpu); +int vcpu_vgic_init(struct vcpu *v); +int vcpu_vgic_free(struct vcpu *v); =20 void vgic_inject_irq(struct domain *d, struct vcpu *v, unsigned int virq, bool level); --=20 2.34.1 From nobody Sat May 18 05:04:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1687773198077148.12496422698484; Mon, 26 Jun 2023 02:53:18 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.555387.867161 (Exim 4.92) (envelope-from ) id 1qDity-0002Ah-MS; Mon, 26 Jun 2023 09:52:54 +0000 Received: by outflank-mailman (output) from mailman id 555387.867161; Mon, 26 Jun 2023 09:52:54 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qDity-0002AW-I8; Mon, 26 Jun 2023 09:52:54 +0000 Received: by outflank-mailman (input) for mailman id 555387; Mon, 26 Jun 2023 09:52:51 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qDitv-0000Ov-J4 for xen-devel@lists.xenproject.org; Mon, 26 Jun 2023 09:52:51 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 36049170-1407-11ee-8611-37d641c3527e; Mon, 26 Jun 2023 11:52:50 +0200 (CEST) Received: from Dell.bugseng.com (unknown [37.163.27.55]) by support.bugseng.com (Postfix) with ESMTPSA id 6EE0D4EE0742; Mon, 26 Jun 2023 11:52:48 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 36049170-1407-11ee-8611-37d641c3527e From: Federico Serafini To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Federico Serafini , Stefano Stabellini , Julien Grall , Bertrand Marquis , Volodymyr Babchuk , Michal Orzel , Xenia Ragiadakou , Ayan Kumar Halder Subject: [XEN PATCH v3 6/6] xen/arm: change parameter names in replace_grant_host_mapping(). Date: Mon, 26 Jun 2023 11:52:18 +0200 Message-Id: <2c2b9b3c53e556945baab3dd387bf029e12434b6.1687771796.git.federico.serafini@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1687773199121100001 Content-Type: text/plain; charset="utf-8" In the current version of replace_grant_host_mapping() function, the declaration (correctly) uses the parameter names 'gpaddr' and 'new_gpaddr', while the definition uses the parameter names 'addr' and 'new_addr'. Change the parameter names of the definition to 'gpaddr' and 'new_gpaddr' so that it is clear what type of address is expected and violations of MISRA C:2012 Rule 8.3 are fixed. In both declaration and definition of function replace_grant_host_mapping() change the parameter name 'mfn' to 'frame', thus improving readability and keeping consistency with name used in create_grant_host_mapping(). Signed-off-by: Federico Serafini Reviewed-by: Julien Grall --- xen/arch/arm/include/asm/grant_table.h | 2 +- xen/arch/arm/mm.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/xen/arch/arm/include/asm/grant_table.h b/xen/arch/arm/include/= asm/grant_table.h index 265e598e56..f2d115b97d 100644 --- a/xen/arch/arm/include/asm/grant_table.h +++ b/xen/arch/arm/include/asm/grant_table.h @@ -38,7 +38,7 @@ static inline bool gnttab_release_host_mappings(const str= uct domain *d) =20 int create_grant_host_mapping(unsigned long gpaddr, mfn_t frame, unsigned int flags, unsigned int cache_flags= ); -int replace_grant_host_mapping(unsigned long gpaddr, mfn_t mfn, +int replace_grant_host_mapping(unsigned long gpaddr, mfn_t frame, unsigned long new_gpaddr, unsigned int flag= s); =20 /* diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index 2e9860a754..0a3e1f3b64 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -1600,17 +1600,17 @@ int create_grant_host_mapping(unsigned long gpaddr,= mfn_t frame, return GNTST_okay; } =20 -int replace_grant_host_mapping(unsigned long addr, mfn_t mfn, - unsigned long new_addr, unsigned int flags) +int replace_grant_host_mapping(unsigned long gpaddr, mfn_t frame, + unsigned long new_gpaddr, unsigned int flag= s) { - gfn_t gfn =3D gaddr_to_gfn(addr); + gfn_t gfn =3D gaddr_to_gfn(gpaddr); struct domain *d =3D current->domain; int rc; =20 - if ( new_addr !=3D 0 || (flags & GNTMAP_contains_pte) ) + if ( new_gpaddr !=3D 0 || (flags & GNTMAP_contains_pte) ) return GNTST_general_error; =20 - rc =3D guest_physmap_remove_page(d, gfn, mfn, 0); + rc =3D guest_physmap_remove_page(d, gfn, frame, 0); =20 return rc ? GNTST_general_error : GNTST_okay; } --=20 2.34.1