Received: by 10.223.176.5 with SMTP id f5csp2942472wra; Mon, 29 Jan 2018 06:34:41 -0800 (PST) X-Google-Smtp-Source: AH8x225KByqRlIdPcYpMBqJnge0v716v73uc1VfWAG6C7O6GgZV+2Dm7ZoUUDc1IDCkRCx1reUCg X-Received: by 2002:a17:902:7793:: with SMTP id o19-v6mr1550778pll.207.1517236481273; Mon, 29 Jan 2018 06:34:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517236481; cv=none; d=google.com; s=arc-20160816; b=R+HoQrt3hE8rR4B/Aj2I2RMib2zV/kLDAB7xDaEWnfbY4pjVmYguM8jX6cvK/2gRBq 5+YSsZN0Td4xaHDlRSu7So2Hc0nhpRttCmfniwGfer7o5j61xYbRGNyukUMvqiB0N7eB kYjTq2aI6q6piweANqXjWvuYnqY5pVoUv/6bZm86wXl8TOm88udbeWm9vcaOjEkT0zy5 7MPxgvWQ6lmkSA3DSNohO6SgIfAy1yzlSlCtlsrS40qbKJnUoO9cAbezlC07G5AIQDzo k+eZApfT9rilRwQrSaX61dq64AjtNSsa+nq+06iONM52MknQfmAGzwLddz8XbZ53GmPf O8jQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=3u7JzUySaGp0ymofIS7pUAP78FgfKc4Ekurwkdy1mVk=; b=XbkLDe+E6w7YxgcHVyuDkHOQDRMMIf/70aUKZWny+BjeFnplDMQI0n0HGEO4Rf0Tbv 32c4Pu6EOCOyTeogDkBhQm5ewcsxM3DZsSuWM3imbH5XWM61q9jI5YdqVdSIlyYOFshD F1jeNejAC/zcj1ZMNxfBF+U3TDceCjZMbi4o+lEtiqEkHTAwWJcBTxMhdWwdPkPBFYqG aFxBFZoGN/7H2zk4hQnFvYyzSnbbXrMKYKxXzxBzHElAEAZI7i7eLV2hzuAYUkMFxDe/ MduG8/CDwJlwNo1w0BThW+l5fed4n/be+QPoWeyNRgvvwDzXZQRX9ZAnrbF2e3q7HCqn AflA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=eseD6xnB; 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 d63si12104373pfk.73.2018.01.29.06.34.26; Mon, 29 Jan 2018 06:34:41 -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=@gmail.com header.s=20161025 header.b=eseD6xnB; 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 S1751981AbeA2OeF (ORCPT + 99 others); Mon, 29 Jan 2018 09:34:05 -0500 Received: from mail-ot0-f196.google.com ([74.125.82.196]:42121 "EHLO mail-ot0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751428AbeA2OeD (ORCPT ); Mon, 29 Jan 2018 09:34:03 -0500 Received: by mail-ot0-f196.google.com with SMTP id a7so3817715otk.9; Mon, 29 Jan 2018 06:34:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=3u7JzUySaGp0ymofIS7pUAP78FgfKc4Ekurwkdy1mVk=; b=eseD6xnBStADjixWDtFSobXhF4SQMVsRea4kF9NYksRLRuA9W1qnuBhoPM0IkshQYM RSfya2U7e8w/Wa+gefdpiUHXmy/iW3cvlSOMUO0bQVYuxSPC1i8IAt9pcnCR4WvhSQ/t lONuHjDLQkfpP1cHPuyDAO5M/wfi2zxGTPStCUnw9olMsIQJlPlAYLczsywvQQDKx9nk 4yYpS+nhqC+9GIRqy0jRZzxRCDdh3P87bXwW+nXFCHKVNvtQSiShhmst4iTjJU2+WpT8 kY0+twMx+BlEEcpCekCrAcA9eH8TTKX2Z0/oqFJFFqao//gTZLYwqVFmF6wUIdz0+QmE DOOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=3u7JzUySaGp0ymofIS7pUAP78FgfKc4Ekurwkdy1mVk=; b=IbEI7o7EKrKNoguotHGkPVHpDVdJoqVj1PVQhtn8LGcfY9+j27mzNrSVrQMReWI2n7 rf7On1++7tgwhPECeDxJDorbquHBmcl0m7FE+CBQ+XSezJbAIxXpTg/iz91FMu3Gv1mm bChhNgkmf5pS38tMubLCLbR28As/OakzQVWQBocb61xF7LRh8CYGqnTK0Lc8SiW/cBfs yUpOzZagJnTV+DOW0iAgbov4HSuDHGM+Io/eVmfa1iCoGTQrqqbpYz3lAGa/V5mHALzc avGq9hcrBNrfMn1ocm3DcTX9ZhJEiPzyhPmZ5ED1N/+s5ryaNuq1yYYTvX7kUdYaRoBs Ju4g== X-Gm-Message-State: AKwxytcV4vnUUszqF8ddMGlTuRxKBD6WflYvsfW1BIOtaRhQvtzoluYc FuJNp10nJWhGM8P/eId6pkMiJctX/zwa8QdcIBU= X-Received: by 10.157.34.53 with SMTP id o50mr4557291ota.104.1517236442627; Mon, 29 Jan 2018 06:34:02 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.68.33 with HTTP; Mon, 29 Jan 2018 06:34:02 -0800 (PST) In-Reply-To: References: <1516695531-23349-1-git-send-email-yong.deng@magewell.com> <20180129082533.6edmqgbauo6q5dgz@flea.lan> From: Arnd Bergmann Date: Mon, 29 Jan 2018 15:34:02 +0100 X-Google-Sender-Auth: d7Xz4OLAFxDFXTEx7WTXFS9nrp4 Message-ID: Subject: Re: [PATCH v6 2/2] media: V3s: Add support for Allwinner CSI. To: Linus Walleij Cc: Maxime Ripard , Yong Deng , Mauro Carvalho Chehab , Rob Herring , Mark Rutland , Chen-Yu Tsai , "David S. Miller" , Greg Kroah-Hartman , Hans Verkuil , Randy Dunlap , Stanimir Varbanov , Hugues Fruchet , Yannick Fertre , Philipp Zabel , Benjamin Gaignard , Ramesh Shanmugasundaram , Sakari Ailus , Rick Chang , Linux Media Mailing List , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Linux ARM , "linux-kernel@vger.kernel.org" , linux-sunxi , megous@megous.com, Thomas Petazzoni Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 29, 2018 at 10:25 AM, Linus Walleij wrote: > On Mon, Jan 29, 2018 at 9:25 AM, Maxime Ripard > wrote: >> On Sat, Jan 27, 2018 at 05:14:26PM +0100, Linus Walleij wrote: >> However, in DT systems, that >> field is filled only with the parent's node dma-ranges property. In >> our case, and since the DT parenthood is based on the "control" bus, >> and not the "data" bus, our parent node would be the AXI bus, and not >> the memory bus that enforce those constraints. >> >> And other devices doing DMA through regular DMA accesses won't have >> that mapping, so we definitely shouldn't enforce it for all the >> devices there, but only the one connected to the separate memory bus. >> >> tl; dr: the DT is not really an option to store that info. >> >> I suggested setting dma_pfn_offset at probe, but Arnd didn't seem too >> fond of that approach either at the time. >> >> So, well, I guess we could do better. We just have no idea how :) > > Usually of Arnd cannot suggest something smart, neither can I :( > > If some aspect of the memory layout of the system *really* doesn't > fit into DT because of the assumptions that DT is doing about > how systems work, we have a problem. > > Is the problem that DT's model assumes that devices have one and > only one data port to the system memory, and that is how it > populates the Linux devices? > > I guess, if nothing else works, I would use auxdata in the board file. > It is our definitive last resort when DT doesn't hold. > > I.e. I would go into struct of_dev_auxdata > (from ) and add a > dma_pfn_offset field that gets set into the device's dma_pfn_offset > in drivers/of/platform.c overriding anything else and use that to hammer > it down in the boardfile. > > But I bet some DT people are going to have other ideas. At one point we had discussed adding a 'dma-masters' property that lists all the buses on which a device can be a dma master, and the respective properties of those masters (iommu, coherency, offset, ...). IIRC at the time we decided that we could live without that complexity, but perhaps we cannot. Another local hack that we can do here is to have two separate device nodes and let the device driver bind to one device and then look up the other one through a phandle to look up a platform_device for it, which it can then use with the DMA mapping interface. Arnd