Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1307864lqp; Mon, 15 Apr 2024 02:21:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVLZ1oWMdfsYMtxwg+xnH4siQ9AfGNOWk5FcnKNZ4dcBNLdUxCs6mT4TeWXd3nDUmr1AcEOmQhYVM3tgod1VLY4HKSiZ/gOJUPvbZBgvw== X-Google-Smtp-Source: AGHT+IH2I+Z0PuHv1uZxXWpZME6phSJMNpclArpu/CGNRlix7T6GoILMT/BfhGVzOyyoNML7o8BG X-Received: by 2002:a05:6a20:72a2:b0:1a7:8115:d0c6 with SMTP id o34-20020a056a2072a200b001a78115d0c6mr15813962pzk.11.1713172892581; Mon, 15 Apr 2024 02:21:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713172892; cv=pass; d=google.com; s=arc-20160816; b=ykxm58nUYRs6FkxRG69AaIEE7Hg20D0y7PA8P9SRCfcCf/j8QlWWPjzmv2Wk56wed4 7v3GzYwrprFDIVZITaoF2DX/ofAFxAmnEO04qYVCINfiZr9wGn9aCW7qpKh1ujnMvb3G 8/9PGsn01LY5Bc2hkCGQVvAlZ13yHCA8c96tZ1XNKNoXWDnm2QCPEJtG1SL6fsHe5JrH iCfzBeMx5thYpbBjGbp2SuXD4samxFDHL/GTvKjsweZn/XXquaJJf2hmmay9Vcd9n1ML wTmjU1vb+YjCzHihCIq7GneT47wYs6SRFcv7M36zozkC6jsRoIrTa20E+x3VkkkPODsJ Rnjg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=CMipTzrco8cuX1DyV3x6d9zPt5GQCAGmWbkRX0s3Bkk=; fh=JnMJEVw9g6ylDEKmsT09P6/BVY7RpP/ECECdVGTKzPw=; b=ISgH8sxYxhdh+3vO0Jr2YSBrtT13kqVC5WFpLbaHjN/X6zvdUjIxTnrVY0A7vFlLsi JPCiWWV8LC5YzeId0jFv5oh0/47LBvGFZpMg8sAY6M7HjT817PM/Lj65+dUEBr2CzftT Z4Iop3k4UqQfYj13RUIew6slPegJoeZ1mioa3iRlKE+wTp0sOXTI58J3j6RZcK0OT/Gj WO915+y3NCiAA8BnrhJeXaT9dJKk6tqO2y/4zESovd/GcP1Z/wJwgRg+KDVwN9DibcKt uZPd6f+vZnVNrTyXk+rB1Qzw8yEnr5YXIDaPOwiVbqfv/ATcC3koEOiDRZNcph+dfr/W cXew==; 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=ZZZSUQJ0; 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-144819-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-144819-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id b2-20020a636702000000b005dc85506e66si6885388pgc.402.2024.04.15.02.21.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 02:21:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-144819-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=ZZZSUQJ0; 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-144819-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-144819-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id EB031B24B8C for ; Mon, 15 Apr 2024 09:10:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CB7C43CF58; Mon, 15 Apr 2024 09:10:30 +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="ZZZSUQJ0" Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (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 374663BBDE for ; Mon, 15 Apr 2024 09:10:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713172229; cv=none; b=ThshMkEuNixT5mE8RuNqQjUt7Ey27JHYsA3Z+prMXwBEVTCn3I+Qn2OVaTjh1POnx7BDdtJVuuXJNCP857vITK/8Ob2op7pBtqLfywDlaY3WrdhE/9mhV+JinVxVnEYB6PCoPA6xUSasezDzUgtLF6UzrzvM/giOtbsGUJwh9mA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713172229; c=relaxed/simple; bh=fZt9c9X/Jc+Z+PWYJ4t8R4woVCVorw+BDVxxptvoH5c=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=dad2mCO2FYwJzlREtqvmlAU6RuY0SLvqphfTlWZ3Y9TqFDzRUAcYFHEKo1pLtBtR0T/yBYgSzaBkWClmhMcqYOrJngW72yWtnokZ9HP64YQKYd+AGmV8h7pD2w3pPLGFU0/DPaQXUInhkOOHFozRuKcraSHay6c28z8HKHzQlV0= 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=ZZZSUQJ0; arc=none smtp.client-ip=209.85.221.45 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-wr1-f45.google.com with SMTP id ffacd0b85a97d-345606e8ac0so621650f8f.0 for ; Mon, 15 Apr 2024 02:10:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1713172226; x=1713777026; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=CMipTzrco8cuX1DyV3x6d9zPt5GQCAGmWbkRX0s3Bkk=; b=ZZZSUQJ03c9MlL1ui6P6baX25LWjbkV2t/Tr+m6koC6TVUZRiS8xKQYkJSlQCcjS2C JHZ4UhD++dHDfNscz88rSZn4ZEBN3WEb9ao5LyOjjz5+iMruZ/7Zm2oosrHSef4mtNN4 s4gLQ0Dt6901BpqfjG/oWiIvjWVr1qDXMCdtKLXQdLlFyqcVfARTXrRzQK9Q2GANRUxf eD2csgR4vZKloLzlSDOYRgRUF1Pakd8rWHE4cz4cFqXhGEErKECnh4RsXFblohCBDtvp VqHOH5u6/51eYfXBlyLVFeFqbGQzYU8l3VTHqRW/9ZAmherm5CvBRM6uRESNJ4uW1XxI RZHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713172226; x=1713777026; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=CMipTzrco8cuX1DyV3x6d9zPt5GQCAGmWbkRX0s3Bkk=; b=ss7Z7sEve8KxXbDiqsogjb5K9z+i8k1Qs7xB605Yj/nFCZ36IRtA6CMzYRyxlhIrjK n7FB1Kj+5ro5gBCzJGnrTviJNHrX/3FVwxsVTEzp05BmTtM5wbNgYyxZ5790YuuFotqa +aU0pL30RlyTfnJfAIZxrGmJpp3yZvdMJYqGH+c+7CW8XZOdTas+6IVJSX8/2DR3X7/K SMfQTQ6dWNoazrbUISXFlH8ebUf0LpUbhwPoTZU6J7f5/DDPDPavlYK0v8Db/SQ97clI rwqc6jjh9jHL4pKOlnTWh97XGEX3np3braSL2qVVGMqT6Uk/I9SM5MFo6kXxekFoXByq d4qg== X-Forwarded-Encrypted: i=1; AJvYcCWkgZVZB8+JnIiJNk8migiDFT+jdgahJAswY1esmWD9yFepkEsNxLWzQYRwCddR10o9dxixeXXzPrEqxqiDqju7VzgRVVWOsZfQkE82 X-Gm-Message-State: AOJu0YxX1KtCZh3jth8S/aKtY6NOoX6lhuVh6HDjpt5GhKJ0tXjn796F imyEEQGZQGk6gPfch3L1l82DccRLYaIirBO3qGGAFi0ovRycd+KhV8jR0fsptPk= X-Received: by 2002:a05:600c:3b1f:b0:416:7b2c:df05 with SMTP id m31-20020a05600c3b1f00b004167b2cdf05mr6832257wms.1.1713172226355; Mon, 15 Apr 2024 02:10:26 -0700 (PDT) Received: from ?IPV6:2a01:e0a:999:a3a0:b1f5:d56c:abf9:b394? ([2a01:e0a:999:a3a0:b1f5:d56c:abf9:b394]) by smtp.gmail.com with ESMTPSA id gw7-20020a05600c850700b004146e58cc35sm18937831wmb.46.2024.04.15.02.10.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 Apr 2024 02:10:25 -0700 (PDT) Message-ID: <5eda3278-24bc-4c17-a741-523ad5ff79f7@rivosinc.com> Date: Mon, 15 Apr 2024 11:10:24 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 07/10] riscv: add ISA extension parsing for Zcmop To: Conor Dooley Cc: Deepak Gupta , Conor Dooley , Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Rob Herring , Krzysztof Kozlowski , Anup Patel , Shuah Khan , 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 References: <20240410091106.749233-1-cleger@rivosinc.com> <20240410091106.749233-8-cleger@rivosinc.com> <20240410-jawless-cavalry-a3eaf9c562a4@spud> <20240410-judgingly-appease-5df493852b70@spud> <1287e6e9-cb8e-4a78-9195-ce29f1c4bace@rivosinc.com> <20240411-superglue-errant-b32e5118695f@wendy> <20240411-backwater-opal-00c9aed2231e@wendy> Content-Language: en-US From: =?UTF-8?B?Q2zDqW1lbnQgTMOpZ2Vy?= In-Reply-To: <20240411-backwater-opal-00c9aed2231e@wendy> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 11/04/2024 13:53, Conor Dooley wrote: > On Thu, Apr 11, 2024 at 11:08:21AM +0200, Clément Léger wrote: >>>> If we consider to have potentially broken isa string (ie extensions >>>> dependencies not correctly handled), then we'll need some way to >>>> validate this within the kernel. >>> >>> No, the DT passed to the kernel should be correct and we by and large we >>> should not have to do validation of it. What I meant above was writing >>> the binding so that something invalid will not pass dtbs_check. >> >> Acked, I was mainly answering Deepak question about dependencies wrt to >> using __RISCV_ISA_EXT_SUPERSET() which does not seems to be relevant >> since we expect a correct isa string to be passed. > > Ahh, okay. > >> But as you stated, DT >> validation clearly make sense. I think a lot of extensions strings would >> benefit such support (All the Zv* depends on V, etc). > > I think it is actually as simple something like this, which makes it > invalid to have "d" without "f": > > | diff --git a/Documentation/devicetree/bindings/riscv/extensions.yaml b/Documentation/devicetree/bindings/riscv/extensions.yaml > | index 468c646247aa..594828700cbe 100644 > | --- a/Documentation/devicetree/bindings/riscv/extensions.yaml > | +++ b/Documentation/devicetree/bindings/riscv/extensions.yaml > | @@ -484,5 +484,20 @@ properties: > | Registers in the AX45MP datasheet. > | https://www.andestech.com/wp-content/uploads/AX45MP-1C-Rev.-5.0.0-Datasheet.pdf > | > | +allOf: > | + - if: > | + properties: > | + riscv,isa-extensions: > | + contains: > | + const: "d" > | + not: > | + contains: > | + const: "f" > | + then: > | + properties: > | + riscv,isa-extensions: > | + false > | + > | + > | additionalProperties: true > | ... > > If you do have d without f, the checker will say: > cpu@2: riscv,isa-extensions: False schema does not allow ['i', 'm', 'a', 'd', 'c'] > > At least that's readable, even though not clear about what to do. I wish That looks really readable indeed but the messages that result from errors are not so informative. It tried playing with various constructs and found this one to yield a comprehensive message: +allOf: + - if: + properties: + riscv,isa-extensions: + contains: + const: zcf + not: + contains: + const: zca + then: + properties: + riscv,isa-extensions: + items: + anyOf: + - const: zca arch/riscv/boot/dts/allwinner/sun20i-d1-dongshan-nezha-stu.dtb: cpu@0: riscv,isa-extensions:10: 'anyOf' conditional failed, one must be fixed: 'zca' was expected from schema $id: http://devicetree.org/schemas/riscv/extensions.yaml Even though dt-bindings-check passed, not sure if this is totally a valid construct though... Thanks, Clément > the former could be said about the wall of text you get for /each/ > undocumented entry in the string.