Path: blob/master/drivers/crypto/intel/qat/qat_common/adf_dbgfs.c
29278 views
// SPDX-License-Identifier: GPL-2.0-only1/* Copyright(c) 2023 Intel Corporation */23#include <linux/debugfs.h>4#include "adf_accel_devices.h"5#include "adf_cfg.h"6#include "adf_common_drv.h"7#include "adf_cnv_dbgfs.h"8#include "adf_dbgfs.h"9#include "adf_fw_counters.h"10#include "adf_heartbeat_dbgfs.h"11#include "adf_pm_dbgfs.h"12#include "adf_tl_debugfs.h"1314/**15* adf_dbgfs_init() - add persistent debugfs entries16* @accel_dev: Pointer to acceleration device.17*18* This function creates debugfs entries that are persistent through a device19* state change (from up to down or vice versa).20*/21void adf_dbgfs_init(struct adf_accel_dev *accel_dev)22{23char name[ADF_DEVICE_NAME_LENGTH];2425/* Create dev top level debugfs entry */26snprintf(name, sizeof(name), "%s%s_%s", ADF_DEVICE_NAME_PREFIX,27accel_dev->hw_device->dev_class->name,28pci_name(accel_dev->accel_pci_dev.pci_dev));2930accel_dev->debugfs_dir = debugfs_create_dir(name, NULL);3132adf_cfg_dev_dbgfs_add(accel_dev);33}34EXPORT_SYMBOL_GPL(adf_dbgfs_init);3536/**37* adf_dbgfs_exit() - remove persistent debugfs entries38* @accel_dev: Pointer to acceleration device.39*/40void adf_dbgfs_exit(struct adf_accel_dev *accel_dev)41{42adf_cfg_dev_dbgfs_rm(accel_dev);43debugfs_remove(accel_dev->debugfs_dir);44}45EXPORT_SYMBOL_GPL(adf_dbgfs_exit);4647/**48* adf_dbgfs_add() - add non-persistent debugfs entries49* @accel_dev: Pointer to acceleration device.50*51* This function creates debugfs entries that are not persistent through52* a device state change (from up to down or vice versa).53*/54void adf_dbgfs_add(struct adf_accel_dev *accel_dev)55{56if (!accel_dev->is_vf) {57adf_fw_counters_dbgfs_add(accel_dev);58adf_heartbeat_dbgfs_add(accel_dev);59adf_pm_dbgfs_add(accel_dev);60adf_cnv_dbgfs_add(accel_dev);61adf_tl_dbgfs_add(accel_dev);62}63}6465/**66* adf_dbgfs_rm() - remove non-persistent debugfs entries67* @accel_dev: Pointer to acceleration device.68*/69void adf_dbgfs_rm(struct adf_accel_dev *accel_dev)70{71if (!accel_dev->is_vf) {72adf_tl_dbgfs_rm(accel_dev);73adf_cnv_dbgfs_rm(accel_dev);74adf_pm_dbgfs_rm(accel_dev);75adf_heartbeat_dbgfs_rm(accel_dev);76adf_fw_counters_dbgfs_rm(accel_dev);77}78}798081