Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /*
0003  * IOMMU debugfs core infrastructure
0004  *
0005  * Copyright (C) 2018 Advanced Micro Devices, Inc.
0006  *
0007  * Author: Gary R Hook <gary.hook@amd.com>
0008  */
0009 
0010 #include <linux/pci.h>
0011 #include <linux/iommu.h>
0012 #include <linux/debugfs.h>
0013 
0014 struct dentry *iommu_debugfs_dir;
0015 EXPORT_SYMBOL_GPL(iommu_debugfs_dir);
0016 
0017 /**
0018  * iommu_debugfs_setup - create the top-level iommu directory in debugfs
0019  *
0020  * Provide base enablement for using debugfs to expose internal data of an
0021  * IOMMU driver. When called, this function creates the
0022  * /sys/kernel/debug/iommu directory.
0023  *
0024  * Emit a strong warning at boot time to indicate that this feature is
0025  * enabled.
0026  *
0027  * This function is called from iommu_init; drivers may then use
0028  * iommu_debugfs_dir to instantiate a vendor-specific directory to be used
0029  * to expose internal data.
0030  */
0031 void iommu_debugfs_setup(void)
0032 {
0033     if (!iommu_debugfs_dir) {
0034         iommu_debugfs_dir = debugfs_create_dir("iommu", NULL);
0035         pr_warn("\n");
0036         pr_warn("*************************************************************\n");
0037         pr_warn("**     NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE    **\n");
0038         pr_warn("**                                                         **\n");
0039         pr_warn("**  IOMMU DebugFS SUPPORT HAS BEEN ENABLED IN THIS KERNEL  **\n");
0040         pr_warn("**                                                         **\n");
0041         pr_warn("** This means that this kernel is built to expose internal **\n");
0042         pr_warn("** IOMMU data structures, which may compromise security on **\n");
0043         pr_warn("** your system.                                            **\n");
0044         pr_warn("**                                                         **\n");
0045         pr_warn("** If you see this message and you are not debugging the   **\n");
0046         pr_warn("** kernel, report this immediately to your vendor!         **\n");
0047         pr_warn("**                                                         **\n");
0048         pr_warn("**     NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE    **\n");
0049         pr_warn("*************************************************************\n");
0050     }
0051 }