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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
|
<!DOCTYPE html>
<html class="client-nojs" lang="en" dir="ltr">
<head>
<meta charset="UTF-8"/>
<title>View source for Mdev-GPU - Open-IOV</title>
<script>document.documentElement.className="client-js";RLCONF={"wgBreakFrames":!0,"wgSeparatorTransformTable":["",""],"wgDigitTransformTable":["",""],"wgDefaultDateFormat":"dmy","wgMonthNames":["","January","February","March","April","May","June","July","August","September","October","November","December"],"wgRequestId":"7212876c9360432053822d84","wgCSPNonce":!1,"wgCanonicalNamespace":"","wgCanonicalSpecialPageName":!1,"wgNamespaceNumber":0,"wgPageName":"Mdev-GPU","wgTitle":"Mdev-GPU","wgCurRevisionId":23740,"wgRevisionId":0,"wgArticleId":85,"wgIsArticle":!1,"wgIsRedirect":!1,"wgAction":"edit","wgUserName":null,"wgUserGroups":["*"],"wgCategories":[],"wgPageContentLanguage":"en","wgPageContentModel":"wikitext","wgRelevantPageName":"Mdev-GPU","wgRelevantArticleId":85,"wgIsProbablyEditable":!1,"wgRelevantPageIsProbablyEditable":!1,"wgRestrictionEdit":[],"wgRestrictionMove":[],"wgVisualEditor":{"pageLanguageCode":"en","pageLanguageDir":"ltr","pageVariantFallbacks":"en"},
"wgEditSubmitButtonLabelPublish":!1};RLSTATE={"site.styles":"ready","noscript":"ready","user.styles":"ready","user":"ready","user.options":"loading","skins.vector.styles.legacy":"ready","ext.visualEditor.desktopArticleTarget.noscript":"ready"};RLPAGEMODULES=["mediawiki.action.edit.collapsibleFooter","site","mediawiki.page.ready","skins.vector.legacy.js","ext.visualEditor.desktopArticleTarget.init","ext.visualEditor.targetLoader"];</script>
<script>(RLQ=window.RLQ||[]).push(function(){mw.loader.implement("user.options@1hzgi",function($,jQuery,require,module){/*@nomin*/mw.user.tokens.set({"patrolToken":"+\\","watchToken":"+\\","csrfToken":"+\\"});
});});</script>
<link rel="stylesheet" href="load.php%3Flang=en&modules=ext.visualEditor.desktopArticleTarget.noscript|skins.vector.styles.legacy&only=styles&skin=vector.css"/>
<script async="" src="load.php%3Flang=en&modules=startup&only=scripts&raw=1&skin=vector"></script>
<meta name="generator" content="MediaWiki 1.37.1"/>
<meta name="robots" content="noindex,nofollow"/>
<meta name="format-detection" content="telephone=no"/>
<link rel="shortcut icon" href="favicon.ico.html"/>
<link rel="search" type="application/opensearchdescription+xml" href="opensearch_desc.php" title="Open-IOV (en)"/>
<link rel="EditURI" type="application/rsd+xml" href="api.php%3Faction=rsd"/>
<link rel="alternate" type="application/atom+xml" title="Open-IOV Atom feed" href="./index.php%3Ftitle=Special:RecentChanges&feed=atom"/>
</head>
<body class="mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-Mdev-GPU rootpage-Mdev-GPU skin-vector action-edit skin-vector-legacy"><div id="mw-page-base" class="noprint"></div>
<div id="mw-head-base" class="noprint"></div>
<div id="content" class="mw-body" role="main">
<a id="top"></a>
<div id="siteNotice"></div>
<div class="mw-indicators">
</div>
<h1 id="firstHeading" class="firstHeading" >View source for Mdev-GPU</h1>
<div id="bodyContent" class="vector-body">
<div id="contentSub">← <a href="index.php/Mdev-GPU.html" title="Mdev-GPU">Mdev-GPU</a></div>
<div id="contentSub2"></div>
<div id="jump-to-nav"></div>
<a class="mw-jump-link" href="index.php%3Ftitle=Mdev-GPU&action=edit.html#mw-head">Jump to navigation</a>
<a class="mw-jump-link" href="index.php%3Ftitle=Mdev-GPU&action=edit.html#searchInput">Jump to search</a>
<div id="mw-content-text" class="mw-body-content"><p>You do not have permission to edit this page, for the following reason:
</p>
<div class="permissions-errors">
<p>The action you have requested is limited to users in the group: <a href="https://open-iov.org/index.php?title=Open-IOV:Administrators&action=edit&redlink=1" class="new" title="Open-IOV:Administrators (page does not exist)">Administrators</a>.
</p>
</div><hr />
<p>You can view and copy the source of this page.
</p><textarea readonly="" accesskey="," id="wpTextbox1" cols="80" rows="25" style="" class="mw-editfont-monospace" lang="en" dir="ltr" name="wpTextbox1">This page makes use of terms that are defined in the [https://open-iov.org/index.php/Glossary ''Open-IOV Glossary'']. If you're curious what a given term means you can check there for a definition.
This page will be used to document the '''Mdev-GPU API''' as well as provide an overview of the internals of the Mdev-GPU package.
Mdev-GPU's source code can be found [ here].
Module docs can be found [ here].<blockquote>An absence of critical technical documentation has historically slowed growth and adoption of developer ecosystems for GPU virtualization.
This [https://creativecommons.org/licenses/by/4.0/ CC-BY-4.0] licensed content can either be used with attribution, or used as inspiration for new documentation, created by GPU vendors for public commercial distribution as developer documentation.
Where possible, this documentation will clearly label dates and versions of observed-but-not-guaranteed behaviour vs. vendor-documented stable interfaces/behaviour with guarantees of forward or backward compatibility.</blockquote>
=== Compilation ===
Compiling Mdev-GPU from source is very simple however it can take a long time to complete (10 minutes for existing sources).
If you'd like to compile Mdev-GPU yourself you can do so by cloning [ the repo] and running the following two commands from within the repository directory:
<code>curl -sSL <nowiki>https://get.haskellstack.org/</nowiki> | sh</code>
<code>stack install</code>
These commands will generate all binaries provided by Mdev-GPU under the path <code>~/.local/bin/</code>.
If you would prefer not to wait for the program to compile you can find pre-compiled x86_64 binaries under the [ Releases section of the repository on GitHub].
=== Installation ===
The binaries compiled on your local machine by Stack in the <code>~/.local/bin/</code> path or downloaded from [ Releases on GitHub] should be copied to <code>/usr/bin/</code>. This can be accomplished both via install script (currently testing in ) or via management layer-agnostic package.
=== Mdev-GPU Configuration ===
The Mdev-GPU repository provides Systemd service and example configurations for Mdev-CLI in the [ /etc/ folder]. On installation the directories & files contained in the repository's /etc/ folder should be copied to the absolute path <code>/etc/</code> on the user's computer.
==== Systemd ====
GVM/Mdev-GPU exposes several of it's functions as Systemd services.
As of the 0.1.0.0 release the following Systemd services are available:
* '''mdev-post.service'''
===== mdev-post.service =====
As the name would suggest '''[ mdev-post.service]''' posts the GPU(s) in a state where they are ready to be virtualized. When the service is invoked the mdev-cli util registers Mdev callbacks and supported mediated device (Mdev) types with the Mediated Core according to the user's specified configuration at '''<code>/etc/gvm/mdev-gpu/generate-vgpu-types.yaml</code>'''. If you'd like to place your configuration file elsewhere and still have your configuration invoked on boot you can edit the systemd service [ ExecStart= line] to specify an alternative path.
==== Mdev-CLI ====
Configuration for Mdev-GPU can be found in the path '''<code>/etc/gvm/mdev-gpu/</code>'''. This path will by default contain several vendor-specific folders which may include configuration examples for various devices/architectures as well as the file <code>'''generate-vgpu-types.yaml'''</code> which you can configure to specify your desired Virtual GPU (vGPU) / VFIO-Mdev topologies as they are presented in the sysfsdev mdev_bus path and as seen by tools such as [https://github.com/mdevctl/mdevctl mdevctl]. Once you have configured the available types your liking you can refresh the supported types registered with the [https://open-iov.org/index.php/Virtual_IO_Internals#Mediated_Core Mediated Core] by rebooting your machine or reloading the vendor driver kernel module then restarting '''mdev-post.service''' or by invoking '''mdev-cli'''.
The available yaml properties which may be specified in '''<code>/etc/gvm/mdev-gpu/generate-vgpu-types.yaml</code>''' are shown below. Note that fields with the <sup>[required]</sup> tag must be specified in the yaml file whereas fields with the <sup>[optional]</sup> tag may be omitted from configuration if you would prefer to rely upon default parameters instead.
===== num =====
<sup>[required]</sup>
num refers to the Mediated Device (Mdev) type number. This value specifies the profile's numerical identifier in the sysfsdev mdev_bus path.
===== vDevId =====
<sup>[optional]</sup>
The vGPU (Virtual GPU) PCI Device ID which should be presented to the guest.
===== pDevId =====
<sup>[optional]</sup>
The pGPU (Physical GPU) PCI Device ID which should be presented to the host.
===== name =====
<sup>[optional]</sup>
The GPU name presented to the guest.
===== gpuClass =====
<sup>[optional]</sup>
The class of GPU to use.
available strings:
"Compute"
"Graphics"
===== maxInstances =====
<sup>[required]</sup>
maxInstances refers to the maximum number of instances available of any given Mediated Device (Mdev) profile. This number can be configured arbitrarily however it should ideally not be set to a value which allows for fbLen/fbRes values that allow a number of Mdev devices to be created which would exceed your device's available VRAM.
===== virtDisplay =====
<sup>[optional]</sup>
virtDisplay controls the topologies of virtual displays. virtDisplay exposes the following user configurable properties:
====== numHeads ======
<sup>[optional]</sup>
Number of heads [virtual monitors] available for each Mediated Device (Mdev).
====== maxResX ======
<sup>[optional]</sup>
Maximum width of the mediated display.
====== maxResY ======
<sup>[optional]</sup>
Maximum height of the mediated display.
====== frlConfig ======
<sup>[optional]</sup>
Frame rate limiter for the mediated display.
====== frlEnable ======
<sup>[optional]</sup>
Do we enable frame rate limiting or not?
===== ecc =====
<sup>[optional]</sup>
ecc refers to if error correcting memory should be used.
===== fbLen =====
<sup>[required]</sup>
fbLen is the framebuffer length (in megabytes).
===== fbRes =====
<sup>[required]</sup>
fbRes is the framebuffer reserved by the hypervisor (in megabytes). In most circumstances this value should scale to around 1/7th the size of your chosen fbLen value.
===== mapVideoSize =====
<sup>[optional]</sup>
Mappable video size in MBs, 24 by default.
===== encCap =====
<sup>[optional]</sup>
Percentage we use the NvEnc hardware.
===== bar1Len =====
<sup>[optional]</sup>
bar1Len refers to the size of the Base Address Registers for BAR1 (MSI) as presented by the [https://open-iov.org/index.php/Virtual_I/O_Internals#VFIO_device_file_descriptor VFIO File Descriptor].
</textarea><div class="templatesUsed"></div><p id="mw-returnto">Return to <a href="index.php/Mdev-GPU.html" title="Mdev-GPU">Mdev-GPU</a>.</p>
<div class="printfooter">Retrieved from "<a dir="ltr" href="index.php/Mdev-GPU.html">https://open-iov.org/index.php/Mdev-GPU</a>"</div></div>
<div id="catlinks" class="catlinks catlinks-allhidden" data-mw="interface"></div>
</div>
</div>
<div id="mw-navigation">
<h2>Navigation menu</h2>
<div id="mw-head">
<nav id="p-personal" class="mw-portlet mw-portlet-personal vector-user-menu-legacy vector-menu" aria-labelledby="p-personal-label" role="navigation"
>
<h3 id="p-personal-label" class="vector-menu-heading"> <span>Personal tools</span>
</h3>
<div class="vector-menu-content">
<ul class="vector-menu-content-list"><li id="pt-login" class="mw-list-item"><a href="https://open-iov.org/index.php?title=Special:UserLogin&returnto=Mdev-GPU&returntoquery=action%3Dedit" title="You are encouraged to log in; however, it is not mandatory [o]" accesskey="o">Log in</a></li></ul>
</div>
</nav>
<div id="left-navigation">
<nav id="p-namespaces" class="mw-portlet mw-portlet-namespaces vector-menu vector-menu-tabs" aria-labelledby="p-namespaces-label" role="navigation"
>
<h3 id="p-namespaces-label" class="vector-menu-heading"> <span>Namespaces</span>
</h3>
<div class="vector-menu-content">
<ul class="vector-menu-content-list"><li id="ca-nstab-main" class="selected mw-list-item"><a href="index.php/Mdev-GPU.html" title="View the content page [c]" accesskey="c">Page</a></li><li id="ca-talk" class="mw-list-item"><a href="index.php/Talk:Mdev-GPU.html" rel="discussion" title="Discussion about the content page [t]" accesskey="t">Discussion</a></li></ul>
</div>
</nav>
<nav id="p-variants" class="mw-portlet mw-portlet-variants emptyPortlet vector-menu-dropdown-noicon vector-menu vector-menu-dropdown" aria-labelledby="p-variants-label" role="navigation"
>
<input type="checkbox"
id="p-variants-checkbox"
role="button"
aria-haspopup="true"
data-event-name="ui.dropdown-p-variants"
class=" vector-menu-checkbox" aria-labelledby="p-variants-label" />
<h3 id="p-variants-label" class="vector-menu-heading"> <span>Variants</span>
<span class="vector-menu-checkbox-expanded">expanded</span>
<span class="vector-menu-checkbox-collapsed">collapsed</span>
</h3>
<div class="vector-menu-content">
<ul class="vector-menu-content-list"></ul>
</div>
</nav>
</div>
<div id="right-navigation">
<nav id="p-views" class="mw-portlet mw-portlet-views vector-menu vector-menu-tabs" aria-labelledby="p-views-label" role="navigation"
>
<h3 id="p-views-label" class="vector-menu-heading"> <span>Views</span>
</h3>
<div class="vector-menu-content">
<ul class="vector-menu-content-list"><li id="ca-view" class="mw-list-item"><a href="index.php/Mdev-GPU.html">Read</a></li><li id="ca-viewsource" class="selected mw-list-item"><a href="index.php%3Ftitle=Mdev-GPU&action=edit.html" title="This page is protected. You can view its source [e]" accesskey="e">View source</a></li><li id="ca-history" class="mw-list-item"><a href="index.php%3Ftitle=Mdev-GPU&action=history.html" title="Past revisions of this page [h]" accesskey="h">View history</a></li></ul>
</div>
</nav>
<nav id="p-cactions" class="mw-portlet mw-portlet-cactions emptyPortlet vector-menu-dropdown-noicon vector-menu vector-menu-dropdown" aria-labelledby="p-cactions-label" role="navigation" title="More options"
>
<input type="checkbox"
id="p-cactions-checkbox"
role="button"
aria-haspopup="true"
data-event-name="ui.dropdown-p-cactions"
class=" vector-menu-checkbox" aria-labelledby="p-cactions-label" />
<h3 id="p-cactions-label" class="vector-menu-heading"> <span>More</span>
<span class="vector-menu-checkbox-expanded">expanded</span>
<span class="vector-menu-checkbox-collapsed">collapsed</span>
</h3>
<div class="vector-menu-content">
<ul class="vector-menu-content-list"></ul>
</div>
</nav>
<div id="p-search" role="search" class="vector-search-box">
<div>
<h3 >
<label for="searchInput">Search</label>
</h3>
<form action="https://open-iov.org/index.php" id="searchform">
<div id="simpleSearch" data-search-loc="header-navigation">
<input type="search" name="search" placeholder="Search Open-IOV" autocapitalize="sentences" title="Search Open-IOV [f]" accesskey="f" id="searchInput"/>
<input type="hidden" name="title" value="Special:Search"/>
<input type="submit" name="fulltext" value="Search" title="Search the pages for this text" id="mw-searchButton" class="searchButton mw-fallbackSearchButton"/>
<input type="submit" name="go" value="Go" title="Go to a page with this exact name if it exists" id="searchButton" class="searchButton"/>
</div>
</form>
</div>
</div>
</div>
</div>
<div id="mw-panel">
<div id="p-logo" role="banner">
<a class="mw-wiki-logo" href="images/archive/c/c3/20221214193624!I915_Scheduling_Events_and_Requests.png.html"
title="Visit the main page"></a>
</div>
<nav id="p-navigation" class="mw-portlet mw-portlet-navigation vector-menu vector-menu-portal portal" aria-labelledby="p-navigation-label" role="navigation"
>
<h3 id="p-navigation-label" class="vector-menu-heading"> <span>Navigation</span>
</h3>
<div class="vector-menu-content">
<ul class="vector-menu-content-list"><li id="n-mainpage-description" class="mw-list-item"><a href="images/archive/c/c3/20221214193624!I915_Scheduling_Events_and_Requests.png.html" title="Visit the main page [z]" accesskey="z">Main page</a></li><li id="n-recentchanges" class="mw-list-item"><a href="https://open-iov.org/index.php/Special:RecentChanges" title="A list of recent changes in the wiki [r]" accesskey="r">Recent changes</a></li><li id="n-randompage" class="mw-list-item"><a href="index.php/Special:Random.html" title="Load a random page [x]" accesskey="x">Random page</a></li><li id="n-help-mediawiki" class="mw-list-item"><a href="https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents">Help about MediaWiki</a></li></ul>
</div>
</nav>
<nav id="p-tb" class="mw-portlet mw-portlet-tb vector-menu vector-menu-portal portal" aria-labelledby="p-tb-label" role="navigation"
>
<h3 id="p-tb-label" class="vector-menu-heading"> <span>Tools</span>
</h3>
<div class="vector-menu-content">
<ul class="vector-menu-content-list"><li id="t-whatlinkshere" class="mw-list-item"><a href="https://open-iov.org/index.php/Special:WhatLinksHere/Mdev-GPU" title="A list of all wiki pages that link here [j]" accesskey="j">What links here</a></li><li id="t-recentchangeslinked" class="mw-list-item"><a href="https://open-iov.org/index.php/Special:RecentChangesLinked/Mdev-GPU" rel="nofollow" title="Recent changes in pages linked from this page [k]" accesskey="k">Related changes</a></li><li id="t-specialpages" class="mw-list-item"><a href="index.php/Special:SpecialPages.html" title="A list of all special pages [q]" accesskey="q">Special pages</a></li><li id="t-info" class="mw-list-item"><a href="index.php%3Ftitle=Mdev-GPU&action=info.html" title="More information about this page">Page information</a></li></ul>
</div>
</nav>
</div>
</div>
<footer id="footer" class="mw-footer" role="contentinfo" >
<ul id="footer-info" >
</ul>
<ul id="footer-places" >
<li id="footer-places-privacy"><a href="https://open-iov.org/index.php/Open-IOV:Privacy_policy" title="Open-IOV:Privacy policy">Privacy policy</a></li>
<li id="footer-places-about"><a href="index.php/Open-IOV:About.html" title="Open-IOV:About">About Open-IOV</a></li>
<li id="footer-places-disclaimer"><a href="https://open-iov.org/index.php/Open-IOV:General_disclaimer" title="Open-IOV:General disclaimer">Disclaimers</a></li>
</ul>
<ul id="footer-icons" class="noprint">
<li id="footer-poweredbyico"><a href="https://www.mediawiki.org/"><img src="resources/assets/poweredby_mediawiki_88x31.png" alt="Powered by MediaWiki" srcset="resources/assets/poweredby_mediawiki_132x47.png 1.5x, resources/assets/poweredby_mediawiki_176x62.png 2x" width="88" height="31" loading="lazy"/></a></li>
</ul>
</footer>
<script>(RLQ=window.RLQ||[]).push(function(){mw.config.set({"wgBackendResponseTime":72});});</script>
<script>(function(){function c(){var b=a.contentDocument||(a.contentWindow&&a.contentWindow.document);if(b){var d=b.createElement('script');d.innerHTML="window.__CF$cv$params={r:'a39969e0ac5539c9',t:'MTc4OTE1ODQ1MQ=='};var a=document.createElement('script');a.src='/cdn-cgi/challenge-platform/scripts/jsd/main.js';document.getElementsByTagName('head')[0].appendChild(a);";b.getElementsByTagName('head')[0].appendChild(d)}}if(document.body){var a=document.createElement('iframe');a.height=1;a.width=1;a.style.position='absolute';a.style.top=0;a.style.left=0;a.style.border='none';a.style.visibility='hidden';document.body.appendChild(a);if('loading'!==document.readyState)c();else if(window.addEventListener)document.addEventListener('DOMContentLoaded',c);else{var e=document.onreadystatechange||function(){};document.onreadystatechange=function(b){e(b);'loading'!==document.readyState&&(document.onreadystatechange=e,c())}}}})();</script></body></html>
|