diff mbox series

[v3,4/4] KVM: PPC: Book3S HV: migrate hot plugged memory

Message ID 1592606622-29884-5-git-send-email-linuxram@us.ibm.com (mailing list archive)
State Not Applicable
Headers show
Series Migrate non-migrated pages of a SVM. | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch warning Failed to apply on branch powerpc/merge (c3405d517d606e965030026daec198d314f20195)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch powerpc/next (5b14671be58d0084e7e2d1cc9c2c36a94467f6e0)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch linus/master (4333a9b0b67bb4e8bcd91bdd80da80b0ec151162)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch powerpc/fixes (b55129f97aeefd265314e12d98935330e011a14a)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch linux-next (ce2cc8efd7a40cbd17841add878cb691d0ce0bba)
snowpatch_ozlabs/apply_patch fail Failed to apply to any branch

Commit Message

Ram Pai June 19, 2020, 10:43 p.m. UTC
From: Laurent Dufour <ldufour@linux.ibm.com>

When a memory slot is hot plugged to a SVM, PFNs associated with the
GFNs in that slot must be migrated to the secure-PFNs, aka device-PFNs.

kvmppc_uv_migrate_mem_slot() is called to accomplish this. UV_PAGE_IN
ucall is skipped, since the ultravisor does not trust the content of
those pages and hence ignores it.

Signed-off-by: Laurent Dufour <ldufour@linux.ibm.com>
Signed-off-by: Ram Pai <linuxram@us.ibm.com>
	[resolved conflicts, and modified the commit log]
---
 arch/powerpc/kvm/book3s_hv.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 6717d24..fcea41c 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -4531,10 +4531,12 @@  static void kvmppc_core_commit_memory_region_hv(struct kvm *kvm,
 	case KVM_MR_CREATE:
 		if (kvmppc_uvmem_slot_init(kvm, new))
 			return;
-		uv_register_mem_slot(kvm->arch.lpid,
-				     new->base_gfn << PAGE_SHIFT,
-				     new->npages * PAGE_SIZE,
-				     0, new->id);
+		if (uv_register_mem_slot(kvm->arch.lpid,
+					 new->base_gfn << PAGE_SHIFT,
+					 new->npages * PAGE_SIZE,
+					 0, new->id))
+			return;
+		kvmppc_uv_migrate_mem_slot(kvm, new);
 		break;
 	case KVM_MR_DELETE:
 		uv_unregister_mem_slot(kvm->arch.lpid, old->id);