From nobody Mon Jun 8 06:38:11 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 7B5D0379C5E for ; Mon, 1 Jun 2026 06:45:05 +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=1780296306; cv=none; b=qGqWMO/4yOHNvmT+QCyVgYyliMxACU4fr0wtvtmKEDrv5ZWXUJPKNVNBl84mdKRcQvblFA5/imEOjwnCG6rRLGKclQHOIcGD20RxZQBSNbLM/cymUC4q0vLqBKgKQQJR//4CyWQiGWNMGnFWQuFW4ufm2ZL8OfE5iIUQysasS3A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780296306; c=relaxed/simple; bh=6Rx+Mqs8rrBjb2APsk4K+XqOTi0K2mqyxgXhnPnWt6o=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=axbRSBS5M/+bjUkAtfT8c93cFBJVh1uvVxbcXU5EI79pZjVoF7K/QzN9oOKg3m1fcjdb1IV+nvGHKEi9GwMt1tpZqoVZK1xvBP8COdyu0vAFEmB4JPu9vemDxlkHmV/HI5A+cJ+wZ34xX/g3QHGIWaHi+ZfU7h/RD+TyaiwkXBU= 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=r8Dov3DT; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=x9XC48Od; 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="r8Dov3DT"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="x9XC48Od" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1780296298; 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=Rf4DTNElJchP8xkVqcv4xKXvu0rW+ufkYh0xD2fRTH8=; b=r8Dov3DTBCbIiBlgDBa35nN2Fr49vUxl6orrZMVQ2gdxvv4QHm3f7PSub+FqBZ8x5jPpO6 V4C/DcKV1/pnIHpjYuwzDzFQkvruMstIx6jS3erKfToB7uQPLDons+Fhi+oPzEQxqMfe0W zsmucjXx3uYl842M/j1hDrym3AyLHujBi1+6tDHkudQZr0eVnD+A88R8gykcbUbu0NWxFF YhjedW364p75Rchmks+zdy61vR30tIgBNT3eB5/wL1eWXA0FHWfWhSY0Jnb/MGi8RPsaSZ D686FEMxLR8uhZ/qB4fIU6fXM0cd2DhCRIzdixxIPCqZpe6hHky+ifIq+drWoA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1780296298; 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=Rf4DTNElJchP8xkVqcv4xKXvu0rW+ufkYh0xD2fRTH8=; b=x9XC48OdGOi/y6QrLDUj1RF8yUCljHRHCIPDwyJCFVpKKAeFbaFz5JENpvYfkO7i8y9fce s1E31rz/zMV5WOAw== Date: Mon, 01 Jun 2026 08:44:48 +0200 Subject: [PATCH v2] 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: <20260601-x86-sparse-boot-v2-1-53e621bc9c4c@linutronix.de> X-B4-Tracking: v=1; b=H4sIAAAAAAAC/2WNQQ6CMBBFr0Jm7Zh2RCiuvIdhAXSUSUxLWiQY0 rtbSVy5fC/5728QOQhHuBQbBF4kincZ6FDAMHbuwSg2M5CiSp1J42oqjFMXImPv/YxDX1J90qZ StYW8mgLfZd2LtzbzKHH24b0fLPprfy36ay0aNfZNORAZ2yhlrk9xrzl4J+vRMrQppQ8ee6bws gAAAA== 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=1780296296; l=2736; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=6Rx+Mqs8rrBjb2APsk4K+XqOTi0K2mqyxgXhnPnWt6o=; b=qix6U06/KYQKkO/k+8W1MEMTI8X4i1shbbQHsxMT27AJB5r5s8tS5E3exnCPsQ59ZqhR1zpIm uhEuSbY3KzsB1EEkEe3ckmKpS39daVhpp6v8YK3Cu9lsO5BAHv6YPmj 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. At this point -m32/-m64 and -D__i386__/-D__x86_64__ are not yet added to CHECKFLAGS, so no replacement is necessary. 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 --- Changes in v2: - Drop -m32/-m64 replacement logic - export REALMODE_CHECKFLAGS - Link to v1: https://patch.msgid.link/20260522-x86-sparse-boot-v1-1-b94c22= 8d9008@linutronix.de --- arch/x86/Makefile | 3 +++ arch/x86/boot/Makefile | 1 + arch/x86/realmode/rm/Makefile | 1 + 3 files changed, 5 insertions(+) diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 46fec0b08487..d3678483c486 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -61,6 +61,9 @@ REALMODE_CFLAGS +=3D $(cc_stack_align4) REALMODE_CFLAGS +=3D $(CLANG_FLAGS) export REALMODE_CFLAGS =20 +REALMODE_CHECKFLAGS :=3D $(CHECKFLAGS) -m16 -D__i386__ +export REALMODE_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