mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 04:18:39 +08:00
Do not always honor guest PAT on CPUs that support self-snoop.
This triggers an issue in the bochsdrm driver, which used ioremap() instead of ioremap_wc() to map the video RAM. The revert lets video RAM use the WB memory type instead of the slower UC memory type. -----BEGIN PGP SIGNATURE----- iQFIBAABCAAyFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAmbmhVcUHHBib256aW5p QHJlZGhhdC5jb20ACgkQv/vSX3jHroPC8gf9GT8ynM3/+csYTKKvJ3acvhvFoIl0 xzptkWh9tal7H1jPG+BFq44o8DbAcb9u5pxPng9ng5ojmPwticBRWt6dpWyKurTm WKT2JRCV/6/sPDu8WrMLli9c/9P85ETFAyAPyr4CO4/rPg173qtLT5zxWjsLi0xz ZtVdAdHj041skYH8REYyRm2zolq/PIj7TWWAYZVRWgX2AkQeRq//g51MpBgLfbYt BNL7TLqpaD3ZSNHXsTZDn3c1jh9VnPGFPa+QSq2a6JgPPqCuJzs7RpPwMzTRlkoT agdRf8Wj082u1kqMGCHLXHGQybevauLs+yQYRkojpxj774PPNzH3kEGOEA== =9Eo3 -----END PGP SIGNATURE----- Merge tag 'for-linus-6.11' of git://git.kernel.org/pub/scm/virt/kvm/kvm Pull kvm fix from Paolo Bonzini: "Do not always honor guest PAT on CPUs that support self-snoop. This triggers an issue in the bochsdrm driver, which used ioremap() instead of ioremap_wc() to map the video RAM. The revert lets video RAM use the WB memory type instead of the slower UC memory type" * tag 'for-linus-6.11' of git://git.kernel.org/pub/scm/virt/kvm/kvm: Revert "KVM: VMX: Always honor guest PAT on CPUs that support self-snoop"
This commit is contained in:
commit
d42f7708e2
@ -4674,16 +4674,14 @@ out_unlock:
|
|||||||
bool kvm_mmu_may_ignore_guest_pat(void)
|
bool kvm_mmu_may_ignore_guest_pat(void)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* When EPT is enabled (shadow_memtype_mask is non-zero), the CPU does
|
* When EPT is enabled (shadow_memtype_mask is non-zero), and the VM
|
||||||
* not support self-snoop (or is affected by an erratum), and the VM
|
|
||||||
* has non-coherent DMA (DMA doesn't snoop CPU caches), KVM's ABI is to
|
* has non-coherent DMA (DMA doesn't snoop CPU caches), KVM's ABI is to
|
||||||
* honor the memtype from the guest's PAT so that guest accesses to
|
* honor the memtype from the guest's PAT so that guest accesses to
|
||||||
* memory that is DMA'd aren't cached against the guest's wishes. As a
|
* memory that is DMA'd aren't cached against the guest's wishes. As a
|
||||||
* result, KVM _may_ ignore guest PAT, whereas without non-coherent DMA,
|
* result, KVM _may_ ignore guest PAT, whereas without non-coherent DMA,
|
||||||
* KVM _always_ ignores or honors guest PAT, i.e. doesn't toggle SPTE
|
* KVM _always_ ignores guest PAT (when EPT is enabled).
|
||||||
* bits in response to non-coherent device (un)registration.
|
|
||||||
*/
|
*/
|
||||||
return !static_cpu_has(X86_FEATURE_SELFSNOOP) && shadow_memtype_mask;
|
return shadow_memtype_mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
int kvm_tdp_page_fault(struct kvm_vcpu *vcpu, struct kvm_page_fault *fault)
|
int kvm_tdp_page_fault(struct kvm_vcpu *vcpu, struct kvm_page_fault *fault)
|
||||||
|
@ -7659,13 +7659,11 @@ u8 vmx_get_mt_mask(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_mmio)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Force WB and ignore guest PAT if the VM does NOT have a non-coherent
|
* Force WB and ignore guest PAT if the VM does NOT have a non-coherent
|
||||||
* device attached and the CPU doesn't support self-snoop. Letting the
|
* device attached. Letting the guest control memory types on Intel
|
||||||
* guest control memory types on Intel CPUs without self-snoop may
|
* CPUs may result in unexpected behavior, and so KVM's ABI is to trust
|
||||||
* result in unexpected behavior, and so KVM's (historical) ABI is to
|
* the guest to behave only as a last resort.
|
||||||
* trust the guest to behave only as a last resort.
|
|
||||||
*/
|
*/
|
||||||
if (!static_cpu_has(X86_FEATURE_SELFSNOOP) &&
|
if (!kvm_arch_has_noncoherent_dma(vcpu->kvm))
|
||||||
!kvm_arch_has_noncoherent_dma(vcpu->kvm))
|
|
||||||
return (MTRR_TYPE_WRBACK << VMX_EPT_MT_EPTE_SHIFT) | VMX_EPT_IPAT_BIT;
|
return (MTRR_TYPE_WRBACK << VMX_EPT_MT_EPTE_SHIFT) | VMX_EPT_IPAT_BIT;
|
||||||
|
|
||||||
return (MTRR_TYPE_WRBACK << VMX_EPT_MT_EPTE_SHIFT);
|
return (MTRR_TYPE_WRBACK << VMX_EPT_MT_EPTE_SHIFT);
|
||||||
|
Loading…
Reference in New Issue
Block a user