From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 27F0CD2ECE9 for ; Tue, 20 Jan 2026 14:27:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hWRliVnJSopjYdoiT6Zn4a2CjDdJ6Dj2WhQVzUvVFB0=; b=JwhjO7M6hHiBuM SS6F6bN0AYrAHYU70gZxUb5jdqmipwFDZzfklRRLbSQtXD4sACzfx9j82P3CzKh7uclkqryOD1uwO JHakxi7M3fNAvNeZ+qYqjWGueSITv7BTgvVf5JEnNGIHnA1XJBjgT/UDNH5JeWSyzu033+d36xTPo Y+tNad4oGd39dnU6mCRJYirYhm4jFUhQXWt+CZVCuWA+TrKOlgcYiYFbcKv40yU2dy7NoIpEpboQo 6LVdNMb70sT3hT42eXOkFhOj+iXoXD7gnxigkGXWWb9xq9/kfmfYL7mxGMGZWxVMTAFHWPBuvMQSj yY0y8M17+PDEc8ApTY1w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1viCgz-00000003ygg-2jRH; Tue, 20 Jan 2026 14:26:49 +0000 Received: from esa2.hc555-34.eu.iphmx.com ([23.90.104.147]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1viCgv-00000003yfN-1rF6 for linux-riscv@lists.infradead.org; Tue, 20 Jan 2026 14:26:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mobileye.com; i=@mobileye.com; q=dns/txt; s=MoEyIP; t=1768919203; x=1800455203; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8EBLwHT55IuAbkABwax6AVrddslo69S70L3DGkHyKUU=; b=ZIYP2yAMbJu8qmR7Ktw2Fcyby7MUa6dfhZwz8glBkdEA4trHWM78oCb+ PxWF1zqfFxIZVk6GHh5idgpUICySdiSUeFXMCbv/+olkh8t/HOpQDm6i7 pNa6QEO7PPnOlS8HhYDkSoafgyRs+r3brPGrIAuK1r6Vr+4kJbOM/y6XM Ly71khl9cwIf2s0eYPAfYB8ZBFtRJegPxFj3x5MfOXvVZ6Nj6eipxp+Az aC+pi4zLvJnIjzpxHyNszqKSRAf1XOzqR9hSpXVARRyF3zzZVEXXB07iU 9uuqiAaeLm+yIHzIM+XAgmwUX7HN+mAH10ZOW4YqnvM/mcx0q9DuSTEwz Q==; X-CSE-ConnectionGUID: NibvJdGcRGi/R6pvMFxMRA== X-CSE-MsgGUID: w9YKJwwlS4O0r/0C20+DCg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from unknown (HELO ces03_data.me-corp.lan) ([146.255.191.134]) by esa2.hc555-34.eu.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jan 2026 16:26:41 +0200 X-CSE-ConnectionGUID: Pp58k23DRzexhP6tmk/wuQ== X-CSE-MsgGUID: i54Ppv5KSm6oKZVU4VwrHA== Received: from unknown (HELO epgd071.me-corp.lan) ([10.154.54.2]) by ces03_data.me-corp.lan with SMTP; 20 Jan 2026 16:28:31 +0200 Received: by epgd071.me-corp.lan (sSMTP sendmail emulation); Tue, 20 Jan 2026 16:26:41 +0200 From: Vladimir Kondratiev To: Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Will Deacon , Peter Zijlstra , Boqun Feng , Mark Rutland , Gary Guo , Yury Norov , Rasmus Villemoes , cfu@wavecomp.com, torvalds@linux-foundation.org, olof@lixom.net, aleksa.paunovic@htecgroup.com, arikalo@gmail.com Cc: Vladimir Kondratiev , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Vladimir.Kondratiev@mobileye.com Subject: [PATCH v2 2/2] riscv: more accurate check for CPU atomics support Date: Tue, 20 Jan 2026 16:26:24 +0200 Message-ID: <20260120-lrsc-only-v2-2-a522e640d27d@mobileye.com> In-Reply-To: <20260120-lrsc-only-v2-0-a522e640d27d@mobileye.com> References: <20260120-lrsc-only-v2-0-a522e640d27d@mobileye.com> MIME-Version: 1.0 X-Mailer: b4 0.14.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260120_062645_781575_9B9D3097 X-CRM114-Status: GOOD ( 13.55 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org CPU reports extensions supported in "riscv,isa-extensions" property of the CPU node, for atomic operations it is - "a" extension meaning both AMO and LR/SC supported - "zaamo" extension meaning AMO instructions supported - "zalrsc" extension meaning LR/SC supported Code can also be compiled with subset of atomics support Relax requirements for CPU extension support from full "a" to subset compatible with software configuration Signed-off-by: Vladimir Kondratiev --- arch/riscv/kernel/cpu.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/arch/riscv/kernel/cpu.c b/arch/riscv/kernel/cpu.c index 3dbc8cc557dd1d71101959a003ea7195af3c92a0..84d4a549b6136e0c97a35025a18ce710afbedad5 100644 --- a/arch/riscv/kernel/cpu.c +++ b/arch/riscv/kernel/cpu.c @@ -82,12 +82,26 @@ int __init riscv_early_of_processor_hartid(struct device_node *node, unsigned lo return -ENODEV; if (of_property_match_string(node, "riscv,isa-extensions", "i") < 0 || - of_property_match_string(node, "riscv,isa-extensions", "m") < 0 || - of_property_match_string(node, "riscv,isa-extensions", "a") < 0) { - pr_warn("CPU with hartid=%lu does not support ima", *hart); + of_property_match_string(node, "riscv,isa-extensions", "m") < 0) { + pr_warn("CPU with hartid=%lu does not support im", *hart); return -ENODEV; } - + /* any atomic supported? */ +#if defined(__riscv_atomic) || defined(__riscv_zaamo) + if (of_property_match_string(node, "riscv,isa-extensions", "a") < 0 && + of_property_match_string(node, "riscv,isa-extensions", "zaamo") < 0) { + pr_warn("CPU with hartid=%lu does not support AMO atomics", *hart); + return -ENODEV; + } +#elif defined(__riscv_zalrsc) + if (of_property_match_string(node, "riscv,isa-extensions", "a") < 0 && + of_property_match_string(node, "riscv,isa-extensions", "zalrsc") < 0) { + pr_warn("CPU with hartid=%lu does not support LS/SC atomics", *hart); + return -ENODEV; + } +#else +#error "need atomic or zalrsc extension" +#endif return 0; old_interface: -- 2.43.0 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv