From: Juergen Gross <jgross@suse.com>
To: linux-kernel@vger.kernel.org, x86@kernel.org
Cc: Juergen Gross <jgross@suse.com>,
Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
"H. Peter Anvin" <hpa@zytor.com>
Subject: [PATCH v4 6/6] x86/io_delay: Add config option for controlling build of io_delay.
Date: Mon, 19 Jan 2026 19:26:32 +0100 [thread overview]
Message-ID: <20260119182632.596369-7-jgross@suse.com> (raw)
In-Reply-To: <20260119182632.596369-1-jgross@suse.com>
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@suse.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 62e11572da27..e93abd2ffeb9 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -3169,6 +3169,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 d50d31023385..4946f870bdb7 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 e9aeeeafad17..879c1b7bf7c2 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.52.0
next prev parent reply other threads:[~2026-01-19 18:27 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-19 18:26 [PATCH v4 0/6] x86: Cleanups around slow_down_io() Juergen Gross
2026-01-19 18:26 ` [PATCH v4 1/6] x86/irqflags: Fix build failure Juergen Gross
2026-03-21 15:47 ` [tip: x86/cleanups] x86/irqflags: Preemptively move include paravirt.h directive where it belongs tip-bot2 for Juergen Gross
2026-03-22 7:47 ` tip-bot2 for Juergen Gross
2026-01-19 18:26 ` [PATCH v4 2/6] x86/paravirt: Replace io_delay() hook with a bool Juergen Gross
2026-03-21 15:47 ` [tip: x86/cleanups] " tip-bot2 for Juergen Gross
2026-03-22 7:46 ` tip-bot2 for Juergen Gross
2026-01-19 18:26 ` [PATCH v4 3/6] block/floppy: Don't use REALLY_SLOW_IO for delays Juergen Gross
2026-03-21 15:47 ` [tip: x86/cleanups] " tip-bot2 for Juergen Gross
2026-03-22 7:46 ` tip-bot2 for Juergen Gross
2026-01-19 18:26 ` [PATCH v4 4/6] x86/io: Remove REALLY_SLOW_IO handling Juergen Gross
2026-03-26 8:39 ` Juergen Gross
2026-03-26 10:04 ` Borislav Petkov
2026-03-26 10:23 ` Jürgen Groß
2026-01-19 18:26 ` [PATCH v4 5/6] x86/io_delay: Switch io_delay() default mechanism to "none" Juergen Gross
2026-03-20 22:02 ` Borislav Petkov
2026-03-21 6:29 ` Jürgen Groß
2026-03-21 11:32 ` Borislav Petkov
2026-01-19 18:26 ` Juergen Gross [this message]
2026-02-02 10:27 ` [PATCH v4 0/6] x86: Cleanups around slow_down_io() Juergen Gross
2026-02-09 9:11 ` Juergen Gross
2026-02-09 10:19 ` Borislav Petkov
2026-03-11 9:16 ` Juergen Gross
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=20260119182632.596369-7-jgross@suse.com \
--to=jgross@suse.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome