kernel/platform: Add mmio support for native platform#775
kernel/platform: Add mmio support for native platform#775joergroedel merged 2 commits intococonut-svsm:mainfrom
Conversation
|
@stefano-garzarella thanks for the review! |
|
@stefano-garzarella @osteffenrh thank you for the review, I addressed all of your comments :) |
|
@stefano-garzarella yes! I'll wait until that PR is merged and then rebase |
16d3a4a to
3625f57
Compare
|
I rebased to the latest upstream that is now using MaybeUninit. I had to make some changes to |
Currently, `mmio_read` and `mmio_write` take `PhysAddr` as a parameter. This can be limiting for other platforms that may require a virtual address, because going back from physical to virtual is not always possible. Change the parameter from `PhysAddr` to `VirtAddr` and let the platform handle the conversion if necessary. Signed-off-by: Luigi Leonardi <leonardi@redhat.com>
3625f57 to
fb6f795
Compare
fb6f795 to
7af0553
Compare
|
As suggested by @stefano-garzarella, I introduced an helper for Ideally it would be nice to keep the generics from the Hal itself, but I'm not sure on how to do it because |
Introduce `mmio_write` and `mmio_read` for native platform. This is useful when developing or testing drivers that rely on MMIO, like virtio. It was not possible to implement these two function using generics because SvsmPlatform struct uses the `dyn` trait. It is also not possible to iterate and read byte by byte as this would violate the virtio spec, where is stated that all multi-byte long registers must be read in one operation, therefore making it impossible to implement a virtio driver. Signed-off-by: Luigi Leonardi <leonardi@redhat.com>
7af0553 to
e476ae6
Compare
|
Added a check on |
osteffenrh
left a comment
There was a problem hiding this comment.
Tested it on top of #823 ✔️
stefano-garzarella
left a comment
There was a problem hiding this comment.
In the last TSC meeting we discussed this PR and decided to merge, but for long term we should improve our MMIO interface. Of course this is outside the scope of this PR so we can postpone it.
I'm approving and wait @joergroedel to take a final look before merging it.
Currently native platform does not support mmio operations. This can be useful when developing or testing drivers that rely on MMIO, like virtio-vsock or virtio-block.
Tested on top of my RFC #766 that introduces Vsock support, using
make test-in-svsm