qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 3/3] arm: implement query-gic-capability


From: Peter Xu
Subject: Re: [Qemu-devel] [PATCH v3 3/3] arm: implement query-gic-capability
Date: Mon, 7 Mar 2016 13:38:24 +0800
User-agent: Mutt/1.5.24 (2015-08-30)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]