From nobody Sat Apr 4 03:19:47 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 A3A183C13F0 for ; Fri, 20 Mar 2026 15:59:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774022347; cv=none; b=sSEerk2+S9+4rrSy0Pqv0L09mrC/p+Pk8Soio7V6gWLw4PcRApNVx4RlwI5o+yDL3qJtZaypZyriHSIPIiuKo9mhHxWqVcgQFa1SbMYKawWzDov9CTYu/LEYvC4B0w4ah5J4vGuJaT31Pyog+fJ3TgTJnXqAMcOFAEFqp2K4IIU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774022347; c=relaxed/simple; bh=16yO1qqMR4wLhgsIkXKZhV9SQP3DubEoX1WVxr3V5bI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=gDoS+2+2ykyipBK7Qojlai94VRzbhGy7TZhBu2GPZR1nx8qQHSoyTWtL11cjdrFe19i27HVSH0KyKYhn3tfPUdbBBroTPI3eKz4clGGZTLGlbT0AzJpk0EdCYvCCbk+jmaerKytTBbpPcqNBjmpEyC7sogaHC4yVwjtDxEobVzw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=dI3bzeKI; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="dI3bzeKI" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1774022344; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=8yWdXXmCFKiAxvWiUii4eBbGeSCOI3DuI0otrKafgog=; b=dI3bzeKI3Hw84ZyKxmyJ6DOfRZajX3j1l9KhvUHQsyT66YqxxIIvjF4nJ+h9O1LvIfvQcI 3KZtKfS7LvIRo5Dj2Nbh+Ft3/b6olSwTrAmtod0NWJ8spB6ceJBa9aGMm4SNaFLykbz9um Tx/QA6g/VzelrEpQ1nh55+fbBc3mL+c= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-214-pu8zbBcJOZ2ucDJsTPbYEA-1; Fri, 20 Mar 2026 11:59:03 -0400 X-MC-Unique: pu8zbBcJOZ2ucDJsTPbYEA-1 X-Mimecast-MFC-AGG-ID: pu8zbBcJOZ2ucDJsTPbYEA_1774022342 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 556EA1800281; Fri, 20 Mar 2026 15:59:01 +0000 (UTC) Received: from cmirabil.redhat.com (unknown [10.2.16.157]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 759B51953944; Fri, 20 Mar 2026 15:58:58 +0000 (UTC) From: Charles Mirabile To: linux-kernel@vger.kernel.org Cc: Charles Mirabile , linux-riscv@lists.infradead.org, Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Charlie Jenkins , stable@vger.kernel.org Subject: [PATCH v1] riscv: disable runtime constant support for XIP kernels Date: Fri, 20 Mar 2026 11:58:41 -0400 Message-ID: <20260320155843.1848180-1-cmirabil@redhat.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-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Content-Type: text/plain; charset="utf-8" Runtime constant support is predicated on patching the kernel binary at runtime, which is fundamentally impossible for an XIP kernel whose text section is backed not by RAM but by memory mapped read-only storage. If CONFIG_XIP_KERNEL is enabled, do not define riscv implementations of the relevant runtime constant macros so that the fallbacks which do not perform runtime constant optimization are used. Fixes: a44fb5722199 ("riscv: Add runtime constant support") Cc: stable@vger.kernel.org Signed-off-by: Charles Mirabile --- arch/riscv/include/asm/runtime-const.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/riscv/include/asm/runtime-const.h b/arch/riscv/include/as= m/runtime-const.h index d766e2b9e6df1..05110bb7554e9 100644 --- a/arch/riscv/include/asm/runtime-const.h +++ b/arch/riscv/include/asm/runtime-const.h @@ -11,6 +11,9 @@ =20 #include =20 +/* patching of the kernel text is fundamentally impossible on XIP kernels = */ +#ifndef CONFIG_XIP_KERNEL + #ifdef CONFIG_32BIT #define runtime_const_ptr(sym) \ ({ \ @@ -265,4 +268,5 @@ static inline void runtime_const_fixup(void (*fn)(void = *, unsigned long), } } =20 +#endif /* !CONFIG_XIP_KERNEL */ #endif /* _ASM_RISCV_RUNTIME_CONST_H */ base-commit: f338e77383789c0cae23ca3d48adcc5e9e137e3c --=20 2.53.0