All of lore.kernel.org
 help / color / mirror / Atom feed
From: Uros Bizjak <ubizjak@gmail.com>
To: x86@kernel.org, linux-kernel@vger.kernel.org
Cc: Uros Bizjak <ubizjak@gmail.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@kernel.org>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>
Subject: [PATCH] x86/boot: Use __ASM_SIZE() to reduce ifdeffery in cpuflags.c
Date: Thu, 18 Jul 2024 08:32:18 +0200	[thread overview]
Message-ID: <20240718063242.52275-1-ubizjak@gmail.com> (raw)

Use __ASM_SIZE() macro to add correct insn suffix to pushf/popf.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
---
 arch/x86/boot/cpuflags.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/arch/x86/boot/cpuflags.c b/arch/x86/boot/cpuflags.c
index d75237ba7ce9..aacabe431fd5 100644
--- a/arch/x86/boot/cpuflags.c
+++ b/arch/x86/boot/cpuflags.c
@@ -2,6 +2,7 @@
 #include <linux/types.h>
 #include "bitops.h"
 
+#include <asm/asm.h>
 #include <asm/processor-flags.h>
 #include <asm/required-features.h>
 #include <asm/msr-index.h>
@@ -36,13 +37,8 @@ static int has_fpu(void)
  * compressed/ directory where it may be 64-bit code, and thus needs
  * to be 'pushfq' or 'popfq' in that case.
  */
-#ifdef __x86_64__
-#define PUSHF "pushfq"
-#define POPF "popfq"
-#else
-#define PUSHF "pushfl"
-#define POPF "popfl"
-#endif
+#define PUSHF __ASM_SIZE(pushf)
+#define POPF __ASM_SIZE(popf)
 
 int has_eflag(unsigned long mask)
 {
-- 
2.45.2


             reply	other threads:[~2024-07-18  6:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-18  6:32 Uros Bizjak [this message]
2024-07-18  6:35 ` [PATCH] x86/boot: Use __ASM_SIZE() to reduce ifdeffery in cpuflags.c H. Peter Anvin
2024-07-18  6:46   ` Uros Bizjak
2024-07-18  6:58     ` H. Peter Anvin
2024-07-18  7:27       ` Uros Bizjak
2024-07-18  7:28         ` H. Peter Anvin
2024-07-18  8:52   ` Uros Bizjak
2024-07-18  8:55     ` H. Peter Anvin
2024-07-18  9:12       ` Uros Bizjak
2024-07-18 20:53         ` H. Peter Anvin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240718063242.52275-1-ubizjak@gmail.com \
    --to=ubizjak@gmail.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.