From 3c65e1a6107ebbf064a198f8bd82a5a81ad42503 Mon Sep 17 00:00:00 2001 From: Yureka Date: Fri, 10 Nov 2023 03:38:00 +0100 Subject: rust 1.73.0 patch --- .../packages/linux-asahi/default.nix | 4 + .../packages/linux-asahi/rustc-1.73.0-fix.patch | 232 +++++++++++++++++++++ 2 files changed, 236 insertions(+) create mode 100644 apple-silicon-support/packages/linux-asahi/rustc-1.73.0-fix.patch diff --git a/apple-silicon-support/packages/linux-asahi/default.nix b/apple-silicon-support/packages/linux-asahi/default.nix index 4696a6f1af69..90dcd563ee49 100644 --- a/apple-silicon-support/packages/linux-asahi/default.nix +++ b/apple-silicon-support/packages/linux-asahi/default.nix @@ -104,6 +104,10 @@ let { name = "rust-bindgen-version"; patch = ./rust-bindgen-version.patch; } + ] ++ lib.optionals (rustAtLeast "1.73.0") [ + { name = "rustc-1.73.0"; + patch = ./rustc-1.73.0-fix.patch; + } ] ++ lib.optionals _4KBuild [ # thanks to Sven Peter # https://lore.kernel.org/linux-iommu/20211019163737.46269-1-sven@svenpeter.dev/ diff --git a/apple-silicon-support/packages/linux-asahi/rustc-1.73.0-fix.patch b/apple-silicon-support/packages/linux-asahi/rustc-1.73.0-fix.patch new file mode 100644 index 000000000000..3db8b5860ea3 --- /dev/null +++ b/apple-silicon-support/packages/linux-asahi/rustc-1.73.0-fix.patch @@ -0,0 +1,232 @@ +diff --git a/rust/alloc/lib.rs b/rust/alloc/lib.rs +index 49d643c3af6a..9107881810e4 100644 +--- a/rust/alloc/lib.rs ++++ b/rust/alloc/lib.rs +@@ -138,7 +138,6 @@ + #![feature(nonnull_slice_from_raw_parts)] + #![feature(pattern)] + #![feature(pointer_byte_offsets)] +-#![feature(provide_any)] + #![feature(ptr_internals)] + #![feature(ptr_metadata)] + #![feature(ptr_sub_ptr)] +diff --git a/rust/kernel/driver.rs b/rust/kernel/driver.rs +index e59f163d8ff3..35f27ba8894e 100644 +--- a/rust/kernel/driver.rs ++++ b/rust/kernel/driver.rs +@@ -108,68 +108,35 @@ fn drop(&mut self) { + } + } + +-/// Conversion from a device id to a raw device id. +-/// +-/// This is meant to be implemented by buses/subsystems so that they can use [`IdTable`] to +-/// guarantee (at compile-time) zero-termination of device id tables provided by drivers. +-/// +-/// # Safety +-/// +-/// Implementers must ensure that: +-/// - [`RawDeviceId::ZERO`] is actually a zeroed-out version of the raw device id. +-/// - [`RawDeviceId::to_rawid`] stores `offset` in the context/data field of the raw device id so +-/// that buses can recover the pointer to the data. +-#[const_trait] +-pub unsafe trait RawDeviceId { +- /// The raw type that holds the device id. +- /// +- /// Id tables created from [`Self`] are going to hold this type in its zero-terminated array. +- type RawType: Copy; +- +- /// A zeroed-out representation of the raw device id. +- /// +- /// Id tables created from [`Self`] use [`Self::ZERO`] as the sentinel to indicate the end of +- /// the table. +- const ZERO: Self::RawType; +- +- /// Converts an id into a raw id. +- /// +- /// `offset` is the offset from the memory location where the raw device id is stored to the +- /// location where its associated context information is stored. Implementations must store +- /// this in the appropriate context/data field of the raw type. +- fn to_rawid(&self, offset: isize) -> Self::RawType; +-} + + /// A zero-terminated device id array. + #[derive(Copy, Clone)] + #[repr(C)] +-pub struct IdArrayIds { +- ids: [T::RawType; N], +- sentinel: T::RawType, ++pub struct IdArrayIds { ++ ids: [bindings::of_device_id; N], ++ sentinel: bindings::of_device_id, + } + +-unsafe impl Sync for IdArrayIds {} ++unsafe impl Sync for IdArrayIds {} + + /// A zero-terminated device id array, followed by context data. + #[repr(C)] +-pub struct IdArray { +- ids: IdArrayIds, ++pub struct IdArray { ++ ids: IdArrayIds, + id_infos: [Option; N], + } + +-impl IdArray { ++impl IdArray { + /// Creates a new instance of the array. + /// + /// The contents are derived from the given identifiers and context information. +- pub const fn new(ids: [T; N], infos: [Option; N]) -> Self ++ pub const fn new(ids: [crate::of::DeviceId; N], infos: [Option; N]) -> Self + where +- T: ~const RawDeviceId + Copy, +- T::RawType: Copy + Clone, + { + let mut array = Self { + ids: IdArrayIds { +- ids: [T::ZERO; N], +- sentinel: T::ZERO, ++ ids: [crate::of::DEVICEID_ZERO; N], ++ sentinel: crate::of::DEVICEID_ZERO, + }, + id_infos: infos, + }; +@@ -191,7 +158,7 @@ impl IdArray { + /// Returns an `IdTable` backed by `self`. + /// + /// This is used to essentially erase the array size. +- pub const fn as_table(&self) -> IdTable<'_, T, U> { ++ pub const fn as_table(&self) -> IdTable<'_, U> { + IdTable { + first: &self.ids.ids[0], + _p: PhantomData, +@@ -204,10 +171,7 @@ pub const fn count(&self) -> usize { + } + + /// Returns the inner IdArrayIds array, without the context data. +- pub const fn as_ids(&self) -> IdArrayIds +- where +- T: ~const RawDeviceId + Copy, +- { ++ pub const fn as_ids(&self) -> IdArrayIds { + self.ids + } + } +@@ -216,13 +180,13 @@ pub const fn as_ids(&self) -> IdArrayIds + /// + /// The table is guaranteed to be zero-terminated and to be followed by an array of context data of + /// type `Option`. +-pub struct IdTable<'a, T: RawDeviceId, U> { +- first: &'a T::RawType, ++pub struct IdTable<'a, U> { ++ first: &'a bindings::of_device_id, + _p: PhantomData<&'a U>, + } + +-impl AsRef for IdTable<'_, T, U> { +- fn as_ref(&self) -> &T::RawType { ++impl AsRef for IdTable<'_, U> { ++ fn as_ref(&self) -> &bindings::of_device_id { + self.first + } + } +@@ -364,11 +328,11 @@ macro_rules! second_item { + /// ``` + #[macro_export] + macro_rules! define_id_array { +- ($table_name:ident, $id_type:ty, $data_type:ty, [ $($t:tt)* ]) => { ++ ($table_name:ident, $data_type:ty, [ $($t:tt)* ]) => { + const $table_name: +- $crate::driver::IdArray<$id_type, $data_type, { $crate::count_paren_items!($($t)*) }> = ++ $crate::driver::IdArray<$data_type, { $crate::count_paren_items!($($t)*) }> = + $crate::driver::IdArray::new( +- $crate::first_item!($id_type, $($t)*), $crate::second_item!($($t)*)); ++ $crate::first_item!(crate::of::DeviceId, $($t)*), $crate::second_item!($($t)*)); + }; + } + +@@ -388,8 +352,8 @@ macro_rules! define_id_array { + /// ``` + #[macro_export] + macro_rules! driver_id_table { +- ($table_name:ident, $id_type:ty, $data_type:ty, $target:expr) => { +- const $table_name: Option<$crate::driver::IdTable<'static, $id_type, $data_type>> = ++ ($table_name:ident, $data_type:ty, $target:expr) => { ++ const $table_name: Option<$crate::driver::IdTable<'static, $data_type>> = + Some($target.as_table()); + }; + } +@@ -412,7 +376,7 @@ macro_rules! driver_id_table { + macro_rules! module_id_table { + ($item_name:ident, $table_type:literal, $id_type:ty, $table_name:ident) => { + #[export_name = concat!("__mod_", $table_type, "__", stringify!($table_name), "_device_table")] +- static $item_name: $crate::driver::IdArrayIds<$id_type, { $table_name.count() }> = ++ static $item_name: $crate::driver::IdArrayIds<{ $table_name.count() }> = + $table_name.as_ids(); + }; + } +diff --git a/rust/kernel/of.rs b/rust/kernel/of.rs +index a27621b57fbb..0e2a52ee49da 100644 +--- a/rust/kernel/of.rs ++++ b/rust/kernel/of.rs +@@ -46,7 +46,7 @@ pub enum DeviceId { + #[macro_export] + macro_rules! define_of_id_table { + ($name:ident, $data_type:ty, $($t:tt)*) => { +- $crate::define_id_array!($name, $crate::of::DeviceId, $data_type, $($t)*); ++ $crate::define_id_array!($name, $data_type, $($t)*); + }; + } + +@@ -56,7 +56,6 @@ macro_rules! driver_of_id_table { + ($name:expr) => { + $crate::driver_id_table!( + OF_DEVICE_ID_TABLE, +- $crate::of::DeviceId, + Self::IdInfo, + $name + ); +@@ -72,19 +71,18 @@ macro_rules! module_of_id_table { + }; + } + ++pub const DEVICEID_ZERO: bindings::of_device_id = bindings::of_device_id { ++ name: [0; 32], ++ type_: [0; 32], ++ compatible: [0; 128], ++ data: core::ptr::null(), ++}; + // SAFETY: `ZERO` is all zeroed-out and `to_rawid` stores `offset` in `of_device_id::data`. +-unsafe impl const driver::RawDeviceId for DeviceId { +- type RawType = bindings::of_device_id; +- const ZERO: Self::RawType = bindings::of_device_id { +- name: [0; 32], +- type_: [0; 32], +- compatible: [0; 128], +- data: core::ptr::null(), +- }; ++impl DeviceId { + +- fn to_rawid(&self, offset: isize) -> Self::RawType { ++ pub const fn to_rawid(&self, offset: isize) -> bindings::of_device_id { + let DeviceId::Compatible(compatible) = self; +- let mut id = Self::ZERO; ++ let mut id = DEVICEID_ZERO; + let mut i = 0; + while i < compatible.len() { + // If `compatible` does not fit in `id.compatible`, an "index out of bounds" build time +diff --git a/rust/kernel/platform.rs b/rust/kernel/platform.rs +index d42ae1cbaf9e..7281351a2b8a 100644 +--- a/rust/kernel/platform.rs ++++ b/rust/kernel/platform.rs +@@ -140,7 +140,7 @@ pub trait Driver { + type IdInfo: 'static = (); + + /// The table of device ids supported by the driver. +- const OF_DEVICE_ID_TABLE: Option> = None; ++ const OF_DEVICE_ID_TABLE: Option> = None; + + /// Platform driver probe. + /// -- cgit 1.4.1 From e775cc1ce47a0527861661c56e91de88563557fa Mon Sep 17 00:00:00 2001 From: Isabella Skořepová Date: Sun, 22 Oct 2023 18:02:52 +0000 Subject: docs: hide the 4K page size config --- docs/uefi-standalone.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/uefi-standalone.md b/docs/uefi-standalone.md index 58e9fcc53d95..d54679959abc 100644 --- a/docs/uefi-standalone.md +++ b/docs/uefi-standalone.md @@ -246,12 +246,17 @@ Currently, the only supported way to update the peripheral firmware files is to # hardware.asahi.extractPeripheralFirmware = false; ``` +
+ If you have apps incompatible with 16K page sizes and you need 4K page size instead... + +**Note:** The 4K patches are currently not updated to latest kernel version. See [this issue](https://github.com/tpwrules/nixos-apple-silicon/issues/43). You can choose to build the Asahi kernel with a 4K page size by enabling the appropriate option. This results in a reduction in raw compilation speed of 10-25%, but improves software compatibility in some cases (such as with Chromium/Electron and x86 emulation). ``` # Build the kernel with 4K pages to improve software compatibility at # the cost of performance in some cases. hardware.asahi.use4KPages = true; ``` +
If you want to install a desktop environment, you will have to uncomment the option to enable X11 and NetworkManager, then add an option to include your favorite desktop environment. You may also wish to include graphical packages such as `firefox` in `environment.systemPackages`. For example, to install Xfce: ``` -- cgit 1.4.1 From 03c9751db71d143cc0d03c0714e3a5925f654fb1 Mon Sep 17 00:00:00 2001 From: Isabella Skořepová Date: Sun, 22 Oct 2023 18:08:32 +0000 Subject: docs: note about enabling iwd --- docs/uefi-standalone.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/uefi-standalone.md b/docs/uefi-standalone.md index d54679959abc..6805fd225144 100644 --- a/docs/uefi-standalone.md +++ b/docs/uefi-standalone.md @@ -273,6 +273,14 @@ Some keyboard layouts are not detected correctly. On some devices, the \` key is ''; ``` +`iwd` is recommended for WiFi on most systems: +``` +networking.wireless.iwd = { + enable = true; + settings.General.EnableNetworkConfiguration = true; +}; +``` + #### NixOS Installation Once you are happy with your initial configuration, you may install the system. This will have to download a large amount of data. -- cgit 1.4.1 From 5fbb916ba48dc638b783e83eadee1a1aaff42c2f Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Sun, 19 Nov 2023 16:52:24 -0600 Subject: update nixpkgs --- flake.lock | 8 ++++---- flake.nix | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/flake.lock b/flake.lock index ff024e7b3179..1670b54e21dd 100644 --- a/flake.lock +++ b/flake.lock @@ -17,17 +17,17 @@ }, "nixpkgs": { "locked": { - "lastModified": 1697723726, - "narHash": "sha256-SaTWPkI8a5xSHX/rrKzUe+/uVNy6zCGMXgoeMb7T9rg=", + "lastModified": 1700419998, + "narHash": "sha256-aXh4adx9x9RlRMSykzR+bY8AOVjcwMEJO1ZeQROwbcE=", "owner": "nixos", "repo": "nixpkgs", - "rev": "7c9cc5a6e5d38010801741ac830a3f8fd667a7a0", + "rev": "12a0ade5e458984675b9789a4b260ebabdd2d1ab", "type": "github" }, "original": { "owner": "nixos", "repo": "nixpkgs", - "rev": "7c9cc5a6e5d38010801741ac830a3f8fd667a7a0", + "rev": "12a0ade5e458984675b9789a4b260ebabdd2d1ab", "type": "github" } }, diff --git a/flake.nix b/flake.nix index 9dd07b7fdc64..93d0752435c9 100644 --- a/flake.nix +++ b/flake.nix @@ -5,7 +5,7 @@ nixpkgs = { # https://hydra.nixos.org/jobset/mobile-nixos/unstable/evals # these evals have a cross-compiled stdenv available - url = "github:nixos/nixpkgs/7c9cc5a6e5d38010801741ac830a3f8fd667a7a0"; + url = "github:nixos/nixpkgs/12a0ade5e458984675b9789a4b260ebabdd2d1ab"; }; rust-overlay = { -- cgit 1.4.1 From 14b327ca47703c376ebb82ba16dc42ca2baa57d8 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Sun, 19 Nov 2023 17:33:35 -0600 Subject: release 2023-11-19 --- docs/release-notes.md | 12 ++++++++++++ docs/uefi-standalone.md | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/docs/release-notes.md b/docs/release-notes.md index 64de3137ba33..4bf65b9e3c52 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -2,6 +2,18 @@ This file contains important information for each release. +## 2023-11-19 + +This release updates nixpkgs. + +In particular, nixpkgs is updated to fix issues with compilation of wolfssl, +and some regressions in systemd-boot. + +This release also adds patches to the kernel to support compilation with Rust +1.73.0. Thanks again to yu-re-ka for this contribution. + +Speaker support will be added in an upcoming release. + ## 2023-10-21 This release updates nixpkgs, m1n1, U-Boot, and the kernel. diff --git a/docs/uefi-standalone.md b/docs/uefi-standalone.md index 6805fd225144..06e9c6228f3d 100644 --- a/docs/uefi-standalone.md +++ b/docs/uefi-standalone.md @@ -1,11 +1,11 @@ -# UEFI Boot Standalone NixOS (2023-10-21) +# UEFI Boot Standalone NixOS (2023-11-19) This guide will build and was tested with the following software: * Asahi Linux kernel version 6.5.0-asahi15 * Asahi Linux's Mesa version 23.3.0_asahi-20230904-1 * m1n1 version v1.4.2 * Asahi Linux's U-Boot version 2023.07.02.asahi3-1 -* Nixpkgs, as of 2023-10-19 +* Nixpkgs, as of 2023-11-19 * macOS stub 12.3 NOTE: The latest version of this guide will always be [at its home](https://github.com/tpwrules/nixos-apple-silicon/blob/main/docs/uefi-standalone.md). For more general information about Linux on Apple Silicon Macs, refer to the [Asahi Linux project](https://asahilinux.org/) and [alpha installer release](https://asahilinux.org/2022/03/asahi-linux-alpha-release/). -- cgit 1.4.1 From 47d9e901ba949a597960113b4a650c90a5dc34b9 Mon Sep 17 00:00:00 2001 From: Scott Dier Date: Sun, 17 Dec 2023 18:50:26 +0100 Subject: Use 115200n8 for serial console to match what early boot (m1n1, u-boot, etc.) is using and what the Central Scrutinizer expects. --- apple-silicon-support/modules/kernel/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apple-silicon-support/modules/kernel/default.nix b/apple-silicon-support/modules/kernel/default.nix index 26d920facc5c..8e615479c20b 100644 --- a/apple-silicon-support/modules/kernel/default.nix +++ b/apple-silicon-support/modules/kernel/default.nix @@ -57,7 +57,7 @@ boot.kernelParams = [ "earlycon" - "console=ttySAC0,1500000" + "console=ttySAC0,115200n8" "console=tty0" "boot.shell_on_fail" # Apple's SSDs are slow (~dozens of ms) at processing flush requests which -- cgit 1.4.1 From f7b8dd238e345cf5d985bc5a4dbb14ad019c0b1a Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Sat, 16 Dec 2023 11:59:01 -0600 Subject: upgrade nixpkgs --- flake.lock | 8 ++++---- flake.nix | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/flake.lock b/flake.lock index 1670b54e21dd..14e9ea6b16b7 100644 --- a/flake.lock +++ b/flake.lock @@ -17,17 +17,17 @@ }, "nixpkgs": { "locked": { - "lastModified": 1700419998, - "narHash": "sha256-aXh4adx9x9RlRMSykzR+bY8AOVjcwMEJO1ZeQROwbcE=", + "lastModified": 1702830618, + "narHash": "sha256-lvhwIvRwhOLgzbRuYkqHy4M5cQHYs4ktL6/hyuBS6II=", "owner": "nixos", "repo": "nixpkgs", - "rev": "12a0ade5e458984675b9789a4b260ebabdd2d1ab", + "rev": "91a00709aebb3602f172a0bf47ba1ef013e34835", "type": "github" }, "original": { "owner": "nixos", "repo": "nixpkgs", - "rev": "12a0ade5e458984675b9789a4b260ebabdd2d1ab", + "rev": "91a00709aebb3602f172a0bf47ba1ef013e34835", "type": "github" } }, diff --git a/flake.nix b/flake.nix index 93d0752435c9..cb6e1724ae38 100644 --- a/flake.nix +++ b/flake.nix @@ -5,7 +5,7 @@ nixpkgs = { # https://hydra.nixos.org/jobset/mobile-nixos/unstable/evals # these evals have a cross-compiled stdenv available - url = "github:nixos/nixpkgs/12a0ade5e458984675b9789a4b260ebabdd2d1ab"; + url = "github:nixos/nixpkgs/91a00709aebb3602f172a0bf47ba1ef013e34835"; }; rust-overlay = { -- cgit 1.4.1 From 9907e87a3bcccaa1c93a96e39a5f5ef7f6ba96c9 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Sat, 16 Dec 2023 19:42:46 -0600 Subject: linux-asahi: asahi-6.5-15 -> asahi-6.6-14 --- .../packages/linux-asahi/default.nix | 17 +- .../linux-asahi/rust-bindgen-version.patch | 14 -- .../packages/linux-asahi/rustc-1.73.0-fix.patch | 232 --------------------- 3 files changed, 5 insertions(+), 258 deletions(-) delete mode 100644 apple-silicon-support/packages/linux-asahi/rust-bindgen-version.patch delete mode 100644 apple-silicon-support/packages/linux-asahi/rustc-1.73.0-fix.patch diff --git a/apple-silicon-support/packages/linux-asahi/default.nix b/apple-silicon-support/packages/linux-asahi/default.nix index 90dcd563ee49..a582aac81b8f 100644 --- a/apple-silicon-support/packages/linux-asahi/default.nix +++ b/apple-silicon-support/packages/linux-asahi/default.nix @@ -88,26 +88,19 @@ let (linuxKernel.manualConfig rec { inherit stdenv lib; - version = "6.5.0-asahi"; + version = "6.6.0-asahi"; modDirVersion = version; - extraMeta.branch = "6.5"; + extraMeta.branch = "6.6"; src = fetchFromGitHub { - # tracking: https://github.com/AsahiLinux/PKGBUILDs/blob/main/linux-asahi/PKGBUILD + # tracking: https://github.com/AsahiLinux/linux/tree/asahi-wip (w/ fedora verification) owner = "AsahiLinux"; repo = "linux"; - rev = "asahi-6.5-15"; - hash = "sha256-Rruk/Nrw425XerZjgDJ4PJ3c63CCycch1qz7vFxHPCE="; + rev = "asahi-6.6-14"; + hash = "sha256-+ydX2XXIbcVfq27WC68EPP8n3bf+WD5fDG7FBq3QJi4="; }; kernelPatches = [ - { name = "rust-bindgen-version"; - patch = ./rust-bindgen-version.patch; - } - ] ++ lib.optionals (rustAtLeast "1.73.0") [ - { name = "rustc-1.73.0"; - patch = ./rustc-1.73.0-fix.patch; - } ] ++ lib.optionals _4KBuild [ # thanks to Sven Peter # https://lore.kernel.org/linux-iommu/20211019163737.46269-1-sven@svenpeter.dev/ diff --git a/apple-silicon-support/packages/linux-asahi/rust-bindgen-version.patch b/apple-silicon-support/packages/linux-asahi/rust-bindgen-version.patch deleted file mode 100644 index 695cb2ceaeff..000000000000 --- a/apple-silicon-support/packages/linux-asahi/rust-bindgen-version.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/scripts/rust_is_available.sh b/scripts/rust_is_available.sh -index aebbf1913..b7b0a4abc 100755 ---- a/scripts/rust_is_available.sh -+++ b/scripts/rust_is_available.sh -@@ -102,8 +102,7 @@ fi - # Check that the `libclang` used by the Rust bindings generator is suitable. - bindgen_libclang_version=$( \ - LC_ALL=C "$BINDGEN" $(dirname $0)/rust_is_available_bindgen_libclang.h 2>&1 >/dev/null \ -- | grep -F 'clang version ' \ -- | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' \ -+ | grep -oP 'clang version \K[0-9]+\.[0-9]+\.[0-9]+' \ - | head -n 1 \ - ) - bindgen_libclang_min_version=$($min_tool_version llvm) diff --git a/apple-silicon-support/packages/linux-asahi/rustc-1.73.0-fix.patch b/apple-silicon-support/packages/linux-asahi/rustc-1.73.0-fix.patch deleted file mode 100644 index 3db8b5860ea3..000000000000 --- a/apple-silicon-support/packages/linux-asahi/rustc-1.73.0-fix.patch +++ /dev/null @@ -1,232 +0,0 @@ -diff --git a/rust/alloc/lib.rs b/rust/alloc/lib.rs -index 49d643c3af6a..9107881810e4 100644 ---- a/rust/alloc/lib.rs -+++ b/rust/alloc/lib.rs -@@ -138,7 +138,6 @@ - #![feature(nonnull_slice_from_raw_parts)] - #![feature(pattern)] - #![feature(pointer_byte_offsets)] --#![feature(provide_any)] - #![feature(ptr_internals)] - #![feature(ptr_metadata)] - #![feature(ptr_sub_ptr)] -diff --git a/rust/kernel/driver.rs b/rust/kernel/driver.rs -index e59f163d8ff3..35f27ba8894e 100644 ---- a/rust/kernel/driver.rs -+++ b/rust/kernel/driver.rs -@@ -108,68 +108,35 @@ fn drop(&mut self) { - } - } - --/// Conversion from a device id to a raw device id. --/// --/// This is meant to be implemented by buses/subsystems so that they can use [`IdTable`] to --/// guarantee (at compile-time) zero-termination of device id tables provided by drivers. --/// --/// # Safety --/// --/// Implementers must ensure that: --/// - [`RawDeviceId::ZERO`] is actually a zeroed-out version of the raw device id. --/// - [`RawDeviceId::to_rawid`] stores `offset` in the context/data field of the raw device id so --/// that buses can recover the pointer to the data. --#[const_trait] --pub unsafe trait RawDeviceId { -- /// The raw type that holds the device id. -- /// -- /// Id tables created from [`Self`] are going to hold this type in its zero-terminated array. -- type RawType: Copy; -- -- /// A zeroed-out representation of the raw device id. -- /// -- /// Id tables created from [`Self`] use [`Self::ZERO`] as the sentinel to indicate the end of -- /// the table. -- const ZERO: Self::RawType; -- -- /// Converts an id into a raw id. -- /// -- /// `offset` is the offset from the memory location where the raw device id is stored to the -- /// location where its associated context information is stored. Implementations must store -- /// this in the appropriate context/data field of the raw type. -- fn to_rawid(&self, offset: isize) -> Self::RawType; --} - - /// A zero-terminated device id array. - #[derive(Copy, Clone)] - #[repr(C)] --pub struct IdArrayIds { -- ids: [T::RawType; N], -- sentinel: T::RawType, -+pub struct IdArrayIds { -+ ids: [bindings::of_device_id; N], -+ sentinel: bindings::of_device_id, - } - --unsafe impl Sync for IdArrayIds {} -+unsafe impl Sync for IdArrayIds {} - - /// A zero-terminated device id array, followed by context data. - #[repr(C)] --pub struct IdArray { -- ids: IdArrayIds, -+pub struct IdArray { -+ ids: IdArrayIds, - id_infos: [Option; N], - } - --impl IdArray { -+impl IdArray { - /// Creates a new instance of the array. - /// - /// The contents are derived from the given identifiers and context information. -- pub const fn new(ids: [T; N], infos: [Option; N]) -> Self -+ pub const fn new(ids: [crate::of::DeviceId; N], infos: [Option; N]) -> Self - where -- T: ~const RawDeviceId + Copy, -- T::RawType: Copy + Clone, - { - let mut array = Self { - ids: IdArrayIds { -- ids: [T::ZERO; N], -- sentinel: T::ZERO, -+ ids: [crate::of::DEVICEID_ZERO; N], -+ sentinel: crate::of::DEVICEID_ZERO, - }, - id_infos: infos, - }; -@@ -191,7 +158,7 @@ impl IdArray { - /// Returns an `IdTable` backed by `self`. - /// - /// This is used to essentially erase the array size. -- pub const fn as_table(&self) -> IdTable<'_, T, U> { -+ pub const fn as_table(&self) -> IdTable<'_, U> { - IdTable { - first: &self.ids.ids[0], - _p: PhantomData, -@@ -204,10 +171,7 @@ pub const fn count(&self) -> usize { - } - - /// Returns the inner IdArrayIds array, without the context data. -- pub const fn as_ids(&self) -> IdArrayIds -- where -- T: ~const RawDeviceId + Copy, -- { -+ pub const fn as_ids(&self) -> IdArrayIds { - self.ids - } - } -@@ -216,13 +180,13 @@ pub const fn as_ids(&self) -> IdArrayIds - /// - /// The table is guaranteed to be zero-terminated and to be followed by an array of context data of - /// type `Option`. --pub struct IdTable<'a, T: RawDeviceId, U> { -- first: &'a T::RawType, -+pub struct IdTable<'a, U> { -+ first: &'a bindings::of_device_id, - _p: PhantomData<&'a U>, - } - --impl AsRef for IdTable<'_, T, U> { -- fn as_ref(&self) -> &T::RawType { -+impl AsRef for IdTable<'_, U> { -+ fn as_ref(&self) -> &bindings::of_device_id { - self.first - } - } -@@ -364,11 +328,11 @@ macro_rules! second_item { - /// ``` - #[macro_export] - macro_rules! define_id_array { -- ($table_name:ident, $id_type:ty, $data_type:ty, [ $($t:tt)* ]) => { -+ ($table_name:ident, $data_type:ty, [ $($t:tt)* ]) => { - const $table_name: -- $crate::driver::IdArray<$id_type, $data_type, { $crate::count_paren_items!($($t)*) }> = -+ $crate::driver::IdArray<$data_type, { $crate::count_paren_items!($($t)*) }> = - $crate::driver::IdArray::new( -- $crate::first_item!($id_type, $($t)*), $crate::second_item!($($t)*)); -+ $crate::first_item!(crate::of::DeviceId, $($t)*), $crate::second_item!($($t)*)); - }; - } - -@@ -388,8 +352,8 @@ macro_rules! define_id_array { - /// ``` - #[macro_export] - macro_rules! driver_id_table { -- ($table_name:ident, $id_type:ty, $data_type:ty, $target:expr) => { -- const $table_name: Option<$crate::driver::IdTable<'static, $id_type, $data_type>> = -+ ($table_name:ident, $data_type:ty, $target:expr) => { -+ const $table_name: Option<$crate::driver::IdTable<'static, $data_type>> = - Some($target.as_table()); - }; - } -@@ -412,7 +376,7 @@ macro_rules! driver_id_table { - macro_rules! module_id_table { - ($item_name:ident, $table_type:literal, $id_type:ty, $table_name:ident) => { - #[export_name = concat!("__mod_", $table_type, "__", stringify!($table_name), "_device_table")] -- static $item_name: $crate::driver::IdArrayIds<$id_type, { $table_name.count() }> = -+ static $item_name: $crate::driver::IdArrayIds<{ $table_name.count() }> = - $table_name.as_ids(); - }; - } -diff --git a/rust/kernel/of.rs b/rust/kernel/of.rs -index a27621b57fbb..0e2a52ee49da 100644 ---- a/rust/kernel/of.rs -+++ b/rust/kernel/of.rs -@@ -46,7 +46,7 @@ pub enum DeviceId { - #[macro_export] - macro_rules! define_of_id_table { - ($name:ident, $data_type:ty, $($t:tt)*) => { -- $crate::define_id_array!($name, $crate::of::DeviceId, $data_type, $($t)*); -+ $crate::define_id_array!($name, $data_type, $($t)*); - }; - } - -@@ -56,7 +56,6 @@ macro_rules! driver_of_id_table { - ($name:expr) => { - $crate::driver_id_table!( - OF_DEVICE_ID_TABLE, -- $crate::of::DeviceId, - Self::IdInfo, - $name - ); -@@ -72,19 +71,18 @@ macro_rules! module_of_id_table { - }; - } - -+pub const DEVICEID_ZERO: bindings::of_device_id = bindings::of_device_id { -+ name: [0; 32], -+ type_: [0; 32], -+ compatible: [0; 128], -+ data: core::ptr::null(), -+}; - // SAFETY: `ZERO` is all zeroed-out and `to_rawid` stores `offset` in `of_device_id::data`. --unsafe impl const driver::RawDeviceId for DeviceId { -- type RawType = bindings::of_device_id; -- const ZERO: Self::RawType = bindings::of_device_id { -- name: [0; 32], -- type_: [0; 32], -- compatible: [0; 128], -- data: core::ptr::null(), -- }; -+impl DeviceId { - -- fn to_rawid(&self, offset: isize) -> Self::RawType { -+ pub const fn to_rawid(&self, offset: isize) -> bindings::of_device_id { - let DeviceId::Compatible(compatible) = self; -- let mut id = Self::ZERO; -+ let mut id = DEVICEID_ZERO; - let mut i = 0; - while i < compatible.len() { - // If `compatible` does not fit in `id.compatible`, an "index out of bounds" build time -diff --git a/rust/kernel/platform.rs b/rust/kernel/platform.rs -index d42ae1cbaf9e..7281351a2b8a 100644 ---- a/rust/kernel/platform.rs -+++ b/rust/kernel/platform.rs -@@ -140,7 +140,7 @@ pub trait Driver { - type IdInfo: 'static = (); - - /// The table of device ids supported by the driver. -- const OF_DEVICE_ID_TABLE: Option> = None; -+ const OF_DEVICE_ID_TABLE: Option> = None; - - /// Platform driver probe. - /// -- cgit 1.4.1 From 0c4a676de02c27fc1db0d6760b8730fbf1857be2 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Sat, 16 Dec 2023 19:47:13 -0600 Subject: m1n1: 1.4.2 -> 1.4.11 --- apple-silicon-support/packages/m1n1/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apple-silicon-support/packages/m1n1/default.nix b/apple-silicon-support/packages/m1n1/default.nix index 7955f47ab435..86a8bcdf8bc8 100644 --- a/apple-silicon-support/packages/m1n1/default.nix +++ b/apple-silicon-support/packages/m1n1/default.nix @@ -25,14 +25,14 @@ let }); in stdenv.mkDerivation rec { pname = "m1n1"; - version = "1.4.2"; + version = "1.4.11"; src = fetchFromGitHub { - # tracking: https://github.com/AsahiLinux/PKGBUILDs/blob/main/m1n1/PKGBUILD + # tracking: https://src.fedoraproject.org/rpms/m1n1 owner = "AsahiLinux"; repo = "m1n1"; rev = "v${version}"; - hash = "sha256-zPHLlhXUIX6MV2pnDkuSg4Pz8gB4YOZiaa8MuLasgPY="; + hash = "sha256-1lWI9tcOxgrcfaPfdSF+xRE9qofhNR3SQiA4h86VVeE="; fetchSubmodules = true; }; -- cgit 1.4.1 From cb264882e6e4df5f8870a7873d66869ac0293a10 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Sat, 16 Dec 2023 19:56:48 -0600 Subject: uboot-asahi: 2023.07.02.asahi3-1 -> 2023.07.02.asahi4-1 --- apple-silicon-support/packages/uboot-asahi/default.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apple-silicon-support/packages/uboot-asahi/default.nix b/apple-silicon-support/packages/uboot-asahi/default.nix index 908aff32b1ae..c3bf0847973f 100644 --- a/apple-silicon-support/packages/uboot-asahi/default.nix +++ b/apple-silicon-support/packages/uboot-asahi/default.nix @@ -6,13 +6,13 @@ (buildUBoot rec { src = fetchFromGitHub { - # tracking: https://github.com/AsahiLinux/PKGBUILDs/blob/main/uboot-asahi/PKGBUILD + # tracking: https://pagure.io/fedora-asahi/uboot-tools/commits/main owner = "AsahiLinux"; repo = "u-boot"; - rev = "asahi-v2023.07.02-3"; - hash = "sha256-a7iNawyq7K6jhiVzu5x8mllF3olTP+jQRXGGSsoKINI="; + rev = "asahi-v2023.07.02-4"; + hash = "sha256-M4qkEyNgwV2AKSr5VzPGfhHo1kGy8Tw8TfyP36cgYjc="; }; - version = "2023.07.02.asahi3-1"; + version = "2023.07.02.asahi4-1"; defconfig = "apple_m1_defconfig"; extraMeta.platforms = [ "aarch64-linux" ]; -- cgit 1.4.1 From 777e10ec2094a0ac92e61cbfe338063d1e64646e Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Sat, 16 Dec 2023 21:11:37 -0600 Subject: mesa-asahi-edge: 23.3.0_asahi-20230904 -> 24.0.0_asahi-20231213 --- .../packages/mesa-asahi-edge/default.nix | 20 ++++-- .../packages/mesa-asahi-edge/opencl.patch | 84 ++++++++++++++++++++++ 2 files changed, 97 insertions(+), 7 deletions(-) create mode 100644 apple-silicon-support/packages/mesa-asahi-edge/opencl.patch diff --git a/apple-silicon-support/packages/mesa-asahi-edge/default.nix b/apple-silicon-support/packages/mesa-asahi-edge/default.nix index 0e1b60315cb2..b6b330ef8b4f 100644 --- a/apple-silicon-support/packages/mesa-asahi-edge/default.nix +++ b/apple-silicon-support/packages/mesa-asahi-edge/default.nix @@ -1,22 +1,26 @@ { lib , fetchFromGitLab -, mesa }: +, mesa +, llvmPackages +}: (mesa.override { galliumDrivers = [ "swrast" "asahi" ]; vulkanDrivers = [ "swrast" ]; enableGalliumNine = false; + # libclc and other OpenCL components are needed for geometry shader support on Apple Silicon + enableOpenCL = true; }).overrideAttrs (oldAttrs: { # version must be the same length (i.e. no unstable or date) # so that system.replaceRuntimeDependencies can work - version = "23.3.0"; + version = "24.0.0"; src = fetchFromGitLab { - # tracking: https://github.com/AsahiLinux/PKGBUILDs/blob/main/mesa-asahi-edge/PKGBUILD + # tracking: https://pagure.io/fedora-asahi/mesa/commits/asahi domain = "gitlab.freedesktop.org"; owner = "asahi"; repo = "mesa"; - rev = "asahi-20230904"; - hash = "sha256-hBfXzV8U9fm3cR4KMIl64ypioEeofH3BDl/jZQPLKQg="; + rev = "asahi-20231213"; + hash = "sha256-hl0JtwWEXaCkhCMQJ393mzfw/eEx6m9DYNS+spQ3Vhs="; }; mesonFlags = @@ -34,8 +38,10 @@ "-Dlmsensors=disabled" ]; - # replace disk cache path patch with one tweaked slightly to apply to this version + # replace patches with ones tweaked slightly to apply to this version patches = lib.forEach oldAttrs.patches (p: if lib.hasSuffix "disk_cache-include-dri-driver-path-in-cache-key.patch" p - then ./disk_cache-include-dri-driver-path-in-cache-key.patch else p); + then ./disk_cache-include-dri-driver-path-in-cache-key.patch else + (if lib.hasSuffix "opencl.patch" p + then ./opencl.patch else p)); }) diff --git a/apple-silicon-support/packages/mesa-asahi-edge/opencl.patch b/apple-silicon-support/packages/mesa-asahi-edge/opencl.patch new file mode 100644 index 000000000000..2957bb987854 --- /dev/null +++ b/apple-silicon-support/packages/mesa-asahi-edge/opencl.patch @@ -0,0 +1,84 @@ +From bbd0f154183e4d26a14bb005f6afc636629c201e Mon Sep 17 00:00:00 2001 +From: Thomas Watson +Date: Sat, 16 Dec 2023 20:46:51 -0600 +Subject: [PATCH] opencl.patch from nixpkgs + f416128e90ac75bec060e8b9435fe9c38423c036 + +--- + meson.build | 2 +- + meson_options.txt | 6 ++++++ + src/gallium/targets/opencl/meson.build | 6 +++--- + src/gallium/targets/rusticl/meson.build | 3 +-- + 4 files changed, 11 insertions(+), 6 deletions(-) + +diff --git a/meson.build b/meson.build +index 552ff196aa8..9e10156b875 100644 +--- a/meson.build ++++ b/meson.build +@@ -1829,7 +1829,7 @@ endif + + dep_clang = null_dep + if with_clc +- llvm_libdir = dep_llvm.get_variable(cmake : 'LLVM_LIBRARY_DIR', configtool: 'libdir') ++ llvm_libdir = get_option('clang-libdir') + + dep_clang = cpp.find_library('clang-cpp', dirs : llvm_libdir, required : false) + +diff --git a/meson_options.txt b/meson_options.txt +index c76fa6d3382..d2021f55634 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -1,6 +1,12 @@ + # Copyright © 2017-2019 Intel Corporation + # SPDX-License-Identifier: MIT + ++option( ++ 'clang-libdir', ++ type : 'string', ++ value : '', ++ description : 'Locations to search for clang libraries.' ++) + option( + 'platforms', + type : 'array', +diff --git a/src/gallium/targets/opencl/meson.build b/src/gallium/targets/opencl/meson.build +index 7c14135898e..cbcd67cc443 100644 +--- a/src/gallium/targets/opencl/meson.build ++++ b/src/gallium/targets/opencl/meson.build +@@ -39,7 +39,8 @@ if dep_llvm.version().version_compare('>=10.0.0') + polly_isl_dep = cpp.find_library('PollyISL', dirs : llvm_libdir, required : false) + endif + +-dep_clang = cpp.find_library('clang-cpp', dirs : llvm_libdir, required : false) ++clang_libdir = get_option('clang-libdir') ++dep_clang = cpp.find_library('clang-cpp', dirs : clang_libdir, required : false) + + # meson will return clang-cpp from system dirs if it's not found in llvm_libdir + linker_rpath_arg = '-Wl,--rpath=@0@'.format(llvm_libdir) +@@ -123,8 +124,7 @@ if with_opencl_icd + configuration : _config, + input : 'mesa.icd.in', + output : 'mesa.icd', +- install : true, +- install_tag : 'runtime', ++ install : false, + install_dir : join_paths(get_option('sysconfdir'), 'OpenCL', 'vendors'), + ) + +diff --git a/src/gallium/targets/rusticl/meson.build b/src/gallium/targets/rusticl/meson.build +index b2963fe6dfa..2f784bdccd4 100644 +--- a/src/gallium/targets/rusticl/meson.build ++++ b/src/gallium/targets/rusticl/meson.build +@@ -76,8 +76,7 @@ configure_file( + configuration : _config, + input : 'rusticl.icd.in', + output : 'rusticl.icd', +- install : true, +- install_tag : 'runtime', ++ install : false, + install_dir : join_paths(get_option('sysconfdir'), 'OpenCL', 'vendors'), + ) + +-- +2.40.1 + -- cgit 1.4.1 From 5002211aed2b383d761473028f6920794cd7dd48 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Sat, 16 Dec 2023 21:18:59 -0600 Subject: alsa-ucm-conf-asahi: v3 -> v5 --- apple-silicon-support/packages/alsa-ucm-conf-asahi/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apple-silicon-support/packages/alsa-ucm-conf-asahi/default.nix b/apple-silicon-support/packages/alsa-ucm-conf-asahi/default.nix index bb34f19f4f9c..ac9d15e36d4e 100644 --- a/apple-silicon-support/packages/alsa-ucm-conf-asahi/default.nix +++ b/apple-silicon-support/packages/alsa-ucm-conf-asahi/default.nix @@ -3,14 +3,14 @@ , alsa-ucm-conf }: (alsa-ucm-conf.overrideAttrs (oldAttrs: rec { - version = "3"; + version = "5"; src_asahi = fetchFromGitHub { - # tracking: https://github.com/AsahiLinux/PKGBUILDs/blob/main/alsa-ucm-conf-asahi/PKGBUILD + # tracking: https://src.fedoraproject.org/rpms/alsa-ucm-asahi owner = "AsahiLinux"; repo = "alsa-ucm-conf-asahi"; rev = "v${version}"; - hash = "sha256-TCCT0AJx0SdnTzzBaV94zuD2hrPqvk+9vTTuEQmpJjc="; + hash = "sha256-daUNz5oUrPfSMO0Tqq/WbtiLHMOtPeQQlI+juGrhTxw="; }; postInstall = oldAttrs.postInstall or "" + '' -- cgit 1.4.1 From 275509b7a12abf295a50e363f98744333c42074a Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Tue, 19 Dec 2023 18:42:31 -0600 Subject: fix installer cross compilation --- iso-configuration/installer-configuration.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/iso-configuration/installer-configuration.nix b/iso-configuration/installer-configuration.nix index 0cd3ca711e77..39c9ae90efcf 100644 --- a/iso-configuration/installer-configuration.nix +++ b/iso-configuration/installer-configuration.nix @@ -107,6 +107,14 @@ util-linux = prev.util-linux.override { translateManpages = false; }; + + # documentation cross-compilation is currently broken + # https://github.com/NixOS/nixpkgs/pull/275078 + btrfs-progs = prev.btrfs-progs.overrideAttrs (old: { + configureFlags = (old.configureFlags or []) ++ [ + "--disable-documentation" + ]; + }); }) ]; -- cgit 1.4.1 From 56c1ef38d3e04eae9b5867669ed131601fa99a7d Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Tue, 19 Dec 2023 21:38:49 -0600 Subject: release 2023-12-19 --- README.md | 2 +- docs/release-notes.md | 17 +++++++++++++++++ docs/uefi-standalone.md | 12 ++++++------ 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 2a60cd8e5e47..d28cc7cb0972 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Please see the documentation and guide below to get started. ## Documentation * [Release Notes](docs/release-notes.md) -* [Setup, Installation, and Maintenance Guide (2023-10-21)](docs/uefi-standalone.md) +* [Setup, Installation, and Maintenance Guide (2023-12-19)](docs/uefi-standalone.md) ## Credits diff --git a/docs/release-notes.md b/docs/release-notes.md index 4bf65b9e3c52..d7bd23b821d7 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -2,6 +2,23 @@ This file contains important information for each release. +## 2023-12-19 + +This release updates nixpkgs, m1n1, U-Boot, the kernel, and Mesa. + +With the official announcement of the Fedora Asahi Remix, nixos-apple-silicon is +now tracking package versions and capabilities as they appear in Fedora, in +order to offer the upstream intended user experience. + +Updating nixpkgs brings us past the 23.11 release and on the path to 24.05. +Other updates bring HDMI support for supported machines and firmware versions. +Don't expect this to work if you installed before August 2023; workarounds will +be made available shortly, and a long-term solution will hopefully be +implemented by Asahi and incorporated here as well. + +Speaker support will be added in the next release once safe implementation and +testing is completed. Thanks for the patience and understanding. + ## 2023-11-19 This release updates nixpkgs. diff --git a/docs/uefi-standalone.md b/docs/uefi-standalone.md index 06e9c6228f3d..1209027cced7 100644 --- a/docs/uefi-standalone.md +++ b/docs/uefi-standalone.md @@ -1,11 +1,11 @@ -# UEFI Boot Standalone NixOS (2023-11-19) +# UEFI Boot Standalone NixOS (2023-12-19) This guide will build and was tested with the following software: -* Asahi Linux kernel version 6.5.0-asahi15 -* Asahi Linux's Mesa version 23.3.0_asahi-20230904-1 -* m1n1 version v1.4.2 -* Asahi Linux's U-Boot version 2023.07.02.asahi3-1 -* Nixpkgs, as of 2023-11-19 +* Asahi Linux kernel version 6.6.0-asahi14 +* Asahi Linux's Mesa version 24.0.0_asahi-20231213-1 +* m1n1 version v1.4.11 +* Asahi Linux's U-Boot version 2023.07.02.asahi4-1 +* Nixpkgs, as of 2023-12-17 * macOS stub 12.3 NOTE: The latest version of this guide will always be [at its home](https://github.com/tpwrules/nixos-apple-silicon/blob/main/docs/uefi-standalone.md). For more general information about Linux on Apple Silicon Macs, refer to the [Asahi Linux project](https://asahilinux.org/) and [alpha installer release](https://asahilinux.org/2022/03/asahi-linux-alpha-release/). -- cgit 1.4.1