Re: [RFC PATCH v3 1/6] kvm: add device control API

2013-04-08 Thread Gleb Natapov
On Thu, Apr 04, 2013 at 06:47:45PM -0500, Scott Wood wrote: On 04/04/2013 05:41:35 AM, Gleb Natapov wrote: On Tue, Apr 02, 2013 at 08:57:48PM -0500, Scott Wood wrote: +struct kvm_device_attr { + __u32 flags; /* no flags currently defined */ + __u32 group; /*

Re: [RFC PATCH v3 1/6] kvm: add device control API

2013-04-08 Thread Gleb Natapov
On Fri, Apr 05, 2013 at 12:02:06PM +1100, Paul Mackerras wrote: On Thu, Apr 04, 2013 at 01:41:35PM +0300, Gleb Natapov wrote: Since now each device has its own fd is it an advantage to enforce common interface between different devices? If we do so though why not handle file creation,

Re: [RFC PATCH v3 1/6] kvm: add device control API

2013-04-08 Thread Scott Wood
On 04/08/2013 12:33:13 AM, Paul Mackerras wrote: On Tue, Apr 02, 2013 at 08:57:48PM -0500, Scott Wood wrote: [snip] +static int kvm_ioctl_create_device(struct kvm *kvm, + struct kvm_create_device *cd) +{ + bool test = cd-flags KVM_CREATE_DEVICE_TEST; + +

Re: [RFC PATCH v3 1/6] kvm: add device control API

2013-04-07 Thread Paul Mackerras
On Tue, Apr 02, 2013 at 08:57:48PM -0500, Scott Wood wrote: [snip] +static int kvm_ioctl_create_device(struct kvm *kvm, +struct kvm_create_device *cd) +{ + bool test = cd-flags KVM_CREATE_DEVICE_TEST; + + switch (cd-type) { + default: +

Re: [RFC PATCH v3 1/6] kvm: add device control API

2013-04-04 Thread Gleb Natapov
On Tue, Apr 02, 2013 at 08:57:48PM -0500, Scott Wood wrote: Currently, devices that are emulated inside KVM are configured in a hardcoded manner based on an assumption that any given architecture only has one way to do it. If there's any need to access device state, it is done through

Re: [RFC PATCH v3 1/6] kvm: add device control API

2013-04-04 Thread Scott Wood
On 04/04/2013 05:41:35 AM, Gleb Natapov wrote: On Tue, Apr 02, 2013 at 08:57:48PM -0500, Scott Wood wrote: +struct kvm_device_attr { + __u32 flags; /* no flags currently defined */ + __u32 group; /* device-defined */ + __u64 attr; /* group-defined */ +

Re: [RFC PATCH v3 1/6] kvm: add device control API

2013-04-04 Thread Paul Mackerras
On Thu, Apr 04, 2013 at 01:41:35PM +0300, Gleb Natapov wrote: Since now each device has its own fd is it an advantage to enforce common interface between different devices? If we do so though why not handle file creation, ioctl and file descriptor lifetime in the common code. Common code will

[RFC PATCH v3 1/6] kvm: add device control API

2013-04-02 Thread Scott Wood
Currently, devices that are emulated inside KVM are configured in a hardcoded manner based on an assumption that any given architecture only has one way to do it. If there's any need to access device state, it is done through inflexible one-purpose-only IOCTLs (e.g. KVM_GET/SET_LAPIC). Defining