From: Oleksandr Tyshchenko <olekstysh@gmail.com>
To: Milan Djokic <milan_djokic@epam.com>,
"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: Rahul Singh <rahul.singh@arm.com>,
Stefano Stabellini <sstabellini@kernel.org>,
Julien Grall <julien@xen.org>,
Bertrand Marquis <bertrand.marquis@arm.com>,
Michal Orzel <michal.orzel@amd.com>
Subject: Re: [PATCH v4 19/22] xen/arm: vIOMMU: Modify the partial device tree for dom0less
Date: Fri, 9 Oct 2026 15:34:23 +0300 [thread overview]
Message-ID: <cbdea9d7-e410-4228-acfa-3600e02bb956@gmail.com> (raw)
In-Reply-To: <9e31544f751d8a9708e1e6385da1b3ac6a438153.1791328190.git.milan_djokic@epam.com>
On 10/7/26 03:07, Milan Djokic wrote:
Hello Milan
> From: Rahul Singh <rahul.singh@arm.com>
>
> To configure IOMMU in guest for passthrough devices, user will need to
> copy the unmodified "iommus" property from host device tree to partial
> device tree. To enable the dom0 linux kernel to configure the IOMMU
> correctly replace the phandle in partial device tree with virtual
> IOMMU phandle when "iommus" property is set.
>
> Signed-off-by: Rahul Singh <rahul.singh@arm.com>
> Signed-off-by: Milan Djokic <milan_djokic@epam.com>
> ---
> xen/common/device-tree/dom0less-build.c | 40 ++++++++++++++++++++++++-
> 1 file changed, 39 insertions(+), 1 deletion(-)
>
> diff --git a/xen/common/device-tree/dom0less-build.c b/xen/common/device-tree/dom0less-build.c
> index fcbeb8adbd..7280bcf72b 100644
> --- a/xen/common/device-tree/dom0less-build.c
> +++ b/xen/common/device-tree/dom0less-build.c
> @@ -331,7 +331,44 @@ static int __init handle_prop_pfdt(struct kernel_info *kinfo,
> return ( propoff != -FDT_ERR_NOTFOUND ) ? propoff : 0;
> }
>
> -static int __init scan_pfdt_node(struct kernel_info *kinfo, const void *pfdt,
> +#ifdef CONFIG_ARM_VIRTUAL_IOMMU
> +static void __init modify_pfdt_node(void *pfdt, int nodeoff)
> +{
> + int proplen, i, rc;
> + const fdt32_t *prop;
> + fdt32_t *prop_c;
> +
> + prop = fdt_getprop(pfdt, nodeoff, "iommus", &proplen);
> + if ( !prop )
> + return;
> +
> + prop_c = xzalloc_bytes(proplen);
> + if ( !prop_c )
> + return;
> +
> + for ( i = 0; i < proplen / 8; ++i )
> + {
> + prop_c[i * 2] = cpu_to_fdt32(GUEST_PHANDLE_VSMMUV3);
> + prop_c[i * 2 + 1] = prop[i * 2 + 1];
> + }
> +
> + rc = fdt_setprop(pfdt, nodeoff, "iommus", prop_c, proplen);
> + if ( rc )
> + {
> + dprintk(XENLOG_ERR, "Can't set the iommus property in partial FDT");
> + return;
> + }
> +
> + return;
> +}
> +#else
> + static inline void __init modify_pfdt_node(void *pfdt, int nodeoff)
> + {
> + return;
> + }
> +#endif
> +
> +static int __init scan_pfdt_node(struct kernel_info *kinfo, void *pfdt,
> int nodeoff,
> uint32_t address_cells, uint32_t size_cells,
> bool scan_passthrough_prop)
> @@ -357,6 +394,7 @@ static int __init scan_pfdt_node(struct kernel_info *kinfo, const void *pfdt,
> node_next = fdt_first_subnode(pfdt, nodeoff);
> while ( node_next > 0 )
> {
> + modify_pfdt_node(pfdt, node_next);
I might miss something, but ^^^ returns void, so allocation or vSID
assigment failures (viommu_allocate_vsid() is added by next commit
#20/22) are ignored. So the guest might be created with the host phandle
and SID in its device tree or with a half-updated device tree. The IOMMU
may (will?) not work and nobody is told. Should not we return the error
here?
Also looks like the each rewritten node also leaks prop_c.
> rc = scan_pfdt_node(kinfo, pfdt, node_next, address_cells, size_cells,
> scan_passthrough_prop);
> if ( rc )
next prev parent reply other threads:[~2026-10-09 12:34 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-07 0:06 [PATCH v4 00/22] Add SMMUv3 Stage 1 Support for Xen guests Milan Djokic
2026-10-07 0:06 ` [PATCH v4 01/22] xen/arm: smmuv3: Maintain a SID->device structure Milan Djokic
2026-10-07 0:06 ` [PATCH v4 02/22] xen/arm: smmuv3: Add support for stage-1 and nested stage translation Milan Djokic
2026-10-09 17:37 ` Oleksandr Tyshchenko
2026-10-07 0:06 ` [PATCH v4 03/22] xen/arm: smmuv3: Alloc io_domain for each device Milan Djokic
2026-10-07 0:06 ` [PATCH v4 04/22] xen/arm: vIOMMU: add generic vIOMMU framework Milan Djokic
2026-10-09 11:41 ` Oleksandr Tyshchenko
2026-10-07 0:06 ` [PATCH v4 05/22] xen/arm: vsmmuv3: Add dummy support for virtual SMMUv3 for guests Milan Djokic
2026-10-11 14:06 ` Oleksandr Tyshchenko
2026-10-07 0:06 ` [PATCH v4 06/22] tools: Add XEN_DOMCTL_CONFIG_VIOMMU_* and viommu config param Milan Djokic
2026-10-07 0:06 ` [PATCH v4 07/22] xen/arm: smmuv3: Extend HW features detection and apply errata Milan Djokic
2026-10-07 0:06 ` [PATCH v4 08/22] xen/arm: vsmmuv3: Add support for registers emulation Milan Djokic
2026-10-07 0:06 ` [PATCH v4 09/22] xen/arm: vsmmuv3: Add support for cmdqueue handling Milan Djokic
2026-10-10 16:58 ` Oleksandr Tyshchenko
2026-10-07 0:06 ` [PATCH v4 10/22] xen/arm: vsmmuv3: Add support for command CMD_CFGI_STE Milan Djokic
2026-10-10 16:14 ` Oleksandr Tyshchenko
2026-10-07 0:07 ` [PATCH v4 11/22] xen/arm: vsmmuv3: Attach Stage-1 configuration to SMMUv3 hardware Milan Djokic
2026-10-10 14:47 ` Oleksandr Tyshchenko
2026-10-07 0:07 ` [PATCH v4 12/22] xen/arm: vsmmuv3: Add support for event queue and global error Milan Djokic
2026-10-11 13:27 ` Oleksandr Tyshchenko
2026-10-07 0:07 ` [PATCH v4 13/22] xen/arm: vsmmuv3: IOMMU device tree node for dom0 Milan Djokic
2026-10-10 15:30 ` Oleksandr Tyshchenko
2026-10-07 0:07 ` [PATCH v4 14/22] xen/arm: vsmmuv3: Emulated SMMUv3 device tree node for dom0less Milan Djokic
2026-10-07 0:07 ` [PATCH v4 15/22] arm/libxl: vsmmuv3: Emulated SMMUv3 device tree node in libxl Milan Djokic
2026-10-07 0:07 ` [PATCH v4 16/22] xen/arm: vsmmuv3: Insert vIRQ properties into vIOMMU device tree node Milan Djokic
2026-10-07 0:07 ` [PATCH v4 17/22] xen/arm: vsmmuv3: Add support to send stage-1 event to guest Milan Djokic
2026-10-09 15:12 ` Oleksandr Tyshchenko
2026-10-07 0:07 ` [PATCH v4 18/22] libxl/arm: vIOMMU: Modify the partial device tree for iommus Milan Djokic
2026-10-07 0:07 ` [PATCH v4 19/22] xen/arm: vIOMMU: Modify the partial device tree for dom0less Milan Djokic
2026-10-09 12:34 ` Oleksandr Tyshchenko [this message]
2026-10-07 0:07 ` [PATCH v4 20/22] xen/arm: vIOMMU vSID->pSID mapping layer Milan Djokic
2026-10-09 14:15 ` Oleksandr Tyshchenko
2026-10-07 0:07 ` [PATCH v4 21/22] libxl/arm: Introduce domctl command for IOMMU vSID mapping Milan Djokic
2026-10-09 13:07 ` Oleksandr Tyshchenko
2026-10-07 0:08 ` [PATCH v4 22/22] doc/arm: vIOMMU design document Milan Djokic
2026-10-09 15:40 ` Dmytro Prokopchuk1
2026-10-10 15:16 ` Oleksandr Tyshchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cbdea9d7-e410-4228-acfa-3600e02bb956@gmail.com \
--to=olekstysh@gmail.com \
--cc=bertrand.marquis@arm.com \
--cc=julien@xen.org \
--cc=michal.orzel@amd.com \
--cc=milan_djokic@epam.com \
--cc=rahul.singh@arm.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.