[PATCH v4 16/24] xen/domctl: wrap iommu-related domctl op with CONFIG_MGMT_HYPERCALLS

Penny Zheng posted 24 patches 3 weeks, 1 day ago
There is a newer version of this series
[PATCH v4 16/24] xen/domctl: wrap iommu-related domctl op with CONFIG_MGMT_HYPERCALLS
Posted by Penny Zheng 3 weeks, 1 day ago
Function iommu_do_domctl() is the main entry for all iommu-related domctl-op,
and shall be wrapped with CONFIG_MGMT_HYPERCALLS.
Otherwise it will become unreachable when MGMT_HYPERCALLS=n, and hence
violating Misra rule 2.1

Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
---
v3 -> v4:
- new commit
---
Commit "xen/domctl: wrap pci-subset iommu-related domctl op with
CONFIG_MGMT_HYPERCALLS" and "xen/domctl: wrap device-tree-subset iommu-related
domctl op with CONFIG_MGMT_HYPERCALLS" are the prereq commit.
---
 xen/drivers/passthrough/iommu.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
index c9425d6971..8812e38174 100644
--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -625,6 +625,7 @@ void iommu_resume(void)
         iommu_vcall(iommu_get_ops(), resume);
 }
 
+#ifdef CONFIG_MGMT_HYPERCALLS
 int iommu_do_domctl(
     struct xen_domctl *domctl, struct domain *d,
     XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
@@ -645,6 +646,7 @@ int iommu_do_domctl(
 
     return ret;
 }
+#endif /* CONFIG_MGMT_HYPERCALLS */1
 
 void iommu_crash_shutdown(void)
 {
-- 
2.34.1
Re: [PATCH v4 16/24] xen/domctl: wrap iommu-related domctl op with CONFIG_MGMT_HYPERCALLS
Posted by Jan Beulich 2 weeks, 4 days ago
On 21.11.2025 11:57, Penny Zheng wrote:
> Function iommu_do_domctl() is the main entry for all iommu-related domctl-op,
> and shall be wrapped with CONFIG_MGMT_HYPERCALLS.
> Otherwise it will become unreachable when MGMT_HYPERCALLS=n, and hence
> violating Misra rule 2.1
> 
> Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
> ---
> v3 -> v4:
> - new commit
> ---
> Commit "xen/domctl: wrap pci-subset iommu-related domctl op with
> CONFIG_MGMT_HYPERCALLS" and "xen/domctl: wrap device-tree-subset iommu-related
> domctl op with CONFIG_MGMT_HYPERCALLS" are the prereq commit.

You state the normal thing here: The general assumption is that later patches
in a series depend on earlier ones. What you want to state is when this general
rule doesn't apply, i.e. when patches can move ahead (some or entirely), and
hence can be committed when they alone are ready, without having other
dependencies (or with having only some).

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

The latest here xen/iommu.h also needs touching, as just said in reply to
patch 14. Unused hooks shall stay around.

Jan
Re: [PATCH v4 16/24] xen/domctl: wrap iommu-related domctl op with CONFIG_MGMT_HYPERCALLS
Posted by Grygorii Strashko 3 weeks, 1 day ago

On 21.11.25 12:57, Penny Zheng wrote:
> Function iommu_do_domctl() is the main entry for all iommu-related domctl-op,
> and shall be wrapped with CONFIG_MGMT_HYPERCALLS.
> Otherwise it will become unreachable when MGMT_HYPERCALLS=n, and hence
> violating Misra rule 2.1
> 
> Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
> ---
> v3 -> v4:
> - new commit
> ---
> Commit "xen/domctl: wrap pci-subset iommu-related domctl op with
> CONFIG_MGMT_HYPERCALLS" and "xen/domctl: wrap device-tree-subset iommu-related
> domctl op with CONFIG_MGMT_HYPERCALLS" are the prereq commit.
> ---
>   xen/drivers/passthrough/iommu.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
> index c9425d6971..8812e38174 100644
> --- a/xen/drivers/passthrough/iommu.c
> +++ b/xen/drivers/passthrough/iommu.c
> @@ -625,6 +625,7 @@ void iommu_resume(void)
>           iommu_vcall(iommu_get_ops(), resume);
>   }
>   
> +#ifdef CONFIG_MGMT_HYPERCALLS
>   int iommu_do_domctl(
>       struct xen_domctl *domctl, struct domain *d,
>       XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
> @@ -645,6 +646,7 @@ int iommu_do_domctl(
>   
>       return ret;
>   }
> +#endif /* CONFIG_MGMT_HYPERCALLS */1

"/1" type - build fail

>   
>   void iommu_crash_shutdown(void)
>   {

-- 
Best regards,
-grygorii