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: 387664 Delivered-To: patches@linaro.org Received: by 2002:a02:290e:0:0:0:0:0 with SMTP id p14csp881588jap; Thu, 25 Feb 2021 20:09:12 -0800 (PST) X-Received: by 2002:a63:524d:: with SMTP id s13mr1132810pgl.366.1614312551912; Thu, 25 Feb 2021 20:09:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614312551; cv=none; d=google.com; s=arc-20160816; b=bnXNIiFRUBqnKvP8N1ES7FGixjlKth6yZ6PgPi1WD+mqCfmW79g1TLlNOfHCFnFvrV RmhLpn59MeJrN8JdlMw9Nx9Fv4XhWCtaQE36q16kud3qv2+4bXyKVsqRKrV/A1TwU07D UIwzDm1BmPswcpkDAGoYvvBo6msfGrgrQFLXys8Rk5M3RqsTepprUGxiqcnQhdoPruDS yATkFj5p0nDWxWO36NpLIrsfd7C2XVqVEcsJMS086h8dZ8ZCuHnwY3SqEmFdkaIi93al WjXflBVTSBiNsmNSWer1GCctsHnMw3iiHkxJF8A/NGBof2sUk5LLJ/g+Qg7Wcakkmgep tedQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=sS7O64Dax1Oof6uU+LILebhJ2b6dwBPbMV6PckIKTic=; b=zbWdi4t7euhVDXBiclzOvwIg6U4jyb8NbdYU+AAt+ppP7A8cIt8dQP3yeZcIsq7/I3 UzO3peS5gkdq23HtOJdcUGf+pUJ6J9I9SjGTHENRpgoAhSgQaM7pfWTBh2YSf/2WMOZa KX9uJ42g3XPo+lMYufEQCiss/5rXFxXrnELmcg6RJc/i0iZ/TSOasQwZTaPtIxUrkwmu RB/hHbhAaizLLCgG+i6p2Op8nZUKqBY+WWaG99PLteKgrmZEW4eHs0ic1bA4l+Ct1LcY k4xK0v5W/5X1Vxmze7qKP2TOS12cr3nPtWB+OKoIBnC7HiwRVNVODNxpaezh4yIlcbzc Cbzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SBfjWgcX; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id b3sor4458035plz.48.2021.02.25.20.09.11 for (Google Transport Security); Thu, 25 Feb 2021 20:09:11 -0800 (PST) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SBfjWgcX; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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=mGemoKsEtS14Dv+2XnTnZ7Cdj3HJLd/a5VaX41SKeEuAfQCbSKfhzDVbRPmlNdrGHo oKqTYUPrE5zBt3/28fpPokVqYWlKMDrsq6zzeOzaOAbI2QBPZGUzXY8Mgs+v478+sv9V QoMv9YotuFYqXtElIQ/clMiDnPqZzgNT3Pm9oTVjyNDQckOJPWqurs/XxKX6r1A5XFZh Lv1o7IVT9IYaFvwluOcf6g6StADsLb6BDHVD9m2kURS5t+NY8J1BnZjwuhumQFYGuweN 4japnAf4BzU1X0OsYb8qJHER8LXj/4gxnpnnY+aRJTlOABVSAqhZUHg5T4SuLkRzn8Qw RntA== X-Gm-Message-State: AOAM531Rn3FaIlZAUYCwKacu3HlLXvVzNfilBIGr5OuX72OKHHTr3QKy tdXxz3bzRJeKRAbj9YA5tMrnJKP+ 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) Return-Path: 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 Cc: John Stultz , Daniel Vetter , Jason Gunthorpe , Christian Koenig , Sumit Semwal , Liam Mark , Chris Goldsworthy , Laura Abbott , Brian Starkey , Hridya Valsaraju , Suren Baghdasaryan , Sandeep Patil , Daniel Mentz , =?utf-8?q?=C3=98rjan_Eide?= , Robin Murphy , Ezequiel Garcia , Simon Ser , James Jones , linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org 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 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(-) -- 2.25.1 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; }