]> git.kernelconcepts.de Git - karo-tx-linux.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)
commitc2e04fdab33181b53b5a2f9662b7b607b720f79f
tree14319135e5d499e622869243efda7f67ad239ba8
parent8f1117abb408808af9cc4c948925c726bec4755a
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