Received: by 10.213.65.68 with SMTP id h4csp1773312imn; Mon, 19 Mar 2018 12:53:33 -0700 (PDT) X-Google-Smtp-Source: AG47ELsfBRqlFc3xDsqO8LdqNFsHylyD5T954rG/8cKJg6fClLExwQNncGt70bAfmbPrPsJOFsV4 X-Received: by 10.98.109.131 with SMTP id i125mr11235175pfc.226.1521489213729; Mon, 19 Mar 2018 12:53:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521489213; cv=none; d=google.com; s=arc-20160816; b=M7MoO9PXXddfN0Jrg9YiySiz1U/jXP+H0knX+5AccKWNkrvf++Y6NLd1sUMYqHfDBl fi++O0kU8eIH8hTPlw0NSw1VRKqLXAl1pXpHDfWWXfVmsKPnjbMyJkXs7bihYMwIuNcU IVlCljU83LjUIl0dZrS2oexkk30PX+fOi99YrhHePGXcZ94UQIGvTZu1WZbXCUBLPGtE n0IL5/+LnCKdkjd4+mx51PvrpYHHqcIHID/dCQStq1zshX4rFxytQcAA7UA76X64py8b QaRwC7hJ62JP9xdYgv71WsxwmDFu6Wkgl+NN8qDXK/T21hpG5rV9ooLcsWyeKFpIfLyZ HC1Q== 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=pcC0aeC29ZgypijuI0Omn6Tuz9+0KdDL2aV0ttA4xug=; b=KcSEUjfnXJqfx3N2TRvJSeVKhB1mrhdm6GezvYRXVDqFGWHB8sJwVA7PAQ4VcyYrh1 3ULfaQcdqznPV2p9bJFMOt+oMnLInMok6b6yk+5MFTfGLat5wb8CW84LQTyQDPX3LXOv rzrtWXnhpLnk7VTFC3H2cV+rGOwa5CoUDpm2fftRQjFn3rwK89n3F7QwLw4b3Pc5NWRQ L5iuvCXnHusmbthJHxgcXQg2vlNbZuJu4kgpr5Nov5qhna+r4zVnyhmp32clQzEzeyXX AzRxIIX/PzjdBuCI3Y491YCQD8lPUyO2ChCCZBjKMO8S4TsOHHf259L2vjIBdDyE5NQt gxQg== 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 d6-v6si545075plo.661.2018.03.19.12.52.50; Mon, 19 Mar 2018 12:53:33 -0700 (PDT) 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 S970690AbeCSTte (ORCPT + 99 others); Mon, 19 Mar 2018 15:49:34 -0400 Received: from verein.lst.de ([213.95.11.211]:32919 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S970355AbeCSTtb (ORCPT ); Mon, 19 Mar 2018 15:49:31 -0400 Received: by newverein.lst.de (Postfix, from userid 2407) id 9C36F6F233; Mon, 19 Mar 2018 20:49:30 +0100 (CET) Date: Mon, 19 Mar 2018 20:49:30 +0100 From: Christoph Hellwig To: Catalin Marinas Cc: Christoph Hellwig , Will Deacon , Robin Murphy , x86@kernel.org, Tom Lendacky , Konrad Rzeszutek Wilk , linux-kernel@vger.kernel.org, Muli Ben-Yehuda , iommu@lists.linux-foundation.org, David Woodhouse Subject: Re: [PATCH 12/14] dma-direct: handle the memory encryption bit in common code Message-ID: <20180319194930.GA3255@lst.de> References: <20180319103826.12853-1-hch@lst.de> <20180319103826.12853-13-hch@lst.de> <20180319152442.GA27915@lst.de> <5316b479-7e75-d62f-6b17-b6bece55187c@arm.com> <20180319154832.GD14916@arm.com> <20180319160343.GA29002@lst.de> <20180319180141.w5o6lhknhd6q7ktq@armageddon.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180319180141.w5o6lhknhd6q7ktq@armageddon.cambridge.arm.com> 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 Mon, Mar 19, 2018 at 06:01:41PM +0000, Catalin Marinas wrote: > I don't particularly like maintaining an arm64-specific dma-direct.h > either but arm64 seems to be the only architecture that needs to > potentially force a bounce when cache_line_size() > ARCH_DMA_MINALIGN > and the device is non-coherent. mips is another likely candidate, see all the recent drama about dma_get_alignmet(). And I'm also having major discussion about even exposing the cache line size architecturally for RISC-V, so changes are high it'll have to deal with this mess sooner or later as they probably can't agree on a specific cache line size. > Note that lib/swiotlb.c doesn't even > deal with non-coherent DMA (e.g. map_sg doesn't have arch callbacks for > cache maintenance), so not disrupting lib/swiotlb.c seems to be the > least intrusive option. No yet. I have patches to consolidate the various swiotlb ops that deal with cache flushing or barriers. I was hoping to get them in for this merge window, but it probably is too late now given that I have a few other fires to fight. But they are going to be out early for the next merge window. > > Nevermind that the commit should at least be three different patches: > > > > (1) revert the broken original commit > > (2) increase the dma min alignment > > Reverting the original commit could, on its own, break an SoC which > expects ARCH_DMA_MINALIGN == 128. So these two should be a single commit > (my patch only reverts the L1_CACHE_BYTES change rather than > ARCH_DMA_MINALIGN, the latter being correct as 128). It would revert to the state before this commit. > As I said above, adding a check in swiotlb.c for > !is_device_dma_coherent(dev) && (ARCH_DMA_MINALIGN < cache_line_size()) > feels too architecture specific. And what exactly is architecture specific about that? It is a totally generic concept, which at this point also seems entirely theoretical based on the previous mail in this thread.