KVM: PPC: Book3S HV: In H_SVM_INIT_DONE, migrate remaining normal-GFNs to secure...
authorRam Pai <linuxram@us.ibm.com>
Mon, 27 Jul 2020 18:07:17 +0000 (11:07 -0700)
committerPaul Mackerras <paulus@ozlabs.org>
Tue, 28 Jul 2020 02:34:52 +0000 (12:34 +1000)
commitdfaa973ae9605e1731eaef9f30c2b056346a4efc
treede96792abf1078069813e431eeee80e26ef6fa7a
parent651a6310111ef8e09394e77d6d959ab3d066930d
KVM: PPC: Book3S HV: In H_SVM_INIT_DONE, migrate remaining normal-GFNs to secure-GFNs

The Ultravisor is expected to explicitly call H_SVM_PAGE_IN for all the
pages of the SVM before calling H_SVM_INIT_DONE. This causes a huge
delay in tranistioning the VM to SVM. The Ultravisor is only interested
in the pages that contain the kernel, initrd and other important data
structures. The rest contain throw-away content.

However if not all pages are requested by the Ultravisor, the Hypervisor
continues to consider the GFNs corresponding to the non-requested pages
as normal GFNs. This can lead to data-corruption and undefined behavior.

In H_SVM_INIT_DONE handler, move all the PFNs associated with the SVM's
GFNs to secure-PFNs. Skip the GFNs that are already Paged-in or Shared
or Paged-in followed by a Paged-out.

Reviewed-by: Bharata B Rao <bharata@linux.ibm.com>
Signed-off-by: Ram Pai <linuxram@us.ibm.com>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Documentation/powerpc/ultravisor.rst
arch/powerpc/kvm/book3s_hv_uvmem.c