Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3519935pxb; Wed, 13 Oct 2021 07:39:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8lPbpDnTfgvX1Sr7fXZPl6qJHdrxEa/d8/wIa/k1nHxgq1ljpIdYdeNxZbDEtVBHbBFdR X-Received: by 2002:aa7:c783:: with SMTP id n3mr10086351eds.122.1634135950615; Wed, 13 Oct 2021 07:39:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634135950; cv=none; d=google.com; s=arc-20160816; b=f1WN11plUZ6ncNJnCgdOZ1G6cWSl4zeyKU6YVLoVMoKzJ0w+ip17clA8n42uYBr5VR dW9VW7AmsIVwii8i3inSe8StWWCkRW35BV1P5gXr0b+qgBeR018EDixbQiiLUeNjKHEb h2EVFiFBxH2tIbldX9UBVOxACokWa8isR3iA7goZnwW4LCM6aJ3rWQfwUhIhwch9aMiQ NcodxIkZVDaZPWplWpFSSZ3tHGEoxPatHvabswGBOV1sunlnrZcPRVCNsWsY0kzDn3m6 BhR4StZhai+6htzswK7yETMGei4oacVhths26uUY2+KqwwdrbejDlYoYKhtV3Fc2/cfC 2qoA== 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=2qxJQiWEFZ32sI00CYRA7cNAIFmSOtmwzpCWJ3QnyrI=; b=riiCuGe020VKrBmQpkAp6176aeQdcbgg3U/MuXccFkRVsvLeRALo3dc5/rve96vB8A gChYdOCE5UjNFjq3/x8dcSzkM0rZ6G9/xKNn4gqICamGbmCa+gJ4AOX74w0lQ2WyUbwy ENfiS1Aht2viTjCtOtom+vfXEeWt0mFX8/eop8gOCpOJuT+4lm3EQxZio82XUYbynZXz n/PEVwTpY0zradJggV+37Lm/uCVOhuekFGjgVUaGOord0JsJ7Sxh4tpH+7kSWGRS8vUP gRw4XG5HPisj5kAJCtFDLTeGrGtVHGz8ZWhGd0s9RacTuUebmbv3FPIZVLVZ/FLAr9CW VG4g== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u3si20231096ejf.706.2021.10.13.07.38.45; Wed, 13 Oct 2021 07:39:10 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234768AbhJMOjI (ORCPT + 99 others); Wed, 13 Oct 2021 10:39:08 -0400 Received: from rosenzweig.io ([138.197.143.207]:46962 "EHLO rosenzweig.io" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230171AbhJMOjH (ORCPT ); Wed, 13 Oct 2021 10:39:07 -0400 From: Alyssa Rosenzweig To: dri-devel@lists.freedesktop.org Cc: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , linux-kernel@vger.kernel.org, Robin Murphy , Alyssa Rosenzweig Subject: [PATCH v2] drm/cma-helper: Set VM_DONTEXPAND for mmap Date: Wed, 13 Oct 2021 10:36:54 -0400 Message-Id: <20211013143654.39031-1-alyssa@rosenzweig.io> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Robin Murphy 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. Arm hdlcd is an in-tree affected driver. Out-of-tree, the Apple DCP driver is affected; this fix is required for DCP to be mainlined. Signed-off-by: Robin Murphy Reviewed-and-tested-by: Alyssa Rosenzweig --- 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.30.2