Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Aug 2014 21:16:27 +0000 (UTC)
From:      Neel Natu <neel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r270434 - head/sys/amd64/vmm/io
Message-ID:  <201408232116.s7NLGRug052215@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: neel
Date: Sat Aug 23 21:16:26 2014
New Revision: 270434
URL: http://svnweb.freebsd.org/changeset/base/270434

Log:
  Return the spurious interrupt vector (IRQ7 or IRQ15) if the atpic cannot
  find any unmasked pin with an interrupt asserted.
  
  Reviewed by:	tychon
  CR:		https://reviews.freebsd.org/D669
  MFC after:	1 week

Modified:
  head/sys/amd64/vmm/io/vatpic.c

Modified: head/sys/amd64/vmm/io/vatpic.c
==============================================================================
--- head/sys/amd64/vmm/io/vatpic.c	Sat Aug 23 20:45:00 2014	(r270433)
+++ head/sys/amd64/vmm/io/vatpic.c	Sat Aug 23 21:16:26 2014	(r270434)
@@ -500,13 +500,19 @@ vatpic_pending_intr(struct vm *vm, int *
 	VATPIC_LOCK(vatpic);
 
 	pin = vatpic_get_highest_irrpin(atpic);
-	if (pin == -1)
-		pin = 7;
 	if (pin == 2) {
 		atpic = &vatpic->atpic[1];
 		pin = vatpic_get_highest_irrpin(atpic);
 	}
 
+	/*
+	 * If there are no pins active at this moment then return the spurious
+	 * interrupt vector instead.
+	 */
+	if (pin == -1)
+		pin = 7;
+
+	KASSERT(pin >= 0 && pin <= 7, ("%s: invalid pin %d", __func__, pin));
 	*vecptr = atpic->irq_base + pin;
 
 	VATPIC_UNLOCK(vatpic);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201408232116.s7NLGRug052215>