All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hector Martin <marcan@marcan.st>
To: Janne Grunau <j@jannau.net>, iommu@lists.linux.dev
Cc: Konrad Dybcio <konrad.dybcio@somainline.org>,
	asahi@lists.linux.dev, Robin Murphy <robin.murphy@arm.com>,
	Sven Peter <sven@svenpeter.dev>,
	Alyssa Rosenzweig <alyssa@rosenzweig.io>,
	Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
	iommu@lists.linux-foundation.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 2/5] iommu/io-pgtable: Move Apple DART support to its own file
Date: Thu, 22 Sep 2022 23:05:10 +0900	[thread overview]
Message-ID: <ff713226-333c-72e6-da79-7f0b54b6d15d@marcan.st> (raw)
In-Reply-To: <20220916094152.87137-3-j@jannau.net>

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

WARNING: multiple messages have this Message-ID (diff)
From: Hector Martin <marcan@marcan.st>
To: Janne Grunau <j@jannau.net>, iommu@lists.linux.dev
Cc: Konrad Dybcio <konrad.dybcio@somainline.org>,
	asahi@lists.linux.dev, Robin Murphy <robin.murphy@arm.com>,
	Sven Peter <sven@svenpeter.dev>,
	Alyssa Rosenzweig <alyssa@rosenzweig.io>,
	Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
	iommu@lists.linux-foundation.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 2/5] iommu/io-pgtable: Move Apple DART support to its own file
Date: Thu, 22 Sep 2022 23:05:10 +0900	[thread overview]
Message-ID: <ff713226-333c-72e6-da79-7f0b54b6d15d@marcan.st> (raw)
In-Reply-To: <20220916094152.87137-3-j@jannau.net>

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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-09-22 14:05 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-16  9:41 [PATCH v5 0/5] iommu: M1 Pro/Max DART support Janne Grunau
2022-09-16  9:41 ` Janne Grunau
2022-09-16  9:41 ` [PATCH v5 1/5] dt-bindings: iommu: dart: add t6000 compatible Janne Grunau
2022-09-16  9:41   ` Janne Grunau
2022-09-22 12:05   ` Hector Martin
2022-09-22 12:05     ` Hector Martin
2022-09-16  9:41 ` [PATCH v5 2/5] iommu/io-pgtable: Move Apple DART support to its own file Janne Grunau
2022-09-16  9:41   ` Janne Grunau
2022-09-22 14:05   ` Hector Martin [this message]
2022-09-22 14:05     ` Hector Martin
2022-09-16  9:41 ` [PATCH v5 3/5] iommu/io-pgtable: Add DART subpage protection support Janne Grunau
2022-09-16  9:41   ` Janne Grunau
2022-09-16 11:57   ` Rob Herring
2022-09-16 11:57     ` Rob Herring
2022-09-16  9:41 ` [PATCH v5 4/5] iommu/io-pgtable-dart: Add DART PTE support for t6000 Janne Grunau
2022-09-16  9:41   ` Janne Grunau
2022-09-16 12:03   ` Rob Herring
2022-09-16 12:03     ` Rob Herring
2022-09-16  9:41 ` [PATCH v5 5/5] iommu: dart: Support t6000 variant Janne Grunau
2022-09-16  9:41   ` Janne Grunau
2022-09-16 12:05   ` Rob Herring
2022-09-16 12:05     ` Rob Herring
2022-09-21 13:20 ` [PATCH v5 0/5] iommu: M1 Pro/Max DART support Robin Murphy
2022-09-21 13:20   ` Robin Murphy
2022-09-22 14:05 ` Hector Martin
2022-09-22 14:05   ` Hector Martin
2022-09-26 11:50 ` Joerg Roedel
2022-09-26 11:50   ` Joerg Roedel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ff713226-333c-72e6-da79-7f0b54b6d15d@marcan.st \
    --to=marcan@marcan.st \
    --cc=alyssa@rosenzweig.io \
    --cc=asahi@lists.linux.dev \
    --cc=iommu@lists.linux-foundation.org \
    --cc=iommu@lists.linux.dev \
    --cc=j@jannau.net \
    --cc=joro@8bytes.org \
    --cc=konrad.dybcio@somainline.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=sven@svenpeter.dev \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.