[Public]

> -----Original Message-----
> From: Jan Beulich <[email protected]>
> Sent: Thursday, September 11, 2025 7:59 PM
> To: Penny, Zheng <[email protected]>
> Cc: Huang, Ray <[email protected]>; Stefano Stabellini
> <[email protected]>; Julien Grall <[email protected]>; Bertrand Marquis
> <[email protected]>; Orzel, Michal <[email protected]>; Andrew
> Cooper <[email protected]>; Anthony PERARD
> <[email protected]>; Roger Pau MonnĂ© <[email protected]>;
> Volodymyr Babchuk <[email protected]>; Rahul Singh
> <[email protected]>; [email protected]
> Subject: Re: [PATCH v2 20/26] xen/domctl: wrap iommu-related domctl op with
> CONFIG_MGMT_HYPERCALLS
>
> On 10.09.2025 09:38, 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.
> > Tracking its calling chain, the following functions shall all be
> > wrapped with CONFIG_MGMT_HYPERCALLS:
> > - iommu_do_pci_domctl
> >   - iommu_get_device_group
> >     - amd_iommu_group_id/intel_iommu_group_id
> >   - device_assigned
> >   - assign_device
> >     - intel_iommu_assign_device/amd_iommu_assign_device
> >   - deassign_device
> >     - reassign_device_ownership/reassign_device
> > - iommu_do_dt_domctl
> >   - iommu_deassign_dt_device
> >     - arm_smmu_reassign_dev/arm_smmu_reassign_dev
> >     - ipmmu_reassign_dev
> >       - ipmmu_deassign_dev
> >         - ipmmu_detach_dev
> >   - dt_find_node_by_gpath
> > Wrap XEN_DOMCTL_assign_device{test_assign_device,deassign_device,
> > get_device_group}-case transiently with CONFIG_MGMT_HYPERCALLS, and it
> > will be removed when introducing CONFIG_MGMT_HYPERCALLS on the whole
> > domctl.c in the last.
> >
> > Signed-off-by: Penny Zheng <[email protected]>
>
> Apart from all of the above another aspect becomes apparent here: Some code is
> called at boot time only once management hypercalls are compiled out. Such 
> code
> should then move to .init.text, so we may need to gain something like
> __init_or_mgmt. Imo that would want dealing with right here, but I can imagine
> opinions to differ on this.
>

Like handle_device() -> iommu_assign_dt_device(), once MGMT_HYPERCALLS=n 
compiled out toolstack scenario, we only have usage at boot time for dom0less 
on arm. And also set_global_virq_handler() in the previous commit... And 
domain_create()/domain_teardown()...
I remembered that when checking each switch-case-block under do_domctl(), for 
some of it, the references could be simply divided into two ways: toolstack and 
boot-time. I suggest to do it on a follow-up patch serie to go through 
do_domctl() all over again.

> Furthermore, while looking around, I noticed that there's 
> dt_overlay_sysctl(), entirely
> unguarded despite the earlier sysctl series. Yet if that work (and Misra 
> checking)
> assumed OVERLAY_DTB=n, then there's iommu_remove_dt_device() which is only
> used when OVERLAY_DTB=y.
>

The whole file dt-overlay.c is guarded by CONFIG_SYSCTL, as it is compiled 
under CONFIG_OVERLAY_DTB which depends on CONFIG_SYSCTL. So, 
dt_overlay_sysctl() is guarded.
 While,  yes, I forgot iommu_remove_dt_device().

> Jan

Reply via email to