Gary R Hook | 7d0f5fd | 2018-06-12 16:41:30 -0500 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* |
| 3 | * AMD IOMMU driver |
| 4 | * |
| 5 | * Copyright (C) 2018 Advanced Micro Devices, Inc. |
| 6 | * |
| 7 | * Author: Gary R Hook <gary.hook@amd.com> |
| 8 | */ |
| 9 | |
| 10 | #include <linux/debugfs.h> |
Gary R Hook | 7d0f5fd | 2018-06-12 16:41:30 -0500 | [diff] [blame] | 11 | #include <linux/pci.h> |
Joerg Roedel | 786dfe4 | 2020-05-27 13:53:11 +0200 | [diff] [blame] | 12 | |
| 13 | #include "amd_iommu.h" |
Gary R Hook | 7d0f5fd | 2018-06-12 16:41:30 -0500 | [diff] [blame] | 14 | |
| 15 | static struct dentry *amd_iommu_debugfs; |
| 16 | static DEFINE_MUTEX(amd_iommu_debugfs_lock); |
| 17 | |
| 18 | #define MAX_NAME_LEN 20 |
| 19 | |
| 20 | void amd_iommu_debugfs_setup(struct amd_iommu *iommu) |
| 21 | { |
| 22 | char name[MAX_NAME_LEN + 1]; |
| 23 | |
| 24 | mutex_lock(&amd_iommu_debugfs_lock); |
| 25 | if (!amd_iommu_debugfs) |
| 26 | amd_iommu_debugfs = debugfs_create_dir("amd", |
| 27 | iommu_debugfs_dir); |
| 28 | mutex_unlock(&amd_iommu_debugfs_lock); |
| 29 | |
| 30 | snprintf(name, MAX_NAME_LEN, "iommu%02d", iommu->index); |
| 31 | iommu->debugfs = debugfs_create_dir(name, amd_iommu_debugfs); |
| 32 | } |