From patchwork Fri Oct 6 08:26:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicola Vetrini X-Patchwork-Id: 13411127 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 F377CE92FF9 for ; Fri, 6 Oct 2023 08:26:35 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.613309.953828 (Exim 4.92) (envelope-from ) id 1qogAE-0008Ma-VB; Fri, 06 Oct 2023 08:26:26 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 613309.953828; Fri, 06 Oct 2023 08:26:26 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qogAE-0008L1-Pl; Fri, 06 Oct 2023 08:26:26 +0000 Received: by outflank-mailman (input) for mailman id 613309; Fri, 06 Oct 2023 08:26:24 +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 1qogAC-0006Fk-LE for xen-devel@lists.xenproject.org; Fri, 06 Oct 2023 08:26:24 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 085ea74b-6422-11ee-98d3-6d05b1d4d9a1; Fri, 06 Oct 2023 10:26:22 +0200 (CEST) Received: from nico.bugseng.com (unknown [147.123.100.131]) by support.bugseng.com (Postfix) with ESMTPSA id DEEA04EE0C88; Fri, 6 Oct 2023 10:26:21 +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: 085ea74b-6422-11ee-98d3-6d05b1d4d9a1 From: Nicola Vetrini To: xen-devel@lists.xenproject.org Cc: sstabellini@kernel.org, michal.orzel@amd.com, xenia.ragiadakou@amd.com, ayan.kumar.halder@amd.com, consulting@bugseng.com, jbeulich@suse.com, andrew.cooper3@citrix.com, roger.pau@citrix.com, Nicola Vetrini , Paul Durrant , George Dunlap , Julien Grall , Wei Liu Subject: [XEN PATCH][for-4.19 8/9] xen/types: address Rule 10.1 for DECLARE_BITMAP use Date: Fri, 6 Oct 2023 10:26:11 +0200 Message-Id: <9642dcb4ab51ec9eaeedf16056fbcd946a3efbea.1696514677.git.nicola.vetrini@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Given its use in the declaration 'DECLARE_BITMAP(features, IOMMU_FEAT_count)' the argument 'bits' has essential type 'enum iommu_feature', which is not allowed by the Rule as an operand to the addition operator in macro 'BITS_TO_LONGS'. A comment in BITS_TO_LONGS is added to make it clear that values passed are meant to be positive. Signed-off-by: Nicola Vetrini --- xen/include/xen/iommu.h | 2 +- xen/include/xen/types.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h index 0e747b0bbc1c..34aa0b9b5b81 100644 --- a/xen/include/xen/iommu.h +++ b/xen/include/xen/iommu.h @@ -360,7 +360,7 @@ struct domain_iommu { #endif /* Features supported by the IOMMU */ - DECLARE_BITMAP(features, IOMMU_FEAT_count); + DECLARE_BITMAP(features, (int)IOMMU_FEAT_count); /* Does the guest share HAP mapping with the IOMMU? */ bool hap_pt_share; diff --git a/xen/include/xen/types.h b/xen/include/xen/types.h index aea259db1ef2..936e83d333a0 100644 --- a/xen/include/xen/types.h +++ b/xen/include/xen/types.h @@ -22,6 +22,7 @@ typedef signed long ssize_t; typedef __PTRDIFF_TYPE__ ptrdiff_t; +/* Users of this macro are expected to pass a positive value */ #define BITS_TO_LONGS(bits) \ (((bits)+BITS_PER_LONG-1)/BITS_PER_LONG) #define DECLARE_BITMAP(name,bits) \