From patchwork Fri Mar 1 19:38:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jordan Crouse X-Patchwork-Id: 10836017 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5D0141880 for ; Fri, 1 Mar 2019 19:38:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 42B16295B4 for ; Fri, 1 Mar 2019 19:38:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 34DE72DEC8; Fri, 1 Mar 2019 19:38:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 40BC7295B4 for ; Fri, 1 Mar 2019 19:38:57 +0000 (UTC) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=wx8a8bmT2DDvK3v4H5dzKSfvBn6P5LuHUtEkHaZ43IM=; b=E1n FCnkdzB/orDSuxfdP7ENfaYWjiZTiaXvaJVObhOq+x469xD68a3Gansc2RUXeJOtWtXphlyeWk/BW QfCCFF/s1WL0rAW/8istqXAi35snbPA8KoCAk8Gt5ARcX56ffBgzep9nMRx+zU6Dr3yzil7neyoYg b2PSKizEqgbRVdX+4iI8Ccpe9hv9rYnACDZvV1iHScgUvBb4pG0fh1LdWpyzMFL10FJlR4Fr1d+11 w2KrrEpdnyAHtJ7cHf+23vnhCEJALOO4UNMsLaTCa2nS4f6wRkEh9kO/stIMuR1KUk6tM7DYA9uCZ tCW3+CZZ3FU/dWfw+56rbSyEquwV/UA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gznze-0007oK-II; Fri, 01 Mar 2019 19:38:50 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gznzb-0007nh-B2 for linux-arm-kernel@lists.infradead.org; Fri, 01 Mar 2019 19:38:49 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 5995561194; Fri, 1 Mar 2019 19:38:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1551469126; bh=dfu1ST0yNnlyytyDMliEd2S/XprVBfQyYwcDG+8sbsQ=; h=From:To:Cc:Subject:Date:From; b=DRxxhIlQmHYw1PrRGsesyGo0FfGN0H8NuJTxLxt6fY76MT20UgSi1wh3VrKZzkHju BhehPDhTS3O6RowYK4Y6JXVOnAl/wDYf8ErtHC187DJI7lk+/ka3rLIm1ykKH7XyDF 4MuPWiHydqX+mjd1P8wsmV9YxutV/23gu7fAMLLk= Received: from jcrouse1-lnx.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: jcrouse@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id E0B3A6087A; Fri, 1 Mar 2019 19:38:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1551469123; bh=dfu1ST0yNnlyytyDMliEd2S/XprVBfQyYwcDG+8sbsQ=; h=From:To:Cc:Subject:Date:From; b=lLCMZIkKH2egp9k6czrZEoNal6WS+RcKX9ypDasgt5a0YQsZ27PRcaFlJnDv5f4uq gSEoubFHotoDri13WOsn8dSpn5f+BAwtY6BXjimJN2rQQX1Rpuic/4mKgW9e8NS4xs mllxatmB3cYg98gLHDun0Cn8lDG2E0di0DydRZ2U= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org E0B3A6087A Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=jcrouse@codeaurora.org From: Jordan Crouse To: freedreno@lists.freedesktop.org Subject: [RFC PATCH v1 00/15] drm/msm: Per-instance pagetable support Date: Fri, 1 Mar 2019 12:38:22 -0700 Message-Id: <1551469117-3404-1-git-send-email-jcrouse@codeaurora.org> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190301_113847_426641_C1189FAB X-CRM114-Status: GOOD ( 19.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , Will Deacon , dri-devel@lists.freedesktop.org, Bjorn Andersson , Jonathan Marek , jean-philippe.brucker@arm.com, Joerg Roedel , iommu@lists.linux-foundation.org, Mamta Shukla , Kees Cook , linux-arm-msm@vger.kernel.org, Sharat Masetty , dianders@chromimum.org, Daniel Vetter , Sean Paul , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Rob Clark , hoegsberg@google.com, Thomas Zimmermann , Robin Murphy , baolu.lu@linux.intel.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This is the latest incarnation of per-instance pagetable support for the MSM GPU driver. Some of these have been seen before, most recently [1]. Per-instance pagetables allow the target GPU driver to create and manage an individual pagetable for each file descriptor instance and switch between them asynchronously using the GPU to reprogram the pagetable registers on the fly. This is accomplished in this series by taking advantage of the multiple IOMMU domain API from Lu Baolu [2] and all these patches are based on that patch. This series is split into three parts: Part one adds support for split pagetables. These are the same patches from the previous attempts [1]. Split pagetables allow the hardware to switch out the lower pagetable (TTBR0) without affecting the global allocations in the upper one (TTBR1). Part 2 adds aux domain support for arm-smmu-v2. New aux domains create a new pagetable but do not touch the underlying hardware. The target driver uses the new aux domain to map and unmap memory through the usual mechanisms. The final part is the support in the GPU driver to enable 64 bit addressing for a5xx and a6xx, set up the support for split pagetables, create new per-instance pagetables for a new instance and submit the GPU command to switch the pagetable at the appropriate time. This is compile tested but I haven't done much target testing as of yet. I wanted to get this out in the world for debate while we work on fixing up the minor issues. In particular, I want to make sure that this fits with the current thinking about how aux domains should look and feel. [1] https://patchwork.freedesktop.org/series/43447/ [2] https://patchwork.kernel.org/patch/10825061/ Jordan Crouse (15): iommu: Add DOMAIN_ATTR_SPLIT_TABLES iommu/arm-smmu: Add split pagetable support for arm-smmu-v2 iommu/io-pgtable: Allow TLB operations to be optional iommu: Add DOMAIN_ATTR_PTBASE iommu/arm-smmu: Add auxiliary domain support for arm-smmuv2 drm/msm/adreno: Enable 64 bit mode by default on a5xx and a6xx targets drm/msm: Print all 64 bits of the faulting IOMMU address drm/msm: Pass the MMU domain index in struct msm_file_private drm/msm/gpu: Move address space setup to the GPU targets drm/msm: Add support for IOMMU auxiliary domains drm/msm: Add a helper function for a per-instance address space drm/msm: Add support to create target specific address spaces drm/msm/gpu: Add ttbr0 to the memptrs drm/msm/a6xx: Support per-instance pagetables drm/msm/a5xx: Support per-instance pagetables drivers/gpu/drm/msm/adreno/a2xx_gpu.c | 37 ++-- drivers/gpu/drm/msm/adreno/a3xx_gpu.c | 50 ++++-- drivers/gpu/drm/msm/adreno/a4xx_gpu.c | 51 ++++-- drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 163 +++++++++++++++++- drivers/gpu/drm/msm/adreno/a5xx_gpu.h | 19 ++ drivers/gpu/drm/msm/adreno/a5xx_preempt.c | 70 ++++++-- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 167 +++++++++++++++++- drivers/gpu/drm/msm/adreno/a6xx_gpu.h | 1 + drivers/gpu/drm/msm/adreno/adreno_gpu.c | 7 - drivers/gpu/drm/msm/msm_drv.c | 25 ++- drivers/gpu/drm/msm/msm_drv.h | 5 + drivers/gpu/drm/msm/msm_gem.h | 2 + drivers/gpu/drm/msm/msm_gem_submit.c | 13 +- drivers/gpu/drm/msm/msm_gem_vma.c | 53 +++--- drivers/gpu/drm/msm/msm_gpu.c | 59 +------ drivers/gpu/drm/msm/msm_gpu.h | 3 + drivers/gpu/drm/msm/msm_iommu.c | 99 ++++++++++- drivers/gpu/drm/msm/msm_mmu.h | 4 + drivers/gpu/drm/msm/msm_ringbuffer.h | 1 + drivers/iommu/arm-smmu-regs.h | 18 ++ drivers/iommu/arm-smmu.c | 278 ++++++++++++++++++++++++++---- drivers/iommu/io-pgtable-arm.c | 3 +- drivers/iommu/io-pgtable.h | 10 +- include/linux/iommu.h | 2 + 24 files changed, 952 insertions(+), 188 deletions(-)