Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp277622pxu; Tue, 5 Jan 2021 10:35:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJxinUEyWD4hH1d2u46/jwGHkhB20YTmKB5fxxClLEKxV5ROUgJ4iL/VdBosuwwbDtGJOgVW X-Received: by 2002:a17:906:e093:: with SMTP id gh19mr406951ejb.510.1609871701433; Tue, 05 Jan 2021 10:35:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609871701; cv=none; d=google.com; s=arc-20160816; b=LCu2Yun3r/oVi/HOFa2Nd5OUC/nTw1NB42kSj0gDgA1PnQ0BKt/bvVru3cC43ZwUZA auRD4iAQWuyQe7/Oht2aHylubC9eXjrraIOn5K78rN7jJOurfwyZsfkLj61Ov9pLJdTf tuXGXRFrKDQHWrdoWMwNQ1/4p6TsUhcUerhCsEUAyoCoDxLWycjaEGM7DuO7PJNo0ukh UvOl1aaZd5CU0j9I3WddfUgYb6s21uhtmiZnzVWX9yU0IZNkI/W0bSBQs47fYN7qbN7V oxRObqKSdsJwSphjZgPoVYv/O3OFbU8B32zhZ/rNDS5ROfi8YNqX56/JR+2ILJpAhYFU DINg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=sX+Z5cinaGEHb+Rg680GNmulVNTwsny/hFmafIxttB0=; b=spe9QG34CaMHhf+W7um1vL2beiZJAJPtEaZLqdBKA7hyNDhUN3bGtBU3T4FqLU2voi YueR1Dd95/b2gCwWdcb7gRNLxiiP1XudhRJj/Yzz6yRL516EQx8cCZbCwmWkDRopaSxs MSuybkU6WBLHcA+WCq3iQbekHp5y5geNukOjPZ1UVw3m2W5EKr8aMqqvMUrSoj833xz8 E3Z2ASAr2mW0LDO+bypo35O/+XugXbZjaxtwlxrYLrc7des4+gSpTn73OgUHznZ2CK3N lp9Y4GX/pnZ5Qjh0geL09Zji1x2LX1B2ITGERUEa+35ipSMO7X4KjuyHwajqbSHEmiek 7JdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cdYSFuaD; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dg17si185190edb.531.2021.01.05.10.34.37; Tue, 05 Jan 2021 10:35:01 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cdYSFuaD; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727605AbhAESdl (ORCPT + 99 others); Tue, 5 Jan 2021 13:33:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726671AbhAESdl (ORCPT ); Tue, 5 Jan 2021 13:33:41 -0500 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACF87C061574 for ; Tue, 5 Jan 2021 10:33:00 -0800 (PST) Received: by mail-pf1-x433.google.com with SMTP id s21so215240pfu.13 for ; Tue, 05 Jan 2021 10:33:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=sX+Z5cinaGEHb+Rg680GNmulVNTwsny/hFmafIxttB0=; b=cdYSFuaDv6z15vOKJG8UTD8B2nE6uiN1THjKL+OP7indqdfspz63FI4KPq0gb8rHmc 7lLzJbw+dHqcZbTaBloV0uVkJVS4mYL4Hb9bmL4RtLI7PxLYzjYfHfs47THpHI+ne7eb sTeOsFkib02LmlglFpXuQIgDjFuBUHss+0A6ZfXJWnCc/t+X0XHvonF+npQmIJyQuwPC Pd9sUxUNt+dFGcJiXFU76Pn8jOmj8e6o1eV2ezmLt8EyOP3bPR2hRcUnd2URvbpvMgq1 qa15eTZANrNsTFYb5QyRfPpkbhaDGYJ59/OXNEuqGjMTPU06wV58LFtDuSFOG+vaz1XG qMtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=sX+Z5cinaGEHb+Rg680GNmulVNTwsny/hFmafIxttB0=; b=oqDOIv15r/x/zow36V2cHf6JWwBCXwEcc4kPeay8Uz8+it+YjMdK2Mu+chwkz2fQOt Xxh4kPdjAj3sM/bfrEIW8QQEZCbvnLKJpV3/2z7WPHun4WsGfL1iSGi+RcSB95s+aojd yGp1wn8M08F2dOY7r3jUWhW73eImxj/xUoE6vp5NVswl2haE3rKUcXAeVZs6n5QfSOGr LpO3il+vfM+G09IZw5sLev5QQe8OKDvdzlBsMy7KZ7pgkG0X5JrOj5HqDAr9dSpMvOIu NjBKB8npyvs6kNGmvFubLVsORAAsfPKJymPFjIExvCxsMr5jua7F2DnW/D5XpZySuR6Y l83Q== X-Gm-Message-State: AOAM531OLgykX9VJ/h6dlkJ7ZnX8RVOo+phzcKli5UJ09bNt8Y8M3Gxj hel10RIsPcA6Z2hlJ/ZwcszUGRNSc8kSvWDRCoM= X-Received: by 2002:a63:1f10:: with SMTP id f16mr584229pgf.111.1609871580342; Tue, 05 Jan 2021 10:33:00 -0800 (PST) MIME-Version: 1.0 References: <20201222145603.40192-1-jim2101024@gmail.com> <20201222145603.40192-3-jim2101024@gmail.com> <20210105173526.yvjh2bxnofjzmc6n@bogus> In-Reply-To: From: Jim Quinlan Date: Tue, 5 Jan 2021 13:32:49 -0500 Message-ID: Subject: Re: [PATCH v4 2/2] firmware: arm_scmi: Augment SMC/HVC to allow optional interrupt To: Jim Quinlan , Sudeep Holla Cc: bcm-kernel-feedback-list , "open list:SYSTEM CONTROL & POWER/MANAGEMENT INTERFACE Mes..." , open list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > From: Sudeep Holla > Date: Tue, Jan 5, 2021 at 12:35 PM > Subject: Re: [PATCH v4 2/2] firmware: arm_scmi: Augment SMC/HVC to allow = optional interrupt > To: Florian Fainelli > Cc: Jim Quinlan , Sudeep Holla , , , = open list:SYSTEM CONTROL & POWER/MANAGEMENT INTERFACE Mes... , open list > > > 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, &re= s); > > > + if (scmi_info->irq) > > > + wait_for_completion(&scmi_info->tx_complete); > > > > Do we need this to have a preceding call to reinit_completion()? It doe= s > > 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. Hi Sudeep, I don't think that is the case; the bottom routine, do_wait_for_common(), decrements the x->done after a completion (which does an increment). Regardless, I think it is prudent to add the reinit patch you've provided below. BTW, one thing I could have done was incorporate the timeout value but I thought that since this is the "fast" call we shouldn't be timing out at all. Thanks much, Jim Quinlan Broadcom STB So practically 2nd message onwards won't block in wait_for_completion > which means return from smc/hvc is actually completion too which is clear= ly > 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 *ci= nfo, > > 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, &re= s); > if (scmi_info->irq) > wait_for_completion(&scmi_info->tx_complete); > > > This electronic communication and the information and any files transmitt= ed with it, or attached to it, are confidential and are intended solely for= the use of the individual or entity to whom it is addressed and may contai= n information that is confidential, legally privileged, protected by privac= y laws, or otherwise restricted from disclosure to anyone else. If you are = not the intended recipient or the person responsible for delivering the e-m= ail to the intended recipient, you are hereby notified that any use, copyin= g, distributing, dissemination, forwarding, printing, or copying of this e-= mail is strictly prohibited. If you received this e-mail in error, please r= eturn the e-mail to the sender, delete it from your computer, and destroy a= ny printed copy of it.