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?

~Michal

Reply via email to