[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 20/23] xen/arm: vIOMMU: Modify the partial device tree for dom0less


  • To: Milan Djokic <milan_djokic@xxxxxxxx>
  • From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • Date: Mon, 13 Apr 2026 14:46:29 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 4.158.2.129) smtp.rcpttodomain=epam.com smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=p4FmrOpFb0e42n9yiw5GMtvYtRFntCV4vjFBnK7J5CQ=; b=aQJI5Jbg7YkmQHijPwK1YCbvoXqwS/bTR3Xeoi5UtmcutG2a9FM+oJoOYvBTmeR00uQcmtQJzkU3yWLRySEpeVssfOmsx8WnD8psEe+kFHjw+t1CVYTyT+u704o1wHrY/lvA95hoHr5kH5kHPejb5Voo9BG7/mHDTmg2KbGPeQsY6wzWonxgYk+3Z08NM/1QM+RycjN/R9N0joZKq/BViVLCN9QcMRxrqzTBgCSQnb3LKuD/qZcD82h5+z1cGQ1qQgm5Jp0Rv1LjLqzw8mssYvfRR5Rydrl1HqRuJUUDDhtfb2hc2NWaRBpytF3FkXxeKA2Y/TRE1eI2TMcNhaD9kg==
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=p4FmrOpFb0e42n9yiw5GMtvYtRFntCV4vjFBnK7J5CQ=; b=PJvgHDltr+Qrr1JFZQrRl7EtxsiBi9AVw+qGDxpvxlD0BQB/uARmCYO3cBUeU708q7hjXC4BSbyLanjdjfwgSMI5tmknzvM+kAQys//mZ+eR+ZvcQxO3TspCzmpGW40pIsq7dvryz90BFBFmTsDfiqb6xTg0RERDLb20OUw6pl1OQ4lWw3b8iYevHGo0h0QTb3mV1kKsEyRS9UfAhS9XnVfVQ08HRaQZxNRp1h9rhmm9CdlK6U4CQu8WZKDHUKueKgNBkoz/xyvjGtKFSIQEDKb77UbDX1Twq3xu9CdfKsrQjRA7ls6+HRSVpD7eKfesw4dFFAna80jZLkXHKQ81Qg==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=A13YOEKs/5fu+PG42GwaQnDsIYmOHBjecb03/BJN2qlozKy/f9lRBIpvfxKDhjTms6405Xs+NHkUos094fYuVvga2+/X3wv3kJB4HJJHdf0GpTnNanpT9Ly7WUUxummUPE7064uouUAyGEhJQwWFw/AKBaBkfClK9LvCsPDhadVS9ieMUjLJeje7p8gKlVhU7by0HaPuaAkLLm/6aRRQ5rtdK6eG14y/bWiUHO6r5xetRF/dp47ImS19Kv+fOMBU86iANfJ77FmJEWR9xWgKWv6BS5ifULwnnn3OFbU4OAv9E2bIOJvMXkInToPsRTf1Sz+xSAa0dFJ9TSsBokyUVw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=iDe8x30MXtO/HO8CFSN6E6vwtdqo++h+eiMWZwoCBQCPhKAdh27XRP6aJ8N0uESjMoEuVJG3p5uFcO57znDe2WSEyHwM0HO9uQI3A0Ld8X5GZ+dGZwQpZ+XeEC+RopYkfIFnj8GD449LUyjEqwvkoANzc0Jd5SryOvJ6aTI7bfkTieoSRkpS/LNsrUUM6m96PFwwGpE+OUOUE1wIHWew3bXf/2nXJNdJ7Te6a7nssyHOqku7ftg3EF482fQ0n6oNlzQlCVFo81QjivEmzne/IWBzI7UplFPo2FbzHryLtNLYefGtzZIEQTjUhKHyK04A9AAMWsNkKQzTOHohAXpyoQ==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=arm.com header.i="@arm.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"; dkim=pass header.s=selector1 header.d=arm.com header.i="@arm.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Rahul Singh <Rahul.Singh@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>
  • Delivery-date: Mon, 13 Apr 2026 14:47:54 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Thread-index: AQHcy1RPOVtQoBcTykuFEWgWmPGPfw==
  • Thread-topic: [PATCH v3 20/23] xen/arm: vIOMMU: Modify the partial device tree for dom0less

Hi Milan,

> On 31 Mar 2026, at 02:52, Milan Djokic <milan_djokic@xxxxxxxx> wrote:
> 
> From: Rahul Singh <rahul.singh@xxxxxxx>
> 
> 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 confiure the IOMMU

typo s/confiure/configure/

> correctly replace the phandle in partial device tree with virtual
> IOMMU phandle when "iommus" property is set.
> 
> Signed-off-by: Rahul Singh <rahul.singh@xxxxxxx>
> Signed-off-by: Milan Djokic <milan_djokic@xxxxxxxx>
> ---
> xen/common/device-tree/dom0less-build.c | 31 ++++++++++++++++++++++++-
> 1 file changed, 30 insertions(+), 1 deletion(-)
> 
> diff --git a/xen/common/device-tree/dom0less-build.c 
> b/xen/common/device-tree/dom0less-build.c
> index 840d14419d..4b74d2f705 100644
> --- a/xen/common/device-tree/dom0less-build.c
> +++ b/xen/common/device-tree/dom0less-build.c
> @@ -318,7 +318,35 @@ 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,
> +static void 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);

we should check if the allocation was ok

> +
> +    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;
> +}
> +
> +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)
> @@ -344,6 +372,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);
>         rc = scan_pfdt_node(kinfo, pfdt, node_next, address_cells, size_cells,
>                             scan_passthrough_prop);
>         if ( rc )
> 

Cheers,
Luca




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.