Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp8219480rwl; Tue, 10 Jan 2023 10:26:46 -0800 (PST) X-Google-Smtp-Source: AMrXdXtDiF5/JdF1xZUCHg2XoQlEZaW+JXn+0rihwdW5Z4rp9PfaEWhykq802aBMfFrXZ8+YZj2J X-Received: by 2002:a05:6a20:ce07:b0:af:ee05:fd0b with SMTP id ic7-20020a056a20ce0700b000afee05fd0bmr64271786pzb.3.1673375205939; Tue, 10 Jan 2023 10:26:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673375205; cv=none; d=google.com; s=arc-20160816; b=G/P8saKAk1RotX1pJbRs5X1dflFi3Juh2hFgtV71qGELTtsNIvkpF4r7f+yOd8PkC1 Q5Zasq7lDsQZaw1UBmXh4WbpjIVPYP8mfb7Etj5BpMooRZeOA9EPN+53hPBGxmlqaE/A n/VrfhmSfppq0EG2GhaMxAnl68bGmZVdqBpfVIoC+VuFDihWwuWlkdx/sg+bWV/R+wQP eYo1H4HcyuKnmyspUXINtPeljXvzyx5sN8GSXJUO07Yz+ydchUmYQYfY0efGbKl7E6VI kC2Vyny9+VJsahJXjdRra+L4+rDi1dEhSd3y1nGvqyPkJFiMoppdyHmtSFBB6Ynsb7oj 1uWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=EvFROkB2sfsF4UGl+Heq142zuOBwB/rIeOQqdCMlFLM=; b=EWltb5Qk32xLGLvEVvqDIHqFVRyFrVpQpZald3zEi+t6P4uU+57s0+yblBZ3p3gI5/ ZGi3I7QcpVcqe4IcDlw5XcMqCWHlx6TGEs3clyu/ni73NCkVXGYYyKPx/O/awdbc4UmL HtQQ53P0CizxUDuXdxjLoJm87uYQzyWqE5yvUtOjiw3i2g3CV2yhvU67aowySmyO+xq4 FpVsFOHxwrVHEff8zVD4pQ2ju/JCRtq/sKCLfE74oHzFTnq4KMdJxM3MIxct0cD7PVmU IPAVn10PHVVpJWi3VbjfbPAqdsMjBDwss+T4phG1zW9ul50+5MA/gXxDW4gSzWO2li8q +RlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=W1i43Ufq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g22-20020a635656000000b0048a5e036c44si6681526pgm.383.2023.01.10.10.26.39; Tue, 10 Jan 2023 10:26:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=W1i43Ufq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238390AbjAJRzU (ORCPT + 53 others); Tue, 10 Jan 2023 12:55:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234431AbjAJRyr (ORCPT ); Tue, 10 Jan 2023 12:54:47 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 005E06ECAF; Tue, 10 Jan 2023 09:54:42 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9F609B818EB; Tue, 10 Jan 2023 17:54:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94EECC433D2; Tue, 10 Jan 2023 17:54:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673373280; bh=qmNUGuo/b0UqRA+8ZzfjsJz3OHO/rP4/69lPal4OxRI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=W1i43UfqHxKz2yzK+hQJqNbxJktuF3a2owbDWM4c2lsedU03mvPuMxV20GL/SXXHN XRR7YELJNMHbpT0wz6mfkOFrzsE9YuI1GrQT94YAqs775sTVf+kwFMyHjZcISMHJNX VzAv8Xw8aZeg+cP6NwUA7lr+JCyWcnFXT+pXbCci8mlgv41xdVTIbCtu8xHcwxLLc0 Y6NmE5fFUs2YPPjHie7UXfphxv63KtfU3DTop5S6wDbmlZH4UWQIQyn95NTShjSlFS f5j4Ovtg/tnOJxvoYSegJijuk+/OhWJ8iRasA2bJgKULHKeBfzYZkEP4eWHdSZ8Y4R Bu+zRp7In1YTQ== Date: Tue, 10 Jan 2023 11:54:37 -0600 From: Bjorn Andersson To: Guru Das Srinagesh Cc: Sibi Sankar , agross@kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, krzysztof.kozlowski+dt@linaro.org, robh+dt@kernel.org, konrad.dybcio@somainline.org, robimarko@gmail.com Subject: Re: [PATCH V7 2/2] firmware: qcom: scm: Add wait-queue handling logic Message-ID: <20230110175437.pfnhn3zdlzxnymts@builder.lan> References: <20230110063745.16739-1-quic_sibis@quicinc.com> <20230110063745.16739-3-quic_sibis@quicinc.com> <20230110081410.GB2082@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230110081410.GB2082@quicinc.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 10, 2023 at 12:14:11AM -0800, Guru Das Srinagesh wrote: > On Jan 10 2023 12:07, Sibi Sankar wrote: > > ... > > > +static int __scm_smc_do_quirk_handle_waitq(struct device *dev, struct arm_smccc_args *waitq, > > + struct arm_smccc_res *res) > > +{ > > + int ret; > > + struct arm_smccc_args resume; > > + u32 wq_ctx, smc_call_ctx, flags; > > + struct arm_smccc_args *smc = waitq; > > + > > + do { > > + __scm_smc_do_quirk(smc, res); > > + > > + if (res->a0 == QCOM_SCM_WAITQ_SLEEP) { > > + wq_ctx = res->a1; > > + smc_call_ctx = res->a2; > > + flags = res->a3; > > + > > + if (!dev) > > + return -EPROBE_DEFER; > > + > > + ret = qcom_scm_lookup_completion(wq_ctx); > > I see that this function has been created in response to Bjorn's comment [1] > about avoiding the dev_get_drvdata() call, but I would prefer to not use this > function as it hides the fact that the wait_for_completion() is occurring here. > My reasoning here is that I don't want the waiting for the completion that happen in one part of the driver and the completion happening in a completely different one. > Knowing where the waiting is happening is useful not just for understanding > code flow but also for debugging issues in the future. > Absolutely agree, this should be named to make that obvious to the reader. > ... > > > +static struct completion *qcom_scm_lookup_wq(struct qcom_scm *scm, u32 wq_ctx) > > +{ > > This function is called qcom_scm_lookup_wq() but there is no looking up > occurring here. Could this comment be added for context? > > /* FW currently only supports a single wq_ctx (zero). > * TODO: Update this logic to include dynamic allocation and lookup of > * completion structs when FW supports more wq_ctx values. > */ > Agree. Regards, Bjorn > > + /* assert wq_ctx is zero */ > > + if (wq_ctx != 0) { > > + dev_err(scm->dev, "No waitqueue found for wq_ctx %d\n", wq_ctx); > > + return ERR_PTR(-EINVAL); > > + } > > + > > + return &scm->waitq_comp; > > +} > > + > ... > > [1] https://lore.kernel.org/lkml/20221208221125.bflo7unhcrgfsgbr@builder.lan/