Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp998076lqo; Fri, 17 May 2024 07:53:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX1CkcrOoNxn1KVu7HvggjVkyK59jbHY5B0RNmvWXRYiu8RBXtRhFZRBsVk2mw++pihxmmZU7DJHrJ0Mnq3E30DPvSTmrChp+SHvYeDbw== X-Google-Smtp-Source: AGHT+IEqL8r4VajJACyFJv/DTVCNuH0Uyee87/mYUQrakhZgxzIuNFnvGKMsMIhyZk/hDqqOM3qN X-Received: by 2002:a81:8d48:0:b0:622:f7ef:7bc4 with SMTP id 00721157ae682-622f7ef7d95mr119836667b3.31.1715957611616; Fri, 17 May 2024 07:53:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715957611; cv=pass; d=google.com; s=arc-20160816; b=wC4PIbobr8KYpA5s5Sz/Vvu89M/k/gwsEd4/0MVJY20h5g1nLSpBijmRn8x3pACPkg Y7yb91VreZZLNb67JH8dzIMu83T9A+2V1jhSEODpv21e8fIMZI/zW+6R2+Oi9qRwiwyd Z7tR5Cq5TNtwxpxmwAUTSwoalmCOkFE1Ve6HFT6AW2ouDipVXuHWJxeJEfw4IuWZE7gQ ur0qLhrKej8rVlAepwPfmtaPy8g1O2jiWAQC9r95kVodYU6yAape9Py4QP1biVHqLmZF NaMhqP0fwWPqY5FEhhntgdT3LjcXhxToX81BCEb7jjbTe0Jv6ss3pNGtsVB3CRyVstFH bkhw== 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=MBxnVnvMYgrOz5wGG3XSCFV37Hy6vOq+FURf3O2sV60=; fh=piKMl0nuXqccPX7wV7XVjg6/2IOmelSdC0IjNzdQ1SI=; b=TFw0Vxse+gIgcEjfRqfz8MjQ5aPTZI0jGuOc3k8FNgTl1ypdTUMtGYwGHS86WnxTpT uFv7Es/JYOMkHN2wJMTa+7U4hhNvIAFjCmrvwVmeEz8khNN/T6un9S44D3JAKogy1gW9 EN5NgLZoQLkG1ICzPPdLvDs5gmmN19tHV41/Li9U2srpRZzzOy0noTMU4YrvFXrWb2BT T8wvh6OT9TPN5/MDEGSkkD1G5c8bR7SD2mmbTfy2WLeh4zydfDii36o8byrJjF5KGb40 xB6mHKGQjxluDq4NkVTpGxMv95N3qTfvDjsBrJZUScC/rCQjWFh06P/lDlc7KVThe+gl 1JwQ==; 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=uDRAJlKr; 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-182238-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182238-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-43df549d458si174943971cf.96.2024.05.17.07.53.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 07:53:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-182238-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=uDRAJlKr; 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-182238-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182238-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 398A41C21BCB for ; Fri, 17 May 2024 14:53:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 320836A039; Fri, 17 May 2024 14:53:20 +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="uDRAJlKr" Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (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 6D64461691 for ; Fri, 17 May 2024 14:53:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715957599; cv=none; b=CHtXklXwDvNS3X9wiw7kMedVyOyTeexaIEQVEZjngI1tfuvoNH0wnaaKtZrokRN/aqps1ZcZaOi7y5Il6xOk8wuoLWjLrG329b5/VHTipdZzZBu9qfSZSYT5rGrSjoWw+Z94f1IOlFA9BsrI0VNP5qeRX7smrXG9GsNTjCnTIL4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715957599; c=relaxed/simple; bh=11tFZYMuDAVi+4LdOZqevmF5dxJsVBfI1xfm/Sl6E5Y=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=nYGxnE4IQ+uLAw7gmWpF3hLDytVwYeGyTnkVG3wb+Ay/aKLNAaLqzbNk6VZBRQ9eSC7iLRqMT15zjUPQkLK5EMCx9Pf8rlGOfcvZvW2fhbroGXoPvv4WavFh3tXAi8fufyYCaGH2CTSdzjx17i0QsfQAg8XZTb5oX/4JevJDJHk= 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=uDRAJlKr; arc=none smtp.client-ip=209.85.128.50 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-wm1-f50.google.com with SMTP id 5b1f17b1804b1-4200eae18e0so324465e9.3 for ; Fri, 17 May 2024 07:53:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1715957596; x=1716562396; 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=MBxnVnvMYgrOz5wGG3XSCFV37Hy6vOq+FURf3O2sV60=; b=uDRAJlKr5Mb2MqFY26e+MkN4P2KElvhjOixy3rEUUpYyeTh4FTW+rAD9FSpFIAbehY NMfO0vPKNC7vqimVLaJeLDMebzpokanOF25MSCoisdfqgkZUt6hMKdxiRJwBcgSVDN3P c2JLufSk3SU2w+ibAiJ1x1TJp32z2c/9VKnIr3dQ+06Fj+jTs/hesQ9Q4IAxs0Qfa5BQ H5pfLwh3PO3HHOthGIJimaKCJHEIymsgfvPftfpqfW4OT/lIxRqQIMQIIGiBrIZdhpC+ vDjFMk9LYUXxVOtYTCRO2VKUwnCDkOPLdVmDhI1Go6si4MTj4/zC6kAE70MF82irGiVJ 7D1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715957596; x=1716562396; 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=MBxnVnvMYgrOz5wGG3XSCFV37Hy6vOq+FURf3O2sV60=; b=LG9qKZEKmeW0P/eNKRldom3ev2jhJM2OO4qfweXWwKwONTfrAqa2/DwlzfilLxoBCU tF6pvVO22rsPhN/UvEyDwK2nKcHPEH9uxd87KpYpiA1NwOczrV6c5wRSPtC0pkem4H7q 7LdV5R00q3EYs4LWzyX45ItLUgxZp5pn2UBgtVMA6eAA5JPp5lvggbH68LVBjVMZDmf7 t2P5o0Kx4gUQu8jjVbd2wzQ0UNKA98NjnkEeXsuld9uZw0wSRuFBIYcnVi8tGnd/uaXb VxyuRiBSBDr7wZgCVCjV6ENARCyJBDrwd+hXtObtS2Rk+EAOhXRsiPw75wNI1OR8bihe fcLg== X-Forwarded-Encrypted: i=1; AJvYcCXLBdO90K1bR6WazYErCkQPBhjIyH6tsNmmZ0N5RfqiAqAUPwSK/ZcMTZNtRjJS0NV8A76EO3Z51OLN+vydyoI3OtTnUhBr9HWfs5LD X-Gm-Message-State: AOJu0Yw6GrYStvPzBG22QPoAUQR6eTUtzNKhuYiWVXCpsjBt9SlPSs4a 0VwFmNatz6X8I44aMlg169M847Ur9QiTaDFvoigxm2IBQWBTnJ8JOggqisRkEI8KNbTbDA+RyWK 9Img= X-Received: by 2002:a05:600c:3b0a:b0:41a:3150:cc83 with SMTP id 5b1f17b1804b1-41feac59d8emr162018155e9.2.1715957595750; Fri, 17 May 2024 07:53:15 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:46f0:3724:aa77:c1f8]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccce9431sm301723695e9.28.2024.05.17.07.53.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 07:53:14 -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 v5 00/16] Add support for a few Zc* extensions, Zcmop and Zimop Date: Fri, 17 May 2024 16:52:40 +0200 Message-ID: <20240517145302.971019-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 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] --- v5: - Merged in Zimop to avoid any uneeded series dependencies - Rework dependency resolution loop to loop on source isa first rather than on all extensions. - Disabled extensions in source isa once set in resolved isa - Rename riscv_resolve_isa() parameters 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 | 26 +- arch/riscv/include/asm/hwcap.h | 6 + arch/riscv/include/uapi/asm/hwprobe.h | 6 + arch/riscv/include/uapi/asm/kvm.h | 6 + arch/riscv/kernel/cpufeature.c | 244 ++++++++++++------ 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, 366 insertions(+), 87 deletions(-) -- 2.43.0