Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp242418pxu; Tue, 5 Jan 2021 09:38:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJxHZfOQjkkcowM+vEKxSC6IbLkOvRrvMT878AyK24t9qOYmijiJ0CBfVagVQVi4371uJiGe X-Received: by 2002:a17:906:e18:: with SMTP id l24mr215873eji.434.1609868280550; Tue, 05 Jan 2021 09:38:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609868280; cv=none; d=google.com; s=arc-20160816; b=yyt5gC36O5ZPL4+908tzV8U3Rr5f+BrakOyEG3MCZ08F2uvDiZGCtQytm4Y4ZJqEsK IdQINLy35Tocn1jRAvhD+3+LOZAQ6BcJqflwNBp+WujDv2YGl0qDMHSTRULpIoyIz/9F kxqtRX0/IITVNNJIUjJaIN2hDlEOoStdSAc3T8Kd9U9JjyE/cPEGkYoGyfMfm5Hae3Mp x/vsxMQv64cgOvE7Pa4TKejfPbefC+cjCP1a1EQ32sQ4Pw1+itD6CK9V2Gz0gfvNz26B DobFbanMntNWBP2n3sWcuuOIvh8S54LT/zq5fOFic5UG1T0+97wqDoHLs9x64nzTKWpY +7QA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=TEolL6s0tRHpp2QZ32wpFs+XdLTWurrIOoPZKnsaISk=; b=lg2wbFnqWVlyEeG5oDTrgNg+Zi9BWRR9GAxMph3+bCFgO1a8RaFkaYfScxkfPosc/T Ij3sF6LTLgoNvqeC2ldl6/nv4UmGwgVoZFaSYIyv9PhERXMIGQ7jqusbI2VZmVTDhR+C yLINDbw/Uvvck0vmsO8iTJY7rD645L3CMc/+y8C19H5rowRKbMivJboHr95l2diq9WXe 0asSXd77vCnUcgbWRCPcGwfYOm5otkUWjmGE5OgMzgrB8vxJ9fd6C25pn0Al2/TTmtIY d1Z2MrK/T5I3ZfwojlFX2CnOruNja6w1+toXOQPqS2jrjXHrm18Zt8QfJ+wAg68TKJcr 0kEg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ce20si125828edb.138.2021.01.05.09.37.35; Tue, 05 Jan 2021 09:38:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728833AbhAERgR (ORCPT + 99 others); Tue, 5 Jan 2021 12:36:17 -0500 Received: from foss.arm.com ([217.140.110.172]:58086 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725838AbhAERgR (ORCPT ); Tue, 5 Jan 2021 12:36:17 -0500 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 7D5A71063; Tue, 5 Jan 2021 09:35:31 -0800 (PST) Received: from bogus (unknown [10.57.35.27]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CC94A3F66E; Tue, 5 Jan 2021 09:35:29 -0800 (PST) Date: Tue, 5 Jan 2021 17:35:26 +0000 From: Sudeep Holla To: Florian Fainelli Cc: Jim Quinlan , Sudeep Holla , bcm-kernel-feedback-list@broadcom.com, james.quinlan@broadcom.com, "open list:SYSTEM CONTROL & POWER/MANAGEMENT INTERFACE Mes..." , open list Subject: Re: [PATCH v4 2/2] firmware: arm_scmi: Augment SMC/HVC to allow optional interrupt Message-ID: <20210105173526.yvjh2bxnofjzmc6n@bogus> References: <20201222145603.40192-1-jim2101024@gmail.com> <20201222145603.40192-3-jim2101024@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20171215 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 22, 2020 at 07:37:22PM -0800, Florian Fainelli wrote: > > > On 12/22/2020 6:56 AM, Jim Quinlan wrote: > > The SMC/HVC SCMI transport is modified to allow the completion of an SCMI > > message to be indicated by an interrupt rather than the return of the smc > > call. This accommodates the existing behavior of the BrcmSTB SCMI > > "platform" whose SW is already out in the field and cannot be changed. > > > > Signed-off-by: Jim Quinlan > > This looks good to me, just one question below: > > [snip] > > > @@ -111,6 +145,8 @@ static int smc_send_message(struct scmi_chan_info *cinfo, > > shmem_tx_prepare(scmi_info->shmem, xfer); > > > > arm_smccc_1_1_invoke(scmi_info->func_id, 0, 0, 0, 0, 0, 0, 0, &res); > > + if (scmi_info->irq) > > + wait_for_completion(&scmi_info->tx_complete); > > Do we need this to have a preceding call to reinit_completion()? It does > not look like this is going to make any practical difference but there > are drivers doing that for correctness. Why do you think that might not cause any issue ? After first message is completed and ISR is executed, the completion flag remains done for ever. So practically 2nd message onwards won't block in wait_for_completion which means return from smc/hvc is actually completion too which is clearly wrong or am I missing something ? Jim, please confirm either way. If you agree I can add the below snippet, no need to repost. Regards, Sudeep -- diff --git i/drivers/firmware/arm_scmi/smc.c w/drivers/firmware/arm_scmi/smc.c index fd41d436e34b..86eac0831d3c 100644 --- i/drivers/firmware/arm_scmi/smc.c +++ w/drivers/firmware/arm_scmi/smc.c @@ -144,6 +145,8 @@ static int smc_send_message(struct scmi_chan_info *cinfo, shmem_tx_prepare(scmi_info->shmem, xfer); + if (scmi_info->irq) + reinit_completion(&scmi_info->tx_complete); arm_smccc_1_1_invoke(scmi_info->func_id, 0, 0, 0, 0, 0, 0, 0, &res); if (scmi_info->irq) wait_for_completion(&scmi_info->tx_complete);