Linux 4.19.133
[linux/fpc-iii.git] / drivers / iommu / amd_iommu_debugfs.c
blobc6a5c737ef0947654cb95607b43c7f3e9ae854ad
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * AMD IOMMU driver
5 * Copyright (C) 2018 Advanced Micro Devices, Inc.
7 * Author: Gary R Hook <gary.hook@amd.com>
8 */
10 #include <linux/debugfs.h>
11 #include <linux/iommu.h>
12 #include <linux/pci.h>
13 #include "amd_iommu_proto.h"
14 #include "amd_iommu_types.h"
16 static struct dentry *amd_iommu_debugfs;
17 static DEFINE_MUTEX(amd_iommu_debugfs_lock);
19 #define MAX_NAME_LEN 20
21 void amd_iommu_debugfs_setup(struct amd_iommu *iommu)
23 char name[MAX_NAME_LEN + 1];
25 mutex_lock(&amd_iommu_debugfs_lock);
26 if (!amd_iommu_debugfs)
27 amd_iommu_debugfs = debugfs_create_dir("amd",
28 iommu_debugfs_dir);
29 mutex_unlock(&amd_iommu_debugfs_lock);
31 snprintf(name, MAX_NAME_LEN, "iommu%02d", iommu->index);
32 iommu->debugfs = debugfs_create_dir(name, amd_iommu_debugfs);