[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [XEN][RFC PATCH v4 09/16] xen/iommu: Introduce iommu_remove_dt_device()
Hi, On 23/01/2023 10:00, Michal Orzel wrote: 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..a8ba0b0d17 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; +Aren't we missing a check if iommu is enabled?+ if ( !ops ) + return -EOPNOTSUPP;-EINVAL to match the return values returned by other functions? The meaning of -EINVAL is quite overloaded. So it would be better to use a mix of errno to help differentiating the error paths. In this case, '!ops' means there are no possibility (read "support") to remove the device. So I think -EOPNOTUSUPP is suitable. + + spin_lock(&dtdevs_lock); + + if ( iommu_dt_device_is_assigned_locked(np) ) {Incorrect coding style. The closing brace should be placed on the next line.+ rc = -EBUSY; + goto fail; + } + + /* + * The driver which supports generic IOMMU DT bindings must have + * these callback implemented. + */ + if ( !ops->remove_device ) {Incorrect coding style. The closing brace should be placed on the next line.+ rc = -EOPNOTSUPP;-EINVAL to match the return values returned by other functions? Ditto. Cheers, -- Julien Grall
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |