File Index
Files and directories
Sign in
FILE

defaults.c

File preview with syntax highlighting.

linux-6.19.14/drivers/dma/idxd/defaults.c C
 1// SPDX-License-Identifier: GPL-2.0
 2/* Copyright(c) 2023 Intel Corporation. All rights rsvd. */
 3#include <linux/kernel.h>
 4#include "idxd.h"
 5
 6int idxd_load_iaa_device_defaults(struct idxd_device *idxd)
 7{
 8	struct idxd_engine *engine;
 9	struct idxd_group *group;
10	struct idxd_wq *wq;
11
12	if (!test_bit(IDXD_FLAG_CONFIGURABLE, &idxd->flags))
13		return 0;
14
15	wq = idxd->wqs[0];
16
17	if (wq->state != IDXD_WQ_DISABLED)
18		return -EPERM;
19
20	/* set mode to "dedicated" */
21	set_bit(WQ_FLAG_DEDICATED, &wq->flags);
22	wq->threshold = 0;
23
24	/* only setting up 1 wq, so give it all the wq space */
25	wq->size = idxd->max_wq_size;
26
27	/* set priority to 10 */
28	wq->priority = 10;
29
30	/* set type to "kernel" */
31	wq->type = IDXD_WQT_KERNEL;
32
33	/* set wq group to 0 */
34	group = idxd->groups[0];
35	wq->group = group;
36	group->num_wqs++;
37
38	/* set name to "iaa_crypto" */
39	strscpy_pad(wq->name, "iaa_crypto");
40
41	/* set driver_name to "crypto" */
42	strscpy_pad(wq->driver_name, "crypto");
43
44	engine = idxd->engines[0];
45
46	/* set engine group to 0 */
47	engine->group = idxd->groups[0];
48	engine->group->num_engines++;
49
50	return 0;
51}
~/ Read-only file preview.