hyperv/vmbus: add a new method to get vcpu_id
vcpu_id is host's representation of guest CPU. We get the mapping between vcpu_id and FreeBSD kernel's cpu id when VMBus driver is loaded. Later, when a driver, like the coming pcib driver, talks to the host and needs to refer to a guest CPU, the driver must use the vcpu_id. Reviewed by: jhb, sephe Approved by: sephe (mentor) MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8410
This commit is contained in:
parent
b2f831c009
commit
c8b32f717d
@ -77,6 +77,8 @@ static int vmbus_child_pnpinfo_str(device_t, device_t,
|
||||
static uint32_t vmbus_get_version_method(device_t, device_t);
|
||||
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 int vmbus_init(struct vmbus_softc *);
|
||||
static int vmbus_connect(struct vmbus_softc *, uint32_t);
|
||||
@ -135,6 +137,7 @@ static device_method_t vmbus_methods[] = {
|
||||
/* Vmbus interface */
|
||||
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_END
|
||||
};
|
||||
@ -991,6 +994,14 @@ vmbus_probe_guid_method(device_t bus, device_t dev,
|
||||
return ENXIO;
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
vmbus_get_vcpu_id_method(device_t bus, device_t dev, int cpu)
|
||||
{
|
||||
const struct vmbus_softc *sc = device_get_softc(bus);
|
||||
|
||||
return (VMBUS_PCPU_GET(sc, vcpuid, cpu));
|
||||
}
|
||||
|
||||
static int
|
||||
vmbus_probe(device_t dev)
|
||||
{
|
||||
|
@ -45,3 +45,9 @@ METHOD int probe_guid {
|
||||
device_t dev;
|
||||
const struct hyperv_guid *guid;
|
||||
};
|
||||
|
||||
METHOD uint32_t get_vcpu_id {
|
||||
device_t bus;
|
||||
device_t dev;
|
||||
int cpu;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user