svn commit: r271299 - head/usr.sbin/bhyve

Peter Grehan grehan at FreeBSD.org
Tue Sep 9 04:11:55 UTC 2014


Author: grehan
Date: Tue Sep  9 04:11:54 2014
New Revision: 271299
URL: http://svnweb.freebsd.org/changeset/base/271299

Log:
  Add a callback to be notified about negotiated features.
  
  Submitted by:	luigi
  Obtained from:	Vincenzo Maffione, Universita` di Pisa
  MFC after:	3 days

Modified:
  head/usr.sbin/bhyve/pci_virtio_block.c
  head/usr.sbin/bhyve/pci_virtio_net.c
  head/usr.sbin/bhyve/pci_virtio_rnd.c
  head/usr.sbin/bhyve/virtio.c
  head/usr.sbin/bhyve/virtio.h

Modified: head/usr.sbin/bhyve/pci_virtio_block.c
==============================================================================
--- head/usr.sbin/bhyve/pci_virtio_block.c	Tue Sep  9 04:00:30 2014	(r271298)
+++ head/usr.sbin/bhyve/pci_virtio_block.c	Tue Sep  9 04:11:54 2014	(r271299)
@@ -133,6 +133,7 @@ static struct virtio_consts vtblk_vi_con
 	pci_vtblk_notify,	/* device-wide qnotify */
 	pci_vtblk_cfgread,	/* read PCI config */
 	pci_vtblk_cfgwrite,	/* write PCI config */
+	NULL,			/* apply negotiated features */
 	VTBLK_S_HOSTCAPS,	/* our capabilities */
 };
 

Modified: head/usr.sbin/bhyve/pci_virtio_net.c
==============================================================================
--- head/usr.sbin/bhyve/pci_virtio_net.c	Tue Sep  9 04:00:30 2014	(r271298)
+++ head/usr.sbin/bhyve/pci_virtio_net.c	Tue Sep  9 04:11:54 2014	(r271299)
@@ -160,6 +160,7 @@ static struct virtio_consts vtnet_vi_con
 	NULL,			/* device-wide qnotify -- not used */
 	pci_vtnet_cfgread,	/* read PCI config */
 	pci_vtnet_cfgwrite,	/* write PCI config */
+	NULL,			/* apply negotiated features */
 	VTNET_S_HOSTCAPS,	/* our capabilities */
 };
 

Modified: head/usr.sbin/bhyve/pci_virtio_rnd.c
==============================================================================
--- head/usr.sbin/bhyve/pci_virtio_rnd.c	Tue Sep  9 04:00:30 2014	(r271298)
+++ head/usr.sbin/bhyve/pci_virtio_rnd.c	Tue Sep  9 04:11:54 2014	(r271299)
@@ -80,6 +80,7 @@ static struct virtio_consts vtrnd_vi_con
 	pci_vtrnd_notify,	/* device-wide qnotify */
 	NULL,			/* read virtio config */
 	NULL,			/* write virtio config */
+	NULL,			/* apply negotiated features */
 	0,			/* our capabilities */
 };
 

Modified: head/usr.sbin/bhyve/virtio.c
==============================================================================
--- head/usr.sbin/bhyve/virtio.c	Tue Sep  9 04:00:30 2014	(r271298)
+++ head/usr.sbin/bhyve/virtio.c	Tue Sep  9 04:11:54 2014	(r271299)
@@ -698,6 +698,9 @@ bad:
 	switch (offset) {
 	case VTCFG_R_GUESTCAP:
 		vs->vs_negotiated_caps = value & vc->vc_hv_caps;
+		if (vc->vc_apply_features)
+			(*vc->vc_apply_features)(DEV_SOFTC(vs),
+			    vs->vs_negotiated_caps);
 		break;
 	case VTCFG_R_PFN:
 		if (vs->vs_curq >= vc->vc_nvq)

Modified: head/usr.sbin/bhyve/virtio.h
==============================================================================
--- head/usr.sbin/bhyve/virtio.h	Tue Sep  9 04:00:30 2014	(r271298)
+++ head/usr.sbin/bhyve/virtio.h	Tue Sep  9 04:11:54 2014	(r271299)
@@ -352,6 +352,8 @@ struct virtio_consts {
 					/* called to read config regs */
 	int	(*vc_cfgwrite)(void *, int, int, uint32_t);
 					/* called to write config regs */
+	void    (*vc_apply_features)(void *, uint64_t);
+				/* called to apply negotiated features */
 	uint64_t vc_hv_caps;		/* hypervisor-provided capabilities */
 };
 


More information about the svn-src-head mailing list