Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Nov 2015 08:41:27 +0000 (UTC)
From:      =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= <royger@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r291239 - in stable/10/sys: dev/xen/blkfront dev/xen/netfront x86/xen xen
Message-ID:  <201511240841.tAO8fRbl021905@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: royger
Date: Tue Nov 24 08:41:27 2015
New Revision: 291239
URL: https://svnweb.freebsd.org/changeset/base/291239

Log:
  MFC r286999:
  
  xen: allow disabling PV disks and nics
  
  Sponsored by: Citrix Systems R&D

Modified:
  stable/10/sys/dev/xen/blkfront/blkfront.c
  stable/10/sys/dev/xen/netfront/netfront.c
  stable/10/sys/x86/xen/hvm.c
  stable/10/sys/xen/xen-os.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/xen/blkfront/blkfront.c
==============================================================================
--- stable/10/sys/dev/xen/blkfront/blkfront.c	Tue Nov 24 08:34:48 2015	(r291238)
+++ stable/10/sys/dev/xen/blkfront/blkfront.c	Tue Nov 24 08:41:27 2015	(r291239)
@@ -1367,6 +1367,11 @@ xbd_probe(device_t dev)
 	if (strcmp(xenbus_get_type(dev), "vbd") != 0)
 		return (ENXIO);
 
+#ifdef XENHVM
+	if (xen_disable_pv_disks != 0)
+		return (ENXIO);
+#endif
+
 	if (xen_hvm_domain()) {
 		int error;
 		char *type;

Modified: stable/10/sys/dev/xen/netfront/netfront.c
==============================================================================
--- stable/10/sys/dev/xen/netfront/netfront.c	Tue Nov 24 08:34:48 2015	(r291238)
+++ stable/10/sys/dev/xen/netfront/netfront.c	Tue Nov 24 08:41:27 2015	(r291239)
@@ -451,6 +451,11 @@ static int 
 netfront_probe(device_t dev)
 {
 
+#ifdef XENHVM
+	if (xen_disable_pv_nics != 0)
+		return (ENXIO);
+#endif
+
 	if (!strcmp(xenbus_get_type(dev), "vif")) {
 		device_set_desc(dev, "Virtual Network Interface");
 		return (0);

Modified: stable/10/sys/x86/xen/hvm.c
==============================================================================
--- stable/10/sys/x86/xen/hvm.c	Tue Nov 24 08:34:48 2015	(r291238)
+++ stable/10/sys/x86/xen/hvm.c	Tue Nov 24 08:41:27 2015	(r291239)
@@ -152,6 +152,13 @@ DPCPU_DEFINE(xen_intr_handle_t, ipi_hand
 char *hypercall_stubs;
 shared_info_t *HYPERVISOR_shared_info;
 
+
+/*------------------------------ Sysctl tunables -----------------------------*/
+int xen_disable_pv_disks = 0;
+int xen_disable_pv_nics = 0;
+TUNABLE_INT("hw.xen.disable_pv_disks", &xen_disable_pv_disks);
+TUNABLE_INT("hw.xen.disable_pv_nics", &xen_disable_pv_nics);
+
 #ifdef SMP
 /*---------------------------- XEN PV IPI Handlers ---------------------------*/
 /*
@@ -303,7 +310,7 @@ xen_ipi_vectored(u_int vector, int dest)
 	}
 }
 
-/* XEN diverged cpu operations */
+/*---------------------- XEN diverged cpu operations -------------------------*/
 static void
 xen_hvm_cpu_resume(void)
 {
@@ -503,12 +510,24 @@ enum {
 static void
 xen_hvm_disable_emulated_devices(void)
 {
+	u_short disable_devs = 0;
+
 	if (inw(XEN_MAGIC_IOPORT) != XMI_MAGIC)
 		return;
 
-	if (bootverbose)
-		printf("XEN: Disabling emulated block and network devices\n");
-	outw(XEN_MAGIC_IOPORT, XMI_UNPLUG_IDE_DISKS|XMI_UNPLUG_NICS);
+	if (xen_disable_pv_disks == 0) {
+		if (bootverbose)
+			printf("XEN: disabling emulated disks\n");
+		disable_devs |= XMI_UNPLUG_IDE_DISKS;
+	}
+	if (xen_disable_pv_nics == 0) {
+		if (bootverbose)
+			printf("XEN: disabling emulated nics\n");
+		disable_devs |= XMI_UNPLUG_NICS;
+	}
+
+	if (disable_devs != 0)
+		outw(XEN_MAGIC_IOPORT, disable_devs);
 }
 
 static void

Modified: stable/10/sys/xen/xen-os.h
==============================================================================
--- stable/10/sys/xen/xen-os.h	Tue Nov 24 08:34:48 2015	(r291238)
+++ stable/10/sys/xen/xen-os.h	Tue Nov 24 08:41:27 2015	(r291239)
@@ -52,6 +52,11 @@ void force_evtchn_callback(void);
 
 extern shared_info_t *HYPERVISOR_shared_info;
 
+#ifdef XENHVM
+extern int xen_disable_pv_disks;
+extern int xen_disable_pv_nics;
+#endif
+
 enum xen_domain_type {
 	XEN_NATIVE,             /* running on bare hardware    */
 	XEN_PV_DOMAIN,          /* running in a PV domain      */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201511240841.tAO8fRbl021905>