Complete-Single-GPU-Passthrough

<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-primitives-953961b66e63.css" />
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-4430d3c2c150.css" />
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/global-47b8b2ca21ae.css" />
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/github-e72829f5538b.css" />
<meta name="hovercard-subject-tag" content="repository:286278178" data-turbo-transient>
<meta name="google-site-verification" content="Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I">
<meta name="user-login" content="">



<meta name="viewport" content="width=device-width">



  <meta name="description" content="Single GPU VFIO Passthrough Guide. Contribute to QaidVoid/Complete-Single-GPU-Passthrough development by creating an account on GitHub.">

  <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub">

<link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub">
<meta property="fb:app_id" content="1401488693436528">
<meta name="apple-itunes-app" content="app-id=1477376905, app-argument=https://github.com/QaidVoid/Complete-Single-GPU-Passthrough" />

  <meta name="twitter:image" content="https://opengraph.githubassets.com/701d05e0cc0636dda30c62c9fcf2c62e607d9deede83751e8567e71289dfc903/QaidVoid/Complete-Single-GPU-Passthrough" /><meta name="twitter:site" content="@github" /><meta name="twitter:card" content="summary_large_image" /><meta name="twitter:title" content="GitHub - QaidVoid/Complete-Single-GPU-Passthrough: Single GPU VFIO Passthrough Guide" /><meta name="twitter:description" content="Single GPU VFIO Passthrough Guide. Contribute to QaidVoid/Complete-Single-GPU-Passthrough development by creating an account on GitHub." />
  <meta name="hostname" content="github.com">



    <meta name="expected-hostname" content="github.com">
  <meta data-hydrostats="publish">
  <link rel="canonical" href="https://github.com/QaidVoid/Complete-Single-GPU-Passthrough" data-turbo-transient>


<meta name="turbo-body-classes" content="logged-out env-production page-responsive">
<div class="position-relative header-wrapper js-header-wrapper ">
  <a href="#start-of-content" data-skip-target-assigned="false" class="px-2 py-4 color-bg-accent-emphasis color-fg-on-emphasis show-on-focus js-skip-to-content">Skip to content</a>

  <span data-view-component="true" class="progress-pjax-loader Progress position-fixed width-full">
<span style="width: 0%;" data-view-component="true" class="Progress-item progress-pjax-loader-bar left-0 top-0 color-bg-accent-emphasis"></span>

<react-partial
partial-name="keyboard-shortcuts-dialog"
data-ssr="false"
data-attempted-ssr="false"

  <a class="mr-lg-3 color-fg-inherit flex-order-2 js-prevent-focus-on-mobile-nav"
    href="/"
    aria-label="Homepage"
    data-analytics-event="{&quot;category&quot;:&quot;Marketing nav&quot;,&quot;action&quot;:&quot;click to go to homepage&quot;,&quot;label&quot;:&quot;ref_page:Marketing;ref_cta:Logomark;ref_loc:Header&quot;}">
    <svg height="32" aria-hidden="true" viewBox="0 0 24 24" version="1.1" width="32" data-view-component="true" class="octicon octicon-mark-github">
<path d="M12.5.75C6.146.75 1 5.896 1 12.25c0 5.089 3.292 9.387 7.863 10.91.575.101.79-.244.79-.546 0-.273-.014-1.178-.014-2.142-2.889.532-3.636-.704-3.866-1.35-.13-.331-.69-1.352-1.18-1.625-.402-.216-.977-.748-.014-.762.906-.014 1.553.834 1.769 1.179 1.035 1.74 2.688 1.25 3.349.948.1-.747.402-1.25.733-1.538-2.559-.287-5.232-1.279-5.232-5.678 0-1.25.445-2.285 1.178-3.09-.115-.288-.517-1.467.115-3.048 0 0 .963-.302 3.163 1.179.92-.259 1.897-.388 2.875-.388.977 0 1.955.13 2.875.388 2.2-1.495 3.162-1.179 3.162-1.179.633 1.581.23 2.76.115 3.048.733.805 1.179 1.825 1.179 3.09 0 4.413-2.688 5.39-5.247 5.678.417.36.776 1.05.776 2.128 0 1.538-.014 2.774-.014 3.162 0 .302.216.662.79.547C20.709 21.637 24 17.324 24 12.25 24 5.896 18.854.75 12.5.75Z"></path>
  <div class="flex-1 flex-order-2 text-right">
      <a
        href="/login?return_to=https%3A%2F%2Fgithub.com%2FQaidVoid%2FComplete-Single-GPU-Passthrough"
        class="HeaderMenu-link HeaderMenu-button d-inline-flex d-lg-none flex-order-1 f5 no-underline border color-border-default rounded-2 px-2 py-1 color-fg-inherit js-prevent-focus-on-mobile-nav"
        data-hydro-click="{&quot;event_type&quot;:&quot;authentication.click&quot;,&quot;payload&quot;:{&quot;location_in_page&quot;:&quot;site header menu&quot;,&quot;repository_id&quot;:null,&quot;auth_type&quot;:&quot;SIGN_UP&quot;,&quot;originating_url&quot;:&quot;https://github.com/QaidVoid/Complete-Single-GPU-Passthrough&quot;,&quot;user_id&quot;:null}}" data-hydro-click-hmac="e746504cb681d740df7428dab3434ee90628c8ddca4e26f3c0d4c63938931579"
        data-analytics-event="{&quot;category&quot;:&quot;Marketing nav&quot;,&quot;action&quot;:&quot;click to Sign in&quot;,&quot;label&quot;:&quot;ref_page:Marketing;ref_cta:Sign in;ref_loc:Header&quot;}"
      >
        Sign in
      </a>
  </div>
</div>


<div class="HeaderMenu js-header-menu height-fit position-lg-relative d-lg-flex flex-column flex-auto top-0">
  <div class="HeaderMenu-wrapper d-flex flex-column flex-self-start flex-lg-row flex-auto rounded rounded-lg-0">
      <nav class="HeaderMenu-nav" aria-label="Global">
        <ul class="d-lg-flex list-style-none">
            <li class="HeaderMenu-item position-relative flex-wrap flex-justify-between flex-items-center d-block d-lg-flex flex-lg-nowrap flex-lg-items-center js-details-container js-header-menu-item">
  <button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false">
    Product
    <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1">
<path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path>

                <li>
Security
Find and fix vulnerabilities

                <li>
Actions
Automate any workflow

                <li>
Codespaces
Instant dev environments

                <li>
Issues
Plan and track work

                <li>
Code Review
Manage code changes

                <li>
Discussions
Collaborate outside of code

                <li>
Code Search
Find more, search less

            </ul>
          </div>
      </div>
      <div class="HeaderMenu-column px-lg-4">
          <div class="border-bottom pb-3 pb-lg-0 border-lg-bottom-0 border-bottom-0">
                <span class="d-block h4 color-fg-default my-1" id="product-explore-heading">Explore</span>
            <ul class="list-style-none f5" aria-labelledby="product-explore-heading">
                <li>
All features

                <li>
Documentation
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle">
<path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path>
                <li>
GitHub Skills
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle">
<path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path>
                <li>
Blog
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle">
<path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path>
            </ul>
          </div>
      </div>
  </div>
              <li class="HeaderMenu-item position-relative flex-wrap flex-justify-between flex-items-center d-block d-lg-flex flex-lg-nowrap flex-lg-items-center js-details-container js-header-menu-item">
  <button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false">
    Solutions
    <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1">
<path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path>

                <li>
Small and medium teams

                <li>
Startups

            </ul>
          </div>
          <div class="border-bottom pb-3 pb-lg-0 border-lg-bottom-0">
                <span class="d-block h4 color-fg-default my-1" id="solutions-by-use-case-heading">By use case</span>
            <ul class="list-style-none f5" aria-labelledby="solutions-by-use-case-heading">
                <li>
DevSecOps

                <li>
DevOps

                <li>
CI/CD

                <li>
View all use cases

            </ul>
          </div>
      </div>
      <div class="HeaderMenu-column px-lg-4">
          <div class="border-bottom pb-3 pb-lg-0 border-lg-bottom-0">
                <span class="d-block h4 color-fg-default my-1" id="solutions-by-industry-heading">By industry</span>
            <ul class="list-style-none f5" aria-labelledby="solutions-by-industry-heading">
                <li>
Healthcare

                <li>
Financial services

                <li>
Manufacturing

                <li>
Government

                <li>
View all industries

            </ul>
          </div>
      </div>
     <div class="HeaderMenu-trailing-link rounded-bottom-2 flex-shrink-0 mt-lg-4 px-lg-4 py-4 py-lg-3 f5 text-semibold">
        <a href="/solutions">
          View all solutions
          <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-right HeaderMenu-trailing-link-icon">
<path d="M6.22 3.22a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L9.94 8 6.22 4.28a.75.75 0 0 1 0-1.06Z"></path>
              <li class="HeaderMenu-item position-relative flex-wrap flex-justify-between flex-items-center d-block d-lg-flex flex-lg-nowrap flex-lg-items-center js-details-container js-header-menu-item">
  <button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false">
    Resources
    <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1">
<path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path>

                <li>
DevOps

                <li>
Security

                <li>
Software Development

                <li>
View all

            </ul>
          </div>
      </div>
      <div class="HeaderMenu-column px-lg-4">
          <div class="border-bottom pb-3 pb-lg-0 border-lg-bottom-0 border-bottom-0">
                <span class="d-block h4 color-fg-default my-1" id="resources-explore-heading">Explore</span>
            <ul class="list-style-none f5" aria-labelledby="resources-explore-heading">
                <li>
Learning Pathways
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle">
<path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path>
                <li>
White papers, Ebooks, Webinars
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle">
<path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path>
                <li>
Customer Stories

                <li>
Partners
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle">
<path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path>
                <li>
Executive Insights

            </ul>
          </div>
      </div>
  </div>
            <li class="HeaderMenu-item position-relative flex-wrap flex-justify-between flex-items-center d-block d-lg-flex flex-lg-nowrap flex-lg-items-center js-details-container js-header-menu-item">
  <button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false">
    Open Source
    <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1">
<path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path>

            </ul>
          </div>
          <div class="border-bottom pb-3 pb-lg-0 pb-lg-3 mb-3 mb-lg-0 mb-lg-3">
            <ul class="list-style-none f5" >
                <li>
The ReadME Project
GitHub community articles

            </ul>
          </div>
          <div class="border-bottom pb-3 pb-lg-0 border-bottom-0">
                <span class="d-block h4 color-fg-default my-1" id="open-source-repositories-heading">Repositories</span>
            <ul class="list-style-none f5" aria-labelledby="open-source-repositories-heading">
                <li>
Topics

                <li>
Trending

                <li>
Collections

            </ul>
          </div>
      </div>
  </div>
            <li class="HeaderMenu-item position-relative flex-wrap flex-justify-between flex-items-center d-block d-lg-flex flex-lg-nowrap flex-lg-items-center js-details-container js-header-menu-item">
  <button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false">
    Enterprise
    <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1">
<path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path>

            </ul>
          </div>
          <div class="border-bottom pb-3 pb-lg-0 border-bottom-0">
                <span class="d-block h4 color-fg-default my-1" id="enterprise-available-add-ons-heading">Available add-ons</span>
            <ul class="list-style-none f5" aria-labelledby="enterprise-available-add-ons-heading">
                <li>
Advanced Security
Enterprise-grade security features

                <li>
GitHub Copilot
Enterprise-grade AI features

                <li>
Premium Support
Enterprise-grade 24/7 support

            </ul>
          </div>
      </div>
  </div>
            <li class="HeaderMenu-item position-relative flex-wrap flex-justify-between flex-items-center d-block d-lg-flex flex-lg-nowrap flex-lg-items-center js-details-container js-header-menu-item">
<a class="HeaderMenu-link no-underline px-0 px-lg-2 py-3 py-lg-2 d-block d-lg-inline-block" data-analytics-event="{&quot;location&quot;:&quot;navbar&quot;,&quot;action&quot;:&quot;pricing&quot;,&quot;context&quot;:&quot;global&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;label&quot;:&quot;pricing_link_global_navbar&quot;}" href="https://github.com/pricing">Pricing</a>
        </ul>
      </nav>

    <div class="d-flex flex-column flex-lg-row width-full flex-justify-end flex-lg-items-center text-center mt-3 mt-lg-0 text-lg-left ml-lg-3">
            
      </div>
  </button>

<input type="hidden" name="type" class="js-site-search-type-field">

Search code, repositories, users, issues, pull requests...

  </div>
  <template id="search-icon">
    <div class="position-relative">
            <ul
              role="listbox"
              class="ActionListWrap QueryBuilder-ListWrap"
              aria-label="Suggestions"
              data-action="
                combobox-commit:query-builder#comboboxCommit
                mousedown:query-builder#resultsMousedown
              "
              data-target="query-builder.resultsList"
              data-persist-list=false
              id="query-builder-test-results"
            ></ul>
    </div>
  <div class="FormControl-inlineValidation" id="validation-b64f8cdc-0b60-4b3d-881a-16682545bc1d" hidden="hidden">
    <span class="FormControl-inlineValidation--visual">
      <svg aria-hidden="true" height="12" viewBox="0 0 12 12" version="1.1" width="12" data-view-component="true" class="octicon octicon-alert-fill">
<path d="M4.855.708c.5-.896 1.79-.896 2.29 0l4.675 8.351a1.312 1.312 0 0 1-1.146 1.954H1.33A1.313 1.313 0 0 1 .183 9.058ZM7 7V3H5v4Zm-1 3a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"></path>
</div>

Provide feedback

We read every piece of feedback, and take your input very seriously.

<custom-scopes data-target="qbsearch-input.customScopesManager">

Saved searches

Use saved searches to filter your results more quickly

    <div hidden class="create-custom-scope-form" data-target="custom-scopes.createCustomScopeForm">
    <!-- '"` --><!-- </textarea></xmp> --></option></form><form id="custom-scopes-dialog-form" data-turbo="false" action="/search/custom_scopes" accept-charset="UTF-8" method="post"><input type="hidden" data-csrf="true" name="authenticity_token" value="nqJ9Ju/xilxluh8nAc3x3zeKEqok/TTX2xMx+2oN1BWjjVc4lWstX0pehyz9iqgxPqiNujIcm91S0UKr7+A3hA==" />
      <div data-target="custom-scopes.customScopesModalDialogFlash"></div>

      <input type="hidden" id="custom_scope_id" name="custom_scope_id" data-target="custom-scopes.customScopesIdField">

      <div class="form-group">
        <label for="custom_scope_name">Name</label>
        <auto-check src="/search/custom_scopes/check_name" required>
          <input
            type="text"
            name="custom_scope_name"
            id="custom_scope_name"
            data-target="custom-scopes.customScopesNameField"
            class="form-control"
            autocomplete="off"
            placeholder="github-ruby"
            required
            maxlength="50">
          <input type="hidden" data-csrf="true" value="IiZ16JKlyKj7lwb3KboUkWCiKeOrmN/bWuDESgjrmJDGZGlQuGKTKPqdNKXBsWyntgcssbxqpMuyLI16rGX9MA==" />
        </auto-check>
      </div>

      <div class="form-group">
        <label for="custom_scope_query">Query</label>
        <input
          type="text"
          name="custom_scope_query"
          id="custom_scope_query"
          data-target="custom-scopes.customScopesQueryField"
          class="form-control"
          autocomplete="off"
          placeholder="(repo:mona/a OR repo:mona/b) AND lang:python"
          required
          maxlength="500">
      </div>

      <p class="text-small color-fg-muted">
        To see all available qualifiers, see our <a class="Link--inTextBlock" href="https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax">documentation</a>.
      </p>
    <div data-target="custom-scopes.manageCustomScopesForm">
      <div data-target="custom-scopes.list"></div>
    </div>
        <div class="position-relative HeaderMenu-link-wrap d-lg-inline-block">
          <a
            href="/login?return_to=https%3A%2F%2Fgithub.com%2FQaidVoid%2FComplete-Single-GPU-Passthrough"
            class="HeaderMenu-link HeaderMenu-link--sign-in HeaderMenu-button flex-shrink-0 no-underline d-none d-lg-inline-flex border border-lg-0 rounded rounded-lg-0 px-2 py-1"
            style="margin-left: 12px;"
            data-hydro-click="{&quot;event_type&quot;:&quot;authentication.click&quot;,&quot;payload&quot;:{&quot;location_in_page&quot;:&quot;site header menu&quot;,&quot;repository_id&quot;:null,&quot;auth_type&quot;:&quot;SIGN_UP&quot;,&quot;originating_url&quot;:&quot;https://github.com/QaidVoid/Complete-Single-GPU-Passthrough&quot;,&quot;user_id&quot;:null}}" data-hydro-click-hmac="e746504cb681d740df7428dab3434ee90628c8ddca4e26f3c0d4c63938931579"
            data-analytics-event="{&quot;category&quot;:&quot;Marketing nav&quot;,&quot;action&quot;:&quot;click to go to homepage&quot;,&quot;label&quot;:&quot;ref_page:Marketing;ref_cta:Sign in;ref_loc:Header&quot;}"
          >
            Sign in
          </a>
        </div>

          <a href="/signup?ref_cta=Sign+up&amp;ref_loc=header+logged+out&amp;ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E&amp;source=header-repo&amp;source_repo=QaidVoid%2FComplete-Single-GPU-Passthrough"
            class="HeaderMenu-link HeaderMenu-link--sign-up HeaderMenu-button flex-shrink-0 d-flex d-lg-inline-flex no-underline border color-border-default rounded px-2 py-1"
            data-hydro-click="{&quot;event_type&quot;:&quot;authentication.click&quot;,&quot;payload&quot;:{&quot;location_in_page&quot;:&quot;site header menu&quot;,&quot;repository_id&quot;:null,&quot;auth_type&quot;:&quot;SIGN_UP&quot;,&quot;originating_url&quot;:&quot;https://github.com/QaidVoid/Complete-Single-GPU-Passthrough&quot;,&quot;user_id&quot;:null}}" data-hydro-click-hmac="e746504cb681d740df7428dab3434ee90628c8ddca4e26f3c0d4c63938931579"
            data-analytics-event="{&quot;category&quot;:&quot;Sign up&quot;,&quot;action&quot;:&quot;click to sign up for account&quot;,&quot;label&quot;:&quot;ref_page:/&lt;user-name&gt;/&lt;repo-name&gt;;ref_cta:Sign up;ref_loc:header logged out&quot;}"
          >
            Sign up
          </a>
      <button type="button" class="sr-only js-header-menu-focus-trap d-block d-lg-none">Reseting focus</button>
    </div>
  </div>
</div>
  <div hidden="hidden" data-view-component="true" class="js-stale-session-flash stale-session-flash flash flash-warn flash-full">

    <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert">
<path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path>
<button id="icon-button-be6602ad-9660-4dcb-bef7-159124ef95d1" aria-labelledby="tooltip-11af6656-99b5-49f7-a37a-adb183f398e9" type="button" data-view-component="true" class="Button Button--iconOnly Button--invisible Button--medium flash-close js-flash-close">  <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x Button-visual">
<path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path>
Dismiss alert
<div id="js-flash-container" class="flash-container" data-turbo-replace>
</div>
  <div class="d-flex flex-nowrap flex-justify-end mb-3  px-3 px-lg-5" style="gap: 1rem;">

    <div class="flex-auto min-width-0 width-fit">
        
<span></span><span class="Label Label--secondary v-align-middle mr-1">Public</span>
    </div>

    <div id="repository-details-container" class="flex-shrink-0" data-turbo-replace style="max-width: 70%;">
        <ul class="pagehead-actions flex-shrink-0 d-none d-md-inline" style="padding: 2px 0;">

  
  • Notifications You must be signed in to change notification settings
  • Fork 38
  •     </div>
      </div>
    
        <div id="responsive-meta-container" data-turbo-replace>
      <div class="d-block d-md-none mb-2 px-3 px-md-4 px-lg-5">
      <p class="f4 mb-3 ">
        Single GPU VFIO Passthrough Guide
      </p>
    
    
    
    <div class="mb-3">
        <a class="Link--secondary no-underline mr-3" href="/QaidVoid/Complete-Single-GPU-Passthrough/stargazers">
          <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-star mr-1">
    <path d="M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.751.751 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25Zm0 2.445L6.615 5.5a.75.75 0 0 1-.564.41l-3.097.45 2.24 2.184a.75.75 0 0 1 .216.664l-.528 3.084 2.769-1.456a.75.75 0 0 1 .698 0l2.77 1.456-.53-3.084a.75.75 0 0 1 .216-.664l2.24-2.183-3.096-.45a.75.75 0 0 1-.564-.41L8 2.694Z"></path>
    
      <div class="d-flex flex-wrap gap-2">
        <div class="flex-1">
            <div data-view-component="true" class="BtnGroup d-flex">
        <a href="/login?return_to=%2FQaidVoid%2FComplete-Single-GPU-Passthrough" rel="nofollow" data-hydro-click="{&quot;event_type&quot;:&quot;authentication.click&quot;,&quot;payload&quot;:{&quot;location_in_page&quot;:&quot;star button&quot;,&quot;repository_id&quot;:286278178,&quot;auth_type&quot;:&quot;LOG_IN&quot;,&quot;originating_url&quot;:&quot;https://github.com/QaidVoid/Complete-Single-GPU-Passthrough&quot;,&quot;user_id&quot;:null}}" data-hydro-click-hmac="512f1c3d8ba872da8cb7f9dd85a7f98d2597a9f68b02f98a8ef1d4a6dfcefdb5" aria-label="You must be signed in to star a repository" data-view-component="true" class="tooltipped tooltipped-sw btn-sm btn btn-block">    <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-star v-align-text-bottom d-inline-block mr-2">
    <path d="M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.751.751 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25Zm0 2.445L6.615 5.5a.75.75 0 0 1-.564.41l-3.097.45 2.24 2.184a.75.75 0 0 1 .216.664l-.528 3.084 2.769-1.456a.75.75 0 0 1 .698 0l2.77 1.456-.53-3.084a.75.75 0 0 1 .216-.664l2.24-2.183-3.096-.45a.75.75 0 0 1-.564-.41L8 2.694Z"></path>
    


    Star






    Notifications
    You must be signed in to change notification settings

        </div>
        <span>
          
    
        </span>
      </div>
    
          <nav data-pjax="#js-repo-pjax-container" aria-label="Repository" data-view-component="true" class="js-repo-nav js-sidenav-container-pjax js-responsive-underlinenav overflow-hidden UnderlineNav px-3 px-md-4 px-lg-5">
    



  •           <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-issue-opened UnderlineNav-octicon d-none d-sm-inline">
    <path d="M8 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path><path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Z"></path>
    
    Issues 8



  •           <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-git-pull-request UnderlineNav-octicon d-none d-sm-inline">
    <path d="M1.5 3.25a2.25 2.25 0 1 1 3 2.122v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.25 2.25 0 0 1 1.5 3.25Zm5.677-.177L9.573.677A.25.25 0 0 1 10 .854V2.5h1A2.5 2.5 0 0 1 13.5 5v5.628a2.251 2.251 0 1 1-1.5 0V5a1 1 0 0 0-1-1h-1v1.646a.25.25 0 0 1-.427.177L7.177 3.427a.25.25 0 0 1 0-.354ZM3.75 2.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm0 9.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm8.25.75a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Z"></path>
    
    Pull requests



  •           <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-play UnderlineNav-octicon d-none d-sm-inline">
    <path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm4.879-2.773 4.264 2.559a.25.25 0 0 1 0 .428l-4.264 2.559A.25.25 0 0 1 6 10.559V5.442a.25.25 0 0 1 .379-.215Z"></path>
    
    Actions



  •           <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-table UnderlineNav-octicon d-none d-sm-inline">
    <path d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25ZM6.5 6.5v8h7.75a.25.25 0 0 0 .25-.25V6.5Zm8-1.5V1.75a.25.25 0 0 0-.25-.25H6.5V5Zm-13 1.5v7.75c0 .138.112.25.25.25H5v-8ZM5 5V1.5H1.75a.25.25 0 0 0-.25.25V5Z"></path>
    
    Projects



  •           <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-shield UnderlineNav-octicon d-none d-sm-inline">
    <path d="M7.467.133a1.748 1.748 0 0 1 1.066 0l5.25 1.68A1.75 1.75 0 0 1 15 3.48V7c0 1.566-.32 3.182-1.303 4.682-.983 1.498-2.585 2.813-5.032 3.855a1.697 1.697 0 0 1-1.33 0c-2.447-1.042-4.049-2.357-5.032-3.855C1.32 10.182 1 8.566 1 7V3.48a1.75 1.75 0 0 1 1.217-1.667Zm.61 1.429a.25.25 0 0 0-.153 0l-5.25 1.68a.25.25 0 0 0-.174.238V7c0 1.358.275 2.666 1.057 3.86.784 1.194 2.121 2.34 4.366 3.297a.196.196 0 0 0 .154 0c2.245-.956 3.582-2.104 4.366-3.298C13.225 9.666 13.5 8.36 13.5 7V3.48a.251.251 0 0 0-.174-.237l-5.25-1.68ZM8.75 4.75v3a.75.75 0 0 1-1.5 0v-3a.75.75 0 0 1 1.5 0ZM9 10.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path>
    
    Security



  •           <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-graph UnderlineNav-octicon d-none d-sm-inline">
    <path d="M1.5 1.75V13.5h13.75a.75.75 0 0 1 0 1.5H.75a.75.75 0 0 1-.75-.75V1.75a.75.75 0 0 1 1.5 0Zm14.28 2.53-5.25 5.25a.75.75 0 0 1-1.06 0L7 7.06 4.28 9.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.25-3.25a.75.75 0 0 1 1.06 0L10 7.94l4.72-4.72a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Z"></path>
    
    Insights

    QaidVoid/Complete-Single-GPU-Passthrough

    <react-partial
    partial-name="repos-overview"
    data-ssr="true"
    data-attempted-ssr="true"

    Folders and files

    NameName
    Last commit message
    Last commit date

    Latest commit

    History

    73 Commits

    Repository files navigation

    Note: I'm currently not using this, so my ability to provide support is limited. If you encounter issues or have questions about the setup, I recommend asking at r/VFIO.

    Table Of Contents

    Enable & Verify IOMMU

    BIOS Settings
    Enable Intel VT-d or AMD-Vi in BIOS settings. If these options are not present, it is likely that your hardware does not support IOMMU.

    Disable Resizable BAR Support in BIOS settings. Cards that support Resizable BAR can cause problems with black screens following driver load if Resizable BAR is enabled in UEFI/BIOS. There doesn't seem to be a large performance penalty for disabling it, so turn it off for now until ReBAR support is available for KVM.

    Set the kernel paramater depending on your CPU.

    GRUB

    Edit GRUB configuration

    /etc/default/grub
    GRUB_CMDLINE_LINUX_DEFAULT="... intel_iommu=on iommu=pt ..."
    OR
    GRUB_CMDLINE_LINUX_DEFAULT="... amd_iommu=on iommu=pt ..."

    Generate grub.cfg

    grub-mkconfig -o /boot/grub/grub.cfg
    Systemd Boot

    Edit boot entry.

    /boot/loader/entries/*.conf
    options root=UUID=...intel_iommu=on iommu=pt..
    OR
    options root=UUID=...amd_iommu=on iommu=pt..

    Reboot your system for the changes to take effect.

    To verify IOMMU, run the following command.

    dmesg | grep IOMMU

    The output should include the message Intel-IOMMU: enabled for Intel CPUs or AMD-Vi: AMD IOMMUv2 loaded and initialized for AMD CPUs.

    To view the IOMMU groups and attached devices, run the following script:

    #!/bin/bash
    shopt -s nullglob
    for g in `find /sys/kernel/iommu_groups/* -maxdepth 0 -type d | sort -V`; do
        echo "IOMMU Group ${g##*/}:"
        for d in $g/devices/*; do
            echo -e "\t$(lspci -nns ${d##*/})"
        done;
    done;

    When using passthrough, it is necessary to pass every device in the group that includes your GPU.
    You can avoid having to pass everything by using ACS override patch.

    Install required tools

    Gentoo Linux
    emerge -av qemu virt-manager libvirt ebtables dnsmasq
    Arch Linux
    pacman -S qemu libvirt edk2-ovmf virt-manager dnsmasq ebtables
    Fedora
    dnf install @virtualization
    Ubuntu
    apt install qemu-kvm qemu-utils libvirt-daemon-system libvirt-clients bridge-utils virt-manager ovmf

    Enable required services

    SystemD
    systemctl enable --now libvirtd
    OpenRC
    rc-update add libvirtd default
    rc-service libvirtd start

    Sometimes, you might need to start default network manually.

    virsh net-start default
    virsh net-autostart default

    Setup Guest OS

    NOTE: You should replace win10 with your VM's name where applicable
    You should add your user to libvirt group to be able to run VM without root. And, input and kvm group for passing input devices.

    usermod -aG kvm,input,libvirt username

    Download virtio driver.
    Launch virt-manager and create a new virtual machine. Select Customize before install on Final Step.
    In Overview section, set Chipset to Q35, and Firmware to UEFI
    In CPUs section, set CPU model to host-passthrough, and CPU Topology to whatever fits your system.
    For SATA disk of VM, set Disk Bus to virtio.
    In NIC section, set Device Model to virtio
    Add Hardware > CDROM: virtio-win.iso
    Now, Begin Installation. Windows can't detect the virtio disk, so you need to Load Driver and select virtio-iso/amd64/win10 when prompted.
    After successful installation of Windows, install virtio drivers from virtio CDROM. You can then remove virtio iso.

    Attaching PCI devices

    Remove Channel Spice, Display Spice, Video QXL, Sound ich* and other unnecessary devices.
    Now, click on Add Hardware, select PCI Devices and add the PCI Host devices for your GPU's VGA and HDMI Audio.

    Libvirt Hooks

    Libvirt hooks automate the process of running specific tasks during VM state change.
    More info at: PassthroughPost

    Note: Comment Unbind/rebind EFI framebuffer line from start and stop script if you're using AMD 6000 series cards (#9). Also, move the line to unload AMD kernal module below detaching devices from host. These might also apply to older AMD cards.

    Create Libvirt Hook
    mkdir /etc/libvirt/hooks
    touch /etc/libvirt/hooks/qemu
    chmod +x /etc/libvirt/hooks/qemu
    /etc/libvirt/hooks/qemu

    GUEST_NAME="1&quot; HOOK_NAME=&quot;$2&quot; STATE_NAME=&quot;$3&quot; MISC=&quot;{@:4}"

    BASEDIR="$(dirname $0)"

    HOOKPATH="GUEST_NAME/STATE_NAME"
    set -e # If a script exits with an error, we should as well.

    if [ -f "$HOOKPATH" ]; then
    eval &quot;"HOOKPATH&quot;\&quot; &quot;@"
    elif [ -d "$HOOKPATH" ]; then
    while read file; do
    eval &quot;"file&quot;\&quot; &quot;@"
    done <<< "(find -L &quot;HOOKPATH" -maxdepth 1 -type f -executable -print;)"
    fi">

    #!/bin/bash

    GUEST_NAME="{@:4}"

    BASEDIR="$(dirname $0)"

    HOOKPATH="GUEST_NAME/STATE_NAME"
    set -e # If a script exits with an error, we should as well.

    if [ -f "$HOOKPATH" ]; then
    eval ""@"
    elif [ -d "$HOOKPATH" ]; then
    while read file; do
    eval ""@"
    done <<< "HOOKPATH" -maxdepth 1 -type f -executable -print;)"
    fi

    Create Start Script
    mkdir -p /etc/libvirt/hooks/qemu.d/win10/prepare/begin
    touch /etc/libvirt/hooks/qemu.d/win10/prepare/begin/start.sh
    chmod +x /etc/libvirt/hooks/qemu.d/win10/prepare/begin/start.sh

    Note: If you're on KDE Plasma (Wayland), you need to terminate user services alongside display-manager (#31).

    /etc/libvirt/hooks/qemu.d/win10/prepare/begin/start.sh
    1. Stop display manager
      systemctl stop display-manager

    2. systemctl --user -M YOUR_USERNAME@ stop plasma*

    3. Unbind VTconsoles: might not be needed
      echo 0 > /sys/class/vtconsole/vtcon0/bind
      echo 0 > /sys/class/vtconsole/vtcon1/bind

    4. Unbind EFI Framebuffer
      echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/unbind

    5. Unload NVIDIA kernel modules
      modprobe -r nvidia_drm nvidia_modeset nvidia_uvm nvidia

    6. Unload AMD kernel module

    7. modprobe -r amdgpu

    8. Detach GPU devices from host

    9. Use your GPU and HDMI Audio PCI host device
      virsh nodedev-detach pci_0000_01_00_0
      virsh nodedev-detach pci_0000_01_00_1

    10. Load vfio module
      modprobe vfio-pci">

      #!/bin/bash
      set -x

    # Stop display manager
    systemctl stop display-manager
    # systemctl --user -M YOUR_USERNAME@ stop plasma*

    # Unbind VTconsoles: might not be needed
    echo 0 > /sys/class/vtconsole/vtcon0/bind
    echo 0 > /sys/class/vtconsole/vtcon1/bind

    # Unbind EFI Framebuffer
    echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/unbind

    # Unload NVIDIA kernel modules
    modprobe -r nvidia_drm nvidia_modeset nvidia_uvm nvidia

    # Unload AMD kernel module
    # modprobe -r amdgpu

    # Detach GPU devices from host
    # Use your GPU and HDMI Audio PCI host device
    virsh nodedev-detach pci_0000_01_00_0
    virsh nodedev-detach pci_0000_01_00_1

    # Load vfio module
    modprobe vfio-pci

    Create Stop Script
    mkdir -p /etc/libvirt/hooks/qemu.d/win10/release/end
    touch /etc/libvirt/hooks/qemu.d/win10/release/end/stop.sh
    chmod +x /etc/libvirt/hooks/qemu.d/win10/release/end/stop.sh
    /etc/libvirt/hooks/qemu.d/win10/release/end/stop.sh
    1. Attach GPU devices to host

    2. Use your GPU and HDMI Audio PCI host device
      virsh nodedev-reattach pci_0000_01_00_0
      virsh nodedev-reattach pci_0000_01_00_1

    3. Unload vfio module
      modprobe -r vfio-pci

    4. Load AMD kernel module
      #modprobe amdgpu

    5. Rebind framebuffer to host
      echo "efi-framebuffer.0" > /sys/bus/platform/drivers/efi-framebuffer/bind

    6. Load NVIDIA kernel modules
      modprobe nvidia_drm
      modprobe nvidia_modeset
      modprobe nvidia_uvm
      modprobe nvidia

    7. Bind VTconsoles: might not be needed
      echo 1 > /sys/class/vtconsole/vtcon0/bind
      echo 1 > /sys/class/vtconsole/vtcon1/bind

    8. Restart Display Manager
      systemctl start display-manager">

      #!/bin/bash
      set -x

    # Attach GPU devices to host
    # Use your GPU and HDMI Audio PCI host device
    virsh nodedev-reattach pci_0000_01_00_0
    virsh nodedev-reattach pci_0000_01_00_1

    # Unload vfio module
    modprobe -r vfio-pci

    # Load AMD kernel module
    #modprobe amdgpu

    # Rebind framebuffer to host
    echo "efi-framebuffer.0" > /sys/bus/platform/drivers/efi-framebuffer/bind

    # Load NVIDIA kernel modules
    modprobe nvidia_drm
    modprobe nvidia_modeset
    modprobe nvidia_uvm
    modprobe nvidia

    # Bind VTconsoles: might not be needed
    echo 1 > /sys/class/vtconsole/vtcon0/bind
    echo 1 > /sys/class/vtconsole/vtcon1/bind

    # Restart Display Manager
    systemctl start display-manager

    Keyboard/Mouse Passthrough

    In order to be able to use keyboard/mouse in the VM, you can either passthrough the USB Host device or use Evdev passthrough.

    Using USB Host Device is simple,
    Add Hardware > USB Host Device, add your keyboard and mouse device.

    For Evdev passthrough, follow these steps:
    Modify libvirt configuration of your VM.
    Note: Save only after adding keyboard and mouse devices or the changes gets lost.
    Change first line to:

    virsh edit win10
    <domain type='kvm' xmlns:qemu='http:_libvirt.org/schemas/domain/qemu/1.0'>

    Find your keyboard and mouse devices in /dev/input/by-id. You'd generally use the devices ending with event-kbd and event-mouse. And the devices in your configuration right before closing </domain> tag.
    Replace MOUSE_NAME and KEYBOARD_NAME with your device id.

    virsh edit win10
    ...
      <qemu:commandline>
        <qemu:arg value='-object'/>
        <qemu:arg value='input-linux,id=mouse1,evdev=/dev/input/by-id/MOUSE_NAME'/>
        <qemu:arg value='-object'/>
        <qemu:arg value='input-linux,id=kbd1,evdev=/dev/input/by-id/KEYBOARD_NAME,grab_all=on,repeat=on'/>
      </qemu:commandline>
    </domain>

    You need to include these devices in your qemu config.

    /etc/libvirt/qemu.conf
    ...
    user = "YOUR_USERNAME"
    group = "kvm"
    ...
    cgroup_device_acl = [
        "/dev/input/by-id/KEYBOARD_NAME",
        "/dev/input/by-id/MOUSE_NAME",
        "/dev/null", "/dev/full", "/dev/zero",
        "/dev/random", "/dev/urandom",
        "/dev/ptmx", "/dev/kvm", "/dev/kqemu",
        "/dev/rtc","/dev/hpet", "/dev/sev"
    ]
    ...

    Also, switch from PS/2 devices to virtio devices. Add the devices inside <devices> block

    virsh edit win10
    ...
    <devices>
      ...
      <input type='mouse' bus='virtio'/>
      <input type='keyboard' bus='virtio'/>
      ...
    </devices>
    ...

    Audio Passthrough

    VM's audio can be routed to the host using Pipewire or Pulseaudio.
    You can also use Scream instead.

    Pipewire

    From ArchWiki

    You need to have Pipewire with JACK support.

    Note: You may use Carla to figure out appropriate input/output. Replace 1000 with your current user id.

    virsh edit win10
    ...
      <devices>
        ...
        <audio id="1" type="jack">
          <input clientName="win10" connectPorts="your-input"/>
          <output clientName="win10" connectPorts="your-output"/>
        </audio>
      </devices>
      <qemu:commandline>
        <qemu:env name="PIPEWIRE_RUNTIME_DIR" value="/run/user/1000"/>
        <qemu:env name="PIPEWIRE_LATENCY" value="512/48000"/>
      </qemu:commandline>
    </domain>
    Pulseaudio

    Note: Replace 1000 with your current user id.

    virsh edit win10
    ...
      <qemu:commandline>
        ...
        <qemu:arg value="-device"/>
        <qemu:arg value="ich9-intel-hda,bus=pcie.0,addr=0x1b"/>
        <qemu:arg value="-device"/>
        <qemu:arg value="hda-micro,audiodev=hda"/>
        <qemu:arg value="-audiodev"/>
        <qemu:arg value="pa,id=hda,server=/run/user/1000/pulse/native"/>
      </qemu:commandline>
    </domain>

    Video card driver virtualisation detection

    Video Card drivers refuse to run in Virtual Machine, so you need to spoof Hyper-V Vendor ID.

    virsh edit win10
    ...
    <features>
      ...
      <hyperv>
        ...
        <vendor_id state='on' value='whatever'/>
        ...
      </hyperv>
      ...
    </features>
    ...

    NVIDIA guest drivers also require hiding the KVM CPU leaf:

    virsh edit win10
    ...
    <features>
      ...
      <kvm>
        <hidden state='on'/>
      </kvm>
      ...
    </features>
    ...

    vBIOS Patching

    NOTE: You are only making changes on dumped ROM file. Your hardware is safe.
    While most of the GPU can be passed with stock vBIOS, some GPU requires vBIOS patching to passthrough.
    In order to patch vBIOS, you need to first dump the GPU vBIOS from your system.
    If you have Windows installed, you can use GPU-Z to dump vBIOS.
    To dump vBIOS on Linux, you can use following command (replace PCI id with yours):

    echo 1 > /sys/bus/pci/devices/0000:01:00.0/rom
    cat /sys/bus/pci/devices/0000:01:00.0/rom > path/to/dump/vbios.rom
    echo 0 > /sys/bus/pci/devices/0000:01:00.0/rom

    If you're not in root shell, you should use the above commands with sudo as:

    echo 1 | sudo tee /sys/bus/pci/devices/0000:01:00.0/rom
    sudo cat /sys/bus/pci/devices/0000:01:00.0/rom > path/to/dump/vbios.rom
    echo 0 | sudo tee /sys/bus/pci/devices/0000:01:00.0/rom

    To patch vBIOS, you need to use Hex Editor (eg., Okteta) and trim unnecessary header.
    For NVIDIA GPU, using hex editor, search string “VIDEO”, and remove everything before HEX value 55.
    I'm not sure about AMD, but the process should be similar.

    To use patched vBIOS, edit VM's configuration to include patched vBIOS inside hostdev block of VGA

    virsh edit win10
    ...
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <source>
        ...
      </source>
      <rom file='/home/me/patched.rom'/>
      ...
    </hostdev>
    ...
      <input type="hidden" data-csrf="true" value="joLjV5sZh1fgmTlB3trW/+k0vp93fy8o7zaspVEfSHbGrnht4+Lae8jlVTkB3NPM4cn7/bAVy4Kmtg0LH3+ZzA==" />
    
      <div class="BorderGrid about-margin" data-pjax>
        <div class="BorderGrid-row">
          <div class="BorderGrid-cell">
            <div class="hide-sm hide-md">
    

    About

      <p class="f4 my-3">
        Single GPU VFIO Passthrough Guide
      </p>
    
    <h3 class="sr-only">Topics</h3>
    <div class="my-3">
        <div class="f6">
      <a data-ga-click="Topic, repository page" data-octo-click="topic_click" data-octo-dimensions="topic:linux" href="/topics/linux" title="Topic: linux" data-view-component="true" class="topic-tag topic-tag-link">
    
    </div>
    
    <h3 class="sr-only">Resources</h3>
    <div class="mt-2">
      <a class="Link--muted" data-analytics-event="{&quot;category&quot;:&quot;Repository Overview&quot;,&quot;action&quot;:&quot;click&quot;,&quot;label&quot;:&quot;location:sidebar;file:readme&quot;}" href="#readme-ov-file">
        <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-book mr-2">
    <path d="M0 1.75A.75.75 0 0 1 .75 1h4.253c1.227 0 2.317.59 3 1.501A3.743 3.743 0 0 1 11.006 1h4.245a.75.75 0 0 1 .75.75v10.5a.75.75 0 0 1-.75.75h-4.507a2.25 2.25 0 0 0-1.591.659l-.622.621a.75.75 0 0 1-1.06 0l-.622-.621A2.25 2.25 0 0 0 5.258 13H.75a.75.75 0 0 1-.75-.75Zm7.251 10.324.004-5.073-.002-2.253A2.25 2.25 0 0 0 5.003 2.5H1.5v9h3.757a3.75 3.75 0 0 1 1.994.574ZM8.755 4.75l-.004 7.322a3.752 3.752 0 0 1 1.992-.572H14.5v-9h-3.495a2.25 2.25 0 0 0-2.25 2.25Z"></path>
    
    Readme

    Stars

    Watchers

    Forks

    <div class="mt-2">
      <a class="Link--muted" href="/contact/report-content?content_url=https%3A%2F%2Fgithub.com%2FQaidVoid%2FComplete-Single-GPU-Passthrough&amp;report=QaidVoid+%28user%29">
          Report repository
    

          </div>
        </div>
    
        
        
        
        
            <div class="BorderGrid-row" hidden>
              <div class="BorderGrid-cell">
                <include-fragment src="/QaidVoid/Complete-Single-GPU-Passthrough/used_by_list" accept="text/fragment+html">
    
            <div class="BorderGrid-row">
              <div class="BorderGrid-cell">
                <h2 class="h4 mb-3">
    
              </div>
            </div>
    
        
        
            <div class="BorderGrid-row">
              <div class="BorderGrid-cell">
                <h2 class="h4 mb-3">Languages</h2>
    
              </div>
            </div>
    
              </div>
    
    </main>
    
          <footer class="footer pt-8 pb-6 f6 color-fg-muted p-responsive" role="contentinfo" >
    
    © 2024 GitHub, Inc.
    <nav aria-label="Footer">
      <h3 class="sr-only" id="sr-footer-heading">Footer navigation</h3>
    
      <ul class="list-style-none d-flex flex-justify-center flex-wrap mb-2 mb-lg-0" aria-labelledby="sr-footer-heading">
    
          <li class="mx-2">
            <a data-analytics-event="{&quot;category&quot;:&quot;Footer&quot;,&quot;action&quot;:&quot;go to Terms&quot;,&quot;label&quot;:&quot;text:terms&quot;}" href="https://docs.github.com/site-policy/github-terms/github-terms-of-service" data-view-component="true" class="Link--secondary Link">Terms</a>
          </li>
    
          <li class="mx-2">
            <a data-analytics-event="{&quot;category&quot;:&quot;Footer&quot;,&quot;action&quot;:&quot;go to privacy&quot;,&quot;label&quot;:&quot;text:privacy&quot;}" href="https://docs.github.com/site-policy/privacy-policies/github-privacy-statement" data-view-component="true" class="Link--secondary Link">Privacy</a>
          </li>
    
          <li class="mx-2">
            <a data-analytics-event="{&quot;category&quot;:&quot;Footer&quot;,&quot;action&quot;:&quot;go to security&quot;,&quot;label&quot;:&quot;text:security&quot;}" href="https://github.com/security" data-view-component="true" class="Link--secondary Link">Security</a>
          </li>
    
          <li class="mx-2">
            <a data-analytics-event="{&quot;category&quot;:&quot;Footer&quot;,&quot;action&quot;:&quot;go to status&quot;,&quot;label&quot;:&quot;text:status&quot;}" href="https://www.githubstatus.com/" data-view-component="true" class="Link--secondary Link">Status</a>
          </li>
    
          <li class="mx-2">
            <a data-analytics-event="{&quot;category&quot;:&quot;Footer&quot;,&quot;action&quot;:&quot;go to docs&quot;,&quot;label&quot;:&quot;text:docs&quot;}" href="https://docs.github.com/" data-view-component="true" class="Link--secondary Link">Docs</a>
          </li>
    
          <li class="mx-2">
            <a data-analytics-event="{&quot;category&quot;:&quot;Footer&quot;,&quot;action&quot;:&quot;go to contact&quot;,&quot;label&quot;:&quot;text:contact&quot;}" href="https://support.github.com?tags=dotcom-footer" data-view-component="true" class="Link--secondary Link">Contact</a>
          </li>
    
          <li class="mx-2" >
    
  •   </ul>
    </nav>
    
    <ghcc-consent id="ghcc" class="position-fixed bottom-0 left-0" style="z-index: 999999" data-initial-cookie-consent-allowed="" data-cookie-consent-required="false"></ghcc-consent>
    
    <template id="site-details-dialog">
    
    <div class="Popover js-hovercard-content position-absolute" style="display: none; outline: none;">
    
    <template id="snippet-clipboard-copy-button">
    
    </div>
    
    <div id="js-global-screen-reader-notice" class="sr-only mt-n1" aria-live="polite" aria-atomic="true" ></div>
    <div id="js-global-screen-reader-notice-assertive" class="sr-only mt-n1" aria-live="assertive" aria-atomic="true"></div>