Re: [PATCH v2 6/8] iommu: Move IOMMU pagesize check to attach_device

2021-09-01 Thread Robin Murphy
On 2021-09-01 18:14, Sven Peter wrote: On Tue, Aug 31, 2021, at 23:39, Alyssa Rosenzweig wrote: + if ((1 << __ffs(domain->pgsize_bitmap)) > PAGE_SIZE) { Not a fan of this construction. Could you assign `(1 << __ffs(domain->pgsize_bitmap))` to an appropriately named temporary (e.g min_i

Re: [PATCH v2 6/8] iommu: Move IOMMU pagesize check to attach_device

2021-09-01 Thread Sven Peter via iommu
On Tue, Aug 31, 2021, at 23:39, Alyssa Rosenzweig wrote: > > + if ((1 << __ffs(domain->pgsize_bitmap)) > PAGE_SIZE) { > > Not a fan of this construction. Could you assign `(1 << > __ffs(domain->pgsize_bitmap))` to an appropriately named temporary (e.g > min_io_pgsize) so it's clearer what's g

Re: [PATCH v2 6/8] iommu: Move IOMMU pagesize check to attach_device

2021-08-31 Thread Alyssa Rosenzweig
> + if ((1 << __ffs(domain->pgsize_bitmap)) > PAGE_SIZE) { Not a fan of this construction. Could you assign `(1 << __ffs(domain->pgsize_bitmap))` to an appropriately named temporary (e.g min_io_pgsize) so it's clearer what's going on? > + pr_warn("IOMMU page size cannot represent

[PATCH v2 6/8] iommu: Move IOMMU pagesize check to attach_device

2021-08-28 Thread Sven Peter via iommu
The iova allocator is capable of handling any granularity which is a power of two. Remove the much stronger condition that the granularity must be smaller or equal to the CPU page size from a BUG_ON there. Instead, check this condition during __iommu_attach_device and fail gracefully. Signed-off-b