svn commit: r302723 - head/sys/dev/hyperv/vmbus

Sepherosa Ziehau sephe at FreeBSD.org
Wed Jul 13 09:11:05 UTC 2016


Author: sephe
Date: Wed Jul 13 09:11:03 2016
New Revision: 302723
URL: https://svnweb.freebsd.org/changeset/base/302723

Log:
  hyperv: All Hypercall parameters have same alignment requirement.
  
  MFC after:	1 week
  Sponsored by:	Microsoft OSTC
  Differential Revision:	https://reviews.freebsd.org/D7086

Modified:
  head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
  head/sys/dev/hyperv/vmbus/hyperv_reg.h
  head/sys/dev/hyperv/vmbus/vmbus.c

Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
==============================================================================
--- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c	Wed Jul 13 09:09:34 2016	(r302722)
+++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c	Wed Jul 13 09:11:03 2016	(r302723)
@@ -298,7 +298,7 @@ vmbus_channel_on_offer_internal(struct v
 
 	new_channel->ch_sigevt = hyperv_dmamem_alloc(
 	    bus_get_dma_tag(sc->vmbus_dev),
-	    HYPERCALL_SIGEVTIN_ALIGN, 0, sizeof(struct hypercall_sigevt_in),
+	    HYPERCALL_PARAM_ALIGN, 0, sizeof(struct hypercall_sigevt_in),
 	    &new_channel->ch_sigevt_dma, BUS_DMA_WAITOK | BUS_DMA_ZERO);
 	if (new_channel->ch_sigevt == NULL) {
 		device_printf(sc->vmbus_dev, "sigevt alloc failed\n");

Modified: head/sys/dev/hyperv/vmbus/hyperv_reg.h
==============================================================================
--- head/sys/dev/hyperv/vmbus/hyperv_reg.h	Wed Jul 13 09:09:34 2016	(r302722)
+++ head/sys/dev/hyperv/vmbus/hyperv_reg.h	Wed Jul 13 09:11:03 2016	(r302723)
@@ -153,13 +153,22 @@
 /*
  * Hypercall input parameters
  */
+#define HYPERCALL_PARAM_ALIGN		8
+#if 0
+/*
+ * XXX
+ * <<Hypervisor Top Level Functional Specification 4.0b>> requires
+ * input parameters size to be multiple of 8, however, many post
+ * message input parameters do _not_ meet this requirement.
+ */
+#define HYPERCALL_PARAM_SIZE_ALIGN	8
+#endif
 
 /*
  * HYPERCALL_POST_MESSAGE
  */
 #define HYPERCALL_POSTMSGIN_DSIZE_MAX	240
 #define HYPERCALL_POSTMSGIN_SIZE	256
-#define HYPERCALL_POSTMSGIN_ALIGN	8
 
 struct hypercall_postmsg_in {
 	uint32_t	hc_connid;
@@ -173,8 +182,6 @@ CTASSERT(sizeof(struct hypercall_postmsg
 /*
  * HYPERCALL_SIGNAL_EVENT
  */
-#define HYPERCALL_SIGEVTIN_ALIGN	8
-
 struct hypercall_sigevt_in {
 	uint32_t	hc_connid;
 	uint16_t	hc_evtflag_ofs;

Modified: head/sys/dev/hyperv/vmbus/vmbus.c
==============================================================================
--- head/sys/dev/hyperv/vmbus/vmbus.c	Wed Jul 13 09:09:34 2016	(r302722)
+++ head/sys/dev/hyperv/vmbus/vmbus.c	Wed Jul 13 09:11:03 2016	(r302723)
@@ -130,7 +130,7 @@ vmbus_msghc_alloc(bus_dma_tag_t parent_d
 	mh = malloc(sizeof(*mh), M_DEVBUF, M_WAITOK | M_ZERO);
 
 	mh->mh_inprm = hyperv_dmamem_alloc(parent_dtag,
-	    HYPERCALL_POSTMSGIN_ALIGN, 0, HYPERCALL_POSTMSGIN_SIZE,
+	    HYPERCALL_PARAM_ALIGN, 0, HYPERCALL_POSTMSGIN_SIZE,
 	    &mh->mh_inprm_dma, BUS_DMA_WAITOK);
 	if (mh->mh_inprm == NULL) {
 		free(mh, M_DEVBUF);


More information about the svn-src-all mailing list