* [PATCH 1/1] KVM: MMU: Map device MMIO as UC in EPT
@ 2009-01-21 8:52 Sheng Yang
2009-01-21 9:03 ` Avi Kivity
0 siblings, 1 reply; 2+ messages in thread
From: Sheng Yang @ 2009-01-21 8:52 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm, Sheng Yang
Software are not allow to access device MMIO using cacheable memory type, the
patch limit MMIO region with UC and WC(guest can select WC using PAT and
PCD/PWT).
Signed-off-by: Sheng Yang <sheng@linux.intel.com>
---
arch/x86/kvm/mmu.c | 9 +++++++--
arch/x86/kvm/vmx.c | 3 +--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 0798610..ef060ec 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -1712,8 +1712,13 @@ static int set_spte(struct kvm_vcpu *vcpu, u64 *shadow_pte,
if (largepage)
spte |= PT_PAGE_SIZE_MASK;
if (mt_mask) {
- mt_mask = get_memory_type(vcpu, gfn) <<
- kvm_x86_ops->get_mt_mask_shift();
+ if (!kvm_is_mmio_pfn(pfn)) {
+ mt_mask = get_memory_type(vcpu, gfn) <<
+ kvm_x86_ops->get_mt_mask_shift();
+ mt_mask |= VMX_EPT_IGMT_BIT;
+ } else
+ mt_mask = MTRR_TYPE_UNCACHABLE <<
+ kvm_x86_ops->get_mt_mask_shift();
spte |= mt_mask;
}
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 9b56d21..73e8fd9 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -3782,8 +3782,7 @@ static int __init vmx_init(void)
if (vm_need_ept()) {
bypass_guest_pf = 0;
kvm_mmu_set_base_ptes(VMX_EPT_READABLE_MASK |
- VMX_EPT_WRITABLE_MASK |
- VMX_EPT_IGMT_BIT);
+ VMX_EPT_WRITABLE_MASK);
kvm_mmu_set_mask_ptes(0ull, 0ull, 0ull, 0ull,
VMX_EPT_EXECUTABLE_MASK,
VMX_EPT_DEFAULT_MT << VMX_EPT_MT_EPTE_SHIFT);
--
1.5.4.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] KVM: MMU: Map device MMIO as UC in EPT
2009-01-21 8:52 [PATCH 1/1] KVM: MMU: Map device MMIO as UC in EPT Sheng Yang
@ 2009-01-21 9:03 ` Avi Kivity
0 siblings, 0 replies; 2+ messages in thread
From: Avi Kivity @ 2009-01-21 9:03 UTC (permalink / raw)
To: Sheng Yang; +Cc: kvm
Sheng Yang wrote:
> Software are not allow to access device MMIO using cacheable memory type, the
> patch limit MMIO region with UC and WC(guest can select WC using PAT and
> PCD/PWT).
>
Applied, thanks.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-01-21 9:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-21 8:52 [PATCH 1/1] KVM: MMU: Map device MMIO as UC in EPT Sheng Yang
2009-01-21 9:03 ` Avi Kivity
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox