Patchwork [v2,1/5] KVM: define KVM_CAP_READONLY_MEM unconditionally

login
register
mail settings
Submitter Xiao Guangrong
Date Oct. 25, 2012, 9:21 a.m.
Message ID <50890485.902@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/194083/
State New
Headers show

Comments

Xiao Guangrong - Oct. 25, 2012, 9:21 a.m.
let it not depend on __KVM_HAVE_READONLY_MEM to make it friendly
to userspace

Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
---
 arch/x86/kvm/x86.c  |    2 ++
 include/linux/kvm.h |    2 --
 virt/kvm/kvm_main.c |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
Jan Kiszka - Oct. 25, 2012, 12:14 p.m.
On 2012-10-25 11:21, Xiao Guangrong wrote:
> let it not depend on __KVM_HAVE_READONLY_MEM to make it friendly
> to userspace
> 
> Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
> ---
>  arch/x86/kvm/x86.c  |    2 ++
>  include/linux/kvm.h |    2 --
>  virt/kvm/kvm_main.c |    2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index ec07cd3..0fd220b 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -2189,7 +2189,9 @@ int kvm_dev_ioctl_check_extension(long ext)
>  	case KVM_CAP_GET_TSC_KHZ:
>  	case KVM_CAP_PCI_2_3:
>  	case KVM_CAP_KVMCLOCK_CTRL:
> +#ifdef __KVM_HAVE_READONLY_MEM
>  	case KVM_CAP_READONLY_MEM:
> +#endif
>  	case KVM_CAP_IRQFD_RESAMPLE:
>  		r = 1;
>  		break;
> diff --git a/include/linux/kvm.h b/include/linux/kvm.h
> index 494a84c..a9001c1 100644
> --- a/include/linux/kvm.h
> +++ b/include/linux/kvm.h
> @@ -629,9 +629,7 @@ struct kvm_ppc_smmu_info {
>  #define KVM_CAP_PPC_GET_SMMU_INFO 78
>  #define KVM_CAP_S390_COW 79
>  #define KVM_CAP_PPC_ALLOC_HTAB 80
> -#ifdef __KVM_HAVE_READONLY_MEM
>  #define KVM_CAP_READONLY_MEM 81
> -#endif
>  #define KVM_CAP_IRQFD_RESAMPLE 82
>  #define KVM_CAP_PPC_BOOKE_WATCHDOG 83
> 
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index e26a55f..55f12a1 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -684,7 +684,7 @@ static int check_memory_region_flags(struct kvm_userspace_memory_region *mem)
>  {
>  	u32 valid_flags = KVM_MEM_LOG_DIRTY_PAGES;
> 
> -#ifdef KVM_CAP_READONLY_MEM
> +#ifdef __KVM_HAVE_READONLY_MEM
>  	valid_flags |= KVM_MEM_READONLY;
>  #endif
> 

Much appreciated.

Jan

Patch

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index ec07cd3..0fd220b 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2189,7 +2189,9 @@  int kvm_dev_ioctl_check_extension(long ext)
 	case KVM_CAP_GET_TSC_KHZ:
 	case KVM_CAP_PCI_2_3:
 	case KVM_CAP_KVMCLOCK_CTRL:
+#ifdef __KVM_HAVE_READONLY_MEM
 	case KVM_CAP_READONLY_MEM:
+#endif
 	case KVM_CAP_IRQFD_RESAMPLE:
 		r = 1;
 		break;
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index 494a84c..a9001c1 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -629,9 +629,7 @@  struct kvm_ppc_smmu_info {
 #define KVM_CAP_PPC_GET_SMMU_INFO 78
 #define KVM_CAP_S390_COW 79
 #define KVM_CAP_PPC_ALLOC_HTAB 80
-#ifdef __KVM_HAVE_READONLY_MEM
 #define KVM_CAP_READONLY_MEM 81
-#endif
 #define KVM_CAP_IRQFD_RESAMPLE 82
 #define KVM_CAP_PPC_BOOKE_WATCHDOG 83

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index e26a55f..55f12a1 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -684,7 +684,7 @@  static int check_memory_region_flags(struct kvm_userspace_memory_region *mem)
 {
 	u32 valid_flags = KVM_MEM_LOG_DIRTY_PAGES;

-#ifdef KVM_CAP_READONLY_MEM
+#ifdef __KVM_HAVE_READONLY_MEM
 	valid_flags |= KVM_MEM_READONLY;
 #endif