On 05/02/2020 09:42, Jan Beulich wrote: > amd_iommu_get_paging_mode() expects a count, not a "maximum possible" > value. Prior to b4f042236ae0 dropping the reference, the use of our mis- > named "max_page" in amd_iommu_domain_init() may have lead to such a > misunderstanding. > > Also replace a literal 4 by an expression tying it to a wider use > constant, just like amd_iommu_quarantine_init() does. > > Fixes: ea38867831da ("x86 / iommu: set up a scratch page in the quarantine > domain") > Fixes: b4f042236ae0 ("AMD/IOMMU: Cease using a dynamic height for the IOMMU > pagetables") > Signed-off-by: Jan Beulich <jbeul...@suse.com> > --- > Note: I'm not at the same time adding error checking here, despite > amd_iommu_get_paging_mode() possibly returning one, as I think > that's a sufficiently orthogonal aspect.
It is entirely non-obvious what amd_iommu_get_paging_mode() takes, which is presumably what has led to this confusion. It also seems silly to force a call into another translation unit when 2/3 of the callers can be evaluated at compile time. How about re-implementing amd_iommu_get_paging_mode() as a static inline (seeing as it is just basic arithmetic), and naming its parameter in a more useful, e.g. max_frames ? ~Andrew _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel