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] [day] [month] [year] [list]
Message-ID: <20251216134150.2710-6-jgross@suse.com>
Date: Tue, 16 Dec 2025 14:41:49 +0100
From: Juergen Gross <jgross@...e.com>
To: linux-kernel@...r.kernel.org,
	x86@...nel.org
Cc: Juergen Gross <jgross@...e.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	Borislav Petkov <bp@...en8.de>,
	Dave Hansen <dave.hansen@...ux.intel.com>,
	"H. Peter Anvin" <hpa@...or.com>
Subject: [PATCH v2 5/5] x86/io_delay: Add config option for controlling build of io_delay.

Prepare phasing out support of io_delay() by adding a config option
(default on for now) controlling the build of io_delay.c.

Signed-off-by: Juergen Gross <jgross@...e.com>
---
V2:
- new patch (kind of suggested by Ingo Molnar)
---
 arch/x86/Kconfig              | 8 ++++++++
 arch/x86/include/asm/floppy.h | 4 ++++
 arch/x86/include/asm/io.h     | 6 ++++++
 arch/x86/kernel/Makefile      | 3 ++-
 arch/x86/kernel/setup.c       | 2 ++
 5 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 80527299f859..ae6da2bd6e44 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -3175,6 +3175,14 @@ config HAVE_ATOMIC_IOMAP
 	def_bool y
 	depends on X86_32
 
+config IO_DELAY
+	bool "Support delay of I/O-port activities"
+	default y
+	help
+	  Include code allowing to delay I/O-port activities. This might be
+	  needed on some rather old hardware. The delay mechanism will still
+	  require to be selected via the "io_delay" boot parameter.
+
 source "arch/x86/kvm/Kconfig"
 
 source "arch/x86/Kconfig.cpufeatures"
diff --git a/arch/x86/include/asm/floppy.h b/arch/x86/include/asm/floppy.h
index 8d1e86687b98..d7df95255761 100644
--- a/arch/x86/include/asm/floppy.h
+++ b/arch/x86/include/asm/floppy.h
@@ -50,9 +50,11 @@ static inline u8 fd_inb(u16 base, u16 reg)
 {
 	u8 ret = inb_p(base + reg);
 
+#ifdef CONFIG_IO_DELAY
 	native_io_delay();
 	native_io_delay();
 	native_io_delay();
+#endif
 
 	return ret;
 }
@@ -61,9 +63,11 @@ static inline void fd_outb(u8 value, u16 base, u16 reg)
 {
 	outb_p(value, base + reg);
 
+#ifdef CONFIG_IO_DELAY
 	native_io_delay();
 	native_io_delay();
 	native_io_delay();
+#endif
 }
 
 static irqreturn_t floppy_hardint(int irq, void *dev_id)
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
index 9c4178f2d094..c5d19665b746 100644
--- a/arch/x86/include/asm/io.h
+++ b/arch/x86/include/asm/io.h
@@ -237,6 +237,7 @@ static inline void __iowrite32_copy(void __iomem *to, const void *from,
 
 #endif /* __KERNEL__ */
 
+#ifdef CONFIG_IO_DELAY
 extern void native_io_delay(void);
 
 extern int io_delay_type;
@@ -254,6 +255,11 @@ static inline void slow_down_io(void)
 
 	native_io_delay();
 }
+#else
+static inline void slow_down_io(void)
+{
+}
+#endif
 
 #define BUILDIO(bwl, type)						\
 static inline void out##bwl##_p(type value, u16 port)			\
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index bc184dd38d99..f2bb6664b7ca 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -66,11 +66,12 @@ obj-$(CONFIG_X86_32)	+= sys_ia32.o
 obj-$(CONFIG_IA32_EMULATION)	+= sys_ia32.o signal_32.o
 obj-$(CONFIG_X86_64)	+= sys_x86_64.o
 obj-$(CONFIG_X86_ESPFIX64)	+= espfix_64.o
+obj-$(CONFIG_IO_DELAY)	+= io_delay.o
 obj-$(CONFIG_SYSFS)	+= ksysfs.o
 obj-y			+= bootflag.o e820.o
 obj-y			+= pci-dma.o quirks.o kdebugfs.o
 obj-y			+= alternative.o i8253.o hw_breakpoint.o
-obj-y			+= tsc.o tsc_msr.o io_delay.o rtc.o
+obj-y			+= tsc.o tsc_msr.o rtc.o
 obj-y			+= resource.o
 obj-y			+= irqflags.o
 obj-y			+= static_call.o
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 8ef29c1ebb8d..a3fa38a23807 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -183,6 +183,7 @@ static const struct ctl_table x86_sysctl_table[] = {
 		.mode		= 0444,
 		.proc_handler	= proc_dointvec,
 	},
+#ifdef CONFIG_IO_DELAY
 	{
 		.procname	= "io_delay_type",
 		.data		= &io_delay_type,
@@ -190,6 +191,7 @@ static const struct ctl_table x86_sysctl_table[] = {
 		.mode		= 0644,
 		.proc_handler	= proc_dointvec,
 	},
+#endif
 #if defined(CONFIG_ACPI_SLEEP)
 	{
 		.procname	= "acpi_video_flags",
-- 
2.51.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ