On Mon, Sep 01, 2025 at 02:35:29AM +0000, Duan, Zhenzhong wrote: > >> I just noticed this change will conflict with your suggestion of using > >HW_NESTED terminology. > >> Let me know if you agree with this change or not? > > > >It wouldn't necessarily conflict. VIOMMU_FLAG_WANT_NESTING_PARENT > >is a request, interchangeable with VIOMMU_FLAG_SUPPORT_HW_NESTED, > >i.e. a cap. > > > >At the end of the day, they are fundamentally the same thing that > >is to tell the core to allocate a nesting parent HWPT. The former > >one is just more straightforward, avoiding confusing terms such as > >"stage-1" and "nested". > > > >IMHO, you wouldn't even need the comments in the other thread, as > >the flag explains clearly what it wants and what the core is doing. > > > >Also, once you use the "want" one, the "HW_NESTED" terminology will > >not exist in the code. > > OK, will use the *_flags and _WANT_* style, do you have suggestions > for the name of vfio_device_viommu_get_nested() since "HW_NESTED" > terminology will not exist, what about vfio_device_get_viommu_flags_W_N_P()?
I don't see it very necessary to have a specific API per flag. So, it could be just: uint64_t viommu_flags = vfio_device_get_viommu_flags(vbasedev); if (viommu_flags & VIOMMU_FLAG_WANT_NEST_PARENT) { flags |= IOMMU_HWPT_ALLOC_NEST_PARENT; } ? Thanks Nic