From 479cb9c89a639f103d0395126fd4883d8350b689 Mon Sep 17 00:00:00 2001 From: Elliot Berman Date: Tue, 18 Apr 2023 14:36:01 -0700 Subject: [PATCH] aarch64: Fix size prop in swiotlb Devicetree bindings for restricted-dma-pool say that *either* "size" or "reg" property should be used (but do not allow for both). Each child node may either use a 'reg' property ... or a 'size' property ... Presently, "size" property is added even when fixed swiotlb region is used. Apply the "size" property only when using dynamically allocated swiotlb. BUG=b:244630071 Fixes: 653f62a4a3ad ("aarch64: static swiotlb allocation") Change-Id: I1c88c9be043133e698e1da9072e5353ad7419e27 Signed-off-by: Elliot Berman Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4680283 Reviewed-by: Daniel Verkamp Commit-Queue: Frederick Mayle --- aarch64/src/fdt.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/aarch64/src/fdt.rs b/aarch64/src/fdt.rs index 7cc362759e..e12cc595ae 100644 --- a/aarch64/src/fdt.rs +++ b/aarch64/src/fdt.rs @@ -115,11 +115,12 @@ fn create_resv_memory_node( fdt.property_array_u64("reg", &[resv_addr.0, resv_size])?; node } else { - fdt.begin_node("restricted_dma_reserved")? + let node = fdt.begin_node("restricted_dma_reserved")?; + fdt.property_u64("size", resv_size)?; + node }; fdt.property_u32("phandle", PHANDLE_RESTRICTED_DMA_POOL)?; fdt.property_string("compatible", "restricted-dma-pool")?; - fdt.property_u64("size", resv_size)?; fdt.property_u64("alignment", base::pagesize() as u64)?; fdt.end_node(restricted_dma_pool)?;