Received: by 10.223.185.116 with SMTP id b49csp801390wrg; Tue, 20 Feb 2018 08:06:25 -0800 (PST) X-Google-Smtp-Source: AH8x227lKxM7uP4H3GBP4ZKXgKO+WK93XQgY1OeQwVhPsdMjKaVZKfSxN5ehpshD5AOSCN75bYcI X-Received: by 10.98.4.1 with SMTP id 1mr117622pfe.148.1519142784846; Tue, 20 Feb 2018 08:06:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519142784; cv=none; d=google.com; s=arc-20160816; b=WC5698wBdfjalspPt0ho5qpF5za7yjz9F1dMveXAu5x2cjpoiA18NPHIsO2ySTfRPL o05lIYgXTDOIk69dGwpcmjYQQ3dGC9jspJh8wsqHxjZfRLnH2m3y+607rx7bfL4zz9pH A8eRrHjMgJsXo+P8VIi1XyJTKC+96FbxMWKCFwcEMl4FqV1WJ8bo+id8wfhrayLb0jgP N2fRyHpGUgR7fuNB6a5sYsFGaZgcn1DZ8/BCEfPAVk/41qfvjSREyrGjh/zFYofuvX0B AGYVlfpBu7ZR5ryjDcsePyHdbf3kmFWgmneJsmACDzP1mMvghB5ZGEYqO2kkKfjbRAjG s91w== 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:dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=IJ0sxNO9I5UkdbhGsVAIEJ+T3t0B31J5Lxrc0dM3ZGs=; b=rSXdG9Hn1ADILuN7zNkXYUJATbLHAzXW4eyqtRFdTnE28hk5+/vx1kNZ4pbCJG4DOH 4SWQkGZmxC1pW8LZoG3iqDu7gR7P1hi77ZwRLCxANTs83GwierpRCVGdwfc7Afi9G5jN wrME6SWNZTNa9AlPO0cvBCZZ+BrZ6gJfx4mvV2hXhzlAuGAjQDSEVA63f/Z74vEkC+Tm eJJczUkZA5BB7k1XGTYT0uAlPn+jGIX+3hGGStXsPa8wOHrVX1ZcLyQwzG2vi0BrAqzn aKpEh3J/z+9uywtGsSO5fSSlYWNi2lY8LUg/kNmrl/DCRKxqa2EO9SNgttIwSsTuKUzj QXUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=VCG7/DAx; dkim=pass header.i=@codeaurora.org header.s=default header.b=VCG7/DAx; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b10-v6si2513852plz.69.2018.02.20.08.05.47; Tue, 20 Feb 2018 08:06:24 -0800 (PST) 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=@codeaurora.org header.s=default header.b=VCG7/DAx; dkim=pass header.i=@codeaurora.org header.s=default header.b=VCG7/DAx; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752753AbeBTQDo (ORCPT + 99 others); Tue, 20 Feb 2018 11:03:44 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:43680 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751320AbeBTQDm (ORCPT ); Tue, 20 Feb 2018 11:03:42 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id AE6C86070D; Tue, 20 Feb 2018 16:03:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1519142621; bh=dwZ/U8UnV/DoOEl1IbxY6/3vkVOTAHEdjOExT0yvpPs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VCG7/DAx/huBJluXfea3zLvl8BqReehfL9N/rO3DLdPg0xRdugT7l2qIfDOGR09fv 9cuAVhTI2xv1GG8fH0aIRDL01LBAfMzlsuudLAIsh/opjuiu1COctLJEv7vWFAZyoB wgr6pHvMJiMR8f+kR1bRs0pTqk1Wr0mt4J2dlE1Q= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from localhost (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: ilina@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 060ED602BA; Tue, 20 Feb 2018 16:03:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1519142621; bh=dwZ/U8UnV/DoOEl1IbxY6/3vkVOTAHEdjOExT0yvpPs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VCG7/DAx/huBJluXfea3zLvl8BqReehfL9N/rO3DLdPg0xRdugT7l2qIfDOGR09fv 9cuAVhTI2xv1GG8fH0aIRDL01LBAfMzlsuudLAIsh/opjuiu1COctLJEv7vWFAZyoB wgr6pHvMJiMR8f+kR1bRs0pTqk1Wr0mt4J2dlE1Q= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 060ED602BA Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=ilina@codeaurora.org Date: Tue, 20 Feb 2018 16:03:40 +0000 From: Lina Iyer To: Evan Green Cc: Andy Gross , David Brown , linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, Rajendra Nayak , Bjorn Andersson , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 05/10] drivers: qcom: rpmh-rsc: write sleep/wake requests to TCS Message-ID: <20180220160340.GD28504@codeaurora.org> References: <20180215173507.10989-1-ilina@codeaurora.org> <20180215173507.10989-6-ilina@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.3 (2018-01-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Evan, Thanks for your review. On Fri, Feb 16 2018 at 23:51 +0000, Evan Green wrote: >Hello Lina, > >On Thu, Feb 15, 2018 at 9:35 AM, 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 job of this controller >> driver to find arrange the requests into the available TCSes. >> >> Signed-off-by: Lina Iyer >> --- >> drivers/soc/qcom/rpmh-internal.h | 7 +++ >> drivers/soc/qcom/rpmh-rsc.c | 126 +++++++++++++++++++++++++++++++++++++++ >> 2 files changed, 133 insertions(+) >> >[...] >> +static int find_slots(struct tcs_group *tcs, struct tcs_request *msg, >> + int *m, int *n) >> +{ >> + int slot, offset; >> + int i = 0; >> + >> + /* Find if we already have the msg in our TCS */ >> + slot = find_match(tcs, msg->payload, msg->num_payload); >> + if (slot >= 0) >> + goto copy_data; >> + >> + /* Do over, until we can fit the full payload in a TCS */ >> + do { >> + slot = bitmap_find_next_zero_area(tcs->slots, MAX_TCS_SLOTS, >> + i, msg->num_payload, 0); >> + if (slot == MAX_TCS_SLOTS) >> + break; >> + i += tcs->ncpt; >> + } while (slot + msg->num_payload - 1 >= i); >> + >> + if (slot == MAX_TCS_SLOTS) >> + return -ENOMEM; >> + >> +copy_data: >> + bitmap_set(tcs->slots, slot, msg->num_payload); >> + /* Copy the addresses of the resources over to the slots */ >> + for (i = 0; tcs->cmd_addr && i < msg->num_payload; i++) > >I don't think tcs->cmd_addr can be null, can it? Above, find_match() >is already reaching through cmd_addr with enthusiasm. If kept, it >could at least be moved outside of the loop. > It would be NULL for ACTIVE_TCS. I can move the check outside the loop. Thanks, Lina