From patchwork Fri Oct 27 12:44:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Pallardy X-Patchwork-Id: 117311 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp727207qgn; Fri, 27 Oct 2017 05:44:43 -0700 (PDT) X-Google-Smtp-Source: ABhQp+S8BK3UKYWk+hcUL9kxfVh8c/eRbuq0KqLLNZBS8IenL3MEQVPRIoOWTRd6lAqJ8sunntOF X-Received: by 10.98.75.71 with SMTP id y68mr368366pfa.45.1509108283856; Fri, 27 Oct 2017 05:44:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509108283; cv=none; d=google.com; s=arc-20160816; b=AcOcqIwE7G/P4Nmdn7WB8n3ajmMifztIP3tEcg0YeO9qHWigHU+j1vYy/1XoHSX26n WgIirxi5+T5FWtW0nv3YVjB8Phte8ILN0YjC/ZrZOWoNGp/u0VwQ5XlzLyxua4FX1SDc uCo+5vpZFnJa79sPavpLo0ALc8t4Gkn/VhXpQ9BRM7QwSwt2SAK9Fl9DFhaZSLmiyMm/ AeuFCxjfjBbC+JtCVRzrOCSVzwQGNEzTWQpZDlknVk4UUk1rdWn1aUD+3LDBIrYHnPPh LZO1X9KMimKe1fEe0/VvDvRsOCl4pma9LT3XwRXVnqQczH62VMUi3ug6hNeLSb08+qdH rC1g== 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=k25LPEIhP1EnFXdLs7dUDf2uwVWcWnwcmC5qKMyHpB3Izk413WOneM5dgvamaYnRLt GuqtZEoZePkX8uExoGJZOC+cGhG+86HAw/HUhrz5ybzV+tHB/6Bxta9DfL4BwGcIKmk4 qE4h3uEqkztFzhlUwyOlS3KWSXRTQk2hbmf6/Jwx4sJ1bxwMzUzTxje9wx5HjLRrsK+D I91tEnRfF0lI+wao7H3UObX6zo7t4GGDPQJl//wcbLsMh5Lsxt3ldOD0yT8NxNj0QRlG 8uY4FeWRbTBLbdUWLzLoSbii2aONbxXFiYFgUG7jnBm+3Sqvj4YSBOc6BBhoabCvp+eG nNcw== 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 m66si5333968pfb.72.2017.10.27.05.44.43; Fri, 27 Oct 2017 05:44:43 -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; 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 S1752658AbdJ0Moj (ORCPT + 27 others); Fri, 27 Oct 2017 08:44:39 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:39695 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752459AbdJ0Mod (ORCPT ); Fri, 27 Oct 2017 08:44:33 -0400 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 v9RCi214004814; Fri, 27 Oct 2017 14:44:31 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 2dtg42ywk6-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 27 Oct 2017 14:44:31 +0200 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 27A983D; Fri, 27 Oct 2017 12:44:31 +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 0A60626E0; Fri, 27 Oct 2017 12:44:31 +0000 (GMT) Received: from localhost (10.75.127.49) by SFHDAG7NODE2.st.com (10.75.127.20) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Fri, 27 Oct 2017 14:44:30 +0200 From: Loic Pallardy To: , CC: , , , , Loic Pallardy Subject: [PATCH 1/7] remoteproc: add rproc_va_to_pa function Date: Fri, 27 Oct 2017 14:44:08 +0200 Message-ID: <1509108254-22296-2-git-send-email-loic.pallardy@st.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1509108254-22296-1-git-send-email-loic.pallardy@st.com> References: <1509108254-22296-1-git-send-email-loic.pallardy@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.49] X-ClientProxiedBy: SFHDAG4NODE3.st.com (10.75.127.12) To SFHDAG7NODE2.st.com (10.75.127.20) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-10-27_07:, , 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(-) -- 1.9.1 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;