Received: by 2002:a05:6500:1b41:b0:1fb:d597:ff75 with SMTP id cz1csp76851lqb; Tue, 4 Jun 2024 05:46:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXXHNpFVQ8hh3dYKtsl6kFOn2wKGUfHNbIaNSGsHbYw0NFM9VeLcSWXftQfdubDFQ04mWZzxbnAkfTyASfEWNt2/Yy4ycZUr2L52dNI/g== X-Google-Smtp-Source: AGHT+IGJjp59eKscGXGrTWN47KvmGl8lGM7kSqR2eagO+EM2BE1LfyoWuiJ2ev0bVIKCcDmCd+3d X-Received: by 2002:a05:6102:5120:b0:48b:e750:f98f with SMTP id ada2fe7eead31-48be750fab7mr6532955137.17.1717505183784; Tue, 04 Jun 2024 05:46:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717505183; cv=pass; d=google.com; s=arc-20160816; b=oTL/mUhBQZhzY+DLeQ/hR3uZJGDuG+y8luXRKELNheL/pcVRwolXg4stk+TpGK/Nr1 0ULZcIhuCmNuoqoZewQIC/sRrDDYjfzUennbDu1FgAFcWnThF02IirntMcvof+7RaBa+ dWJqNWaMdIimU1u5T+cqM33jN/4Q0b2B9DYXBxxQNpW7QbD3Ye04Ik3vn4BpsN/Sjv9I bUgq9DbiI/wH2gTIOlcdbiPuSdU7PnRebY7Y2RswpsSM/wD+0qPh/ObYdghd4FDL/+JV /iVpiTvdc6VNC3uz626YCB+WooUlN/DM9/MgEBAmnnjpl4RExTAVX1mFhv0nBmOdPyrt KCZA== 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=RlFfGyvlYpwu5mumxxHK+PtmO5s3+buvtb+SvPxc6V0=; fh=4MLhXMXYAWGBrFHTe/E/0k8+3g4dfL1itNrVY+tYS6E=; b=dPkOdYkBdEUZuO93lCyaN9IHfv/FoiErYwfw70i//Cg9qqtGaWmtx1zCqG5Lgch2yi /sGzj/l/eoTpahjiIUxVLV9B2KOJVF6sAsyu8a8Tg6kJ7TQzH4Od+zTZ4GhOKLdVnHRI YqK5a+krenpDKEzb3zeE4mG9vy0ozGoY3l9pMD0m9vfnpq76Dg1GKCoznV7+ig2ZMhOf TUcCXcZoMnQ3xLBUbKZXTlQrfTZL0GXxB6wdqQeq/Jgo8MaY/VA2QOv777hvDzXVq50l rjnSZT62xSNseXv+wQVbpzXAs6lP2IRHWaK7DPExA0RFenD5SSi3wofHedFla5AGuam5 Kszw==; 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=ZZ9gtc+H; 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-200624-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200624-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 af79cd13be357-794f2f05155si1042898785a.85.2024.06.04.05.46.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 05:46:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-200624-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=ZZ9gtc+H; 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-200624-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200624-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 734411C239C8 for ; Tue, 4 Jun 2024 12:46:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E2C131465AA; Tue, 4 Jun 2024 12:46:14 +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="ZZ9gtc+H" Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (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 5525814658B for ; Tue, 4 Jun 2024 12:46:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717505174; cv=none; b=bxSlY//Uev+sTMoOumCjD3/2X/9xbYbtLrAOkHJS6rBc30FNOxH5jWoBQZ09aavQ905WAjFmnFUMPw6+C5lm7DXFpaiFexwRXK4PnbajsP+B6XyDFHBEsEIvQC6W3fcGrHceLbkQp86fBl1Fc2eHY2Lxa+CgmDIYG1rsoyX2X1Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717505174; c=relaxed/simple; bh=rXkB9HSCpKxWLSjih7qqbvvJKhAnmk8tL5d1yBuTZvs=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=V79jHEARZ5c/iv0U0z+bPvfw5nnV50cdv5FLHV5oNOtoftPAZ3n32bPV6ikeN/wLAA85J9wQmXB3qf0IrjDio1vC/LrDOBRHpfYJYAxeL3gIEw2k0Tzu4+KMkmEsJg+XbHTqu3hipYaJroBjDiLQcQ9Noxxoz+CN9TjUdGAscRk= 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=ZZ9gtc+H; arc=none smtp.client-ip=209.85.214.178 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-pl1-f178.google.com with SMTP id d9443c01a7336-1f64a3e5d6fso781745ad.2 for ; Tue, 04 Jun 2024 05:46:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1717505170; x=1718109970; 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=RlFfGyvlYpwu5mumxxHK+PtmO5s3+buvtb+SvPxc6V0=; b=ZZ9gtc+HzFnFoM18eou/rOcC3NuD4FVSM/dEi8JicBScNDcQrq+bw+4b0PlcchXbcJ Es+wj3Zsf0jnCklYbhskBaJIqBBW9kwgkV/qoUgxySJ5t+seyFhQEFscN3u3CZqERisw XtTsa04EFvTWu/faxFMeiQsK4r63Q4WMVTCZQpZVFI2fascUv0bW0qlvlFb6A7WDeXR4 k1zQw8XY9TI4O0ki2x8QW4vq/HdIG7a7DODs8tqOFulQ3YfWoM5qiGBmnhx910yQed71 Ml8l6ilx05hOOGkLF3BgcYu7MmJB6DvC22dxAKFEuCm/3Gn2aYDo1DwPlY9EGgtsvY5T iMig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717505170; x=1718109970; 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=RlFfGyvlYpwu5mumxxHK+PtmO5s3+buvtb+SvPxc6V0=; b=Y6aXEmuRmEVTAgTOmWuu29yIthrzFaMkBrec+G3izD3cuSQrDYYpwAfRHMjovFTswo NwdWdQEH9aOeODZgt0Pl7SoRjcxB7s2oqL5etfz8URPyIj6jJT3SxeKTcWlS0W5dHPRn zSaCn5IeWpbhXQXoiFlIScYsCbC+QKf9F53plPdm5Uu8an3jgbfeS5RFxCdftSh9+wUJ xg+05I3wkPKBmFSjT6U1+htw1Hr/UUjwXdDelpJvw8aZOsNmuqVk6651xOTLXTh5P/Hc nbik54bhep0bbVbm9doX49S+w3IelFa5RB3fAVyvQYvo3LtogdkGHD9AmXrlgtoxqaue ukkg== X-Forwarded-Encrypted: i=1; AJvYcCUc7M2G80AdH5Z6kamCrmyjCXgdN4UhoztDBzfHcobntjKLvFXOQMOXYHOa+d/fv7Owl6l73AA5ALGsx83UvbYsWcNWZYENa6ci5v4b X-Gm-Message-State: AOJu0YzCO9RmFWlwttUMg3ksVyPNnmTaDQqODMetkhLaUrkIGhgdP+Lx 4qvWcRkqPiR/FrLs8vlw28+ris6eYYgJT7kTrxbbL0AYQyC1jk+lvAWqO9wmeHY= X-Received: by 2002:a17:902:ea0e:b0:1f2:fbc8:643c with SMTP id d9443c01a7336-1f6370f2847mr137326235ad.3.1717505170463; Tue, 04 Jun 2024 05:46:10 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:327b:5ba3:8154:37ed]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6323ebc69sm83042885ad.211.2024.06.04.05.45.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 05:46:09 -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 v6 00/16] Add support for a few Zc* extensions, Zcmop and Zimop Date: Tue, 4 Jun 2024 14:45:32 +0200 Message-ID: <20240604124550.3214710-1-cleger@rivosinc.com> X-Mailer: git-send-email 2.45.1 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 Zimop, 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. 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] --- v6: - Rebased on riscv/for-next - Remove ternary operator to use 'if()' instead in extension checks - v5: https://lore.kernel.org/all/20240517145302.971019-1-cleger@rivosinc.com/ v5: - Merged in Zimop to avoid any uneeded series dependencies - Rework dependency resolution loop to loop on source isa first rather than on all extension. - Disabled extensions in source isa once set in resolved isa - Rename riscv_resolve_isa() parameters - v4: https://lore.kernel.org/all/20240429150553.625165-1-cleger@rivosinc.com/ v4: - Modify validate() callbacks to return 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 (16): dt-bindings: riscv: add Zimop ISA extension description riscv: add ISA extension parsing for Zimop riscv: hwprobe: export Zimop ISA extension RISC-V: KVM: Allow Zimop extension for Guest/VM KVM: riscv: selftests: Add Zimop extension to get-reg-list test dt-bindings: riscv: add Zca, Zcf, Zcd and Zcb ISA extension description riscv: add ISA extensions validation callback 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 | 28 ++ .../devicetree/bindings/riscv/extensions.yaml | 95 ++++++ arch/riscv/include/asm/cpufeature.h | 1 + arch/riscv/include/asm/hwcap.h | 7 +- arch/riscv/include/uapi/asm/hwprobe.h | 6 + arch/riscv/include/uapi/asm/kvm.h | 6 + arch/riscv/kernel/cpufeature.c | 278 ++++++++++++------ arch/riscv/kernel/sys_hwprobe.c | 6 + arch/riscv/kvm/vcpu_onereg.c | 12 + .../selftests/kvm/riscv/get-reg-list.c | 24 ++ 10 files changed, 375 insertions(+), 88 deletions(-) -- 2.45.1