]> git.baikalelectronics.ru Git - kernel.git/commit
drm/i915/gvt: protect RO and Rsvd bits of virtual vgpu configuration space
authorChangbin Du <changbin.du@intel.com>
Mon, 6 Mar 2017 09:08:30 +0000 (17:08 +0800)
committerZhenyu Wang <zhenyuw@linux.intel.com>
Mon, 6 Mar 2017 09:29:02 +0000 (17:29 +0800)
commitb5916a25ea08b086790da69be6b3cb895ac9f885
tree14319135e5d499e622869243efda7f67ad239ba8
parentb9670b1539758775dd1487e469016675a0eee8ab
drm/i915/gvt: protect RO and Rsvd bits of virtual vgpu configuration space

Per PCI specification, Configuration Register has different types (RO,
RW, RW1C, Rsvd). For RO Register bits are read-only and cannot be
altered by software. For RW1C Register bits indicate status when read.
A Set bit indicates a status event which is Cleared by writing a 1b.
Writing a 0b to RW1C bits has no effect. Reserved Register is for future
implementations, and they are read-only and must return zero when read.

Current vGPU configuration write emulation just copy the value as it is.
So we haven't emulated RO, RW1C and Rsvd Registers correctly. This patch
is following the Spec to correct emulation logic. We add a function
vgpu_cfg_mem_write to wrap the access to vGPU configuration memory.
The write function uses a RW Register bitmap to avoid RO bits be
overwritten, and emulate RW1C behavior for the particular status Register.

v2:
  new = src[i] --> new = src[i] & mask (zhenyu)

Signed-off-by: Changbin Du <changbin.du@intel.com>
Cc: Xiaoguang Chen <xiaoguang.chen@intel.com>
Cc: Zhiyuan Lv <zhiyuan.lv@intel.com>
Cc: Min He <min.he@intel.com>
Reviewed-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
drivers/gpu/drm/i915/gvt/cfg_space.c