From owner-freebsd-virtualization@FreeBSD.ORG Thu Aug 15 19:34:13 2013 Return-Path: Delivered-To: freebsd-virtualization@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id F291D107 for ; Thu, 15 Aug 2013 19:34:13 +0000 (UTC) (envelope-from jlott@averesystems.com) Received: from mail.averesystems.com (mail.averesystems.com [208.70.68.85]) by mx1.freebsd.org (Postfix) with ESMTP id CACDB2517 for ; Thu, 15 Aug 2013 19:34:13 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.averesystems.com (Postfix) with ESMTP id 05B0C482122 for ; Thu, 15 Aug 2013 15:27:56 -0400 (EDT) X-Virus-Scanned: amavisd-new at mail.averesystems.com Received: from mail.averesystems.com ([127.0.0.1]) by localhost (mail.averesystems.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XxEi-OT73A0y for ; Thu, 15 Aug 2013 15:27:55 -0400 (EDT) Received: from jlott-mac.arriad.com (206.193.225.214.nauticom.net [206.193.225.214]) by mail.averesystems.com (Postfix) with ESMTPSA id 76A17481E2C for ; Thu, 15 Aug 2013 15:27:55 -0400 (EDT) From: Jeremiah Lott Content-Type: multipart/mixed; boundary="Apple-Mail=_2B96711E-47DD-45CA-B64C-85A2C897A624" Subject: legacy irq patch and e1000 emulation Message-Id: Date: Thu, 15 Aug 2013 15:27:54 -0400 To: freebsd-virtualization@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 6.5 \(1508\)) X-Mailer: Apple Mail (2.1508) X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Aug 2013 19:34:14 -0000 --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 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--