From patchwork Fri Feb 26 04:09:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 12105797 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=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 76366C433E6 for ; Fri, 26 Feb 2021 04:09:14 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 34F5664EDC for ; Fri, 26 Feb 2021 04:09:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 34F5664EDC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8F39B6E8D8; Fri, 26 Feb 2021 04:09:12 +0000 (UTC) Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by gabe.freedesktop.org (Postfix) with ESMTPS id 16B286E8D8 for ; Fri, 26 Feb 2021 04:09:12 +0000 (UTC) Received: by mail-pl1-x633.google.com with SMTP id k22so4608994pll.6 for ; Thu, 25 Feb 2021 20:09:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=sS7O64Dax1Oof6uU+LILebhJ2b6dwBPbMV6PckIKTic=; b=SBfjWgcX7J4qKX7Tx/bBySKwNSomYsKyezXTnuznVIVzwnGIJhBnf+Q6aKLZklE010 piLfpJ38GSZPZ04u3WRoGx6Dx/iXambXNJlWc10p5BJu0BkQisRIGletv6H5lAFWrucj gzU9iSRDzzcenUY9x2wowgr0zRYUXiLTv44+BLxGLx0Xor+xXaqi2N6H2iv+SGv2Z4ZC rmt4QWoPPXQy9J2PVfp7jFSeS9EwqLsqmOcBzHKTz4T1Tuo5q9paDQmHdhaz7ePPAh3y UlzVxEERei8fpd1u1UXtchb1bQ9knVi+9o4h85Hfpt2HGT3rdWg5NU5k/+WS71bPE4o+ XYpQ== 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:mime-version :content-transfer-encoding; bh=sS7O64Dax1Oof6uU+LILebhJ2b6dwBPbMV6PckIKTic=; b=QaBxWeE84Q/fzKqLQJ265Mmc8DNygqR1TEElb4KmLkRXRkZURV6hgCaYh4Sn6XAX8C 8ofc8Kjs6lw9l7/6cqWiqBdtJ1z0z09FrG6gF2hhzEMG7TBLjmPVFMiirYmly/Y6tnO4 0KeVCSJvLjb4yByiOeAxXCSLCaUa9qBuBZB6qwktWRyLf906U+zsI3yYnEf83g6SJuMn cf9PkuKcOHMy8lyIDPs/LSqpIhwGlNB2kCoDNaEscTKO7URIjmZerEXcc6fNZo3+EhnN N1l1rO6X5vJU9oRF+rPb7uE8C4BfmLi5mzB6Soz+da/telwmFjrIauQLaWdggjFcGjEA lOwg== X-Gm-Message-State: AOAM533FlYQd1WY/X5wRTVmx/LFCtCyGYfGJJxkfOkbNALZOtaKoIREm JyQfz05CT1RfjeEAYiSAqNZpnA== X-Google-Smtp-Source: ABdhPJzoeipTVrF8IbTxJwEupx0T2MyCKRlMEoY2FfiRRoVqjyRaqdsS61hiZWm94ZbjbWhgc9g5IQ== X-Received: by 2002:a17:902:a985:b029:e3:8796:a128 with SMTP id bh5-20020a170902a985b02900e38796a128mr1326366plb.81.1614312551589; Thu, 25 Feb 2021 20:09:11 -0800 (PST) Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id z2sm7792202pfc.8.2021.02.25.20.09.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Feb 2021 20:09:10 -0800 (PST) From: John Stultz To: lkml Subject: [PATCH] dma-buf: heaps: Set VM_PFNMAP in mmap for system and cma heaps Date: Fri, 26 Feb 2021 04:09:08 +0000 Message-Id: <20210226040908.3274666-1-john.stultz@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org, Sandeep Patil , Chris Goldsworthy , Ezequiel Garcia , Robin Murphy , James Jones , Liam Mark , Jason Gunthorpe , Laura Abbott , Hridya Valsaraju , =?utf-8?q?=C3=98rjan_Eide?= , linux-media@vger.kernel.org, Suren Baghdasaryan , Christian Koenig , Daniel Mentz Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Per discussion and patches here: https://lore.kernel.org/dri-devel/20210223105951.912577-1-daniel.vetter@ffwll.ch/ Daniel is planning on making VM_PFNMAP required on dmabufs. Thus to avoid the warn_on noise, set the VM_PFNMAP in the system and cma heap's mmap handler. Cc: Daniel Vetter Cc: Jason Gunthorpe Cc: Christian Koenig Cc: Sumit Semwal Cc: Liam Mark Cc: Chris Goldsworthy Cc: Laura Abbott Cc: Brian Starkey Cc: Hridya Valsaraju Cc: Suren Baghdasaryan Cc: Sandeep Patil Cc: Daniel Mentz Cc: Ørjan Eide Cc: Robin Murphy Cc: Ezequiel Garcia Cc: Simon Ser Cc: James Jones Cc: linux-media@vger.kernel.org Cc: dri-devel@lists.freedesktop.org Signed-off-by: John Stultz --- drivers/dma-buf/heaps/cma_heap.c | 1 + drivers/dma-buf/heaps/system_heap.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/dma-buf/heaps/cma_heap.c b/drivers/dma-buf/heaps/cma_heap.c index 364fc2f3e499..34bc3987f942 100644 --- a/drivers/dma-buf/heaps/cma_heap.c +++ b/drivers/dma-buf/heaps/cma_heap.c @@ -185,6 +185,7 @@ static int cma_heap_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma) vma->vm_ops = &dma_heap_vm_ops; vma->vm_private_data = buffer; + vma->vm_flags |= VM_PFNMAP; return 0; } diff --git a/drivers/dma-buf/heaps/system_heap.c b/drivers/dma-buf/heaps/system_heap.c index 3548b20cb98c..8995e3cbfcaf 100644 --- a/drivers/dma-buf/heaps/system_heap.c +++ b/drivers/dma-buf/heaps/system_heap.c @@ -228,8 +228,10 @@ static int system_heap_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma) return ret; addr += PAGE_SIZE; if (addr >= vma->vm_end) - return 0; + break; } + + vma->vm_flags |= VM_PFNMAP; return 0; }