From nobody Fri Dec 19 07:24:12 2025 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 277A636829B for ; Tue, 16 Dec 2025 13:42:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765892548; cv=none; b=CguHyABLsdBgHWezl2AObf2OqZIMkAY5ZOqQNtXsvsnsk7kULzqf+fRjUXH/niP6aAv2WQvpvp5tm7pW3wCQPwKMqGKHBrDFaUpIUlbxPfozBVBFEwRSmAHiOF5x5F0nFTU5YOpVXlyrGOcC35TB7oD/w265csAlvev5wuM3IHw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765892548; c=relaxed/simple; bh=CnU1p+DcY0LjsqS9t6kzSGGJG80Naw7ECgB91jGwVuc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Af20LKZqrjkwB9/SaplsCtoevEPhxUts9UJoEpYTlFxsvYx8meGcmIlSz1ir213m/o0YprCvRaT2Tga/8TmCDEbf7Iww+Z77xmXBxSD1AZhm6htE4IMp4WmdAkYziEBbVhNgPAxToXCg/uWq7xJU8wVkWi997ByCjPxAlJn6frA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=nyybNWoO; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=nyybNWoO; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="nyybNWoO"; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="nyybNWoO" Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 22322336A1; Tue, 16 Dec 2025 13:42:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1765892542; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SVYXw6g8ugnGrVHrWrI3qq0RL0EvjQam8AV44nTM6hs=; b=nyybNWoOUFZMNg8rR6AvSeac8KYVPdo0LVu54H4CchWMDZSyzjq6LrrCcTWK/7rxR9S57B +GACn19GiN7YnjWvsjxu3wdgcFjAnqolKJkO8R08FiiwgjBCMSOuJtap6zCniy8f2981HM X5K8gT5EILmzjcdfxBn6EQycQYbanzQ= Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1765892542; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SVYXw6g8ugnGrVHrWrI3qq0RL0EvjQam8AV44nTM6hs=; b=nyybNWoOUFZMNg8rR6AvSeac8KYVPdo0LVu54H4CchWMDZSyzjq6LrrCcTWK/7rxR9S57B +GACn19GiN7YnjWvsjxu3wdgcFjAnqolKJkO8R08FiiwgjBCMSOuJtap6zCniy8f2981HM X5K8gT5EILmzjcdfxBn6EQycQYbanzQ= Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id C756C3EA63; Tue, 16 Dec 2025 13:42:21 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id lBvwLr1hQWmmHwAAD6G6ig (envelope-from ); Tue, 16 Dec 2025 13:42:21 +0000 From: Juergen Gross To: linux-kernel@vger.kernel.org, x86@kernel.org Cc: Juergen Gross , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" Subject: [PATCH v2 5/5] x86/io_delay: Add config option for controlling build of io_delay. Date: Tue, 16 Dec 2025 14:41:49 +0100 Message-ID: <20251216134150.2710-6-jgross@suse.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251216134150.2710-1-jgross@suse.com> References: <20251216134150.2710-1-jgross@suse.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-6.80 / 50.00]; REPLY(-4.00)[]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.987]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; RCPT_COUNT_SEVEN(0.00)[8]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; R_RATELIMIT(0.00)[to_ip_from(RLfdszjqhz8kzzb9uwpzdm8png)]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.com:mid,suse.com:email]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_TLS_ALL(0.00)[] X-Spam-Level: X-Spam-Flag: NO X-Spam-Score: -6.80 Content-Type: text/plain; charset="utf-8" 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 --- 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 =20 +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" =20 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 =3D inb_p(base + reg); =20 +#ifdef CONFIG_IO_DELAY native_io_delay(); native_io_delay(); native_io_delay(); +#endif =20 return ret; } @@ -61,9 +63,11 @@ static inline void fd_outb(u8 value, u16 base, u16 reg) { outb_p(value, base + reg); =20 +#ifdef CONFIG_IO_DELAY native_io_delay(); native_io_delay(); native_io_delay(); +#endif } =20 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, c= onst void *from, =20 #endif /* __KERNEL__ */ =20 +#ifdef CONFIG_IO_DELAY extern void native_io_delay(void); =20 extern int io_delay_type; @@ -254,6 +255,11 @@ static inline void slow_down_io(void) =20 native_io_delay(); } +#else +static inline void slow_down_io(void) +{ +} +#endif =20 #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) +=3D sys_ia32.o obj-$(CONFIG_IA32_EMULATION) +=3D sys_ia32.o signal_32.o obj-$(CONFIG_X86_64) +=3D sys_x86_64.o obj-$(CONFIG_X86_ESPFIX64) +=3D espfix_64.o +obj-$(CONFIG_IO_DELAY) +=3D io_delay.o obj-$(CONFIG_SYSFS) +=3D ksysfs.o obj-y +=3D bootflag.o e820.o obj-y +=3D pci-dma.o quirks.o kdebugfs.o obj-y +=3D alternative.o i8253.o hw_breakpoint.o -obj-y +=3D tsc.o tsc_msr.o io_delay.o rtc.o +obj-y +=3D tsc.o tsc_msr.o rtc.o obj-y +=3D resource.o obj-y +=3D irqflags.o obj-y +=3D 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[] =3D { .mode =3D 0444, .proc_handler =3D proc_dointvec, }, +#ifdef CONFIG_IO_DELAY { .procname =3D "io_delay_type", .data =3D &io_delay_type, @@ -190,6 +191,7 @@ static const struct ctl_table x86_sysctl_table[] =3D { .mode =3D 0644, .proc_handler =3D proc_dointvec, }, +#endif #if defined(CONFIG_ACPI_SLEEP) { .procname =3D "acpi_video_flags", --=20 2.51.0