From owner-svn-src-head@FreeBSD.ORG Wed Sep 11 07:11:15 2013 Return-Path: Delivered-To: svn-src-head@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 CC81E72E; Wed, 11 Sep 2013 07:11:15 +0000 (UTC) (envelope-from neel@FreeBSD.org) 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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A0DC2298B; Wed, 11 Sep 2013 07:11:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8B7BFQD031340; Wed, 11 Sep 2013 07:11:15 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8B7BFfZ031334; Wed, 11 Sep 2013 07:11:15 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201309110711.r8B7BFfZ031334@svn.freebsd.org> From: Neel Natu Date: Wed, 11 Sep 2013 07:11:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r255469 - in head/sys/amd64/vmm: . io X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Sep 2013 07:11:15 -0000 Author: neel Date: Wed Sep 11 07:11:14 2013 New Revision: 255469 URL: http://svnweb.freebsd.org/changeset/base/255469 Log: Fix a limitation in bhyve that would limit the number of virtual machines to the maximum number of VT-d domains (256 on a Sandybridge). We now allocate a VT-d domain for a guest only if the administrator has explicitly configured one or more PCI passthru device(s). If there are no PCI passthru devices configured (the common case) then the number of virtual machines is no longer limited by the maximum number of VT-d domains. Reviewed by: grehan@ Approved by: re@ Modified: head/sys/amd64/vmm/io/ppt.c head/sys/amd64/vmm/io/ppt.h head/sys/amd64/vmm/vmm.c Modified: head/sys/amd64/vmm/io/ppt.c ============================================================================== --- head/sys/amd64/vmm/io/ppt.c Wed Sep 11 06:42:55 2013 (r255468) +++ head/sys/amd64/vmm/io/ppt.c Wed Sep 11 07:11:14 2013 (r255469) @@ -592,3 +592,9 @@ ppt_setup_msix(struct vm *vm, int vcpu, return (0); } +int +ppt_num_devices(void) +{ + + return (num_pptdevs); +} Modified: head/sys/amd64/vmm/io/ppt.h ============================================================================== --- head/sys/amd64/vmm/io/ppt.h Wed Sep 11 06:42:55 2013 (r255468) +++ head/sys/amd64/vmm/io/ppt.h Wed Sep 11 07:11:14 2013 (r255469) @@ -38,4 +38,5 @@ int ppt_setup_msi(struct vm *vm, int vcp int destcpu, int vector, int numvec); int ppt_setup_msix(struct vm *vm, int vcpu, int bus, int slot, int func, int idx, uint32_t msg, uint32_t vector_control, uint64_t addr); +int ppt_num_devices(void); #endif Modified: head/sys/amd64/vmm/vmm.c ============================================================================== --- head/sys/amd64/vmm/vmm.c Wed Sep 11 06:42:55 2013 (r255468) +++ head/sys/amd64/vmm/vmm.c Wed Sep 11 07:11:14 2013 (r255469) @@ -213,7 +213,8 @@ vmm_handler(module_t mod, int what, void switch (what) { case MOD_LOAD: vmmdev_init(); - iommu_init(); + if (ppt_num_devices() > 0) + iommu_init(); error = vmm_init(); if (error == 0) vmm_initialized = 1;