From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8126C4363A for ; Wed, 21 Oct 2020 11:36:38 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2DA6520872 for ; Wed, 21 Oct 2020 11:36:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="SsWy9HDb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2DA6520872 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=t+h79X6ql8fvzLkosZ6C9MRfEvZAwstsYtlkqQpAL4w=; b=SsWy9HDbFxp9jvSdbpE98VAE2 iHS1QsTPi+/+oPHcpLOpy2hdrgqzsWO+3/MLx+lkaT8VjTYvmBKmYaVD0qTNbvx5bFDC/TWHZzvvP 82KbBBSWhQiVkjOGZYBZdirbXQ8wGG89Vkx5euPPTcjsEzmoJmJqdt8yzm7b9FdemLN6puU3rMRNz pQ0dtKJSmMAkXZBk510ku92DgGz5oA2fyn0hK341w9WMR4LxYRH9F/U13ujwC/rl9lZD5LmUQLMxH ucBAK3XUn/1PVTFv8uo91xqvk3w8YlfDgi1HgoQnssFrbK/bgu9xgEYr7LKjWmgD9oIsB+EgyfQoL YVUGfdL/g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kVCOf-0005hX-UJ; Wed, 21 Oct 2020 11:35:13 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kVCOd-0005gs-Jw for linux-arm-kernel@lists.infradead.org; Wed, 21 Oct 2020 11:35:12 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 193021FB; Wed, 21 Oct 2020 04:35:09 -0700 (PDT) Received: from e120937-lin (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 99F013F66E; Wed, 21 Oct 2020 04:35:07 -0700 (PDT) Date: Wed, 21 Oct 2020 12:35:05 +0100 From: Cristian Marussi To: Thara Gopinath Subject: Re: [PATCH 10/11] [DEBUG] firmware: arm_scmi: add custom_dummy SCMI devname Message-ID: <20201021113505.GD20482@e120937-lin> References: <20201014150545.44807-1-cristian.marussi@arm.com> <20201014150545.44807-11-cristian.marussi@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201021_073511_833325_1F6A0888 X-CRM114-Status: GOOD ( 35.45 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: f.fainelli@gmail.com, vincent.guittot@linaro.org, sudeep.holla@arm.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, james.quinlan@broadcom.com, Jonathan.Cameron@Huawei.com, souvik.chakravarty@arm.com, etienne.carriere@linaro.org, lukasz.luba@arm.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Oct 20, 2020 at 10:49:23PM -0400, Thara Gopinath wrote: > > > On 10/14/20 11:05 AM, Cristian Marussi wrote: > > Add custom_dummy SCMI devname. > > > > Signed-off-by: Cristian Marussi > > --- > > drivers/firmware/arm_scmi/driver.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c > > index 55df134c2338..5c39a738866a 100644 > > --- a/drivers/firmware/arm_scmi/driver.c > > +++ b/drivers/firmware/arm_scmi/driver.c > > @@ -993,6 +993,7 @@ static struct scmi_prot_devnames devnames[] = { > > { SCMI_PROTOCOL_CLOCK, { "clocks" },}, > > { SCMI_PROTOCOL_SENSOR, { "hwmon" },}, > > { SCMI_PROTOCOL_RESET, { "reset" },}, > > + { SCMI_PROTOCOL_CUSTOM_DUMMY, { "custom_dummy" },}, > > Hi Cristian, > > Thanks for the sample dummy custom protocol and driver! > The problem with adding scmi devname into the array is that every time a > custom vendor protocol is added, the array has to be extended. Instead since > the scmi spec supports the range 0x80-0xff for custom protocols, why not > check for that range in scmi_create_protocol_devices and go ahead with > registering the creating the protocol device via > scmi_create_protocol_device? > Hi, so this is really a good point, and in fact in some earlier (non-public) iterations I had a mechanism to just get rid of these device tables, thinking that if you want to enable custom protocols loading, it seemed better to let the related devices being created dynamically at will, so that an SCMI driver can just 'declare' its own device name and that will be created if the corresponding protocol is found in the DT and implemented in fw. Anyway this complicated the code a lot in some dubious ways. In a built-in scenario you end up with your driver being probe before the platform SCMI driver, so you cannot create the device straight away in your driver (there's not even an SCMI bus still) and you anyway need the platform SCMI driver to be up and running to check the DT and initialize basic transport to talk to the fw and check the protocol is supported by fw before creating the device itself: so I ended up basically having the SCMI driver just 'requesting' some device name to the core and then having the core creating the device later on when the SCMI platform was probed iff the DT and the fw supported that protocol (or immediately if your driver was a module and the SCMI platform was already initialized) All of the above, even if working, led to a lot of machinery to track all these requested devices properly and properly create/destroy them, and also it does not seem the right thing to do, since it's basically mimicing/duplicating all the usual probe deferring standard mechanism. Maybe this could have been addressed in different ways but I've not explored further. So at the end I removed such dynamic device creation support from this series. Now you proposal would be, if I understood correctly, to just create straight away a custom device whenever its protocol is defined in the DT and supported by fw, so that the custom driver above would not have to declare anything statically, and it will just be associated with some "dev_proto_99" matching just on protocol number. I'd like this option because it simplifies a lot the above issues, but I don't think it is viable because in this way you are no more able to define 2 distinct SCMI drivers for the same protocol (like you can do now defining multiple names in the match table: as an example you could not create a different "custom_dummy_2" SCMI driver using the custom protocol 0x99, because there;s only one single "dev_proto_99" device created and already probed for "custom_dummy". So the problem is again that if you want to support multiple SCMI drivers they have to be able to declare their own devname, against which the platform SCMI driver can match and initialized if needed the underlying device. In short, I want certainly to explore the dynamic device creation further, but for the moment I put it apart trying to consolidate all the rest. Maybe I could re-introduce something better later on in future versions of this series, or maybe just address this a distinct series later on. Sorry for the flood-style email :D Thanks Cristian > > > }; > > static inline void > > > > -- > Warm Regards > Thara _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel