Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp6497007ybh; Thu, 8 Aug 2019 00:59:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqxBg6UjxqwQyJFpYsDXWgtV9dKPv7KCBu68h9TRrkby1HU/qNvYuZfKTybVCvzjj5Hpx3Wl X-Received: by 2002:a65:64cf:: with SMTP id t15mr11275810pgv.88.1565251188346; Thu, 08 Aug 2019 00:59:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565251188; cv=none; d=google.com; s=arc-20160816; b=FwAx8XzoqkEY0zpvSoLNSzYoe9+tiYqJclP9W/7nuLAMUSDt7WJZFcAtmdITGlvDyA bWPDsmpYGPS+AFLE/NNsz5+cy7x69r8vJpUijqTwtA1tfQjhleWoWxUu0snfoh5WqPIf WHa6Nq74NFTULiuUsM48sMuaMXFDUJOwTOpjwM2H33kHJZ/gTfFCZmeTYGa+ZNJ57zot SWIcbVROxWA4ooRzj9rE2NJmzLdMlbzbZXtYpP/7Zas3C/Cz2BIcCGHxwXPuVglVVkai 0PhxSFME4pvKoyWi7A4BM1Umx5lGCa4z2J/XeCJa9ZBO1z1emZe36bX7Fw2hDBY9JRhN dATA== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=N0iyIDFPGszLi975YqLS+JnyqeJZJVi55UOs+T0feyk=; b=EDXaiPWhjJ/jAvWxqgI0j0QJ/BJBwylPvNiYA5x1hTrvpz39u/1K7cI2mNVaITinJX ScX+sQ/Cj29tOfUsZ6ioiHkAFTyNkbqZH47gG0JA8RblDlQzJ7ILZc4Yv5jJwo5Ow+aO OI/5Utg8hZ/tl6uSg2kLCdaDwfw+1vWZP3Yu9EqSKqZOvxFulPx51UQ8vRZnkGXW4PEU pk9TIgahTAi+QIsCsQucXrvwTr+6LsKvLkd8pzVpw+fc+rcyDygXDLlwbGZjCgbWnxXd EecEPfdfteb9zS1mWghQxPffsQqGgvIpDfk12i+qzvoBcNn8CqvoKfrTv/smGjhaOfxd BkxA== 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 l102si1329363pje.78.2019.08.08.00.59.32; Thu, 08 Aug 2019 00:59:48 -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 S1731677AbfHHH6c (ORCPT + 99 others); Thu, 8 Aug 2019 03:58:32 -0400 Received: from verein.lst.de ([213.95.11.211]:44262 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731588AbfHHH6c (ORCPT ); Thu, 8 Aug 2019 03:58:32 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 3D39168B02; Thu, 8 Aug 2019 09:58:27 +0200 (CEST) Date: Thu, 8 Aug 2019 09:58:27 +0200 From: Christoph Hellwig To: Mark Rutland Cc: Rob Clark , Christoph Hellwig , Rob Clark , dri-devel , Catalin Marinas , Will Deacon , Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Daniel Vetter , Allison Randal , Greg Kroah-Hartman , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, LKML Subject: Re: [PATCH 1/2] drm: add cache support for arm64 Message-ID: <20190808075827.GD30308@lst.de> References: <20190805211451.20176-1-robdclark@gmail.com> <20190806084821.GA17129@lst.de> <20190806143457.GF475@lakrids.cambridge.arm.com> <20190807123807.GD54191@lakrids.cambridge.arm.com> <20190807164958.GA44765@lakrids.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190807164958.GA44765@lakrids.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 Wed, Aug 07, 2019 at 05:49:59PM +0100, Mark Rutland wrote: > I'm fairly confident that the linear/direct map cacheable alias is not > torn down when pages are allocated. The gneeric page allocation code > doesn't do so, and I see nothing the shmem code to do so. It is not torn down anywhere. > For arm64, we can tear down portions of the linear map, but that has to > be done explicitly, and this is only possible when using rodata_full. If > not using rodata_full, it is not possible to dynamically tear down the > cacheable alias. Interesting. For this or next merge window I plan to add support to the generic DMA code to remap pages as uncachable in place based on the openrisc code. AŃ• far as I can tell the requirement for that is basically just that the kernel direct mapping doesn't use PMD or bigger mapping so that it supports changing protection bits on a per-PTE basis. Is that the case with arm64 + rodata_full? > > My understanding is that a cacheable alias is "ok", with some > > caveats.. ie. that the cacheable alias is not accessed. > > Unfortunately, that is not true. You'll often get away with it in > practice, but that's a matter of probability rather than a guarantee. > > You cannot prevent a CPU from accessing a VA arbitrarily (e.g. as the > result of wild speculation). The ARM ARM (ARM DDI 0487E.a) points this > out explicitly: Well, if we want to fix this properly we'll have to remap in place for dma_alloc_coherent and friends.