* With SNP+gmem, private/encrypted memory is unreachable via the
* hva-based mmu notifiers, i.e. these events are explicitly scoped to
* shared pages, where there's no need to flush caches.
+ *
+ * Checking for SEV+ outside of kvm->lock is safe as __sev_guest_init()
+ * can only be done before vCPUs are created, caches can be incoherent
+ * if and only if a vCPU was run, and either this task will see the VM
+ * as being SEV+ or the vCPU won't be to access the memory (because of
+ * the in-progress invalidation).
*/
- if (!sev_guest(kvm) || sev_snp_guest(kvm))
+ if (!____sev_guest(kvm) || ____sev_snp_guest(kvm))
return;
sev_writeback_caches(kvm);