lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250514071803.209166-12-Neeraj.Upadhyay@amd.com>
Date: Wed, 14 May 2025 12:47:42 +0530
From: Neeraj Upadhyay <Neeraj.Upadhyay@....com>
To: <linux-kernel@...r.kernel.org>
CC: <bp@...en8.de>, <tglx@...utronix.de>, <mingo@...hat.com>,
	<dave.hansen@...ux.intel.com>, <Thomas.Lendacky@....com>, <nikunj@....com>,
	<Santosh.Shukla@....com>, <Vasant.Hegde@....com>,
	<Suravee.Suthikulpanit@....com>, <David.Kaplan@....com>, <x86@...nel.org>,
	<hpa@...or.com>, <peterz@...radead.org>, <seanjc@...gle.com>,
	<pbonzini@...hat.com>, <kvm@...r.kernel.org>,
	<kirill.shutemov@...ux.intel.com>, <huibo.wang@....com>,
	<naveen.rao@....com>, <francescolavra.fl@...il.com>, <tiala@...rosoft.com>
Subject: [RFC PATCH v6 11/32] x86/apic: Change get/set reg operations reg param to unsigned

Change reg parameter of apic_{set|get}_*() to unsigned int to
optimize code generation.

On gcc-14.2, code generation for apic_get_reg() is show below.

* Without change:

apic_get_reg:

48 63 f6    movsxd rsi,esi
8b 04 37    mov    eax,DWORD PTR [rdi+rsi*1]
c3          ret

* With change:

89 f6       mov    esi,esi
8b 04 37    mov    eax,DWORD PTR [rdi+rsi*1]
c3          ret

Signed-off-by: Neeraj Upadhyay <Neeraj.Upadhyay@....com>
---
Changes since v5:

 - New change.

 arch/x86/include/asm/apic.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
index 2acf695ed1b7..b377718d34d3 100644
--- a/arch/x86/include/asm/apic.h
+++ b/arch/x86/include/asm/apic.h
@@ -525,23 +525,23 @@ static inline int apic_find_highest_vector(void *bitmap)
 	return -1;
 }
 
-static inline u32 apic_get_reg(char *regs, int reg)
+static inline u32 apic_get_reg(char *regs, unsigned int reg)
 {
 	return *((u32 *) (regs + reg));
 }
 
-static inline void apic_set_reg(char *regs, int reg, u32 val)
+static inline void apic_set_reg(char *regs, unsigned int reg, u32 val)
 {
 	*((u32 *) (regs + reg)) = val;
 }
 
-static __always_inline u64 apic_get_reg64(char *regs, int reg)
+static __always_inline u64 apic_get_reg64(char *regs, unsigned int reg)
 {
 	BUILD_BUG_ON(reg != APIC_ICR);
 	return *((u64 *) (regs + reg));
 }
 
-static __always_inline void apic_set_reg64(char *regs, int reg, u64 val)
+static __always_inline void apic_set_reg64(char *regs, unsigned int reg, u64 val)
 {
 	BUILD_BUG_ON(reg != APIC_ICR);
 	*((u64 *) (regs + reg)) = val;
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ