> Currently, `io_read` and `io_write` methods require the exact type of `Io` > plus an address. This means that they need to be monomorphized for each > different `Io` instance. This also means that multiple I/O implementors for > the same I/O kind needs to duplicate implementation (e.g. `Mmio` and > `MmioOwned`). > > Create a new `IoBackend` trait and define these operations on it instead. > The operations are just going to receive a view type and operate on them. > This has the additional advantage that the invariants can be moved from the > trait (and guaranteed via `unsafe`) to type invariants on the canonical > view types of the backends, so `io_read` and `io_write` can be safe. > > Note that view type is needed; addresses are insufficient in this > designk, as they do not carry sufficient information. For example, > `ConfigSpace` needs `&pci::Device` in addition to the address. > > Signed-off-by: Gary Guo <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great! -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=9
