Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1428736lqa; Mon, 29 Apr 2024 08:13:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU9LYu4bEMujDtNo9FH3ip0l4LZHw2L9esCPSKYZTnWlK2RqAWDLMyBb5giHGUVDouCoH4lndbAiCTD8blMBVtde75Y5XylL+yc0DotLg== X-Google-Smtp-Source: AGHT+IGh6SuU/ehYrmkomIWJAIDaBxKl9qG1Ig2q4Q6rN3pwMjUvRKPmfSMiHEW0gCYVgipW4PlT X-Received: by 2002:a05:622a:5514:b0:437:b7bd:368a with SMTP id fj20-20020a05622a551400b00437b7bd368amr13891165qtb.19.1714403629297; Mon, 29 Apr 2024 08:13:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714403629; cv=pass; d=google.com; s=arc-20160816; b=qlZViDIzbpcoA4WJaViSR2QhwjLMpOtlFE+LkwR+lguOU7LSLA26JeskwXRO+19ITh huFFBeF9bqiPCjHWVn2vpniAmxEltYWffmnoKoyolFQApBRvPVIRVhssluho9gteIjde iqlBZrXeiOJdKAOcFJkndTWuUQ31EMOFfe7OR7hb/rbdWLDsqM3xlSvezFA510u6pT0E Q4ySf3F5k0+XZaViMaOUaSGoKP9sIlvNMv+IdZNKjzeNUn8THIxfgud9LEy41HWcIgyo AfiwlpRbOTUu1T3fuYlbxJBBIuaKAgC6PFcC0TqQ21ANepe3u+trS1aKBJRT53AmrkvQ sjEQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=9QQSGk0Y9Ubz9htfULcfpBCmdaYN6MR+rakpquodwmU=; fh=NEkq7Vm6dmo1UDHecjQTW3O5cy08hxrIrqrAoP9w4uw=; b=xqHj4AYE51LNYu2XMbzXB1izOXwVqrGMdm+S9TOE0J4f3da81xgdXyWkfEwROLPuQQ he2zFaBR0pUwhuMzLKqnaDP6LgcMa8zt00kmZrYttIHqh8mtgoUFVs4zIfxwqV5pjdhg 4PNf0Dr04gSzvnlawbGQNzOXVOTnpnXLyfbHnvI8WhrDqeA04MTZoAY/Ws5ijHwsd5pr ss9Wd53A3X+DbbO4trmyziailPvrp6ysD938ZXpOYRnez65w8LxoZVHwK7BO4ivFsYFf 5Yi8Q1fFrXYUGhuZ6BV2SxJlbh4NhnYRditeJlHJNV85Xo30ykv92qyroEQJcEntDEFt m6lQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=NIZjB5Pm; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-162539-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162539-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id y20-20020a05622a121400b0043aeee4d180si2292766qtx.314.2024.04.29.08.13.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 08:13:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162539-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=NIZjB5Pm; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-162539-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162539-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id F0E961C21398 for ; Mon, 29 Apr 2024 15:13:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ACC5684D21; Mon, 29 Apr 2024 15:06:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b="NIZjB5Pm" Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) (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 E3E0783CB0 for ; Mon, 29 Apr 2024 15:06:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714403193; cv=none; b=LN5wqkNOBOc1WhcdMVPw63BckP62oKpDbcaZ+7TeBmZnCQh5iZOxGyGxtjmKrIFDPbs/NV5lbcRJSUKOoWloRNa1z1tk3lT1/9zG69Ayu9mn57rGmeZN3NM7hsBFgd3vt3XF7nztvJbSJfPG0hbQJrW0YdKjIUBcDqhvm2csJwM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714403193; c=relaxed/simple; bh=ZVcAG+OzER8E5YrxGpABeX9SY2L97uaCD62n5fHEDC0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=jVn5gs/wCjP/6QfsvTEgxDzKmhv8B2kyiE8aG4mWlcaO25lHTKcNAu4lpvTmmOh8qGdkL3CuYB1ycveNFKs7WzBNgd138k12zCfAmRdUM7lyC9HRl6l6G2fylykR2c37FTx7t4H/kpaBeVld86m1irhI9my3Ub8lSqvI5ouerqc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com; spf=pass smtp.mailfrom=rivosinc.com; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b=NIZjB5Pm; arc=none smtp.client-ip=209.85.167.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-lf1-f45.google.com with SMTP id 2adb3069b0e04-516ced2f94cso1093181e87.1 for ; Mon, 29 Apr 2024 08:06:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1714403190; x=1715007990; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=9QQSGk0Y9Ubz9htfULcfpBCmdaYN6MR+rakpquodwmU=; b=NIZjB5PmwUuRqPa4NzQd0fJ4uDlI5Q6lVyUH6dtrFfpQkDk4iDy3ucmvrKcP/aFEzz aSwFZEWLnpSaJ0bVbqUK8fN84wENhAWzJ0NlnALF7RPfdqAxU649yzRqsUgXp3xRg+8w JARGW4hMoyFZ13rSflhoOELX6ByuWZDp+tMPCoeXh1803kXNw/fF1H37/fESNVpPON8e a0nKfAbLoc8AeEQsIaW536H6o8X0PwfZaRMYVKPJ7IMwoHc1hw/3tWUe6KVgiocDzoog NDNuCtqOn4hW7M4X/Rs3QA/p2qD4E3bSAtJHQQWjYMSNT+1zAxCttNe1TevBV9c1nlR2 Bnlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714403190; x=1715007990; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=9QQSGk0Y9Ubz9htfULcfpBCmdaYN6MR+rakpquodwmU=; b=xJ3xJuidQLvX6hWlz7hm6b3rn7RGJNdUyqokmvuNpZj4b32kLedcJYX9xSQ5Tnv9Jp O1QXI5EtH4vmwIaPj+hvjPqh98gZAH83YYRbNh61PG0vxewVK+B/qDeSugxS9qzIGhwv 6mTwf3LWf1cbyDdbedFT0aMHj3t6BEtX1PmQ1EDTlUzHA4yjsy7eQIDX54UfE4i2hCV2 5SbjN01newwkb+hx2+zKT8RclJjGF5aXBC7UPXjLJV97TMnUGQXOaQGdJJLyyqGyCYEj OQLz+o6+hPgDvs6ZSike77e6o9QYcpdD1rMsrCukCHgvpmk6/uN4dYs+5Zj+0Mv9tVS8 ytVg== X-Forwarded-Encrypted: i=1; AJvYcCWcbTbyHPNiysna08sNgczj3GyQhqSNP3gsSw7dudPGVhTZ7rguEJX1MAB9/Nwgktqy72/WZ+wSrw7QrUzuWAAkXPJHIY+KnART8MFw X-Gm-Message-State: AOJu0YzuBpQGgBucTyHAXTLr3iMNL9eJ7V/wwle3BJFtTfWejmCEr0A1 kpQUerb3Oc8p8aBPPW3WEYX8PDfXwGXAJ/k6L/7ouRwmJtF2hjGj3HtgF6vMzjQ= X-Received: by 2002:a2e:9547:0:b0:2d6:c59e:37bd with SMTP id t7-20020a2e9547000000b002d6c59e37bdmr6422086ljh.3.1714403189917; Mon, 29 Apr 2024 08:06:29 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:2fec:d20:2b60:e334]) by smtp.gmail.com with ESMTPSA id l23-20020a05600c1d1700b00418f99170f2sm39646638wms.32.2024.04.29.08.06.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 08:06:29 -0700 (PDT) From: =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= To: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Anup Patel , Shuah Khan Cc: =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= , Atish Patra , linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-kselftest@vger.kernel.org Subject: [PATCH v4 00/11] Add support for a few Zc* extensions as well as Zcmop Date: Mon, 29 Apr 2024 17:04:53 +0200 Message-ID: <20240429150553.625165-1-cleger@rivosinc.com> X-Mailer: git-send-email 2.43.0 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: 8bit Add support for (yet again) more RVA23U64 missing extensions. Add support for Zcmop, Zca, Zcf, Zcd and Zcb extensions isa string parsing, hwprobe and kvm support. Zce, Zcmt and Zcmp extensions have been left out since they target microcontrollers/embedded CPUs and are not needed by RVA23U64. Since Zc* extensions states that C implies Zca, Zcf (if F and RV32), Zcd (if D), this series modifies the way ISA string is parsed and now does it in two phases. First one parses the string and the second one validates it for the final ISA description. This series is based on the Zimop one [1]. An additional fix [2] should be applied to correctly test that series. Link: https://lore.kernel.org/linux-riscv/20240404103254.1752834-1-cleger@rivosinc.com/ [1] Link: https://lore.kernel.org/all/20240409143839.558784-1-cleger@rivosinc.com/ [2] --- v4: - Modify validate() callbacks to return an 0, -EPROBEDEFER or another error. - v3: https://lore.kernel.org/all/20240423124326.2532796-1-cleger@rivosinc.com/ v3: - Fix typo "exists" -> "exist" - Remove C implies Zca, Zcd, Zcf, dt-bindings rules - Rework ISA string resolver to handle dependencies - v2: https://lore.kernel.org/all/20240418124300.1387978-1-cleger@rivosinc.com/ v2: - Add Zc* dependencies validation in dt-bindings - v1: https://lore.kernel.org/lkml/20240410091106.749233-1-cleger@rivosinc.com/ Clément Léger (11): dt-bindings: riscv: add Zca, Zcf, Zcd and Zcb ISA extension description riscv: add ISA extensions validation riscv: add ISA parsing for Zca, Zcf, Zcd and Zcb riscv: hwprobe: export Zca, Zcf, Zcd and Zcb ISA extensions RISC-V: KVM: Allow Zca, Zcf, Zcd and Zcb extensions for Guest/VM KVM: riscv: selftests: Add some Zc* extensions to get-reg-list test dt-bindings: riscv: add Zcmop ISA extension description riscv: add ISA extension parsing for Zcmop riscv: hwprobe: export Zcmop ISA extension RISC-V: KVM: Allow Zcmop extension for Guest/VM KVM: riscv: selftests: Add Zcmop extension to get-reg-list test Documentation/arch/riscv/hwprobe.rst | 24 ++ .../devicetree/bindings/riscv/extensions.yaml | 90 ++++++ arch/riscv/include/asm/cpufeature.h | 1 + arch/riscv/include/asm/hwcap.h | 5 + arch/riscv/include/uapi/asm/hwprobe.h | 5 + arch/riscv/include/uapi/asm/kvm.h | 5 + arch/riscv/kernel/cpufeature.c | 259 ++++++++++++------ arch/riscv/kernel/sys_hwprobe.c | 5 + arch/riscv/kvm/vcpu_onereg.c | 10 + .../selftests/kvm/riscv/get-reg-list.c | 20 ++ 10 files changed, 337 insertions(+), 87 deletions(-) -- 2.43.0