hyperv: Add mmio_size attribute to device nodes
Some devices such as graphics and PCI passthrough bridges require MMIO space. Add this as a device node attribute if present. Change-Id: Id374ff61c29c1ccad10e3a7f3f7053c14d02aa5e Reviewed-on: https://review.haiku-os.org/c/haiku/+/10483 Tested-by: Commit checker robot <[email protected]> Reviewed-by: Jérôme Duval <[email protected]>
This commit is contained in:
@@ -17,6 +17,7 @@
|
|||||||
#define HYPERV_CHANNEL_ID_ITEM "hyperv/channel"
|
#define HYPERV_CHANNEL_ID_ITEM "hyperv/channel"
|
||||||
#define HYPERV_DEVICE_TYPE_STRING_ITEM "hyperv/type_string"
|
#define HYPERV_DEVICE_TYPE_STRING_ITEM "hyperv/type_string"
|
||||||
#define HYPERV_INSTANCE_ID_ITEM "hyperv/instance"
|
#define HYPERV_INSTANCE_ID_ITEM "hyperv/instance"
|
||||||
|
#define HYPERV_MMIO_SIZE_ITEM "hyperv/mmio_size"
|
||||||
|
|
||||||
#define HYPERV_PRETTYNAME_VMBUS "Hyper-V Virtual Machine Bus"
|
#define HYPERV_PRETTYNAME_VMBUS "Hyper-V Virtual Machine Bus"
|
||||||
#define HYPERV_PRETTYNAME_VMBUS_DEVICE_FMT "Hyper-V Channel %u"
|
#define HYPERV_PRETTYNAME_VMBUS_DEVICE_FMT "Hyper-V Channel %u"
|
||||||
|
|||||||
@@ -697,6 +697,7 @@ VMBus::_ProcessPendingMessage(int32_t cpu)
|
|||||||
channel->dedicated_int = offerMessage->dedicated_int != 0;
|
channel->dedicated_int = offerMessage->dedicated_int != 0;
|
||||||
channel->connection_id = offerMessage->connection_id;
|
channel->connection_id = offerMessage->connection_id;
|
||||||
}
|
}
|
||||||
|
channel->mmio_size = static_cast<uint32>(offerMessage->mmio_size_mb) * 1024 * 1024;
|
||||||
|
|
||||||
// Add new channel to offer queue and signal the channel handler thread
|
// Add new channel to offer queue and signal the channel handler thread
|
||||||
MutexLocker locker(fChannelQueueLock);
|
MutexLocker locker(fChannelQueueLock);
|
||||||
@@ -1093,7 +1094,7 @@ VMBus::_RegisterChannel(VMBusChannel* channel)
|
|||||||
snprintf(prettyName, sizeof(prettyName), HYPERV_PRETTYNAME_VMBUS_DEVICE_FMT,
|
snprintf(prettyName, sizeof(prettyName), HYPERV_PRETTYNAME_VMBUS_DEVICE_FMT,
|
||||||
channel->channel_id);
|
channel->channel_id);
|
||||||
|
|
||||||
device_attr attributes[] = {
|
device_attr attributes[10] = {
|
||||||
{ B_DEVICE_BUS, B_STRING_TYPE,
|
{ B_DEVICE_BUS, B_STRING_TYPE,
|
||||||
{ .string = HYPERV_BUS_NAME }},
|
{ .string = HYPERV_BUS_NAME }},
|
||||||
{ B_DEVICE_PRETTY_NAME, B_STRING_TYPE,
|
{ B_DEVICE_PRETTY_NAME, B_STRING_TYPE,
|
||||||
@@ -1107,6 +1108,17 @@ VMBus::_RegisterChannel(VMBusChannel* channel)
|
|||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
uint32 attributeCount = 5;
|
||||||
|
|
||||||
|
// Add MMIO attribute if present (typically PCI passthrough and graphics)
|
||||||
|
if (channel->mmio_size > 0) {
|
||||||
|
attributes[attributeCount] = {
|
||||||
|
HYPERV_MMIO_SIZE_ITEM, B_UINT32_TYPE,
|
||||||
|
{ .ui32 = channel->mmio_size }
|
||||||
|
};
|
||||||
|
attributeCount++;
|
||||||
|
}
|
||||||
|
|
||||||
// Add to active channel list
|
// Add to active channel list
|
||||||
InterruptsSpinLocker spinLocker(fChannelsSpinlock);
|
InterruptsSpinLocker spinLocker(fChannelsSpinlock);
|
||||||
if (fHighestChannelID < channel->channel_id)
|
if (fHighestChannelID < channel->channel_id)
|
||||||
|
|||||||
@@ -90,11 +90,12 @@ struct VMBusChannel : DoublyLinkedListLinkImpl<VMBusChannel> {
|
|||||||
mutex_destroy(&lock);
|
mutex_destroy(&lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t channel_id;
|
uint32 channel_id;
|
||||||
vmbus_guid_t type_id;
|
vmbus_guid_t type_id;
|
||||||
vmbus_guid_t instance_id;
|
vmbus_guid_t instance_id;
|
||||||
bool dedicated_int;
|
bool dedicated_int;
|
||||||
uint32_t connection_id;
|
uint32 connection_id;
|
||||||
|
uint32 mmio_size;
|
||||||
|
|
||||||
mutex lock;
|
mutex lock;
|
||||||
device_node* node;
|
device_node* node;
|
||||||
|
|||||||
Reference in New Issue
Block a user