On 30/08/2023 00:45, Stefano Stabellini wrote: > > > On Tue, 29 Aug 2023, Michal Orzel wrote: >> On 25/08/2023 10:02, Vikram Garhwal wrote: >>> Add remove_device callback for removing the device entry from smmu-master >>> using >>> following steps: >>> 1. Find if SMMU master exists for the device node. >>> 2. Check if device is currently in use. >> Since you removed a call to iommu_dt_device_is_assigned_locked(), you do not >> check it from SMMU, right? >> You are relying on a check done in iommu_remove_dt_device(). >> This wants to be mentioned. However, Julien suggested to do the check for >> internal SMMU state. >> Looking at the code, when the device is assigned, we do: >> dev_iommu_domain(dev) = domain; >> and when de-assigned: >> dev_iommu_domain(dev) = NULL; >> >> This means that before calling remove_smmu_master() you could do: >> >> /* Make sure device is not assigned */ >> if (dev_iommu_domain(dev)) >> return -EBUSY; >> >> @Julien, @Stefano? > > I think it is OK without it, as we have a call to > iommu_dt_device_is_assigned_locked(np) already in > iommu_remove_dt_device? Yes, but this would add an extra layer of protection by checking for IOMMU domain for this device. ~Michal
- [XEN][PATCH v10 01/20] common/device_tree: handle memor... Vikram Garhwal
- [XEN][PATCH v10 09/20] xen/iommu: Move spin_lock from i... Vikram Garhwal
- [XEN][PATCH v10 14/20] common/device_tree: Add rwlock f... Vikram Garhwal
- Re: [XEN][PATCH v10 14/20] common/device_tree: Add... Vikram Garhwal
- Re: [XEN][PATCH v10 14/20] common/device_tree: Add... Michal Orzel
- [XEN][PATCH v10 13/20] asm/smp.h: Fix circular dependen... Vikram Garhwal
- [XEN][PATCH v10 12/20] xen/smmu: Add remove_device call... Vikram Garhwal
- Re: [XEN][PATCH v10 12/20] xen/smmu: Add remove_de... Michal Orzel
- Re: [XEN][PATCH v10 12/20] xen/smmu: Add remov... Stefano Stabellini
- Re: [XEN][PATCH v10 12/20] xen/smmu: Add r... Michal Orzel
- [XEN][PATCH v10 15/20] arm/asm/setup.h: Update struct m... Vikram Garhwal
- [XEN][PATCH v10 07/20] libfdt: overlay: change overlay_... Vikram Garhwal
- [XEN][PATCH v10 20/20] tools/xl: Add new xl command ove... Vikram Garhwal
- [XEN][PATCH v10 19/20] tools/libs/light: Implement new ... Vikram Garhwal
- [XEN][PATCH v10 18/20] tools/libs/ctrl: Implement new x... Vikram Garhwal
- [XEN][PATCH v10 17/20] xen/arm: Implement device tree n... Vikram Garhwal
- Re: [XEN][PATCH v10 17/20] xen/arm: Implement devi... Stefano Stabellini
- [XEN][PATCH v10 16/20] xen/arm: Implement device tree n... Vikram Garhwal
- Re: [XEN][PATCH v10 16/20] xen/arm: Implement devi... Stefano Stabellini