Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8056366imu; Tue, 4 Dec 2018 02:05:47 -0800 (PST) X-Google-Smtp-Source: AFSGD/XASXN76K+ZWlSXneauztgXZMBMJ2fCSYBC9qwtomEPxX7EKluManTtPD3WNluUkPxYq3zj X-Received: by 2002:a17:902:bcc7:: with SMTP id o7mr19810095pls.281.1543917946982; Tue, 04 Dec 2018 02:05:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543917946; cv=none; d=google.com; s=arc-20160816; b=EcxEvhwshGna61Wp/ir4Hs1y/LFDuq4UAQKweiiYaTxpD1D4HzFSyI6UDGAIrQiH1r leDDVW5tHGcC4skOPRAyEIJInWN3nr/YpJSeytuO3Md4H8SYCc9TKZPlv5Cj2utyM8c+ G5O3FHtNH/ZNBOk7k4MDF7d6fwuxqddgeTyWIc0N8MAyBsRJmOqWcVi/3VciLnoeQ9dK tKm5okV3H+XbvUO7d/ng4EWPEmcDi26g0gVgiXRzXkagMsKstjcQcSYUmgU4zE3cYHwH CmIwgEMQGmh0CexrhUaYn1Hr/gboxPiSSNlzQMXnADoloDSGY7Ewr+FsDBchvyN941I1 AQ9Q== 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:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:dkim-signature; bh=B8J3sc3nmIiZr+4K9PcmGrK2QlFeB+qIYKkJFvtoE9Y=; b=OtnnOzkT7K2KItEhg4D7M/bmIhS2iYlN12pORPVTAoyVH0wenvuTe7TgyidjZFmiFm sA7BCO+GQDD6DFNG/lEvrLTSbwi4VgbT63sfVDXyP5DqeltrYiR6qB2NsLVlo4roXqIF gChDRp5w2S2OQB1bS/U91NJI2F9HQoeofKxPWM3Cp8IXzW0eo2FpK1bzvmw2i2lKNvxG yeAhV36eBKNquAvLvMYdHpGj+/olUBBGFzztirNtLQLpsS7go34rDV8qMGSL6a9oOyFj aye8SIWlwVzPb+t7Wav1hkP9z4i+tf4iLWcbxSoMQNeIht56wDenNtjKiB1+bBXuvJQz HzMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Ok7lG4mm; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r17si15222769pls.380.2018.12.04.02.05.30; Tue, 04 Dec 2018 02:05:46 -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=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Ok7lG4mm; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726046AbeLDKEy (ORCPT + 99 others); Tue, 4 Dec 2018 05:04:54 -0500 Received: from fllv0016.ext.ti.com ([198.47.19.142]:40158 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725764AbeLDKEx (ORCPT ); Tue, 4 Dec 2018 05:04:53 -0500 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id wB4A3wQ4101807; Tue, 4 Dec 2018 04:03:58 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1543917838; bh=B8J3sc3nmIiZr+4K9PcmGrK2QlFeB+qIYKkJFvtoE9Y=; h=Subject:To:References:CC:From:Date:In-Reply-To; b=Ok7lG4mmz+SH7asAclprmTXH5HyjH8HkAJXn8XrD86llC5rupeDFYAu2VKItcozxI uI6ybL4gco17/0fK3X5zZCRVvzXYSvFJ07bDsnlaofqqnuIkEDQ5+ffJNpfmwvvHiy EIDJ1mmpqSSMgFbO03blnryB/RvtdzSeFwRHqef4= Received: from DFLE115.ent.ti.com (dfle115.ent.ti.com [10.64.6.36]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id wB4A3wpe106239 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 4 Dec 2018 04:03:58 -0600 Received: from DFLE110.ent.ti.com (10.64.6.31) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Tue, 4 Dec 2018 04:03:56 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE110.ent.ti.com (10.64.6.31) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1591.10 via Frontend Transport; Tue, 4 Dec 2018 04:03:56 -0600 Received: from [192.168.2.6] (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id wB4A3qN8016455; Tue, 4 Dec 2018 04:03:53 -0600 Subject: Re: [PATCH 01/16] remoteproc: Extend rproc_da_to_va() API with a flags parameter To: David Lechner , , , References: <1543218769-5507-1-git-send-email-rogerq@ti.com> <1543218769-5507-2-git-send-email-rogerq@ti.com> <5BFFBFA0.9000104@ti.com> CC: , , , , , , , , , , , , , From: Roger Quadros Message-ID: <5C065107.8080600@ti.com> Date: Tue, 4 Dec 2018 12:03:51 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29/11/18 18:12, David Lechner wrote: > 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/ > Thanks. I think we need to do something like that. Too bad you had to reverse engineer the TI specific headers. I'll check if we have this available somewhere internally. >> >> 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. >> This question still holds. Suman? cheers, -roger -- Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki