hyperv/vmbus: Add DEVMETHOD to map cpu to event taskq.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8658
This commit is contained in:
sephe 2016-11-30 07:45:05 +00:00
parent c8e340b474
commit 4497d765e2
2 changed files with 19 additions and 0 deletions

View File

@ -97,6 +97,8 @@ static int vmbus_probe_guid_method(device_t, device_t,
const struct hyperv_guid *);
static uint32_t vmbus_get_vcpu_id_method(device_t bus,
device_t dev, int cpu);
static struct taskqueue *vmbus_get_eventtq_method(device_t, device_t,
int);
static int vmbus_init(struct vmbus_softc *);
static int vmbus_connect(struct vmbus_softc *, uint32_t);
@ -172,6 +174,7 @@ static device_method_t vmbus_methods[] = {
DEVMETHOD(vmbus_get_version, vmbus_get_version_method),
DEVMETHOD(vmbus_probe_guid, vmbus_probe_guid_method),
DEVMETHOD(vmbus_get_vcpu_id, vmbus_get_vcpu_id_method),
DEVMETHOD(vmbus_get_event_taskq, vmbus_get_eventtq_method),
DEVMETHOD_END
};
@ -1126,6 +1129,15 @@ vmbus_get_vcpu_id_method(device_t bus, device_t dev, int cpu)
return (VMBUS_PCPU_GET(sc, vcpuid, cpu));
}
static struct taskqueue *
vmbus_get_eventtq_method(device_t bus, device_t dev __unused, int cpu)
{
const struct vmbus_softc *sc = device_get_softc(bus);
KASSERT(cpu >= 0 && cpu < mp_ncpus, ("invalid cpu%d", cpu));
return (VMBUS_PCPU_GET(sc, event_tq, cpu));
}
#ifdef NEW_PCIB
#define VTPM_BASE_ADDR 0xfed40000
#define FOUR_GB (1ULL << 32)

View File

@ -33,6 +33,7 @@ INTERFACE vmbus;
HEADER {
struct hyperv_guid;
struct taskqueue;
};
METHOD uint32_t get_version {
@ -51,3 +52,9 @@ METHOD uint32_t get_vcpu_id {
device_t dev;
int cpu;
};
METHOD struct taskqueue * get_event_taskq {
device_t bus;
device_t dev;
int cpu;
};