From owner-svn-src-all@FreeBSD.ORG Fri Apr 25 17:35:34 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AB6EDEED; Fri, 25 Apr 2014 17:35:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9830F10B2; Fri, 25 Apr 2014 17:35:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s3PHZYC5048298; Fri, 25 Apr 2014 17:35:34 GMT (envelope-from grehan@svn.freebsd.org) Received: (from grehan@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s3PHZYSd048297; Fri, 25 Apr 2014 17:35:34 GMT (envelope-from grehan@svn.freebsd.org) Message-Id: <201404251735.s3PHZYSd048297@svn.freebsd.org> From: Peter Grehan Date: Fri, 25 Apr 2014 17:35:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r264921 - head/usr.sbin/bhyve X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Apr 2014 17:35:34 -0000 Author: grehan Date: Fri Apr 25 17:35:34 2014 New Revision: 264921 URL: http://svnweb.freebsd.org/changeset/base/264921 Log: Respect and track the enable bit in the PCI configuration address word. Ignore writes, and return 0xff's, on config accesses when not set. Behaviour now matches that seen on h/w. Found with a NetBSD/amd64 guest. Reviewed by: tychon MFC after: 3 weeks Modified: head/usr.sbin/bhyve/pci_emul.c Modified: head/usr.sbin/bhyve/pci_emul.c ============================================================================== --- head/usr.sbin/bhyve/pci_emul.c Fri Apr 25 16:54:28 2014 (r264920) +++ head/usr.sbin/bhyve/pci_emul.c Fri Apr 25 17:35:34 2014 (r264921) @@ -1508,7 +1508,7 @@ pci_emul_hdrtype_fixup(int bus, int slot } } -static int cfgbus, cfgslot, cfgfunc, cfgoff; +static int cfgenable, cfgbus, cfgslot, cfgfunc, cfgoff; static int pci_emul_cfgaddr(struct vmctx *ctx, int vcpu, int in, int port, int bytes, @@ -1527,9 +1527,12 @@ pci_emul_cfgaddr(struct vmctx *ctx, int (cfgslot << 11) | (cfgfunc << 8) | cfgoff; - *eax = x | CONF1_ENABLE; + if (cfgenable) + x |= CONF1_ENABLE; + *eax = x; } else { x = *eax; + cfgenable = (x & CONF1_ENABLE) == CONF1_ENABLE; cfgoff = x & PCI_REGMAX; cfgfunc = (x >> 8) & PCI_FUNCMAX; cfgslot = (x >> 11) & PCI_SLOTMAX; @@ -1629,10 +1632,11 @@ pci_emul_cfgdata(struct vmctx *ctx, int #endif /* - * Just return if there is no device at this cfgslot:cfgfunc or - * if the guest is doing an un-aligned access + * Just return if there is no device at this cfgslot:cfgfunc, + * if the guest is doing an un-aligned access, or if the config + * address word isn't enabled. */ - if (pi == NULL || (coff & (bytes - 1)) != 0) { + if (!cfgenable || pi == NULL || (coff & (bytes - 1)) != 0) { if (in) *eax = 0xffffffff; return (0);