drivres/hv
Greg,
I recently discovered that the Hyper-V host allocates mmio memory for some synthetic devices like the virtual framebuffer. We are currently in the process of implementing this virtual framebuffer device. As part of the offer message from the host we are given the mmio region size that needs to be allocatted to the device. I am told in the current implementation of the firmware, this mmio resource shows up in the PCI space. What is the best way to allocate this mmio space for this driver.
Regards,
K. Y
Quoted 2 lines · K. Y. Srinivasan
Greg,
You are writing the most unhelpful Subject: lines lately, please be more descriptive in the future.
Quoted 8 lines
I recently discovered that the Hyper-V host allocates mmio memory for some synthetic devices like the virtual framebuffer. We are currently in the process of implementing this virtual framebuffer device. As part of the offer message from the host we are given the mmio region size that needs to be allocatted to the device. I am told in the current implementation of the firmware, this mmio resource shows up in the PCI space. What is the best way to allocate this mmio space for this driver.
I don't understand, does the guest os think this really is mmio memory and the host just set up up? Or is the memory being used to pass data back and forth? Or something else?
And what do you mean "firmware"? That usually means UEFI/BIOS to me, not a hyperv host.
And finally, what does the guest os see as far as the PCI resource space shows it? Shouldn't it just think it is a normal PCI device and access it properly that way?
thanks,
greg k-h
Quoted 9 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Wednesday, November 28, 2012 5:43 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]
Subject: Re: drivres/hv
Quoted 6 lines
Quoted 2 lines · K. Y. Srinivasan
Greg,
You are writing the most unhelpful Subject: lines lately, please be more descriptive in the future.
Sorry about that; I will be more descriptive.
Quoted 10 lines
Quoted 9 lines
I recently discovered that the Hyper-V host allocates mmio memory for some synthetic devices like the virtual framebuffer. We are currently in the process of implementing this virtual framebuffer device. As part of the offer message from the host we are given the mmio region size that needs to be allocatted to the device. I am told in the current implementation of the firmware, this mmio resource shows up in the PCI space. What is the best way to allocate this mmio space for this driver.
Quoted 5 lines
I don't understand, does the guest os think this really is mmio memory and the host just set up up? Or is the memory being used to pass data back and forth? Or something else?
From what I understand, the host is allocating this memory and presenting
this to the guest. This memory is to be used for framebuffer. The guest is expected to setup appropriate mappings to this region and use that as the framebuffer.
Quoted 3 lines
And what do you mean "firmware"? That usually means UEFI/BIOS to me, not a hyperv host.
Hyper-V host presents the firmware to the guest (Hyper-V like KVM supports full virtualization with selective para-virtualization - PV drivers). As part of the BIOS presented to the guest this mmio region is allocated.
Quoted 4 lines
And finally, what does the guest os see as far as the PCI resource space shows it? Shouldn't it just think it is a normal PCI device and access it properly that way?
This is the crux of the problem. Vmbus and other vmbus based devices are not PCI devices. I have implemented vmbus as an ACPI driver since vmbus is an ACPI enumerated device. I have the size information of the mmio region that is to be allocated to the framebuffer device. I am looking at a way to allocate this mmio region.
Quoted 5 lines
thanks,
greg k-h
Quoted 9 lines · KY Srinivasan
Quoted 9 lines
Quoted 8 lines
I recently discovered that the Hyper-V host allocates mmio memory for some synthetic devices like the virtual framebuffer. We are currently in the process of implementing this virtual framebuffer device. As part of the offer message from the host we are given the mmio region size that needs to be allocatted to the device. I am told in the current implementation of the firmware, this mmio resource shows up in the PCI space. What is the best way to allocate this mmio space for this driver.
Quoted 8 lines
Quoted 3 lines
I don't understand, does the guest os think this really is mmio memory and the host just set up up? Or is the memory being used to pass data back and forth? Or something else?
From what I understand, the host is allocating this memory and presenting this to the guest. This memory is to be used for framebuffer. The guest is expected to setup appropriate mappings to this region and use that as the framebuffer.
What type of framebuffer? Linux supports a ton of different ones, have you looked at drivers/video/ to see if one of the ones there will "just work" with what hyperv is passing to the guest?
If not, you'll have to write a new driver for this, look at the examples of other framebuffer drivers in that directory for examples. Also, I bet the code there will answer your memory questions.
Quoted 12 lines
Quoted 2 lines
And what do you mean "firmware"? That usually means UEFI/BIOS to me, not a hyperv host.
Hyper-V host presents the firmware to the guest (Hyper-V like KVM supports full virtualization with selective para-virtualization - PV drivers). As part of the BIOS presented to the guest this mmio region is allocated.
Quoted 4 lines
And finally, what does the guest os see as far as the PCI resource space shows it? Shouldn't it just think it is a normal PCI device and access it properly that way?
Quoted 5 lines
This is the crux of the problem. Vmbus and other vmbus based devices are not PCI devices. I have implemented vmbus as an ACPI driver since vmbus is an ACPI enumerated device. I have the size information of the mmio region that is to be allocated to the framebuffer device. I am looking at a way to allocate this mmio region.
Do you have any "hints" as to where it is, if it even is present, or anything else? If so, use them and create a new framebuffer device with that information.
If not, that seems really strange, but hey, it's hyper-v, it wouldn't be the first time :)
good luck,
greg k-h
Quoted 23 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Wednesday, November 28, 2012 7:05 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]
Subject: Re: drivres/hvQuoted 13 lines · KY Srinivasan
Quoted 12 lines
Quoted 8 lines
I recently discovered that the Hyper-V host allocates mmio memory for some synthetic devices like the virtual framebuffer. We are currently in the process of implementing this virtual framebuffer device. As part of the offer message from the host we are given the mmio region size that needs to be allocatted to the device. I am told in the current implementation of the firmware, this mmio resource shows up in the PCI space. What is the best way to allocate this mmio space for this driver.
I don't understand, does the guest os think this really is mmio memory and the host just set up up? Or is the memory being used to pass data back and forth? Or something else?
Quoted 8 lines
Quoted 4 lines
From what I understand, the host is allocating this memory and presenting this to the guest. This memory is to be used for framebuffer. The guest is expected to setup appropriate mappings to this region and use that as the framebuffer.
What type of framebuffer? Linux supports a ton of different ones, have you looked at
drivers/video/to see if one of the ones there will "just work" with what hyperv is passing to the guest?
We are writing a diver for this device. The existing Linux drivers can (and do) work for the emulated VGA device. What we are implementing is a synthetic framebuffer driver that will communicate over the vmbus to the host.
Quoted 19 lines
If not, you'll have to write a new driver for this, look at the examples of other framebuffer drivers in that directory for examples. Also, I bet the code there will answer your memory questions.
Quoted 8 lines
Quoted 2 lines
And what do you mean "firmware"? That usually means UEFI/BIOS to me, not a hyperv host.
Hyper-V host presents the firmware to the guest (Hyper-V like KVM supports full virtualization with selective para-virtualization - PV drivers). As part of the BIOS presented to the guest this mmio region is allocated.
Quoted 1 line
Quoted 6 lines
Quoted 3 lines
And finally, what does the guest os see as far as the PCI resource space shows it? Shouldn't it just think it is a normal PCI device and access it properly that way?
This is the crux of the problem. Vmbus and other vmbus based devices are not PCI devices. I have implemented vmbus as an ACPI driver since vmbus is an
Quoted 8 lines
ACPI
Quoted 3 lines
enumerated device. I have the size information of the mmio region that is to be allocated to the framebuffer device. I am looking at a way to allocate this mmio region.
Do you have any "hints" as to where it is, if it even is present, or anything else? If so, use them and create a new framebuffer device with that information.
All I know is that it is present and its size is known. If I have a way of knowing what range of mmio memory is unclaimed; I could grab that perhaps using the request_mem_region() call, I know the size that is reserved for this device. So, is there a way to query the system for the first unclaimed address in the mmio range.
Thanks,
K. Y
Quoted 1 line
Quoted 5 lines
All I know is that it is present and its size is known. If I have a way of knowing what range of mmio memory is unclaimed; I could grab that perhaps using the
request_mem_region()call, I know the size that is reserved for this device. So, is there a way to query the system for the first unclaimed address in the mmio range.
You can add memory region resources yes. See the code in drivers/pci which allocates mmio space to unassigned BARs and/or moves stuff around.
Alan