File: driver_interface.py

package info (click to toggle)
intel-gpu-tools 2.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 63,360 kB
  • sloc: xml: 781,458; ansic: 360,567; python: 8,336; yacc: 2,781; perl: 1,196; sh: 1,177; lex: 487; asm: 227; lisp: 35; makefile: 30
file content (198 lines) | stat: -rw-r--r-- 5,534 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# SPDX-License-Identifier: MIT
# Copyright © 2024 Intel Corporation

import abc
import enum
import typing


class SchedulingPriority(enum.Enum):
    LOW = 0
    NORMAL = 1
    HIGH = 2


class VfControl(str, enum.Enum):
    pause = 'pause'
    resume = 'resume'
    stop = 'stop'
    clear = 'clear'

    def __str__(self) -> str:
        return str.__str__(self)


class DriverInterface(abc.ABC):

    @staticmethod
    @abc.abstractmethod
    def get_name() -> str:
        raise NotImplementedError

    @abc.abstractmethod
    def bind(self, bdf: str) -> None:
        raise NotImplementedError

    @abc.abstractmethod
    def unbind(self, bdf: str) -> None:
        raise NotImplementedError

    @abc.abstractmethod
    def get_totalvfs(self) -> int:
        raise NotImplementedError

    @abc.abstractmethod
    def get_numvfs(self) -> int:
        raise NotImplementedError

    @abc.abstractmethod
    def set_numvfs(self, val: int) -> None:
        raise NotImplementedError

    @abc.abstractmethod
    def get_drivers_autoprobe(self) -> int:
        raise NotImplementedError

    @abc.abstractmethod
    def set_drivers_autoprobe(self, val: int) -> None:
        raise NotImplementedError

    @abc.abstractmethod
    def get_num_gts(self) -> int:
        raise NotImplementedError

    @abc.abstractmethod
    def has_lmem(self) -> bool:
        raise NotImplementedError

    @abc.abstractmethod
    def get_auto_provisioning(self) -> bool:
        raise NotImplementedError

    @abc.abstractmethod
    def set_auto_provisioning(self, val: bool) -> None:
        raise NotImplementedError

    @abc.abstractmethod
    def cancel_work(self) -> None:
        raise NotImplementedError

    @abc.abstractmethod
    def get_pf_ggtt_spare(self, gt_num: int) -> int:
        raise NotImplementedError

    @abc.abstractmethod
    def set_pf_ggtt_spare(self, gt_num: int, val: int) -> None:
        raise NotImplementedError

    @abc.abstractmethod
    def get_pf_lmem_spare(self, gt_num: int) -> int:
        raise NotImplementedError

    @abc.abstractmethod
    def set_pf_lmem_spare(self, gt_num: int, val: int) -> None:
        raise NotImplementedError

    @abc.abstractmethod
    def get_pf_contexts_spare(self, gt_num: int) -> int:
        raise NotImplementedError

    @abc.abstractmethod
    def set_pf_contexts_spare(self, gt_num: int, val: int) -> None:
        raise NotImplementedError

    @abc.abstractmethod
    def get_pf_doorbells_spare(self, gt_num: int) -> int:
        raise NotImplementedError

    @abc.abstractmethod
    def set_pf_doorbells_spare(self, gt_num: int, val: int) -> None:
        raise NotImplementedError

    @abc.abstractmethod
    def get_pf_sched_priority(self, gt_num: int) -> SchedulingPriority:
        raise NotImplementedError

    @abc.abstractmethod
    def set_pf_sched_priority(self, gt_num: int, val: SchedulingPriority) -> None:
        raise NotImplementedError

    @abc.abstractmethod
    def get_pf_policy_reset_engine(self, gt_num: int) -> int:
        raise NotImplementedError

    @abc.abstractmethod
    def set_pf_policy_reset_engine(self, gt_num: int, val: int) -> None:
        raise NotImplementedError

    @abc.abstractmethod
    def get_pf_policy_sample_period_ms(self, gt_num: int) -> int:
        raise NotImplementedError

    @abc.abstractmethod
    def set_pf_policy_sample_period_ms(self, gt_num: int, val: int) -> None:
        raise NotImplementedError

    @abc.abstractmethod
    def get_pf_policy_sched_if_idle(self, gt_num: int) -> int:
        raise NotImplementedError

    @abc.abstractmethod
    def set_pf_policy_sched_if_idle(self, gt_num: int, val: int) -> None:
        raise NotImplementedError

    @abc.abstractmethod
    def get_ggtt_quota(self, vf_num: int, gt_num: int) -> int:
        raise NotImplementedError

    @abc.abstractmethod
    def set_ggtt_quota(self, vf_num: int, gt_num: int, val: int) -> None:
        raise NotImplementedError

    @abc.abstractmethod
    def get_lmem_quota(self, vf_num: int, gt_num: int) -> int:
        raise NotImplementedError

    @abc.abstractmethod
    def set_lmem_quota(self, vf_num: int, gt_num: int, val: int) -> None:
        raise NotImplementedError

    @abc.abstractmethod
    def get_contexts_quota(self, vf_num: int, gt_num: int) -> int:
        raise NotImplementedError

    @abc.abstractmethod
    def set_contexts_quota(self, vf_num: int, gt_num: int, val: int) -> None:
        raise NotImplementedError

    @abc.abstractmethod
    def get_doorbells_quota(self, vf_num: int, gt_num: int) -> int:
        raise NotImplementedError

    @abc.abstractmethod
    def set_doorbells_quota(self, vf_num: int, gt_num: int, val: int) -> None:
        raise NotImplementedError

    @abc.abstractmethod
    def get_exec_quantum_ms(self, vf_num: int, gt_num: int) -> int:
        raise NotImplementedError

    @abc.abstractmethod
    def set_exec_quantum_ms(self, vf_num: int, gt_num: int, val: int) -> None:
        raise NotImplementedError

    @abc.abstractmethod
    def get_preempt_timeout_us(self, vf_num: int, gt_num: int) -> int:
        raise NotImplementedError

    @abc.abstractmethod
    def set_preempt_timeout_us(self, vf_num: int, gt_num: int, val: int) -> None:
        raise NotImplementedError

    @abc.abstractmethod
    def set_vf_control(self, vf_num: int, val: VfControl) -> None:
        raise NotImplementedError

    @abc.abstractmethod
    def get_ggtt_available(self, gt_num: int) -> typing.Tuple[int, int]:
        raise NotImplementedError