From patchwork Fri May 10 12:32:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alessandro Zucchelli X-Patchwork-Id: 13661560 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A4255C25B10 for ; Fri, 10 May 2024 12:32:45 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.719856.1122706 (Exim 4.92) (envelope-from ) id 1s5PQS-0005eG-Cu; Fri, 10 May 2024 12:32:36 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 719856.1122706; Fri, 10 May 2024 12:32:36 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1s5PQS-0005e9-9g; Fri, 10 May 2024 12:32:36 +0000 Received: by outflank-mailman (input) for mailman id 719856; Fri, 10 May 2024 12:32:34 +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 1s5PQQ-0005e3-RC for xen-devel@lists.xenproject.org; Fri, 10 May 2024 12:32:34 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 5f767244-0ec9-11ef-b4bb-af5377834399; Fri, 10 May 2024 14:32:32 +0200 (CEST) Received: from LAPTOP-EFA9O91E.localdomain (host-87-7-28-64.retail.telecomitalia.it [87.7.28.64]) by support.bugseng.com (Postfix) with ESMTPSA id AFE114EE073C; Fri, 10 May 2024 14:32:31 +0200 (CEST) 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: 5f767244-0ec9-11ef-b4bb-af5377834399 From: Alessandro Zucchelli To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Alessandro Zucchelli , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Tamas K Lengyel , Alexandru Isaila , Petre Pircalabu Subject: [XEN PATCH v3] arm/mem_access: add conditional build of mem_access.c Date: Fri, 10 May 2024 14:32:11 +0200 Message-Id: X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 In order to comply to MISRA C:2012 Rule 8.4 for ARM the following changes are done: revert preprocessor conditional changes to xen/mem_access.h which had it build unconditionally, add conditional build for xen/mem_access.c as well and provide stubs in asm/mem_access.h for the users of this header. Signed-off-by: Alessandro Zucchelli Acked-by: Tamas K Lengyel --- Changes from v2: Stylistic changes to code aimed to respect xen's coding guidelines. --- Changes from v1: Reverted preprocessor conditional changes to xen/mem_access.h; added conditional build for xen/mem_access.c; provided stubs for asm/mem_access.h functions --- xen/arch/arm/Makefile | 2 +- xen/arch/arm/include/asm/mem_access.h | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile index 7b1350e2ef..45dc29ea53 100644 --- a/xen/arch/arm/Makefile +++ b/xen/arch/arm/Makefile @@ -37,7 +37,7 @@ obj-$(CONFIG_IOREQ_SERVER) += ioreq.o obj-y += irq.o obj-y += kernel.init.o obj-$(CONFIG_LIVEPATCH) += livepatch.o -obj-y += mem_access.o +obj-$(CONFIG_MEM_ACCESS) += mem_access.o obj-y += mm.o obj-y += monitor.o obj-y += p2m.o diff --git a/xen/arch/arm/include/asm/mem_access.h b/xen/arch/arm/include/asm/mem_access.h index 35ed0ad154..abac8032fc 100644 --- a/xen/arch/arm/include/asm/mem_access.h +++ b/xen/arch/arm/include/asm/mem_access.h @@ -17,6 +17,8 @@ #ifndef _ASM_ARM_MEM_ACCESS_H #define _ASM_ARM_MEM_ACCESS_H +#include + static inline bool p2m_mem_access_emulate_check(struct vcpu *v, const struct vm_event_st *rsp) @@ -35,12 +37,28 @@ static inline bool p2m_mem_access_sanity_check(struct domain *d) * Send mem event based on the access. Boolean return value indicates if trap * needs to be injected into guest. */ +#ifdef CONFIG_MEM_ACCESS 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, const struct vcpu *v); +#else + +static inline bool +p2m_mem_access_check(paddr_t gpa, vaddr_t gla, const struct npfec npfec) +{ + return false; +} + +static inline struct page_info* +p2m_mem_access_check_and_get_page(vaddr_t gva, unsigned long flag, + const struct vcpu *v) +{ + return NULL; +} +#endif /*CONFIG_MEM_ACCESS*/ #endif /* _ASM_ARM_MEM_ACCESS_H */ /*