hyperv/vmbus: Busdma-fy Hypercall signal event input parameter.
MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6916
This commit is contained in:
parent
44d03f9a5f
commit
e44bdd84c9
@ -55,6 +55,7 @@
|
|||||||
|
|
||||||
#include <amd64/include/xen/synch_bitops.h>
|
#include <amd64/include/xen/synch_bitops.h>
|
||||||
#include <amd64/include/atomic.h>
|
#include <amd64/include/atomic.h>
|
||||||
|
#include <dev/hyperv/include/hyperv_busdma.h>
|
||||||
|
|
||||||
typedef uint8_t hv_bool_uint8_t;
|
typedef uint8_t hv_bool_uint8_t;
|
||||||
|
|
||||||
@ -528,20 +529,6 @@ typedef union {
|
|||||||
|
|
||||||
} __packed hv_vmbus_connection_id;
|
} __packed hv_vmbus_connection_id;
|
||||||
|
|
||||||
/*
|
|
||||||
* Definition of the hv_vmbus_signal_event hypercall input structure
|
|
||||||
*/
|
|
||||||
typedef struct {
|
|
||||||
hv_vmbus_connection_id connection_id;
|
|
||||||
uint16_t flag_number;
|
|
||||||
uint16_t rsvd_z;
|
|
||||||
} __packed hv_vmbus_input_signal_event;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
uint64_t align8;
|
|
||||||
hv_vmbus_input_signal_event event;
|
|
||||||
} __packed hv_vmbus_input_signal_event_buffer;
|
|
||||||
|
|
||||||
typedef struct hv_vmbus_channel {
|
typedef struct hv_vmbus_channel {
|
||||||
TAILQ_ENTRY(hv_vmbus_channel) list_entry;
|
TAILQ_ENTRY(hv_vmbus_channel) list_entry;
|
||||||
struct hv_device* device;
|
struct hv_device* device;
|
||||||
@ -589,14 +576,8 @@ typedef struct hv_vmbus_channel {
|
|||||||
|
|
||||||
boolean_t is_dedicated_interrupt;
|
boolean_t is_dedicated_interrupt;
|
||||||
|
|
||||||
/*
|
struct hypercall_sigevt_in *ch_sigevt;
|
||||||
* Used as an input param for HV_CALL_SIGNAL_EVENT hypercall.
|
struct hyperv_dma ch_sigevt_dma;
|
||||||
*/
|
|
||||||
hv_vmbus_input_signal_event_buffer signal_event_buffer;
|
|
||||||
/*
|
|
||||||
* 8-bytes aligned of the buffer above
|
|
||||||
*/
|
|
||||||
hv_vmbus_input_signal_event *signal_event_param;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* From Win8, this field specifies the target virtual process
|
* From Win8, this field specifies the target virtual process
|
||||||
|
@ -29,6 +29,10 @@
|
|||||||
#ifndef _HYPERV_BUSDMA_H_
|
#ifndef _HYPERV_BUSDMA_H_
|
||||||
#define _HYPERV_BUSDMA_H_
|
#define _HYPERV_BUSDMA_H_
|
||||||
|
|
||||||
|
#include <sys/param.h>
|
||||||
|
#include <sys/bus.h>
|
||||||
|
#include <machine/bus.h>
|
||||||
|
|
||||||
struct hyperv_dma {
|
struct hyperv_dma {
|
||||||
bus_addr_t hv_paddr;
|
bus_addr_t hv_paddr;
|
||||||
bus_dma_tag_t hv_dtag;
|
bus_dma_tag_t hv_dtag;
|
||||||
|
@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <vm/pmap.h>
|
#include <vm/pmap.h>
|
||||||
|
|
||||||
#include <dev/hyperv/vmbus/hv_vmbus_priv.h>
|
#include <dev/hyperv/vmbus/hv_vmbus_priv.h>
|
||||||
|
#include <dev/hyperv/vmbus/hyperv_var.h>
|
||||||
#include <dev/hyperv/vmbus/vmbus_reg.h>
|
#include <dev/hyperv/vmbus/vmbus_reg.h>
|
||||||
#include <dev/hyperv/vmbus/vmbus_var.h>
|
#include <dev/hyperv/vmbus/vmbus_var.h>
|
||||||
|
|
||||||
@ -72,7 +73,7 @@ vmbus_channel_set_event(hv_vmbus_channel *channel)
|
|||||||
(uint32_t *)&monitor_page->
|
(uint32_t *)&monitor_page->
|
||||||
trigger_group[channel->monitor_group].u.pending);
|
trigger_group[channel->monitor_group].u.pending);
|
||||||
} else {
|
} else {
|
||||||
hv_vmbus_set_event(channel);
|
hypercall_signal_event(channel->ch_sigevt_dma.hv_paddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include <sys/mbuf.h>
|
#include <sys/mbuf.h>
|
||||||
#include <sys/mutex.h>
|
#include <sys/mutex.h>
|
||||||
|
|
||||||
|
#include <dev/hyperv/include/hyperv_busdma.h>
|
||||||
#include <dev/hyperv/vmbus/hv_vmbus_priv.h>
|
#include <dev/hyperv/vmbus/hv_vmbus_priv.h>
|
||||||
#include <dev/hyperv/vmbus/vmbus_reg.h>
|
#include <dev/hyperv/vmbus/vmbus_reg.h>
|
||||||
#include <dev/hyperv/vmbus/vmbus_var.h>
|
#include <dev/hyperv/vmbus/vmbus_var.h>
|
||||||
@ -327,23 +328,23 @@ vmbus_channel_on_offer_internal(struct vmbus_softc *sc,
|
|||||||
*/
|
*/
|
||||||
new_channel->batched_reading = TRUE;
|
new_channel->batched_reading = TRUE;
|
||||||
|
|
||||||
new_channel->signal_event_param =
|
new_channel->ch_sigevt = hyperv_dmamem_alloc(
|
||||||
(hv_vmbus_input_signal_event *)
|
bus_get_dma_tag(sc->vmbus_dev),
|
||||||
(HV_ALIGN_UP((unsigned long)
|
HYPERCALL_SIGEVTIN_ALIGN, 0, sizeof(struct hypercall_sigevt_in),
|
||||||
&new_channel->signal_event_buffer,
|
&new_channel->ch_sigevt_dma, BUS_DMA_WAITOK | BUS_DMA_ZERO);
|
||||||
HV_HYPERCALL_PARAM_ALIGN));
|
if (new_channel->ch_sigevt == NULL) {
|
||||||
|
device_printf(sc->vmbus_dev, "sigevt alloc failed\n");
|
||||||
new_channel->signal_event_param->connection_id.as_uint32_t = 0;
|
/* XXX */
|
||||||
new_channel->signal_event_param->connection_id.u.id =
|
mtx_destroy(&new_channel->sc_lock);
|
||||||
HV_VMBUS_EVENT_CONNECTION_ID;
|
free(new_channel, M_DEVBUF);
|
||||||
new_channel->signal_event_param->flag_number = 0;
|
return;
|
||||||
new_channel->signal_event_param->rsvd_z = 0;
|
}
|
||||||
|
new_channel->ch_sigevt->hc_connid = VMBUS_CONNID_EVENT;
|
||||||
|
|
||||||
if (hv_vmbus_protocal_version != HV_VMBUS_VERSION_WS2008) {
|
if (hv_vmbus_protocal_version != HV_VMBUS_VERSION_WS2008) {
|
||||||
new_channel->is_dedicated_interrupt =
|
new_channel->is_dedicated_interrupt =
|
||||||
(offer->is_dedicated_interrupt != 0);
|
(offer->is_dedicated_interrupt != 0);
|
||||||
new_channel->signal_event_param->connection_id.u.id =
|
new_channel->ch_sigevt->hc_connid = offer->connection_id;
|
||||||
offer->connection_id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(&new_channel->offer_msg, offer,
|
memcpy(&new_channel->offer_msg, offer,
|
||||||
|
@ -158,16 +158,6 @@ vmbus_event_proc_compat(struct vmbus_softc *sc, int cpu)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Send an event notification to the parent
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
hv_vmbus_set_event(hv_vmbus_channel *channel)
|
|
||||||
{
|
|
||||||
|
|
||||||
return hv_vmbus_signal_event(channel->signal_event_param);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
vmbus_on_channel_open(const struct hv_vmbus_channel *chan)
|
vmbus_on_channel_open(const struct hv_vmbus_channel *chan)
|
||||||
{
|
{
|
||||||
|
@ -363,6 +363,5 @@ int hv_vmbus_child_device_unregister(
|
|||||||
*/
|
*/
|
||||||
int hv_vmbus_connect(struct vmbus_softc *);
|
int hv_vmbus_connect(struct vmbus_softc *);
|
||||||
int hv_vmbus_disconnect(void);
|
int hv_vmbus_disconnect(void);
|
||||||
int hv_vmbus_set_event(hv_vmbus_channel *channel);
|
|
||||||
|
|
||||||
#endif /* __HYPERV_PRIV_H__ */
|
#endif /* __HYPERV_PRIV_H__ */
|
||||||
|
@ -125,6 +125,13 @@ hypercall_post_message(bus_addr_t msg_paddr)
|
|||||||
HYPERCALL_POST_MESSAGE, msg_paddr, 0);
|
HYPERCALL_POST_MESSAGE, msg_paddr, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint64_t
|
||||||
|
hypercall_signal_event(bus_addr_t sigevt_paddr)
|
||||||
|
{
|
||||||
|
return hypercall_md(hypercall_context.hc_addr,
|
||||||
|
HYPERCALL_SIGNAL_EVENT, sigevt_paddr, 0);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Signal an event on the specified connection using the hypervisor
|
* @brief Signal an event on the specified connection using the hypervisor
|
||||||
* event IPC. (This involves a hypercall.)
|
* event IPC. (This involves a hypercall.)
|
||||||
|
@ -148,6 +148,7 @@
|
|||||||
* Hypercall input values
|
* Hypercall input values
|
||||||
*/
|
*/
|
||||||
#define HYPERCALL_POST_MESSAGE 0x005c
|
#define HYPERCALL_POST_MESSAGE 0x005c
|
||||||
|
#define HYPERCALL_SIGNAL_EVENT 0x005d
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Hypercall input parameters
|
* Hypercall input parameters
|
||||||
@ -169,4 +170,15 @@ struct hypercall_postmsg_in {
|
|||||||
} __packed;
|
} __packed;
|
||||||
CTASSERT(sizeof(struct hypercall_postmsg_in) == HYPERCALL_POSTMSGIN_SIZE);
|
CTASSERT(sizeof(struct hypercall_postmsg_in) == HYPERCALL_POSTMSGIN_SIZE);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* HYPERCALL_SIGNAL_EVENT
|
||||||
|
*/
|
||||||
|
#define HYPERCALL_SIGEVTIN_ALIGN 8
|
||||||
|
|
||||||
|
struct hypercall_sigevt_in {
|
||||||
|
uint32_t hc_connid;
|
||||||
|
uint16_t hc_evtflag_ofs;
|
||||||
|
uint16_t hc_rsvd;
|
||||||
|
} __packed;
|
||||||
|
|
||||||
#endif /* !_HYPERV_REG_H_ */
|
#endif /* !_HYPERV_REG_H_ */
|
||||||
|
@ -39,5 +39,6 @@ extern u_int hyperv_features;
|
|||||||
extern u_int hyperv_recommends;
|
extern u_int hyperv_recommends;
|
||||||
|
|
||||||
uint64_t hypercall_post_message(bus_addr_t msg_paddr);
|
uint64_t hypercall_post_message(bus_addr_t msg_paddr);
|
||||||
|
uint64_t hypercall_signal_event(bus_addr_t sigevt_paddr);
|
||||||
|
|
||||||
#endif /* !_HYPERV_VAR_H_ */
|
#endif /* !_HYPERV_VAR_H_ */
|
||||||
|
@ -69,12 +69,6 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <contrib/dev/acpica/include/acpi.h>
|
#include <contrib/dev/acpica/include/acpi.h>
|
||||||
#include "acpi_if.h"
|
#include "acpi_if.h"
|
||||||
|
|
||||||
/*
|
|
||||||
* NOTE: DO NOT CHANGE THESE
|
|
||||||
*/
|
|
||||||
#define VMBUS_CONNID_MESSAGE 1
|
|
||||||
#define VMBUS_CONNID_EVENT 2
|
|
||||||
|
|
||||||
struct vmbus_msghc {
|
struct vmbus_msghc {
|
||||||
struct hypercall_postmsg_in *mh_inprm;
|
struct hypercall_postmsg_in *mh_inprm;
|
||||||
struct hypercall_postmsg_in mh_inprm_save;
|
struct hypercall_postmsg_in mh_inprm_save;
|
||||||
|
@ -46,6 +46,12 @@
|
|||||||
*/
|
*/
|
||||||
#define VMBUS_SINT_TIMER 4
|
#define VMBUS_SINT_TIMER 4
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NOTE: DO NOT CHANGE THESE
|
||||||
|
*/
|
||||||
|
#define VMBUS_CONNID_MESSAGE 1
|
||||||
|
#define VMBUS_CONNID_EVENT 2
|
||||||
|
|
||||||
struct vmbus_pcpu_data {
|
struct vmbus_pcpu_data {
|
||||||
u_long *intr_cnt; /* Hyper-V interrupt counter */
|
u_long *intr_cnt; /* Hyper-V interrupt counter */
|
||||||
struct vmbus_message *message; /* shared messages */
|
struct vmbus_message *message; /* shared messages */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user