Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2656184imu; Thu, 29 Nov 2018 08:15:53 -0800 (PST) X-Google-Smtp-Source: AFSGD/W0hIv3NPg0C//AqMmkEh7awJBs/kf/9P5R7x2UR1QSEQdvJPCOtu4po0dPY5OtTk8YvniZ X-Received: by 2002:a63:b17:: with SMTP id 23mr1748597pgl.423.1543508153250; Thu, 29 Nov 2018 08:15:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543508153; cv=none; d=google.com; s=arc-20160816; b=JEzlXQUYVL7223JaCm20bWu/DTWw7HNgWGPuiwhz8asRqiQOdfsfziSK7Yqezwt0Iw gxYCxDlpOb6QyYbj/4K4kYRTDsXdERxVI/hfeCLoAYhwI8VnCmWE+0okjfm5mPw8Wg3A aGBIFE/dSMzCcV3BfHIpoS1tsEGyTt6tMTsXgIFKU9l+IsQumsyryhftU9yli6jB23jt g6xx34Glz8b1+5SH16uU8xQW5ULEM+645REy7dGYgooRe03DWoJiVLu+4y10U8LMRD43 lJvhxtYYf+2HxSuN55r1y0YyeooISJTBohZN9yZnEvfGkHScea1E/kU3V/ZiDmU7FG4J pKSQ== 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:dkim-signature; bh=LMHsRwp3CjjL/trFzNhJGjfy3tlyWHYOHfcG5/ntbtQ=; b=xtJBofPSCJn+Pcx2Q38xPEi55n7NQ+L3yDu2gWIGKilohvnx7COyIbALrNT94b558Q 0fVKeef1Y4eA7EH919BLAyiR2Ty3MUPvw63HMn/k+C6ueRGLSLT3CLp6lBVWe/XRNiuH 9KBD1M+9kHKzbvPewgrHJBo/9gQoBd0/haKkpWxkizS5FJtg50N/FK0iKqTIglGNt5I/ EHB81nkpKzyRgOiIg84Fizmk3uRTMGuukMt/fW800Ww8kNS9OxCc6NGNjFoMRBxapSF1 v82JBKuWYBFlIfFWfFbsVJeTXHrlsQJ7HyVL5VsDGJEnw71+LsJX2+UmmQkfUOqaxqYM GH5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lechnology.com header.s=default header.b=FBGD+nKk; 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 y188si2734056pfb.59.2018.11.29.08.15.15; Thu, 29 Nov 2018 08:15:53 -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=fail header.i=@lechnology.com header.s=default header.b=FBGD+nKk; 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 S1729146AbeK3DSn (ORCPT + 99 others); Thu, 29 Nov 2018 22:18:43 -0500 Received: from vern.gendns.com ([98.142.107.122]:51812 "EHLO vern.gendns.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728551AbeK3DSl (ORCPT ); Thu, 29 Nov 2018 22:18:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lechnology.com; s=default; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=LMHsRwp3CjjL/trFzNhJGjfy3tlyWHYOHfcG5/ntbtQ=; b=FBGD+nKkpUl0Z7X5bNOWvDBApQ +jfQ2BVxfdnnr3qx1KrA7ure9LRmq2bjVLGj/XJUv/EuzVlsuPXAhnZtGGjoEL+/KOOHeQMl9LBvD /kD4fPIHKl1jPZNdWFJSOXhNHv/MUZw6Eh6bB696VUP7LEnAukI6rGnn7psJCBnm3+okU938661W5 VpMjiUX5/ro3VY+Z+ngBK9bsofHO2s6gaUGyrAM/OGECO62sDHkJ+7Clc3iDJVJMFChThNAR74kdN D8SQ219yFD0fOILV+G/RaW/kS3zmUlWnV5xae5hd9wUb295zCEjQ4NQEevWvsdSKtTvZKelegla7A 8Lf/V9EQ==; Received: from 108-198-5-147.lightspeed.okcbok.sbcglobal.net ([108.198.5.147]:44110 helo=[192.168.0.134]) by vern.gendns.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.91) (envelope-from ) id 1gSOuq-0001gx-OM; Thu, 29 Nov 2018 11:11:48 -0500 Subject: Re: [PATCH 01/16] remoteproc: Extend rproc_da_to_va() API with a flags parameter To: Roger Quadros , ohad@wizery.com, bjorn.andersson@linaro.org, s-anna@ti.com Cc: tony@atomide.com, robh+dt@kernel.org, bcousson@baylibre.com, ssantosh@kernel.org, nsekhar@ti.com, t-kristo@ti.com, nsaulnier@ti.com, jreeder@ti.com, m-karicheri2@ti.com, woods.technical@gmail.com, linux-omap@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org References: <1543218769-5507-1-git-send-email-rogerq@ti.com> <1543218769-5507-2-git-send-email-rogerq@ti.com> <5BFFBFA0.9000104@ti.com> From: David Lechner Message-ID: Date: Thu, 29 Nov 2018 10:12:42 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <5BFFBFA0.9000104@ti.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vern.gendns.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lechnology.com X-Get-Message-Sender-Via: vern.gendns.com: authenticated_id: davidmain+lechnology.com/only user confirmed/virtual account not confirmed X-Authenticated-Sender: vern.gendns.com: davidmain@lechnology.com X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/29/18 4:29 AM, Roger Quadros wrote: > Bjorn, Suman, > > On 26/11/18 23:29, David Lechner wrote: >> On 11/26/18 1:52 AM, Roger Quadros wrote: >>> From: Suman Anna >>> >>> The rproc_da_to_va() API is currently used to perform any device >>> to kernel address translations to meet the different needs of the >>> remoteproc core/platform drivers (eg: loading). The function also >>> invokes the da_to_va ops, if present, to allow the remoteproc >>> platform drivers to provide address translation. However, not all >>> platform implementations have linear address spaces, and may need >>> an additional parameter to be able to perform proper translations. >>> >>> The rproc_da_to_va() API and the rproc .da_to_va ops have therefore >>> been expanded to take in an additional flags field enabling some >>> remoteproc implementations (like the TI PRUSS remoteproc driver) >>> to use these flags. Also, define some semantics for this flags >>> argument as this can vary from one implementation to another. A >>> new flags type is encoded into the upper 16 bits along side the >>> actual value in the lower 16-bits for the flags argument, to >>> allow different individual implementations to have better >>> flexibility in interpreting the flags as per their needs. >> >> This seems like an overly complex solution for a rather simple >> problem. Instead of passing all sorts of flags, could we just add >> a parameter named "page" to da_to_va() that indicates the memory >> page of the address in the remote processor? >> >> Or perhaps there is some other use for all of these flags that I >> am not aware of? > > I'm not a big fan of this patch either. > > rproc_da_to_va() is used at the following places > > 2 qcom_q6v5_mss.c qcom_q6v5_dump_segment 974 void *ptr = rproc_da_to_va(rproc, segment->da, segment->size, > 3 remoteproc_core.c rproc_da_to_va 197 void *rproc_da_to_va(struct rproc *rproc, u64 da, int len, u32 flags) > 4 remoteproc_core.c rproc_handle_trace 582 ptr = rproc_da_to_va(rproc, rsc->da, rsc->len, RPROC_FLAGS_NONE); > 5 remoteproc_core.c rproc_coredump 1592 ptr = rproc_da_to_va(rproc, segment->da, segment->size, > 6 remoteproc_elf_loader.c rproc_elf_load_segments 185 ptr = rproc_da_to_va(rproc, da, memsz, > 7 remoteproc_elf_loader.c rproc_elf_find_loaded_rsc_table 337 return rproc_da_to_va(rproc, shdr->sh_addr, shdr->sh_size, > > At rproc_elf_load_segments() we need to pass enough information so that > the rproc driver can load the segment into proper area (IRAM vs DRAM). > So providing page should suffice. FYI, the PRU series I sent a while back has some patches to do something like this so feel free to use them if they are helpful. https://lore.kernel.org/lkml/20180623210810.21232-2-david@lechnology.com/ https://lore.kernel.org/lkml/20180623210810.21232-3-david@lechnology.com/ > > I want to understand more about rproc_elf_find_loaded_rsc_table() myself. > rproc_elf_find_loaded_rsc_table() is called only in rproc_start() in remoteproc_core.c > with the comment > > /* > * The starting device has been given the rproc->cached_table as the > * resource table. The address of the vring along with the other > * allocated resources (carveouts etc) is stored in cached_table. > * In order to pass this information to the remote device we must copy > * this information to device memory. We also update the table_ptr so > * that any subsequent changes will be applied to the loaded version. > */ > loaded_table = rproc_find_loaded_rsc_table(rproc, fw); > > Why isn't cached_table sufficient? > Why do we need to call rproc_find_loaded_rsc_table()? > > why do we need to load the resource table into remote processor memory at all. > As discussed earlier, some PRU systems have very little memory (512 bytes?) > and we want to avoid unnecessary loading. > > cheers, > -roger >