[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [XEN][PATCH v7 11/19] xen/iommu: Introduce iommu_remove_dt_device()
- To: Vikram Garhwal <vikram.garhwal@xxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Fri, 2 Jun 2023 11:22:41 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4sz3cIfM+RxhbSvoJSZ1fP1qiiqRjWDYZWsj6/2Cdyg=; b=E33jmVGIn57im88Zvv1lIQU/CLlj4ZQUP5WRGROyXWCqeVJb3DIZAb4FremtMQKX0mOyzT1MbyKXYZNcp/ToQ0AON52tm3ktgE0xahMqwdHT+O18RP1xSkU6dvgjNJqqaISj0jmDn7nzjjZfkhLaFfXZjzLX8FuldHfmU29gmdvw87tG6Zv/zk+xLCaDif5I0WtZzge/N82wvEXBR0v5/If9y1dcGoKEgUC1WDa6IPJmTLF/cqZPcN0sohf+jx25F62hlMSSRTJdZ0aSbmVYuNWRS1f9Q/AV5tlnF65jNoMmyPflvG9r/NszNtWjN0GnL8RYOYNgmsbVT4iwTO6E9w==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R8gaeO3m8rdflYYarNNbpKwaEfIvfjgzO1danDZtPd+UDW2U86Ehz9zdvHwLYgxiE43gEja1RyqH0R6/XhhQse35oMLvfIIJpvfJ8dyQqxAmLerU3ovv31hEkKaaCh/UxuMUxwNOGcsK5MnIkuPrd4snzfUMg77cr26GbImPtuy4MKzL2v6tkNnRzIuGT6OZa9m68z1tTWU+CSyPstIukFqI4HZk7TOSKijCsLqTSuDSAoxLph4ZlQWSYhEv+xyH0TGgL2FrgvO98edXhMs0xdedmxNAhgLiNC6JaLpFo+7XxPa0e59qKrZB9oDTNBZjbpf4wolP7L04WwoK6kPptg==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
- Cc: michal.orzel@xxxxxxx, sstabellini@xxxxxxxxxx, Julien Grall <julien@xxxxxxx>, Paul Durrant <paul@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- Delivery-date: Fri, 02 Jun 2023 09:22:59 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 02.06.2023 02:48, Vikram Garhwal wrote:
> --- a/xen/drivers/passthrough/device_tree.c
> +++ b/xen/drivers/passthrough/device_tree.c
> @@ -126,6 +126,47 @@ 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 this
> + * callback implemented.
> + */
> + if ( !ops->remove_device )
> + {
> + rc = -EOPNOTSUPP;
> + goto fail;
> + }
> +
> + /*
> + * Remove master device from the IOMMU if latter is present and
> available.
> + * The driver is responsible for removing is_protected flag.
> + */
> + rc = ops->remove_device(0, dev);
> +
> + if ( !rc )
> + iommu_fwspec_free(dev);
> +
> +fail:
> + spin_unlock(&dtdevs_lock);
> + return rc;
Same remark regarding label indentation - please address throughout the
series.
Jan
|