/* * Copyright(c) 2011-2016 Intel Corporation. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Authors: * Eddie Dong <[email protected]> * Kevin Tian <[email protected]> * * Contributors: * Zhi Wang <[email protected]> * Changbin Du <[email protected]> * Zhenyu Wang <[email protected]> * Tina Zhang <[email protected]> * Bing Niu <[email protected]> * */ #include "i915_drv.h" #include "i915_reg.h" #include "gt/intel_context.h" #include "gt/intel_engine_regs.h" #include "gt/intel_gpu_commands.h" #include "gt/intel_gt_regs.h" #include "gt/intel_ring.h" #include "gvt.h" #include "trace.h" #define GEN9_MOCS_SIZE … struct engine_mmio { … }; /* Raw offset is appened to each line for convenience. */ static struct engine_mmio gen8_engine_mmio_list[] __cacheline_aligned = …; static struct engine_mmio gen9_engine_mmio_list[] __cacheline_aligned = …; static struct { … } gen9_render_mocs; static u32 gen9_mocs_mmio_offset_list[] = …; static void load_render_mocs(const struct intel_engine_cs *engine) { … } static int restore_context_mmio_for_inhibit(struct intel_vgpu *vgpu, struct i915_request *req) { … } static int restore_render_mocs_control_for_inhibit(struct intel_vgpu *vgpu, struct i915_request *req) { … } static int restore_render_mocs_l3cc_for_inhibit(struct intel_vgpu *vgpu, struct i915_request *req) { … } /* * Use lri command to initialize the mmio which is in context state image for * inhibit context, it contains tracked engine mmio, render_mocs and * render_mocs_l3cc. */ int intel_vgpu_restore_inhibit_context(struct intel_vgpu *vgpu, struct i915_request *req) { … } static u32 gen8_tlb_mmio_offset_list[] = …; static void handle_tlb_pending_event(struct intel_vgpu *vgpu, const struct intel_engine_cs *engine) { … } static void switch_mocs(struct intel_vgpu *pre, struct intel_vgpu *next, const struct intel_engine_cs *engine) { … } #define CTX_CONTEXT_CONTROL_VAL … bool is_inhibit_context(struct intel_context *ce) { … } /* Switch ring mmio values (context). */ static void switch_mmio(struct intel_vgpu *pre, struct intel_vgpu *next, const struct intel_engine_cs *engine) { … } /** * intel_gvt_switch_mmio - switch mmio context of specific engine * @pre: the last vGPU that own the engine * @next: the vGPU to switch to * @engine: the engine * * If pre is null indicates that host own the engine. If next is null * indicates that we are switching to host workload. */ void intel_gvt_switch_mmio(struct intel_vgpu *pre, struct intel_vgpu *next, const struct intel_engine_cs *engine) { … } /** * intel_gvt_init_engine_mmio_context - Initiate the engine mmio list * @gvt: GVT device * */ void intel_gvt_init_engine_mmio_context(struct intel_gvt *gvt) { … }