Received: by 10.192.165.148 with SMTP id m20csp1217166imm; Wed, 25 Apr 2018 14:42:49 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/rARTixx8zSxaLwaWUs8UpllC4+9ZRA5Wm18qMYNiBT9qFL7ipunRej+XmZEp7j6o0rDRw X-Received: by 2002:a17:902:64d0:: with SMTP id y16-v6mr30429710pli.349.1524692569644; Wed, 25 Apr 2018 14:42:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524692569; cv=none; d=google.com; s=arc-20160816; b=BbJT34Zh7ncgikI4TQlxuxp84b8P/yC7ppEoBa/YB6RHQQz8ZAyNfxCBkCpO/CiOIo o/VjkqhJ3V0CBFHBr+f6seenvaAf6ciBLCD5C0C9cNd+GC3tnvaXwcQQU4a1d4iA3coq zO9lWzYXbKVN1LVKMNDDtlOx+iGD4dyNfy6sV9hLUYjiZNRzB9Zzjk1olQ7uGOb9/wg0 tZ+vC0CTwdBf2b+u7nb3o2AxTp2+GxiOyXsRfE2LpkjfYw8yejCzrPAoVo35MqFefW8a B2aDHhbSoh0SJQf7XsRsAaMBtmKW7Ay4CLZ0shi5lt/oEsxVzk7eJ/wso2N/NBmN+vig 9Zgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=hwYzLEXuGWlGjaqvhdUITKv+AjgvfNgok55iUBubssk=; b=aqrY/O+l/Qj/oflqX8b5AiPJwusGLvKXJGCyg96yLczBeHUOF6xAcHBV4gqtn4lufr cZ+hSX4J/zt9zS9rlwUhP53W/kbG2osq5iV/b5oDBB0rGjSLX8PUPNy0HVZ6IpK4DhzX qkqRpqlZNNHM670wFPad4HWNTQMzJ9L50mghAHSEe0iSP3JY04soi226/om5Qi6yVvdJ L/RbZAuoxUS4mBZR1ZAddlldtK4edGu2i5WdEaEXbrQWjt7HzLml5rKYzzCryvwwlaEQ jEWaO9xGNGj9zjEiqeUoZ84Nn8Vr7Ox2gK+uibeoUJDlryGwZP09lvBJ+v594NUbrXyh 9Q1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Sv6ZWBsh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p6si16464472pfk.357.2018.04.25.14.42.35; Wed, 25 Apr 2018 14:42:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Sv6ZWBsh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753423AbeDYVlQ (ORCPT + 99 others); Wed, 25 Apr 2018 17:41:16 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:35916 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753301AbeDYVlN (ORCPT ); Wed, 25 Apr 2018 17:41:13 -0400 Received: by mail-pg0-f65.google.com with SMTP id i6so14262429pgv.3 for ; Wed, 25 Apr 2018 14:41:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=hwYzLEXuGWlGjaqvhdUITKv+AjgvfNgok55iUBubssk=; b=Sv6ZWBsh/MWyQTSYS4PgUbmJHY9yNTjyUXiv0A5zbYUIO1K0lNE9xUBlgrBStu/4TA oNYWs1Y+lfxbROdXIFWLHpYg01xlQOKNtIssT8C2ZW/WGHQbz98lb2gboN15NQxFqbxK Ku+cBjs0Xk8b8ADq22I2FAnhxStE/pFbs55Bc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=hwYzLEXuGWlGjaqvhdUITKv+AjgvfNgok55iUBubssk=; b=n00HCaLyNax5Axvzg+XSRJegodr8ZskCc1ws4Li6i7vHH7i/wEkvJSNN7CzAPyElHG zAxh6gAPZYd2FMmgKjtfx5rn+cFRz3oGYRfaLtL+x85hvsEpSGeba0imEtFN9CjDcwIE N7Wo5HiA5PVr3dccIs8lIJAVlWqAEjBEnk2BQrVQ1eC59xKvQoEJfL8W+UNymPmG4u2G yMAMUxnjByJi7ElsTsrSiIflgF9xLtJCtx78lRsnofSTQ64dGqqD65Qo2Yk1qVGpN143 Dwx7tuIac03ruOfTRAM6eubBl7c6CvMindEmU1Ep65salKstmd/7u5jWI3FtcZOWT+a7 zrpA== X-Gm-Message-State: ALQs6tCq8j+D3UYVu5YQ95cuOiPXMPOvTNmTuxs7cR0or7B3QaS+kti9 fa3Lrx4YzYjEIDAzmtUrDaVxTg== X-Received: by 10.101.82.12 with SMTP id o12mr2304589pgp.178.1524692473288; Wed, 25 Apr 2018 14:41:13 -0700 (PDT) Received: from localhost ([2620:0:1000:1501:8e2d:4727:1211:622]) by smtp.gmail.com with ESMTPSA id k83sm51053485pfg.153.2018.04.25.14.41.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Apr 2018 14:41:12 -0700 (PDT) Date: Wed, 25 Apr 2018 14:41:11 -0700 From: Matthias Kaehlcke To: Lina Iyer Cc: andy.gross@linaro.org, david.brown@linaro.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, rnayak@codeaurora.org, bjorn.andersson@linaro.org, linux-kernel@vger.kernel.org, sboyd@kernel.org, evgreen@chromium.org, dianders@chromium.org Subject: Re: [PATCH v6 05/10] drivers: qcom: rpmh-rsc: write sleep/wake requests to TCS Message-ID: <20180425214111.GC243180@google.com> References: <20180419221635.17849-1-ilina@codeaurora.org> <20180419221635.17849-6-ilina@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180419221635.17849-6-ilina@codeaurora.org> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 19, 2018 at 04:16:30PM -0600, Lina Iyer wrote: > Sleep and wake requests are sent when the application processor > subsystem of the SoC is entering deep sleep states like in suspend. > These requests help lower the system power requirements when the > resources are not in use. > > Sleep and wake requests are written to the TCS slots but are not > triggered at the time of writing. The TCS are triggered by the firmware > after the last of the CPUs has executed its WFI. Since these requests > may come in different batches of requests, it is the job of this > controller driver to find and arrange the requests into the available > TCSes. > > Signed-off-by: Lina Iyer > Reviewed-by: Evan Green > --- > drivers/soc/qcom/rpmh-internal.h | 8 +++ > drivers/soc/qcom/rpmh-rsc.c | 120 +++++++++++++++++++++++++++++++ > 2 files changed, 128 insertions(+) > > diff --git a/drivers/soc/qcom/rpmh-internal.h b/drivers/soc/qcom/rpmh-internal.h > index d9a21726e568..6e19fe458c31 100644 > --- a/drivers/soc/qcom/rpmh-internal.h > +++ b/drivers/soc/qcom/rpmh-internal.h > +static int find_match(const struct tcs_group *tcs, const struct tcs_cmd *cmd, > + int len) > +{ > + int i, j; > + > + /* Check for already cached commands */ > + for_each_set_bit(i, tcs->slots, MAX_TCS_SLOTS) { > + for (j = 0; j < len; j++) { > + if (tcs->cmd_cache[i] != cmd[0].addr) { Shouldn't the condition be 'tcs->cmd_cache[i + j] != cmd[j].addr'? Otherwise the code below the following if branch will never be executed. Either the 'tcs->cmd_cache[i] != cmd[0].addr' branch isn't entered because the addresses match, or the addresses don't match and the inner loop is aborted after the first iteration. > + if (j == 0) > + break; > + WARN(tcs->cmd_cache[i + j] != cmd[j].addr, > + "Message does not match previous sequence.\n"); > + return -EINVAL; > + } else if (j == len - 1) { > + return i; > + } > + } > + } > + > + return -ENODATA; > +}