KVM: SVM: Flush when freeing encrypted pages even on SME_COHERENT CPUs
authorMingwei Zhang <mizhang@google.com>
Thu, 21 Apr 2022 03:14:06 +0000 (03:14 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Apr 2022 12:39:00 +0000 (14:39 +0200)
commit4bbd693d9f0ac81e3b3ea97ab2201424061df96c
treefd386db0f2ef6c65212ec671724b4d629cb0326d
parent8b2da96904895cb9f82c64e8ee428ddb15d040da
KVM: SVM: Flush when freeing encrypted pages even on SME_COHERENT CPUs

commit d45829b351ee6ec5f54dd55e6aca1f44fe239fe6 upstream.

Use clflush_cache_range() to flush the confidential memory when
SME_COHERENT is supported in AMD CPU. Cache flush is still needed since
SME_COHERENT only support cache invalidation at CPU side. All confidential
cache lines are still incoherent with DMA devices.

Cc: stable@vger.kerel.org
Fixes: add5e2f04541 ("KVM: SVM: Add support for the SEV-ES VMSA")
Reviewed-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Mingwei Zhang <mizhang@google.com>
Message-Id: <20220421031407.2516575-3-mizhang@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kvm/svm/sev.c