Mailing List Archive

[PATCH 03/15] xen/arm: Always enable IOMMU
From: Vikram Garhwal <fnu.vikram@xilinx.com>

For overlay with iommu functionality to work with running VMs, we need to enable
IOMMU by default for the domains.

Signed-off-by: Vikram Garhwal <fnu.vikram@xilinx.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
Signed-off-by: Henry Wang <xin.wang2@amd.com>
---
xen/arch/arm/dom0less-build.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c
index fb63ec6fd1..2d1fd1e214 100644
--- a/xen/arch/arm/dom0less-build.c
+++ b/xen/arch/arm/dom0less-build.c
@@ -894,7 +894,8 @@ void __init create_domUs(void)
panic("Missing property 'cpus' for domain %s\n",
dt_node_name(node));

- if ( dt_find_compatible_node(node, NULL, "multiboot,device-tree") &&
+ if ( (IS_ENABLED(CONFIG_OVERLAY_DTB) ||
+ dt_find_compatible_node(node, NULL, "multiboot,device-tree")) &&
iommu_enabled )
d_cfg.flags |= XEN_DOMCTL_CDF_iommu;

--
2.34.1
Re: [PATCH 03/15] xen/arm: Always enable IOMMU [ In reply to ]
Hi Henry,

On 24/04/2024 04:34, Henry Wang wrote:
> From: Vikram Garhwal <fnu.vikram@xilinx.com>
>
> For overlay with iommu functionality to work with running VMs, we need to enable
> IOMMU by default for the domains.
>
> Signed-off-by: Vikram Garhwal <fnu.vikram@xilinx.com>
> Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
> Signed-off-by: Henry Wang <xin.wang2@amd.com>
> ---
> xen/arch/arm/dom0less-build.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c
> index fb63ec6fd1..2d1fd1e214 100644
> --- a/xen/arch/arm/dom0less-build.c
> +++ b/xen/arch/arm/dom0less-build.c
> @@ -894,7 +894,8 @@ void __init create_domUs(void)
> panic("Missing property 'cpus' for domain %s\n",
> dt_node_name(node));
>
> - if ( dt_find_compatible_node(node, NULL, "multiboot,device-tree") &&
> + if ( (IS_ENABLED(CONFIG_OVERLAY_DTB) ||

Similar to the first patch, building Xen with the DTB overlay doesn't
mean the user will want to use it (think of distros that may want to
provide a generic Xen).

Instead, we should introduce a new DT property "passthrough" that would
indicate whether the IOMMU should be used.

To be futureproof, I would match the values used by xl.cfg (see
docs/man/xl.cfg.5.pod.in).

> + dt_find_compatible_node(node, NULL, "multiboot,device-tree")) &&
> iommu_enabled )
> d_cfg.flags |= XEN_DOMCTL_CDF_iommu;
>

Cheers,

--
Julien Grall
Re: [PATCH 03/15] xen/arm: Always enable IOMMU [ In reply to ]
Hi Julien,

On 4/24/2024 9:03 PM, Julien Grall wrote:
> Hi Henry,
>
> On 24/04/2024 04:34, Henry Wang wrote:
>> From: Vikram Garhwal <fnu.vikram@xilinx.com>
>>
>> For overlay with iommu functionality to work with running VMs, we
>> need to enable
>> IOMMU by default for the domains.
>>
>> Signed-off-by: Vikram Garhwal <fnu.vikram@xilinx.com>
>> Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
>> Signed-off-by: Henry Wang <xin.wang2@amd.com>
>> ---
>>   xen/arch/arm/dom0less-build.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/xen/arch/arm/dom0less-build.c
>> b/xen/arch/arm/dom0less-build.c
>> index fb63ec6fd1..2d1fd1e214 100644
>> --- a/xen/arch/arm/dom0less-build.c
>> +++ b/xen/arch/arm/dom0less-build.c
>> @@ -894,7 +894,8 @@ void __init create_domUs(void)
>>               panic("Missing property 'cpus' for domain %s\n",
>>                     dt_node_name(node));
>>   -        if ( dt_find_compatible_node(node, NULL,
>> "multiboot,device-tree") &&
>> +        if ( (IS_ENABLED(CONFIG_OVERLAY_DTB) ||
>
> Similar to the first patch, building Xen with the DTB overlay doesn't
> mean the user will want to use it (think of distros that may want to
> provide a generic Xen).
>
> Instead, we should introduce a new DT property "passthrough" that
> would indicate whether the IOMMU should be used.
>
> To be futureproof, I would match the values used by xl.cfg (see
> docs/man/xl.cfg.5.pod.in).

That sounds good. I can introduce a new DT property as suggested. Thanks
for the suggestion!

Kind regards,
Henry

>
>> + dt_find_compatible_node(node, NULL, "multiboot,device-tree")) &&
>>                iommu_enabled )
>>               d_cfg.flags |= XEN_DOMCTL_CDF_iommu;
>
> Cheers,
>