From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Subject: Re: [RFC PATCH] drm: disable WC optimization for cache coherent devices on non-x86 Date: Mon, 21 Jan 2019 07:59:08 -0800 Message-ID: <20190121155908.GA8084@infradead.org> References: <20190121100617.2311-1-ard.biesheuvel@linaro.org> <20190121150734.GA30582@infradead.org> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Return-path: Content-Disposition: inline In-Reply-To: List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Sender: "amd-gfx" To: Ard Biesheuvel Cc: Will Deacon , David Zhou , Maxime Ripard , Benjamin Herrenschmidt , David Airlie , Maarten Lankhorst , Michel Daenzer , Linux Kernel Mailing List , amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, Christoph Hellwig , Junwei Zhang , Huang Rui , dri-devel , Daniel Vetter , Michael Ellerman , Alex Deucher , Sean Paul , Christian Koenig , linux-arm-kernel T24gTW9uLCBKYW4gMjEsIDIwMTkgYXQgMDQ6MzM6MjdQTSArMDEwMCwgQXJkIEJpZXNoZXV2ZWwg d3JvdGU6Cj4gT24gTW9uLCAyMSBKYW4gMjAxOSBhdCAxNjowNywgQ2hyaXN0b3BoIEhlbGx3aWcg PGhjaEBpbmZyYWRlYWQub3JnPiB3cm90ZToKPiA+Cj4gPiA+ICsjaW5jbHVkZSA8bGludXgvZG1h LW5vbmNvaGVyZW50Lmg+Cj4gPgo+ID4gVGhpcyBoZWFkZXIgaXMgbm90IGZvciB1c2FnZSBpbiBk ZXZpY2UgZHJpdmVycywgYnV0IHB1cmVseSBmb3IKPiA+IGRtYS1tYXBwaW5nIGltcGxlbWVudGF0 aW9ucyEKPiA+Cj4gCj4gSXMgdGhhdCBkb2N1bWVudGVkIGFueXdoZXJlPwoKSSdsbC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yB3ZSBtaWdodAphbHNvIG5lZWQg YSB3YXkgdG8gcXVlcnkgdGhlc2UgZmVhdHVyZXMsIGJ1dCB0aGF0IHJlYWxseSBoYXMgdG8gZ28K dGhyb3VnaCB0aGUgdXN1YWwgZG1hIGxheWVyIGFic3RyYWN0aW9uIGFzIHdlbGwgYW5kIG5vdCBo YWNrZWQgdG9nZXRoZXIKaW4gYSBkcml2ZXIgYmFzZWQgb24gYW4gZWR1YWN0ZWQgZ3Vlc3RpbWF0 ZS4KX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KYW1kLWdm eCBtYWlsaW5nIGxpc3QKYW1kLWdmeEBsaXN0cy5mcmVlZGVza3RvcC5vcmcKaHR0cHM6Ly9saXN0 cy5mcmVlZGVza3RvcC5vcmcvbWFpbG1hbi9saXN0aW5mby9hbWQtZ2Z4Cg== From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS, URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46A80C2F441 for ; Mon, 21 Jan 2019 15:59:12 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 16A5C20844 for ; Mon, 21 Jan 2019 15:59:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="l348Xeab" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 16A5C20844 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BpkVKB9S9ww4VSKKZdfl5xMraFLlhgmP7+easfaO+EQ=; b=l348XeabmIKVcH K2DXcNPuTEoxWfQj00raPzssRBCIkDEOGNCfk/9Fru6P5h1QWtqAoWJrEe90YLcsTaC4PdUuDzKXM 33moeF5vvi6aUF3jlxFvQTojvo/5vUzF51izL+7ieXnhjCT7i2yKjktRtQUkuI7g/Ij3ZBJThfhRD aqCeHo+Qu1qxQmm6u/RazKnmgaI546HyN0MiJQYE5vbXkAeyx6dcISrec+yqUbrW1KZptESlUnrzn 3kEUQjZbR8mdw9M+IkvVxxGFR7YD4n0DP2X8Dn8y8Ne3ONNdrT6G25+cSQCh8tT7VzTcwG8zmOS1H II2B1g2Q4UZdXbCI6Y2A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1glbyg-00031K-Vu; Mon, 21 Jan 2019 15:59:11 +0000 Received: from hch by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1glbye-00030K-Hw; Mon, 21 Jan 2019 15:59:08 +0000 Date: Mon, 21 Jan 2019 07:59:08 -0800 From: Christoph Hellwig To: Ard Biesheuvel Subject: Re: [RFC PATCH] drm: disable WC optimization for cache coherent devices on non-x86 Message-ID: <20190121155908.GA8084@infradead.org> References: <20190121100617.2311-1-ard.biesheuvel@linaro.org> <20190121150734.GA30582@infradead.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Will Deacon , David Zhou , Maxime Ripard , Benjamin Herrenschmidt , David Airlie , Maarten Lankhorst , Michel Daenzer , Linux Kernel Mailing List , amd-gfx@lists.freedesktop.org, Christoph Hellwig , Junwei Zhang , Huang Rui , dri-devel , Daniel Vetter , Michael Ellerman , Alex Deucher , Sean Paul , Christian Koenig , linux-arm-kernel Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Jan 21, 2019 at 04:33:27PM +0100, Ard Biesheuvel wrote: > On Mon, 21 Jan 2019 at 16:07, Christoph Hellwig wrote: > > > > > +#include > > > > This header is not for usage in device drivers, but purely for > > dma-mapping implementations! > > > > Is that documented anywhere? I'll add big fat comments. But the fact that nothing is exported there should be a fairly big hint. > > And even if something like this was valid to do, it would have to be > > a core function with an arch hook, and not hidden in a random driver. > > Why would it not be valid to do? Is it wrong for a driver to be aware > of whether a device is cache coherent or not? > > And in case it isn't, do you have an alternative suggestion on how to > fix this mess? For the write combine mappings we need a proper core API how instances can advertise the support. One thing I want to do fairly soon is error checking of the attrs argument to dma_alloc_attrs - so if you pass in something unsupported it will give you back an error. It seems that isn't quite enough for the drm use case, so we might also need a way to query these features, but that really has to go through the usual dma layer abstraction as well and not hacked together in a driver based on an eduacted guestimate. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED, USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 052C6C2F421 for ; Mon, 21 Jan 2019 15:59:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CA9BF20844 for ; Mon, 21 Jan 2019 15:59:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="Mxq+R22z" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730275AbfAUP7K (ORCPT ); Mon, 21 Jan 2019 10:59:10 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:34468 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728761AbfAUP7J (ORCPT ); Mon, 21 Jan 2019 10:59:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=6NEmVVeGQF+RW2yW3iE9OtImz5GMuIym5FZr9nYwJD8=; b=Mxq+R22zqGsivEjJBXctu91nt WeV/YbLGvri3McijBKcc8ujykesL9THu5sIny+R2UeJ4ZU4sE/si9E5ImVQdwDqsauHtjX8ljYCLb VcpMUkvbaifYB95QFw4bRNLLd13CipTKbyTQ/xVp6IfDLvMotkQceBMwYYVbBysBcq/S50Cx5JoaU mi0P5t+0QnTM0DfRe7MiN7Px6A7Y8hmNH1XS31VlrE/Hzhbvwju3vZRgzgni57p6HW9a+aT1AMwTO 5AezjK7WFp9IWrmC7qo18jH+9YY1JKkVnohyrK3eBS24H3gjNtoQ2ngJQjEshyES7OzGyNAh663aM gaHBNgI4A==; Received: from hch by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1glbye-00030K-Hw; Mon, 21 Jan 2019 15:59:08 +0000 Date: Mon, 21 Jan 2019 07:59:08 -0800 From: Christoph Hellwig To: Ard Biesheuvel Cc: Christoph Hellwig , linux-arm-kernel , dri-devel , Linux Kernel Mailing List , amd-gfx@lists.freedesktop.org, Christian Koenig , Alex Deucher , David Zhou , Huang Rui , Junwei Zhang , Michel Daenzer , David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Sean Paul , Michael Ellerman , Benjamin Herrenschmidt , Will Deacon Subject: Re: [RFC PATCH] drm: disable WC optimization for cache coherent devices on non-x86 Message-ID: <20190121155908.GA8084@infradead.org> References: <20190121100617.2311-1-ard.biesheuvel@linaro.org> <20190121150734.GA30582@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 21, 2019 at 04:33:27PM +0100, Ard Biesheuvel wrote: > On Mon, 21 Jan 2019 at 16:07, Christoph Hellwig wrote: > > > > > +#include > > > > This header is not for usage in device drivers, but purely for > > dma-mapping implementations! > > > > Is that documented anywhere? I'll add big fat comments. But the fact that nothing is exported there should be a fairly big hint. > > And even if something like this was valid to do, it would have to be > > a core function with an arch hook, and not hidden in a random driver. > > Why would it not be valid to do? Is it wrong for a driver to be aware > of whether a device is cache coherent or not? > > And in case it isn't, do you have an alternative suggestion on how to > fix this mess? For the write combine mappings we need a proper core API how instances can advertise the support. One thing I want to do fairly soon is error checking of the attrs argument to dma_alloc_attrs - so if you pass in something unsupported it will give you back an error. It seems that isn't quite enough for the drm use case, so we might also need a way to query these features, but that really has to go through the usual dma layer abstraction as well and not hacked together in a driver based on an eduacted guestimate.