From patchwork Tue Apr 23 12:43:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 13640014 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 D0A2AC4345F for ; Tue, 23 Apr 2024 12:43:57 +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: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:In-Reply-To:References: List-Owner; bh=Fq5UZHre4hrIN6pQ9BxYwYqNX+FXqPV/hiIj3Ngc/qc=; b=yAJhSWNBbSsC8Q m1RrlpZAKv3QOIj1f2kUl+J/oDqdlSx+l4vs9cPZN6CfMmbSirta0oulo4rOcSbIyesEwkbI0IbXc rikidDhox+9RmiGOMn4wF9SEfCHTaTj4ZmIEdHZs+5TDJq0HTMm/95Jq23yfNnb3dh6DPOOgCL1fa dy84StJ4SRCxyuIwsh+SoAOE6pCefng6VF0vIZ+q4H1DcOBccIYbFOqPzvZX8YKwc2e0MCeOQ/IsD 8N+G6BWXmL+T+1f+++OHqlVekHgZoWhl5JzBlmkz+qvaqIdy9NgzCJz2sNL2DAAWeqV0UOb7ggyUz gi2IKaffO1GPCmPEVdgg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzFUw-0000000HSOR-2QQW; Tue, 23 Apr 2024 12:43:46 +0000 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzFUt-0000000HSLh-0NIr for linux-riscv@lists.infradead.org; Tue, 23 Apr 2024 12:43:44 +0000 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-34801b1bc4aso947578f8f.0 for ; Tue, 23 Apr 2024 05:43:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1713876220; x=1714481020; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=C9WxKxISE98J4DR8ayongvF0iJ3p8rHkiA1LnrlMpVw=; b=Bck32+4jiDGGQvcF51AW/HgoWtmWGH7Jzg5hkOwNq/2JwY3RIIWbD09cqW81DDt8tK tWmp+1S9OGh3J7UtTeK7VZCAhB7bIhHQ8R2XpkcUJLI2uk6X6QQ71baZbE2spF5muhTs 6ylepPhpdMWX4P5fbTSpwr9IlfViLcUtF6+W1KEfA7PMsIER9bz7e1IaIFCCIw2zRhE8 LmearvP6dj+u9WyZETSGyjuHW87hp1lSW2sIKAwAi0pl9LRksbFuMX76ijQOiPeDUBRC lvrqpX2/joBa2BWAhjhVqw0YwP1lMUoPadXrTYImIjiJtR9/aoaslt/g9rbBOIf6AyAw YEPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713876220; x=1714481020; 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=C9WxKxISE98J4DR8ayongvF0iJ3p8rHkiA1LnrlMpVw=; b=UAJVaOjVbQWJyRIbCJLFi1/LnH5izQtTEbLoh4gtbKeLkQI2QTdvigV0XKC46j0Hv9 kC3LM4iMG58PKV+8kp/IgsHe4y/UyYpFdpiebysz8+jaGnXSleNNQCh0VZFR9wdR6/9v WBd9Towyu7Osw/3Etb/izBZ1Vzql1ocvR4N74Ykk6z5pO5dl37Sj954z1uoyR5b329aT HOZ3Rt3h/aePDH+AmmZ1ND0FgtLiUNov7q6m8Org5rRtxW/R0nHoKd6nj5Zovud3GOgp EdftGGQRd8vc7dYn16jMdy19RAjLOrmKadevuxdKgOysc47enyZTLTMUeVE8zUf+KM6C v41w== X-Forwarded-Encrypted: i=1; AJvYcCUtjDLARY0lJFyuAV/KDOR6+r6nQUcb6j2fMwIdJHr2EPsZO48ykBki2URPOrE5YZvliJ3sqcgL60tqshhekYi+G4920b9R/bLP2QxH9Iob X-Gm-Message-State: AOJu0Yz+y4QoYap8SuNvvlfLrlTteVV2gMuhgEcVoR0M2r8669ndNQk9 QCv3olEnFozflWc2ZoIkCy1i9WbdZpQkOHYiAM5WY2ofDlB1RHigTGL+GKufIcc= X-Google-Smtp-Source: AGHT+IHpI2Tpv9REfejw04rEmQ/PVuDNtz+wncAv+sSz/yClI0MXsOsXH9hJ+L4XIOgzD6O4fSViLQ== X-Received: by 2002:a05:600c:1c90:b0:41a:b9a1:3ecc with SMTP id k16-20020a05600c1c9000b0041ab9a13eccmr1166991wms.3.1713876220072; Tue, 23 Apr 2024 05:43:40 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:71cb:1f75:7053:849c]) by smtp.gmail.com with ESMTPSA id v10-20020a05600c470a00b00418a386c059sm19975709wmo.42.2024.04.23.05.43.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 05:43:39 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Anup Patel , Shuah Khan Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , 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 v3 00/11] Add support for a few Zc* extensions as well as Zcmop Date: Tue, 23 Apr 2024 14:43:14 +0200 Message-ID: <20240423124326.2532796-1-cleger@rivosinc.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240423_054343_162297_AA0C71B9 X-CRM114-Status: UNSURE ( 9.30 ) X-CRM114-Notice: Please train this message. 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: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org 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] --- 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 | 249 ++++++++++++------ 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, 329 insertions(+), 85 deletions(-)