Add device specific token to address different IO windows - #13
Conversation
Device can have several PIO or MMIO address spaces like PCI BARs. Besides, not all devices have to know exactly the base IO address and only need to track the offset of each IO window. This patch adds `token` to uniquely identify the different IO windows when IO VMExit, so that device can use `token` and `offset` to address the data handling. Signed-off-by: Jing Liu <jing2.liu@linux.intel.com>
| /// A device supporting memory based I/O should implement this trait. For | ||
| /// device that has one or several IO (PIO or MMIO) address space, it | ||
| /// registers itself against the different IO type ranges it handles with | ||
| /// a unique token to distinguish different windows. The VMM will then |
There was a problem hiding this comment.
a unique token to distinguish different windows.
If anything, this token should naturally be the base address of that window. And yes, that base address would change when reprogramming PCI BARs, but so would the registration against the MMIO or IO bus. A token is well defined for PCI BARs, but it makes the API less simple and obvious.
There was a problem hiding this comment.
We may use the base address as the token, but we may also have better choices for token.
For example, PCI bar index may be better than base address because we almost need to map the base address to bar index.
So token gives more flexibility to the driver implementation. And it would be easier to support firecracker by simply ignoring the token argument.
There was a problem hiding this comment.
The problem with adding a token with VMM and device specific semantics, is that you have to use your DeviceIo instances with a specific device manager, one that can forward a cookie/token that was passed during device registration time. Your device IO trait becomes semantically bound to your device manager, which I feel is not the cleanest approach.
Adding a base: IoAddress argument would already be useful and help devices.
|
Close this to move else together into #18 |
Device can have several PIO or MMIO address spaces like PCI BARs.
Besides, not all devices have to know exactly the base IO address and
only need to track the offset address of each IO window. This patch adds
tokento uniquely identify the different IO windows when IO VMExit, so that
device can use
tokenandoffsetto address the data handling.