[lkml]   [2021]   [Oct]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subject[PATCH v3 0/6] Support IOMMU page sizes larger than the CPU page size


Time to revive this series:

v2 -> v3:
- Dropped support for untrusted devices since swiotlb currently does not
allow aligning buffers to granularities bigger than PAGE_SIZE.
Getting this to work is possibly but a bit tricky together with min_align_mask.
Right now there are no untrusted device on the M1 anyway and this series already
feels big enough. I've therefore decided to address this in a follow up.
- Replaced phys_to_page with pfn_to_page(PHYS_PFN(..)) since not all architectures
define phys_to_page
- Replaced the PAGE_SIZE > granule check in iommu_check_page_size with
domain->pgsize_bitmap & (PAGE_SIZE | (PAGE_SIZE - 1)) as suggested by Robin
- Rebased on the latest rc which required to introduce sg_alloc_append_table_from_pages
since __sg_alloc_table_from_pages no longer exists

RFC -> v2:
- essentially a comlpetely rewrite of the first approach which just padded every

Some background: On the Apple M1 the IOMMUs are hardwired to only support 16 KB pages.
We'd still like to boot Linux with 4KB pages though because that's what most distros
ship these days. I've been told this also helps with Android userspace compatibility
and x86 emulation.
This patch series adds support for that setup to the IOMMU DMA API.

This is essentially done by always mapping the encapsulating IOMMU page and adjusting
the returned iova offset. There are also changes to only allow DMA domains to make use
of this and prevent UNMANAGED domains from encountering unexpected situations.



Sven Peter (6):
iommu/dma: Disable get_sgtable for granule > PAGE_SIZE
iommu/dma: Support granule > PAGE_SIZE in dma_map_sg
iommu/dma: Support granule > PAGE_SIZE allocations
iommu: Move IOMMU pagesize check to attach_device
iommu: Introduce __IOMMU_DOMAIN_LP
iommu/dart: Remove force_bypass logic

drivers/iommu/apple-dart.c | 14 +---
drivers/iommu/dma-iommu.c | 134 +++++++++++++++++++++++++++++++------
drivers/iommu/iommu.c | 40 ++++++++++-
drivers/iommu/iova.c | 7 +-
include/linux/iommu.h | 18 ++++-
5 files changed, 174 insertions(+), 39 deletions(-)


 \ /
  Last update: 2021-10-19 18:39    [W:0.060 / U:3.868 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site