|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [XEN][PATCH v5 10/17] xen/iommu: Introduce iommu_remove_dt_device()
Hi Vikram,
On 11/04/2023 21:16, Vikram Garhwal wrote:
>
>
> Remove master device from the IOMMU. This will be helpful when removing the
> overlay nodes using dynamic programming during run time.
>
> Signed-off-by: Vikram Garhwal <vikram.garhwal@xxxxxxx>
> ---
> xen/drivers/passthrough/device_tree.c | 38 +++++++++++++++++++++++++++
> xen/include/xen/iommu.h | 2 ++
> 2 files changed, 40 insertions(+)
>
> diff --git a/xen/drivers/passthrough/device_tree.c
> b/xen/drivers/passthrough/device_tree.c
> index 457df333a0..a77a217f3d 100644
> --- a/xen/drivers/passthrough/device_tree.c
> +++ b/xen/drivers/passthrough/device_tree.c
> @@ -126,6 +126,44 @@ int iommu_release_dt_devices(struct domain *d)
> return 0;
> }
>
> +int iommu_remove_dt_device(struct dt_device_node *np)
> +{
> + const struct iommu_ops *ops = iommu_get_ops();
> + struct device *dev = dt_to_dev(np);
> + int rc;
> +
> + if ( !ops )
> + return -EOPNOTSUPP;
> +
> + spin_lock(&dtdevs_lock);
> +
> + if ( iommu_dt_device_is_assigned_locked(np) )
> + {
> + rc = -EBUSY;
> + goto fail;
> + }
> +
> + /*
> + * The driver which supports generic IOMMU DT bindings must have
> + * these callback implemented.
s/these/this since you are checking for a single callback.
> + */
> + if ( !ops->remove_device )
> + {
> + rc = -EOPNOTSUPP;
> + goto fail;
> + }
> +
> + /* Remove master device from the IOMMU if latter is present and
> available. */
80 chars length exceeded -> please fix.
Apart from that, similarly to comment inside iommu_add_dt_device(), I would
also write
something that the driver is responsible for unsetting is_protected flag.
Apart from that:
Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>
~Michal
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |