Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp642640pxb; Wed, 25 Aug 2021 11:28:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJykerEhtMu1Srsu1pxiFKev+BTpGlXxptLT7qrUKK3QvZT0QC1m1NYjIuNxuNxcq3WLoMNY X-Received: by 2002:a17:906:a404:: with SMTP id l4mr5305386ejz.277.1629916091840; Wed, 25 Aug 2021 11:28:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629916091; cv=none; d=google.com; s=arc-20160816; b=QDp9MZgh6/OXpIMiAlWGuPW01admL/DQP7c9j+VsE0d5w+abMZcOKLEZxB02pxZLi5 GMhAE7YD+jH2QgPlmvIBxmFodne6xyfqk896ZDs44t47cm+l1Nn5TD3bm0UxRUdxI3mK BcuNp4+76Sdr3J6zcebM+1x/DT4peBlhl5Zpg1WMKXl70Gjz8dV+zHdFZftJ0X3lX7jl oO/wG28MedWy/YWyj4s+0bZVNBMLSc5GkF/gFg8e35xmrlOg1KetkC96wxDeHdrMKS0y 4utH9Ei1fGxkKPe/V0KpJssJQlSlx4c5DpDBUL5GYOrjWsWYVrp0yNWwDryLjaEP5lQR CvVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=r7duvE1wzzxX2jQAERUpfzLWm+7uDfriLymAZnxOOes=; b=xZxRpiMlHeZljnWq8ns48RqI2Qq9pUNEfUKwhoW/Gh5qhkpvmB6wvmjKyKF9P0yOUB Ni4JG9kUC0BZdRU24tOSyJESAkCtiJKdPPpL6MHgxIuy+4BqxW2NU/oAu3EY+YR/E2o/ m6CjjcBU1WIYcA/JVH4DJAZiZJyfijAEDsrMmICOH31twVwjw2WkWMkAwfK+HDZiAIGO v0K+UUYU8KjmhS2Sa4f0Am7mTy9/KnXUNaJtqmYzG+2bH1501ygAHvLg0gHaBclj25Rf hxRKq/Ahie7SjXeDeoaOyYHm/qi4WhsOZ3BlrV+5TCsgfiCAe6yUWaVP1K9mobiUmrY4 oukw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b8si695303edd.29.2021.08.25.11.27.32; Wed, 25 Aug 2021 11:28:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241789AbhHYOn6 (ORCPT + 99 others); Wed, 25 Aug 2021 10:43:58 -0400 Received: from foss.arm.com ([217.140.110.172]:52528 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229553AbhHYOn5 (ORCPT ); Wed, 25 Aug 2021 10:43:57 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EF2FA106F; Wed, 25 Aug 2021 07:43:11 -0700 (PDT) Received: from 010265703453.arm.com (unknown [10.57.15.112]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 8F6383F5A1; Wed, 25 Aug 2021 07:43:10 -0700 (PDT) From: Robin Murphy To: maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de Cc: airlied@linux.ie, daniel@ffwll.ch, alyssa.rosenzweig@collabora.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH] drm/cma-helper: Set VM_DONTEXPAND for mmap Date: Wed, 25 Aug 2021 15:43:05 +0100 Message-Id: <1c68be0449aa3217e2bbc898dd8c7426748fc6b8.1629902585.git.robin.murphy@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org drm_gem_cma_mmap() cannot assume every implementation of dma_mmap_wc() will end up calling remap_pfn_range() (which happens to set the relevant vma flag, among others), so in order to make sure expectations around VM_DONTEXPAND are met, let it explicitly set the flag like most other GEM mmap implementations do. This avoids repeated warnings on a small minority of systems where the display is behind an IOMMU, and has a simple driver which does not override drm_gem_cma_default_funcs. Signed-off-by: Robin Murphy --- drivers/gpu/drm/drm_gem_cma_helper.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem_cma_helper.c index d53388199f34..63e48d98263d 100644 --- a/drivers/gpu/drm/drm_gem_cma_helper.c +++ b/drivers/gpu/drm/drm_gem_cma_helper.c @@ -510,6 +510,7 @@ int drm_gem_cma_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma) */ vma->vm_pgoff -= drm_vma_node_start(&obj->vma_node); vma->vm_flags &= ~VM_PFNMAP; + vma->vm_flags |= VM_DONTEXPAND; cma_obj = to_drm_gem_cma_obj(obj); -- 2.25.1