From patchwork Fri Aug 18 14:03:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "StDenis, Tom" X-Patchwork-Id: 9909437 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 24F5D60382 for ; Fri, 18 Aug 2017 15:36:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1113128CD3 for ; Fri, 18 Aug 2017 15:36:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0596B28CFF; Fri, 18 Aug 2017 15:36:30 +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=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 DA01428CD3 for ; Fri, 18 Aug 2017 15:36:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 67A456E0B6; Fri, 18 Aug 2017 15:36:27 +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-bl2nam02on0064.outbound.protection.outlook.com [104.47.38.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id 334486E0B6 for ; Fri, 18 Aug 2017 15:36:25 +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=G+9VzL/Kax+4SkCIpWBNIvMlU8RPAYbbf4CLCEmPubw=; b=AM8DCRpVtwTZpr8ipxn5jWtSkQMvLK6LirIJWhcT7X9p95BmUHnVisDRDysvYtFbC84bLcbkt4tiO23mX0o0kEcTz0fvgpw7J9fStCfQ3ApC//DRO7rZmCJNx++fSmw2LgJBacZD8rD3t7FnNHfYCfANAy/Iv9Re2xjzg6Yhdmw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Tom.StDenis@amd.com; Received: from fx8.amd.com (165.204.55.251) by CY4PR1201MB0071.namprd12.prod.outlook.com (10.172.77.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1362.18; Fri, 18 Aug 2017 14:03:33 +0000 From: Tom St Denis To: amd-gfx@lists.freedesktop.org Subject: [PATCH 1/2] drm/ttm: Add DMA map/unmap tracepoint (v3) Date: Fri, 18 Aug 2017 10:03:23 -0400 Message-Id: <20170818140324.6849-1-tom.stdenis@amd.com> X-Mailer: git-send-email 2.12.0 MIME-Version: 1.0 X-Originating-IP: [165.204.55.251] X-ClientProxiedBy: CY4PR06CA0058.namprd06.prod.outlook.com (10.175.122.148) To CY4PR1201MB0071.namprd12.prod.outlook.com (10.172.77.146) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 60901e7d-7760-4bd8-29f8-08d4e641ea19 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:CY4PR1201MB0071; X-Microsoft-Exchange-Diagnostics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EECWE3O5EXG2Vq27c24BWwif0RO8b2CTGZjDBqLmX/XpHK/Nu5yBBOHY+CbliCyb9m77EE9TXkCdi8PXHqBunZCLNlr/ucY1kwSbSwOwCVSL4EdNhrr83xc/8jIwZplJFuqXL/Agpwn5kILOcZ3MVbp9efxfozahEX6KT0gfR2DBAiJYTLfV6AhM0syoBUKwBIxQwUjxj2FgvWuUI4Rki8fALHi+d1GebStxX97HlejnKgXdvWgk7qRG7Kwwhw4PEotil1aliWWLMAEbQDExqP4d0IrRLaHsudnVSo4pWlN/HvvZg4IAeTyyrjbKbDeqwl6rr4OPysu9agfcXB57ONgD5z1K74SJfsxF1EqIvHYbWfVx; 4:ezA8ON7wj4wAns9BNXmkl7PPhLPaImvlKv7bMxMdeHESz6rDV31uIIAKiWJEnmFyB56koCWVBIY8/kfSQwfaFk3FJ5WvXzQfpryFhZF9hSaCaL92rKCn1eoromHk0hEx+BTKhlo2mdlLjDPSO5ECgIkuE91Wh2nYEJ8nm5u+Zx0lYjfkdNA4u5KBp/rcxgTb/lfMimqU8uYa6nCELe39FHyI5ug0Tz21lPLf5yIDKLNgCZKFqvNkKbwu0EvxBuetgCssX64bVjm7cXn5nVsnVpbeJrEqiPosohzq+oBPHmg= X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(3002001)(6055026)(6041248)(20161123558100)(20161123560025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY4PR1201MB0071; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY4PR1201MB0071; X-Forefront-PRVS: 040359335D X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(7370300001)(6009001)(39860400002)(189002)(199003)(50466002)(1076002)(53936002)(23676002)(189998001)(2906002)(3846002)(33646002)(305945005)(86362001)(7350300001)(25786009)(5660300001)(36756003)(2870700001)(6116002)(478600001)(575784001)(450100002)(97736004)(6486002)(72206003)(66066001)(101416001)(50986999)(47776003)(4326008)(53416004)(6666003)(6916009)(42186005)(105586002)(106356001)(110136004)(7736002)(8676002)(81156014)(50226002)(68736007)(81166006)(2351001)(2361001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR1201MB0071; H:fx8.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTRQUjEyMDFNQjAwNzE7MjM6WDdwbjQ2UmZ3WmNhMHoxN0paUkRoRUZ3?= =?utf-8?B?UmhtdGlmWjhoSFJUTlRvaU9qR0NzT05EcVNXSjhGcjZmQThjN1RBOUVRdkk4?= =?utf-8?B?bWRiR1duS0E0Mml1Rkt2dWxpUUNzdWxHUmI4aUEwTmhTa0pUSVl3V3V3cldM?= =?utf-8?B?MktLYjBUVzJqSTN0cjM1eC9ROWIyTGxNZU93cjJDQ3JWR1JWT0hwMEFQK0FE?= =?utf-8?B?ZzFNZTFBbzk1b2JibGdWczkzWEYvNVNiYlM3WWRvRzc5dklnemNKRkhTRHBB?= =?utf-8?B?SVBscVZoWmw3ZUE3bVN1TFo4SzczRThmcmY3MnZndkhXMStYOEEvT0xCMXo3?= =?utf-8?B?RnBUeGdOR3FDUTdKM3R3SU1PZExuL3hWMkNGQWc1VjZXZFFnV0EreDlYK1B2?= =?utf-8?B?c01LeWQwWkUyeHN3Z3dXbk9xd3M2NURtNTQ4dHdhSkErRlJZOEs3dDVTb3Fp?= =?utf-8?B?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Z2g4GdirYqNF5aLx6RYFu0DUDtoDLwbM/NyJfKfOAF7GJl7o4TcGJm39AEzNcEPpF4ZtZZN8+RXk= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR1201MB0071; 20:JqnneYVxCYCE8jV9ybK0ysvpDS1DderboyS3a1Ak+THONxHii/JwloJFy9o2gp/cOcKqgrT8UwrAezi9tokJdJy3G1q94jBomSzCQW5Ny9o3aRdKcMgyKuq3Y28LtpSbpp5a+greEc4jDVeny1UOIAnvj4C/+1HKpDzFdo7oyOgvtBC1TS0G1wHCAVjnIbQw1XP6+sogYTyLDifiSk5aQULukKASx0m7mKMK/ux47jIsPnqXAs9BP/fVjJEhJOv/ X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Aug 2017 14:03:33.6487 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1201MB0071 Cc: Tom St Denis , dri-devel@lists.freedesktop.org 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 Also exports two functions that vendor drivers can call to trace DMA mappings. This is meant to help translate IOMMU mappings of bus addresses back to physical pages. Used by the umr amdgpu debugger for instance. Signed-off-by: Tom St Denis Reviewed-by: Christian König (v2): Use dev_name() to get PCI path instead. (v3): Use correct types for dma/phys addresses --- drivers/gpu/drm/ttm/Makefile | 4 +- drivers/gpu/drm/ttm/ttm_debug.c | 75 ++++++++++++++++++++++++++++++ drivers/gpu/drm/ttm/ttm_trace.h | 87 +++++++++++++++++++++++++++++++++++ drivers/gpu/drm/ttm/ttm_tracepoints.c | 46 ++++++++++++++++++ include/drm/ttm/ttm_debug.h | 31 +++++++++++++ 5 files changed, 241 insertions(+), 2 deletions(-) create mode 100644 drivers/gpu/drm/ttm/ttm_debug.c create mode 100644 drivers/gpu/drm/ttm/ttm_trace.h create mode 100644 drivers/gpu/drm/ttm/ttm_tracepoints.c create mode 100644 include/drm/ttm/ttm_debug.h diff --git a/drivers/gpu/drm/ttm/Makefile b/drivers/gpu/drm/ttm/Makefile index f92325800f8a..fd3da00c0bf2 100644 --- a/drivers/gpu/drm/ttm/Makefile +++ b/drivers/gpu/drm/ttm/Makefile @@ -1,11 +1,11 @@ # # Makefile for the drm device driver. This driver provides support for the -ccflags-y := -Iinclude/drm +ccflags-y := -Iinclude/drm -I$(src)/. ttm-y := ttm_memory.o ttm_tt.o ttm_bo.o \ ttm_bo_util.o ttm_bo_vm.o ttm_module.o \ ttm_object.o ttm_lock.o ttm_execbuf_util.o ttm_page_alloc.o \ - ttm_bo_manager.o ttm_page_alloc_dma.o + ttm_bo_manager.o ttm_page_alloc_dma.o ttm_debug.o ttm_tracepoints.o ttm-$(CONFIG_AGP) += ttm_agp_backend.o obj-$(CONFIG_DRM_TTM) += ttm.o diff --git a/drivers/gpu/drm/ttm/ttm_debug.c b/drivers/gpu/drm/ttm/ttm_debug.c new file mode 100644 index 000000000000..dd158c6ef90d --- /dev/null +++ b/drivers/gpu/drm/ttm/ttm_debug.c @@ -0,0 +1,75 @@ +/************************************************************************** + * + * Copyright (c) 2017 Advanced Micro Devices, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ +/* + * Authors: Tom St Denis + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ttm_trace.h" + +void ttm_trace_dma_map(struct device *dev, struct ttm_dma_tt *tt) +{ + unsigned i; + + if (unlikely(trace_ttm_dma_map_enabled())) { + for (i = 0; i < tt->ttm.num_pages; i++) { + trace_ttm_dma_map( + dev, + tt->ttm.pages[i], + tt->dma_address[i]); + } + } +} +EXPORT_SYMBOL(ttm_trace_dma_map); + +void ttm_trace_dma_unmap(struct device *dev, struct ttm_dma_tt *tt) +{ + unsigned i; + + if (unlikely(trace_ttm_dma_unmap_enabled())) { + for (i = 0; i < tt->ttm.num_pages; i++) { + trace_ttm_dma_unmap( + dev, + tt->ttm.pages[i], + tt->dma_address[i]); + } + } +} +EXPORT_SYMBOL(ttm_trace_dma_unmap); + diff --git a/drivers/gpu/drm/ttm/ttm_trace.h b/drivers/gpu/drm/ttm/ttm_trace.h new file mode 100644 index 000000000000..23279b9b8e64 --- /dev/null +++ b/drivers/gpu/drm/ttm/ttm_trace.h @@ -0,0 +1,87 @@ +/************************************************************************** + * + * Copyright (c) 2017 Advanced Micro Devices, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ +/* + * Authors: Tom St Denis + */ +#if !defined(_TTM_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TTM_TRACE_H_ + +#include +#include +#include + +#include + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM ttm +#define TRACE_INCLUDE_FILE ttm_trace + +TRACE_EVENT(ttm_dma_map, + TP_PROTO(struct device *dev, struct page *page, dma_addr_t dma_address), + TP_ARGS(dev, page, dma_address), + TP_STRUCT__entry( + __string(device, dev_name(dev)) + __field(dma_addr_t, dma) + __field(phys_addr_t, phys) + ), + TP_fast_assign( + __assign_str(device, dev_name(dev)); + __entry->dma = dma_address; + __entry->phys = page_to_phys(page); + ), + TP_printk("%s: %pad => %pa", + __get_str(device), + &__entry->dma, + &__entry->phys) +); + +TRACE_EVENT(ttm_dma_unmap, + TP_PROTO(struct device *dev, struct page *page, dma_addr_t dma_address), + TP_ARGS(dev, page, dma_address), + TP_STRUCT__entry( + __string(device, dev_name(dev)) + __field(dma_addr_t, dma) + __field(phys_addr_t, phys) + ), + TP_fast_assign( + __assign_str(device, dev_name(dev)); + __entry->dma = dma_address; + __entry->phys = page_to_phys(page); + ), + TP_printk("%s: %pad => %pa", + __get_str(device), + &__entry->dma, + &__entry->phys) +); + +#endif + +/* This part must be outside protection */ +#undef TRACE_INCLUDE_PATH +#define TRACE_INCLUDE_PATH . +#include + diff --git a/drivers/gpu/drm/ttm/ttm_tracepoints.c b/drivers/gpu/drm/ttm/ttm_tracepoints.c new file mode 100644 index 000000000000..c13b9f5b6496 --- /dev/null +++ b/drivers/gpu/drm/ttm/ttm_tracepoints.c @@ -0,0 +1,46 @@ +/************************************************************************** + * + * Copyright (c) 2017 Advanced Micro Devices, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ +/* + * Authors: Tom St Denis + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define CREATE_TRACE_POINTS +#include "ttm_trace.h" diff --git a/include/drm/ttm/ttm_debug.h b/include/drm/ttm/ttm_debug.h new file mode 100644 index 000000000000..b5e460fa5086 --- /dev/null +++ b/include/drm/ttm/ttm_debug.h @@ -0,0 +1,31 @@ +/************************************************************************** + * + * Copyright (c) 2017 Advanced Micro Devices, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ +/* + * Authors: Tom St Denis + */ +extern void ttm_trace_dma_map(struct device *dev, struct ttm_dma_tt *tt); +extern void ttm_trace_dma_unmap(struct device *dev, struct ttm_dma_tt *tt);