Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp306200pxb; Thu, 21 Jan 2021 07:34:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJwaLu2wNRlpdUEjOPX/6O9csKxZ2YFo5vZRFlSrWWaN2P/ZItslXGbSyJl8oxlD2o96LIM/ X-Received: by 2002:a17:906:bc5a:: with SMTP id s26mr9642ejv.327.1611243281069; Thu, 21 Jan 2021 07:34:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611243281; cv=none; d=google.com; s=arc-20160816; b=pMnXwKJnxxKvG3Fj6YvPB8DgdWi8bPljaSIcfD9MrP/ZQfHQTvdAP0YhtUccSOnuGK J3NjoQa26xWcospKYJ+IEAS2cprDNCaWvey5Uxhvv3Qe8A8uEv4wyTld8RYNOy6/VhUP tZNmZLk6Zmrq6ahV57BDaAapgyVb0jQd4B0T7CNe5UT+4Ap6X69Mh0nyLA/5NVu/+E77 WUp/xJz+IwNI68v9OJCmsS4DnNL2wHCaNY88GCbzhwuQI7LKRdyX2Hy111kCh56YzclK GZ5nlxyDCHIGui68WoDll5axEJ9wq845Zn4yAeOVNbWrvAKvBFYZrO4OvrOpGy4Ys41g McOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:subject:from :references:cc:to; bh=7EFzZ3O3lFcSRy5wWv8wu8yiZF5rtIuJblBCYGpU72I=; b=JzqNi8CEUNG8DxX8hqLul19y+8RdMi25FeSfwzKnwNLNrHV1pXCxy1anXHGsA9WmEm +R4QCAeh560fOGkpQjGgyF/5mf1KuTobyItPnvYtieHyKBbiHHGMLAjSOwBqy6B7QKa2 NE+HA8grdwEOdAz2FszIr/G9xOoi8tylPO/wGP2eDZsGAUxcZxBpSdS6dKJYErrQsLCn SHS9LlgADjV3HH/5Ud5bDvFSDbnS2ed1kaj4jcgeAjogPwzNo55T2a5XEybyeU8TuWH4 cREYeMoKbUNoc+oxlln4+28kyKSi7z2F041iPZuIB3Jl1QCmxtvDurw3Wib45ClAlD7h 9kVg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k5si1908997ejj.483.2021.01.21.07.33.46; Thu, 21 Jan 2021 07:34:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731136AbhAUPbX (ORCPT + 99 others); Thu, 21 Jan 2021 10:31:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732158AbhAUPaq (ORCPT ); Thu, 21 Jan 2021 10:30:46 -0500 Received: from mail.marcansoft.com (marcansoft.com [IPv6:2a01:298:fe:f::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2732FC06174A for ; Thu, 21 Jan 2021 07:30:05 -0800 (PST) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: marcan@marcan.st) by mail.marcansoft.com (Postfix) with ESMTPSA id 3E7D4419AD; Thu, 21 Jan 2021 15:30:01 +0000 (UTC) To: Arnd Bergmann , Linus Walleij Cc: Mohamed Mediouni , Mark Rutland , Catalin Marinas , "linux-kernel@vger.kernel.org" , Marc Zyngier , Will Deacon , Linux ARM , Stan Skowronek References: <20210120132717.395873-1-mohamed.mediouni@caramail.com> <20210120132717.395873-5-mohamed.mediouni@caramail.com> From: Hector Martin 'marcan' Subject: Re: [RFC PATCH 4/7] irqchip/apple-aic: Add support for Apple AIC Message-ID: Date: Fri, 22 Jan 2021 00:29:58 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: es-ES Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21/01/2021 19.37, Arnd Bergmann wrote: > On Thu, Jan 21, 2021 at 10:48 AM Linus Walleij wrote: >> >> However weird it may seem, Apple is not in the file >> Documentation/devicetree/bindings/vendor-prefixes.yaml > > Since Apple are already using both the "AAPL" and the "apple" > prefix themselves, I have a bad feeling about reusing either of > them for defining the devicetree.org bindings that we add to > linux/Documentation/devicetree/bindings. The question is: if > not "apple", what else should we use here? This ties into the larger question of how we should handle devicetrees in general on these platforms. The two extremes are: 1) Have the bootloader outright convert ADT to FDT and make Linux support the entirety of Apple's devicetree structure, or 2) Maintain our own devicetrees and ignore Apple's entirely My feeling is that 1) is a non-starter, because Linux ARM device trees and Apple ARM device trees have seen independent evolution from the PowerPC era, and many details are completely different. Plus conversion is non-trivial, because the endianness is different and the format is too ambiguous to do programmatically without complex logic. On the other hand, cranking out devicetrees by hand for every device variant that Apple puts out is a waste of time. Obviously at the bare minimum the bootloader will need to move some dynamic information from the ADT to the FDT, but that can be a very specific set of properties (memory layout, MAC addresses, etc). My current thinking is that we should write offline, automated tooling to parse, diff, and automatically convert portions of Apple devicetrees into Linux ones. Then we can more easily maintain our own, but still ultimately have humans decide what goes into the Linux device trees. It's worth noting that AIUI Apple does not consider their devicetree layout to be stable, and it may change any time. On M1 devices, the devicetree is provided as part of the iBoot2 firmware bundle, which means it changes from one macOS version to the next (this is paired with the Darwin kernel itself, and they are upgraded as a unit). It includes placeholder values that iBoot2 then replaces with data from NOR before handing control over to the kernel. My goal for our long-term project [1] is to keep up with iBoot2 updates so that we do not have to instruct users to dig up old macOS versions. Quick TL;DR on how these things boot: - Boot ROM boots - iBoot1 (system firmware) in NOR flash which looks for a bootable OS in internal storage (only!) in the form of an APFS container+volume and then boots - iBoot2 (OS loader) which loads a bunch of firmware blobs and the devicetree off of storage, customizes it with system data from NOR, and then loads a wrapped mach-o file containing - A Darwin kernel, or in our case a Linux bootloader which then boots - A standard arm64 Linux blob The boot ROM is ROM. iBoot1 only ever rolls forward (downgrades impossible). iBoot2 downgrades are possible but Apple already proved they can break this willingly or not, at least in betas (macOS 11.2 Beta2 iBoot1 cannot boot Beta1 iBoot2). The secureboot chain goes all the way up to the mach-o kernel load, that is the first point where we can change boot policy to load anything we want (with user consent). [1] https://asahilinux.org/ -- Hector Martin "marcan" (marcan@marcan.st) Public Key: https://mrcn.st/pub