From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54080) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abfrh-0002h2-EN for qemu-devel@nongnu.org; Thu, 03 Mar 2016 21:53:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1abfrg-0005kE-HN for qemu-devel@nongnu.org; Thu, 03 Mar 2016 21:53:17 -0500 Date: Fri, 4 Mar 2016 10:52:55 +0800 From: Peter Xu Message-ID: <20160304025255.GF30973@pxdev.xzpeter.org> References: <1456993272-32292-1-git-send-email-peterx@redhat.com> <1456993272-32292-4-git-send-email-peterx@redhat.com> <1457007587.4468.2.camel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1457007587.4468.2.camel@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 3/3] arm: implement query-gic-capability List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andrea Bolognani Cc: wei@redhat.com, peter.maydell@linaro.org, drjones@redhat.com, armbru@redhat.com, mdroth@linux.vnet.ibm.com, qemu-devel@nongnu.org, qemu-arm@nongnu.org On Thu, Mar 03, 2016 at 01:19:47PM +0100, Andrea Bolognani wrote: > On Thu, 2016-03-03 at 16:21 +0800, Peter Xu wrote: > > For emulated ARM VM, only gicv2 is supported. We need to add gicv3 > in > > when emulated gicv3 ready. For KVM accelerated ARM VM, we detect the > > capability bits using ioctls. > >=C2=A0 > > if we want to > know GIC kernel capabilities, we need to make sure we have > > enabled KVM when querying (like, with "-enable-kvm"). > >=C2=A0 > > > Signed-off-by: Peter Xu > > --- > >=C2=A0=C2=A0target-arm/machine.c | 48 > +++++++++++++++++++++++++++++++++++++++++++++++- > >=C2=A0=C2=A01 file changed, 47 insertions(+), 1 deletion(-) >=20 > Sorry for not catching this earlier, but I'm afraid this is not > going to work -- libvirt doesn't pass either -enable-kvm or the > machine option accel=3Dkvm when probing for capabilities, which > means that, with the current implementation, it will only get > information about emulated GIC. >=20 > Is there a way to make probing work without requiring KVM to > be enabled? Ah.. If so, this is a good point... I can do this, but I just feel it a bit hacky if I do ioctl()s directly in one QMP command handle: qmp_query_gic_capability() { kvm =3D open("/dev/kvm"); vm =3D ioctl(KVM_CREATE_VM); ...test create devices using KVM_CREATE_DEVICE ioctls... close(vm); close(kvm); } Rather than leveraging current KVMState stuffs (of course, I can make things a little bit prettier than above...). Another way to do is to generalize kvm_init() maybe? That's some work too. Andrea, do you know how much effort we need to add this support for libvirt, say, we can specify "accel=3D" or "-enable-kvm" as extra parameter when probing? Or, does anyone on the list has suggestion on how to better do this? Thanks. Peter