From patchwork Wed Sep 18 12:32:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 20431 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f198.google.com (mail-qc0-f198.google.com [209.85.216.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D4244246E9 for ; Wed, 18 Sep 2013 12:32:22 +0000 (UTC) Received: by mail-qc0-f198.google.com with SMTP id l13sf7137953qcy.1 for ; Wed, 18 Sep 2013 05:32:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mime-version:date:message-id :subject:from:to:cc:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=7GhRpjfvJDAUUq6juiYJL4OQ3futeib9xnOCSeyzaJo=; b=JbiQc4zOvIDSu3E3tAIYD2+WTTYNwizUWCeiL2b/llwqTeP2EHaC4KE9mPz+SOyaB7 CRZA0X0dQ/fh4TG0RUnoAg1bT4J2HlumLlDgeVT3F0T7Kwn7yOg+8UL7bsV4GlHFCT65 q+/YpXG+6uIZMt0TTLeu1KOIsztyqoFsh6PsAs70YAFeiCriJ3cZEPRvNu96/Xqp11nJ nm6eAiocaEVFwjujqovVtzeMDlMUaU+gvSL9xTN47wkDp8rzhzEjbp7kTq9IARjyp7g8 tVAPEoMdJNQbekmh9nXrrtWGleWNR5VpA+SZ1xeryY9F7oz5FoykIGqZdnQqKVA8VpNv oXdg== X-Gm-Message-State: ALoCoQkWmdMIG0sBI3IZ7OCq5sGlJUkvwU6ahkdU3fyh3f3+3qIHrtRPlaOdSt+b10OL1qjeG6jq X-Received: by 10.52.31.69 with SMTP id y5mr80902vdh.4.1379507541976; Wed, 18 Sep 2013 05:32:21 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.96.9 with SMTP id do9ls3370390qeb.80.gmail; Wed, 18 Sep 2013 05:32:21 -0700 (PDT) X-Received: by 10.52.166.200 with SMTP id zi8mr86488vdb.38.1379507541890; Wed, 18 Sep 2013 05:32:21 -0700 (PDT) Received: from mail-vb0-f52.google.com (mail-vb0-f52.google.com [209.85.212.52]) by mx.google.com with ESMTPS id tm8si450786vdc.85.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 18 Sep 2013 05:32:21 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.52 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.52; Received: by mail-vb0-f52.google.com with SMTP id f12so5248681vbg.11 for ; Wed, 18 Sep 2013 05:32:21 -0700 (PDT) X-Received: by 10.52.34.109 with SMTP id y13mr32405060vdi.8.1379507541785; Wed, 18 Sep 2013 05:32:21 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp215288vcz; Wed, 18 Sep 2013 05:32:21 -0700 (PDT) X-Received: by 10.152.4.6 with SMTP id g6mr96548lag.50.1379507540541; Wed, 18 Sep 2013 05:32:20 -0700 (PDT) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com [209.85.215.53]) by mx.google.com with ESMTPS id e8si915730lah.109.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 18 Sep 2013 05:32:20 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.215.53 is neither permitted nor denied by best guess record for domain of benjamin.gaignard@linaro.org) client-ip=209.85.215.53; Received: by mail-la0-f53.google.com with SMTP id el20so5441867lab.26 for ; Wed, 18 Sep 2013 05:32:19 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.152.19.97 with SMTP id d1mr1703802lae.34.1379507539304; Wed, 18 Sep 2013 05:32:19 -0700 (PDT) Received: by 10.114.27.199 with HTTP; Wed, 18 Sep 2013 05:32:19 -0700 (PDT) Date: Wed, 18 Sep 2013 14:32:19 +0200 Message-ID: Subject: [PATCH] gpu: ion: fix missing unmap_kernel function in CMA heap From: Benjamin Gaignard To: linaro-mm-sig@lists.linaro.org, Rebecca Zavin Cc: Patch Tracking X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: benjamin.gaignard@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.52 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , After calling dma_alloc_coherent memory is mapped in kernel space. CMA heap doesn't map/unmap so only create a function to avoid segfault when ion call it without check it. Add a check at heap creation to be sure that unmap_kernel ops is implemented. Signed-off-by: Benjamin Gaignard --- drivers/gpu/ion/ion.c | 2 +- drivers/gpu/ion/ion_cma_heap.c | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) .free = ion_cma_free, @@ -178,6 +184,7 @@ static struct ion_heap_ops ion_cma_ops = { .phys = ion_cma_phys, .map_user = ion_cma_mmap, .map_kernel = ion_cma_map_kernel, + .unmap_kernel = ion_cma_unmap_kernel, }; struct ion_heap *ion_cma_heap_create(struct ion_platform_heap *data) diff --git a/drivers/gpu/ion/ion.c b/drivers/gpu/ion/ion.c index 71b650e..5dd0ea2 100644 --- a/drivers/gpu/ion/ion.c +++ b/drivers/gpu/ion/ion.c @@ -1390,7 +1390,7 @@ DEFINE_SIMPLE_ATTRIBUTE(debug_shrink_fops, debug_shrink_get, void ion_device_add_heap(struct ion_device *dev, struct ion_heap *heap) { if (!heap->ops->allocate || !heap->ops->free || !heap->ops->map_dma || - !heap->ops->unmap_dma) + !heap->ops->unmap_dma || !heap->ops->unmap_kernel) pr_err("%s: can not add heap with invalid ops struct.\n", __func__); diff --git a/drivers/gpu/ion/ion_cma_heap.c b/drivers/gpu/ion/ion_cma_heap.c index 1eaa8c1..b98dcc4a 100644 --- a/drivers/gpu/ion/ion_cma_heap.c +++ b/drivers/gpu/ion/ion_cma_heap.c @@ -170,6 +170,12 @@ void *ion_cma_map_kernel(struct ion_heap *heap, struct ion_buffer *buffer) return info->cpu_addr; } +void ion_cma_unmap_kernel(struct ion_heap *heap, struct ion_buffer *buffer) +{ + /* do nothing because we keep the mapping*/ + return; +} + static struct ion_heap_ops ion_cma_ops = { .allocate = ion_cma_allocate,