Received: by 10.192.165.148 with SMTP id m20csp502842imm; Wed, 9 May 2018 17:12:32 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo8yuK8VTXiiHlKAM6XESupXClkEyuIQfEYoTh1OyG5iyxol13iat1fWk69w191buJuoaIH X-Received: by 2002:a65:4844:: with SMTP id i4-v6mr37001994pgs.191.1525911152533; Wed, 09 May 2018 17:12:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525911152; cv=none; d=google.com; s=arc-20160816; b=TCohV7GxGd28cDeN/x7W6Bj2e5N2gzi3CsXFRXN7IFrSPEvice3AclHXRhxXePt92B /7QqAI1MsBDiU1AwMzzEYjHBxZruOu1Ctz8QrZ3dwXWLRT69/mcslPkdcO4fXYecCbBR I4C7hiinlG8yUx9P/Zi/Ux7ZXV6kVAaGQCPR7S507L8X9rgAh90zS9qlRzfEwDr+aSDD 8l1nE+Tjcw9YzDdM5uHSnB59AnDJijsVRcwCPBeQ0s+CFzc+bSySOhK/VgVfGifpuquU awz39hHivZDuHvSfADfv1/4v7R2tIWdwxy1a1BJCQnLl2sOXiHsl9Uk+Y4BhbRmwzvbB OxkA== 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=CL7FIdvx7oOPRiAQ6wMxr5XCPV1qYu1dO+j1HXbUt3w=; b=s1wFMafDMJwaDej4LaBS/AXYupN+C/G5XJp9ei6abJ4qP4YXDyS/i5Xcy4J5X8tQbb a2ibuFEYyNj9I3MJmaAWPd7GgM4q2Ha8xUzzJXP7Lf7uAk6SxWkLpZX8AitY8t0XP1EF 0SvZv1VVq6LyeLYPUWVIbGuQa/XbgnBGGvG6S9+tndH2TK0zzpUggsHiuoZmw/girRkw IPSuaKXd9waXmF4Sw+G8gwfYQFUJ5e5Z4CQuQs4Nhy6UOI0ZyibV39bkwrd105yldxff 8+fIRbUyvUBdBO4a7EI6TIkF37AFl/0DsPU/jW8NAtGaBpuL9XkiCYTxMa9BYVGrX1lo vBTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KOvptllt; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j2si21940441pff.184.2018.05.09.17.12.05; Wed, 09 May 2018 17:12:32 -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=@linaro.org header.s=google header.b=KOvptllt; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935582AbeEJALv (ORCPT + 99 others); Wed, 9 May 2018 20:11:51 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:44877 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934609AbeEJALu (ORCPT ); Wed, 9 May 2018 20:11:50 -0400 Received: by mail-pl0-f67.google.com with SMTP id e6-v6so198646plt.11 for ; Wed, 09 May 2018 17:11:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=CL7FIdvx7oOPRiAQ6wMxr5XCPV1qYu1dO+j1HXbUt3w=; b=KOvptlltO7WXgcSfiFhJfKKxZiBZZSl1AK8TyrCaQCwJXvLsZ1SHIhe1Id8STX6CJn yVO/+c+67wtz2BTY8yxVT4yCeyGQ5Xxc2Gph4CdqoygXeZMbd4voyfZGYCf+Po39RCLi KLcqbBiHMaX7rJYtfo+jCLPzt9Yn4Zbhvaj9U= 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=CL7FIdvx7oOPRiAQ6wMxr5XCPV1qYu1dO+j1HXbUt3w=; b=h+Pj+9BjLfZeyFig440ng+7hG8/GhRoc/l2ZY/kXb2KaebsEWd5EEt1ptXpI6EYMJz gzGtll8yDr9IwWn7D/4iVT7/7W3WAy+t4y9a30EY2V295xAAqGqpMpabSVwP6lOhFAsc ZFfx9TZ7n7EIX9kqelIgiN7gZrmaeqC973b23WG5Q2HnO5WYbIDL+6Fg8PgHX4QSUTfW pFZf9Gni9mvr9BCFT1QaHQ04ALYo+yR5xfUCNuhD7rpE6wmojZhTwb+yCVfoBiJo4NTp oHeshwVeI0e5Ns3GGAffuvvQ9FUEjn+F9hkXIUmNQ/7OTKhI7MZMkzxM8Ypm0577kRXD s2DQ== X-Gm-Message-State: ALKqPwfTFWhZYMefkeAF73rjchtSbIDp0ucaYNCDuvHWxiozwlRR2Wsq F++rVNkTX3x7usaEfW9cLxs09A== X-Received: by 2002:a17:902:b692:: with SMTP id c18-v6mr6957589pls.307.1525911109588; Wed, 09 May 2018 17:11:49 -0700 (PDT) Received: from builder (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id s7sm48492891pfm.114.2018.05.09.17.11.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 09 May 2018 17:11:48 -0700 (PDT) Date: Wed, 9 May 2018 17:11:46 -0700 From: Bjorn Andersson To: Loic Pallardy Cc: ohad@wizery.com, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, arnaud.pouliquen@st.com, benjamin.gaignard@linaro.org Subject: Re: [PATCH v3 02/13] remoteproc: add rproc_va_to_pa function Message-ID: <20180510001146.GB29093@builder> References: <1519921440-21356-1-git-send-email-loic.pallardy@st.com> <1519921440-21356-3-git-send-email-loic.pallardy@st.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1519921440-21356-3-git-send-email-loic.pallardy@st.com> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 01 Mar 08:23 PST 2018, Loic Pallardy wrote: > This new function translates CPU virtual address in > CPU physical one according to virtual address location. > > Signed-off-by: Loic Pallardy Acked-by: Bjorn Andersson Regards, Bjorn > --- > drivers/remoteproc/remoteproc_core.c | 18 +++++++++++++++++- > 1 file changed, 17 insertions(+), 1 deletion(-) > > diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c > index 56b33e4..eb1b779 100644 > --- a/drivers/remoteproc/remoteproc_core.c > +++ b/drivers/remoteproc/remoteproc_core.c > @@ -139,6 +139,22 @@ static void rproc_disable_iommu(struct rproc *rproc) > iommu_domain_free(domain); > } > > +static phys_addr_t rproc_va_to_pa(void *cpu_addr) > +{ > + /* > + * Return physical address according to virtual address location > + * - in vmalloc: if region ioremapped or defined as dma_alloc_coherent > + * - in kernel: if region allocated in generic dma memory pool > + */ > + if (is_vmalloc_addr(cpu_addr)) { > + return page_to_phys(vmalloc_to_page(cpu_addr)) + > + offset_in_page(cpu_addr); > + } > + > + WARN_ON(!virt_addr_valid(cpu_addr)); > + return virt_to_phys(cpu_addr); > +} > + > /** > * rproc_da_to_va() - lookup the kernel virtual address for a remoteproc address > * @rproc: handle of a remote processor > @@ -708,7 +724,7 @@ static int rproc_handle_carveout(struct rproc *rproc, > * In this case, the device address and the physical address > * are the same. > */ > - rsc->pa = dma; > + rsc->pa = (u32)rproc_va_to_pa(va); > > carveout->va = va; > carveout->len = rsc->len; > -- > 1.9.1 >