From owner-svn-src-stable@FreeBSD.ORG Fri Oct 18 22:48:38 2013 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the 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); } /*