From patchwork Tue Jul 18 03:57:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Felix Kuehling X-Patchwork-Id: 9846761 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E070B600CC for ; Tue, 18 Jul 2017 03:56:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC17326BE9 for ; Tue, 18 Jul 2017 03:56:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CF0B4284C7; Tue, 18 Jul 2017 03:56:51 +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=-2.6 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_WEB, T_DKIM_INVALID 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 D93FC26BE9 for ; Tue, 18 Jul 2017 03:56:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 528F86E2DC; Tue, 18 Jul 2017 03:56:48 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0040.outbound.protection.outlook.com [104.47.41.40]) by gabe.freedesktop.org (Postfix) with ESMTPS id B44C36E07E; Tue, 18 Jul 2017 03:56:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=7HNpk/AKSZGXmIkGF0LrxZlUtsyBWTb9OkiMUqHjX7o=; b=gI9xj8x4LI8TZGP4HyDICxpUU9TmSMBLCqaGiLZE77dVQPXWXVymE1yC/oL0ickfLiqpZtLuYza3Rhm63uMQceU03XPsbPYld3mf1VUOac55I4OMnJ2tQEIwJKwllEpbZFy1lVRw+MhL/7sLkZPUEidW0uQzueAVOytZp8H/ePo= Authentication-Results: lists.freedesktop.org; dkim=none (message not signed) header.d=none; lists.freedesktop.org; dmarc=none action=none header.from=amd.com; Received: from Harpoon.amd.com (165.204.55.251) by CY4PR1201MB0232.namprd12.prod.outlook.com (10.172.79.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.13; Tue, 18 Jul 2017 03:56:44 +0000 From: Felix Kuehling To: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org Subject: [PATCH 1/2] drm/ttm: Implement vm_operations_struct.access v2 Date: Mon, 17 Jul 2017 23:57:02 -0400 Message-Id: <1500350223-4913-1-git-send-email-Felix.Kuehling@amd.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [165.204.55.251] X-ClientProxiedBy: DM5PR07CA0035.namprd07.prod.outlook.com (10.168.109.21) To CY4PR1201MB0232.namprd12.prod.outlook.com (10.172.79.9) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 243487db-e3b6-4a3b-c40a-08d4cd910175 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(300000503095)(300135400095)(48565401081)(201703131423075)(201703031133081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:CY4PR1201MB0232; X-Microsoft-Exchange-Diagnostics: 1; CY4PR1201MB0232; 3:2WTmLOATnbONyi/Nf5qUGnmtIlVdvNSOGI6eby3bCqkWwxRI52NHp8RBVO/rQeCioKdjnBn4G2TchajOv0KG7GJ9kiluHATPVSY7SPLWkCJ/SsViY/lEocHFh7zfprLyxM1xqFtHs9heDo3Bji6XCp+9vVNwtIE2UJobyYstC5iyHBGZ320v5wXnOlwrEHaFtJFA5GxXmh8e+pHTnmVrQIXfISkAjUlzYrZeGaKlwvFfCDhbKRXY6i+ZiBJTyEOJ4sTyLqMa4KMPl2cmpkD5aLIH0eo9Wfxn7Mb1btVjt90lBJNOEhyBCYRbayuEx9XtfvFk75isuN5zZVxD4DeIiu7Kb5BIbvKIvXvTL/es2Zsy8Co8P4slMVcb7EM8VbZhTijY5XpgZyCb//qktdDGnP5sY1CQR7e595vyWwZRqRqySz0odRU6NBg5RN2q94oMG9BJBaBdmF3WCUUIr36cagNUUqEjl3nz00NvD6xHdf7FXBtZWpLi+li2NSI8ftWP7d5LrOOuZ3TL1suw5rboUeebaixyv+sDjHSr8bBeLopBsEwxk1YXyVlSWw9lvvCzei4YuMNTGBc5u0eE5iks7i2mblNRa3NxkbzyHC1PiYCzVKZFrtT2IYN7JTBG+D/wot1CL4Vj5K60epIOvA5UBcKRZOBh075eeF87n5BCkhmeAhlaMRyVRGihzzAy8F+131zx+7gIZt70zGV6SsqDiZQSw05bTnMjBhyTguPxMVIr4Nm7pdIi+WAsE80WgfIjWSGcFtiEqJHXC/YjPfUAng== X-MS-TrafficTypeDiagnostic: CY4PR1201MB0232: X-Microsoft-Exchange-Diagnostics: 1; CY4PR1201MB0232; 25:xPTIpevN+ZrSeIOQz3A3rIT/p9NOerw8XolejdsjTEZsHl6WGPOgSgz+iEo18whciA8lQwo9vQFUau3DNI+90YCLHDEUBpboX2PvQ9B/iTBU6VFkJ1oMWyWVmlO/ZAakGow+NzkYg6cOYFqsTWEzcUd6DNlWlXXL7O87wePY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qW3FaxuTMevi2Ag6NertKzOlfHykRhRz13RqcLasbm5JCKC5f54McgkKOgNmaxghAbt2Cef/bIEka3RG7EyVpg9LXA5Ve6dBQxCErIy3NaUu1GnhuG4u65uI5W6ycEQDvNGihmXwINlEvA74a/Ka0b3Pagq09CwQSALLwydWLDEoA675KwOdwpDpFxalulPnO1k1zzilfHjG9c67i8PV6NX+BDPjJJhc+7LNNe+kxoGqsegxazgro5Q3+7OJjMAAYa2nnvnPIwzOS+iALvX4AHTOVV9q3Y1D5fE7EAGqFIaQWzCNP9rswzGHHQ40pzZWmM4Nw0IkLHJOIrIX7O8GpBRtq/2cD1emebqGkwWwv6kVW10Qhra4aXkUCEJ1/fNYdPKtBU1nhDXXcVKi/2egFYzVc9lM7hY= X-Microsoft-Exchange-Diagnostics: 1; CY4PR1201MB0232; 20:n4F6xxZqRiyOoebXFDQvPISJXFLg67/cd5jhnyxdXp2LNbDTmqGHjcb9r/NF+9nxS8wkcQSTQDcWwNqBmNytWfEPtB6EapcL3lDTC9DS7H9K/Kguu1UEqd+f4D9P1Cb960pJISZ29rZ6VXbUbjORhXCKSTtFbEkIKGOGnCCp6eJEH8qwZXu66Hy3l+ECupSHurSoqR/2oGbgiDznZ6WKn89siCVBnfzE397vIAUDZpXKaPfpN22FsUkqgX4LDzDm43UOxWS4cuIedKRsZRoT7Cac1IU+1iHA+JSi2hhPS2ngvZv18zxceovre5nz4T6l4FMx4qHGBEbbzpmKnfvABkUAEE/SFgLdEojFcnCZuh1J0oqTVznBEmzCcVET6mioemFhUsYGy/RBEKGhsBIE/Iez9+MS2nkRTYA5eyeeOleJ3Y59yUQA3ax3hax0cvhBAY6hN3ibyUNoHCWphTJxXIGgNlDeNtDUB8yMY9m6tR3fBWxjOrnuQkYIUnIVq46A X-Exchange-Antispam-Report-Test: UriScan:(278178393323532)(236129657087228)(767451399110)(148574349560750)(247924648384137); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(2017060910075)(8121501046)(5005006)(93006095)(93001095)(3002001)(100000703101)(100105400095)(10201501046)(6055026)(6041248)(20161123564025)(20161123555025)(20161123560025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY4PR1201MB0232; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY4PR1201MB0232; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR1201MB0232; 4:8q0EL6s43sqSkd5eN+EqJpzgZjiJvApa8y3VsOV1?= =?us-ascii?Q?sjENSr3fbhhHQcwfQ0W88QgERsUx5QFVujNZ03ilS4l//aGQhzWor6jJzpgU?= =?us-ascii?Q?WNoO6AKJ23EzlzrQKCIbM4vwctYLmNh3zxTzj8LOZisixd1X4N3F96TiCsDe?= =?us-ascii?Q?+AApBn4d5SYAgUICWppZWWZwq2J7fCl2DcnU5difVYD9yZJkEjmdWeU6M9sC?= =?us-ascii?Q?oP1487VuMj5rD6ekvMbKTfQqZlnqEjfXm6kotwWS3h4gJOJ602QZa28UOPzU?= =?us-ascii?Q?TMq5+4tIw+nzJuCCq/eb+IXPP7IBj1XBHxscyx7UJZyK7t8tZHptzjGCc9r8?= =?us-ascii?Q?63OnrAzd0TTQOxDBSpwFlzxlTjpqrLQEzAsIvOEOptz23rh7B7n11n8QjDz7?= =?us-ascii?Q?POV5iMzwM9TDRyMtBvK+bOOZjlYI9aBtrWGCZiFwxyUVr8qy69pFqJK6uJ4M?= =?us-ascii?Q?XOzq6z0dcZZHxCSnq+frKVonL94Ef0wUUTf+BxxwRauNH0KJuAvpRV3IVS+f?= =?us-ascii?Q?fn/rpN09FzN5Zy8GqGVI7Q9IV2Tsh88gzpl3OiwCCbq2IOhg+S315cO45Iyp?= =?us-ascii?Q?CZgh95uC3Di0FQ0vfIWQ5KCoD/6YTvHTy9AFpSEEjGkNn1vw1NBJmpK8L0o9?= =?us-ascii?Q?TXveUaq3KoHc7CuYCxdKPrIdc2FqzklaJuRkCEkauizn93MWm3v/hV25Tw89?= =?us-ascii?Q?EJ76LfU3TXZJsMaoB6sW4L03XXy5VwHs30x0UzfeMB3lM05/fSaUz7ZThhSj?= =?us-ascii?Q?r2OI+awzhL/Zc25BTP/78QCJMweNtdqDi6AjTU3w9Ic99mrQprtRBNUITHUe?= =?us-ascii?Q?7en2TqLl/EPObQQcQl/QnKGRw0oZmMNd+BIatGaxv5HJu/ii3dPWmzzJqchh?= =?us-ascii?Q?I6VNlYxgoxuBZdmOq6jH/8uoGs+SDyo7DeSSYfGOd+FmZpNRBMjbESFxw9Oo?= =?us-ascii?Q?OoXcPYZQzCu093yTgiCaDJmMmUwTh7O1ePBQhGQq7WyKDLYgSaKXQ4yvr/CA?= =?us-ascii?Q?Nq3b4nkMbTjYpPI0lXVBtugg9kYhGZlGEXXF2EsrUjod+L5ddxJeg/UCVsfE?= =?us-ascii?Q?ThgJgIl2GXvXeTQw6K/7wn1tAjeeS58jzO9rFzUsqB9plkFl96CwA0d5Kj+I?= =?us-ascii?Q?Z/s4a0YDoaCo1YwRd732mABk87dywjK9cGvQx6tsM7gS7q/L4/2TndCAA6ge?= =?us-ascii?Q?8n47O64iH6vxzHpeJIVLkHgGb0fAsh7/wMyXIEvbFCpZWrxt1fWUVSE3A5Cv?= =?us-ascii?Q?C8IgDAOWif643E2XiOT51B2zYKt58BdlxBCyAKfshTIovyzQ/IKAKjYJZUE4?= =?us-ascii?Q?UlqYawMPEjnlURmKPChguzM343i81CcgBkJ9o/7nBm7bpScepZhRAlJxg2wm?= =?us-ascii?Q?2xVQN+ggBX0gBMOX6vzuLxOpiuA=3D?= X-Forefront-PRVS: 037291602B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(7370300001)(6009001)(39400400002)(39850400002)(39840400002)(39860400002)(39410400002)(39450400003)(72206003)(50986999)(25786009)(86362001)(7350300001)(189998001)(5003940100001)(53416004)(450100002)(2906002)(42186005)(6486002)(4326008)(66066001)(38730400002)(110136004)(36756003)(47776003)(8676002)(6116002)(3846002)(50226002)(53936002)(48376002)(478600001)(7736002)(5660300001)(50466002)(81166006)(6666003)(305945005); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR1201MB0232; H:Harpoon.amd.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR1201MB0232; 23:D2zW8JAjgCTa2cNT45swtfiJQhGh+NW7eSLRtNV?= =?us-ascii?Q?Xwe8h8Ti3uEIKHJAwMJIlDx0q+QHtZb7y8/tnPXwjBAk3qXx7Dask6pmluXa?= =?us-ascii?Q?ujq9T74BUuwNHlYcjq0uy+2ttbtYcYLm67GO9qXBqtLy90NF4s9As20NYrew?= =?us-ascii?Q?ZogcyGaEW+ixpO0CvwrcrBo0aUMOCa2iuUS25DOHbGlCWgXPAUkQCTqjMKfg?= =?us-ascii?Q?yZNLAUuj1eR0OpBXngijxGvZNbsW7KY5MAHvqYIGxylh7fBu/oClVUOkVgnF?= =?us-ascii?Q?iw1tdN1pSjAj1ZXONSLK6396eyQRFL18dOMKPTe9HDuxNLNmCmMPS+gtb5iw?= =?us-ascii?Q?fLfI8vFaVd0P8lZLzCzcshH1KyU67/fxlj1nekfO6c0F/S3Y3kL5c3sdCMoP?= =?us-ascii?Q?MjC+ov8oBfA9W0WyeBRHO6FTrkfwYC/D44yyT/n56Ke3m8N09m2Jhd7UJrhV?= =?us-ascii?Q?bYZCgdeNIWXTDAUHFC4iiITLIIXObNHIY5xgQy1jiijprAdOkqTkOWMLj/dB?= =?us-ascii?Q?kgCyzxh512RuaIXk/HiSdpR202qDwIQeWBnLhpmFASmOEYmHQx2JtwEyvpdk?= =?us-ascii?Q?3m3ypo8sk7v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YSoMje6qZdZ7vgqf3w+7EhdTxS6WHv6Mj5kgpErXhDwDi+SMtyEoXpwI7qBZaXzayZC0t0hDxi6LK3EQQ5U7Pl/v6407hjqQj+4ixq4/6NCIk5r3LGfI9JDkE+i+1E98INWhnaNf1fYYUqxDZE/1yOLutCFx4Ff3O0hOb4NLTDYAY9Q5GhCfnSg616HB6rmE65FOE7tO/a9jEgKEVbO1C1cpRTOC3bX6mEYg9JocBQc= X-Microsoft-Exchange-Diagnostics: 1; CY4PR1201MB0232; 20:Vc2x9AqlW+i+tKmPEbpTOY0m/trqdKTmLEdb7OAUoQ7RVGqp819nji2zTHn+s+E49JfHLl/R3RxkKIPubpBluJTYkDGvVDgoGGHZFtjUWlBCm882X61nO9+W/MFCZCceT56suMyf4F9Q9Sa+z0SfNAIzWbKdUZeUp7hFlBJTlltq24+NfHqtxfxEkgPmPV+MlNpYLnhA0svfEbz6GlJZv/6tbv05QH7HnoBmrs3+m/vZoPVuX2Hr4N2OvFi3fwps X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jul 2017 03:56:44.2307 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1201MB0232 Cc: Felix Kuehling X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Allows gdb to access contents of user mode mapped BOs. System memory is handled by TTM using kmap. Other memory pools require a new driver callback in ttm_bo_driver. v2: * kmap only one page at a time * swap in BO if needed * make driver callback more generic to handle private memory pools * document callback return value * WARN_ON -> WARN_ON_ONCE Signed-off-by: Felix Kuehling Reviewed-by: Christian König for both. Reviewed-by: Michel Dänzer --- drivers/gpu/drm/ttm/ttm_bo_vm.c | 79 ++++++++++++++++++++++++++++++++++++++++- include/drm/ttm/ttm_bo_driver.h | 17 +++++++++ 2 files changed, 95 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c index 9f53df9..945985e 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_vm.c +++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c @@ -294,10 +294,87 @@ static void ttm_bo_vm_close(struct vm_area_struct *vma) vma->vm_private_data = NULL; } +static int ttm_bo_vm_access_kmap(struct ttm_buffer_object *bo, + unsigned long offset, + void *buf, int len, int write) +{ + unsigned long page = offset >> PAGE_SHIFT; + unsigned long bytes_left = len; + int ret; + + /* Copy a page at a time, that way no extra virtual address + * mapping is needed + */ + offset -= page << PAGE_SHIFT; + do { + unsigned long bytes = min(bytes_left, PAGE_SIZE - offset); + struct ttm_bo_kmap_obj map; + void *ptr; + bool is_iomem; + + ret = ttm_bo_kmap(bo, page, 1, &map); + if (ret) + return ret; + + ptr = (uint8_t *)ttm_kmap_obj_virtual(&map, &is_iomem) + offset; + WARN_ON_ONCE(is_iomem); + if (write) + memcpy(ptr, buf, bytes); + else + memcpy(buf, ptr, bytes); + ttm_bo_kunmap(&map); + + page++; + bytes_left -= bytes; + offset = 0; + } while (bytes_left); + + return len; +} + +static int ttm_bo_vm_access(struct vm_area_struct *vma, unsigned long addr, + void *buf, int len, int write) +{ + unsigned long offset = (addr) - vma->vm_start; + struct ttm_buffer_object *bo = vma->vm_private_data; + int ret; + + if (len < 1 || (offset + len) >> PAGE_SHIFT > bo->num_pages) + return -EIO; + + ret = ttm_bo_reserve(bo, true, false, NULL); + if (ret) + return ret; + + switch(bo->mem.mem_type) { + case TTM_PL_SYSTEM: + if (unlikely(bo->ttm->page_flags & TTM_PAGE_FLAG_SWAPPED)) { + ret = ttm_tt_swapin(bo->ttm); + if (unlikely(ret != 0)) + return ret; + } + /* fall through */ + case TTM_PL_TT: + ret = ttm_bo_vm_access_kmap(bo, offset, buf, len, write); + break; + default: + if (bo->bdev->driver->access_memory) + ret = bo->bdev->driver->access_memory( + bo, offset, buf, len, write); + else + ret = -EIO; + } + + ttm_bo_unreserve(bo); + + return ret; +} + static const struct vm_operations_struct ttm_bo_vm_ops = { .fault = ttm_bo_vm_fault, .open = ttm_bo_vm_open, - .close = ttm_bo_vm_close + .close = ttm_bo_vm_close, + .access = ttm_bo_vm_access }; static struct ttm_buffer_object *ttm_bo_vm_lookup(struct ttm_bo_device *bdev, diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h index 6bbd34d..04380ba 100644 --- a/include/drm/ttm/ttm_bo_driver.h +++ b/include/drm/ttm/ttm_bo_driver.h @@ -471,6 +471,23 @@ struct ttm_bo_driver { */ unsigned long (*io_mem_pfn)(struct ttm_buffer_object *bo, unsigned long page_offset); + + /** + * Read/write memory buffers for ptrace access + * + * @bo: the BO to access + * @offset: the offset from the start of the BO + * @buf: pointer to source/destination buffer + * @len: number of bytes to copy + * @write: whether to read (0) from or write (non-0) to BO + * + * If successful, this function should return the number of + * bytes copied, -EIO otherwise. If the number of bytes + * returned is < len, the function may be called again with + * the remainder of the buffer to copy. + */ + int (*access_memory)(struct ttm_buffer_object *bo, unsigned long offset, + void *buf, int len, int write); }; /**