Received: by 10.223.176.5 with SMTP id f5csp2500991wra; Thu, 1 Feb 2018 01:21:10 -0800 (PST) X-Google-Smtp-Source: AH8x225xSpx27mpCA0enXoSFm4DeylMV766y4gNUBVfEGI4Pevz+WNx2wOT0fpXIJWuVktByPV8U X-Received: by 10.98.157.26 with SMTP id i26mr36184994pfd.12.1517476870193; Thu, 01 Feb 2018 01:21:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517476870; cv=none; d=google.com; s=arc-20160816; b=BkSr6HM2YNTgwzvA4UEPuznhcm5uESsnGo/Lnz4550ibkmdrafm+rdvZh3JLTb4JNX 7PPxGiTxRjGZw026YQKEDs2LHYCmq4Yc6Nl9ereEVUYSmB0Tj30dC5SMe1g9S2UQwc/3 SVTZEghRP79Lfff+2WUgqpXl1DD0+dG1kBEMGEl/ywBRczaSXKMGbbcx0eX+9lmSvOv8 C0jtm7XeSBVc150hrQ1DB1zXrwuBb0hWAQEDuDtq0RYR8hZvhHrIIptgy3Yr+e+bzL16 kDjxkCd9ylUTIiuzVRwKotA85ouPP4NBS9AF3+616XcxzCdozjtp78P8Tl94UC5bzRYh EJWg== 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=Fx3omyvNF1M6dEtVmR1r0MVd42N0S1t2zgN2xELsxXk=; b=KA28RfWKa86OYYa7oW/XHTIiAyqNunD55qwsxn/fBF2SwA+3mhjjWk2sL/iPuzmVFP FvLrikCk2lwPo3fEmIkrm3OdMPUEkl0VpZ5tK/sMgU4m+mT2jqo12nXYNvKz5PgAxM3f 2vf1BzXBVaTDQ75ukKHshaZGftDwwW6ROyx8bdICUCoXKjWJViQ99PMlxvM0TbEJc9VE NOdwmmFgQ4ypMi6GQ49Vu/cRmpFACR4YNsf2UrIDcj+GpKFgTVgdcKk1IiuVa8xliiAe 9u+fCPzdHDw7SrQu9i9BV9rb1glqO6SEj2Hn7u2NmCz4VIrJBAgznVE556cjMNnEpD9R 30Ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=Qgzyevys; 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 p13-v6si3174658pll.84.2018.02.01.01.20.55; Thu, 01 Feb 2018 01:21:10 -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=Qgzyevys; 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 S1751989AbeBAJUc (ORCPT + 99 others); Thu, 1 Feb 2018 04:20:32 -0500 Received: from mail-oi0-f65.google.com ([209.85.218.65]:33655 "EHLO mail-oi0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751628AbeBAJUa (ORCPT ); Thu, 1 Feb 2018 04:20:30 -0500 Received: by mail-oi0-f65.google.com with SMTP id l8so12837599oig.0; Thu, 01 Feb 2018 01:20:29 -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=Fx3omyvNF1M6dEtVmR1r0MVd42N0S1t2zgN2xELsxXk=; b=QgzyevysujpShnSnBuECd3Nqod8hbcdAtn13lIfBribUx3tFCWPtQ7OGQ6KuIv9kca J2Wb9oHKK2GGlCWEDVz+KJFvQElzhm4CFlRmx7VOXNTqtGr/pBfP8atkSSkPcgshSG9C g6368Q14UpaSQovNbS9YTMoIQfdoCaC9ALX8IjhLKdHPdtmsS+mtUe7n/GlO1ElGTpqr MH2ypamcd09z0yW8MYFQbCzjwzbEZ6MH2QA80kZXrC36tz70fvRl1IQBBluqSqS6mGm8 v3XnouyvlCOqhaLdfc5u5hpeNYg7Z1qcXqEHO74IFN1jINjXxiAQP1FWf/KpUljVSLj2 cbiw== 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=Fx3omyvNF1M6dEtVmR1r0MVd42N0S1t2zgN2xELsxXk=; b=NLeAc5YBisSar1svTZl8x0GcjfRcoXgNF0K/y3f/ytFRQsoIYLdwIkBoTkvNYmNQq8 Hti5esKnjDs38X9v658WXlsdy8kUpBYkPiA0IDBNg7Wux6ZnJJFBW6YTQa548o1z4Wp5 TGgvThJpdlBLo3ULE3iHrPJMMyKxAdo0KmGykGbxsNQ7/veRtwHeU/KrAt+IIVFG6ooZ JlwlSPzJpcM8KBNVB4titEH1Myb9jxVia8WTK4u6h0e5GYlfWvZmtEi4xGhrg4evp1EM oDUWjIoeYrCnAx+uhjamT96ZcEovMlHgOEm6mcqnHfmZdYtA2RMtAjbWSLuYW/VeaDIK RN/w== X-Gm-Message-State: AKwxytdH4OgIOy79rJfe+AhWTo88Ogro0HtplR63lC6mb/gG5XYS19IM ZQ1eKB3/MTGrqa8fSXiUh1RvW2MOOZq8eh1smSA= X-Received: by 10.202.86.12 with SMTP id k12mr13131646oib.283.1517476828969; Thu, 01 Feb 2018 01:20:28 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.68.33 with HTTP; Thu, 1 Feb 2018 01:20:28 -0800 (PST) In-Reply-To: <20180201083222.q6rqql4nngn2bhiy@flea.lan> References: <1516695531-23349-1-git-send-email-yong.deng@magewell.com> <201801260759.RyNhDZz4%fengguang.wu@intel.com> <20180126094658.aa70ed3f890464f6051e21e4@magewell.com> <20180126110041.f89848325b9ecfb07df387ca@magewell.com> <20180131030807.GA19945@bart.dudau.co.uk> <20180131074212.7hvb3nqkt22h2chg@flea.lan> <20180131144753.GB19945@bart.dudau.co.uk> <20180201083222.q6rqql4nngn2bhiy@flea.lan> From: Arnd Bergmann Date: Thu, 1 Feb 2018 10:20:28 +0100 X-Google-Sender-Auth: _6lOS2bcJR_XcRlX7wSGQsETnro Message-ID: Subject: Re: [linux-sunxi] Re: [PATCH v6 2/2] media: V3s: Add support for Allwinner CSI. To: Maxime Ripard Cc: Liviu Dudau , Yong , kbuild test robot , kbuild-all@01.org, Mauro Carvalho Chehab , Rob Herring , Mark Rutland , Chen-Yu Tsai , "David S. Miller" , Greg Kroah-Hartman , Hans Verkuil , Linus Walleij , Randy Dunlap , Stanimir Varbanov , Hugues Fruchet , Yannick Fertre , Philipp Zabel , Benjamin Gaignard , Ramesh Shanmugasundaram , Sakari Ailus , Rick Chang , Linux Media Mailing List , DTML , Linux ARM , Linux Kernel Mailing List , linux-sunxi , megous@megous.com 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 Thu, Feb 1, 2018 at 9:32 AM, Maxime Ripard wrote: > On Wed, Jan 31, 2018 at 02:47:53PM +0000, Liviu Dudau wrote: >> On Wed, Jan 31, 2018 at 08:42:12AM +0100, Maxime Ripard wrote: >> > On Wed, Jan 31, 2018 at 03:08:08AM +0000, Liviu Dudau wrote: >> > > On Fri, Jan 26, 2018 at 11:00:41AM +0800, Yong wrote: >> >> Yeah, sorry, my threading of the discussion was broken and I've seen >> the rest of the thread after I have replied. My bad! >> >> > >> > In our case, the bus where the device is attached will not do the >> > address translations, and shouldn't. >> >> In my view, the bus is already doing address translation at physical >> level, AFAIU it remaps the memory to zero. > > Not really. It uses a separate bus with a different mapping for the > DMA accesses (and only the DMA accesses). The AXI (or AHB, I'm not > sure, but, well, the "registers" bus) doesn't remap anything in > itself, and we only describe this one usually in our DTs. Exactly, the DT model fundamentally assumes that each a device is connected to exactly one bus, so we make up a device *tree* rather than a non-directed mesh topology that you might see in modern SoCs. The "dma-ranges" property was introduced when this first started falling apart and we got devices that had a different translation in DMA direction compared to control direction (i.e. the "ranges" property), but that still assumed that every device on a given bus had the same view of DMA space. With just "dma-ranges", we could easy deal with a topology where each DMA master on an AXI bus sees main memory at address zero but the CPU sees the same memory at a high address while seeing the MMIO ranges at a low address. What we cannot represent is multiple masters on the same AXI bus that use a different translation. Making up arbitrary intermediate buses would get this to work, but would likely cause other problems in the future when we do something else that relies on having a correct representation of the hierarchy of all the AXI/AHB/APB buses in the system, such as doing per-bus bandwidth allocation for child devices or anything else that requires configuring the bus bridge itself. >> What you (we?) need is a simple bus driver that registers the >> correct virt_to_bus()/bus_to_virt() hooks for the device that do >> this translation at the DMA API level as well. > > Like I said, this only impact DMA transfers, and not the registers > accesses. We have other devices sitting on the same bus that do not > perform DMA accesses through that special memory bus and will not have > that mapping changed. virt_to_bus()/bus_to_virt() don't actually exist on modern platforms any more, but when they did, they were only about dma access, not mmio access, so they would correspond to what we do with 'dma-ranges' rather than 'ranges'. Arnd