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 72910C433F5 for ; Sat, 22 Jan 2022 19:31:45 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 607AE82C6D; Sat, 22 Jan 2022 20:31:42 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xs4all.nl Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id A7AAE82EBB; Sat, 22 Jan 2022 20:31:40 +0100 (CET) Received: from sibelius.xs4all.nl (sibelius.xs4all.nl [83.163.83.176]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2D90881F7E for ; Sat, 22 Jan 2022 20:31:38 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xs4all.nl Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=mark.kettenis@xs4all.nl Received: from localhost (bloch.sibelius.xs4all.nl [local]) by bloch.sibelius.xs4all.nl (OpenSMTPD) with ESMTPA id 24028144; Sat, 22 Jan 2022 20:31:36 +0100 (CET) Date: Sat, 22 Jan 2022 20:31:36 +0100 (CET) From: Mark Kettenis To: Simon Glass Cc: kettenis@openbsd.org, u-boot@lists.denx.de, jh80.chung@samsung.com, trini@konsulko.com, sven@svenpeter.dev, marcan@marcan.st, bmeng.cn@gmail.com In-Reply-To: (message from Simon Glass on Sat, 22 Jan 2022 10:17:14 -0700) Subject: Re: [PATCH 3/8] arm: apple: Add RTKit support References: <20220114110438.58452-1-kettenis@openbsd.org> <20220114110438.58452-4-kettenis@openbsd.org> Message-ID: 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 > From: Simon Glass > Date: Sat, 22 Jan 2022 10:17:14 -0700 > > Hi Mark, > > On Sat, 22 Jan 2022 at 06:59, Mark Kettenis wrote: > > > > > From: Simon Glass > > > Date: Fri, 21 Jan 2022 18:40:14 -0700 > > > > > > Hi Mark, > > > > > > On Fri, 14 Jan 2022 at 04:05, Mark Kettenis wrote: > > > > > > > > Most Apple IOPs run a firmware that is based on what Apple calls > > > > RTKit. RTKit implements a common mailbox protocol. This code > > > > provides an implementation of the AP side of this protocol, > > > > providing a function to initialize RTKit-based firmwares as well > > > > as a function to do a clean shutdown of this firmware. > > > > > > > > Signed-off-by: Mark Kettenis > > > > --- > > > > arch/arm/include/asm/arch-apple/rtkit.h | 11 ++ > > > > arch/arm/mach-apple/Makefile | 1 + > > > > arch/arm/mach-apple/rtkit.c | 231 ++++++++++++++++++++++++ > > > > 3 files changed, 243 insertions(+) > > > > create mode 100644 arch/arm/include/asm/arch-apple/rtkit.h > > > > create mode 100644 arch/arm/mach-apple/rtkit.c > > > > > > This should be a driver. > > > > This isn't a driver but just a bit of helper code that implements the > > RTKit protocol. It will be used by the Apple NVMe driver and a future > > SMC driver. The same approach is being taken in Linux. Since it is > > intended to be shared, I didn't put it in the NVMe driver itself. > > It just seems to set up and close down the peripheral, so this could > be a driver. What happens when someone needs to change it for a new > generation? Normally we would use the compatible string for that, but > here you have code that might get duplicated or parameterised in > another way. The protocol is versioned, and apple_rtkit_init() does the appropriate version negotation. Currently we support protocol versions 11 and 12 (which seem to correspond to the firmware distributed with macOS 11 and macOS 12). But we haven't noticed any real differences between those versions yet. > Anyway if you really think this is the right way, it is OK. We do it > elsewhere, iwc > > Reviewed-by: Simon Glass > Tested on: Macbook Air M1 > Tested-by: Simon Glass > > Regards, > Simon >