Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Aug 2013 15:27:54 -0400
From:      Jeremiah Lott <jlott@averesystems.com>
To:        freebsd-virtualization@freebsd.org
Subject:   legacy irq patch and e1000 emulation
Message-ID:  <B064FB88-5D5E-453F-83BE-38A59CD67EDD@averesystems.com>

next in thread | raw e-mail | index | archive | help

--Apple-Mail=_2B96711E-47DD-45CA-B64C-85A2C897A624
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

Here is a small patch for automatic legacy irq assignment.  I found that =
when I called:

pci_lintr_request(pi, -1);

It was always asserting and not able to find an irq.  It is because the =
pci devices were being initialized before the lirq structure in =
pci_emul.c.  The attached patch fixes the problem.

Related, I noticed Peter mentioned Intel NIC emulation work in a recent =
email.  Is there work going on in this area?  I've been kind of hacking =
on an implementation for a 82545EM card.  Freebsd drive lem driver can =
probe it at this point, but it's still got a long way to go before it is =
functional.  I'd hate to be duplicating work that is already done, =
though.  Thanks,

  Jeremiah


--Apple-Mail=_2B96711E-47DD-45CA-B64C-85A2C897A624
Content-Disposition: attachment;
	filename=legacy-irq.patch
Content-Type: application/octet-stream;
	name="legacy-irq.patch"
Content-Transfer-Encoding: 7bit

commit 464abfd82c54bf605a3f8ffd372b588eda3d86b5
Author: Jeremiah Lott <jlott@averesystems.com>
Date:   Wed Aug 14 20:04:37 2013 -0400

    Fix automatic legacy interrupt assignment.

diff --git a/usr.sbin/bhyve/pci_emul.c b/usr.sbin/bhyve/pci_emul.c
index 00adf62..005e8b1 100644
--- a/usr.sbin/bhyve/pci_emul.c
+++ b/usr.sbin/bhyve/pci_emul.c
@@ -1008,6 +1008,16 @@ init_pci(struct vmctx *ctx)
 	pci_emul_membase32 = vm_get_lowmem_limit(ctx);
 	pci_emul_membase64 = PCI_EMUL_MEMBASE64;
 
+	/*
+	 * Allow ISA IRQs 5,10,11,12, and 15 to be available for
+	 * generic use
+	 */
+	lirq[5].li_generic = 1;
+	lirq[10].li_generic = 1;
+	lirq[11].li_generic = 1;
+	lirq[12].li_generic = 1;
+	lirq[15].li_generic = 1;
+
 	for (slot = 0; slot < MAXSLOTS; slot++) {
 		for (func = 0; func < MAXFUNCS; func++) {
 			si = &pci_slotinfo[slot][func];
@@ -1023,16 +1033,6 @@ init_pci(struct vmctx *ctx)
 	}
 
 	/*
-	 * Allow ISA IRQs 5,10,11,12, and 15 to be available for
-	 * generic use
-	 */
-	lirq[5].li_generic = 1;
-	lirq[10].li_generic = 1;
-	lirq[11].li_generic = 1;
-	lirq[12].li_generic = 1;
-	lirq[15].li_generic = 1;
-
-	/*
 	 * The guest physical memory map looks like the following:
 	 * [0,		    lowmem)		guest system memory
 	 * [lowmem,	    lowmem_limit)	memory hole (may be absent)

--Apple-Mail=_2B96711E-47DD-45CA-B64C-85A2C897A624--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?B064FB88-5D5E-453F-83BE-38A59CD67EDD>