From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32789) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1acpkJ-0004e9-DN for qemu-devel@nongnu.org; Mon, 07 Mar 2016 02:38:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1acpkI-00023j-GQ for qemu-devel@nongnu.org; Mon, 07 Mar 2016 02:38:27 -0500 Date: Mon, 7 Mar 2016 08:38:13 +0100 From: Andrew Jones Message-ID: <20160307073813.GB1865@localhost.redhat.com> References: <1457324608-11434-1-git-send-email-peterx@redhat.com> <1457324608-11434-4-git-send-email-peterx@redhat.com> <20160307051025.GB2885@localhost.redhat.com> <20160307053824.GB7438@pxdev.xzpeter.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160307053824.GB7438@pxdev.xzpeter.org> Subject: Re: [Qemu-devel] [PATCH v3 3/3] arm: implement query-gic-capability List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Xu Cc: wei@redhat.com, peter.maydell@linaro.org, armbru@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, qemu-arm@nongnu.org, abologna@redhat.com On Mon, Mar 07, 2016 at 01:38:24PM +0800, Peter Xu wrote: > On Mon, Mar 07, 2016 at 06:12:38AM +0100, Andrew Jones wrote: > > On Mon, Mar 07, 2016 at 12:23:28PM +0800, Peter Xu wrote: > > > +#ifdef CONFIG_KVM > > > +/* > > > + * This is merely the same as kvm_create_device(). The only > > > + * difference is we are using raw fds rather than KVMState, so that > > > + * we can use it even without kvm_state initialized. > > > + */ > > > +static int kvm_create_device_fds(int kvm_fd, int vmfd, > > > + uint64_t type, bool test) > > > > I don't think we need this helper function. Who else will call it? > > Particularly without test==true? Anyway, I think three ioctls directly > > called from qmp_query_gic_capability should be OK. > > Right. However, I would still consider using a helper function if > you would not mind. E.g, how about this: Fine by me. Thanks, drew > > #ifdef CONFIG_KVM > /* Test whether KVM support specific device. */ > static inline int kvm_support_device(int vmfd, uint64_t type) > { > struct kvm_create_device create_dev = { > .type = type, > .fd = -1, > .flags = KVM_CREATE_DEVICE_TEST, > }; > return ioctl(vmfd, KVM_CREATE_DEVICE, &create_dev); > } > #endif > > Thanks. > Peter >