From patchwork Thu Apr 18 12:42:26 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: 13634673 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 E467DC4345F for ; Thu, 18 Apr 2024 12:44:12 +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:References:In-Reply-To: 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: List-Owner; bh=5pBHJ1lBchkAtQHBJAd9vlorc90utg0eQl0H019JnX8=; b=1k6wU53WukbTZo 6xr3xmEg9yEF6Fyc5Hlc99yhdE2PCL2xDFdmOCUgzTJCP5D1wB9G+Nd9voIrDr+SS/dI8PuCfz2VE +nz8lzi/DrsQls+bqgkn6aSExzJMb65aecYa81nQKX5hMqq7aJM5DmFZsTZD93O2i+wei2AhD3qfk Bb7DKG1BmKom10+H/Cpgq/Ck3T9kd9nZlp849EZpsnJuxYhbocXqG0lNVQ/m+64eAAPiX6mIPzmU8 rXgHurnUeb7ofA05foIYExwJSjsyaTqHnRIojvD/pstS0YtsUAvYrpBMGgwwyYvyY3nbLLtTsqqgR mqfzl0vRLrc1gQaccuLg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxR7X-00000002CXz-0KDs; Thu, 18 Apr 2024 12:44:07 +0000 Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxR7Q-00000002CRO-04rT for linux-riscv@lists.infradead.org; Thu, 18 Apr 2024 12:44:02 +0000 Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2d9f829d398so1957631fa.0 for ; Thu, 18 Apr 2024 05:43:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1713444237; x=1714049037; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VqinG7vx90NXqlB3cCAWzb6LZzjfwkXKYqGSSxQF2QU=; b=ehXSDB06S/Jdq+rbJDNIFRszt7gqHSFCRbGAQ0DD3ppmJMjkDrohLKK5uz2BxZ8H5i qd1IkoA0HiOIEpn0iY0Molwf+jGnO4ArgLVVW0NqGigLUhmz0EfZNAS6/6Az53PmRM3t vtmp1x1EAroVnUQxMUO//BAEI/CPGtBPM4B9fA91A/jDLpLiTCSybfUJd1LVsEnn2+zO zAxGuB1yTlN5YnotjKb3OLJWUllAheEfYHfUcfYpyzho1uCzYt8un/1UDtm02YU5phTJ SM7euEgn++ObUbRGLFrvOkPRSBWk/gJR2V9MOzxcpdH2DO6wKoRTGbtNHxUbQNTgWcDm K0sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713444237; x=1714049037; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VqinG7vx90NXqlB3cCAWzb6LZzjfwkXKYqGSSxQF2QU=; b=ht945H/JHISbrpcpTLkkNiTdlDQylq1M8bo/EXqFd66IfiWorbraYJR4fwGyqX1XIs PLcohzbemWIquu3JxZ5mrs7Z0N+EYxkVCfPJb2ClTxXrO6zHBsDwnLK8pa6L9nD4Jftg CfZ5JrAphnPsX1uKJ+ONaOpc6uVSKLMLGQUECWNDns8bU3zyWkLAjB6kAzqwgPcaqrqy exYxBZ1VdEOwZIIzPCSXJycPQ0O8eMWOWBdIMtox+7GpLD3F8qKKCpkqyfWjXV72HaPE e59oVeFGpya7xyAU8X1PPU6rWjjlaacZj1eVcr4jRAhdZeLWXZFMzzLwNEu9sVFY+1rn TNdQ== X-Forwarded-Encrypted: i=1; AJvYcCVv06IGWuOE74DlUJjrRxBVfPlyaXGCdmi6llplHYQgsbVEBqt3cgcjY3ngNdDiWWmLH37tlxTRxkQ11L+D3uqAG9RKtqOfJa+nWck+wNa5 X-Gm-Message-State: AOJu0YwFBpEBj7Zs9LU52RudvKKtLP1jO3eq6PnnfZAxOaaeUe2AixWO UWwZ7THbRtHXkZ/Hf/0wlvq5JlmaelH7V7E+Z/lhJRndbsKlkgrTrT7oM+XqUqQ= X-Google-Smtp-Source: AGHT+IFXBu2QshCmevcqDNI9qC29EYmJ3ZQBbQK0N8BE6U3hHj6+0OsosVqzAbOLR3+7A5/jwaHB/w== X-Received: by 2002:a2e:8387:0:b0:2d6:c59e:37c0 with SMTP id x7-20020a2e8387000000b002d6c59e37c0mr1507578ljg.2.1713444237161; Thu, 18 Apr 2024 05:43:57 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:7b64:4d1d:16d8:e38b]) by smtp.gmail.com with ESMTPSA id bi18-20020a05600c3d9200b00418d5b16fa2sm3373412wmb.30.2024.04.18.05.43.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Apr 2024 05:43:56 -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 v2 03/12] dt-bindings: riscv: add Zc* extension rules implied by C extension Date: Thu, 18 Apr 2024 14:42:26 +0200 Message-ID: <20240418124300.1387978-4-cleger@rivosinc.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240418124300.1387978-1-cleger@rivosinc.com> References: <20240418124300.1387978-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240418_054400_092131_ED38A6EB X-CRM114-Status: GOOD ( 11.22 ) 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 As stated by Zc* spec: "As C defines the same instructions as Zca, Zcf and Zcd, the rule is that: - C always implies Zca - C+F implies Zcf (RV32 only) - C+D implies Zcd" Add additionnal validation rules to enforce this in dts. Signed-off-by: Clément Léger --- .../devicetree/bindings/riscv/cpus.yaml | 8 +++-- .../devicetree/bindings/riscv/extensions.yaml | 34 +++++++++++++++++++ 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/riscv/cpus.yaml b/Documentation/devicetree/bindings/riscv/cpus.yaml index d87dd50f1a4b..c4e2c65437b1 100644 --- a/Documentation/devicetree/bindings/riscv/cpus.yaml +++ b/Documentation/devicetree/bindings/riscv/cpus.yaml @@ -168,7 +168,7 @@ examples: i-cache-size = <16384>; reg = <0>; riscv,isa-base = "rv64i"; - riscv,isa-extensions = "i", "m", "a", "c"; + riscv,isa-extensions = "i", "m", "a", "c", "zca"; cpu_intc0: interrupt-controller { #interrupt-cells = <1>; @@ -194,7 +194,8 @@ examples: reg = <1>; tlb-split; riscv,isa-base = "rv64i"; - riscv,isa-extensions = "i", "m", "a", "f", "d", "c"; + riscv,isa-extensions = "i", "m", "a", "f", "d", "c", "zca", + "zcd"; cpu_intc1: interrupt-controller { #interrupt-cells = <1>; @@ -215,7 +216,8 @@ examples: compatible = "riscv"; mmu-type = "riscv,sv48"; riscv,isa-base = "rv64i"; - riscv,isa-extensions = "i", "m", "a", "f", "d", "c"; + riscv,isa-extensions = "i", "m", "a", "f", "d", "c", "zca", + "zcd"; interrupt-controller { #interrupt-cells = <1>; diff --git a/Documentation/devicetree/bindings/riscv/extensions.yaml b/Documentation/devicetree/bindings/riscv/extensions.yaml index db7daf22b863..0172cbaa13ca 100644 --- a/Documentation/devicetree/bindings/riscv/extensions.yaml +++ b/Documentation/devicetree/bindings/riscv/extensions.yaml @@ -549,6 +549,23 @@ properties: const: zca - contains: const: f + # C extension implies Zca + - if: + contains: + const: c + then: + contains: + const: zca + # C extension implies Zcd if d + - if: + allOf: + - contains: + const: c + - contains: + const: d + then: + contains: + const: zcd allOf: # Zcf extension does not exists on rv64 @@ -566,6 +583,23 @@ allOf: not: contains: const: zcf + # C extension implies Zcf if f on rv32 only + - if: + properties: + riscv,isa-extensions: + allOf: + - contains: + const: c + - contains: + const: f + riscv,isa-base: + contains: + const: rv32i + then: + properties: + riscv,isa-extensions: + contains: + const: zcf additionalProperties: true ...