From: Paolo Bonzini Subject: Re: RFC: KVM _CREATE_DEVICE considered harmful? Date: Wed, 16 Oct 2013 15:06:27 +0200 Message-ID: <525E8F53.3090603@redhat.com> References: <525E8DC3.70409@borntraeger.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Alexander Graf , Gleb Natapov , Jens Freimann , KVM list , "qemu-devel@nongnu.org" , Valgrind Developers To: Christian Borntraeger Return-path: Received: from mx1.redhat.com ([209.132.183.28]:9142 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760544Ab3JPNGt (ORCPT ); Wed, 16 Oct 2013 09:06:49 -0400 In-Reply-To: <525E8DC3.70409@borntraeger.net> Sender: kvm-owner@vger.kernel.org List-ID: Il 16/10/2013 14:59, Christian Borntraeger ha scritto: > > Now, newer KVMs have the ability to create subdevices of a KVM guest (e.g. an in kernel > kvm interrupt controller) with the following ioctl: > > #define KVM_CREATE_DEVICE _IOWR(KVMIO, 0xe0, struct kvm_create_device) > > qemu can then work on these devices with the ioctls > > /* ioctls for fds returned by KVM_CREATE_DEVICE */ > #define KVM_SET_DEVICE_ATTR _IOW(KVMIO, 0xe1, struct kvm_device_attr) > #define KVM_GET_DEVICE_ATTR _IOW(KVMIO, 0xe2, struct kvm_device_attr) > #define KVM_HAS_DEVICE_ATTR _IOW(KVMIO, 0xe3, struct kvm_device_attr) > > struct kvm_device_attr { > __u32 flags; /* no flags currently defined */ > __u32 group; /* device-defined */ > __u64 attr; /* group-defined */ > __u64 addr; /* userspace address of attr data */ > }; Would it work to simply add an "__u64 size;" field to kvm_device_attr, that is filled on exit by KVM_GET/HAS_DEVICE_ADDR, and filled on entry to KVM_SET_DEVICE_ADDR? Paolo