[ImageBuilder][PATCH] uboot-script-gen: Add support for "passthrough" property

Oleksandr Tyshchenko posted 1 patch 1 week, 5 days ago
README.md                | 6 ++++++
scripts/uboot-script-gen | 5 +++++
2 files changed, 11 insertions(+)
[ImageBuilder][PATCH] uboot-script-gen: Add support for "passthrough" property
Posted by Oleksandr Tyshchenko 1 week, 5 days ago
This property is used to grant a non-hardware domain
permission to use the IOMMU, which is a prerequisite
for device passthrough.

Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
---
 README.md                | 6 ++++++
 scripts/uboot-script-gen | 5 +++++
 2 files changed, 11 insertions(+)

diff --git a/README.md b/README.md
index 0063747..983cbbc 100644
--- a/README.md
+++ b/README.md
@@ -338,6 +338,12 @@ Where:
       assigned to a regular DomU.
     - An explicit non-zero ID cannot be assigned to the hardware domain itself.
 
+- DOMU_PASSTHROUGH_PROP[number] is optional string used to permit a non-hardware
+  domain to use the IOMMU, which is a prerequisite for device passthrough.
+  If set to "enabled", the passthrough = "enabled"; property is added to
+  the domain's device tree node. This option has no effect if the IOMMU is not
+  active.
+
 - LINUX is optional but specifies the Linux kernel for when Xen is NOT
   used.  To enable this set any LINUX\_\* variables and do NOT set the
   XEN variable.
diff --git a/scripts/uboot-script-gen b/scripts/uboot-script-gen
index 78a731d..d18ac55 100755
--- a/scripts/uboot-script-gen
+++ b/scripts/uboot-script-gen
@@ -509,6 +509,11 @@ function xen_device_tree_editing()
             dt_set "/chosen/domU$i" "domid" "int" "${DOMU_DOMID[$i]}"
         fi
 
+        if test "${DOMU_PASSTHROUGH_PROP[$i]}" = "enabled"
+        then
+            dt_set "/chosen/domU$i" "passthrough" "str" "enabled"
+        fi
+
         if test -n "${DOMU_SHARED_MEM[i]}"
         then
             add_device_tree_static_shared_mem "/chosen/domU${i}" "${DOMU_SHARED_MEM[i]}"
-- 
2.34.1
Re: [ImageBuilder][PATCH] uboot-script-gen: Add support for "passthrough" property
Posted by Orzel, Michal 1 week, 5 days ago

On 01/12/2025 12:34, Oleksandr Tyshchenko wrote:
> This property is used to grant a non-hardware domain
> permission to use the IOMMU, which is a prerequisite
> for device passthrough.
NIT: you could mention that this is not needed when using passthrough dtb.

> 
> Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Reviewed-by: Michal Orzel <michal.orzel@amd.com>

~Michal