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 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 36538C433EF for ; Fri, 1 Jul 2022 15:01:26 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc: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=IGyBpp7QbmL/O1BtNJjSXvB6lwHt2mcrKoggrhm/kP4=; b=XtW/CD5rVRia4M qNFZSqtr0lAhqFBFe9yGkjailLX0BESxRehYcE6zNjZUnp4/RP0EcQggVZNdOUSU4IX2Y0RORmp8i JHbbMlpJ19+6nHrRkiDLaIVhxWds7KPPmuzwB7niOctzqeRxJWEB+1ijoEDzZPn4pCZ4sf7cdsVVo ++y7IkgfMymEs0GDPB73YUsqPwqcrBR0yvwQKXtIDtmWByp7TyE7u6PI/0NZs+6Z4na6zJ5Jz6lXf QY545iVDv/q0eBaso20oRyZ9QgzKUjo0kR1oXWEU32Yo+elpVk+z8sc18E9IwmHQmvQe+qhNG5QT4 dF8CIUeHqVNk6apjySgQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o7I83-005VTP-LF; Fri, 01 Jul 2022 15:00:19 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o7I7y-005VPy-4q for linux-arm-kernel@lists.infradead.org; Fri, 01 Jul 2022 15:00:17 +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 B55F6113E; Fri, 1 Jul 2022 08:00:11 -0700 (PDT) Received: from bogus (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8C2F73F66F; Fri, 1 Jul 2022 08:00:10 -0700 (PDT) Date: Fri, 1 Jul 2022 16:00:08 +0100 From: Sudeep Holla To: Cristian Marussi Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, vincent.guittot@linaro.org, f.fainelli@gmail.com, Sudeep Holla Subject: Re: [PATCH 2/5] firmware: arm_scmi: Support only one single SystemPower device Message-ID: <20220701150008.qsxg5outpqrsce5n@bogus> References: <20220623124742.2492164-1-cristian.marussi@arm.com> <20220623124742.2492164-3-cristian.marussi@arm.com> <20220701134509.e6wk3vwhimqre6h5@bogus> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220701_080014_324613_23D64533 X-CRM114-Status: GOOD ( 37.67 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 Fri, Jul 01, 2022 at 03:31:18PM +0100, Cristian Marussi wrote: > On Fri, Jul 01, 2022 at 02:45:09PM +0100, Sudeep Holla wrote: > > On Thu, Jun 23, 2022 at 01:47:39PM +0100, Cristian Marussi wrote: > > > In order to minimize SCMI platform fw-side complexity, only one single SCMI > > > platform should be in charge of SCMI SystemPower protocol communications > > > with the OSPM: enforce the existence of one single unique device associated > > > with SystemPower protocol across any possible number of SCMI platforms, and > > > warn if a system tries to register different SystemPower devices from > > > multiple platforms. > > > > > > Signed-off-by: Cristian Marussi > > > --- > > > drivers/firmware/arm_scmi/bus.c | 31 ++++++++++++++++++++++++++++++- > > > 1 file changed, 30 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/firmware/arm_scmi/bus.c b/drivers/firmware/arm_scmi/bus.c > > > index a7cbf4d09081..476855d3dccb 100644 > > > --- a/drivers/firmware/arm_scmi/bus.c > > > +++ b/drivers/firmware/arm_scmi/bus.c > > > @@ -19,6 +19,11 @@ static DEFINE_IDA(scmi_bus_id); > > > static DEFINE_IDR(scmi_protocols); > > > static DEFINE_SPINLOCK(protocol_lock); > > > > > > +/* Track globally the creation of SCMI SystemPower related devices */ > > > +static bool scmi_syspower_registered; > > > +/* Protect access to scmi_syspower_registered */ > > > +static DEFINE_MUTEX(scmi_syspower_mtx); > > > + > > > > Hi Sudeep, > > thanks for the review first of all. > > > Since we create device from the driver, can't we do this from there > > and keep the bus code free from handling all these special conditions > > which are checked for each device creation. > > > > Yes scmi_device_create can be called outside the exiting code but since it > > is not exported(yet), we can assume all users are in kernel and we can > > catch that if anyone attempts to add. And probably we don't need the lock > > as well if it is taken care in the single loop creating the device. > > > > Do you mean to move the check inside driver.c common routines like in > scmi_get_protocol_device() right before calling scmi_device_create() ? > > If this is what you meant, yes I can do that to avoid polluting the > bus code...indeed it would be easier than dealing with all the internals > in scmi_device_create() like it is now, BUT regarding the mutex I'm not so > sure I can avoid it since the device creation is triggered at the end of > main platform probe (driver:scmi_probe()) BUT potentially also whenever a > new SCMI driver is (lately) loaded and asks for the device creation after > (or worst concurrently to) the main probe loop. > You got it right, I meant exactly that. Agreed and that's why I mentioned we don't export that and hence it is not possible. I don't want to make bus code complex checking for this. We may have to do that if that is the only way in the future, but let us defer until we have to. > Beside that, there is the case of definitions of multiple SCMI platforms, > which is not officially supported I know but that is, in my understanding, > one of the most possible cause of having multiple instances of an SCMI > SystemPower driver trying to register. (i.e. multiple scmi DT nodes ALL > defining a SystemPower protocol with potentially multiple underlying FWs > advertising SystemPower support which was the thing we wanted to avoid > promoting ... AFAIU...but I could be missing something..) > Agreed, I am not questioning the addition of this change, just how and where :). -- Regards, Sudeep _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel