From patchwork Thu Oct 25 09:21:09 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Guangrong X-Patchwork-Id: 1642491 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 7F69D3FE1C for ; Thu, 25 Oct 2012 09:22:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759282Ab2JYJWX (ORCPT ); Thu, 25 Oct 2012 05:22:23 -0400 Received: from e23smtp09.au.ibm.com ([202.81.31.142]:55867 "EHLO e23smtp09.au.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759268Ab2JYJWW (ORCPT ); Thu, 25 Oct 2012 05:22:22 -0400 Received: from /spool/local by e23smtp09.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 25 Oct 2012 19:18:42 +1000 Received: from d23relay04.au.ibm.com (202.81.31.246) by e23smtp09.au.ibm.com (202.81.31.206) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 25 Oct 2012 19:18:21 +1000 Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q9P9BGbM17367096 for ; Thu, 25 Oct 2012 20:11:17 +1100 Received: from d23av01.au.ibm.com (loopback [127.0.0.1]) by d23av01.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q9P9LDiY019250 for ; Thu, 25 Oct 2012 20:21:14 +1100 Received: from localhost.localdomain ([9.123.236.99]) by d23av01.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q9P9L9sL019173; Thu, 25 Oct 2012 20:21:11 +1100 Message-ID: <50890485.902@linux.vnet.ibm.com> Date: Thu, 25 Oct 2012 17:21:09 +0800 From: Xiao Guangrong User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120911 Thunderbird/15.0.1 MIME-Version: 1.0 To: Xiao Guangrong CC: Avi Kivity , Marcelo Tosatti , Jan Kiszka , Anthony Liguori , "Kevin O'Connor" , Liu Sheng , KVM , qemu-devel@nongnu.org Subject: [PATCH v2 1/5] KVM: define KVM_CAP_READONLY_MEM unconditionally References: <50890462.5010307@linux.vnet.ibm.com> In-Reply-To: <50890462.5010307@linux.vnet.ibm.com> x-cbid: 12102509-3568-0000-0000-000002A703FB Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org let it not depend on __KVM_HAVE_READONLY_MEM to make it friendly to userspace Signed-off-by: Xiao Guangrong --- 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