Received: by 10.192.165.148 with SMTP id m20csp1307797imm; Wed, 25 Apr 2018 16:31:56 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/WlUbvm451raD2b5wurQ9HJSRao7JA7GNr8OiA3/lxV0Sg+1U2LT6+Mf4cRAakxYFcnzhS X-Received: by 2002:a17:902:9a0b:: with SMTP id v11-v6mr31480710plp.387.1524699116500; Wed, 25 Apr 2018 16:31:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524699116; cv=none; d=google.com; s=arc-20160816; b=M+5vPvz0VYZWMhqTobQG8G+J8ihpN+lL1AihrQ2a8RX7ZFyVRa7XiiZnfk0lNUqviX kZwLKLVNNHYI9VgHtYOAjblMLMNHqinBU5iZ2QjOJUYw48X8HOJxd1gJLeEL9VvWTP8I v3UmBPfbO93Y+xq/PXRhqCunEQxfG0IFTUxfubFqSpWm0rh24zy8x+hgctWAtKU1ciZE zInablpcqHYbfnqYG+JXJvLYJP/PDPbzLHaY6h0JYPg0Gu/yU9ZhZdA3mgcYw2+SQKDi NstcKWD2HZ8tdQe2pOnxJ9pvGMKYicRXT9Ht7m2j6JUgan/5c9ws9s0hg4XkxiMUGacw BzBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dmarc-filter :dkim-signature:dkim-signature:arc-authentication-results; bh=k1MXMe8SEPTuv+VOuqS1cdabEjc36Sp2KN89jJ4Y0Ts=; b=bE1Bo5FX6RHpHEOfZEqk0nIIkj1ld9GRgt3t0IkOqRUh13YftGwRFXhu7NTSYpJtrw a0AtRcBtKFNGuqBITfzwddibGetPQrwtqGqw1cl+3AeEeK0vnN/07r0iwsBqZ2n9R8hr MJJQV8+irc3qXaXthk9LQM3dMRZU/Iini916qsbSwDsj5Zr5tZ7LfKGMTALXNpw+E7NC seseJCyL7xTx0bSSsJiknp0LSR72pw+lwCW9zY63TDN58GLYrk0/lOitXcAzzhjs4Hps fM8C6gr9RW9CpjUoOOgJt5ZB6YSE3v7yf0IOQIkrkjJilfhLpXZEuYK01bNbPEzyLpo9 fl9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=IxO03yM/; dkim=pass header.i=@codeaurora.org header.s=default header.b=IxO03yM/; 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 97-v6si17404385plm.548.2018.04.25.16.31.41; Wed, 25 Apr 2018 16:31:56 -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=@codeaurora.org header.s=default header.b=IxO03yM/; dkim=pass header.i=@codeaurora.org header.s=default header.b=IxO03yM/; 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 S1754086AbeDYX3c (ORCPT + 99 others); Wed, 25 Apr 2018 19:29:32 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:45922 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751563AbeDYX32 (ORCPT ); Wed, 25 Apr 2018 19:29:28 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id D4D0260C65; Wed, 25 Apr 2018 23:29:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1524698967; bh=lzJ0p4AfiKRt0ZNyck/1mIernUvTGseX4q6IVUtcGGQ=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=IxO03yM/v6n/tHIJX4gmyYhceIgymL+XzQgKRR6q7Sb1bhuI1bVvPs0peGS6IyDhn 8+H+gnDKY/lZp1CIZETnbfIr6axMPNS9rAlJG1z5678SVTGqvNcvxyyIegfjxMtYd8 YqSgm115C9qyLEn+mISriaIxOH0D7ipvG6sfX3vY= 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 [192.168.142.6] (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: clew@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 068AF60227; Wed, 25 Apr 2018 23:29:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1524698967; bh=lzJ0p4AfiKRt0ZNyck/1mIernUvTGseX4q6IVUtcGGQ=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=IxO03yM/v6n/tHIJX4gmyYhceIgymL+XzQgKRR6q7Sb1bhuI1bVvPs0peGS6IyDhn 8+H+gnDKY/lZp1CIZETnbfIr6axMPNS9rAlJG1z5678SVTGqvNcvxyyIegfjxMtYd8 YqSgm115C9qyLEn+mISriaIxOH0D7ipvG6sfX3vY= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 068AF60227 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=clew@codeaurora.org Subject: Re: [PATCH] soc: qcom: smem: introduce qcom_smem_virt_to_phys() To: Alex Elder , andy.gross@linaro.org Cc: aneela@codeaurora.org, david.brown@linaro.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-kernel@vger.kernel.org References: <20180425151820.25595-1-elder@linaro.org> From: Chris Lew Message-ID: <4a127dda-576c-4eae-80d3-a928e578a1b9@codeaurora.org> Date: Wed, 25 Apr 2018 16:29:26 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180425151820.25595-1-elder@linaro.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Alex, Minor comment. On 4/25/2018 8:18 AM, Alex Elder wrote: > Create function qcom_smem_virt_to_phys(), which returns the physical > address corresponding to a given SMEM item's virtual address. This > feature is required for a driver that will soon be out for review. > > Signed-off-by: Alex Elder > --- > drivers/soc/qcom/smem.c | 27 +++++++++++++++++++++++++++ > include/linux/soc/qcom/smem.h | 2 ++ > 2 files changed, 29 insertions(+) > > diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c > index 7d9a43da5084..70b2ee80d6bd 100644 > --- a/drivers/soc/qcom/smem.c > +++ b/drivers/soc/qcom/smem.c > @@ -655,6 +655,33 @@ int qcom_smem_get_free_space(unsigned host) > } > EXPORT_SYMBOL(qcom_smem_get_free_space); > > +/** > + * qcom_smem_virt_to_phys() - return the physical address associated > + * with an smem item pointer (previously returned by qcom_smem_get() > + * @p: the virtual address to convert > + * > + * Returns 0 if the pointer provided is not within any smem region. > + */ > +phys_addr_t qcom_smem_virt_to_phys(void *p) > +{ > + unsigned i; > + We have a null pointer check for __smem here since it is called by external clients. This case should probably never happen though. > + for (i = 0; i < __smem->num_regions; i++) { > + struct smem_region *region = &__smem->regions[i]; > + > + if (p < region->virt_base) > + continue; > + if (p < region->virt_base + region->size) { > + u64 offset = p - region->virt_base; > + > + return (phys_addr_t)region->aux_base + offset; > + } > + } > + > + return 0; > +} > +EXPORT_SYMBOL(qcom_smem_virt_to_phys); Thanks, Chris -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project