Received: by 10.223.176.5 with SMTP id f5csp1542504wra; Wed, 31 Jan 2018 07:58:59 -0800 (PST) X-Google-Smtp-Source: AH8x226oZwiD9+I7tboTzvKuCSvW7C/ZPIv8nMc6fQwgiAZYcVMSenNaAXS99uRMepCNaMM9fG0Y X-Received: by 2002:a17:902:d90a:: with SMTP id c10-v6mr29587692plz.200.1517414339301; Wed, 31 Jan 2018 07:58:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517414339; cv=none; d=google.com; s=arc-20160816; b=eNFDL4tuCdalUh/Lm0OjoN3uuA8abiTslqXqhrYeLmdoafdgAhjEs+30m0WaIP6KB2 5+/6vwjaX0Gmr+sQ2p28pi77bGEUEXOilVhpng3RNenrnMIlQIQ68FirIRKoes7kRJFB 4R0jK9/FniWRGMDm6jLHKp5bOhrc0dNXwFd96wqGxTl1BKbLutbtTxBXaQhCkVtXf4Gv VuZOVuCKBYV1vkg6A9W4ayldT07lhLw8QPQ/Xq3m5ITSzgRP3XuC2RQ7OSiIBVknwD5h jgf/AoaLgCrpAuuSamzOOauKuGBRgustY23vCw8JrGNnymEEoChZUw1Gma3DKmE6GFwG OgAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=FmfWqkMV5hS4OQRiqdSH2XaXg2tyi8sc5RnTDYXiCy0=; b=wtYXLd0bTN4ff8y2agAgJRFz3vkRvuZ7tf/HPdf3Y+uBqvO1Q2tzUn4TYh5GVSQhdB Rr9q9rN87YWJ0Rn2YMM4A1QdZEi+JzWTCl3uKVWK402WNqMECV9Y+9NNcHtkYCoEixZw fXkyIzbhZSfje6RFH3i5YlzmtAVG3FSM2xCncSf7o5aoIIfzeGP3yghW6DCkvB37z0Pr +/smNKh8CbmlYcxVkNTxrdG+tc93tryzQaLVAAKClvfz2FomxlzROrAA7ATsuWwgxS24 2VI/vVd0EUNLpnX8SY/tSKGmgpsZFmx6oof6iLZCCuRflqpcxPcUxVccw6LwteLtPqBR 6Onw== 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 n3-v6si2123556plp.487.2018.01.31.07.58.45; Wed, 31 Jan 2018 07:58:59 -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; 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 S932099AbeAaOr6 (ORCPT + 99 others); Wed, 31 Jan 2018 09:47:58 -0500 Received: from dliviu.plus.com ([80.229.23.120]:53144 "EHLO smtp.dudau.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752189AbeAaOr4 (ORCPT ); Wed, 31 Jan 2018 09:47:56 -0500 Received: from mail.dudau.co.uk (bart.dudau.co.uk [192.168.14.2]) by smtp.dudau.co.uk (Postfix) with SMTP id 79BEC40EABDF; Wed, 31 Jan 2018 14:47:53 +0000 (GMT) Received: by mail.dudau.co.uk (sSMTP sendmail emulation); Wed, 31 Jan 2018 14:47:53 +0000 Date: Wed, 31 Jan 2018 14:47:53 +0000 From: Liviu Dudau To: Maxime Ripard Cc: 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 , Arnd Bergmann , Benjamin Gaignard , Ramesh Shanmugasundaram , Sakari Ailus , Rick Chang , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, megous@megous.com Subject: Re: [linux-sunxi] Re: [PATCH v6 2/2] media: V3s: Add support for Allwinner CSI. Message-ID: <20180131144753.GB19945@bart.dudau.co.uk> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180131074212.7hvb3nqkt22h2chg@flea.lan> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 31, 2018 at 08:42:12AM +0100, Maxime Ripard wrote: > Hi Liviu, Hi Maxime, > > 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: > > > Hi Maxime, > > > > > > On Fri, 26 Jan 2018 09:46:58 +0800 > > > Yong wrote: > > > > > > > Hi Maxime, > > > > > > > > Do you have any experience in solving this problem? > > > > It seems the PHYS_OFFSET maybe undeclared when the ARCH is not arm. > > > > > > Got it. > > > Should I add 'depends on ARM' in Kconfig? > > > > No, I don't think you should do that, you should fix the code. > > > > The dma_addr_t addr that you've got is ideally coming from dma_alloc_coherent(), > > in which case the addr is already "suitable" for use by the device (because the > > bus where the device is attached to does all the address translations). > > Like we're discussing in that other part of the thread with Thierry > and Arnd, things are slightly more complicated than that :) 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. 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. > > > If you apply PHYS_OFFSET forcefully to it you might get unexpected > > results. > > Out of curiosity, what would be these unexpected results? If in the future (or a parallel world setup) the device is sitting behind an IOMMU, the addr value might well be smaller than PHYS_OFFSET and you will under-wrap, possibly starting to hit kernel physical addresses (or anything sitting at the top of the physical memory). From my time playing with IOMMUs and PCI domains, I've learned to treat the dma_addr_t as a cookie value and never try to do arithmetics with it. Best regards, Liviu > > Thanks! > Maxime > > -- > Maxime Ripard, Free Electrons > Embedded Linux and Kernel engineering > http://free-electrons.com > > -- > You received this message because you are subscribed to the Google Groups "linux-sunxi" group. > To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe@googlegroups.com. > For more options, visit https://groups.google.com/d/optout.