Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2371812ybi; Mon, 17 Jun 2019 03:46:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqxc41w/NjsW56/NRw8YSOBoFYt1oqOT46RdzhcuXYrmt0bq3fppnp/tubDmX9Rh28wmbYHY X-Received: by 2002:a62:1515:: with SMTP id 21mr35333610pfv.100.1560768383874; Mon, 17 Jun 2019 03:46:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560768383; cv=none; d=google.com; s=arc-20160816; b=rPeMDoQgBysSNefIkJvb1DjNQpyQRrTWT4k4uKd+OfmFioHvC5GcHUlBCFgRfQKzRs U+2YqWw/X2QTiepYwRAg98t+Skn2s7uUA0BdO32woMbAyq64LyFoHmUeb8IeNu2cj6Nk U1/G+GWOmo9VGolkxduzOkZZL9ipEX8rOD+sVK2/ZJtAeaEDBpzKV6M5sFyB3WW2ofG1 eKTv6CUF8SjOI6RvXZ8hcrBCEaFKjFJCaGdDs6cQMROaYZi4SITDnkrf3HBKhXrMeBAh 6NRAVKrmhxw1JKgHiGwsk1wCuZUT6YlLBNNXOESX7Uhmor2bqEgBgqbJnTOomQaErrjF agPw== 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=aQDouq8LqNfdscuaz8jSBVNGw7BNInHT0EZyWlwaekE=; b=dxB2fYy9iEu5ejJXkXuyPb9bGUaZfVmgaXw2atBuiuHpV3zY0fmo0WlG0ra9OK8xE7 eMqq+X3mKWRDWIQkheaKqT0AH574hETaOyFaVu7NS1EBeQYICkklAM5R5k+9hcHgIeLg vUh88LEbbbANSw2oEej/WDQuqwjHGOc1uqR1i3FZopyIcMWmpuZDNReUJQ7Svddy38d4 1HoCK3/UlUynSwd/DKZ0fc/H3M/FvfCcRsLwgjnaCe8Hm18a4gxNDwdJ5s0UwQJ51nEt X06Db1CGOMkSxOimsXNTRQNvnF6f9rWClcENS2AraKL259L9llIUNtvfA6eo+Mcw8XNM JQIw== 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 q42si10290178pjc.103.2019.06.17.03.46.07; Mon, 17 Jun 2019 03:46:23 -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 S1727385AbfFQKp7 (ORCPT + 99 others); Mon, 17 Jun 2019 06:45:59 -0400 Received: from foss.arm.com ([217.140.110.172]:45086 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726174AbfFQKp7 (ORCPT ); Mon, 17 Jun 2019 06:45:59 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F24BB344; Mon, 17 Jun 2019 03:45:58 -0700 (PDT) Received: from arrakis.emea.arm.com (arrakis.cambridge.arm.com [10.1.196.78]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 122773F246; Mon, 17 Jun 2019 03:47:42 -0700 (PDT) Date: Mon, 17 Jun 2019 11:45:55 +0100 From: Catalin Marinas To: Zhangshaokun Cc: Masayoshi Mizuma , Robin Murphy , Will Deacon , linux-arm-kernel@lists.infradead.org, Masayoshi Mizuma , linux-kernel@vger.kernel.org, Hidetoshi Seto , Zhang Lei Subject: Re: [PATCH v2] arm64/mm: Correct the cache line size warning with non coherent device Message-ID: <20190617104555.GA1367@arrakis.emea.arm.com> References: <20190614131141.4428-1-msys.mizuma@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jun 15, 2019 at 10:44:33AM +0800, Zhangshaokun wrote: > On 2019/6/14 21:11, Masayoshi Mizuma wrote: > > diff --git a/arch/arm64/kernel/cacheinfo.c b/arch/arm64/kernel/cacheinfo.c > > index 6eaf1c07aa4e..7fa6828bb488 100644 > > --- a/arch/arm64/kernel/cacheinfo.c > > +++ b/arch/arm64/kernel/cacheinfo.c > > @@ -19,12 +19,10 @@ > > > > int cache_line_size(void) > > { > > - u32 cwg = cache_type_cwg(); > > - > > if (coherency_max_size != 0) > > return coherency_max_size; > > > > - return cwg ? 4 << cwg : ARCH_DMA_MINALIGN; > > + return cache_line_size_of_cpu(); > > } > > How about simplify it as this? > > int cache_line_size(void) > { > return coherency_max_size ? coherency_max_size : > cache_line_size_of_cpu(); > } I don't see this as a simplification, easier to read with explicit 'if'. > > EXPORT_SYMBOL_GPL(cache_line_size); > > > > diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c > > index 1669618db08a..379589dc7113 100644 > > --- a/arch/arm64/mm/dma-mapping.c > > +++ b/arch/arm64/mm/dma-mapping.c > > @@ -38,10 +38,6 @@ void arch_dma_prep_coherent(struct page *page, size_t size) > > > > static int __init arm64_dma_init(void) > > { > > - WARN_TAINT(ARCH_DMA_MINALIGN < cache_line_size(), > > - TAINT_CPU_OUT_OF_SPEC, > > - "ARCH_DMA_MINALIGN smaller than CTR_EL0.CWG (%d < %d)", > > - ARCH_DMA_MINALIGN, cache_line_size()); > > return dma_atomic_pool_init(GFP_DMA32, __pgprot(PROT_NORMAL_NC)); > > } > > arch_initcall(arm64_dma_init); > > @@ -56,7 +52,17 @@ void arch_teardown_dma_ops(struct device *dev) > > void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, > > const struct iommu_ops *iommu, bool coherent) > > { > > + int cls = cache_line_size_of_cpu(); > > whether we need this local variable, how about use cache_line_size_of_cpu > directly in WARN_TAINT just like before. The reason being? Anyway, I'll queue v2 of this patch as is for 5.3. Thanks. -- Catalin