Linux IOMMU Development
 help / color / mirror / Atom feed
From: Sven Peter <sven@kernel.org>
To: Nick Chan <towinchenmi@gmail.com>
Cc: asahi@lists.linux.dev, Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Rob Herring <robh@kernel.org>,
	Jassi Brar <jassisinghbrar@gmail.com>,
	Neal Gompa <neal@gompa.dev>, Janne Grunau <j@jannau.net>,
	Christoph Hellwig <hch@lst.de>, Keith Busch <kbusch@kernel.org>,
	Robin Murphy <robin.murphy@arm.com>,
	Will Deacon <will@kernel.org>, Joerg Roedel <joro@8bytes.org>,
	Sagi Grimberg <sagi@grimberg.me>,
	Hector Martin <marcan@marcan.st>, Jens Axboe <axboe@kernel.dk>,
	Conor Dooley <conor+dt@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	iommu@lists.linux.dev, linux-nvme@lists.infradead.org,
	Alyssa Rosenzweig <alyssa@rosenzweig.io>
Subject: Re: [PATCH 7/9] nvme: apple: Add Apple A11 support
Date: Sun, 17 Aug 2025 12:47:16 +0200	[thread overview]
Message-ID: <56be1cd1-73cc-4733-b364-31b74f588e9b@kernel.org> (raw)
In-Reply-To: <20250811-t8015-nvme-v1-7-ef9c200e74a7@gmail.com>

On 11.08.25 15:50, Nick Chan wrote:
> Add support for ANS2 NVMe on Apple A11 SoC.
> 
> This version of ANS2 is less quirky than the one in M1, and does not have
> NVMMU or Linear SQ. However, it still requires a non-standard 128-byte
> SQE.
> 
> Signed-off-by: Nick Chan <towinchenmi@gmail.com>
> ---
>   drivers/nvme/host/apple.c | 228 +++++++++++++++++++++++++++++++---------------

[...]

>   }
>   
>   static void apple_nvme_rtkit_crashed(void *cookie, const void *crashlog, size_t crashlog_size)
> @@ -284,21 +294,8 @@ static void apple_nvme_submit_cmd(struct apple_nvme_queue *q,
>   				  struct nvme_command *cmd)
>   {

Please just create a separate submit function here.
There's just not much code that's shared between the two variants.

[...]

>   }
>   
> @@ -587,10 +618,17 @@ static inline void apple_nvme_handle_cqe(struct apple_nvme_queue *q,
>   {
>   	struct apple_nvme *anv = queue_to_apple_nvme(q);
>   	struct nvme_completion *cqe = &q->cqes[idx];
> -	__u16 command_id = READ_ONCE(cqe->command_id);
>   	struct request *req;
>   
> -	apple_nvmmu_inval(q, command_id);
> +	if (!anv->hw->has_lsq_nvmmu)
> +		cqe->command_id--;
> +
> +	__u16 command_id = READ_ONCE(cqe->command_id);
> +
> +	if (anv->hw->has_lsq_nvmmu)
> +		apple_nvmmu_inval(q, command_id);
> +	else
> +		command_id++;

This entire block here looks weird. First you decrease the command_id
directly inside the shared memory structure, then you read it with
READ_ONCE to a local variable only to increase it again. Why?



Sven

  reply	other threads:[~2025-08-17 10:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-11 13:50 [PATCH 0/9] Add support ANS2 NVMe on Apple A11 Nick Chan
2025-08-11 13:50 ` [PATCH 1/9] dt-bindings: mailbox: apple,mailbox: Add ASC mailboxes on Apple A11 and T2 Nick Chan
2025-08-11 13:50 ` [PATCH 2/9] soc: apple: mailbox: Add Apple A11 and T2 mailbox support Nick Chan
2025-08-17 10:30   ` Sven Peter
2025-08-11 13:50 ` [PATCH 3/9] dt-bindings: iommu: apple,sart: Add Apple A11 Nick Chan
2025-08-17 10:50   ` Sven Peter
2025-08-11 13:50 ` [PATCH 4/9] soc: apple: sart: Make allow flags SART version dependent Nick Chan
2025-08-17 10:31   ` Sven Peter
2025-08-11 13:50 ` [PATCH 5/9] soc: apple: sart: Add SARTv0 support Nick Chan
2025-08-17 10:32   ` Sven Peter
2025-08-11 13:50 ` [PATCH 6/9] dt-bindings: nvme: apple,nvme-ans: Add Apple A11 Nick Chan
2025-08-11 13:50 ` [PATCH 7/9] nvme: apple: Add Apple A11 support Nick Chan
2025-08-17 10:47   ` Sven Peter [this message]
2025-08-17 16:36     ` Nick Chan
2025-08-11 13:51 ` [PATCH 8/9] arm64: dts: apple: t8015: Fix PCIE power domains dependencies Nick Chan
2025-08-11 13:51 ` [PATCH 9/9] arm64: dts: apple: t8015: Add NVMe nodes Nick Chan

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=56be1cd1-73cc-4733-b364-31b74f588e9b@kernel.org \
    --to=sven@kernel.org \
    --cc=alyssa@rosenzweig.io \
    --cc=asahi@lists.linux.dev \
    --cc=axboe@kernel.dk \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux.dev \
    --cc=j@jannau.net \
    --cc=jassisinghbrar@gmail.com \
    --cc=joro@8bytes.org \
    --cc=kbusch@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=marcan@marcan.st \
    --cc=neal@gompa.dev \
    --cc=robh@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=sagi@grimberg.me \
    --cc=towinchenmi@gmail.com \
    --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