mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: Alyssa Rosenzweig <alyssa@rosenzweig.io>,
	Sven Peter <sven@svenpeter.dev>, Janne Grunau <j@jannau.net>,
	Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>
Cc: asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	iommu@lists.linux.dev, linux-kernel@vger.kernel.org,
	Hector Martin <marcan@marcan.st>
Subject: Re: [PATCH 2/5] iommu/dart: Skip reset for locked DARTs
Date: Tue, 11 Feb 2025 18:34:27 +0000	[thread overview]
Message-ID: <98af5c02-5006-4272-aaf0-a0e30c312059@arm.com> (raw)
In-Reply-To: <20250210-locked-dart-v1-2-5d97fe247f35@rosenzweig.io>

On 2025-02-10 7:39 pm, Alyssa Rosenzweig wrote:
> Locked DARTs cannot be reconfigured, therefore the reset/restore
> procedure can't work and should not be needed. Skip it, allowing locked
> DARTs to probe.
> 
> Co-developed-by: Hector Martin <marcan@marcan.st>
> Signed-off-by: Hector Martin <marcan@marcan.st>
> Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
> ---
>   drivers/iommu/apple-dart.c | 24 ++++++++++++------------
>   1 file changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c
> index 460cf96bc8001e051916f356d5d175b35e36c608..9c74a95eb7e819e94ab2fb47ed0d411a1eba8bf7 100644
> --- a/drivers/iommu/apple-dart.c
> +++ b/drivers/iommu/apple-dart.c
> @@ -452,17 +452,9 @@ apple_dart_t8110_hw_invalidate_tlb(struct apple_dart_stream_map *stream_map)
>   
>   static int apple_dart_hw_reset(struct apple_dart *dart)
>   {
> -	u32 config;
>   	struct apple_dart_stream_map stream_map;
>   	int i;
>   
> -	config = readl(dart->regs + dart->hw->lock);
> -	if (config & dart->hw->lock_bit) {
> -		dev_err(dart->dev, "DART is locked down until reboot: %08x\n",
> -			config);
> -		return -EINVAL;
> -	}
> -
>   	stream_map.dart = dart;
>   	bitmap_zero(stream_map.sidmap, DART_MAX_STREAMS);
>   	bitmap_set(stream_map.sidmap, 0, dart->num_streams);
> @@ -1151,9 +1143,11 @@ static int apple_dart_probe(struct platform_device *pdev)
>   	}
>   
>   	dart->locked = apple_dart_is_locked(dart);
> -	ret = apple_dart_hw_reset(dart);
> -	if (ret)
> -		goto err_clk_disable;
> +	if (!dart->locked) {
> +		ret = apple_dart_hw_reset(dart);
> +		if (ret)
> +			goto err_clk_disable;
> +	}
>   
>   	ret = request_irq(dart->irq, dart->hw->irq_handler, IRQF_SHARED,
>   			  "apple-dart fault handler", dart);
> @@ -1192,7 +1186,9 @@ static void apple_dart_remove(struct platform_device *pdev)
>   {
>   	struct apple_dart *dart = platform_get_drvdata(pdev);
>   
> -	apple_dart_hw_reset(dart);
> +	if (!dart->locked)
> +		apple_dart_hw_reset(dart);

Not much point saving anything on suspend either, in that case.

Thanks,
Robin.

> +
>   	free_irq(dart->irq, dart);
>   
>   	iommu_device_unregister(&dart->iommu);
> @@ -1325,6 +1321,10 @@ static __maybe_unused int apple_dart_resume(struct device *dev)
>   	unsigned int sid, idx;
>   	int ret;
>   
> +	/* Locked DARTs can't be restored, and they should not need it */
> +	if (dart->locked)
> +		return 0;
> +
>   	ret = apple_dart_hw_reset(dart);
>   	if (ret) {
>   		dev_err(dev, "Failed to reset DART on resume\n");
> 


  reply	other threads:[~2025-02-11 18:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-10 19:39 [PATCH 0/5] iommu: apple-dart: Support " Alyssa Rosenzweig
2025-02-10 19:39 ` [PATCH 1/5] iommu/dart: Track if the DART is locked Alyssa Rosenzweig
2025-02-10 19:39 ` [PATCH 2/5] iommu/dart: Skip reset for locked DARTs Alyssa Rosenzweig
2025-02-11 18:34   ` Robin Murphy [this message]
2025-02-11 18:44     ` Alyssa Rosenzweig
2025-02-10 19:39 ` [PATCH 3/5] iommu/dart: Set DMA domain " Alyssa Rosenzweig
2025-02-11 18:25   ` Robin Murphy
2025-02-11 18:40     ` Alyssa Rosenzweig
2025-02-11 20:37       ` Robin Murphy
2025-02-10 19:39 ` [PATCH 4/5] iommu/dart: Reject identity " Alyssa Rosenzweig
2025-02-11  6:07   ` Nick Chan
2025-02-11 12:17     ` Alyssa Rosenzweig
2025-02-10 19:39 ` [PATCH 5/5] iommu/dart: Assert !locked when configuring Alyssa Rosenzweig
2025-02-11 18:41   ` Robin Murphy
2025-02-11 19:20     ` Alyssa Rosenzweig
2025-02-11 19:21     ` Janne Grunau
2025-02-11 21:13       ` Robin Murphy
2025-02-10 19:48 ` [PATCH 0/5] iommu: apple-dart: Support locked DARTs Neal Gompa

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=98af5c02-5006-4272-aaf0-a0e30c312059@arm.com \
    --to=robin.murphy@arm.com \
    --cc=alyssa@rosenzweig.io \
    --cc=asahi@lists.linux.dev \
    --cc=iommu@lists.linux.dev \
    --cc=j@jannau.net \
    --cc=joro@8bytes.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcan@marcan.st \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®