Received: by 10.223.176.5 with SMTP id f5csp2710973wra; Mon, 5 Feb 2018 08:36:19 -0800 (PST) X-Google-Smtp-Source: AH8x224wd0bJ2dXTDknlC91BF37Hb+Keui/Vtoz0kvcyGvcavE6gXol81XNlRmbsW449cWvfK4eK X-Received: by 10.99.163.92 with SMTP id v28mr11275234pgn.432.1517848579749; Mon, 05 Feb 2018 08:36:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517848579; cv=none; d=google.com; s=arc-20160816; b=KkH0MrV0Swpk6AlGtYko+QwlKRSHQIm8BIukCPL8Q1VvhRrKBea1D0adyVU66n+K5V xHve0Etc0xF1e0j7ERaeuB5UYVI/zdJJJclc1LWXDNkTNwq3KFK/6xt/uqIylsGpgKha er6kzTqBrC/Oda74BykFf07fFfZUDqr/ZAzDaV0Ugrq0R3cEM0t/jejiPoWiGufR7+Bq mXHjiOGFu3hTNeNSWAqNxecsE31j7T8Zk+meOGzjTtVWBZcvaR+my1mh0UmwqGirO9T8 RqWNZ9tHiGojC0JjnbdTcp6VpQRFyfiSXgEqEmxw/j2I9YfB0udGKShgz3y445zlZ8v6 TnOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=TuHWz9I23IoRFsUSGlWpC3+5Q9TKm8ZIeG+OwwnmsyM=; b=SE64K5Af3hCcClxsJIuTYcdu2zjdTjFUKawbXysLI43QaM+tgkFLaAI3JeJlehukWc NNTAVqtePIfEi22X4HJ8vkxEVS6oGLsxZbdUMCr+2G+gmVlf3eVvxIKherXeTr+cx74r BMjy0pV7VciFS2Tt9pZDhujdrSKcoodQ8BqBO0n7Eb31KEgb5+4kh0V7W+AIFhFOgdRG PfYgAoSB/YK5w8RqGHaHkj4FHuSqsOarmCyoM6zubXWUAg9NovvpFJWz+BcyVKNqdQKN YGlLCanQMcaEOQMjr+2oSpVlFrNJTqjr6tPVZ5QQhVKr/6O4WnSGsCWGw3x+udgMz0yJ 5DEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=WOoDMJcY; 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 q7si5180097pfh.74.2018.02.05.08.36.05; Mon, 05 Feb 2018 08:36:19 -0800 (PST) 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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=WOoDMJcY; 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 S1753399AbeBEQeb (ORCPT + 99 others); Mon, 5 Feb 2018 11:34:31 -0500 Received: from mail-ot0-f175.google.com ([74.125.82.175]:39285 "EHLO mail-ot0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753289AbeBEQeY (ORCPT ); Mon, 5 Feb 2018 11:34:24 -0500 Received: by mail-ot0-f175.google.com with SMTP id f18so3393669otf.6; Mon, 05 Feb 2018 08:34:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=TuHWz9I23IoRFsUSGlWpC3+5Q9TKm8ZIeG+OwwnmsyM=; b=WOoDMJcYBjxJg7kWI7R+cm6xirG24nXVkhrRSX92k7+CcihixoU2us6mYq5Ykt48wP z8z29DOMJaQrvGEtQ+JKRJOeLCuUNKWS3hSF9Ep6RhUPcXUEbrUT09BbXqU1ApK16wMx yRGryEiMB3H+gJLDdijkbtwYimbXb139HtulCNlrt79BR0xoXyJZ6IEAMCfRJGY6ou/k w7BmcVkK6e4qtRFOU13rX6pKjY6fCS8J+fsmd/pKJUnhprM8Uu0KSwW8aWMHMIMLRhBj BKHFUNLo80nIXlB76SnclyN//SDWkcrU5DuJVbVOrstxpIIDeRR3u+1vJbxJFNDxgwME riGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=TuHWz9I23IoRFsUSGlWpC3+5Q9TKm8ZIeG+OwwnmsyM=; b=PB4DiCkU+mzWHyhSIPP4jaByhhzqv5kfW959i2zwSUtLWKjaZfZ2UjzEm+4fq5eDqK mu6jLVdSF0SDpVl9/LvdkVgxjy56yt45Wo7K3JDiKk4YPnDe+jJyta4rWqqs/JfoPRF8 7nnSOwlaBDVLi2nH3ieuokNZpOn4neIStzjGav/kqB5uA5b+dV8rpm6uitW8fyXaUW1M 1xdKXpZXq3HWrlBiBmXQRp7i21B9+RaXe7pJmFasEkCJRmmvE9muJrAurA5XFLVFbW89 qzAyGxSRlfk/6kVGi53hDhe+XPKwRG7YQYm5uzDFhorwGUS6ONp8KBA/6R7WPCcZRRPB 1B1A== X-Gm-Message-State: AKwxytfIanaYRCbFsDv4crVidEtofW11S14vf0sZDHrgJ33tEiV+CEdT IAD1bJ2grxWVpV0AZnzZ7e50O3uKCTmpR/MLG0M= X-Received: by 10.157.67.122 with SMTP id y55mr22131054oti.229.1517848463848; Mon, 05 Feb 2018 08:34:23 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.68.33 with HTTP; Mon, 5 Feb 2018 08:34:23 -0800 (PST) In-Reply-To: <20180202232923.GK12728@builder> References: <20180202232923.GK12728@builder> From: Arnd Bergmann Date: Mon, 5 Feb 2018 17:34:23 +0100 X-Google-Sender-Auth: afqDkJLhDX4DUXlcwdv3HgutbOc Message-ID: Subject: Re: Compilation error report for: drivers/firmware/qcom_scm.c:469:47: error: passing argument 3 of ?dma_alloc_coherent? from incompatible pointer type To: Bjorn Andersson Cc: Benjamin GAIGNARD , Arnaud POULIQUEN , "Andy Gross , David Brown" , "linux-arm-msm@vger.kernel.org" , "linux-soc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Benjamin Gaignard Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Feb 3, 2018 at 12:29 AM, Bjorn Andersson wrote: > On Tue 30 Jan 05:25 PST 2018, Arnd Bergmann wrote: > >> On Tue, Jan 30, 2018 at 11:11 AM, Benjamin GAIGNARD >> wrote: >> > >> > On 01/12/2018 05:11 PM, Arnaud Pouliquen wrote: >> >> Hello Andy,David, >> > + Arnd >> > >> > I have the same issue on drm-misc-next. >> > Does Arnaud's fix make sense or should we update/change the way of how >> > we compile the kernel ? >> >> We've hit a couple of bugs with qcom drivers confusing physical addresses >> and DMA addresses in the past, usually the drivers were buggy in >> some form, and tried to use dma_alloc_coherent() to get a buffer >> that gets passed into a firmware interface taking a physical address, >> which is of course completely wrong. >> > > Thanks Arnd, for once again using the words "bug" and "completely wrong" > when referring to something that obviously works just fine... Sorry, you are right my choice of words was uncalled for. I was getting carried away after seeing Arnaud's suggestion for changing the variable type but not the name, and got carried away. > The solution you introduced for venus and adreno relies on static > reservations of system ram, which isn't pretty, but more importantly > isn't viable for the qcom_scm driver. > > > So, how do I dynamically allocate a chunk of coherent memory? > > Preferably with the possibility of unmapping it temporarily from Linux > while passing the buffer into the trusted environment (as any accesses > during the operation might cause access violations). Well, there is a fundamental problem here that 'coherent memory' as such does not exist. The DMA mapping interface is meant to guarantee coherency between a pair of bus masters, i.e. a CPU and a device, in a way that is a specific to that pair, without the driver having to worry about the details. What the qcom_scm driver does here is to approximate the behavior it needs by calling the dma mapping interfaces. It happens to work some of the time, but it's really something else as we are talking to firmware here and it doesn't have the same semantics that the dma mapping code provides. I think what we want here is to come up with a new allocator that matches the requirements of SCM and that doesn't use dma_addr_t. For allocating memory that can be unmapped, I think the low-level CMA allocation can work, which would also make it independent of the device we are allocating for. Can you say what exactly the requirements are on the memory buffer? I assume you don't really want uncached memory, but instead want a buffer that gets flushed to physical memory before you pass it down so you don't get a writeback to memory that is inaccessible by the OS, correct? Arnd