Skip to content

Commit 2a5bf57

Browse files
vireshkjiangliu
authored andcommitted
README: Update with Xen implementation details
Update README with implementation details of the Xen mapping model. Signed-off-by: Viresh Kumar <[email protected]>
1 parent 4936fc8 commit 2a5bf57

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,33 @@ The detailed design of the `vm-memory` crate can be found [here](DESIGN.md).
2121
- Arch: x86, AMD64, ARM64
2222
- OS: Linux/Unix/Windows
2323

24+
### Xen support
25+
26+
Supporting Xen requires special handling while mapping the guest memory and
27+
hence a separate feature is provided in the crate: `xen`. Mapping the guest
28+
memory for Xen requires an `ioctl()` to be issued along with `mmap()` for the
29+
memory area. The arguments for the `ioctl()` are received via the `vhost-user`
30+
protocol's memory region area.
31+
32+
Xen allows two different mapping models: `Foreign` and `Grant`.
33+
34+
In `Foreign` mapping model, the entire guest address space is mapped at once, in
35+
advance. In `Grant` mapping model, the memory for few regions, like those
36+
representing the virtqueues, is mapped in advance. The rest of the memory
37+
regions are mapped (partially) only while accessing the buffers and the same is
38+
immediately deallocated after the buffer is accessed. Hence, special handling
39+
for the same in `VolatileMemory.rs`.
40+
41+
In order to still support standard Unix memory regions, for special regions and
42+
testing, the Xen specific implementation here allows a third mapping type:
43+
`MmapXenFlags::UNIX`. This performs standard Unix memory mapping and the same is
44+
used for all tests in this crate.
45+
46+
It was decided by the `rust-vmm` maintainers to keep the interface simple and
47+
build the crate for either standard Unix memory mapping or Xen, and not both.
48+
49+
Xen is only supported for Unix platforms.
50+
2451
## Usage
2552

2653
Add `vm-memory` as a dependency in `Cargo.toml`

0 commit comments

Comments
 (0)