/* * 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]> * Jike Song <[email protected]> * * Contributors: * Zhi Wang <[email protected]> * Min He <[email protected]> * Bing Niu <[email protected]> * */ #include "i915_drv.h" #include "gvt.h" #include "intel_pci_config.h" enum { … }; /* bitmap for writable bits (RW or RW1C bits, but cannot co-exist in one * byte) byte by byte in standard pci configuration space. (not the full * 256 bytes.) */ static const u8 pci_cfg_space_rw_bmp[PCI_INTERRUPT_LINE + 4] = …; /** * vgpu_pci_cfg_mem_write - write virtual cfg space memory * @vgpu: target vgpu * @off: offset * @src: src ptr to write * @bytes: number of bytes * * Use this function to write virtual cfg space memory. * For standard cfg space, only RW bits can be changed, * and we emulates the RW1C behavior of PCI_STATUS register. */ static void vgpu_pci_cfg_mem_write(struct intel_vgpu *vgpu, unsigned int off, u8 *src, unsigned int bytes) { … } /** * intel_vgpu_emulate_cfg_read - emulate vGPU configuration space read * @vgpu: target vgpu * @offset: offset * @p_data: return data ptr * @bytes: number of bytes to read * * Returns: * Zero on success, negative error code if failed. */ int intel_vgpu_emulate_cfg_read(struct intel_vgpu *vgpu, unsigned int offset, void *p_data, unsigned int bytes) { … } static void map_aperture(struct intel_vgpu *vgpu, bool map) { … } static void trap_gttmmio(struct intel_vgpu *vgpu, bool trap) { … } static int emulate_pci_command_write(struct intel_vgpu *vgpu, unsigned int offset, void *p_data, unsigned int bytes) { … } static int emulate_pci_rom_bar_write(struct intel_vgpu *vgpu, unsigned int offset, void *p_data, unsigned int bytes) { … } static void emulate_pci_bar_write(struct intel_vgpu *vgpu, unsigned int offset, void *p_data, unsigned int bytes) { … } /** * intel_vgpu_emulate_cfg_write - emulate vGPU configuration space write * @vgpu: target vgpu * @offset: offset * @p_data: write data ptr * @bytes: number of bytes to write * * Returns: * Zero on success, negative error code if failed. */ int intel_vgpu_emulate_cfg_write(struct intel_vgpu *vgpu, unsigned int offset, void *p_data, unsigned int bytes) { … } /** * intel_vgpu_init_cfg_space - init vGPU configuration space when create vGPU * * @vgpu: a vGPU * @primary: is the vGPU presented as primary * */ void intel_vgpu_init_cfg_space(struct intel_vgpu *vgpu, bool primary) { … } /** * intel_vgpu_reset_cfg_space - reset vGPU configuration space * * @vgpu: a vGPU * */ void intel_vgpu_reset_cfg_space(struct intel_vgpu *vgpu) { … }