From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: KVM_ASSIGN_SET_MSIX_NR and KVM_ASSIGN_SET_MSIX_ENTRY should support MSI? Date: Tue, 05 May 2009 16:30:25 +0300 Message-ID: <4A003F71.8090500@redhat.com> References: <20090505103028.GA15418@redhat.com> <20090505110415.GA4114@amt.cnet> <20090505110815.GC15418@redhat.com> <4A002996.6040803@redhat.com> <20090505120134.GE15418@redhat.com> <4A002C48.7000708@redhat.com> <20090505125741.GH15418@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , Sheng Yang , Matthew Wilcox , kvm@vger.kernel.org To: "Michael S. Tsirkin" Return-path: Received: from mx2.redhat.com ([66.187.237.31]:42274 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751438AbZEENa1 (ORCPT ); Tue, 5 May 2009 09:30:27 -0400 In-Reply-To: <20090505125741.GH15418@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Michael S. Tsirkin wrote: >> Works for me. Sheng, is there a reason why it wasn't done like this? >> >> btw, it could be further simplified by using irqfd. Instead of the host >> device tying directly into kvm, it could just trigger an eventfd; and we >> could terminate the eventfd either in kvm (irqfd) or in qemu. >> > > If you are going wild, you could then split this code out from kvm > into something like a UIO driver. E.g. qemu could then in theory > support assigned devices even without VT-d hardware support in CPU. > That's my thinking. PCI interrupts don't work because we need to do some hacky stuff in there, but MSI should. Oh, and we could improve UIO support for interrupts when using MSI, since there's no need to acknowledge the interrupt. Support we can tell the kernel to signal an eventfd whenever an MSI fires. We then ask kvm for an irqfd, and give that irqfd to the kernel for the MSI. Voila, we assign an interrupt from userspace, without the device or kvm knowing anything about it. Like you say, we can assign the device to pure qemu, or to a userspace driver. Beautiful, I finally found something to replace my old Lego set. -- error compiling committee.c: too many arguments to function