Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp2006272lqe; Tue, 9 Apr 2024 07:10:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUkgO+6BMzgRBKyGS37BhdXLoV1L3xofN0NoR66ASqin3jNMzkGdassToidJ/Jkpom4wS/yoUWyC/7htGUM+mNaZJb2f2aR6GyK5unqhg== X-Google-Smtp-Source: AGHT+IHZc7JIAdB1qJrFoAXBBbS3jAE1JcSd74FzJ7+bw9cIRHZ6Ncey7S8OM0LTaqjFAFo1Jd6S X-Received: by 2002:a05:6359:e8a:b0:186:3fcb:8da9 with SMTP id hr10-20020a0563590e8a00b001863fcb8da9mr675505rwb.21.1712671822045; Tue, 09 Apr 2024 07:10:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712671822; cv=pass; d=google.com; s=arc-20160816; b=a9zofau5wConm1IgNonJfUz96DzOmEgvAeYIXFKNnd60A1HFCvsCXa0yNlw13GNF1f +rHBgQ6cBkc4hkGL7b/R9NywswOYncz2cYSsz5Zx6s+ubAectw1YTZJdakDKhYqWv2Bb wM4SkFpqx/XvAeJLIW93t52GqJKYRNirfBZfXu8OZSpySwqPc3r26P8+lBclgJYNNgZ9 r6f8kRXc1dlsChSBS6+qJfFkHCrhYRdpiA+jWcCEnc0qAsGQBCn7YJnh77XaROg9Y16z +WlF+v14yPxkIgnkdBp/CXl0uEA4R1OrsyZsD7SLJ/+uGpGAc5piwk9YN/D+VK58TjK7 /b9w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=D6xRMFoAFACGk1LVbcSbDGnXfSAKXcOG+Uj+91H7veE=; fh=jVLa+iuLZ5chFr9Iem9FORw0g0FNVc7kirRs8M3/8mk=; b=u4Z/AUfOZcDtQaCcZOEC7lg2z0Hj9JOpw1ERj5JYdL1CBDcCQAYCdSzbr9+K0uhRWf 7MRhsq2U6Vj7JhOsdKiMbJmB1HYqbXIycStdFK2pK0kxsbRxy8yDgcnlhjz7FLzH/WOX /LPfl+7MXvNPQkn4AoWXQ9vWbM9lSVdv3lFzD52U8z4QuhHioJ4XGCms8fSqfYyLCiAf fMZpHUFpIkla1RRzAAsHqEiIBJvTNyTdRC6z4RQV2Cp+RFgHCp3hNpHQ4gInH5/wcxXO jH2vCyKGorLhAIGn5rUIXMZhVKdl+Wxs7sf/aWJ9SBdaFd++52nWToCCJpMHjriEGkRB xxxw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=r9IIJLfg; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-137059-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137059-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 35-20020a630a23000000b005f034b50977si8629658pgk.469.2024.04.09.07.10.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 07:10:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-137059-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=r9IIJLfg; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-137059-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137059-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 4551B281BF6 for ; Tue, 9 Apr 2024 14:10:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D857812FB00; Tue, 9 Apr 2024 14:10:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="r9IIJLfg" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 997577F7CB; Tue, 9 Apr 2024 14:10:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712671801; cv=none; b=NoOR/DSQYB/PGjVR/6rWl4hSlMHGI4nRs+hgnuz72tzxE+UcEfo9Sd95MAyJu2ghn9wUx8oiCmCoS2OLtfXXlxzbplr1jRGKpLJLqJh+g849Y0k3YCOaDWQno0s8eXP/m+B/Tt+yA/jR1LAUTzz8SqZ12l5CxyclUKcRwKmdHfw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712671801; c=relaxed/simple; bh=W7xZiCGfrp/J2JNm0PesJiqxLHyBJYWMZRS4zrswi+Q=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=lga/4Df5ccM8Bm5V85yhXbcoitTWMOMocw8yRzCqUxoV7w3yktfWKnszhn/fX2d2rr8dOBJOR+WNPSY7qDKSkouRR99/+LmjpUYKjmhy06qj9HRIXWHHlG2btg2omEHpxLyUhmy1FVAh46gUZccO4V88PYwKzi7JjM74sKBkbWg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=r9IIJLfg; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3E504C433C7; Tue, 9 Apr 2024 14:10:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712671801; bh=W7xZiCGfrp/J2JNm0PesJiqxLHyBJYWMZRS4zrswi+Q=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=r9IIJLfgRWb9nAvzxeXzOfe7nfY0TmB1sc3aTOUhhOQKEaAJvYrTtSCOHTbVAGJZx PcCrWBLEA2ejbMABRpXwQ4pFVpU2epobf0RFmlTM3ieHo3e1EgNFCittJ+XVaqoHjC nvFZafPuVEJuXWnrvHh9HcfPUocf+KyegKc8UrJd4y1Pf7B3Om95xbuWzuo0hOVE3l AeDGiKGdMsagGI672LOdQiPDvoSxSJlrQrIpdIC5bF7NdJ8lmJgnW1fC3gKpDZWin1 weKOssZimQ/mgZqNH2Nh5UieAX0DAyS+MbdNfIxDYYzoYSZioyhEgdRnOObX6Hlozt VMtpTZIugUGBA== Received: by mail-lf1-f46.google.com with SMTP id 2adb3069b0e04-516cbf3fd3dso6532687e87.2; Tue, 09 Apr 2024 07:10:01 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCVEPh2wrfz1ztSrKWsgx5gEZsLy30rr1TafKZaOKI+DeIKRr9GTkkU4E0TX0eOH9P/e7NkV4+fU7kA0qljUEnlVk45FLKm75w4S43lY6FbcIW16zyqm1USfuebhEXgiLdGaVXk0OFuqrg== X-Gm-Message-State: AOJu0YysFmUEPGQ8OvJHHdRAZ/BJG1Yd77J7wgoQObZNeNucxLozU0Hc Z1AWVArd49bzyMMs9vzAr1F+hYwTPUlKzuu1btZwiaBrPC0y3v8+6mOcAfUz35o+DpqB5gUo+I1 vNuNo24TI82zHOsut9HnoZ6s1Bw== X-Received: by 2002:ac2:4257:0:b0:515:a360:1d92 with SMTP id m23-20020ac24257000000b00515a3601d92mr9156118lfl.67.1712671799543; Tue, 09 Apr 2024 07:09:59 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <09f6b752-6b72-49d7-b248-6faba2fd13a7@kernel.org> <5b9e0e44-0b9c-44fc-9d18-21c47b46dc63@kernel.org> In-Reply-To: From: Rob Herring Date: Tue, 9 Apr 2024 09:09:46 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 1/6] dt-bindings: firmware: arm,scmi: set additionalProperties to true To: Cristian Marussi Cc: Peng Fan , Krzysztof Kozlowski , "Peng Fan (OSS)" , Krzysztof Kozlowski , Conor Dooley , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Sudeep Holla , "devicetree@vger.kernel.org" , "imx@lists.linux.dev" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Apr 9, 2024 at 7:01=E2=80=AFAM Cristian Marussi wrote: > > On Tue, Apr 09, 2024 at 09:25:10AM +0000, Peng Fan wrote: > > Hi Krzysztof, > > > > > Subject: RE: [PATCH v2 1/6] dt-bindings: firmware: arm,scmi: set > > > additionalProperties to true > > > > > > > Subject: Re: [PATCH v2 1/6] dt-bindings: firmware: arm,scmi: set > > > > additionalProperties to true > > > > > > > > On 08/04/2024 08:08, Peng Fan wrote: > > > > >> Subject: Re: [PATCH v2 1/6] dt-bindings: firmware: arm,scmi: set > > > > >> additionalProperties to true > > > > >> > > > > >> On 08/04/2024 01:50, Peng Fan wrote: > > > > >>>> Subject: Re: [PATCH v2 1/6] dt-bindings: firmware: arm,scmi: s= et > > > > >>>> additionalProperties to true > > > > >>>> > > > > >>>> On 07/04/2024 12:04, Peng Fan wrote: > > > > >>>>>> Subject: Re: [PATCH v2 1/6] dt-bindings: firmware: arm,scmi: > > > > >>>>>> set additionalProperties to true > > > > >>>>>> > > > > >>>>>> On 07/04/2024 02:37, Peng Fan wrote: > > > > >>>>>>>> Subject: Re: [PATCH v2 1/6] dt-bindings: firmware: arm,scm= i: > > > > >>>>>>>> set additionalProperties to true > > > > >>>>>>>> > > > > >>>>>>>> On 05/04/2024 14:39, Peng Fan (OSS) wrote: > > > > >>>>>>>>> From: Peng Fan > > > > >>>>>>>>> > > > > >>>>>>>>> When adding vendor extension protocols, there is dt-schem= a > > > > >> warning: > > > > >>>>>>>>> " > > > > >>>>>>>>> imx,scmi.example.dtb: scmi: 'protocol@81', 'protocol@84' = do > > > > >>>>>>>>> not match any of the regexes: 'pinctrl-[0-9]+' > > > > >>>>>>>>> " > > > > >>>>>>>>> > > > > >>>>>>>>> Set additionalProperties to true to address the issue. > > > > >>>>>>>> > > > > >>>>>>>> I do not see anything addressed here, except making the > > > > >>>>>>>> binding accepting anything anywhere... > > > > >>>>>>> > > > > >>>>>>> I not wanna add vendor protocols in arm,scmi.yaml, so will > > > > >>>>>>> introduce a new yaml imx.scmi.yaml which add i.MX SCMI > > > > >>>>>>> protocol > > > > >> extension. > > > > >>>>>>> > > > > >>>>>>> With additionalProperties set to false, I not know how, ple= ase > > > > suggest. > > > > >>>>>> > > > > >>>>>> First of all, you cannot affect negatively existing devices > > > > >>>>>> (their > > > > >>>>>> bindings) and your patch does exactly that. This should make > > > > >>>>>> you thing what is the correct approach... > > > > >>>>>> > > > > >>>>>> Rob gave you the comment about missing compatible - you stil= l > > > > >>>>>> did not address that. > > > > >>>>> > > > > >>>>> I added the compatible in patch 2/6 in the examples "compatib= le > > > > >>>>> =3D > > > > >>>> "arm,scmi";" > > > > >>>> > > > > >>>> So you claim that your vendor extensions are the same or fully > > > > >>>> compatible with arm,scmi and you add nothing... Are your > > > > >>>> extensions/protocol valid for arm,scmi? > > > > >>> > > > > >>> Yes. They are valid for arm,scmi. > > > > >>> > > > > >>> If yes, why is this in separate binding. If no, why you use > > > > >>> someone > > > > >>>> else's compatible? > > > > >>> > > > > >>> Per SCMI Spec > > > > >>> 0x80-0xFF: Reserved for vendor or platform-specific extensions = to > > > > >>> this interface > > > > >>> > > > > >>> i.MX use 0x81 for BBM, 0x84 for MISC. But other vendors will us= e > > > > >>> the id for their own protocol. > > > > >> > > > > >> So how are they valid for arm,scmi? I don't understand. > > > > > > > > > > arm,scmi is a firmware compatible string. The protocol node is a = sub-node. > > > > > I think the arm,scmi is that saying the firmware following SCMI s= pec > > > > > to implement the protocols. > > > > > > > > > > For vendor reserved ID, firmware also follow the SCMI spec to > > > > > implement their own usage, so from firmware level, it is ARM SCMI > > > > > spec > > > > compatible. > > > > > > > > That's not the point. It is obvious that your firmware is compatibl= e > > > > with arm,scmi, but what you try to say in this and revised patch is > > > > that every arm,scmi is compatible with your implementation. What yo= u > > > > are saying is that 0x84 is MISC protocol for every firmware, Qualco= mm, > > > > NXP, Samsung, TI, Mediatek etc. > > > > > > > > I claim it is not true. 0x84 is not MISC for Qualcomm, for example. > > > > > > You are right. I am lost now on how to add vendor ID support, using > > > arm,scmi.yaml or adding a new imx,scmi.yaml or else. > > > > Hi Peng, > > I dont think in the following you will find the solution to the problem, > it is just to recap the situation and constraints around vendor protocol > bindings. > > Describing SCMI vendors protocols is tricky because while on one side > the protocol node has to be rooted under the main scmi fw DT node (like > all the standard protocols) and be 'derived' from the arm,scmi.yaml > protocol-node definition, the optional additional properties of the a spe= cific > vendor protocol nodes can be customized by each single vendor, and since, > as you said, you can have multiple protocols from different vendors shari= ng the > same protocol number, you could have multiple disjoint sets of valid prop= erties > allowed under that same protocol node number; so on one side you have to = stick > to some basic protocol-node defs and be rooted under the SCMI node, while= on > the other side you will have multiple possibly allowed sets of additional > properties to check against, so IOW you cannot anyway just set > additionalProperties to false since that will result in no checks at all. > > As a consequence, at runtime, in the final DTB shipped with a specific > platform you should have only one of the possible vendor nodes for each > of these overlapping protocols, and the SCMI core at probe time will > pick the proper protocol implementation based on the vendor/sub_vendor > IDs gathered from the running SCMI fw platform at init: this way you > can just build the usual "all-inclusive" defconfig without worrying > about vendor protocol clashes since the SCMI core can pick the right > protocol implementation, you should just had taken care to provide the > proper DTB for your protocol; BUT this also means that it is not possible > to add multiple DT bindings based on a 'if vendor' condition since the > vendor itself is NOT defined and not needed in the bindings since it is > discoverable at runtime. > > So, after all of this blabbing of mine about this, I am wondering if it > is not possible that the solution is to handle each and every vendor > protocol node that appears with a block of addtional properties that > are picked via a oneOf statement from some external vendor specific > yaml. > (...in a similar way to how pinctrl additional properties are added...) > > > NOTE THAT the following is just an example of what I mean, it is certainl= y > wrong, incomplete annd maybe just not acceptable (and could cause DT > maintainers eyes to bleed :P)... > > ...so it is just fr the sake of explaining what I mean... > > diff --git a/Documentation/devicetree/bindings/firmware/arm,scmi.yaml b/D= ocumentation/devicetree/bindings/firmware/arm,scmi.yaml > index e9d3f043c4ed..3c38a1e3ffed 100644 > --- a/Documentation/devicetree/bindings/firmware/arm,scmi.yaml > +++ b/Documentation/devicetree/bindings/firmware/arm,scmi.yaml > @@ -278,6 +278,22 @@ properties: > required: > - reg > > + protocol@81: > + $ref: '#/$defs/protocol-node' > + unevaluatedProperties: false > + > + properties: > + reg: > + const: 0x81 > + > + patternProperties: > + '$': > + type: object Did you mean to have child nodes under the protocol node rather than in it? > + oneOf: > + - $ref: /schemas/vendor-A/scmi-protos.yaml# > + - $ref: /schemas/vendor-B/protos.yaml# Moved up one level, this would work, but it would have to be an 'anyOf' because it is possible that 2 vendors have the exact same set of properties. I can think of 2 other ways to structure this. First, is a specific vendor protocol discoverable? Not that is 0x81 protocol present, but that 0x81 is vendor Foo's extra special value-add protocol? If not, I think we should require a compatible string on vendor protocols. Then the base SCMI schema can require just that, and each vendor protocol defines its node with a $ref to '#/$defs/protocol-node'. The 2nd way is just a variation of the oneOf above, but do we do 1 file per vendor protocol or 1 file per vendor. Either should be doable, just a matter of where 'protocol@81', etc. are defined. Rob