From patchwork Fri May 17 14:52:40 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: 13667104 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 7A21DC04FFE for ; Fri, 17 May 2024 14:53:28 +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=3ugB5bS27014UUEbPPu+omQiRcmbiO/o4oLpGj8SiQk=; b=gvh6To2GqPQX0z iPXsgJdTUK9B1skvMKWy64VPOa/soCsdN1DqEhc3+qpx5flTaLBCmJ3Uzh+1k4/wS6nCdJk+1Pyrh g3UUl7vkUC4HtEH4GkR8i/vlCmIm3bQIvxRvIRgDkgyxxz3znecnuQnPX0kBH3ck95Pap1NjqYraj u6VP9RSgJzG8jXn4j6cIF7qH5a5dsvf+JiIeGcxg245A+kPhBycHGTq7ZBFHyYJIQJESmB3Cnr3De 1IcIuH72sCX44E/NCDhPREj4LhEPpgKNd+Sf7a5RnO9jovZ8qL0Bvl1FfU/nO611o4zoMZltrqU2N dJWZdoAvuOTpqop9nF/w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s7yxX-0000000884c-0Mzh; Fri, 17 May 2024 14:53:23 +0000 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s7yxS-0000000881B-387W for linux-riscv@lists.infradead.org; Fri, 17 May 2024 14:53:20 +0000 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-420139ea1c4so351495e9.0 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=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=MBxnVnvMYgrOz5wGG3XSCFV37Hy6vOq+FURf3O2sV60=; b=IgFAKVJilKYmWcIWi3/E0JNl/zCEcgLLN0hH3yd+5iNF/WgEZ5M30VkVbLTv5PQVFl 3ECEgfjmIGDWyF4oHChNrxB7vAOm+dJhtcej2Zj4LZirzUcvDgOXHFscjbhPhuPSnz1d lIv4zdnN+lwD86BjnwDlHzgjhE/4EjUfV3xP1Lt8F5obbqpB0l0mS3yl80DykRRDJTUf bZ/BiemUXXAJd8A1w49qREVGp98lHza5Ojy/QoNZsoQ7TDqdz7y/M319/XNmEeOqt/dA mjqRouoD/laqG2xsWPt8Wnq7+Yj7pMG+bCAgsIeqVPlyVYcqQH0hfAtR/+2QF9x6W+sU vX0w== 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=NkV8vR26f02tkZWW4uUt5rzpWMDqbIpGYlgGhCT4i53MZb7pfu34naIp8uN4YWl4N9 wHnZgK3RsCDshnZgnnbjatDankIArvES9CrCUgrxxgajBLdBJwS82/wNSqVzUQJr0Q/8 DhVoJcx1XY1dy/NsK/skVUJe/hzXD5t60yVrhpNfSIT5r0Ve+ILbxXGNcWbET0mdNvnM 5QS7avWahMNv162a2AazMIYLMKij59i0ByOt1/z8W8dnOsXRUtBE80+aCQLXNGmNw8Xe 65zAqX7NX8tbmeO1gEaC77zidye+TlFMyzbH4Nug5e3O8gY63hl0Sw22ribXMQ0nP7pE zjdQ== X-Forwarded-Encrypted: i=1; AJvYcCXNrGQr91W7208v6PD/kWWlFhZYtYTyBVAfpgEgPcbVMuVqwqW36IFZTJrDvE0QtlqpOQliXhZV2c+IBGDWL1W+2RyF0horhi29KMoUAZHS X-Gm-Message-State: AOJu0YwUvL3UfvG9xPpVUEaQgAe74a0mZlrrdP9WxgaI+d+a2ozOrWhA eGTNeFiNMZPamBfr+NBksYWLEdyjkYVQGAFffjja++juoq7a/Z5fc26xTtaUrlg= X-Google-Smtp-Source: AGHT+IElTJZHwS4R62Imc5G809nVY5XtS1QeDbXqWpbZYtlvSrsfuUs8xxpZzJsOl058opK+T4g56g== 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?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 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 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240517_075318_913669_A1985B6F X-CRM114-Status: UNSURE ( 9.06 ) 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 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(-)