sysfs.c (d9e5481fca74f870cf2fc2f90a0e77e85c0b5b86) sysfs.c (6e7f3ee97bbe2c7d7a53b7dbd7a08a579e03c8c9)
1// SPDX-License-Identifier: GPL-2.0
2/* Copyright(c) 2019 Intel Corporation. All rights rsvd. */
3#include <linux/init.h>
4#include <linux/kernel.h>
5#include <linux/module.h>
6#include <linux/pci.h>
7#include <linux/device.h>
8#include <linux/io-64-nonatomic-lo-hi.h>
9#include <uapi/linux/idxd.h>
10#include "registers.h"
11#include "idxd.h"
12
13static char *idxd_wq_type_names[] = {
14 [IDXD_WQT_NONE] = "none",
15 [IDXD_WQT_KERNEL] = "kernel",
16 [IDXD_WQT_USER] = "user",
17};
18
1// SPDX-License-Identifier: GPL-2.0
2/* Copyright(c) 2019 Intel Corporation. All rights rsvd. */
3#include <linux/init.h>
4#include <linux/kernel.h>
5#include <linux/module.h>
6#include <linux/pci.h>
7#include <linux/device.h>
8#include <linux/io-64-nonatomic-lo-hi.h>
9#include <uapi/linux/idxd.h>
10#include "registers.h"
11#include "idxd.h"
12
13static char *idxd_wq_type_names[] = {
14 [IDXD_WQT_NONE] = "none",
15 [IDXD_WQT_KERNEL] = "kernel",
16 [IDXD_WQT_USER] = "user",
17};
18
19static int idxd_dsa_drv_probe(struct idxd_dev *idxd_dev)
20{
21 if (is_idxd_dev(idxd_dev))
22 return idxd_device_drv_probe(idxd_dev);
23
24 if (is_idxd_wq_dev(idxd_dev)) {
25 struct idxd_wq *wq = idxd_dev_to_wq(idxd_dev);
26
27 return drv_enable_wq(wq);
28 }
29
30 return -ENODEV;
31}
32
33static void idxd_dsa_drv_remove(struct idxd_dev *idxd_dev)
34{
35 if (is_idxd_dev(idxd_dev)) {
36 idxd_device_drv_remove(idxd_dev);
37 return;
38 }
39
40 if (is_idxd_wq_dev(idxd_dev)) {
41 struct idxd_wq *wq = idxd_dev_to_wq(idxd_dev);
42
43 drv_disable_wq(wq);
44 return;
45 }
46}
47
48static enum idxd_dev_type dev_types[] = {
49 IDXD_DEV_NONE,
50};
51
52struct idxd_device_driver dsa_drv = {
53 .name = "dsa",
54 .probe = idxd_dsa_drv_probe,
55 .remove = idxd_dsa_drv_remove,
56 .type = dev_types,
57};
58
59/* IDXD engine attributes */
60static ssize_t engine_group_id_show(struct device *dev,
61 struct device_attribute *attr, char *buf)
62{
63 struct idxd_engine *engine = confdev_to_engine(dev);
64
65 if (engine->group)
66 return sysfs_emit(buf, "%d\n", engine->group->id);

--- 1402 unchanged lines hidden ---
19/* IDXD engine attributes */
20static ssize_t engine_group_id_show(struct device *dev,
21 struct device_attribute *attr, char *buf)
22{
23 struct idxd_engine *engine = confdev_to_engine(dev);
24
25 if (engine->group)
26 return sysfs_emit(buf, "%d\n", engine->group->id);

--- 1402 unchanged lines hidden ---