commit | 7ba393978f25e6781f375b7a07efb0341002f730 | [log] [tgz] |
---|---|---|
author | Pierre-Clément Tosi <ptosi@google.com> | Wed May 03 11:23:11 2023 +0000 |
committer | Pierre-Clément Tosi <ptosi@google.com> | Thu May 11 14:05:44 2023 +0000 |
tree | cb35c28e1434cafc3feda3592bbff9a343523b9e | |
parent | 5c94426d39e9c89435fe35c3d60529670ca988e6 [diff] |
pvmfw: Stop confusing MEM_SHARE granule & DMA size The VirtIO HAL assumes that shared allocations are aligned to a size that is a multiple of the DMA alignment required by virtio devices. This is wrong because 1. the allocator isn't forced to align the region it returns to the memory granule (e.g. if 2 regions are requested that fit in a single granule, it should be allowed to allocate only one granule) and 2. nothing guarantees the granule to be a multiple of the DMA alignment. Therefore, modify the {de,}alloc_shared API to more closely follow Rust-standard APIs (e.g. GlobalAllocator or LockedHeap) by taking a Layout, allowing the caller to pass the alignment it requires. Use that in the virtio_drivers HAL to request: - PAGE_SIZE-aligned regions for DMA; - size_of::<u128>()-aligned regions for bounce buffers Keep the memory.rs code functionally unchanged for now, so that allocations are still granule-aligned after this patch. Bug: 280644106 Test: atest MicrodroidTests Change-Id: I2b22e2095cde48e59e7303efeed1e3c09ee5ad5b Merged-In: I2b22e2095cde48e59e7303efeed1e3c09ee5ad5b
This repository contains userspace services related to running virtual machines on Android, especially protected virtual machines. See the getting started documentation and Microdroid README for more information.