From owner-svn-src-stable-10@FreeBSD.ORG Sun Oct 13 00:13:58 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTP id 396D37C; Sun, 13 Oct 2013 00:13:58 +0000 (UTC) (envelope-from markm@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 2602227E3; Sun, 13 Oct 2013 00:13:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9D0DwDQ060771; Sun, 13 Oct 2013 00:13:58 GMT (envelope-from markm@svn.freebsd.org) Received: (from markm@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9D0DvpN060763; Sun, 13 Oct 2013 00:13:57 GMT (envelope-from markm@svn.freebsd.org) Message-Id: <201310130013.r9D0DvpN060763@svn.freebsd.org> From: Mark Murray Date: Sun, 13 Oct 2013 00:13:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r256414 - stable/10/sys/dev/random X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Oct 2013 00:13:58 -0000 Author: markm Date: Sun Oct 13 00:13:57 2013 New Revision: 256414 URL: http://svnweb.freebsd.org/changeset/base/256414 Log: MFC: There is an issue (not seen in our testing) where "yarrow" and "dummy" switch priorities, and the users are left with no usable /dev/random. The fix assigns priories to these and gives the users what they want. The override tuneable has a stupid name (blame me!) and this fixes it to be something that 'sysctl kern.random' emits and is the right thing to set. Approved by: re (gjb) Approved by: secteam (cperciva) Modified: stable/10/sys/dev/random/dummy_rng.c stable/10/sys/dev/random/random_adaptors.c stable/10/sys/dev/random/randomdev.h stable/10/sys/dev/random/randomdev_soft.c Modified: stable/10/sys/dev/random/dummy_rng.c ============================================================================== --- stable/10/sys/dev/random/dummy_rng.c Sun Oct 13 00:13:29 2013 (r256413) +++ stable/10/sys/dev/random/dummy_rng.c Sun Oct 13 00:13:57 2013 (r256414) @@ -102,6 +102,7 @@ struct random_adaptor dummy_random = { .read = (random_read_func_t *)random_null_func, .reseed = (random_reseed_func_t *)random_null_func, .seeded = 0, /* This device can never be seeded */ + .priority = 1, /* Bottom priority, so goes to last position */ }; static int Modified: stable/10/sys/dev/random/random_adaptors.c ============================================================================== --- stable/10/sys/dev/random/random_adaptors.c Sun Oct 13 00:13:29 2013 (r256413) +++ stable/10/sys/dev/random/random_adaptors.c Sun Oct 13 00:13:57 2013 (r256414) @@ -104,12 +104,13 @@ void random_adaptor_choose(struct random_adaptor **adaptor) { char rngs[128], *token, *cp; - struct random_adaptors *rpp; + struct random_adaptors *rppi, *ramax; + unsigned primax; KASSERT(adaptor != NULL, ("pre-conditions failed")); *adaptor = NULL; - if (TUNABLE_STR_FETCH("rngs_want", rngs, sizeof(rngs))) { + if (TUNABLE_STR_FETCH("kern.random.active_adaptor", rngs, sizeof(rngs))) { cp = rngs; while ((token = strsep(&cp, ",")) != NULL) @@ -120,16 +121,23 @@ random_adaptor_choose(struct random_adap " skipping\n", token); } + primax = 0U; if (*adaptor == NULL) { /* - * Fallback to the first thing that's on the list of - * available RNGs. + * Fall back to the highest priority item on the available + * RNG list. */ sx_slock(&adaptors_lock); - rpp = LIST_FIRST(&adaptors); - if (rpp != NULL) - *adaptor = rpp->rsp; + ramax = NULL; + LIST_FOREACH(rppi, &adaptors, entries) { + if (rppi->rsp->priority >= primax) { + ramax = rppi; + primax = rppi->rsp->priority; + } + } + if (ramax != NULL) + *adaptor = ramax->rsp; sx_sunlock(&adaptors_lock); Modified: stable/10/sys/dev/random/randomdev.h ============================================================================== --- stable/10/sys/dev/random/randomdev.h Sun Oct 13 00:13:29 2013 (r256413) +++ stable/10/sys/dev/random/randomdev.h Sun Oct 13 00:13:57 2013 (r256414) @@ -44,6 +44,7 @@ struct random_adaptor { struct selinfo rsel; const char *ident; int seeded; + unsigned priority; random_init_func_t *init; random_deinit_func_t *deinit; random_block_func_t *block; Modified: stable/10/sys/dev/random/randomdev_soft.c ============================================================================== --- stable/10/sys/dev/random/randomdev_soft.c Sun Oct 13 00:13:29 2013 (r256413) +++ stable/10/sys/dev/random/randomdev_soft.c Sun Oct 13 00:13:57 2013 (r256414) @@ -84,6 +84,7 @@ static struct random_adaptor random_cont .poll = randomdev_poll, .reseed = randomdev_flush_reseed, .seeded = 0, /* This will be seeded during entropy processing */ + .priority = 90, /* High priority, so top of the list. Fortuna may still win. */ }; #define RANDOM_MODULE_NAME yarrow #define RANDOM_CSPRNG_NAME "yarrow" @@ -99,6 +100,7 @@ static struct random_adaptor random_cont .poll = randomdev_poll, .reseed = randomdev_flush_reseed, .seeded = 0, /* This will be excplicitly seeded at startup when secured */ + .priority = 100, /* High priority, so top of the list. Beat Yarrow. */ }; #define RANDOM_MODULE_NAME fortuna #define RANDOM_CSPRNG_NAME "fortuna" From owner-svn-src-stable-10@FreeBSD.ORG Sun Oct 13 00:24:45 2013 Return-Path: Delivered-To: svn-src-stable-10@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 8555A787; Sun, 13 Oct 2013 00:24:45 +0000 (UTC) (envelope-from gjb@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 58AE6283F; Sun, 13 Oct 2013 00:24:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9D0OjZw066894; Sun, 13 Oct 2013 00:24:45 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9D0OjS9066892; Sun, 13 Oct 2013 00:24:45 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201310130024.r9D0OjS9066892@svn.freebsd.org> From: Glen Barber Date: Sun, 13 Oct 2013 00:24:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r256420 - stable/10/sys/conf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Oct 2013 00:24:45 -0000 Author: gjb Date: Sun Oct 13 00:24:44 2013 New Revision: 256420 URL: http://svnweb.freebsd.org/changeset/base/256420 Log: Forced commit to mark the real -BETA1 point. Approved by: re (implicit) Modified: stable/10/sys/conf/newvers.sh Modified: stable/10/sys/conf/newvers.sh ============================================================================== From owner-svn-src-stable-10@FreeBSD.ORG Mon Oct 14 18:24:31 2013 Return-Path: Delivered-To: svn-src-stable-10@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 6FD4E251; Mon, 14 Oct 2013 18:24:31 +0000 (UTC) (envelope-from markm@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 5D1782CB9; Mon, 14 Oct 2013 18:24:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9EIOVft073183; Mon, 14 Oct 2013 18:24:31 GMT (envelope-from markm@svn.freebsd.org) Received: (from markm@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9EIOVWF073182; Mon, 14 Oct 2013 18:24:31 GMT (envelope-from markm@svn.freebsd.org) Message-Id: <201310141824.r9EIOVWF073182@svn.freebsd.org> From: Mark Murray Date: Mon, 14 Oct 2013 18:24:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r256449 - stable/10/sys/modules/random X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2013 18:24:31 -0000 Author: markm Date: Mon Oct 14 18:24:30 2013 New Revision: 256449 URL: http://svnweb.freebsd.org/changeset/base/256449 Log: MFC: Add extra files to the KLD random.ko module to allow it to load. Approved by: re (kib) Modified: stable/10/sys/modules/random/Makefile Directory Properties: stable/10/sys/ (props changed) Modified: stable/10/sys/modules/random/Makefile ============================================================================== --- stable/10/sys/modules/random/Makefile Mon Oct 14 18:17:09 2013 (r256448) +++ stable/10/sys/modules/random/Makefile Mon Oct 14 18:24:30 2013 (r256449) @@ -11,6 +11,7 @@ SRCS+= nehemiah.c SRCS+= ivy.c .endif SRCS+= randomdev_soft.c yarrow.c hash.c +SRCS+= random_harvestq.c live_entropy_sources.c rwfile.c SRCS+= rijndael-alg-fst.c rijndael-api-fst.c sha2.c SRCS+= bus_if.h device_if.h vnode_if.h opt_cpu.h opt_random.h From owner-svn-src-stable-10@FreeBSD.ORG Tue Oct 15 21:08:37 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTP id 9A5ACAAF; Tue, 15 Oct 2013 21:08:37 +0000 (UTC) (envelope-from jhb@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 86CC628C7; Tue, 15 Oct 2013 21:08:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9FL8bVY001205; Tue, 15 Oct 2013 21:08:37 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9FL8bsY001204; Tue, 15 Oct 2013 21:08:37 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201310152108.r9FL8bsY001204@svn.freebsd.org> From: John Baldwin Date: Tue, 15 Oct 2013 21:08:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r256562 - stable/10/sys/boot/i386/btx/btx X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2013 21:08:37 -0000 Author: jhb Date: Tue Oct 15 21:08:37 2013 New Revision: 256562 URL: http://svnweb.freebsd.org/changeset/base/256562 Log: MFC 256293: Sanitize the %eflags returned by BIOS routines. Some BIOS routines enter protected mode and may leave protected-mode-specific flags like PSL_NT set when they return to real mode. This can cause a fault when BTX re-enters protected mode after the BIOS mode returns. Approved by: re (gjb) Modified: stable/10/sys/boot/i386/btx/btx/btx.S Directory Properties: stable/10/sys/ (props changed) stable/10/sys/boot/ (props changed) Modified: stable/10/sys/boot/i386/btx/btx/btx.S ============================================================================== --- stable/10/sys/boot/i386/btx/btx/btx.S Tue Oct 15 21:04:46 2013 (r256561) +++ stable/10/sys/boot/i386/btx/btx/btx.S Tue Oct 15 21:08:37 2013 (r256562) @@ -41,6 +41,8 @@ .set PSL_RESERVED_DEFAULT,0x00000002 .set PSL_T,0x00000100 # Trap flag .set PSL_I,0x00000200 # Interrupt enable flag + .set PSL_D,0x00000400 # String instruction direction + .set PSL_NT,0x00004000 # Nested task flag .set PSL_VM,0x00020000 # Virtual 8086 mode flag .set PSL_AC,0x00040000 # Alignment check flag /* @@ -611,8 +613,8 @@ rret_tramp: movw $MEM_ESPR-0x08,%sp # R pushl %ds # regs pushl %es pushfl # Save %eflags - cli # Disable interrupts - std # String ops dec + pushl $PSL_RESERVED_DEFAULT|PSL_D # Use clean %eflags with + popfl # string ops dec xorw %ax,%ax # Reset seg movw %ax,%ds # regs movw %ax,%es # (%ss is already 0) @@ -675,6 +677,7 @@ rret_tramp.1: xorl %ecx,%ecx # Zero testl $V86F_FLAGS,%edx # User wants flags? jz rret_tramp.3 # No movl MEM_ESPR-0x3c,%eax # Read real mode flags + andl $~(PSL_T|PSL_NT),%eax # Clear unsafe flags movw %ax,-0x08(%esi) # Update user flags (low 16) /* * Return to the user task From owner-svn-src-stable-10@FreeBSD.ORG Wed Oct 16 21:52:55 2013 Return-Path: Delivered-To: svn-src-stable-10@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 7F0CCB51; Wed, 16 Oct 2013 21:52:55 +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 6BB782D6F; Wed, 16 Oct 2013 21:52:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9GLqtGm000835; Wed, 16 Oct 2013 21:52:55 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9GLqtIG000834; Wed, 16 Oct 2013 21:52:55 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201310162152.r9GLqtIG000834@svn.freebsd.org> From: Neel Natu Date: Wed, 16 Oct 2013 21:52:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r256651 - stable/10/sys/amd64/vmm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2013 21:52:55 -0000 Author: neel Date: Wed Oct 16 21:52:54 2013 New Revision: 256651 URL: http://svnweb.freebsd.org/changeset/base/256651 Log: MFC r256570: Fix the witness warning that warned against calling uiomove() while holding the 'vmmdev_mtx' in vmmdev_rw(). Rely on the 'si_threadcount' accounting to ensure that we never destroy the VM device node while it has operations in progress (e.g. ioctl, mmap etc). Approved by: re (rodrigc) Modified: stable/10/sys/amd64/vmm/vmm_dev.c Directory Properties: stable/10/sys/ (props changed) stable/10/sys/amd64/vmm/ (props changed) Modified: stable/10/sys/amd64/vmm/vmm_dev.c ============================================================================== --- stable/10/sys/amd64/vmm/vmm_dev.c Wed Oct 16 20:04:06 2013 (r256650) +++ stable/10/sys/amd64/vmm/vmm_dev.c Wed Oct 16 21:52:54 2013 (r256651) @@ -60,7 +60,10 @@ struct vmmdev_softc { struct vm *vm; /* vm instance cookie */ struct cdev *cdev; SLIST_ENTRY(vmmdev_softc) link; + int flags; }; +#define VSC_LINKED 0x01 + static SLIST_HEAD(, vmmdev_softc) head; static struct mtx vmmdev_mtx; @@ -104,7 +107,6 @@ vmmdev_rw(struct cdev *cdev, struct uio static char zerobuf[PAGE_SIZE]; error = 0; - mtx_lock(&vmmdev_mtx); sc = vmmdev_lookup2(cdev); if (sc == NULL) error = ENXIO; @@ -134,8 +136,6 @@ vmmdev_rw(struct cdev *cdev, struct uio vm_gpa_release(cookie); } } - - mtx_unlock(&vmmdev_mtx); return (error); } @@ -379,34 +379,28 @@ vmmdev_mmap_single(struct cdev *cdev, vm int error; struct vmmdev_softc *sc; - mtx_lock(&vmmdev_mtx); - sc = vmmdev_lookup2(cdev); if (sc != NULL && (nprot & PROT_EXEC) == 0) error = vm_get_memobj(sc->vm, *offset, size, offset, object); else error = EINVAL; - mtx_unlock(&vmmdev_mtx); - return (error); } static void -vmmdev_destroy(struct vmmdev_softc *sc, boolean_t unlink) +vmmdev_destroy(void *arg) { - /* - * XXX must stop virtual machine instances that may be still - * running and cleanup their state. - */ - if (sc->cdev) + struct vmmdev_softc *sc = arg; + + if (sc->cdev != NULL) destroy_dev(sc->cdev); - if (sc->vm) + if (sc->vm != NULL) vm_destroy(sc->vm); - if (unlink) { + if ((sc->flags & VSC_LINKED) != 0) { mtx_lock(&vmmdev_mtx); SLIST_REMOVE(&head, sc, vmmdev_softc, link); mtx_unlock(&vmmdev_mtx); @@ -421,27 +415,38 @@ sysctl_vmm_destroy(SYSCTL_HANDLER_ARGS) int error; char buf[VM_MAX_NAMELEN]; struct vmmdev_softc *sc; + struct cdev *cdev; strlcpy(buf, "beavis", sizeof(buf)); error = sysctl_handle_string(oidp, buf, sizeof(buf), req); if (error != 0 || req->newptr == NULL) return (error); - /* - * XXX TODO if any process has this device open then fail - */ - mtx_lock(&vmmdev_mtx); sc = vmmdev_lookup(buf); - if (sc == NULL) { + if (sc == NULL || sc->cdev == NULL) { mtx_unlock(&vmmdev_mtx); return (EINVAL); } - sc->cdev->si_drv1 = NULL; + /* + * The 'cdev' will be destroyed asynchronously when 'si_threadcount' + * goes down to 0 so we should not do it again in the callback. + */ + cdev = sc->cdev; + sc->cdev = NULL; mtx_unlock(&vmmdev_mtx); - vmmdev_destroy(sc, TRUE); + /* + * Schedule the 'cdev' to be destroyed: + * + * - any new operations on this 'cdev' will return an error (ENXIO). + * + * - when the 'si_threadcount' dwindles down to zero the 'cdev' will + * be destroyed and the callback will be invoked in a taskqueue + * context. + */ + destroy_dev_sched_cb(cdev, vmmdev_destroy, sc); return (0); } @@ -462,6 +467,7 @@ sysctl_vmm_create(SYSCTL_HANDLER_ARGS) { int error; struct vm *vm; + struct cdev *cdev; struct vmmdev_softc *sc, *sc2; char buf[VM_MAX_NAMELEN]; @@ -489,22 +495,28 @@ sysctl_vmm_create(SYSCTL_HANDLER_ARGS) */ mtx_lock(&vmmdev_mtx); sc2 = vmmdev_lookup(buf); - if (sc2 == NULL) + if (sc2 == NULL) { SLIST_INSERT_HEAD(&head, sc, link); + sc->flags |= VSC_LINKED; + } mtx_unlock(&vmmdev_mtx); if (sc2 != NULL) { - vmmdev_destroy(sc, FALSE); + vmmdev_destroy(sc); return (EEXIST); } - error = make_dev_p(MAKEDEV_CHECKNAME, &sc->cdev, &vmmdevsw, NULL, + error = make_dev_p(MAKEDEV_CHECKNAME, &cdev, &vmmdevsw, NULL, UID_ROOT, GID_WHEEL, 0600, "vmm/%s", buf); if (error != 0) { - vmmdev_destroy(sc, TRUE); + vmmdev_destroy(sc); return (error); } + + mtx_lock(&vmmdev_mtx); + sc->cdev = cdev; sc->cdev->si_drv1 = sc; + mtx_unlock(&vmmdev_mtx); return (0); } From owner-svn-src-stable-10@FreeBSD.ORG Thu Oct 17 06:48:44 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTP id 4F62C4D7; Thu, 17 Oct 2013 06:48:44 +0000 (UTC) (envelope-from hrs@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 3BCB426E5; Thu, 17 Oct 2013 06:48:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9H6milX086772; Thu, 17 Oct 2013 06:48:44 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9H6mipU086771; Thu, 17 Oct 2013 06:48:44 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201310170648.r9H6mipU086771@svn.freebsd.org> From: Hiroki Sato Date: Thu, 17 Oct 2013 06:48:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r256668 - stable/10/etc/rc.d X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2013 06:48:44 -0000 Author: hrs Date: Thu Oct 17 06:48:43 2013 New Revision: 256668 URL: http://svnweb.freebsd.org/changeset/base/256668 Log: MFC 256440, 256498: - Normalize jailname. "example.com" is converted to "example_com". - Fix a bug that some $jail_{jname}_foo variables did not work. - Fix a bug which prevented $jail_devfs_ruleset from working[1]. - Move $jail_parameters to the last of the configuraiton lines[1]. - Fix "ifname|addr" syntax support in jail_{jname}_ip. - Create /var/run/jail_{jname}.id because ezjail-admin depends on it. Reported by: jase [1] Approved by: re (gjb) Modified: stable/10/etc/rc.d/jail Directory Properties: stable/10/etc/rc.d/ (props changed) Modified: stable/10/etc/rc.d/jail ============================================================================== --- stable/10/etc/rc.d/jail Thu Oct 17 06:14:32 2013 (r256667) +++ stable/10/etc/rc.d/jail Thu Oct 17 06:48:43 2013 (r256668) @@ -22,7 +22,7 @@ status_cmd="jail_status" extra_commands="config console status" : ${jail_conf:=/etc/jail.conf} : ${jail_program:=/usr/sbin/jail} -: ${jail_consolecmd:=/bin/sh} +: ${jail_consolecmd:=/usr/bin/login -f root} : ${jail_jexec:=/usr/sbin/jexec} : ${jail_jls:=/usr/sbin/jls} @@ -94,7 +94,7 @@ extract_var() # parse_options() { - local _j + local _j _p _j=$1 _confwarn=0 @@ -166,7 +166,7 @@ parse_options() jail_handle_ips_option $_ip $_interface alias=0 while : ; do - eval _x=\"\$jail_${_jail}_ip_multi${alias}\" + eval _x=\"\$jail_${_j}_ip_multi${alias}\" [ -z "$_x" ] && break jail_handle_ips_option $_x $_interface @@ -208,6 +208,7 @@ parse_options() eval : \${jail_${_j}_devfs_enable:=${jail_devfs_enable:-NO}} if checkyesno jail_${_j}_devfs_enable; then echo " mount.devfs;" + eval _ruleset=\${jail_${_j}_devfs_ruleset:-${jail_devfs_ruleset}} case $_ruleset in "") ;; [0-9]*) echo " devfs_ruleset = \"$_ruleset\";" ;; @@ -217,7 +218,7 @@ parse_options() # mount(8) only accepts an integer. # This should accept a ruleset name. ;; - *) warn "devfs_ruleset must be integer." ;; + *) warn "devfs_ruleset must be an integer." ;; esac if [ -r $_fstab ]; then echo " mount.fstab = \"$_fstab\";" @@ -234,8 +235,6 @@ parse_options() "\"procfs ${_rootdir%/}/proc procfs rw 0 0\";" fi - echo " ${_parameters};" - eval : \${jail_${_j}_mount_enable:=${jail_mount_enable:-NO}} if checkyesno jail_${_j}_mount_enable; then echo " allow.mount;" >> $_conf @@ -243,6 +242,9 @@ parse_options() extract_var $_j set_hostname_allow allow.set_hostname YN NO extract_var $_j sysvipc_allow allow.sysvipc YN NO + for _p in $_parameters; do + echo " ${_p%\;};" + done echo "}" ) >> $_conf @@ -327,9 +329,9 @@ jail_extract_address() # jail_handle_ips_option() { - local _x _type _i _iface + local _x _type _i _defif _x=$1 - _iface=$2 + _defif=$2 if [ -z "${_x}" ]; then # No IP given. This can happen for the primary address @@ -353,7 +355,8 @@ jail_handle_ips_option() _type="" _addr="" _mask="" - jail_extract_address $_i $_iface + _iface="" + jail_extract_address $_i $_defif # make sure we got an address. case $_addr in @@ -364,10 +367,10 @@ jail_handle_ips_option() # Append address to list of addresses for the jail command. case $_type in inet) - echo " ip4.addr += \"${_addr}${_mask}\";" + echo " ip4.addr += \"${_iface}|${_addr}${_mask}\";" ;; inet6) - echo " ip6.addr += \"${_addr}${_mask}\";" + echo " ip6.addr += \"${_iface}|${_addr}${_mask}\";" need_dad_wait=1 ;; esac @@ -376,26 +379,35 @@ jail_handle_ips_option() jail_config() { + local _j + case $1 in _ALL) return ;; esac - for _jail in $@; do - if parse_options $_jail; then - echo "$_jail: parameters are in $_conf." + for _j in $@; do + _j=$(echo $_j | tr /. _) + if parse_options $_j; then + echo "$_j: parameters are in $_conf." fi done } jail_console() { + local _j _cmd + # One argument that is not _ALL. case $#:$1 in - 1:_ALL) err 3 "Specify a jail name." ;; - 1:*) ;; - *) err 3 "Specify a jail name." ;; + 0:*|1:_ALL) err 3 "Specify a jail name." ;; + 1:*) ;; + esac + _j=$(echo $1 | tr /. _) + shift + case $# in + 0) eval _cmd=\${jail_${_j}_consolecmd:-$jail_consolecmd} ;; + *) _cmd=$@ ;; esac - eval _cmd=\${jail_$1_consolecmd:-$jail_consolecmd} - $jail_jexec $1 $_cmd + $jail_jexec $_j $_cmd } jail_status() @@ -406,6 +418,8 @@ jail_status() jail_start() { + local _j _jid _jn + if [ $# = 0 ]; then return fi @@ -416,27 +430,39 @@ jail_start() command=$jail_program rc_flags=$jail_flags command_args="-f $jail_conf -c" - $command $rc_flags $command_args "*" + $jail_jls -nq | while read IN; do + _jn=$(echo $IN | tr " " "\n" | grep name=) + _jid=$(echo $IN | tr " " "\n" | grep jid=) + if $command $rc_flags $command_args ${_jn#name=}; then + echo -n " ${_jn#name=}" + echo "${_jid#jid=}" \ + > /var/run/jail_${_jn#name=}.id + fi + done echo '.' return ;; esac _tmp=`mktemp -t jail` || exit 3 - for _jail in $@; do - parse_options $_jail || continue + for _j in $@; do + _j=$(echo $_j | tr /. _) + parse_options $_j || continue eval rc_flags=\${jail_${_j}_flags:-$jail_flags} eval command=\${jail_${_j}_program:-$jail_program} if checkyesno jail_parallel_start; then - command_args="-i -f $_conf -c $_jail &" + command_args="-i -f $_conf -c $_j &" else - command_args="-i -f $_conf -c $_jail" + command_args="-i -f $_conf -c $_j" fi if $command $rc_flags $command_args \ >> $_tmp 2>&1 /var/run/jail_${_j}.id else - echo " cannot start jail \"${_hostname:-${jail}}\": " + rm -f /var/run/jail_${_j}.id + echo " cannot start jail \"${_hostname:-${_j}}\": " cat $_tmp fi rm -f $_tmp @@ -446,6 +472,8 @@ jail_start() jail_stop() { + local _j _jn + if [ $# = 0 ]; then return fi @@ -456,16 +484,29 @@ jail_stop() command=$jail_program rc_flags=$jail_flags command_args="-f $jail_conf -r" - $command $rc_flags $command_args "*" + $jail_jls -nq | while read IN; do + _jn=$(echo $IN | tr " " "\n" | grep name=) + echo -n " ${_jn#name=}" + $command $rc_flags $command_args ${_jn#name=} + if ! $jail_jls -j ${_jn#name=} > /dev/null 2>&1; then + rm -f /var/run/jail_${_jn#name=}.id + fi + done echo '.' return ;; esac - for _jail in $@; do - parse_options $_jail || continue + for _j in $@; do + _j=$(echo $_j | tr /. _) + parse_options $_j || continue + if ! $jail_jls -j $_j > /dev/null 2>&1; then + continue + fi eval command=\${jail_${_j}_program:-$jail_program} - if $command -q -f $_conf -r $_jail; then - echo -n " ${_hostname:-${_jail}}" + echo -n " ${_hostname:-${_j}}" + $command -q -f $_conf -r $_j + if ! $jail_jls -j $_j > /dev/null 2>&1; then + rm -f /var/run/jail_${_j}.id fi done echo '.' From owner-svn-src-stable-10@FreeBSD.ORG Thu Oct 17 14:08:47 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTP id 6BB30718; Thu, 17 Oct 2013 14:08:47 +0000 (UTC) (envelope-from alfred@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 582CC2331; Thu, 17 Oct 2013 14:08:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9HE8lEq020160; Thu, 17 Oct 2013 14:08:47 GMT (envelope-from alfred@svn.freebsd.org) Received: (from alfred@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9HE8lu4020159; Thu, 17 Oct 2013 14:08:47 GMT (envelope-from alfred@svn.freebsd.org) Message-Id: <201310171408.r9HE8lu4020159@svn.freebsd.org> From: Alfred Perlstein Date: Thu, 17 Oct 2013 14:08:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r256686 - stable/10/sys/ofed/include/linux X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2013 14:08:47 -0000 Author: alfred Date: Thu Oct 17 14:08:46 2013 New Revision: 256686 URL: http://svnweb.freebsd.org/changeset/base/256686 Log: Fix __free_pages() in the linux shim. __free_pages() is actaully supposed to take a "struct page *" not an address. MFC: 256546 Approved by: re Modified: stable/10/sys/ofed/include/linux/gfp.h Directory Properties: stable/10/sys/ (props changed) Modified: stable/10/sys/ofed/include/linux/gfp.h ============================================================================== --- stable/10/sys/ofed/include/linux/gfp.h Thu Oct 17 13:28:57 2013 (r256685) +++ stable/10/sys/ofed/include/linux/gfp.h Thu Oct 17 14:08:46 2013 (r256686) @@ -92,14 +92,14 @@ __free_page(struct page *m) } static inline void -__free_pages(void *p, unsigned int order) +__free_pages(struct page *m, unsigned int order) { size_t size; - if (p == 0) + if (m == NULL) return; size = PAGE_SIZE << order; - kmem_free(kmem_arena, (vm_offset_t)p, size); + kmem_free(kmem_arena, (vm_offset_t)page_address(m), size); } /* From owner-svn-src-stable-10@FreeBSD.ORG Fri Oct 18 07:42:51 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTP id 2DE88ACA; Fri, 18 Oct 2013 07:42:51 +0000 (UTC) (envelope-from dteske@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 1B2182742; Fri, 18 Oct 2013 07:42:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9I7go9C083982; Fri, 18 Oct 2013 07:42:50 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9I7goZv083981; Fri, 18 Oct 2013 07:42:50 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201310180742.r9I7goZv083981@svn.freebsd.org> From: Devin Teske Date: Fri, 18 Oct 2013 07:42:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r256719 - in stable/10/usr.sbin/bsdinstall: . scripts X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2013 07:42:51 -0000 Author: dteske Date: Fri Oct 18 07:42:50 2013 New Revision: 256719 URL: http://svnweb.freebsd.org/changeset/base/256719 Log: MFC r256489: Add executable bit to docsinstall [old] and entropy [new] scripts. MFC r256541: Document BSDINSTALL_TMPBOOT environment variable introduced by SVN r256343. Approved by: re (gjb) Modified: stable/10/usr.sbin/bsdinstall/bsdinstall.8 Directory Properties: stable/10/usr.sbin/bsdinstall/ (props changed) stable/10/usr.sbin/bsdinstall/scripts/docsinstall (props changed) stable/10/usr.sbin/bsdinstall/scripts/entropy (props changed) Modified: stable/10/usr.sbin/bsdinstall/bsdinstall.8 ============================================================================== --- stable/10/usr.sbin/bsdinstall/bsdinstall.8 Fri Oct 18 07:42:16 2013 (r256718) +++ stable/10/usr.sbin/bsdinstall/bsdinstall.8 Fri Oct 18 07:42:50 2013 (r256719) @@ -254,6 +254,14 @@ will be stored until the target is executed. If this directory does not already exist, it will be created. Default: .Pa /tmp/bsdinstall_etc +.It Ev BSDINSTALL_TMPBOOT +Directory where files destined for the new system's +.Pa /boot +will be stored until the +.Cm config +target is executed. If this directory does not already exist, it will be +created. Default: +.Pa /tmp/bsdinstall_boot .El .Sh SCRIPTING .Nm From owner-svn-src-stable-10@FreeBSD.ORG Fri Oct 18 17:08:23 2013 Return-Path: Delivered-To: svn-src-stable-10@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 C2094B7; Fri, 18 Oct 2013 17:08:23 +0000 (UTC) (envelope-from dim@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 AE3A821A2; Fri, 18 Oct 2013 17:08:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9IH8NDR084862; Fri, 18 Oct 2013 17:08:23 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9IH8Nt1084861; Fri, 18 Oct 2013 17:08:23 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201310181708.r9IH8Nt1084861@svn.freebsd.org> From: Dimitry Andric Date: Fri, 18 Oct 2013 17:08:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r256747 - stable/10/sys/xen X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2013 17:08:23 -0000 Author: dim Date: Fri Oct 18 17:08:23 2013 New Revision: 256747 URL: http://svnweb.freebsd.org/changeset/base/256747 Log: MFC r256746: Remove redundant redeclaration of gdtset in sys/xen/xen-os.h, to silence a gcc warning. Approved by: re (glebius) Modified: stable/10/sys/xen/xen-os.h Directory Properties: stable/10/sys/ (props changed) Modified: stable/10/sys/xen/xen-os.h ============================================================================== --- stable/10/sys/xen/xen-os.h Fri Oct 18 17:06:13 2013 (r256746) +++ stable/10/sys/xen/xen-os.h Fri Oct 18 17:08:23 2013 (r256747) @@ -50,8 +50,6 @@ /* Force a proper event-channel callback from Xen. */ void force_evtchn_callback(void); -extern int gdtset; - extern shared_info_t *HYPERVISOR_shared_info; enum xen_domain_type { From owner-svn-src-stable-10@FreeBSD.ORG Fri Oct 18 21:42:48 2013 Return-Path: Delivered-To: svn-src-stable-10@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 ESMTP id 633FB416; Fri, 18 Oct 2013 21:42:48 +0000 (UTC) (envelope-from grehan@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 50D10202A; Fri, 18 Oct 2013 21:42:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9ILgm4X032688; Fri, 18 Oct 2013 21:42:48 GMT (envelope-from grehan@svn.freebsd.org) Received: (from grehan@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9ILgmTP032687; Fri, 18 Oct 2013 21:42:48 GMT (envelope-from grehan@svn.freebsd.org) Message-Id: <201310182142.r9ILgmTP032687@svn.freebsd.org> From: Peter Grehan Date: Fri, 18 Oct 2013 21:42:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r256754 - stable/10/usr.sbin/bhyve X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2013 21:42:48 -0000 Author: grehan Date: Fri Oct 18 21:42:47 2013 New Revision: 256754 URL: http://svnweb.freebsd.org/changeset/base/256754 Log: MFC r256709: Eliminate unconditional debug printfs. Linux writes to these nominally read-only registers, so avoid having bhyve write warning messages to stdout when the reg writes can be safely ignored. Change the WPRINTF to DPRINTF which is conditional. Approved by: re (gjb) Modified: stable/10/usr.sbin/bhyve/pci_ahci.c Directory Properties: stable/10/usr.sbin/bhyve/ (props changed) Modified: stable/10/usr.sbin/bhyve/pci_ahci.c ============================================================================== --- stable/10/usr.sbin/bhyve/pci_ahci.c Fri Oct 18 20:52:42 2013 (r256753) +++ stable/10/usr.sbin/bhyve/pci_ahci.c Fri Oct 18 21:42:47 2013 (r256754) @@ -1543,7 +1543,7 @@ pci_ahci_host_write(struct pci_ahci_soft case AHCI_PI: case AHCI_VS: case AHCI_CAP2: - WPRINTF("pci_ahci_host: read only registers 0x%"PRIx64"\n", offset); + DPRINTF("pci_ahci_host: read only registers 0x%"PRIx64"\n", offset); break; case AHCI_GHC: if (value & AHCI_GHC_HR) From owner-svn-src-stable-10@FreeBSD.ORG Fri Oct 18 22:05:19 2013 Return-Path: Delivered-To: svn-src-stable-10@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 0E2169A9; Fri, 18 Oct 2013 22:05:19 +0000 (UTC) (envelope-from grehan@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 ED6F5218A; Fri, 18 Oct 2013 22:05:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9IM5I4R044759; Fri, 18 Oct 2013 22:05:18 GMT (envelope-from grehan@svn.freebsd.org) Received: (from grehan@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9IM5H1x044748; Fri, 18 Oct 2013 22:05:17 GMT (envelope-from grehan@svn.freebsd.org) Message-Id: <201310182205.r9IM5H1x044748@svn.freebsd.org> From: Peter Grehan Date: Fri, 18 Oct 2013 22:05:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r256755 - stable/10/usr.sbin/bhyve X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2013 22:05:19 -0000 Author: grehan Date: Fri Oct 18 22:05:17 2013 New Revision: 256755 URL: http://svnweb.freebsd.org/changeset/base/256755 Log: MFC r256709: Eliminate unconditional debug printfs. Linux writes to these nominally read-only registers, so avoid having bhyve write warning messages to stdout when the reg writes can be safely ignored. Change the WPRINTF to DPRINTF which is conditional. Approved by: re (delphij) Modified: stable/10/usr.sbin/bhyve/bhyverun.c stable/10/usr.sbin/bhyve/bhyverun.h stable/10/usr.sbin/bhyve/mptbl.c stable/10/usr.sbin/bhyve/pci_hostbridge.c stable/10/usr.sbin/bhyve/pci_virtio_block.c stable/10/usr.sbin/bhyve/pci_virtio_net.c stable/10/usr.sbin/bhyve/rtc.c Directory Properties: stable/10/usr.sbin/bhyve/ (props changed) Modified: stable/10/usr.sbin/bhyve/bhyverun.c ============================================================================== --- stable/10/usr.sbin/bhyve/bhyverun.c Fri Oct 18 21:42:47 2013 (r256754) +++ stable/10/usr.sbin/bhyve/bhyverun.c Fri Oct 18 22:05:17 2013 (r256755) @@ -81,6 +81,7 @@ int guest_ncpus; static int pincpu = -1; static int guest_vmexit_on_hlt, guest_vmexit_on_pause, disable_x2apic; +static int virtio_msix = 1; static int foundcpus; @@ -120,7 +121,7 @@ usage(int code) { fprintf(stderr, - "Usage: %s [-aehAHIP][-g ][-s ][-S ]" + "Usage: %s [-aehAHIPW][-g ][-s ][-S ]" "[-c vcpus][-p pincpu][-m mem]" " \n" " -a: local apic is in XAPIC mode (default is X2APIC)\n" @@ -131,6 +132,7 @@ usage(int code) " -H: vmexit from the guest on hlt\n" " -I: present an ioapic to the guest\n" " -P: vmexit from the guest on pause\n" + " -W: force virtio to use single-vector MSI\n" " -e: exit on unhandled i/o access\n" " -h: help\n" " -s: PCI slot config\n" @@ -169,6 +171,13 @@ fbsdrun_vmexit_on_hlt(void) return (guest_vmexit_on_hlt); } +int +fbsdrun_virtio_msix(void) +{ + + return (virtio_msix); +} + static void * fbsdrun_start_thread(void *param) { @@ -500,7 +509,7 @@ main(int argc, char *argv[]) ioapic = 0; memsize = 256 * MB; - while ((c = getopt(argc, argv, "abehAHIPp:g:c:s:S:m:")) != -1) { + while ((c = getopt(argc, argv, "abehAHIPWp:g:c:s:S:m:")) != -1) { switch (c) { case 'a': disable_x2apic = 1; @@ -547,6 +556,9 @@ main(int argc, char *argv[]) case 'e': strictio = 1; break; + case 'W': + virtio_msix = 0; + break; case 'h': usage(0); default: Modified: stable/10/usr.sbin/bhyve/bhyverun.h ============================================================================== --- stable/10/usr.sbin/bhyve/bhyverun.h Fri Oct 18 21:42:47 2013 (r256754) +++ stable/10/usr.sbin/bhyve/bhyverun.h Fri Oct 18 22:05:17 2013 (r256755) @@ -46,4 +46,5 @@ int fbsdrun_muxed(void); int fbsdrun_vmexit_on_hlt(void); int fbsdrun_vmexit_on_pause(void); int fbsdrun_disable_x2apic(void); +int fbsdrun_virtio_msix(void); #endif Modified: stable/10/usr.sbin/bhyve/mptbl.c ============================================================================== --- stable/10/usr.sbin/bhyve/mptbl.c Fri Oct 18 21:42:47 2013 (r256754) +++ stable/10/usr.sbin/bhyve/mptbl.c Fri Oct 18 22:05:17 2013 (r256755) @@ -71,6 +71,9 @@ __FBSDID("$FreeBSD$"); #define MPEP_FEATURES (0xBFEBFBFF) /* XXX Intel i7 */ +/* Number of i/o intr entries */ +#define MPEII_MAX_IRQ 16 + /* Define processor entry struct since gets it wrong */ typedef struct BPROCENTRY { u_char type; @@ -155,14 +158,14 @@ mpt_build_bus_entries(bus_entry_ptr mpeb memset(mpeb, 0, sizeof(*mpeb)); mpeb->type = MPCT_ENTRY_BUS; - mpeb->bus_id = ISA; - memcpy(mpeb->bus_type, MPE_BUSNAME_ISA, MPE_BUSNAME_LEN); + mpeb->bus_id = 0; + memcpy(mpeb->bus_type, MPE_BUSNAME_PCI, MPE_BUSNAME_LEN); mpeb++; memset(mpeb, 0, sizeof(*mpeb)); mpeb->type = MPCT_ENTRY_BUS; - mpeb->bus_id = PCI; - memcpy(mpeb->bus_type, MPE_BUSNAME_PCI, MPE_BUSNAME_LEN); + mpeb->bus_id = 1; + memcpy(mpeb->bus_type, MPE_BUSNAME_ISA, MPE_BUSNAME_LEN); } static void @@ -177,9 +180,8 @@ mpt_build_ioapic_entries(io_apic_entry_p mpei->apic_address = IOAPIC_PADDR; } -#ifdef notyet static void -mpt_build_ioint_entries(struct mpe_ioint *mpeii, int num_pins, int id) +mpt_build_ioint_entries(int_entry_ptr mpie, int num_pins, int id) { int pin; @@ -189,28 +191,27 @@ mpt_build_ioint_entries(struct mpe_ioint * just use the default config, tweek later if needed. */ - /* Run through all 16 pins. */ for (pin = 0; pin < num_pins; pin++) { - memset(mpeii, 0, sizeof(*mpeii)); - mpeii->entry_type = MP_ENTRY_IOINT; - mpeii->src_bus_id = MPE_BUSID_ISA; - mpeii->dst_apic_id = id; + memset(mpie, 0, sizeof(*mpie)); + mpie->type = MPCT_ENTRY_INT; + mpie->src_bus_id = 1; + mpie->dst_apic_id = id; /* * All default configs route IRQs from bus 0 to the first 16 * pins of the first I/O APIC with an APIC ID of 2. */ - mpeii->dst_apic_intin = pin; + mpie->dst_apic_int = pin; switch (pin) { case 0: /* Pin 0 is an ExtINT pin. */ - mpeii->intr_type = MPEII_INTR_EXTINT; + mpie->int_type = INTENTRY_TYPE_EXTINT; break; case 2: /* IRQ 0 is routed to pin 2. */ - mpeii->intr_type = MPEII_INTR_INT; - mpeii->src_bus_irq = 0; + mpie->int_type = INTENTRY_TYPE_INT; + mpie->src_bus_irq = 0; break; case 5: case 10: @@ -218,118 +219,20 @@ mpt_build_ioint_entries(struct mpe_ioint /* * PCI Irqs set to level triggered. */ - mpeii->intr_flags = MPEII_FLAGS_TRIGMODE_LEVEL; - mpeii->src_bus_id = MPE_BUSID_PCI; + mpie->int_flags = INTENTRY_FLAGS_TRIGGER_LEVEL; + mpie->src_bus_id = 0; + /* fall through.. */ default: /* All other pins are identity mapped. */ - mpeii->intr_type = MPEII_INTR_INT; - mpeii->src_bus_irq = pin; + mpie->int_type = INTENTRY_TYPE_INT; + mpie->src_bus_irq = pin; break; } - mpeii++; + mpie++; } } -#define COPYSTR(dest, src, bytes) \ - memcpy(dest, src, bytes); \ - str[bytes] = 0; - -static void -mptable_dump(struct mp_floating_pointer *mpfp, struct mp_config_hdr *mpch) -{ - static char str[16]; - int i; - char *cur; - - union mpe { - struct mpe_proc *proc; - struct mpe_bus *bus; - struct mpe_ioapic *ioapic; - struct mpe_ioint *ioint; - struct mpe_lint *lnit; - char *p; - }; - - union mpe mpe; - - printf(" MP Floating Pointer :\n"); - COPYSTR(str, mpfp->signature, 4); - printf("\tsignature:\t%s\n", str); - printf("\tmpch paddr:\t%x\n", mpfp->mptable_paddr); - printf("\tlength:\t%x\n", mpfp->length); - printf("\tspecrec:\t%x\n", mpfp->specrev); - printf("\tchecksum:\t%x\n", mpfp->checksum); - printf("\tfeature1:\t%x\n", mpfp->feature1); - printf("\tfeature2:\t%x\n", mpfp->feature2); - printf("\tfeature3:\t%x\n", mpfp->feature3); - printf("\tfeature4:\t%x\n", mpfp->feature4); - - printf(" MP Configuration Header :\n"); - COPYSTR(str, mpch->signature, 4); - printf(" signature: %s\n", str); - printf(" length: %x\n", mpch->length); - printf(" specrec: %x\n", mpch->specrev); - printf(" checksum: %x\n", mpch->checksum); - COPYSTR(str, mpch->oemid, MPCH_OEMID_LEN); - printf(" oemid: %s\n", str); - COPYSTR(str, mpch->prodid, MPCH_PRODID_LEN); - printf(" prodid: %s\n", str); - printf(" oem_ptr: %x\n", mpch->oem_ptr); - printf(" oem_sz: %x\n", mpch->oem_sz); - printf(" nr_entries: %x\n", mpch->nr_entries); - printf(" apic paddr: %x\n", mpch->lapic_paddr); - printf(" ext_length: %x\n", mpch->ext_length); - printf(" ext_checksum: %x\n", mpch->ext_checksum); - - cur = (char *)mpch + sizeof(*mpch); - for (i = 0; i < mpch->nr_entries; i++) { - mpe.p = cur; - switch(*mpe.p) { - case MP_ENTRY_PROC: - printf(" MP Processor Entry :\n"); - printf(" lapic_id: %x\n", mpe.proc->lapic_id); - printf(" lapic_version: %x\n", mpe.proc->lapic_version); - printf(" proc_flags: %x\n", mpe.proc->proc_flags); - printf(" proc_signature: %x\n", mpe.proc->proc_signature); - printf(" feature_flags: %x\n", mpe.proc->feature_flags); - cur += sizeof(struct mpe_proc); - break; - case MP_ENTRY_BUS: - printf(" MP Bus Entry :\n"); - printf(" busid: %x\n", mpe.bus->busid); - COPYSTR(str, mpe.bus->busname, MPE_BUSNAME_LEN); - printf(" busname: %s\n", str); - cur += sizeof(struct mpe_bus); - break; - case MP_ENTRY_IOAPIC: - printf(" MP IOAPIC Entry :\n"); - printf(" ioapi_id: %x\n", mpe.ioapic->ioapic_id); - printf(" ioapi_version: %x\n", mpe.ioapic->ioapic_version); - printf(" ioapi_flags: %x\n", mpe.ioapic->ioapic_flags); - printf(" ioapi_paddr: %x\n", mpe.ioapic->ioapic_paddr); - cur += sizeof(struct mpe_ioapic); - break; - case MP_ENTRY_IOINT: - printf(" MP IO Interrupt Entry :\n"); - printf(" intr_type: %x\n", mpe.ioint->intr_type); - printf(" intr_flags: %x\n", mpe.ioint->intr_flags); - printf(" src_bus_id: %x\n", mpe.ioint->src_bus_id); - printf(" src_bus_irq: %x\n", mpe.ioint->src_bus_irq); - printf(" dst_apic_id: %x\n", mpe.ioint->dst_apic_id); - printf(" dst_apic_intin: %x\n", mpe.ioint->dst_apic_intin); - cur += sizeof(struct mpe_ioint); - break; - case MP_ENTRY_LINT: - printf(" MP Local Interrupt Entry :\n"); - cur += sizeof(struct mpe_lint); - break; - } - - } -} -#endif - void mptable_add_oemtbl(void *tbl, int tblsz) { @@ -346,6 +249,7 @@ mptable_build(struct vmctx *ctx, int ncp io_apic_entry_ptr mpei; bproc_entry_ptr mpep; mpfps_t mpfp; + int_entry_ptr mpie; char *curraddr; char *startaddr; @@ -381,12 +285,10 @@ mptable_build(struct vmctx *ctx, int ncp mpch->entry_count++; } -#ifdef notyet - mpt_build_ioint_entries((struct mpe_ioint*)curraddr, MPEII_MAX_IRQ, - ncpu + 1); - curraddr += sizeof(struct mpe_ioint) * MPEII_MAX_IRQ; + mpie = (int_entry_ptr) curraddr; + mpt_build_ioint_entries(mpie, MPEII_MAX_IRQ, ncpu + 1); + curraddr += sizeof(*mpie) * MPEII_MAX_IRQ; mpch->entry_count += MPEII_MAX_IRQ; -#endif if (oem_tbl_start) { mpch->oem_table_pointer = curraddr - startaddr + MPTABLE_BASE; Modified: stable/10/usr.sbin/bhyve/pci_hostbridge.c ============================================================================== --- stable/10/usr.sbin/bhyve/pci_hostbridge.c Fri Oct 18 21:42:47 2013 (r256754) +++ stable/10/usr.sbin/bhyve/pci_hostbridge.c Fri Oct 18 22:05:17 2013 (r256755) @@ -47,6 +47,22 @@ pci_hostbridge_init(struct vmctx *ctx, s return (0); } +static int +pci_amd_hostbridge_init(struct vmctx *ctx, struct pci_devinst *pi, char *opts) +{ + (void) pci_hostbridge_init(ctx, pi, opts); + pci_set_cfgdata16(pi, PCIR_VENDOR, 0x1022); /* AMD */ + pci_set_cfgdata16(pi, PCIR_DEVICE, 0x7432); /* made up */ + + return (0); +} + +struct pci_devemu pci_de_amd_hostbridge = { + .pe_emu = "amd_hostbridge", + .pe_init = pci_amd_hostbridge_init, +}; +PCI_EMUL_SET(pci_de_amd_hostbridge); + struct pci_devemu pci_de_hostbridge = { .pe_emu = "hostbridge", .pe_init = pci_hostbridge_init, Modified: stable/10/usr.sbin/bhyve/pci_virtio_block.c ============================================================================== --- stable/10/usr.sbin/bhyve/pci_virtio_block.c Fri Oct 18 21:42:47 2013 (r256754) +++ stable/10/usr.sbin/bhyve/pci_virtio_block.c Fri Oct 18 22:05:17 2013 (r256755) @@ -256,8 +256,6 @@ pci_vtblk_init(struct vmctx *ctx, struct off_t size; int fd; int sectsz; - int use_msix; - const char *env_msi; if (opts == NULL) { printf("virtio-block: backing device required\n"); @@ -336,12 +334,7 @@ pci_vtblk_init(struct vmctx *ctx, struct pci_set_cfgdata8(pi, PCIR_CLASS, PCIC_STORAGE); pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_TYPE_BLOCK); - use_msix = 1; - if ((env_msi = getenv("BHYVE_USE_MSI"))) { - if (strcasecmp(env_msi, "yes") == 0) - use_msix = 0; - } - if (vi_intr_init(&sc->vbsc_vs, 1, use_msix)) + if (vi_intr_init(&sc->vbsc_vs, 1, fbsdrun_virtio_msix())) return (1); vi_set_io_bar(&sc->vbsc_vs, 0); return (0); Modified: stable/10/usr.sbin/bhyve/pci_virtio_net.c ============================================================================== --- stable/10/usr.sbin/bhyve/pci_virtio_net.c Fri Oct 18 21:42:47 2013 (r256754) +++ stable/10/usr.sbin/bhyve/pci_virtio_net.c Fri Oct 18 22:05:17 2013 (r256755) @@ -509,11 +509,9 @@ pci_vtnet_init(struct vmctx *ctx, struct char nstr[80]; char tname[MAXCOMLEN + 1]; struct pci_vtnet_softc *sc; - const char *env_msi; char *devname; char *vtopts; int mac_provided; - int use_msix; sc = malloc(sizeof(struct pci_vtnet_softc)); memset(sc, 0, sizeof(struct pci_vtnet_softc)); @@ -531,15 +529,6 @@ pci_vtnet_init(struct vmctx *ctx, struct #endif /* - * Use MSI if set by user - */ - use_msix = 1; - if ((env_msi = getenv("BHYVE_USE_MSI")) != NULL) { - if (strcasecmp(env_msi, "yes") == 0) - use_msix = 0; - } - - /* * Attempt to open the tap device and read the MAC address * if specified */ @@ -623,7 +612,7 @@ pci_vtnet_init(struct vmctx *ctx, struct sc->vsc_config.status = 1; /* use BAR 1 to map MSI-X table and PBA, if we're using MSI-X */ - if (vi_intr_init(&sc->vsc_vs, 1, use_msix)) + if (vi_intr_init(&sc->vsc_vs, 1, fbsdrun_virtio_msix())) return (1); /* use BAR 0 to map config regs in IO space */ Modified: stable/10/usr.sbin/bhyve/rtc.c ============================================================================== --- stable/10/usr.sbin/bhyve/rtc.c Fri Oct 18 21:42:47 2013 (r256754) +++ stable/10/usr.sbin/bhyve/rtc.c Fri Oct 18 22:05:17 2013 (r256755) @@ -331,7 +331,7 @@ rtc_init(struct vmctx *ctx) memset(rtc_nvram, 0, sizeof(rtc_nvram)); - rtc_nvram[nvoff(RTC_CENTURY)] = rtcout(tm.tm_year / 100); + rtc_nvram[nvoff(RTC_CENTURY)] = bin2bcd((tm.tm_year + 1900) / 100); /* XXX init diag/reset code/equipment/checksum ? */ From owner-svn-src-stable-10@FreeBSD.ORG Fri Oct 18 22:48:38 2013 Return-Path: Delivered-To: svn-src-stable-10@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 D3592797; Fri, 18 Oct 2013 22:48:38 +0000 (UTC) (envelope-from gibbs@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 A488523F8; Fri, 18 Oct 2013 22:48:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9IMmcC4068195; Fri, 18 Oct 2013 22:48:38 GMT (envelope-from gibbs@svn.freebsd.org) Received: (from gibbs@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9IMmceh068194; Fri, 18 Oct 2013 22:48:38 GMT (envelope-from gibbs@svn.freebsd.org) Message-Id: <201310182248.r9IMmceh068194@svn.freebsd.org> From: "Justin T. Gibbs" Date: Fri, 18 Oct 2013 22:48:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r256757 - stable/10/sys/dev/xen/blkfront X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2013 22:48:38 -0000 Author: gibbs Date: Fri Oct 18 22:48:38 2013 New Revision: 256757 URL: http://svnweb.freebsd.org/changeset/base/256757 Log: MFC: r256425 Centralize the detection logic for the Hyper-V hypervisor. Submitted by: Roger Pau MonnĂ© Sponsored by: Citrix Systems R&D Reviewed by: gibbs, grehan Approved by: re (gjb) sys/sys/systm.h: * Add a new VM_GUEST type, VM_GUEST_HV (HyperV guest). sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c: sys/dev/hyperv/vmbus/hv_hv.c: sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.c: * Set vm_guest to VM_GUEST_HV and use that on other HyperV related devices instead of cloning the cpuid hypervisor check. * Cleanup the vmbus_identify function. Modified: stable/10/sys/dev/xen/blkfront/blkfront.c Directory Properties: stable/10/sys/ (props changed) Modified: stable/10/sys/dev/xen/blkfront/blkfront.c ============================================================================== --- stable/10/sys/dev/xen/blkfront/blkfront.c Fri Oct 18 22:47:10 2013 (r256756) +++ stable/10/sys/dev/xen/blkfront/blkfront.c Fri Oct 18 22:48:38 2013 (r256757) @@ -1381,14 +1381,42 @@ xbd_closing(device_t dev) static int xbd_probe(device_t dev) { + if (strcmp(xenbus_get_type(dev), "vbd") != 0) + return (ENXIO); - if (!strcmp(xenbus_get_type(dev), "vbd")) { - device_set_desc(dev, "Virtual Block Device"); - device_quiet(dev); - return (0); + if (xen_hvm_domain()) { + int error; + char *type; + + /* + * When running in an HVM domain, IDE disk emulation is + * disabled early in boot so that native drivers will + * not see emulated hardware. However, CDROM device + * emulation cannot be disabled. + * + * Through use of FreeBSD's vm_guest and xen_hvm_domain() + * APIs, we could modify the native CDROM driver to fail its + * probe when running under Xen. Unfortunatlely, the PV + * CDROM support in XenServer (up through at least version + * 6.2) isn't functional, so we instead rely on the emulated + * CDROM instance, and fail to attach the PV one here in + * the blkfront driver. + */ + error = xs_read(XST_NIL, xenbus_get_node(dev), + "device-type", NULL, (void **) &type); + if (error) + return (ENXIO); + + if (strncmp(type, "cdrom", 5) == 0) { + free(type, M_XENSTORE); + return (ENXIO); + } + free(type, M_XENSTORE); } - return (ENXIO); + device_set_desc(dev, "Virtual Block Device"); + device_quiet(dev); + return (0); } /* From owner-svn-src-stable-10@FreeBSD.ORG Fri Oct 18 23:19:29 2013 Return-Path: Delivered-To: svn-src-stable-10@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 2F2B9349; Fri, 18 Oct 2013 23:19:29 +0000 (UTC) (envelope-from gibbs@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 0C8222590; Fri, 18 Oct 2013 23:19:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9INJSUL085736; Fri, 18 Oct 2013 23:19:28 GMT (envelope-from gibbs@svn.freebsd.org) Received: (from gibbs@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9INJSdH085731; Fri, 18 Oct 2013 23:19:28 GMT (envelope-from gibbs@svn.freebsd.org) Message-Id: <201310182319.r9INJSdH085731@svn.freebsd.org> From: "Justin T. Gibbs" Date: Fri, 18 Oct 2013 23:19:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r256758 - in stable/10/sys: dev/hyperv/stordisengage dev/hyperv/vmbus sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Oct 2013 23:19:29 -0000 Author: gibbs Date: Fri Oct 18 23:19:27 2013 New Revision: 256758 URL: http://svnweb.freebsd.org/changeset/base/256758 Log: MFC r256425: Centralize the detection logic for the Hyper-V hypervisor. Submitted by: Roger Pau MonnĂ© Sponsored by: Citrix Systems R&D Reviewed by: gibbs, grehan Approved by: re (gjb) sys/sys/systm.h: * Add a new VM_GUEST type, VM_GUEST_HV (HyperV guest). sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c: sys/dev/hyperv/vmbus/hv_hv.c: sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.c: * Set vm_guest to VM_GUEST_HV and use that on other HyperV related devices instead of cloning the cpuid hypervisor check. * Cleanup the vmbus_identify function. ------------------------------------------------------------------------ Modified: stable/10/sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.c stable/10/sys/dev/hyperv/vmbus/hv_hv.c stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c stable/10/sys/sys/systm.h Directory Properties: stable/10/sys/ (props changed) stable/10/sys/dev/hyperv/ (props changed) Modified: stable/10/sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.c ============================================================================== --- stable/10/sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.c Fri Oct 18 22:48:38 2013 (r256757) +++ stable/10/sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.c Fri Oct 18 23:19:27 2013 (r256758) @@ -75,17 +75,11 @@ __FBSDID("$FreeBSD$"); #include #include -#define HV_X64_MSR_GUEST_OS_ID 0x40000000 -#define HV_X64_CPUID_MIN 0x40000005 -#define HV_X64_CPUID_MAX 0x4000ffff - /* prototypes */ static int hv_ata_pci_probe(device_t dev); static int hv_ata_pci_attach(device_t dev); static int hv_ata_pci_detach(device_t dev); -static int hv_check_for_hyper_v(void); - /* * generic PCI ATA device probe */ @@ -100,7 +94,7 @@ hv_ata_pci_probe(device_t dev) /* * Don't probe if not running in a Hyper-V environment */ - if (!hv_check_for_hyper_v()) + if (vm_guest != VM_GUEST_HV) return (ENXIO); if (device_get_unit(parent) != 0 || device_get_ivars(dev) != 0) @@ -139,33 +133,6 @@ hv_ata_pci_detach(device_t dev) return (0); } -/** -* Detect Hyper-V and enable fast IDE -* via enlighted storage driver -*/ -static int -hv_check_for_hyper_v(void) -{ - u_int regs[4]; - int hyper_v_detected; - - hyper_v_detected = 0; - do_cpuid(1, regs); - if (regs[2] & 0x80000000) { - /* - * if(a hypervisor is detected) - * make sure this really is Hyper-V - */ - do_cpuid(HV_X64_MSR_GUEST_OS_ID, regs); - hyper_v_detected = - regs[0] >= HV_X64_CPUID_MIN && - regs[0] <= HV_X64_CPUID_MAX && - !memcmp("Microsoft Hv", ®s[1], 12); - } - - return (hyper_v_detected); -} - static device_method_t hv_ata_pci_methods[] = { /* device interface */ DEVMETHOD(device_probe, hv_ata_pci_probe), Modified: stable/10/sys/dev/hyperv/vmbus/hv_hv.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_hv.c Fri Oct 18 22:48:38 2013 (r256757) +++ stable/10/sys/dev/hyperv/vmbus/hv_hv.c Fri Oct 18 23:19:27 2013 (r256758) @@ -218,7 +218,7 @@ hv_vmbus_init(void) 0, sizeof(hv_vmbus_handle) * MAXCPU); - if (!hv_vmbus_query_hypervisor_presence()) + if (vm_guest != VM_GUEST_HV) goto cleanup; max_leaf = hv_vmbus_get_hypervisor_version(); Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Fri Oct 18 22:48:38 2013 (r256757) +++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Fri Oct 18 23:19:27 2013 (r256758) @@ -295,11 +295,15 @@ hv_vmbus_child_device_unregister(struct return(ret); } -static void vmbus_identify(driver_t *driver, device_t parent) { +static void +vmbus_identify(driver_t *driver, device_t parent) +{ + if (!hv_vmbus_query_hypervisor_presence()) + return; + + vm_guest = VM_GUEST_HV; + BUS_ADD_CHILD(parent, 0, "vmbus", 0); - if (device_find_child(parent, "vmbus", 0) == NULL) { - BUS_ADD_CHILD(parent, 0, "vmbus", 0); - } } static int @@ -307,9 +311,6 @@ vmbus_probe(device_t dev) { if(bootverbose) device_printf(dev, "VMBUS: probe\n"); - if (!hv_vmbus_query_hypervisor_presence()) - return (ENXIO); - device_set_desc(dev, "Vmbus Devices"); return (0); @@ -491,10 +492,13 @@ vmbus_attach(device_t dev) static void vmbus_init(void) { + if (vm_guest != VM_GUEST_HV) + return; + /* * If the system has already booted and thread - * scheduling is possible indicated by the global - * cold set to zero, we just call the driver + * scheduling is possible, as indicated by the + * global cold set to zero, we just call the driver * initialization directly. */ if (!cold) Modified: stable/10/sys/sys/systm.h ============================================================================== --- stable/10/sys/sys/systm.h Fri Oct 18 22:48:38 2013 (r256757) +++ stable/10/sys/sys/systm.h Fri Oct 18 23:19:27 2013 (r256758) @@ -71,7 +71,7 @@ extern int vm_guest; /* Running as virt * and/or add to the VM_GUEST_VM type if specific VM functionality is * ever implemented (e.g. vendor-specific paravirtualization features). */ -enum VM_GUEST { VM_GUEST_NO = 0, VM_GUEST_VM, VM_GUEST_XEN }; +enum VM_GUEST { VM_GUEST_NO = 0, VM_GUEST_VM, VM_GUEST_XEN, VM_GUEST_HV }; #if defined(WITNESS) || defined(INVARIANTS) void kassert_panic(const char *fmt, ...) __printflike(1, 2);