hyperv: All Hypercall parameters have same alignment requirement.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7086
This commit is contained in:
Sepherosa Ziehau 2016-07-13 09:11:03 +00:00
parent 782b0df476
commit a570251d00
3 changed files with 12 additions and 5 deletions

View File

@ -298,7 +298,7 @@ vmbus_channel_on_offer_internal(struct vmbus_softc *sc,
new_channel->ch_sigevt = hyperv_dmamem_alloc( new_channel->ch_sigevt = hyperv_dmamem_alloc(
bus_get_dma_tag(sc->vmbus_dev), 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); &new_channel->ch_sigevt_dma, BUS_DMA_WAITOK | BUS_DMA_ZERO);
if (new_channel->ch_sigevt == NULL) { if (new_channel->ch_sigevt == NULL) {
device_printf(sc->vmbus_dev, "sigevt alloc failed\n"); device_printf(sc->vmbus_dev, "sigevt alloc failed\n");

View File

@ -153,13 +153,22 @@
/* /*
* Hypercall input parameters * 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 * HYPERCALL_POST_MESSAGE
*/ */
#define HYPERCALL_POSTMSGIN_DSIZE_MAX 240 #define HYPERCALL_POSTMSGIN_DSIZE_MAX 240
#define HYPERCALL_POSTMSGIN_SIZE 256 #define HYPERCALL_POSTMSGIN_SIZE 256
#define HYPERCALL_POSTMSGIN_ALIGN 8
struct hypercall_postmsg_in { struct hypercall_postmsg_in {
uint32_t hc_connid; uint32_t hc_connid;
@ -173,8 +182,6 @@ CTASSERT(sizeof(struct hypercall_postmsg_in) == HYPERCALL_POSTMSGIN_SIZE);
/* /*
* HYPERCALL_SIGNAL_EVENT * HYPERCALL_SIGNAL_EVENT
*/ */
#define HYPERCALL_SIGEVTIN_ALIGN 8
struct hypercall_sigevt_in { struct hypercall_sigevt_in {
uint32_t hc_connid; uint32_t hc_connid;
uint16_t hc_evtflag_ofs; uint16_t hc_evtflag_ofs;

View File

@ -130,7 +130,7 @@ vmbus_msghc_alloc(bus_dma_tag_t parent_dtag)
mh = malloc(sizeof(*mh), M_DEVBUF, M_WAITOK | M_ZERO); mh = malloc(sizeof(*mh), M_DEVBUF, M_WAITOK | M_ZERO);
mh->mh_inprm = hyperv_dmamem_alloc(parent_dtag, 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); &mh->mh_inprm_dma, BUS_DMA_WAITOK);
if (mh->mh_inprm == NULL) { if (mh->mh_inprm == NULL) {
free(mh, M_DEVBUF); free(mh, M_DEVBUF);