Received: by 10.223.164.202 with SMTP id h10csp193871wrb; Thu, 30 Nov 2017 08:51:34 -0800 (PST) X-Google-Smtp-Source: AGs4zMYW3Pqdj+XoYZNS/GdjdvrXWjm2XIOswbK1G49yBdLCuu5/G2SviOg4cR5Usq1FD3vfxG/w X-Received: by 10.101.66.204 with SMTP id l12mr1503013pgp.430.1512060694875; Thu, 30 Nov 2017 08:51:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512060694; cv=none; d=google.com; s=arc-20160816; b=1A0ZylBejfNNlWDwTxWAT+eQM4B2O9dI3hhNhdC4Iwh4bwUmNm+kdbBAI01o5Qq+4u B9LQhmFXlUAJoFqeqOai6RxpjmXDZqgdFo0qS706cmcC6N9xOTTHMK5fPiT1p8qfqFot gDD2H1f7ThdxOckiuR+bRBMrQ0gBbrJ1lSpjAGZ8kQd0ELy8/0+opJ97rm64YCW8af3S oRyHpAL8PCwUfuW6CNub89cfYLZgzIdeTzKvv49eu102T0c6udXol5lGa6IZOLWeqNrK XziSichdrH+sWG9+ytjVfiD8aWwY6HCfILVsgxZ63BeWhDYpiYufxBCrXIv7vqI58+5i yGYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=+p0JMoaaR1fg2nzsQic4PHrvT7oTwU5+n6sJI8MvLpA=; b=ot8rkU/Rsa1tlfNV919xj2kSZ+SnEaggDG/aI9+4heUZWNAXRLyShtCAsVteloPnqr 1gEuVyjjKMbLtCnvnU6XPpsABfiPYPh7iCpMUtzfplSmkvB23TEH4L3H2p3bPebpUg0J hfEaVUL0q4nWJryOVcIxC1ayoK0WoqYk2DyW0Es2BWF+dylHZChNEH5VGdfSMDCYHj/i oG1Wb7Zd6MyURZYi/C3is5P1YzJC03LDZYCDX0BAjTsy5iUN1phuD5eC/uxs0prvf4e9 a9i/n9M0b7Mn4/c7bG1KMwN3qdeWB7iynGcG0NEVIvWkiLSMUhCR+nyNup++vET79cdb ekNQ== ARC-Authentication-Results: i=1; mx.google.com; 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 l61si3336898plb.409.2017.11.30.08.51.21; Thu, 30 Nov 2017 08:51:34 -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; 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 S1753607AbdK3QrQ (ORCPT + 99 others); Thu, 30 Nov 2017 11:47:16 -0500 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:14815 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753444AbdK3QrN (ORCPT ); Thu, 30 Nov 2017 11:47:13 -0500 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx08-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id vAUGiEpX001563; Thu, 30 Nov 2017 17:47:11 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 2eexh9v2r4-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 30 Nov 2017 17:47:11 +0100 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 501B431; Thu, 30 Nov 2017 16:47:11 +0000 (GMT) Received: from Webmail-eu.st.com (sfhdag7node2.st.com [10.75.127.20]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 374D45379; Thu, 30 Nov 2017 16:47:11 +0000 (GMT) Received: from localhost (10.75.127.46) by SFHDAG7NODE2.st.com (10.75.127.20) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Thu, 30 Nov 2017 17:47:10 +0100 From: Loic Pallardy To: , CC: , , , , Loic Pallardy Subject: [PATCH v2 01/16] remoteproc: add rproc_va_to_pa function Date: Thu, 30 Nov 2017 17:46:36 +0100 Message-ID: <1512060411-729-2-git-send-email-loic.pallardy@st.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1512060411-729-1-git-send-email-loic.pallardy@st.com> References: <1512060411-729-1-git-send-email-loic.pallardy@st.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.75.127.46] X-ClientProxiedBy: SFHDAG8NODE2.st.com (10.75.127.23) To SFHDAG7NODE2.st.com (10.75.127.20) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-11-30_05:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This new function translates CPU virtual address in CPU physical one according to virtual address location. Signed-off-by: Loic Pallardy --- drivers/remoteproc/remoteproc_core.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index eab14b4..faa18a7 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -139,6 +139,17 @@ static void rproc_disable_iommu(struct rproc *rproc) iommu_domain_free(domain); } +static phys_addr_t rproc_va_to_pa(void *cpu_addr) +{ + 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 @@ -700,7 +711,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 From 1585503043670851355@xxx Thu Nov 30 14:52:11 +0000 2017 X-GM-THRID: 1585503043670851355 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread