From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: Fwd: Re: [PATCH] Add irqdevice interface + userint implementation Date: Tue, 10 Apr 2007 19:11:36 +0300 Message-ID: <461BB738.7040206@qumranet.com> References: <4614FF5C.BA47.005A.0@novell.com> <46189005.2090609@qumranet.com> <461A415C.BA47.005A.0@novell.com> <461B4241.5030101@qumranet.com> <461B3E61.BA47.005A.0@novell.com> <461B7C81.7040102@qumranet.com> <461B64E4.BA47.005A.0@novell.com> <461BA363.5080308@qumranet.com> <461B7755.BA47.005A.0@novell.com> <461B7AC6.BA47.005A.0@novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org To: Gregory Haskins Return-path: In-Reply-To: <461B7AC6.BA47.005A.0-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org Gregory Haskins wrote: >>>> On Tue, Apr 10, 2007 at 11:39 AM, in message <461B7755.BA47.005A.0-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>, >>>> > Gregory Haskins wrote: > >> We could change the API to handle the pending condition as a tri-level >> > > I just thought of a better way. Leave the return value as a boolean, but use the concept of the mask_reasons. It simplifies the logic, and allows the irqdevice to register for additional VMEXITs regardless of whether its currently injecting something or not. So we have: > > spin_lock(vcpu- >irq_lock) > vcpu->exit_reasons = 0; > nmi = !irq_window_open(vcpu) > if (vcpu- >irq- >pending(nmi, &mask_reasons)) > inject(vcpu, vcpu- >irq- >read_vector(nmi)) > if (mask_reasons) { > if (mask_reasons & MASKREASON_TPR) > vcpu->exit_reasons &= TPR; > /* etc */ > } > spin_unlock(vcpu- >irq_lock) > It's more complex than that; you need to program the hardware to exit on a specific threshold level of tpr values (e.g. exit when tpr <= n). It's a little sad to encode a complex condition (wait for nmi window opening/wait for irq window opening/wait for irq window opening with tpr <= n) in irqdevice, then decode it in the vcpu and program the hardware accordingly. -- error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV