From patchwork Thu May 16 11:26:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Hellstrom X-Patchwork-Id: 10946419 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 9DD29924 for ; Thu, 16 May 2019 11:26:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8BEE428A3D for ; Thu, 16 May 2019 11:26:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7FD0728B4A; Thu, 16 May 2019 11:26:16 +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,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1CCDE28A3D for ; Thu, 16 May 2019 11:26:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B9BA289394; Thu, 16 May 2019 11:26:13 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-eopbgr750085.outbound.protection.outlook.com [40.107.75.85]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0590889394 for ; Thu, 16 May 2019 11:26:12 +0000 (UTC) Received: from MN2PR05MB6141.namprd05.prod.outlook.com (20.178.241.217) by MN2PR05MB6048.namprd05.prod.outlook.com (20.178.244.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1900.13; Thu, 16 May 2019 11:26:04 +0000 Received: from MN2PR05MB6141.namprd05.prod.outlook.com ([fe80::60b8:98a9:5fab:36ee]) by MN2PR05MB6141.namprd05.prod.outlook.com ([fe80::60b8:98a9:5fab:36ee%4]) with mapi id 15.20.1900.010; Thu, 16 May 2019 11:26:04 +0000 From: Thomas Hellstrom To: Linux-graphics-maintainer , "dri-devel@lists.freedesktop.org" Subject: [PATCH v2] drm/ttm, drm/vmwgfx: Use a configuration option for the TTM dma page pool Thread-Topic: [PATCH v2] drm/ttm, drm/vmwgfx: Use a configuration option for the TTM dma page pool Thread-Index: AQHVC9omNhkGcGtWE0uq/hFXJAII3g== Date: Thu, 16 May 2019 11:26:04 +0000 Message-ID: <20190516112540.47685-1-thellstrom@vmware.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: DB6PR01CA0005.eurprd01.prod.exchangelabs.com (2603:10a6:6:45::18) To MN2PR05MB6141.namprd05.prod.outlook.com (2603:10b6:208:c7::25) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-originating-ip: [155.4.205.35] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 50407659-c8fc-4dbd-960b-08d6d9f1485a x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(2017052603328)(7193020); SRVR:MN2PR05MB6048; x-ms-traffictypediagnostic: MN2PR05MB6048: x-ld-processed: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0,ExtAddr x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5516; x-forefront-prvs: 0039C6E5C5 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(376002)(396003)(346002)(366004)(39860400002)(189003)(199004)(4326008)(66476007)(14454004)(316002)(54906003)(2906002)(478600001)(53936002)(110136005)(6116002)(3846002)(2501003)(1076003)(86362001)(81156014)(71200400001)(6436002)(68736007)(6512007)(8676002)(26005)(66946007)(73956011)(66556008)(64756008)(66446008)(36756003)(66066001)(476003)(186003)(256004)(8936002)(5660300002)(52116002)(50226002)(6486002)(7736002)(25786009)(305945005)(99286004)(486006)(81166006)(2616005)(71190400001)(102836004)(386003)(6506007); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR05MB6048; H:MN2PR05MB6141.namprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: vmware.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: BnHLaFm7g725nqE4b0RI7M0V6Y1lPmniT4KQiSNkYf5bHOKO8LE4lUiNfgG5vagTdT2Z4Metds01ljhD7Rgj+Oxi1zRuNnWkz/GZThTGlUifvd/6jRivv3Xx4Q5tftKBEKcU5/9VuG5gtREOlttF7W0FgYkVtMIN8Gc3ajzUDbIBg8wUL5Kl95jpkRg8w5HzbziEvX6SHuj7951ZxDoJUatVkfYa2NO70tzfw8V8lCBgD88M+DlE4DN6E5R8P/fRo3xWpGaLaCzO50buiIlt4/8fLCPqyTUUYnQ+ZQTCtKy4wXEbiO/e8g7C8AATsuY1y7nT5Pcse6Z5OrufTX8R1IGPbuULT2QU8rWsKvcG6O4cAPmKy/6avI7deH6fRnIJlgJwIHptWITlHqeL7HL8IuUsLXW8WwYvfBBS+hAfpCI= Content-ID: <29367DA1FDAB6749BC60D70813C10250@namprd05.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-Network-Message-Id: 50407659-c8fc-4dbd-960b-08d6d9f1485a X-MS-Exchange-CrossTenant-originalarrivaltime: 16 May 2019 11:26:04.8633 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR05MB6048 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vmware.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nuY4n1WB1K44TNlVxeo0GaP55z/gsoFbdCH1Tc9qgLc=; b=mbKnHDUTZJI1N9b4MxUN9x8GO1Wh9s/KYOhFWGlm0tf4k9dKqETlLaQYNsvLe2DnOWLZshmvqRE88OCQg91qw3VEF3UIfXA/B/dFt/RGdb9ZxlHLHhyRLDJDE1tdurcMUQctoh3zbryMnjJvWPAlQ74kRZ3JXa75YzkTPyTR1HQ= X-Mailman-Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=thellstrom@vmware.com; X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Hellstrom , =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Drivers like vmwgfx may want to test whether the dma page pool is present or not. Since it's activated by default by TTM if compiled-in, define a hidden configuration option that the driver can test for. Cc: Christian König Signed-off-by: Thomas Hellstrom Reviewed-by: Christian König --- drivers/gpu/drm/Kconfig | 7 +++++++ drivers/gpu/drm/ttm/Makefile | 4 ++-- drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 3 --- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 3 +-- include/drm/ttm/ttm_page_alloc.h | 2 +- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index 2267e84d5cb4..be66027f7dbe 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -160,6 +160,13 @@ config DRM_TTM GPU memory types. Will be enabled automatically if a device driver uses it. +config DRM_TTM_DMA_PAGE_POOL + bool + depends on DRM_TTM && (SWIOTLB || INTEL_IOMMU) + default y + help + Choose this if you need the TTM dma page pool + config DRM_GEM_CMA_HELPER bool depends on DRM diff --git a/drivers/gpu/drm/ttm/Makefile b/drivers/gpu/drm/ttm/Makefile index 01fc670ce7a2..caea2a099496 100644 --- a/drivers/gpu/drm/ttm/Makefile +++ b/drivers/gpu/drm/ttm/Makefile @@ -4,8 +4,8 @@ ttm-y := ttm_memory.o ttm_tt.o ttm_bo.o \ ttm_bo_util.o ttm_bo_vm.o ttm_module.o \ - ttm_execbuf_util.o ttm_page_alloc.o ttm_bo_manager.o \ - ttm_page_alloc_dma.o + ttm_execbuf_util.o ttm_page_alloc.o ttm_bo_manager.o ttm-$(CONFIG_AGP) += ttm_agp_backend.o +ttm-$(CONFIG_DRM_TTM_DMA_PAGE_POOL) += ttm_page_alloc_dma.o obj-$(CONFIG_DRM_TTM) += ttm.o diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c index d594f7520b7b..98d100fd1599 100644 --- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c @@ -33,7 +33,6 @@ * when freed). */ -#if defined(CONFIG_SWIOTLB) || defined(CONFIG_INTEL_IOMMU) #define pr_fmt(fmt) "[TTM] " fmt #include @@ -1234,5 +1233,3 @@ int ttm_dma_page_alloc_debugfs(struct seq_file *m, void *data) return 0; } EXPORT_SYMBOL_GPL(ttm_dma_page_alloc_debugfs); - -#endif diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c index d59c474be38e..850efa196d72 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c @@ -572,8 +572,7 @@ static int vmw_dma_select_mode(struct vmw_private *dev_priv) else dev_priv->map_mode = vmw_dma_map_populate; - /* No TTM coherent page pool? FIXME: Ask TTM instead! */ - if (!(IS_ENABLED(CONFIG_SWIOTLB) || IS_ENABLED(CONFIG_INTEL_IOMMU)) && + if (!IS_ENABLED(CONFIG_DRM_TTM_DMA_PAGE_POOL) && (dev_priv->map_mode == vmw_dma_alloc_coherent)) return -EINVAL; diff --git a/include/drm/ttm/ttm_page_alloc.h b/include/drm/ttm/ttm_page_alloc.h index 4d9b019d253c..a6b6ef5f9bf4 100644 --- a/include/drm/ttm/ttm_page_alloc.h +++ b/include/drm/ttm/ttm_page_alloc.h @@ -74,7 +74,7 @@ void ttm_unmap_and_unpopulate_pages(struct device *dev, struct ttm_dma_tt *tt); */ int ttm_page_alloc_debugfs(struct seq_file *m, void *data); -#if defined(CONFIG_SWIOTLB) || defined(CONFIG_INTEL_IOMMU) +#if defined(CONFIG_DRM_TTM_DMA_PAGE_POOL) /** * Initialize pool allocator. */