Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4702259ybi; Tue, 11 Jun 2019 11:00:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqwsP/hTKBZKBx2N0yq2JsXw0WVig+vEtLUxMtzi/5jhysIs/JV7ROS4KDtOxBjMnSptxnuu X-Received: by 2002:a17:902:165:: with SMTP id 92mr49815131plb.197.1560276051329; Tue, 11 Jun 2019 11:00:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560276051; cv=none; d=google.com; s=arc-20160816; b=nJp7khUO3ZQCQOUU7+SRNhnLT/0OA6R/x5nezNehxHXuQJlQFMmRNejT5PgF49ZloL NR/PyBpVmv/PnPM+0ijeHkaBi1LJiZR+7TjthkVOhHgUHB+1DM9pcd43KdJxPsa3TJVO jGpKf3FQeSsQxY+RBtCUZDE5CRetPqxF/WQ7A6LO0Wo6T21I1Xran5T9VZWO/j/Qcgh0 mi+kMcczG9xbG54o/FKTvgNLQufnDd5vyIDekxz1gJpmzZTYzv34mw916NW0hTGryGpK tgg/UILNCOsgS4lvlj80zJp4P1WE2TI9naLkr5APdMq3sIc6W4OkruURH8eaNzwnhiFi 7fAA== 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=QUdEzzvfAGL2FN0o7r08v2cqixYtZDdFSaC7ppneevs=; b=I8nGuaP3qeqEU507f3vRs+RGBFyHeCew57G38GrTJSSzL/amzwblLs/Nrog9MZlREl OKx47CY8D3vTrlmpf8eJ+PMiL+FQlAPyCITScv0sKXkDGugdAyQPcoA2FhWg7g6O2NQO jVfhTgpqKaZoXw/R9/f5FC+qwMMgBV+xBm+s05p/MFPxU5IpLeDJLVXSy7ZUlmtBGRFU L+goRyerCRVF+YqUHJJvjcUQ4XPzid90qCHCM3rOcMa7RqoQ5wqjhluWZUTyzYMALOUL rdNTj8Yt1SyCjnZ0yXqT+YyRbw1IHAEAVXjeaPlIYk/LBl8T28VvT/iN8hjUPlrs/q7x 3jiw== 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 o14si2841481pjp.88.2019.06.11.11.00.35; Tue, 11 Jun 2019 11:00:51 -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 S2406802AbfFKSAL (ORCPT + 99 others); Tue, 11 Jun 2019 14:00:11 -0400 Received: from foss.arm.com ([217.140.110.172]:39386 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406701AbfFKSAL (ORCPT ); Tue, 11 Jun 2019 14:00:11 -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 DCF44337; Tue, 11 Jun 2019 11:00:10 -0700 (PDT) Received: from mbp (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A56C63F73C; Tue, 11 Jun 2019 11:00:09 -0700 (PDT) Date: Tue, 11 Jun 2019 19:00:07 +0100 From: Catalin Marinas To: Masayoshi Mizuma Cc: Will Deacon , linux-arm-kernel@lists.infradead.org, Masayoshi Mizuma , linux-kernel@vger.kernel.org, Hidetoshi Seto , Zhang Lei , Robin Murphy Subject: Re: [PATCH 1/2] arm64/mm: check cpu cache line size with non-coherent device Message-ID: <20190611180007.him7md7gdcjs5cg6@mbp> References: <20190611151731.6135-1-msys.mizuma@gmail.com> <20190611151731.6135-2-msys.mizuma@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190611151731.6135-2-msys.mizuma@gmail.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 11, 2019 at 11:17:30AM -0400, Masayoshi Mizuma wrote: > --- a/arch/arm64/mm/dma-mapping.c > +++ b/arch/arm64/mm/dma-mapping.c > @@ -91,10 +91,6 @@ static int __swiotlb_mmap_pfn(struct vm_area_struct *vma, > > 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); > @@ -473,6 +469,11 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, > const struct iommu_ops *iommu, bool coherent) > { > dev->dma_coherent = coherent; > + > + if (!coherent && (cache_line_size() > ARCH_DMA_MINALIGN)) > + dev_WARN(dev, "ARCH_DMA_MINALIGN smaller than CTR_EL0.CWG (%d < %d)", > + ARCH_DMA_MINALIGN, cache_line_size()); I'm ok in principle with this patch, with the minor issue that since commit 7b8c87b297a7 ("arm64: cacheinfo: Update cache_line_size detected from DT or PPTT") queued for 5.3 cache_line_size() gets the information from DT or ACPI. The reason for this change is that the information is used for performance tuning rather than DMA coherency. You can go for a direct cache_type_cwg() check in here, unless Robin (cc'ed) has a better idea. -- Catalin