Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3455367imu; Fri, 18 Jan 2019 10:39:56 -0800 (PST) X-Google-Smtp-Source: ALg8bN5zjIR17dtbnihLP4EnwxCGfOxMyv+FUW4CcR+tvcZ3jqKjNmmZ2Vw2wXWi6YxLBbFNYM1F X-Received: by 2002:a62:8985:: with SMTP id n5mr20634815pfk.255.1547836796387; Fri, 18 Jan 2019 10:39:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547836796; cv=none; d=google.com; s=arc-20160816; b=z8QO/zxw8/9bsGVbGX1OAAWs9l9dSd3KwlvSxlItT8+4kyF8w3BJzdcojYRyUp1rCx jFY7ZbaZ/oqd4Z5y4lHp2GQOiUNbXD0Z4MuXznkOPpg5IIENlSFnO1Mm1NvfkTt+oQFS E0ENph8F1wuRu48F3e533wJz23iTno+ACvKC8UbtnU0+BsWhpvq2Gh6ieymIs7HZATgF g9nziz5uLPrvA1gTSBRjc2hFYBQvAEi1HxqalE0Ojh/hnxaI5P1+vx+qn+mq1vwGrFT/ FW6ywHA6EKRm+FOQfhrLX25pm5ToYhL/unXV78IQppm9GfFmy0XBZ/u/2ldhItz0XAmU 9VXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature:dkim-signature; bh=GZhQz30C4qy66AiSW0L4W6JJ3B2br5frJ/0N6tJe3P0=; b=fD1TARf+kucJLQc8zeYdRCE9YG3ugUOJ0DrL9OXa6d2yBRgtOupFxTy8xeQUqs0hOG YJGqFQlH3ryHbgwH7bhiRbDcAAIGXDZ17T6Y3ouAJ5s4ictpZ5Lhl2OPtQqK+wsFGNsO 6T/PLfnXdN2GH/aWqpAIZiMmaJcm1JEhTPWDzS/vUh4tyPLBxs3bCv5D3OHyfK6BnI9B rfOo1DW76O6AtvQdVoj+u6SynFEE+5Rj50xrkGuxkM74TexXUqhQefVhaY0fpn3DaqlH WGHogOCHFnf6hJdbZ0LfMck/UJPrzPZ9C8Wiv9ElS2SgcIbr8Z4kH3DfcURjpoL9swWm 7IfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=oKGWMVIz; dkim=pass header.i=@codeaurora.org header.s=default header.b=jpxCEJsf; 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 t18si4677740pgu.476.2019.01.18.10.39.40; Fri, 18 Jan 2019 10:39:56 -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=pass header.i=@codeaurora.org header.s=default header.b=oKGWMVIz; dkim=pass header.i=@codeaurora.org header.s=default header.b=jpxCEJsf; 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 S1729209AbfARSiM (ORCPT + 99 others); Fri, 18 Jan 2019 13:38:12 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:36474 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729173AbfARSiH (ORCPT ); Fri, 18 Jan 2019 13:38:07 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 820D660995; Fri, 18 Jan 2019 18:38:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1547836686; bh=6JuJxs4HPDumXfxdtDnOf3zSKXhTCiVJ0MqsPuOWOBY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oKGWMVIzindoD6SVdu7DXkEYB0kEHzu7vsAVKSZSfir7W61BK3G0u0hRA1RcvAC6q 13yVbOL3g+HcmO+qmLQqqbwuVgMgj+6f7lSKt/oxaa7LtrQterrM8qVOKvzApme69h oVfAZBB1D1bAkYw6+MExvasVd2usZ3ra8ftNtBbQ= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.0 Received: from lmark-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: lmark@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id E19FF60954; Fri, 18 Jan 2019 18:38:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1547836685; bh=6JuJxs4HPDumXfxdtDnOf3zSKXhTCiVJ0MqsPuOWOBY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jpxCEJsfXXPjI19fWPaO5oIOE+l7KMKNaLud35HMONgFDsj5BPzIr8gZhVauTs4sv 2UJlkj+eJ9OKImHhQ6jyhDtxBnLgCdwvi7nqe5EGPNd2G2bYu6t34ie2jczEGHUYt2 ySWwnDm0ZBxJiSaeZBfbWo8hhofA9Tw+AFDCDg1g= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org E19FF60954 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=lmark@codeaurora.org From: Liam Mark To: labbott@redhat.com, sumit.semwal@linaro.org Cc: arve@android.com, tkjos@android.com, maco@android.com, joel@joelfernandes.org, christian@brauner.io, devel@driverdev.osuosl.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org, afd@ti.com, john.stultz@linaro.org, Liam Mark Subject: [PATCH 4/4] staging: android: ion: Support for mapping with dma mapping attributes Date: Fri, 18 Jan 2019 10:37:47 -0800 Message-Id: <1547836667-13695-5-git-send-email-lmark@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1547836667-13695-1-git-send-email-lmark@codeaurora.org> References: <1547836667-13695-1-git-send-email-lmark@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add support for configuring dma mapping attributes when mapping and unmapping memory through dma_buf_map_attachment and dma_buf_unmap_attachment. For example this will allow ION clients to skip cache maintenance, by using DMA_ATTR_SKIP_CPU_SYNC, for buffers which are clean and haven't been accessed by the CPU. Signed-off-by: Liam Mark --- drivers/staging/android/ion/ion.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index 1fe633a7fdba..0aae845b20ba 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -268,8 +268,8 @@ static struct sg_table *ion_map_dma_buf(struct dma_buf_attachment *attachment, table = a->table; mutex_lock(&buffer->lock); - if (!dma_map_sg(attachment->dev, table->sgl, table->nents, - direction)) { + if (!dma_map_sg_attrs(attachment->dev, table->sgl, table->nents, + direction, attachment->dma_map_attrs)) { mutex_unlock(&buffer->lock); return ERR_PTR(-ENOMEM); } @@ -287,7 +287,8 @@ static void ion_unmap_dma_buf(struct dma_buf_attachment *attachment, struct ion_buffer *buffer = attachment->dmabuf->priv; mutex_lock(&buffer->lock); - dma_unmap_sg(attachment->dev, table->sgl, table->nents, direction); + dma_unmap_sg_attrs(attachment->dev, table->sgl, table->nents, direction, + attachment->dma_map_attrs); a->dma_mapped = false; mutex_unlock(&buffer->lock); } -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project