From patchwork Tue Jan 16 11:58:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 13520742 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 AFC68C47077 for ; Tue, 16 Jan 2024 11:59:03 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.667731.1039275 (Exim 4.92) (envelope-from ) id 1rPi5n-00035E-Ko; Tue, 16 Jan 2024 11:58:55 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 667731.1039275; Tue, 16 Jan 2024 11:58:55 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rPi5n-000357-Hd; Tue, 16 Jan 2024 11:58:55 +0000 Received: by outflank-mailman (input) for mailman id 667731; Tue, 16 Jan 2024 11:58:54 +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 1rPi5m-000351-TG for xen-devel@lists.xenproject.org; Tue, 16 Jan 2024 11:58:54 +0000 Received: from esa5.hc3370-68.iphmx.com (esa5.hc3370-68.iphmx.com [216.71.155.168]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 9da19c34-b466-11ee-98f1-6d05b1d4d9a1; Tue, 16 Jan 2024 12:58:53 +0100 (CET) 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: 9da19c34-b466-11ee-98f1-6d05b1d4d9a1 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1705406333; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=CXG++peqcTrVae01hLc9GPCtIYnrgjTYYITPCs1EtSs=; b=Vr0ZMt1DfmSCIYGcSPdb17uKBcQMQXedTjuizCB2jEYaNHXy3la8y5Bi tSWm79XJ4tVpmTzwo4WtuEfGmlNC4EqpucLwLhq4i97h6lZep/cp8gkLc wWf/PmsC9mnaZsmW9lolIUjBy4cc3FCiUm54oaigDe6Dk8Cyu1R58swUk w=; X-CSE-ConnectionGUID: mc5dV3RZRAKJOycBacwj5w== X-CSE-MsgGUID: kVY3adk5T1uIoB227NOYCg== Authentication-Results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 4.0 X-MesageID: 128004259 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.159.70 X-Policy: $RELAYED X-ThreatScanner-Verdict: Negative IronPort-Data: A9a23:ZrkRQqwUw516GpYEHJZ6t+emxirEfRIJ4+MujC+fZmUNrF6WrkUCz GMfW2mEPKqKMzTyfIh/aom/8B4B6p/cnIdmGQVk+CAxQypGp/SeCIXCJC8cHc8wwu7rFxs7s ppEOrEsCOhuExcwcz/0auCJQUFUjPzOHvykTrecZkidfCc8IA85kxVvhuUltYBhhNm9Emult Mj75sbSIzdJ4RYtWo4vw/zF8E4HUMja4mtC4gRnPK4T5jcyqlFOZH4hDfDpR5fHatE88t6SH 47r0Ly/92XFyBYhYvvNfmHTKxBirhb6ZGBiu1IOM0SQqkEqSh8ai87XAME0e0ZP4whlqvgqo Dl7WT5cfi9yVkHEsLx1vxC1iEiSN4UekFPMCSDXXcB+UyQq2pYjqhljJBheAGEWxgp4KWRFq PAmcwo/VDmgpcWny5iyQfZu29t2eaEHPKtH0p1h5TTQDPJgSpHfWaTao9Rf2V/chO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sfQEf071X3MkSSAG12SuCKHAo= X-Talos-MUID: 9a23:062s7g++3+oCZXtN57bWUo6Qf8RW0v+nBENQrcwbms6ub3YvHRCspzviFw== X-IronPort-AV: E=Sophos;i="6.05,199,1701147600"; d="scan'208";a="128004259" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Bertrand Marquis , Michal Orzel , Roberto Bagnara , Federico Serafini , "consulting @ bugseng . com" Subject: [PATCH] x86/cpuid: Change cpuid() from a macro to a static inline Date: Tue, 16 Jan 2024 11:58:38 +0000 Message-ID: <20240116115838.560473-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Fixes MISRA XXX No functional change. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monné CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall CC: Volodymyr Babchuk CC: Bertrand Marquis CC: Michal Orzel CC: Roberto Bagnara CC: Federico Serafini CC: consulting@bugseng.com Can someone please remind me which MISRA rule is the one about macros aliasing identifiers? --- xen/arch/x86/include/asm/processor.h | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) base-commit: f3f6c500e2dbd23af77c207e2cf4b496fffa1b0d diff --git a/xen/arch/x86/include/asm/processor.h b/xen/arch/x86/include/asm/processor.h index ff62b080afbf..b227cdee8ef3 100644 --- a/xen/arch/x86/include/asm/processor.h +++ b/xen/arch/x86/include/asm/processor.h @@ -126,14 +126,6 @@ static inline int cpu_nr_siblings(unsigned int cpu) return cpu_data[cpu].x86_num_siblings; } -/* - * Generic CPUID function - * clear %ecx since some cpus (Cyrix MII) do not set or clear %ecx - * resulting in stale register contents being returned. - */ -#define cpuid(leaf, eax, ebx, ecx, edx) \ - cpuid_count(leaf, 0, eax, ebx, ecx, edx) - /* Some CPUID calls want 'count' to be placed in ecx */ static inline void cpuid_count( unsigned int op, @@ -148,6 +140,21 @@ static inline void cpuid_count( : "0" (op), "c" (count) ); } +/* + * Generic CPUID function + * clear %ecx since some cpus (Cyrix MII) do not set or clear %ecx + * resulting in stale register contents being returned. + */ +static inline void cpuid( + unsigned int leaf, + unsigned int *eax, + unsigned int *ebx, + unsigned int *ecx, + unsigned int *edx) +{ + cpuid_count(leaf, 0, eax, ebx, ecx, edx); +} + /* * CPUID functions returning a single datum */