From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [PATCH 2/3] update kvm related the head file from kernel Date: Fri, 07 Sep 2012 10:49:39 +0200 Message-ID: <5049B523.8090303@siemens.com> References: <1347006389-543-1-git-send-email-liusheng@linux.vnet.ibm.com> <1347006389-543-3-git-send-email-liusheng@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, avi@redhat.com, mtosatti@redhat.com, xiaoguangrong@linux.vnet.ibm.com, qemu-devel@nongnu.org, aliguori@us.ibm.com To: Liu Sheng Return-path: Received: from david.siemens.de ([192.35.17.14]:29039 "EHLO david.siemens.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932932Ab2IGIt6 (ORCPT ); Fri, 7 Sep 2012 04:49:58 -0400 In-Reply-To: <1347006389-543-3-git-send-email-liusheng@linux.vnet.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: On 2012-09-07 10:26, Liu Sheng wrote: > updated the head file from kernel for readonly memory > feature. > > Signed-off-by: Liu Sheng > --- > linux-headers/asm-x86/kvm.h | 1 + > linux-headers/linux/kvm.h | 16 +++++++++++++--- > 2 files changed, 14 insertions(+), 3 deletions(-) > > diff --git a/linux-headers/asm-x86/kvm.h b/linux-headers/asm-x86/kvm.h > index 246617e..521bf25 100644 > --- a/linux-headers/asm-x86/kvm.h > +++ b/linux-headers/asm-x86/kvm.h > @@ -25,6 +25,7 @@ > #define __KVM_HAVE_DEBUGREGS > #define __KVM_HAVE_XSAVE > #define __KVM_HAVE_XCRS > +#define __KVM_HAVE_READONLY_MEM > > /* Architectural interrupt line count. */ > #define KVM_NR_INTERRUPTS 256 > diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h > index 4b9e575..02fae9e 100644 > --- a/linux-headers/linux/kvm.h > +++ b/linux-headers/linux/kvm.h > @@ -101,9 +101,13 @@ struct kvm_userspace_memory_region { > __u64 userspace_addr; /* start of the userspace allocated memory */ > }; > > -/* for kvm_memory_region::flags */ > -#define KVM_MEM_LOG_DIRTY_PAGES 1UL > -#define KVM_MEMSLOT_INVALID (1UL << 1) > +/* > + * The bit 0 ~ bit 15 of kvm_memory_region::flags are visible for userspace, > + * other bits are reserved for kvm internal use which are defined in > + * include/linux/kvm_host.h. > + */ > +#define KVM_MEM_LOG_DIRTY_PAGES (1UL << 0) > +#define KVM_MEM_READONLY (1UL << 1) > > /* for KVM_IRQ_LINE */ > struct kvm_irq_level { > @@ -222,6 +226,9 @@ struct kvm_run { > __u8 data[8]; > __u32 len; > __u8 is_write; > +#ifdef __KVM_HAVE_READONLY_MEM > + __u8 write_readonly_mem; > +#endif > } mmio; > /* KVM_EXIT_HYPERCALL */ > struct { > @@ -618,6 +625,9 @@ 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 Sorry for commenting on the wrong patch, this must be fixed in the kernel: no more conditional CAPs, please. Usually, they only require #ifdef messes in QEMU (see patch 3). Jan -- Siemens AG, Corporate Technology, CT RTC ITP SDP-DE Corporate Competence Center Embedded Linux