Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2547953imu; Mon, 17 Dec 2018 04:01:04 -0800 (PST) X-Google-Smtp-Source: AFSGD/UqV5HWUF+BPJwcwMEacl/KPjP2xaefEnSKX/cI1018AIAZjVWnc0wjkfknxiI+nMOJu0pJ X-Received: by 2002:a17:902:b01:: with SMTP id 1mr12619006plq.331.1545048064918; Mon, 17 Dec 2018 04:01:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545048064; cv=none; d=google.com; s=arc-20160816; b=xv/a11HPniDmTFwwfBV3pe9CqBYtF7NNIa8cp+DAxYcQ1+fXMAlQY64Oqb6Lk3imSZ aqCbKcopEXtbCUQiXfMSiYKAQv62Bq7L6PEplW79ZjfO7dkaYdSPWZrR1j9ty89abdeH uJgGLkevcuVQcVtNN7BvT/KOBqtaCzMR8MMCV+0dVHraxvfrvIkuoGHhcHrzuWW2y1ey 7M3EeCC3Rj9TLN3sRGxWSyNdZjmgv+HtL4JZYAkpW18jI64+sK0P+qEB0jOINM4q2Mf6 BiDhWFgDQ5Aom67Cu4tojQP6G8yzFaBJp433/2thgxJ9H59cnpJ0xlAhhvpZKAL3L8eo M0nA== 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; bh=DpBOfCp3jbA9QqYWYmUCdrUL0skf7VBrndsWG05jRNA=; b=bDFLUP9WNOR1tedvjVAxHV9CjQaTjb0puwBoapFSMaFKN95o5fKrKsV80S2pMO4pF9 SsBe2QMjF8iinak9JR+WUNLzaPkFjsM1hZ/MpnJIjKmfL+I4nKlGngdp2KFe4g+r+GHm Qvf2HH0waBbZ+hb0HP1oiVPTIv3Hx8qjRfJYESW6zQHhBYDUoi4J+JxF6DDLcr4En9+g ZOxOlXXaPTpute+ppVD/0cZaZUV5QGsMV5EmMnJBrset35iI2uxRRIStxGYzTaUp4plx wOZM+gUCsHYnTHgn3Ng4BB1Hs6zO13kg3LeI/ak34khUi/F37hBbLg5Xk/PxOguZxleF 5D1g== 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 n30si10798381pgb.406.2018.12.17.04.00.45; Mon, 17 Dec 2018 04:01:04 -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 S1732663AbeLQL7f (ORCPT + 99 others); Mon, 17 Dec 2018 06:59:35 -0500 Received: from verein.lst.de ([213.95.11.211]:33919 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727255AbeLQL7e (ORCPT ); Mon, 17 Dec 2018 06:59:34 -0500 Received: by newverein.lst.de (Postfix, from userid 2407) id E66B168DD3; Mon, 17 Dec 2018 12:59:31 +0100 (CET) Date: Mon, 17 Dec 2018 12:59:31 +0100 From: Christoph Hellwig To: Greg Ungerer Cc: Christoph Hellwig , Geert Uytterhoeven , Linux IOMMU , Michal Simek , ashutosh.dixit@intel.com, alpha , arcml , linux-c6x-dev@linux-c6x.org, linux-m68k , Openrisc , Parisc List , linux-s390 , sparclinux , linux-xtensa@linux-xtensa.org, Linux Kernel Mailing List Subject: Re: [PATCH 1/2] dma-mapping: zero memory returned from dma_alloc_* Message-ID: <20181217115931.GA6853@lst.de> References: <20181214082515.14835-1-hch@lst.de> <20181214082515.14835-2-hch@lst.de> <20181214114719.GA3316@lst.de> <5ae55118-6858-9121-6b3e-9b19b41550ef@westnet.com.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5ae55118-6858-9121-6b3e-9b19b41550ef@westnet.com.au> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Dec 15, 2018 at 12:14:29AM +1000, Greg Ungerer wrote: > Yep, that is right. Certainly the MMU case is broken. Some noMMU cases work > by virtue of the SoC only having an instruction cache (the older V2 cores). Is there a good an easy case to detect if a core has a cache? Either runtime or in Kconfig? > The MMU case is fixable, but I think it will mean changing away from > the fall-back virtual:physical 1:1 mapping it uses for the kernel address > space. So not completely trivial. Either that or a dedicated area of RAM > for coherent allocations that we can mark as non-cachable via the really > course grained and limited ACR registers - not really very appealing. What about CF_PAGE_NOCACHE? Reading arch/m68k/include/asm/mcf_pgtable.h suggest this would cause an uncached mapping, in which case something like this should work: http://git.infradead.org/users/hch/misc.git/commitdiff/4b8711d436e8d56edbc5ca19aa2be639705bbfef > The noMMU case in general is probably limited to something like that same > type of dedicated RAM/ACR register mechamism. > > The most commonly used periperal with DMA is the FEC ethernet module, > and it has some "special" (used very loosely) cache flushing for > parts like the 532x family which probably makes it mostly work right. > There is a PCI bus on the 54xx family of parts, and I know general > ethernet cards on it (like e1000's) have problems I am sure are > related to the fact that coherent memory allocations aren't. If we really just care about FEC we can just switch it do use DMA_ATTR_NON_CONSISTENT and do explicit cache flushing. But as far as I can tell FEC only uses DMA coherent allocations for the TSO headers anyway, is TSO even used on this SOC?