From patchwork Sat Mar 18 00:54:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laura Abbott X-Patchwork-Id: 9631819 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1F13D60249 for ; Sat, 18 Mar 2017 00:56:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 12C2A283FB for ; Sat, 18 Mar 2017 00:56:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 061F7284A5; Sat, 18 Mar 2017 00:56:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BC158283FB for ; Sat, 18 Mar 2017 00:56:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E2AB96EDF4; Sat, 18 Mar 2017 00:55:49 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qt0-f181.google.com (mail-qt0-f181.google.com [209.85.216.181]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4A0FB6EDF2 for ; Sat, 18 Mar 2017 00:55:47 +0000 (UTC) Received: by mail-qt0-f181.google.com with SMTP id i34so75404172qtc.0 for ; Fri, 17 Mar 2017 17:55:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=pY1nCPUwcwkL0Mfe0n+kS4tU3JSST+QnOJCMegSdohE=; b=dyQRv1pYaOpvuMXfMP4Q6JGsupfCn/3NakmmkPaMUi/69bNlwlonK7cRXSYimUVUfQ 0zzkxJl95iNB4VcBARRefp4cpAZBDBlylkUCDG0P1jCyQ9+xqlxVz8Ja+XmcYLuR6lys nKpw8YJaHUh2sWnd771gke4+GAV6j1TO1vKIxcCC5fIJquh4zIcCagEkhcnCOeUZBZOj Gv7tW+T6Y7fyci/7PIgLzm7SNnhgEg4UPIRDcxJz4zpnEGOFTTMzuKLIf2G7TGRi/RyF KN6i03nEOLOH0Q/MU5aAwnvqI/Yg0tYQB1Qcot4YqB0tCnL0bN5UMkyEO00p94VF/WvF RNXA== X-Gm-Message-State: AFeK/H0o1C3brAAof+Mz4PvhXGf1Njt4ZCzPH2pNGmfySNMUFEq/yL2YUGrl6zBVRaeDR9PH X-Received: by 10.237.43.69 with SMTP id p63mr16148999qtd.68.1489798546435; Fri, 17 Mar 2017 17:55:46 -0700 (PDT) Received: from labbott-redhat-machine.redhat.com ([2601:602:9802:a8dc:1722:8a6b:a66c:79eb]) by smtp.gmail.com with ESMTPSA id e55sm7118568qte.52.2017.03.17.17.55.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Mar 2017 17:55:45 -0700 (PDT) From: Laura Abbott To: Sumit Semwal , Riley Andrews , arve@android.com Subject: [RFC PATCHv2 14/21] staging: android: ion: Stop butchering the DMA address Date: Fri, 17 Mar 2017 17:54:46 -0700 Message-Id: <1489798493-16600-15-git-send-email-labbott@redhat.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1489798493-16600-1-git-send-email-labbott@redhat.com> References: <1489798493-16600-1-git-send-email-labbott@redhat.com> Cc: devel@driverdev.osuosl.org, romlem@google.com, Greg Kroah-Hartman , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-mm@kvack.org, Mark Brown , Laurent Pinchart , Daniel Vetter , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Now that we have proper caching, stop setting the DMA address manually. It should be set after properly calling dma_map. Signed-off-by: Laura Abbott --- drivers/staging/android/ion/ion.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index 3d979ef5..65638f5 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -81,8 +81,7 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap *heap, { struct ion_buffer *buffer; struct sg_table *table; - struct scatterlist *sg; - int i, ret; + int ret; buffer = kzalloc(sizeof(*buffer), GFP_KERNEL); if (!buffer) @@ -119,20 +118,6 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap *heap, INIT_LIST_HEAD(&buffer->vmas); INIT_LIST_HEAD(&buffer->attachments); mutex_init(&buffer->lock); - /* - * this will set up dma addresses for the sglist -- it is not - * technically correct as per the dma api -- a specific - * device isn't really taking ownership here. However, in practice on - * our systems the only dma_address space is physical addresses. - * Additionally, we can't afford the overhead of invalidating every - * allocation via dma_map_sg. The implicit contract here is that - * memory coming from the heaps is ready for dma, ie if it has a - * cached mapping that mapping has been invalidated - */ - for_each_sg(buffer->sg_table->sgl, sg, buffer->sg_table->nents, i) { - sg_dma_address(sg) = sg_phys(sg); - sg_dma_len(sg) = sg->length; - } mutex_lock(&dev->buffer_lock); ion_buffer_add(dev, buffer); mutex_unlock(&dev->buffer_lock);