[RFC PATCH v5 05/10] drivers: iommu: change error code when iommu is disabled

Oleksii Moisieiev posted 10 patches 3 months, 1 week ago
[RFC PATCH v5 05/10] drivers: iommu: change error code when iommu is disabled
Posted by Oleksii Moisieiev 3 months, 1 week ago
Change -ENOPNOTSUPP error code to -ENXIO when iommu is disabled during
iommu_do_domctl call. As was discussed in [1]

[0]: https://lore.kernel.org/xen-devel/alpine.DEB.2.22.394.2506171701190.1780597@ubuntu-linux-20-04-desktop/

Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
---

Changes in v5:
- set error code to -ENXIO when iommu is disabled

 xen/drivers/passthrough/iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
index 16aad86973..075bbd1718 100644
--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -632,7 +632,7 @@ int iommu_do_domctl(
     int ret = -ENODEV;
 
     if ( !(d ? is_iommu_enabled(d) : iommu_enabled) )
-        return -EOPNOTSUPP;
+        return -ENXIO;
 
 #ifdef CONFIG_HAS_PCI
     ret = iommu_do_pci_domctl(domctl, d, u_domctl);
-- 
2.34.1
Re: [RFC PATCH v5 05/10] drivers: iommu: change error code when iommu is disabled
Posted by Jan Beulich 3 months, 1 week ago
On 22.07.2025 13:41, Oleksii Moisieiev wrote:
> Change -ENOPNOTSUPP error code to -ENXIO when iommu is disabled during
> iommu_do_domctl call. As was discussed in [1]
> 
> [0]: https://lore.kernel.org/xen-devel/alpine.DEB.2.22.394.2506171701190.1780597@ubuntu-linux-20-04-desktop/

Hmm, I can't read any justification for the choice of the particular error
code out of that email. How's ENXIO going to be (and remain) unique? If you
need a specific indication of the IOMMU being disabled, I think you want to
have a specific query for that. Assuming XEN_SYSCTL_PHYSCAP_directio isn't
enough (for whatever reason).

Jan