| // Copyright 2022 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| library fuchsia.virtualization; |
| |
| /// A `MemController` controls a guest's virtio-mem |
| @discoverable |
| closed protocol MemController { |
| /// Get the configured region size, usable region size, plugged size and requestd size |
| /// |
| /// block_size is the size and the alignment in bytes of a memory block. Cannot change. |
| /// region_size is the size of device-managed memory region in bytes. Cannot change. |
| /// usable_region_size is the size of the usable device-managed memory region. Can grow up to |
| /// the region_size. Can only shrink due to VIRTIO_MEM_REQ_UNPLUG_ALL requests. |
| /// plugged_size is the amount of plugged memory in bytes within the usable device-managed |
| /// memory region. |
| /// requested_size is the requested amount of plugged memory within the usable device-managed |
| /// memory region. |
| strict GetMemSize() -> (struct { |
| block_size uint64; |
| region_size uint64; |
| usable_region_size uint64; |
| plugged_size uint64; |
| requested_size uint64; |
| }); |
| |
| /// Update the requested size to plug or unplug memory |
| /// |
| /// The driver SHOULD react to resize requests from the device (requested_size in the device |
| /// configuration changed) by (un)plugging memory blocks. |
| strict RequestSize(struct { |
| requested_size uint64; |
| }); |
| }; |