diff mbox series

[1/4] KVM: PPC: Pass change type down to memslot commit function

Message ID 20181212041530.GB22265@blackberry
State Superseded
Headers show
Series KVM: PPC: Book3S HV: Improve live migration of radix guests | expand

Commit Message

Paul Mackerras Dec. 12, 2018, 4:15 a.m. UTC
From: Bharata B Rao <bharata@linux.ibm.com>

Currently, kvm_arch_commit_memory_region() gets called with a
parameter indicating what type of change is being made to the memslot,
but it doesn't pass it down to the platform-specific memslot commit
functions.  This adds the `change' parameter to the lower-level
functions so that they can use it in future.

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
---
 arch/powerpc/include/asm/kvm_ppc.h | 6 ++++--
 arch/powerpc/kvm/book3s.c          | 5 +++--
 arch/powerpc/kvm/book3s_hv.c       | 3 ++-
 arch/powerpc/kvm/book3s_pr.c       | 3 ++-
 arch/powerpc/kvm/powerpc.c         | 2 +-
 5 files changed, 12 insertions(+), 7 deletions(-)

Comments

Suraj Jitindar Singh Dec. 12, 2018, 5:17 a.m. UTC | #1
On Wed, 2018-12-12 at 15:15 +1100, Paul Mackerras wrote:
> From: Bharata B Rao <bharata@linux.ibm.com>
> 
> Currently, kvm_arch_commit_memory_region() gets called with a
> parameter indicating what type of change is being made to the
> memslot,
> but it doesn't pass it down to the platform-specific memslot commit
> functions.  This adds the `change' parameter to the lower-level
> functions so that they can use it in future.

Reviewed-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>

> 
> Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
> Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
> ---
>  arch/powerpc/include/asm/kvm_ppc.h | 6 ++++--
>  arch/powerpc/kvm/book3s.c          | 5 +++--
>  arch/powerpc/kvm/book3s_hv.c       | 3 ++-
>  arch/powerpc/kvm/book3s_pr.c       | 3 ++-
>  arch/powerpc/kvm/powerpc.c         | 2 +-
>  5 files changed, 12 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/kvm_ppc.h
> b/arch/powerpc/include/asm/kvm_ppc.h
> index 9b89b19..04c5b84 100644
> --- a/arch/powerpc/include/asm/kvm_ppc.h
> +++ b/arch/powerpc/include/asm/kvm_ppc.h
> @@ -224,7 +224,8 @@ extern int
> kvmppc_core_prepare_memory_region(struct kvm *kvm,
>  extern void kvmppc_core_commit_memory_region(struct kvm *kvm,
>  				const struct
> kvm_userspace_memory_region *mem,
>  				const struct kvm_memory_slot *old,
> -				const struct kvm_memory_slot *new);
> +				const struct kvm_memory_slot *new,
> +				enum kvm_mr_change change);
>  extern int kvm_vm_ioctl_get_smmu_info(struct kvm *kvm,
>  				      struct kvm_ppc_smmu_info
> *info);
>  extern void kvmppc_core_flush_memslot(struct kvm *kvm,
> @@ -294,7 +295,8 @@ struct kvmppc_ops {
>  	void (*commit_memory_region)(struct kvm *kvm,
>  				     const struct
> kvm_userspace_memory_region *mem,
>  				     const struct kvm_memory_slot
> *old,
> -				     const struct kvm_memory_slot
> *new);
> +				     const struct kvm_memory_slot
> *new,
> +				     enum kvm_mr_change change);
>  	int (*unmap_hva_range)(struct kvm *kvm, unsigned long start,
>  			   unsigned long end);
>  	int (*age_hva)(struct kvm *kvm, unsigned long start,
> unsigned long end);
> diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
> index fd9893b..a35fb40 100644
> --- a/arch/powerpc/kvm/book3s.c
> +++ b/arch/powerpc/kvm/book3s.c
> @@ -830,9 +830,10 @@ int kvmppc_core_prepare_memory_region(struct kvm
> *kvm,
>  void kvmppc_core_commit_memory_region(struct kvm *kvm,
>  				const struct
> kvm_userspace_memory_region *mem,
>  				const struct kvm_memory_slot *old,
> -				const struct kvm_memory_slot *new)
> +				const struct kvm_memory_slot *new,
> +				enum kvm_mr_change change)
>  {
> -	kvm->arch.kvm_ops->commit_memory_region(kvm, mem, old, new);
> +	kvm->arch.kvm_ops->commit_memory_region(kvm, mem, old, new,
> change);
>  }
>  
>  int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start,
> unsigned long end)
> diff --git a/arch/powerpc/kvm/book3s_hv.c
> b/arch/powerpc/kvm/book3s_hv.c
> index ab43306..f4fbb7b5 100644
> --- a/arch/powerpc/kvm/book3s_hv.c
> +++ b/arch/powerpc/kvm/book3s_hv.c
> @@ -4371,7 +4371,8 @@ static int
> kvmppc_core_prepare_memory_region_hv(struct kvm *kvm,
>  static void kvmppc_core_commit_memory_region_hv(struct kvm *kvm,
>  				const struct
> kvm_userspace_memory_region *mem,
>  				const struct kvm_memory_slot *old,
> -				const struct kvm_memory_slot *new)
> +				const struct kvm_memory_slot *new,
> +				enum kvm_mr_change change)
>  {
>  	unsigned long npages = mem->memory_size >> PAGE_SHIFT;
>  
> diff --git a/arch/powerpc/kvm/book3s_pr.c
> b/arch/powerpc/kvm/book3s_pr.c
> index 4efd65d..3aeb17b 100644
> --- a/arch/powerpc/kvm/book3s_pr.c
> +++ b/arch/powerpc/kvm/book3s_pr.c
> @@ -1913,7 +1913,8 @@ static int
> kvmppc_core_prepare_memory_region_pr(struct kvm *kvm,
>  static void kvmppc_core_commit_memory_region_pr(struct kvm *kvm,
>  				const struct
> kvm_userspace_memory_region *mem,
>  				const struct kvm_memory_slot *old,
> -				const struct kvm_memory_slot *new)
> +				const struct kvm_memory_slot *new,
> +				enum kvm_mr_change change)
>  {
>  	return;
>  }
> diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
> index 2869a29..6a7a6a1 100644
> --- a/arch/powerpc/kvm/powerpc.c
> +++ b/arch/powerpc/kvm/powerpc.c
> @@ -696,7 +696,7 @@ void kvm_arch_commit_memory_region(struct kvm
> *kvm,
>  				   const struct kvm_memory_slot
> *new,
>  				   enum kvm_mr_change change)
>  {
> -	kvmppc_core_commit_memory_region(kvm, mem, old, new);
> +	kvmppc_core_commit_memory_region(kvm, mem, old, new,
> change);
>  }
>  
>  void kvm_arch_flush_shadow_memslot(struct kvm *kvm,
David Gibson Dec. 12, 2018, 11:10 p.m. UTC | #2
On Wed, Dec 12, 2018 at 03:15:30PM +1100, Paul Mackerras wrote:
> From: Bharata B Rao <bharata@linux.ibm.com>
> 
> Currently, kvm_arch_commit_memory_region() gets called with a
> parameter indicating what type of change is being made to the memslot,
> but it doesn't pass it down to the platform-specific memslot commit
> functions.  This adds the `change' parameter to the lower-level
> functions so that they can use it in future.
> 
> Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
> Signed-off-by: Paul Mackerras <paulus@ozlabs.org>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  arch/powerpc/include/asm/kvm_ppc.h | 6 ++++--
>  arch/powerpc/kvm/book3s.c          | 5 +++--
>  arch/powerpc/kvm/book3s_hv.c       | 3 ++-
>  arch/powerpc/kvm/book3s_pr.c       | 3 ++-
>  arch/powerpc/kvm/powerpc.c         | 2 +-
>  5 files changed, 12 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h
> index 9b89b19..04c5b84 100644
> --- a/arch/powerpc/include/asm/kvm_ppc.h
> +++ b/arch/powerpc/include/asm/kvm_ppc.h
> @@ -224,7 +224,8 @@ extern int kvmppc_core_prepare_memory_region(struct kvm *kvm,
>  extern void kvmppc_core_commit_memory_region(struct kvm *kvm,
>  				const struct kvm_userspace_memory_region *mem,
>  				const struct kvm_memory_slot *old,
> -				const struct kvm_memory_slot *new);
> +				const struct kvm_memory_slot *new,
> +				enum kvm_mr_change change);
>  extern int kvm_vm_ioctl_get_smmu_info(struct kvm *kvm,
>  				      struct kvm_ppc_smmu_info *info);
>  extern void kvmppc_core_flush_memslot(struct kvm *kvm,
> @@ -294,7 +295,8 @@ struct kvmppc_ops {
>  	void (*commit_memory_region)(struct kvm *kvm,
>  				     const struct kvm_userspace_memory_region *mem,
>  				     const struct kvm_memory_slot *old,
> -				     const struct kvm_memory_slot *new);
> +				     const struct kvm_memory_slot *new,
> +				     enum kvm_mr_change change);
>  	int (*unmap_hva_range)(struct kvm *kvm, unsigned long start,
>  			   unsigned long end);
>  	int (*age_hva)(struct kvm *kvm, unsigned long start, unsigned long end);
> diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
> index fd9893b..a35fb40 100644
> --- a/arch/powerpc/kvm/book3s.c
> +++ b/arch/powerpc/kvm/book3s.c
> @@ -830,9 +830,10 @@ int kvmppc_core_prepare_memory_region(struct kvm *kvm,
>  void kvmppc_core_commit_memory_region(struct kvm *kvm,
>  				const struct kvm_userspace_memory_region *mem,
>  				const struct kvm_memory_slot *old,
> -				const struct kvm_memory_slot *new)
> +				const struct kvm_memory_slot *new,
> +				enum kvm_mr_change change)
>  {
> -	kvm->arch.kvm_ops->commit_memory_region(kvm, mem, old, new);
> +	kvm->arch.kvm_ops->commit_memory_region(kvm, mem, old, new, change);
>  }
>  
>  int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end)
> diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
> index ab43306..f4fbb7b5 100644
> --- a/arch/powerpc/kvm/book3s_hv.c
> +++ b/arch/powerpc/kvm/book3s_hv.c
> @@ -4371,7 +4371,8 @@ static int kvmppc_core_prepare_memory_region_hv(struct kvm *kvm,
>  static void kvmppc_core_commit_memory_region_hv(struct kvm *kvm,
>  				const struct kvm_userspace_memory_region *mem,
>  				const struct kvm_memory_slot *old,
> -				const struct kvm_memory_slot *new)
> +				const struct kvm_memory_slot *new,
> +				enum kvm_mr_change change)
>  {
>  	unsigned long npages = mem->memory_size >> PAGE_SHIFT;
>  
> diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
> index 4efd65d..3aeb17b 100644
> --- a/arch/powerpc/kvm/book3s_pr.c
> +++ b/arch/powerpc/kvm/book3s_pr.c
> @@ -1913,7 +1913,8 @@ static int kvmppc_core_prepare_memory_region_pr(struct kvm *kvm,
>  static void kvmppc_core_commit_memory_region_pr(struct kvm *kvm,
>  				const struct kvm_userspace_memory_region *mem,
>  				const struct kvm_memory_slot *old,
> -				const struct kvm_memory_slot *new)
> +				const struct kvm_memory_slot *new,
> +				enum kvm_mr_change change)
>  {
>  	return;
>  }
> diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
> index 2869a29..6a7a6a1 100644
> --- a/arch/powerpc/kvm/powerpc.c
> +++ b/arch/powerpc/kvm/powerpc.c
> @@ -696,7 +696,7 @@ void kvm_arch_commit_memory_region(struct kvm *kvm,
>  				   const struct kvm_memory_slot *new,
>  				   enum kvm_mr_change change)
>  {
> -	kvmppc_core_commit_memory_region(kvm, mem, old, new);
> +	kvmppc_core_commit_memory_region(kvm, mem, old, new, change);
>  }
>  
>  void kvm_arch_flush_shadow_memslot(struct kvm *kvm,
diff mbox series

Patch

diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h
index 9b89b19..04c5b84 100644
--- a/arch/powerpc/include/asm/kvm_ppc.h
+++ b/arch/powerpc/include/asm/kvm_ppc.h
@@ -224,7 +224,8 @@  extern int kvmppc_core_prepare_memory_region(struct kvm *kvm,
 extern void kvmppc_core_commit_memory_region(struct kvm *kvm,
 				const struct kvm_userspace_memory_region *mem,
 				const struct kvm_memory_slot *old,
-				const struct kvm_memory_slot *new);
+				const struct kvm_memory_slot *new,
+				enum kvm_mr_change change);
 extern int kvm_vm_ioctl_get_smmu_info(struct kvm *kvm,
 				      struct kvm_ppc_smmu_info *info);
 extern void kvmppc_core_flush_memslot(struct kvm *kvm,
@@ -294,7 +295,8 @@  struct kvmppc_ops {
 	void (*commit_memory_region)(struct kvm *kvm,
 				     const struct kvm_userspace_memory_region *mem,
 				     const struct kvm_memory_slot *old,
-				     const struct kvm_memory_slot *new);
+				     const struct kvm_memory_slot *new,
+				     enum kvm_mr_change change);
 	int (*unmap_hva_range)(struct kvm *kvm, unsigned long start,
 			   unsigned long end);
 	int (*age_hva)(struct kvm *kvm, unsigned long start, unsigned long end);
diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
index fd9893b..a35fb40 100644
--- a/arch/powerpc/kvm/book3s.c
+++ b/arch/powerpc/kvm/book3s.c
@@ -830,9 +830,10 @@  int kvmppc_core_prepare_memory_region(struct kvm *kvm,
 void kvmppc_core_commit_memory_region(struct kvm *kvm,
 				const struct kvm_userspace_memory_region *mem,
 				const struct kvm_memory_slot *old,
-				const struct kvm_memory_slot *new)
+				const struct kvm_memory_slot *new,
+				enum kvm_mr_change change)
 {
-	kvm->arch.kvm_ops->commit_memory_region(kvm, mem, old, new);
+	kvm->arch.kvm_ops->commit_memory_region(kvm, mem, old, new, change);
 }
 
 int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end)
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index ab43306..f4fbb7b5 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -4371,7 +4371,8 @@  static int kvmppc_core_prepare_memory_region_hv(struct kvm *kvm,
 static void kvmppc_core_commit_memory_region_hv(struct kvm *kvm,
 				const struct kvm_userspace_memory_region *mem,
 				const struct kvm_memory_slot *old,
-				const struct kvm_memory_slot *new)
+				const struct kvm_memory_slot *new,
+				enum kvm_mr_change change)
 {
 	unsigned long npages = mem->memory_size >> PAGE_SHIFT;
 
diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
index 4efd65d..3aeb17b 100644
--- a/arch/powerpc/kvm/book3s_pr.c
+++ b/arch/powerpc/kvm/book3s_pr.c
@@ -1913,7 +1913,8 @@  static int kvmppc_core_prepare_memory_region_pr(struct kvm *kvm,
 static void kvmppc_core_commit_memory_region_pr(struct kvm *kvm,
 				const struct kvm_userspace_memory_region *mem,
 				const struct kvm_memory_slot *old,
-				const struct kvm_memory_slot *new)
+				const struct kvm_memory_slot *new,
+				enum kvm_mr_change change)
 {
 	return;
 }
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 2869a29..6a7a6a1 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -696,7 +696,7 @@  void kvm_arch_commit_memory_region(struct kvm *kvm,
 				   const struct kvm_memory_slot *new,
 				   enum kvm_mr_change change)
 {
-	kvmppc_core_commit_memory_region(kvm, mem, old, new);
+	kvmppc_core_commit_memory_region(kvm, mem, old, new, change);
 }
 
 void kvm_arch_flush_shadow_memslot(struct kvm *kvm,