1. 14 10月, 2016 6 次提交
    • Z
      drm/i915/gvt: vGPU PCI configuration space virtualization · 4d60c5fd
      Zhi Wang 提交于
      This patch introduces vGPU PCI configuration space virtualization.
      
      - Adjust the trapped GPFN(Guest Page Frame Number) window of virtual GEN
      PCI BAR 0 when guest initializes PCI BAR 0 address.
      
      - Emulate OpRegion when guest touches OpRegion.
      
      - Pass-through a part of aperture to guest when guest initializes
      aperture BAR.
      Signed-off-by: NZhi Wang <zhi.a.wang@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      4d60c5fd
    • Z
      drm/i915/gvt: vGPU graphics memory virtualization · 2707e444
      Zhi Wang 提交于
      The vGPU graphics memory emulation framework is responsible for graphics
      memory table virtualization. Under virtualization environment, a VM will
      populate the page table entry with guest page frame number(GPFN/GFN), while
      HW needs a page table filled with MFN(Machine frame number). The
      relationship between GFN and MFN(Machine frame number) is managed by
      hypervisor, while GEN HW doesn't have such knowledge to translate a GFN.
      
      To solve this gap, shadow GGTT/PPGTT page table is introdcued.
      
      For GGTT, the GFN inside the guest GGTT page table entry will be translated
      into MFN and written into physical GTT MMIO registers when guest write
      virtual GTT MMIO registers.
      
      For PPGTT, a shadow PPGTT page table will be created and write-protected
      translated from guest PPGTT page table.  And the shadow page table root
      pointers will be written into the shadow context after a guest workload
      is shadowed.
      
      vGPU graphics memory emulation framework consists:
      
      - Per-GEN HW platform page table entry bits extract/de-extract routines.
      - GTT MMIO register emulation handlers, which will call hypercall to do
      GFN->MFN translation when guest write GTT MMIO register
      - PPGTT shadow page table routines, e.g. shadow create/destroy/out-of-sync
      Signed-off-by: NZhi Wang <zhi.a.wang@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      2707e444
    • Z
      drm/i915/gvt: vGPU interrupt virtualization. · c8fe6a68
      Zhi Wang 提交于
      This patch introduces vGPU interrupt emulation framework.
      
      The vGPU intrerrupt emulation framework is an event-based interrupt
      emulation framework. It's responsible for emulating GEN hardware interrupts
      during emulating other HW behaviour.
      
      It consists several components:
      
      - Descriptions of interrupt register bit
      - Upper level <-> lower level interrupt mapping
      - GEN HW IER/IMR/IIR register emulation routines
      - Event-based interrupt propagation interface
      
      When a GVT-g component wants to inject an interrupt to a VM during a
      emulation, first it should specify the event needs to be emulated and the
      framework will deal with the rest of emulation:
      
      - Generating related virtual IIR bit according to virtual IER and IMRs,
      - Generate related virtual upper level virtual IIR bit accodring to the
      per-platform interrupt mapping
      - Injecting a MSI to VM
      Signed-off-by: NZhi Wang <zhi.a.wang@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      c8fe6a68
    • Z
      drm/i915/gvt: golden virtual HW state management · 579cea5f
      Zhi Wang 提交于
      Each vGPU expects a golden virtual HW state, which is just the state after
      system is freshly powered on. GVT-g will try to load the golden virtual HW
      state via kernel firmware interface.
      Signed-off-by: NZhi Wang <zhi.a.wang@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      579cea5f
    • Z
      drm/i915/gvt: Introduce a framework for tracking HW registers. · 12d14cc4
      Zhi Wang 提交于
      This patch introduces a framework for tracking HW registers on different
      GEN platforms.
      
      Accesses to GEN HW registers from VMs will be trapped by hypervisor. It
      will forward these emulation requests to GVT-g device model, which
      requires this framework to search for related register descriptions.
      
      Each MMIO entry in this framework describes a GEN HW registers, e.g.
      offset, length, whether it contains RO bits, whether it can be accessed by
      LRIs...and also emulation handlers for emulating register reading and
      writing.
      
      - Use i915 MMIO register definition & statement.(Joonas)
      Signed-off-by: NZhi Wang <zhi.a.wang@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      12d14cc4
    • Z
      drm/i915/gvt: vGPU HW resource management · 28a60dee
      Zhi Wang 提交于
      This patch introduces the GVT-g vGPU HW resource management. Under
      GVT-g virtualizaion environment, each vGPU requires portions HW
      resources, including aperture, hidden GM space, and fence registers.
      
      When creating a vGPU, GVT-g will request these HW resources from host,
      and return them to host after a vGPU is destroyed.
      Signed-off-by: NZhi Wang <zhi.a.wang@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      28a60dee
  2. 18 6月, 2016 1 次提交
    • Z
      drm/i915: gvt: Introduce the basic architecture of GVT-g · 0ad35fed
      Zhi Wang 提交于
      This patch introduces the very basic framework of GVT-g device model,
      includes basic prototypes, definitions, initialization.
      
      v12:
      - Call intel_gvt_init() in driver early initialization stage. (Chris)
      
      v8:
      - Remove the GVT idr and mutex in intel_gvt_host. (Joonas)
      
      v7:
      - Refine the URL link in Kconfig. (Joonas)
      - Refine the introduction of GVT-g host support in Kconfig. (Joonas)
      - Remove the macro GVT_ALIGN(), use round_down() instead. (Joonas)
      - Make "struct intel_gvt" a data member in struct drm_i915_private.(Joonas)
      	- Remove {alloc, free}_gvt_device()
      	- Rename intel_gvt_{create, destroy}_gvt_device()
      	- Expost intel_gvt_init_host()
      - Remove the dummy "struct intel_gvt" declaration in intel_gvt.h (Joonas)
      
      v6:
      - Refine introduction in Kconfig. (Chris)
      - The exposed API functions will take struct intel_gvt * instead of
      void *. (Chris/Tvrtko)
      - Remove most memebers of strct intel_gvt_device_info. Will add them
      in the device model patches.(Chris)
      - Remove gvt_info() and gvt_err() in debug.h. (Chris)
      - Move GVT kernel parameter into i915_params. (Chris)
      - Remove include/drm/i915_gvt.h, as GVT-g will be built within i915.
      - Remove the redundant struct i915_gvt *, as the functions in i915
      will directly take struct intel_gvt *.
      - Add more comments for reviewer.
      
      v5:
      Take Tvrtko's comments:
      - Fix the misspelled words in Kconfig
      - Let functions take drm_i915_private * instead of struct drm_device *
      - Remove redundant prints/local varible initialization
      
      v3:
      Take Joonas' comments:
      - Change file name i915_gvt.* to intel_gvt.*
      - Move GVT kernel parameter into intel_gvt.c
      - Remove redundant debug macros
      - Change error handling style
      - Add introductions for some stub functions
      - Introduce drm/i915_gvt.h.
      
      Take Kevin's comments:
      - Move GVT-g host/guest check into intel_vgt_balloon in i915_gem_gtt.c
      
      v2:
      - Introduce i915_gvt.c.
      It's necessary to introduce the stubs between i915 driver and GVT-g host,
      as GVT-g components is configurable in kernel config. When disabled, the
      stubs here do nothing.
      
      Take Joonas' comments:
      - Replace boolean return value with int.
      - Replace customized info/warn/debug macros with DRM macros.
      - Document all non-static functions like i915.
      - Remove empty and unused functions.
      - Replace magic number with marcos.
      - Set GVT-g in kernel config to "n" by default.
      Reviewed-by: NJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
      Cc: Kevin Tian <kevin.tian@intel.com>
      Signed-off-by: NZhi Wang <zhi.a.wang@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/1466078825-6662-5-git-send-email-zhi.a.wang@intel.comSigned-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      0ad35fed