From nobody Sun May 24 19:34:44 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 982B61A3166 for ; Fri, 22 May 2026 07:03:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779433405; cv=none; b=simuxbNsx2N3JxHv3wwZIVJZobxBdVYoRyt8AlSIN9obXQZPxEjdttLg8iHGt54lfUbq9CgDDFpD5RiUTdBF0RxA6cF0k4VngKQxZgULWZc3WtyjA8edd5fRJu8/YNdjWKoKvK0a8VNBedAk6wy4Iqx4CssgTDqEiSJwkVJ0I/U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779433405; c=relaxed/simple; bh=biXOV7hT/qlUkJ2oULw+R8AEV+v9wL/Kd8Bt/UiUWeU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=IpWYaU0599oyVbQS8t9gy6kYH21d8PbmuoPHs4RhoHte3k25acmYubn+K88tbjV2Qw6B/7th1VpxLP/Y7//+Rsl5U501SgJuCw4D/nroonDM52mKQAhSDxj5QtoQmc37mOwjeDYC64JAx3AN1+2hsgMZLmyTYrTKEzhwtB3auns= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=1JwCL8Cm; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=6k2jrcQa; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="1JwCL8Cm"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="6k2jrcQa" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1779433400; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=D7FcJz2T0UPMSmEAay9MkzKjGlpFfqKVsS6PWFHPYdQ=; b=1JwCL8CmCTLMzyLh2Z0Zpuw7Ywsg4E2DE5Ovc/vv7xnCSjX59WaiEYB3GuY715c9+qn/11 0SSjxqMCBgDfzhVj38BC6FOr+he+UMp5mydgOBwJIKpqnM899Jrs6gqa5ViyHz3D6tNCD7 o3tr5tgyk9lO+OX9rJswYoM8WNGn9lrgO/0Gw5dHbe2fqF7tYjR2YaOlcmgao3RuSq2vqJ S0QeF/0Ti2yZoUdeVYTRF65JAoEhsDGO3ICtV3jfhQpHbhpzah/WxoyfMvZ+uNsB34qPFs UQpZsm8IOWYY0zvLBzX/2PM6KOO+iKXTu263ti8fEPqxEyzfHv5W0bRLhsVEGQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1779433400; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=D7FcJz2T0UPMSmEAay9MkzKjGlpFfqKVsS6PWFHPYdQ=; b=6k2jrcQaxDIYxNKBz7Uz+Na66yyeVBUmee+CnduCEvryxax566Fp7ltix989v2UDTVTHM2 at5jvLSWWESrO5AA== Date: Fri, 22 May 2026 09:03:00 +0200 Subject: [PATCH] x86: Use correct CHECKFLAGS for realmode code Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260522-x86-sparse-boot-v1-1-b94c228d9008@linutronix.de> X-B4-Tracking: v=1; b=H4sIAAAAAAAC/x3MQQqAIBBA0avErBtQK4uuEi1Sp5pNhhMRhHdPW r7F/y8IJSaBsXoh0c3C8SjQdQV+X46NkEMxGGWs6ozGZ7Ao55KE0MV4oXet6Rs9WNUHKNWZaOX nP05zzh9nphQAYQAAAA== X-Change-ID: 20260521-x86-sparse-boot-cb427318607d To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Arnd Bergmann Cc: linux-kernel@vger.kernel.org, Mark Bloch , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1779433394; l=2666; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=biXOV7hT/qlUkJ2oULw+R8AEV+v9wL/Kd8Bt/UiUWeU=; b=7/WBHHVr6uLMWsTAOgvQuuYG7h+lh3lSH/If92gs2dIANoUKfknenxVNmFOhAglZoIqip3wQq wcAJqCNWdgjBKHEl1EfNAMECzjnJJ7R1jIpIF/pqZypbSsqROEcMxlL X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= Currently the CHECKFLAGS from the normal build are also used for the realmode code. This leads to inconsistent flags confusing sparse and the logic in the kernel headers. Since recently this inconsistent state is detected by asm-generic/bitsperlong.h, triggering a warning. Fix the CHECKFLAGS to let sparse properly check this code and also avoid the warning. Technically the replacement of -D__x86_64__ is not necessary, as it will only be added to CHECKFLAGS later in the file. Replace it anyways for consistency. Reported-by: Mark Bloch Closes: https://lore.kernel.org/lkml/3bbcf456-322c-46f9-b238-88fb8ad227b2@n= vidia.com/ Fixes: 62357a5888ea ("asm-generic/bitsperlong.h: Add sanity checks for __BI= TS_PER_LONG") Signed-off-by: Thomas Wei=C3=9Fschuh Tested-by: Mark Bloch --- arch/x86/Makefile | 5 +++++ arch/x86/boot/Makefile | 1 + arch/x86/realmode/rm/Makefile | 1 + 3 files changed, 7 insertions(+) diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 46fec0b08487..bdafa3635dd1 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -61,6 +61,11 @@ REALMODE_CFLAGS +=3D $(cc_stack_align4) REALMODE_CFLAGS +=3D $(CLANG_FLAGS) export REALMODE_CFLAGS =20 +REALMODE_CHECKFLAGS :=3D $(subst -m64, -m16, \ + $(subst -m32, -m16, \ + $(subst -D__x86_64__, -D__i386__, \ + $(CHECKFLAGS)))) + # BITS is used as extension for files which are available in a 32 bit # and a 64 bit version to simplify shared Makefiles. # e.g.: obj-y +=3D foo_$(BITS).o diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile index 3f9fb3698d66..20b569930229 100644 --- a/arch/x86/boot/Makefile +++ b/arch/x86/boot/Makefile @@ -55,6 +55,7 @@ KBUILD_CFLAGS :=3D $(REALMODE_CFLAGS) -D_SETUP KBUILD_AFLAGS :=3D $(KBUILD_CFLAGS) -D__ASSEMBLY__ KBUILD_CFLAGS +=3D -fno-asynchronous-unwind-tables KBUILD_CFLAGS +=3D $(CONFIG_CC_IMPLICIT_FALLTHROUGH) +CHECKFLAGS :=3D $(REALMODE_CHECKFLAGS) =20 $(obj)/bzImage: asflags-y :=3D $(SVGA_MODE) =20 diff --git a/arch/x86/realmode/rm/Makefile b/arch/x86/realmode/rm/Makefile index a0fb39abc5c8..725c5ef6cdf1 100644 --- a/arch/x86/realmode/rm/Makefile +++ b/arch/x86/realmode/rm/Makefile @@ -67,3 +67,4 @@ KBUILD_CFLAGS :=3D $(REALMODE_CFLAGS) -D_SETUP -D_WAKEUP \ -I$(srctree)/arch/x86/boot KBUILD_AFLAGS :=3D $(KBUILD_CFLAGS) -D__ASSEMBLY__ KBUILD_CFLAGS +=3D -fno-asynchronous-unwind-tables +CHECKFLAGS :=3D $(REALMODE_CHECKFLAGS) --- base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731 change-id: 20260521-x86-sparse-boot-cb427318607d Best regards, -- =20 Thomas Wei=C3=9Fschuh