Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp4268105ybh; Tue, 6 Aug 2019 08:53:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqyU2cvbV00Px+UzuoMwon6EGvtGuLzmr33xxeO+rVjFrRMZS8Pr8+fND5RJNCvOini0o8kU X-Received: by 2002:a17:90a:a116:: with SMTP id s22mr3869626pjp.47.1565106803757; Tue, 06 Aug 2019 08:53:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565106803; cv=none; d=google.com; s=arc-20160816; b=qq0/yqo+s1EKNkAcLNP25BzSOnrYQ6AtoD8JMnoTzRm4yEIUyf4zAULoOnXQI8Pn/r n2TIvQaoGyGQR91bXFtIbJNcz7PAHdgclTK/GG/cB8TditIVkSeaTU6DxyoESM/pxadc oGRA7373ZP9KKpQ18Yp8cmSq6FFpYLKnVlwithxfGnu5Nkhk0RGttCL/m+PA0OZWafIS b8EYxOFuZvtYQJ74DqTNpkNB5jyLfvQNL2p3o6/u17UGGOpNKAq6Et147AMTcfgVx113 VGI/Wc18gATaahCo2Ko7WT0JSoDnH+YUwDOplvjXun7Ug14g4EfOJ6rNph6TkckCs2tf Qa3w== 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=wbM6JdbmutFxo1wlvuT5sgd5id31k0pFyQb4acTCUYs=; b=jEcg9b0L99NLUU51dEdcASSsEgxK7sZB5ghFvbF7ISSjadEPsuRgBCDIzN1JBXzvF1 IJSsJ8UFTSb0B7n/kslvWGUCy2CMs4zM8lhQyEcsh/jo90TG2ao8e24ekMV5P5m7seF1 x31HKQH9yP7yPG94w+qyv2Lbv1bN5YjmzyUeTkI9oXib79zB+HpSmv1ItKoMnX93DI/U BbcL1NKBzD5TPe25z2AN41VckpV726iD5C108qD/IlgIux3c+MTUO9Jms0cLLCF899GK pJYF17zD3gEDNTRxbVGvaXafD3iwB8V2ZqMCU5QXXEIVo4hLtaY4gYPK3M0AIZ2btmSL 5N6A== 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 j6si51126095pgb.206.2019.08.06.08.53.08; Tue, 06 Aug 2019 08:53: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 S1733115AbfHFPut (ORCPT + 99 others); Tue, 6 Aug 2019 11:50:49 -0400 Received: from verein.lst.de ([213.95.11.211]:57530 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728041AbfHFPut (ORCPT ); Tue, 6 Aug 2019 11:50:49 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 125CC227A81; Tue, 6 Aug 2019 17:50:45 +0200 (CEST) Date: Tue, 6 Aug 2019 17:50:44 +0200 From: Christoph Hellwig To: Rob Clark Cc: 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: <20190806155044.GC25050@lst.de> References: <20190805211451.20176-1-robdclark@gmail.com> <20190806084821.GA17129@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Tue, Aug 06, 2019 at 07:11:41AM -0700, Rob Clark wrote: > Agreed that drm_cflush_* isn't a great API. In this particular case > (IIUC), I need wb+inv so that there aren't dirty cache lines that drop > out to memory later, and so that I don't get a cache hit on > uncached/wc mmap'ing. So what is the use case here? Allocate pages using the page allocator (or CMA for that matter), and then mmaping them to userspace and never touching them again from the kernel? > Tying it in w/ iommu seems a bit weird to me.. but maybe that is just > me, I'm certainly willing to consider proposals or to try things and > see how they work out. This was just my through as the fit seems easy. But maybe you'll need to explain your use case(s) a bit more so that we can figure out what a good high level API is. > Exposing the arch_sync_* API and using that directly (bypassing > drm_cflush_*) actually seems pretty reasonable and pragmatic. I did > have one doubt, as phys_to_virt() is only valid for kernel direct > mapped memory (AFAIU), what happens for pages that are not in kernel > linear map? Maybe it is ok to ignore those pages, since they won't > have an aliased mapping? They could have an aliased mapping in vmalloc/vmap space for example, if you created one. We have the flush_kernel_vmap_range / invalidate_kernel_vmap_range APIs for those, that are implement on architectures with VIVT caches.