From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41581) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1acnsS-0006Tc-Cw for qemu-devel@nongnu.org; Mon, 07 Mar 2016 00:38:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1acnsR-0002Mz-JE for qemu-devel@nongnu.org; Mon, 07 Mar 2016 00:38:44 -0500 Date: Mon, 7 Mar 2016 13:38:24 +0800 From: Peter Xu Message-ID: <20160307053824.GB7438@pxdev.xzpeter.org> References: <1457324608-11434-1-git-send-email-peterx@redhat.com> <1457324608-11434-4-git-send-email-peterx@redhat.com> <20160307051025.GB2885@localhost.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20160307051025.GB2885@localhost.redhat.com> 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: Andrew Jones Cc: wei@redhat.com, peter.maydell@linaro.org, mdroth@linux.vnet.ibm.com, armbru@redhat.com, abologna@redhat.com, qemu-devel@nongnu.org, qemu-arm@nongnu.org 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: #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