diff mbox series

[V6.1,3/3] libxl: arm: make creation of iommu node independent of disk device

Message ID ebcf40f0d5dfe6bfa27c11dc2fe3e65df48772fe.1662734469.git.viresh.kumar@linaro.org (mailing list archive)
State New, archived
Headers show
Series None | expand

Commit Message

Viresh Kumar Sept. 9, 2022, 2:43 p.m. UTC
The iommu node will be required for other virtio device types too, not
just disk device.

Move the call to make_xen_iommu_node(), out of the disk device specific
block and rename "iommu_created" variable to "iommu_needed", and set it
to true for virtio disk device.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
V6->V6.1:
- Initialize iommu_needed at declaration time only.
- Update comment.

 tools/libs/light/libxl_arm.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

Comments

Anthony PERARD Sept. 9, 2022, 3:02 p.m. UTC | #1
On Fri, Sep 09, 2022 at 08:13:28PM +0530, Viresh Kumar wrote:
> The iommu node will be required for other virtio device types too, not
> just disk device.
> 
> Move the call to make_xen_iommu_node(), out of the disk device specific
> block and rename "iommu_created" variable to "iommu_needed", and set it
> to true for virtio disk device.
> 
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>

Thanks,
Oleksandr Tyshchenko Sept. 16, 2022, 10:21 a.m. UTC | #2
On 09.09.22 17:43, Viresh Kumar wrote:

Hello Viresh

> The iommu node will be required for other virtio device types too, not
> just disk device.
>
> Move the call to make_xen_iommu_node(), out of the disk device specific
> block and rename "iommu_created" variable to "iommu_needed", and set it
> to true for virtio disk device.
>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
> V6->V6.1:
> - Initialize iommu_needed at declaration time only.
> - Update comment.

Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>



>
>   tools/libs/light/libxl_arm.c | 17 ++++++++++-------
>   1 file changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/tools/libs/light/libxl_arm.c b/tools/libs/light/libxl_arm.c
> index 55aee15c10b4..fe1c92383dd6 100644
> --- a/tools/libs/light/libxl_arm.c
> +++ b/tools/libs/light/libxl_arm.c
> @@ -1157,7 +1157,7 @@ static int libxl__prepare_dtb(libxl__gc *gc, libxl_domain_config *d_config,
>       size_t fdt_size = 0;
>       int pfdt_size = 0;
>       libxl_domain_build_info *const info = &d_config->b_info;
> -    bool iommu_created;
> +    bool iommu_needed = false;
>       unsigned int i;
>   
>       const libxl_version_info *vers;
> @@ -1265,22 +1265,25 @@ static int libxl__prepare_dtb(libxl__gc *gc, libxl_domain_config *d_config,
>           if (d_config->num_pcidevs)
>               FDT( make_vpci_node(gc, fdt, ainfo, dom) );
>   
> -        iommu_created = false;
>           for (i = 0; i < d_config->num_disks; i++) {
>               libxl_device_disk *disk = &d_config->disks[i];
>   
>               if (disk->specification == LIBXL_DISK_SPECIFICATION_VIRTIO) {
> -                if (disk->backend_domid != LIBXL_TOOLSTACK_DOMID &&
> -                    !iommu_created) {
> -                    FDT( make_xen_iommu_node(gc, fdt) );
> -                    iommu_created = true;
> -                }
> +                if (disk->backend_domid != LIBXL_TOOLSTACK_DOMID)
> +                    iommu_needed = true;
>   
>                   FDT( make_virtio_mmio_node(gc, fdt, disk->base, disk->irq,
>                                              disk->backend_domid) );
>               }
>           }
>   
> +        /*
> +         * The iommu node should be created only once for all virtio-mmio
> +         * devices.
> +         */
> +        if (iommu_needed)
> +            FDT( make_xen_iommu_node(gc, fdt) );
> +
>           if (pfdt)
>               FDT( copy_partial_fdt(gc, fdt, pfdt) );
>
Viresh Kumar Sept. 20, 2022, 10:29 a.m. UTC | #3
On 09-09-22, 16:02, Anthony PERARD wrote:
> On Fri, Sep 09, 2022 at 08:13:28PM +0530, Viresh Kumar wrote:
> > The iommu node will be required for other virtio device types too, not
> > just disk device.
> > 
> > Move the call to make_xen_iommu_node(), out of the disk device specific
> > block and rename "iommu_created" variable to "iommu_needed", and set it
> > to true for virtio disk device.
> > 
> > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> 
> Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>

I don't see these patches being applied yet, do I need to ping someone
for that ?
Julien Grall Oct. 4, 2022, 9:59 a.m. UTC | #4
Hi Viresh,

Apologies for the late reply. I was away for the past 2 weeks.

On 20/09/2022 11:29, Viresh Kumar wrote:
> On 09-09-22, 16:02, Anthony PERARD wrote:
>> On Fri, Sep 09, 2022 at 08:13:28PM +0530, Viresh Kumar wrote:
>>> The iommu node will be required for other virtio device types too, not
>>> just disk device.
>>>
>>> Move the call to make_xen_iommu_node(), out of the disk device specific
>>> block and rename "iommu_created" variable to "iommu_needed", and set it
>>> to true for virtio disk device.
>>>
>>> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
>>
>> Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
> 
> I don't see these patches being applied yet, do I need to ping someone
> for that ?

We are currently preparing to release Xen 4.17 (plan for November) and 
have stopped accepting new code (other than bug fix) since the beginning 
of September.

Your series will be committed once the tree is re-opened (hopefully by 
the beginning of November). Please ping me mid-november if this is still 
not applied.

Cheers,
Julien Grall Nov. 24, 2022, 7:19 p.m. UTC | #5
Hi Viresh,

On 04/10/2022 11:59, Julien Grall wrote:
> On 20/09/2022 11:29, Viresh Kumar wrote:
>> On 09-09-22, 16:02, Anthony PERARD wrote:
>>> On Fri, Sep 09, 2022 at 08:13:28PM +0530, Viresh Kumar wrote:
>>>> The iommu node will be required for other virtio device types too, not
>>>> just disk device.
>>>>
>>>> Move the call to make_xen_iommu_node(), out of the disk device specific
>>>> block and rename "iommu_created" variable to "iommu_needed", and set it
>>>> to true for virtio disk device.
>>>>
>>>> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
>>>
>>> Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
>>
>> I don't see these patches being applied yet, do I need to ping someone
>> for that ?
> 
> We are currently preparing to release Xen 4.17 (plan for November) and 
> have stopped accepting new code (other than bug fix) since the beginning 
> of September.
> 
> Your series will be committed once the tree is re-opened (hopefully by 
> the beginning of November). Please ping me mid-november if this is still 
> not applied.

Unfortunately, we had some delay for releasing 4.17. So I have pushed 
this series in a branch for-next/4.18. This will be applied to staging 
once the tree has re-opened.

Cheers,
Viresh Kumar Nov. 25, 2022, 5:45 a.m. UTC | #6
On 24-11-22, 20:19, Julien Grall wrote:
> Unfortunately, we had some delay for releasing 4.17. So I have pushed this
> series in a branch for-next/4.18.

Thanks.

> This will be applied to staging once the
> tree has re-opened.

I don't see the branch here though. Is it not public yet ? Or should I be
looking at a different tree ?

https://github.com/xen-project/xen
Julien Grall Nov. 28, 2022, 9:31 a.m. UTC | #7
Hi Viresh,

On 25/11/2022 06:45, Viresh Kumar wrote:
> On 24-11-22, 20:19, Julien Grall wrote:
>> Unfortunately, we had some delay for releasing 4.17. So I have pushed this
>> series in a branch for-next/4.18.
> 
> Thanks.
> 
>> This will be applied to staging once the
>> tree has re-opened.
> 
> I don't see the branch here though. Is it not public yet ? Or should I be
> looking at a different tree ?

The branch has been created in my personal tree for now:

https://xenbits.xen.org/gitweb/?p=people/julieng/xen-unstable.git;a=shortlog;h=refs/heads/for-next/4.18

Sorry I should have been clearer.

Cheers,
diff mbox series

Patch

diff --git a/tools/libs/light/libxl_arm.c b/tools/libs/light/libxl_arm.c
index 55aee15c10b4..fe1c92383dd6 100644
--- a/tools/libs/light/libxl_arm.c
+++ b/tools/libs/light/libxl_arm.c
@@ -1157,7 +1157,7 @@  static int libxl__prepare_dtb(libxl__gc *gc, libxl_domain_config *d_config,
     size_t fdt_size = 0;
     int pfdt_size = 0;
     libxl_domain_build_info *const info = &d_config->b_info;
-    bool iommu_created;
+    bool iommu_needed = false;
     unsigned int i;
 
     const libxl_version_info *vers;
@@ -1265,22 +1265,25 @@  static int libxl__prepare_dtb(libxl__gc *gc, libxl_domain_config *d_config,
         if (d_config->num_pcidevs)
             FDT( make_vpci_node(gc, fdt, ainfo, dom) );
 
-        iommu_created = false;
         for (i = 0; i < d_config->num_disks; i++) {
             libxl_device_disk *disk = &d_config->disks[i];
 
             if (disk->specification == LIBXL_DISK_SPECIFICATION_VIRTIO) {
-                if (disk->backend_domid != LIBXL_TOOLSTACK_DOMID &&
-                    !iommu_created) {
-                    FDT( make_xen_iommu_node(gc, fdt) );
-                    iommu_created = true;
-                }
+                if (disk->backend_domid != LIBXL_TOOLSTACK_DOMID)
+                    iommu_needed = true;
 
                 FDT( make_virtio_mmio_node(gc, fdt, disk->base, disk->irq,
                                            disk->backend_domid) );
             }
         }
 
+        /*
+         * The iommu node should be created only once for all virtio-mmio
+         * devices.
+         */
+        if (iommu_needed)
+            FDT( make_xen_iommu_node(gc, fdt) );
+
         if (pfdt)
             FDT( copy_partial_fdt(gc, fdt, pfdt) );