From patchwork Mon Oct 21 21:45:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring (Arm)" X-Patchwork-Id: 11203057 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D9A2914ED for ; Mon, 21 Oct 2019 21:46:19 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 B069520659 for ; Mon, 21 Oct 2019 21:46:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="iV2oIyDd" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B069520659 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=fqPske7Yeq5cncmte1yTKN+gHy2ZJF7tKO3EzE81+y4=; b=iV2oIyDdY0WODF JzRy/+OYAHwbus5l8OjbsaxXn6Kru4mLuCOfA45l5j8MSTi/c6ILcjCxDPELVKbdB1o2+9Ouu+iXG 62abuOPIUQu4GIl7jzFVwJx9nUysYTIXHchCvaVpbUneocAb9TcLQ+0B0uQL8pFh85jc7ZF11xXTj /OXXFEmr4kiBAl0k4IhkmT5T7BczxoHd43OdVMxxNQH5/oBw3g8MUXQV09C1bQiunuZGm3huQ9f6D puIhain8WCrnm592iiKK/i4LKRaDyXFfWbEBqDaji20CUcttYtOlPlrYQuJba8oBkLsPHIxbHMsUB WKF/SCkpxvOv1h0tCRsw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iMfVF-0000SL-Ty; Mon, 21 Oct 2019 21:46:14 +0000 Received: from mail-ot1-f67.google.com ([209.85.210.67]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iMfUw-0000C7-GQ; Mon, 21 Oct 2019 21:45:56 +0000 Received: by mail-ot1-f67.google.com with SMTP id 21so12345581otj.11; Mon, 21 Oct 2019 14:45:53 -0700 (PDT) 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=nqe5QILtIpNsEaGhkK4nGkXs8zLkefJgCA+oa+2s7ok=; b=db9KTeYkpaYOOjZMgE35pgtZ2xKfjPyYyi819zk+e31lUGvdoPYUABDmCcMg9ZCdQv oMw3u1ARKoFYi/t13JCiUu++uBUMQ1RZcYoSfcX4HuvWJm3wNk/bUK3n083UNoGzYUY5 +DcsHUqnQYaMKcZtqIrX6+G40IvrJ5p54a+olZL9ZwOENy5U10VU4pzP+RSYrjnTQFSv 4aMdXl2snQ2zcPM3ZoSA/MZEofZOluh19/j//hAfQbrrtuaFZvBazgrAatl9X4y2XwLU mAA9C3tIK56HmV6ZlBDcvnpWTXxXrvB7/zXdmWLRfRg38Q+p6Mja1ybJs4jcoFtQHjG7 XH+Q== X-Gm-Message-State: APjAAAWin4AyFyvNmQGDPktfeokkjWclpuZ9GcGJ2lZ7jHZsH1PAnTvW liJr8DM5vqnQU0iCjZYt3w== X-Google-Smtp-Source: APXvYqxCs8yabMuTaUbUxDWWtS2Wplp/U09Sf75zVuQx5s+Q4uVctXMoxLgtzYEKbav8DT5Bobt0qg== X-Received: by 2002:a9d:3df7:: with SMTP id l110mr40031otc.245.1571694353132; Mon, 21 Oct 2019 14:45:53 -0700 (PDT) Received: from xps15.herring.priv (24-155-109-49.dyn.grandenetworks.net. [24.155.109.49]) by smtp.googlemail.com with ESMTPSA id u130sm4122676oib.56.2019.10.21.14.45.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2019 14:45:52 -0700 (PDT) From: Rob Herring To: dri-devel@lists.freedesktop.org Subject: [PATCH 0/6] drm: Support CMA per allocation kernel mappings Date: Mon, 21 Oct 2019 16:45:44 -0500 Message-Id: <20191021214550.1461-1-robh@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191021_144554_544317_B8C090D6 X-CRM114-Status: GOOD ( 14.65 ) X-Spam-Score: 0.7 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (robherring2[at]gmail.com) 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (robherring2[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.210.67 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.210.67 listed in list.dnswl.org] 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders 0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Heiko_St=C3=BCbner?= , Neil Armstrong , David Airlie , Liviu Dudau , Sandy Huang , Laurent Pinchart , Benjamin Gaignard , Yannick Fertre , Kevin Hilman , Xinwei Kong , Xinliang Liu , linux-rockchip@lists.infradead.org, Chen-Yu Tsai , =?utf-8?q?Noralf_Tr=C3=B8nnes?= , "James \(Qian\) Wang" , CK Hu , Philipp Zabel , Alexandre Torgue , Chen Feng , Maarten Lankhorst , Maxime Ripard , linux-mediatek@lists.infradead.org, Matthias Brugger , Daniel Vetter , Sean Paul , linux-arm-kernel@lists.infradead.org, Philippe Cornu , Vincent Abriou , Kieran Bingham , Maxime Coquelin , Rongrong Zou Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org This series adds support for CMA/DMA users to skip kernel mappings for GEM allocations. The DMA API only guarantees a kernel mapping at allocation time. Creating mappings with vmap() after allocation may or may not work as not all allocations have a struct page. As virtual memory space is limited on 32-bit systems some drivers will skip kernel mappings when possible. This prevents those drivers from using CMA helpers and the generic fbdev emulation which results in a lot of duplicated code. In order to distinguish between kernel and userspace allocations, a new flag, DRM_MODE_DUMB_KERNEL_MAP, for drm_mode_create_dumb() is introduced. This allows drivers to override the default behavior for CMA helpers of always creating a kernel mapping. Mediatek is converted to CMA helpers and Rockchip is converted to generic fbdev support. I also have patches to convert Rockchip to CMA and shmem helpers, but they need a bit more work. Exynos can also probably be converted to use CMA helpers. Compile tested only. I did test fbdev on Rockchip, but the h/w I have has an IOMMU, so the CMA code path doesn't get tested. Rob Rob Herring (6): drm/kirin: Use DRM_GEM_CMA_VMAP_DRIVER_OPS drm: Introduce DRM_MODE_DUMB_KERNEL_MAP flag drm/cma-helper: Use the dma_*_attr API variant drm/cma-helper: Support DRM_MODE_DUMB_KERNEL_MAP flag drm/mediatek: Convert to use CMA helpers drm/rockchip: Convert to use generic fbdev emulation .../gpu/drm/arm/display/komeda/komeda_kms.c | 1 + drivers/gpu/drm/arm/malidp_drv.c | 1 + drivers/gpu/drm/drm_client.c | 1 + drivers/gpu/drm/drm_dumb_buffers.c | 5 +- drivers/gpu/drm/drm_gem_cma_helper.c | 68 +++-- .../gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 11 +- drivers/gpu/drm/mediatek/Makefile | 1 - drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 2 +- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 28 +- drivers/gpu/drm/mediatek/mtk_drm_fb.c | 1 - drivers/gpu/drm/mediatek/mtk_drm_gem.c | 289 ------------------ drivers/gpu/drm/mediatek/mtk_drm_gem.h | 51 ---- drivers/gpu/drm/mediatek/mtk_drm_plane.c | 7 +- drivers/gpu/drm/meson/meson_drv.c | 1 + drivers/gpu/drm/rcar-du/rcar_du_kms.c | 1 + drivers/gpu/drm/rockchip/Makefile | 1 - drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 10 +- drivers/gpu/drm/rockchip/rockchip_drm_drv.h | 2 - drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 14 - drivers/gpu/drm/rockchip/rockchip_drm_fb.h | 6 - drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c | 170 ----------- drivers/gpu/drm/rockchip/rockchip_drm_fbdev.h | 24 -- drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 6 +- drivers/gpu/drm/rockchip/rockchip_drm_gem.h | 4 - drivers/gpu/drm/stm/drv.c | 1 + drivers/gpu/drm/sun4i/sun4i_drv.c | 1 + include/drm/drm_gem_cma_helper.h | 1 + include/uapi/drm/drm_mode.h | 2 + 28 files changed, 78 insertions(+), 632 deletions(-) delete mode 100644 drivers/gpu/drm/mediatek/mtk_drm_gem.c delete mode 100644 drivers/gpu/drm/mediatek/mtk_drm_gem.h delete mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c delete mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_fbdev.h --- 2.20.1