From nobody Fri May 17 11:58:49 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 170064673761815.034204694263735; Wed, 22 Nov 2023 01:52:17 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.638585.995306 (Exim 4.92) (envelope-from ) id 1r5jtd-0002Vx-26; Wed, 22 Nov 2023 09:51:49 +0000 Received: by outflank-mailman (output) from mailman id 638585.995306; Wed, 22 Nov 2023 09:51:49 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r5jtc-0002Vm-U9; Wed, 22 Nov 2023 09:51:48 +0000 Received: by outflank-mailman (input) for mailman id 638585; Wed, 22 Nov 2023 09:51:47 +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 1r5jtb-0002Gw-T8 for xen-devel@lists.xenproject.org; Wed, 22 Nov 2023 09:51:47 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id bfbc5062-891c-11ee-98e1-6d05b1d4d9a1; Wed, 22 Nov 2023 10:51:46 +0100 (CET) Received: from Dell.bugseng.com (unknown [37.163.203.136]) by support.bugseng.com (Postfix) with ESMTPSA id 95A834EE0C91; Wed, 22 Nov 2023 10:51:45 +0100 (CET) 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: bfbc5062-891c-11ee-98e1-6d05b1d4d9a1 From: Federico Serafini To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Federico Serafini , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu Subject: [XEN PATCH v4 1/2] x86/mm: preparation work to uniform modify_xen_mappings* interfaces Date: Wed, 22 Nov 2023 10:51:28 +0100 Message-Id: <8f318ade9277b316a6f91df3b75a593d662ac586.1700645120.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: 1700646739037100001 Content-Type: text/plain; charset="utf-8" The objective is to use parameter name "nf" to denote "new flags" in all the modify_xen_mappings* functions. Since modify_xen_mappings_lite() is currently using "nf" as identifier for a local variable, bad things could happen if new uses of such variable are committed while a renaming patch is waiting for the approval. To avoid such danger, as first thing rename the local variable from "nf" to "flags". No functional change. Suggested-by: Jan Beulich Signed-off-by: Federico Serafini Acked-by: Jan Beulich Reviewed-by: Stefano Stabellini --- xen/arch/x86/mm.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index 39544bd9f9..42c957c40e 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -5903,15 +5903,15 @@ int destroy_xen_mappings(unsigned long s, unsigned = long e) void init_or_livepatch modify_xen_mappings_lite( unsigned long s, unsigned long e, unsigned int _nf) { - unsigned long v =3D s, fm, nf; + unsigned long v =3D s, fm, flags; =20 /* Set of valid PTE bits which may be altered. */ #define FLAGS_MASK (_PAGE_NX|_PAGE_DIRTY|_PAGE_ACCESSED|_PAGE_RW|_PAGE_PRE= SENT) fm =3D put_pte_flags(FLAGS_MASK); - nf =3D put_pte_flags(_nf & FLAGS_MASK); + flags =3D put_pte_flags(_nf & FLAGS_MASK); #undef FLAGS_MASK =20 - ASSERT(nf & _PAGE_PRESENT); + ASSERT(flags & _PAGE_PRESENT); ASSERT(IS_ALIGNED(s, PAGE_SIZE) && s >=3D XEN_VIRT_START); ASSERT(IS_ALIGNED(e, PAGE_SIZE) && e <=3D XEN_VIRT_END); =20 @@ -5925,7 +5925,7 @@ void init_or_livepatch modify_xen_mappings_lite( =20 if ( l2e_get_flags(l2e) & _PAGE_PSE ) { - l2e_write_atomic(pl2e, l2e_from_intpte((l2e.l2 & ~fm) | nf)); + l2e_write_atomic(pl2e, l2e_from_intpte((l2e.l2 & ~fm) | flags)= ); =20 v +=3D 1UL << L2_PAGETABLE_SHIFT; continue; @@ -5943,7 +5943,8 @@ void init_or_livepatch modify_xen_mappings_lite( =20 ASSERT(l1f & _PAGE_PRESENT); =20 - l1e_write_atomic(pl1e, l1e_from_intpte((l1e.l1 & ~fm) | nf= )); + l1e_write_atomic(pl1e, + l1e_from_intpte((l1e.l1 & ~fm) | flags)); =20 v +=3D 1UL << L1_PAGETABLE_SHIFT; =20 --=20 2.34.1 From nobody Fri May 17 11:58:49 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 1700646730994979.576898453756; Wed, 22 Nov 2023 01:52:10 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.638586.995316 (Exim 4.92) (envelope-from ) id 1r5jte-0002kx-80; Wed, 22 Nov 2023 09:51:50 +0000 Received: by outflank-mailman (output) from mailman id 638586.995316; Wed, 22 Nov 2023 09:51: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 1r5jte-0002kq-5I; Wed, 22 Nov 2023 09:51:50 +0000 Received: by outflank-mailman (input) for mailman id 638586; Wed, 22 Nov 2023 09:51:48 +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 1r5jtc-0002Gw-TK for xen-devel@lists.xenproject.org; Wed, 22 Nov 2023 09:51:48 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id c0c47e92-891c-11ee-98e1-6d05b1d4d9a1; Wed, 22 Nov 2023 10:51:48 +0100 (CET) Received: from Dell.bugseng.com (unknown [37.163.203.136]) by support.bugseng.com (Postfix) with ESMTPSA id 820B74EE0C92; Wed, 22 Nov 2023 10:51:46 +0100 (CET) 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: c0c47e92-891c-11ee-98e1-6d05b1d4d9a1 From: Federico Serafini To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Federico Serafini , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Andrew Cooper , George Dunlap , Jan Beulich , Wei Liu , Shawn Anastasio , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [XEN PATCH v4 2/2] xen/mm: address violations of MISRA C:2012 Rules 8.2 and 8.3 Date: Wed, 22 Nov 2023 10:51:29 +0100 Message-Id: <9a73c479f3a9b2a3f796f8f65de3b3feb735c56d.1700645120.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: 1700646733213100001 Content-Type: text/plain; charset="utf-8" Add missing parameter names and uniform the interfaces of modify_xen_mappings() and modify_xen_mappings_lite(). No functional change. Signed-off-by: Federico Serafini Acked-by: Jan Beulich Reviewed-by: Stefano Stabellini --- This patch depends on patch 1/2 of the same series. --- xen/arch/arm/mmu/pt.c | 4 ++-- xen/arch/ppc/mm-radix.c | 2 +- xen/arch/x86/mm.c | 4 ++-- xen/include/xen/mm.h | 16 +++++++++------- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/xen/arch/arm/mmu/pt.c b/xen/arch/arm/mmu/pt.c index e6fc5ed45a..a7755728ae 100644 --- a/xen/arch/arm/mmu/pt.c +++ b/xen/arch/arm/mmu/pt.c @@ -718,12 +718,12 @@ int destroy_xen_mappings(unsigned long s, unsigned lo= ng e) return xen_pt_update(s, INVALID_MFN, (e - s) >> PAGE_SHIFT, 0); } =20 -int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int fla= gs) +int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf) { ASSERT(IS_ALIGNED(s, PAGE_SIZE)); ASSERT(IS_ALIGNED(e, PAGE_SIZE)); ASSERT(s <=3D e); - return xen_pt_update(s, INVALID_MFN, (e - s) >> PAGE_SHIFT, flags); + return xen_pt_update(s, INVALID_MFN, (e - s) >> PAGE_SHIFT, nf); } =20 /* diff --git a/xen/arch/ppc/mm-radix.c b/xen/arch/ppc/mm-radix.c index 11d0f27b60..daa411a6fa 100644 --- a/xen/arch/ppc/mm-radix.c +++ b/xen/arch/ppc/mm-radix.c @@ -271,7 +271,7 @@ void __init setup_initial_pagetables(void) */ unsigned long __read_mostly frametable_base_pdx; =20 -void put_page(struct page_info *p) +void put_page(struct page_info *page) { BUG_ON("unimplemented"); } diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index 42c957c40e..0a66db10b9 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -5901,14 +5901,14 @@ int destroy_xen_mappings(unsigned long s, unsigned = long e) * a problem. */ void init_or_livepatch modify_xen_mappings_lite( - unsigned long s, unsigned long e, unsigned int _nf) + unsigned long s, unsigned long e, unsigned int nf) { unsigned long v =3D s, fm, flags; =20 /* Set of valid PTE bits which may be altered. */ #define FLAGS_MASK (_PAGE_NX|_PAGE_DIRTY|_PAGE_ACCESSED|_PAGE_RW|_PAGE_PRE= SENT) fm =3D put_pte_flags(FLAGS_MASK); - flags =3D put_pte_flags(_nf & FLAGS_MASK); + flags =3D put_pte_flags(nf & FLAGS_MASK); #undef FLAGS_MASK =20 ASSERT(flags & _PAGE_PRESENT); diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h index 8b9618609f..d0682c9da5 100644 --- a/xen/include/xen/mm.h +++ b/xen/include/xen/mm.h @@ -71,9 +71,10 @@ =20 struct page_info; =20 -void put_page(struct page_info *); -bool __must_check get_page(struct page_info *, const struct domain *); -struct domain *__must_check page_get_owner_and_reference(struct page_info = *); +void put_page(struct page_info *page); +bool __must_check get_page(struct page_info *page, + const struct domain *domain); +struct domain *__must_check page_get_owner_and_reference(struct page_info = *page); =20 /* Boot-time allocator. Turns into generic allocator after bootstrap. */ void init_boot_pages(paddr_t ps, paddr_t pe); @@ -110,8 +111,9 @@ int map_pages_to_xen( unsigned long nr_mfns, unsigned int flags); /* Alter the permissions of a range of Xen virtual address space. */ -int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int fla= gs); -void modify_xen_mappings_lite(unsigned long s, unsigned long e, unsigned i= nt flags); +int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf); +void modify_xen_mappings_lite(unsigned long s, unsigned long e, + unsigned int nf); int destroy_xen_mappings(unsigned long s, unsigned long e); /* Retrieve the MFN mapped by VA in Xen virtual address space. */ mfn_t xen_map_to_mfn(unsigned long va); @@ -135,7 +137,7 @@ void free_domheap_pages(struct page_info *pg, unsigned = int order); unsigned long avail_domheap_pages_region( unsigned int node, unsigned int min_width, unsigned int max_width); unsigned long avail_domheap_pages(void); -unsigned long avail_node_heap_pages(unsigned int); +unsigned long avail_node_heap_pages(unsigned int nodeid); #define alloc_domheap_page(d,f) (alloc_domheap_pages(d,0,f)) #define free_domheap_page(p) (free_domheap_pages(p,0)) unsigned int online_page(mfn_t mfn, uint32_t *status); @@ -528,7 +530,7 @@ static inline unsigned int get_order_from_pages(unsigne= d long nr_pages) return order; } =20 -void scrub_one_page(struct page_info *); +void scrub_one_page(struct page_info *pg); =20 #ifndef arch_free_heap_page #define arch_free_heap_page(d, pg) \ --=20 2.34.1