lkml.org 
[lkml]   [2022]   [Sep]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v5 2/5] iommu/io-pgtable: Move Apple DART support to its own file
From
On 16/09/2022 18.41, Janne Grunau wrote:
> The pte format used by the DARTs found in the Apple M1 (t8103) is not
> fully compatible with io-pgtable-arm. The 24 MSB are used for subpage
> protection (mapping only parts of page) and conflict with the address
> mask. In addition bit 1 is not available for tagging entries but disables
> subpage protection. Subpage protection could be useful to support a CPU
> granule of 4k with the fixed IOMMU page size of 16k.
>
> The DARTs found on Apple M1 Pro/Max/Ultra use another different pte
> format which is even less compatible. To support an output address size
> of 42 bit the address is shifted down by 4. Subpage protection is
> mandatory and bit 1 signifies uncached mappings used by the display
> controller.
>
> It would be advantageous to share code for all known Apple DART
> variants to support common features. The page table allocator for DARTs
> is less complex since it uses a two levels of translation table without
> support for huge pages.
>
> Signed-off-by: Janne Grunau <j@jannau.net>
> Acked-by: Robin Murphy <robin.murphy@arm.com>
> Acked-by: Sven Peter <sven@svenpeter.dev>
>
> ---

[...]

> +static void *__dart_alloc_pages(size_t size, gfp_t gfp,
> + struct io_pgtable_cfg *cfg)
> +{
> + struct device *dev = cfg->iommu_dev;
> + int order = get_order(size);
> + struct page *p;
> +
> + VM_BUG_ON((gfp & __GFP_HIGHMEM));
> + p = alloc_pages(gfp | __GFP_ZERO, order);
> + if (!p)
> + return NULL;
> +
> + return page_address(p);
> +}

This throws a warning:

drivers/iommu/io-pgtable-dart.c: In function ‘__dart_alloc_pages’:
drivers/iommu/io-pgtable-dart.c:112:24: warning: unused variable ‘dev’
[-Wunused-variable]
112 | struct device *dev = cfg->iommu_dev;
| ^~~

The fix is trivial, of course.

- Hector

\
 
 \ /
  Last update: 2022-09-22 16:06    [W:0.021 / U:1.600 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site