From f2eec5cadae6d3bd3f71d1129304489e947f1b8e Mon Sep 17 00:00:00 2001 From: Elliot Berman Date: Wed, 20 Mar 2024 09:56:59 -0700 Subject: hypervisor: gunyah: Mark shm devices as optional When using demand paging, userspace shouldn't provide shm vdevice in the VM configuration. The shm vdevice is used by RM to automatically accept and map the mem parcel. With demand paging, the kernel wouldn't be creating mem parcels and Gunyah complains about that no mem parcel was provided for the shm vdevice. Gunyah allows us to add "optional" tag to the vdevice and it will be ignored if no mem parcel is prvoided, as is the case for demand paging. We could create additional downstream UAPI to indicate whether demand paging is being used and not create the vdevice node at all, but the approach of adding "optional" property was preferred to avoid creating downstream UAPI. Bug: 330496811 Change-Id: Ib070e9d453af88a7af5f8c240f9a22c7b744c987 Signed-off-by: Elliot Berman --- hypervisor/src/gunyah/aarch64.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hypervisor/src/gunyah/aarch64.rs b/hypervisor/src/gunyah/aarch64.rs index c40c36394..2bf7557c7 100644 --- a/hypervisor/src/gunyah/aarch64.rs +++ b/hypervisor/src/gunyah/aarch64.rs @@ -39,6 +39,10 @@ fn fdt_create_shm_device( shm_node.set_prop("peer-default", ())?; shm_node.set_prop("dma_base", 0u64)?; let mem_node = shm_node.subnode_mut("memory")?; + // We have to add the shm device for RM to accept the swiotlb memparcel. + // Memparcel is only used on android14-6.1. Once android14-6.1 is EOL + // we should be able to remove all the times we call fdt_create_shm_device() + mem_node.set_prop("optional", ())?; mem_node.set_prop("label", index)?; mem_node.set_prop("#address-cells", 2u32)?; mem_node.set_prop("base", guest_addr.offset()) -- cgit v1.2.3