From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 29E09C433F5 for ; Sat, 22 Jan 2022 17:17:38 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3AEDA837FD; Sat, 22 Jan 2022 18:17:32 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Bftg5unt"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 82317835CA; Sat, 22 Jan 2022 18:17:27 +0100 (CET) Received: from mail-ua1-x935.google.com (mail-ua1-x935.google.com [IPv6:2607:f8b0:4864:20::935]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 97E7682F87 for ; Sat, 22 Jan 2022 18:17:24 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@google.com Received: by mail-ua1-x935.google.com with SMTP id y4so22922712uad.1 for ; Sat, 22 Jan 2022 09:17:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Mo07VqT/p4x4KivMz03vB5j2If+Z1fwgF2djBhQcfH4=; b=Bftg5unt+/GGFhVI11b+l0hcXTH2AgbBwKSt8H3sj4vdROmvGUisjpp0e8Ls9lHQWh b1Hg5nsLB+/74+LZhXJ8mU5FGyvZSB+rr/m6pCtuLNqHGqMNLNXUMwIlbvSUS8r4Xz57 zpKQKdbsRXsAJLljhbMVqvHh4Uq2zw70clpsY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Mo07VqT/p4x4KivMz03vB5j2If+Z1fwgF2djBhQcfH4=; b=wxytGL06MBeYEbHxFofEKYy2hW7ZgshG0+/Q24fZqWJM/NoSF0frv7x+TcWiqBHEq3 g/7dTOCfMSz0ylQvUjo6ncXfNEHp32rkqcKE7qh7cPIot5f7IzdQrV+S58KLcrtnkCwf /q2x2G4z94J3Rbo57aEHFa+DOfgpddBn20OrrGjbzVbd5lze7I6Yv3FfqsWOY+0Ss5ku 2U+aas8Z0L+Gb/6rXnvo9fWL34FqQH67uin0QB0SjdZ2nV+3L2TEX6lc4G6zeAlLHL5M watn/Km5qf1Mmt/5oJ9xlASeT64Os6O/+Dt1acFi2A4DSGAbQQYruXlG1QSqJ8pYkszv SRVA== X-Gm-Message-State: AOAM5310cJAkD3aKdaqANzKBSLxPwLuSC/gUDe4q0kuB94JZ/+TSTaN5 x7Dbq36AXF9gOa/PqXX5LZ4AqRccBPYTjXoCFU5JFQ== X-Google-Smtp-Source: ABdhPJyOJ4vbaqMD6SgBiAcjypGLS4jUrDpR6es3nT8xKw7JlOs7WURX1jfRizfe8gQ5IDr9cKneq7g23nvh0vqg0I8= X-Received: by 2002:a05:6130:3a0:: with SMTP id az32mr4131880uab.140.1642871843225; Sat, 22 Jan 2022 09:17:23 -0800 (PST) MIME-Version: 1.0 References: <20220114110438.58452-1-kettenis@openbsd.org> <20220114110438.58452-8-kettenis@openbsd.org> In-Reply-To: From: Simon Glass Date: Sat, 22 Jan 2022 10:17:08 -0700 Message-ID: Subject: Re: [PATCH 7/8] nvme: apple: Add driver for Apple NVMe storage controller To: Mark Kettenis Cc: Mark Kettenis , U-Boot Mailing List , Jaehoon Chung , Tom Rini , sven@svenpeter.dev, marcan@marcan.st, Bin Meng Content-Type: text/plain; charset="UTF-8" X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean Hi Mark, On Sat, 22 Jan 2022 at 07:45, Mark Kettenis wrote: > > > From: Simon Glass > > Date: Fri, 21 Jan 2022 18:40:24 -0700 > > > > Hi Mark, > > > > On Fri, 14 Jan 2022 at 04:05, Mark Kettenis wrote: > > > > > > Add a driver for the NVMe storage controller integrated on > > > Apple SoCs. This NVMe controller isn't PCI based and deviates > > > from the NVMe standard in its implementation of the command > > > submission queue and the integration of an NVMMU that needs > > > to be managed. This commit tweaks the core NVMe code to > > > support the linear command submission queue implemented by > > > this controller. But setting up the submission queue and > > > managing the NVMMU controller is handled by implementing > > > the driver ops that were added in an earlier commit. > > > > > > Signed-off-by: Mark Kettenis > > > Tested-on: firefly-rk3399 > > > Tested-by: Mark Kettenis > > > --- > > > configs/apple_m1_defconfig | 1 + > > > drivers/nvme/Kconfig | 11 ++ > > > drivers/nvme/Makefile | 1 + > > > drivers/nvme/nvme_apple.c | 233 +++++++++++++++++++++++++++++++++++++ > > > 4 files changed, 246 insertions(+) > > > create mode 100644 drivers/nvme/nvme_apple.c > > > > Tested on: Macbook Air M1 > > Tested-by: Simon Glass > > > > > > > > diff --git a/configs/apple_m1_defconfig b/configs/apple_m1_defconfig > > > index cb235e4e7d..1528217b17 100644 > > > --- a/configs/apple_m1_defconfig > > > +++ b/configs/apple_m1_defconfig > > > @@ -11,6 +11,7 @@ CONFIG_DISPLAY_BOARDINFO_LATE=y > > > # CONFIG_NET is not set > > > # CONFIG_MMC is not set > > > CONFIG_DEBUG_UART_ANNOUNCE=y > > > +CONFIG_NVME_APPLE=y > > > CONFIG_USB_XHCI_HCD=y > > > CONFIG_USB_XHCI_DWC3=y > > > CONFIG_USB_KEYBOARD=y > > > diff --git a/drivers/nvme/Kconfig b/drivers/nvme/Kconfig > > > index 78da444c8b..0cb465160b 100644 > > > --- a/drivers/nvme/Kconfig > > > +++ b/drivers/nvme/Kconfig > > > @@ -10,6 +10,17 @@ config NVME > > > This option enables support for NVM Express devices. > > > It supports basic functions of NVMe (read/write). > > > > > > +config NVME_APPLE > > > + bool "Apple NVMe controller support" > > > + select NVME > > > + help > > > + This option enables support for the NVMe storage > > > + controller integrated on Apple SoCs. This controller > > > + isn't PCI-based based and deviates from the NVMe > > > + standard implementation in its implementation of > > > + the command submission queue and the integration > > > + of an NVMMU that needs to be managed. > > > + > > > config NVME_PCI > > > bool "NVM Express PCI device support" > > > depends on PCI > > > diff --git a/drivers/nvme/Makefile b/drivers/nvme/Makefile > > > index fad9724e17..fa7b619446 100644 > > > --- a/drivers/nvme/Makefile > > > +++ b/drivers/nvme/Makefile > > > @@ -3,4 +3,5 @@ > > > # Copyright (C) 2017, Bin Meng > > > > > > obj-y += nvme-uclass.o nvme.o nvme_show.o > > > +obj-$(CONFIG_NVME_APPLE) += nvme_apple.o > > > obj-$(CONFIG_NVME_PCI) += nvme_pci.o > > > diff --git a/drivers/nvme/nvme_apple.c b/drivers/nvme/nvme_apple.c > > > new file mode 100644 > > > index 0000000000..b0dc8492f0 > > > --- /dev/null > > > +++ b/drivers/nvme/nvme_apple.c > > > @@ -0,0 +1,233 @@ > > > +// SPDX-License-Identifier: GPL-2.0+ > > > +/* > > > + * (C) Copyright 2021 Mark Kettenis > > > + */ > > > + > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include "nvme.h" > > > +#include > > > + > > > +#include > > > +#include > > > > asm/arch/ should work > > It doesn't. For some reason I end up with > > arch/arm/include/asm/arch -> arch-m1 > > But this rtkit stuff is expected to be generic and apply to all Apple > SoCs, not just the M1. Hmm so you plan to have an arch/m2 as well? Can we not put everything in arch/apple then? We don't normally have arch directories for different generations unless they are completely different. [..] Regards, Simon