From owner-svn-src-all@FreeBSD.ORG Wed Apr 17 02:03:13 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 4E9E782E; Wed, 17 Apr 2013 02:03:13 +0000 (UTC) (envelope-from neel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 27A2F2D3; Wed, 17 Apr 2013 02:03:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3H23DCj099294; Wed, 17 Apr 2013 02:03:13 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3H23D1r099293; Wed, 17 Apr 2013 02:03:13 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201304170203.r3H23D1r099293@svn.freebsd.org> From: Neel Natu Date: Wed, 17 Apr 2013 02:03:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249572 - 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.14 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: Wed, 17 Apr 2013 02:03:13 -0000 Author: neel Date: Wed Apr 17 02:03:12 2013 New Revision: 249572 URL: http://svnweb.freebsd.org/changeset/base/249572 Log: Setup accesses to the memory hole below 4GB to return all 1's on read and consume all writes without any side effects. Obtained from: NetApp Modified: head/usr.sbin/bhyve/pci_emul.c Modified: head/usr.sbin/bhyve/pci_emul.c ============================================================================== --- head/usr.sbin/bhyve/pci_emul.c Tue Apr 16 22:42:40 2013 (r249571) +++ head/usr.sbin/bhyve/pci_emul.c Wed Apr 17 02:03:12 2013 (r249572) @@ -88,8 +88,6 @@ static struct lirqinfo { SET_DECLARE(pci_devemu_set, struct pci_devemu); -static uint32_t pci_hole_startaddr; - static uint64_t pci_emul_iobase; static uint64_t pci_emul_membase32; static uint64_t pci_emul_membase64; @@ -977,13 +975,12 @@ init_pci(struct vmctx *ctx) struct mem_range memp; struct pci_devemu *pde; struct slotinfo *si; + size_t lowmem; int slot, func; int error; - pci_hole_startaddr = vm_get_lowmem_limit(ctx); - pci_emul_iobase = PCI_EMUL_IOBASE; - pci_emul_membase32 = pci_hole_startaddr; + pci_emul_membase32 = vm_get_lowmem_limit(ctx); pci_emul_membase64 = PCI_EMUL_MEMBASE64; for (slot = 0; slot < MAXSLOTS; slot++) { @@ -1010,14 +1007,23 @@ init_pci(struct vmctx *ctx) lirq[15].li_generic = 1; /* - * Setup the PCI hole to return 0xff's when accessed in a region - * with no devices + * The guest physical memory map looks like the following: + * [0, lowmem) guest system memory + * [lowmem, lowmem_limit) memory hole (may be absent) + * [lowmem_limit, 4GB) PCI hole (32-bit BAR allocation) + * [4GB, 4GB + highmem) + * + * Accesses to memory addresses that are not allocated to system + * memory or PCI devices return 0xff's. */ + error = vm_get_memory_seg(ctx, 0, &lowmem); + assert(error == 0); + memset(&memp, 0, sizeof(struct mem_range)); memp.name = "PCI hole"; memp.flags = MEM_F_RW; - memp.base = pci_hole_startaddr; - memp.size = (4ULL * 1024 * 1024 * 1024) - pci_hole_startaddr; + memp.base = lowmem; + memp.size = (4ULL * 1024 * 1024 * 1024) - lowmem; memp.handler = pci_emul_fallback_handler; error = register_mem_fallback(&memp);