From patchwork Wed Jul 5 15:26:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simone Ballarin X-Patchwork-Id: 13302338 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 DF910C001B0 for ; Wed, 5 Jul 2023 15:27:49 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.559308.874216 (Exim 4.92) (envelope-from ) id 1qH4PY-0002Aw-Qq; Wed, 05 Jul 2023 15:27:20 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 559308.874216; Wed, 05 Jul 2023 15:27:20 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qH4PY-0002AB-Jh; Wed, 05 Jul 2023 15:27:20 +0000 Received: by outflank-mailman (input) for mailman id 559308; Wed, 05 Jul 2023 15:27:19 +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 1qH4PW-0001jW-Vl for xen-devel@lists.xenproject.org; Wed, 05 Jul 2023 15:27:18 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 6ca95199-1b48-11ee-8611-37d641c3527e; Wed, 05 Jul 2023 17:27:17 +0200 (CEST) Received: from beta.bugseng.com (unknown [37.163.248.64]) by support.bugseng.com (Postfix) with ESMTPSA id E85EF4EE0C8B; Wed, 5 Jul 2023 17:27:15 +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: 6ca95199-1b48-11ee-8611-37d641c3527e From: Simone Ballarin To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Gianluca Luparini , Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu , Stefano Stabellini , Michal Orzel , Xenia Ragiadakou , Ayan Kumar Halder , Simone Ballarin Subject: [XEN PATCH v2 03/13] x86/svm: fix violations of MISRA C:2012 Rule 7.2 Date: Wed, 5 Jul 2023 17:26:25 +0200 Message-Id: <015d7c13dc4e1b481abb23a3eaa254e316b7ca53.1688559115.git.gianluca.luparini@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 From: Gianluca Luparini The xen sources contains violations of MISRA C:2012 Rule 7.2 whose headline states: "A 'u' or 'U' suffix shall be applied to all integer constants that are represented in an unsigned type". Add the 'U' suffix to integers literals with unsigned type and also to other literals used in the same contexts or near violations, when their positive nature is immediately clear. The latter changes are done for the sake of uniformity. Signed-off-by: Simone Ballarin Signed-off-by: Gianluca Luparini Reviewed-by: Stefano Stabellini Acked-by: Jan Beulich --- Changes in v2: - change commit title to make it unique - change commit message --- xen/arch/x86/hvm/svm/asid.c | 2 +- xen/arch/x86/hvm/svm/svm.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/hvm/svm/asid.c b/xen/arch/x86/hvm/svm/asid.c index 09f8c23fd9..56306d1a16 100644 --- a/xen/arch/x86/hvm/svm/asid.c +++ b/xen/arch/x86/hvm/svm/asid.c @@ -16,7 +16,7 @@ void svm_asid_init(const struct cpuinfo_x86 *c) /* Check for erratum #170, and leave ASIDs disabled if it's present. */ if ( !cpu_has_amd_erratum(c, AMD_ERRATUM_170) ) - nasids = cpuid_ebx(0x8000000A); + nasids = cpuid_ebx(0x8000000AU); hvm_asid_init(nasids); } diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index 59a6e88dff..56cb2f61bb 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -269,9 +269,9 @@ svm_msrbit(unsigned long *msr_bitmap, uint32_t msr) */ if ( msr <= 0x1fff ) msr_bit = msr_bitmap + 0x0000 / BYTES_PER_LONG; - else if ( (msr >= 0xc0000000) && (msr <= 0xc0001fff) ) + else if ( (msr >= 0xc0000000U) && (msr <= 0xc0001fffU) ) msr_bit = msr_bitmap + 0x0800 / BYTES_PER_LONG; - else if ( (msr >= 0xc0010000) && (msr <= 0xc0011fff) ) + else if ( (msr >= 0xc0010000U) && (msr <= 0xc0011fffU) ) msr_bit = msr_bitmap + 0x1000 / BYTES_PER_LONG; return msr_bit; @@ -2539,8 +2539,8 @@ const struct hvm_function_table * __init start_svm(void) setup_vmcb_dump(); - if ( boot_cpu_data.extended_cpuid_level >= 0x8000000a ) - svm_feature_flags = cpuid_edx(0x8000000a); + if ( boot_cpu_data.extended_cpuid_level >= 0x8000000aU ) + svm_feature_flags = cpuid_edx(0x8000000aU); printk("SVM: Supported advanced features:\n");