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 lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4F073C3DA49 for ; Thu, 25 Jul 2024 18:57:33 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.765095.1175673 (Exim 4.92) (envelope-from ) id 1sX3eG-0004Gl-13; Thu, 25 Jul 2024 18:57:08 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 765095.1175673; Thu, 25 Jul 2024 18:57:08 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sX3eF-0004Ge-TX; Thu, 25 Jul 2024 18:57:07 +0000 Received: by outflank-mailman (input) for mailman id 765095; Thu, 25 Jul 2024 18:57:07 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sX3eA-0004GW-Ob for xen-devel@lists.xenproject.org; Thu, 25 Jul 2024 18:57:07 +0000 Received: from smtp-8fa8.mail.infomaniak.ch (smtp-8fa8.mail.infomaniak.ch [83.166.143.168]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id ac697eaf-4ab7-11ef-bbff-fd08da9f4363; Thu, 25 Jul 2024 20:57:00 +0200 (CEST) Received: from smtp-3-0000.mail.infomaniak.ch (smtp-3-0000.mail.infomaniak.ch [10.4.36.107]) by smtp-3-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4WVKqv5ZBkzqNk; Thu, 25 Jul 2024 20:56:59 +0200 (CEST) Received: from unknown by smtp-3-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4WVKqt6zSLzW6L; Thu, 25 Jul 2024 20:56:58 +0200 (CEST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ac697eaf-4ab7-11ef-bbff-fd08da9f4363 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=byiq.org; s=20191114; t=1721933819; bh=BRruTllybKIIf3F/b0lHofkv4WQ2TL5jHRPMDfFiy5M=; h=Date:Subject:From:Reply-To:To:Cc:References:In-Reply-To:From; b=KjwEwEtawkqBhufkLOwXenWwrhJcdeR6FtSVoJeJWGsQrxbW09GIPutAWPUcodPrN 1Y4xePjiuogn5XYMSNrjdCDNK8hXSD9W5oKeDbHrJz068oHRxnRErrBpR7utITG3Ko SWkt2ptciYxNOswqYmmNWoRFIvbj0qSvKSaotonI= Message-ID: <99c8f34c61b59a16edb0fd11d214267e@mail.infomaniak.com> Date: Thu, 25 Jul 2024 20:56:58 +0200 Subject: Re: Xen for Apple Silicon (M1 and beyond) From: Techguru Reply-To: Techguru To: Stefano Stabellini Cc: xen-devel@lists.xenproject.org, Michal Orzel , Bertrand Marquis , Julien Grall MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="_=_swift_1721933818_e06b5c8fb8646690b380d5680f631849_=_" X-WS-User-Origin: eyJpdiI6ImlHSkt6eHlPMDBPeVJKSFN0WHZNQ1E9PSIsInZhbHVlIjoicG9wbWR2Z0N2UGxkM2RRUzhWRlIzZz09IiwibWFjIjoiMjdmMjIwMWNkZjQxNjY3MjM1ODYxOWVmMDE2MjllZGJhNDIwY2Q3OTViYTcwOTllOGUzZjgxOGRjOTI3NjExZiIsInRhZyI6IiJ9 X-WS-User-Mbox: eyJpdiI6ImZlc3lnOStTaXNpZWV6N0ZLdDBuVUE9PSIsInZhbHVlIjoiVTBtM1JweVdqNWdVZHYvNUFYS1lxdz09IiwibWFjIjoiNDAyODk4OGYyZTA2NjA0NzQyOTgyYzk1NTNlYjMzYjAwYWY0NmVkMmYxZTk4Y2E0NDIwNmY3NWQzYzE2Y2YwZCIsInRhZyI6IiJ9 X-WS-Location: eJxzKUpMKykGAAfpAmU- X-Mailer: Infomaniak Workspace (1.3.725) References: In-Reply-To: X-Infomaniak-Routing: alpha --_=_swift_1721933818_e06b5c8fb8646690b380d5680f631849_=_ Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable A bit about Apple Silicon M1(2,3,4) architecture, SoC and motherboard. (A= FAIK) There are no EFI assumptions nor contracts, and no EFI firmware.= Between those 4 generations of silicon, there are about 80 different= roles "SoC cores/components" can play, each with its own signed Apple = Firmware. Most of those SoC cores/functions have nothing to do with th= e traditional ARM compute cores. At least one of those SoC cores is = actually an x86 processor core (on models which support HDMI), running x8= 6 firmware. Many of the other non-compute cores (Networking, USC (A-C)= , Thunderbolt ... yada yada) are various size Arm cores running an Apple= RTOS Variant of L4 microkernel. Each of those, again, has its own A= pple Signed firmware which is paired with a particular Darwin kernel rele= ase. One point of friction is that there is no stable ABI spec for eac= h of the firmware modules. =C2=A0 Apple reserves the right to completely = change the firmware's interface with the paired Darwin kernel. = It is perhaps best to think of the SoC and related motherboard hardware a= s a "compute cluster" rather than a single von-neuman machine. I cou= ld be wrong about a lot of the above, and invite corrections with citatio= ns. >=C2=A0For=C2=A0this,=C2=A0do=C2=A0you=C2=A0know=C2=A0if=C2=A04K= =C2=A0pages=C2=A0are=C2=A0supported=C2=A0(in=C2=A0addition=C2=A0to=C2=A016K= )?=C2=A0It >=C2=A0 >=C2=A0would=C2=A0be=C2=A0a=C2=A0lot=C2=A0easier= =C2=A0to=C2=A0keep=C2=A0running=C2=A0Xen=C2=A0using=C2=A04K=C2=A0pages= =C2=A0and=C2=A0run=C2=A0guests >=C2=A0 >=C2=A0on=C2=A0top=C2=A0of=C2= =A0Xen=C2=A0which=C2=A0use=C2=A016K=C2=A0pages.=C2=A0In=C2=A0the=C2=A0past,= =C2=A0we=C2=A0had=C2=A0Linux=C2=A0using=C2=A064K >=C2=A0 >=C2=A0pages= =C2=A0running=C2=A0on=C2=A0top=C2=A0of=C2=A0Xen=C2=A0using=C2=A04K=C2=A0pag= es=C2=A0for=C2=A0example. Given the state of all of the _other_ SoC co= res running L4 RTOS, I have reservations about running with anything othe= r than 16k native pages. =C2=A0Will have to investigate what options= , if any, are available for keeping 16k pages for existing firmware, whil= e presenting 4k pages to guest OS. However, both Rosetta and Docker ap= pear to run 4k guests just fine, so not sure how many pushups they are do= ing in the process. TBD >>=C2=A0=C2=A0device=C2=A0trees; >= =C2=A0 >=C2=A0You=C2=A0might=C2=A0be=C2=A0able=C2=A0to=C2=A0use=C2=A0the= =C2=A0device=C2=A0tree=C2=A0which=C2=A0is=C2=A0used=C2=A0to=C2=A0boot=C2= =A0Linux >=C2=A0on >=C2=A0 >=C2=A0Apple=C2=A0silicon Yes, the As= ahi team has done some wizard level heavy lifting in that area. =C2=A0If = I recall correctly, their model is let apple boot loader load the apple s= igned firmware, pass off to the Asahi boot kernel, =C2=A0then present an = EFI compatible DT and driver surface on top of that for boot-essential dr= ivers. =C2=A0They also have a fairly nifty lightweight hypervisor that as= sists with debug and ultimately does boot via u-boot -> grub -> linux in = the current incarnation >=C2=A0 --_=_swift_1721933818_e06b5c8fb8646690b380d5680f631849_=_ Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
A bit about Apple Silicon M1(2,3,4) architectu= re, SoC and motherboard. (AFAIK)

There are no EFI assumptions nor contracts, and no EFI firmware.=
Between those 4 generations of silicon, there ar= e about 80 different roles "SoC cores/components" can play, each with its o= wn signed Apple Firmware.
Most of those SoC cores= /functions have nothing to do with the traditional ARM compute cores.
At least one of those SoC cores is actually an x86 pro= cessor core (on models which support HDMI), running x86 firmware.
=
Many of the other non-compute cores (Networking, USC (A-C)= , Thunderbolt ... yada yada) are various size Arm cores running an Apple RT= OS Variant of L4 microkernel.
Each of those, agai= n, has its own Apple Signed firmware which is paired with a particular Darw= in kernel release.
One point of friction is that = there is no stable ABI spec for each of the firmware modules.   Apple = reserves the right to completely change the firmware's
interface with the paired Darwin kernel.
<= br>
It is perhaps best to think of the SoC and relate= d motherboard hardware as a "compute cluster" rather than a single von-neum= an machine.

I could be= wrong about a lot of the above, and invite corrections with citations.
=

For this, do you know if 4K pages are supported (in addition to 16K= )? It
would be a lot easier to keep running Xen using 4K page= s and run guests
on top of Xen which use 16K pages. In the pa= st, we had Linux using 64K
pages running on top of Xen using = 4K pages for example.
Gi= ven the state of all of the _other_ SoC cores running L4 RTOS, I have reser= vations about running with anything other than 16k native pages.  Will= have to
investigate what options, if any, are av= ailable for keeping 16k pages for existing firmware, while presenting 4k pa= ges to guest OS.

Howev= er, both Rosetta and Docker appear to run 4k guests just fine, so not sure= how many pushups they are doing in the process.
=
TBD

device= trees;

You might be able to use the d= evice tree which is used to boot Linux on
Apple silicon
Yes, the Asahi team has done = some wizard level heavy lifting in that area.  If I recall correctly, = their model is let apple boot loader load the apple signed firmware, pass o= ff to the Asahi boot kernel,  then present an EFI compatible DT and dr= iver surface on top of that for boot-essential drivers.  They also hav= e a fairly nifty lightweight hypervisor that assists with debug and ultimat= ely does boot via u-boot -> grub -> linux in the current incarnation<= br>

=

--_=_swift_1721933818_e06b5c8fb8646690b380d5680f631849_=_--