Add support for omitting host paddr for static shmem regions
Reflect the latest Xen support to be able to omit the host physical address for static shared memory regions, in which case the address will come from the Xen heap.
Signed-off-by Michal Orzel <[email protected]>
--- README.md | 7 ++++--- scripts/uboot-script-gen | 19 +++++++++++++------ 2 files changed, 17 insertions(+), 9 deletions(-)
README.md +4 -3
@@ -199,9 +199,10 @@ Where: - DOMU_SHARED_MEM[number]="SHM-ID HPA GPA size" if specified, indicate SHM-ID represents the unique identifier of the shared - memory region, the host physical address HPA will get mapped at guest - address GPA in domU and the memory of size will be reserved to be shared - memory. The shared memory is used between two dom0less domUs. + memory region. The host physical address HPA is optional, if specified, will + get mapped at guest address GPA in domU (otherwise it will come from Xen heap) + and the memory of size will be reserved to be shared memory. The shared memory + is used between two dom0less domUs. Below is an example: NUM_DOMUS=2
scripts/uboot-script-gen +13 -6
@@ -211,18 +211,25 @@ function add_device_tree_static_shared_mem() local shared_mem_id=${shared_mem%% *} local regions="${shared_mem#* }" local cells=() - local shared_mem_host=${regions%% *} - - dt_mknode "${path}" "shared-mem@${shared_mem_host}" + local node_name= for val in ${regions[@]} do cells+=("$(split_value $val)") done - dt_set "${path}/shared-mem@${shared_mem_host}" "compatible" "str" "xen,domain-shared-memory-v1" - dt_set "${path}/shared-mem@${shared_mem_host}" "xen,shm-id" "str" "${shared_mem_id}" - dt_set "${path}/shared-mem@${shared_mem_host}" "xen,shared-mem" "hex" "${cells[*]}" + # Less than 3 cells means host address not provided + if [ ${#cells[@]} -lt 3 ]; then + node_name="shared-mem-${shared_mem_id}" + else + node_name="shared-mem@${regions%% *}" + fi + + dt_mknode "${path}" "${node_name}" + + dt_set "${path}/${node_name}" "compatible" "str" "xen,domain-shared-memory-v1" + dt_set "${path}/${node_name}" "xen,shm-id" "str" "${shared_mem_id}" + dt_set "${path}/${node_name}" "xen,shared-mem" "hex" "${cells[*]}" } function add_device_tree_cpupools()
Signature · 1 line
2.25.1
Stefano Stabellini
Reviewed-byQuoted 5 lines · Michal Orzel
Reflect the latest Xen support to be able to omit the host physical address for static shared memory regions, in which case the address will come from the Xen heap.
Signed-off-by Michal Orzel <[email protected]>
Reviewed-by Stefano Stabellini <[email protected]>
Quoted 62 lines
--- README.md | 7 ++++--- scripts/uboot-script-gen | 19 +++++++++++++------ 2 files changed, 17 insertions(+), 9 deletions(-)README.md +4
-3@@ -199,9 +199,10 @@ Where: - DOMU_SHARED_MEM[number]="SHM-ID HPA GPA size" if specified, indicate SHM-ID represents the unique identifier of the shared - memory region, the host physical address HPA will get mapped at guest - address GPA in domU and the memory of size will be reserved to be shared - memory. The shared memory is used between two dom0less domUs. + memory region. The host physical address HPA is optional, if specified, will + get mapped at guest address GPA in domU (otherwise it will come from Xen heap) + and the memory of size will be reserved to be shared memory. The shared memory + is used between two dom0less domUs. Below is an example: NUM_DOMUS=2scripts/uboot-script-gen +13
-6@@ -211,18 +211,25 @@ function add_device_tree_static_shared_mem() local shared_mem_id=${shared_mem%% *} local regions="${shared_mem#* }" local cells=() - local shared_mem_host=${regions%% *} - - dt_mknode "${path}" "shared-mem@${shared_mem_host}" + local node_name= for val in ${regions[@]} do cells+=("$(split_value $val)") done - dt_set "${path}/shared-mem@${shared_mem_host}" "compatible" "str" "xen,domain-shared-memory-v1" - dt_set "${path}/shared-mem@${shared_mem_host}" "xen,shm-id" "str" "${shared_mem_id}" - dt_set "${path}/shared-mem@${shared_mem_host}" "xen,shared-mem" "hex" "${cells[*]}" + # Less than 3 cells means host address not provided + if [ ${#cells[@]} -lt 3 ]; then + node_name="shared-mem-${shared_mem_id}" + else + node_name="shared-mem@${regions%% *}" + fi + + dt_mknode "${path}" "${node_name}" + + dt_set "${path}/${node_name}" "compatible" "str" "xen,domain-shared-memory-v1" + dt_set "${path}/${node_name}" "xen,shm-id" "str" "${shared_mem_id}" + dt_set "${path}/${node_name}" "xen,shared-mem" "hex" "${cells[*]}" } function add_device_tree_cpupools()Signature · 1 line
2.25.1