crosvm/x86_64
Xiong Zhang 3064a7164a Setup vcpu's MTRR
When vfio pass-through is enabled, guest will be very slow. The root
casue is gfn is uncachable in EPT.

From the comments in kernel vmx_get_mt_mask(vcpu, gfn, is_mmio)
function, EPT memory type with VT-d, VT-d without snooping control
feature: can't guarantee the result, try to trust guest through
kvm_mtrr_get_guest_memory_type(vcpu, gfn).

But crosvm doesn't set mtrr, so host kernel will set uncachable for all
gfn in ept.

This patch set the default cache type as WB, and set mmio cache type as
UC, so the guest ram is WB.

BUG=chromium:992270
TEST=crosvm --vfio /sys/devices/pci0000:00/0000:00:02.0, pass through
host igd into linux guest, the guest runs smoothly and guest desktop
could be shown on physical local display.

Change-Id: I151aae7835910cfbc9e38464ee901e5da281de1e
Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1813458
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2019-11-27 09:04:26 +00:00
..
src Setup vcpu's MTRR 2019-11-27 09:04:26 +00:00
build.rs edition: Remove extern crate lines 2019-04-15 02:06:08 -07:00
Cargo.toml x86_64: replace byteorder with {to,from}_le_bytes() 2019-08-26 23:41:51 +00:00
host_cpuid.c x86_64: fill cache info in cpuid, stop spoofing CPU vendor id 2018-07-09 12:42:42 -07:00