Commit 34700631 authored by Min He's avatar Min He Committed by Zhenyu Wang

drm/i915/gvt: fix an issue in emulating cfg space PCI_COMMAND

There's an issue in current cfg space emulation for PCI_COMMAND (offset
0x4): when guest changes some bits other than PCI_COMMAND_MEMORY, this
write operation will not be written to virutal cfg space successfully.

This patch is to fix the wrong behavior above.
Signed-off-by: default avatarMin He <min.he@intel.com>
Signed-off-by: default avatarZhenyu Wang <zhenyuw@linux.intel.com>
parent 8ff842fd
...@@ -123,6 +123,7 @@ static int emulate_pci_command_write(struct intel_vgpu *vgpu, ...@@ -123,6 +123,7 @@ static int emulate_pci_command_write(struct intel_vgpu *vgpu,
u8 changed = old ^ new; u8 changed = old ^ new;
int ret; int ret;
memcpy(vgpu_cfg_space(vgpu) + offset, p_data, bytes);
if (!(changed & PCI_COMMAND_MEMORY)) if (!(changed & PCI_COMMAND_MEMORY))
return 0; return 0;
...@@ -142,7 +143,6 @@ static int emulate_pci_command_write(struct intel_vgpu *vgpu, ...@@ -142,7 +143,6 @@ static int emulate_pci_command_write(struct intel_vgpu *vgpu,
return ret; return ret;
} }
memcpy(vgpu_cfg_space(vgpu) + offset, p_data, bytes);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment