wip
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
From 1c60b7662b82d7d5d54aca1cd24f9517a8c4595f Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Watson <twatson52@icloud.com>
|
||||
Date: Thu, 24 Nov 2022 11:00:43 -0600
|
||||
Subject: [PATCH] drivers/usb/dwc3: remove apple dr_mode check
|
||||
|
||||
This check prevents the driver from probing with old device trees.
|
||||
Allegedly this check is incorrect anyway as the dr_mode should default
|
||||
to OTG but this is not true at the time of the check.
|
||||
---
|
||||
drivers/usb/dwc3/core.c | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
|
||||
index 1d88119cdbb8..b92401c1ee0c 100644
|
||||
--- a/drivers/usb/dwc3/core.c
|
||||
+++ b/drivers/usb/dwc3/core.c
|
||||
@@ -1882,8 +1882,7 @@ static int dwc3_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
if (of_device_is_compatible(dev->of_node, "apple,dwc3")) {
|
||||
- if (!IS_ENABLED(CONFIG_USB_ROLE_SWITCH) ||
|
||||
- dwc->dr_mode != USB_DR_MODE_OTG) {
|
||||
+ if (!IS_ENABLED(CONFIG_USB_ROLE_SWITCH)) {
|
||||
dev_err(dev,
|
||||
"Apple DWC3 requires role switch support.\n"
|
||||
);
|
||||
--
|
||||
2.17.1
|
||||
File diff suppressed because it is too large
Load Diff
@@ -10,4 +10,4 @@ index a1eb6572ecd2..b94fbd9b3d70 100644
|
||||
+ default ARM64_16K_PAGES
|
||||
help
|
||||
Page size (translation granule) configuration.
|
||||
|
||||
|
||||
@@ -3,9 +3,8 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
config = {
|
||||
boot.kernelPackages = pkgs.callPackage ./package.nix {
|
||||
crossBuild = config.boot.kernelBuildIsCross;
|
||||
_16KBuild = config.boot.kernelBuildIs16K;
|
||||
boot.kernelPackages = config.hardware.asahi.pkgs.callPackage ./package.nix {
|
||||
_4KBuild = config.hardware.asahi.use4KPages;
|
||||
};
|
||||
|
||||
# we definitely want to use CONFIG_ENERGY_MODEL, and
|
||||
@@ -13,10 +12,42 @@
|
||||
# source: https://www.kernel.org/doc/html/latest/scheduler/sched-energy.html
|
||||
powerManagement.cpuFreqGovernor = lib.mkOverride 800 "schedutil";
|
||||
|
||||
# our kernel config is weird and doesn't really have any modules
|
||||
# remove?
|
||||
# boot.initrd.availableKernelModules = lib.mkForce [];
|
||||
boot.initrd.availableKernelModules = lib.mkForce [ "dm_crypt" ];
|
||||
boot.initrd.includeDefaultModules = false;
|
||||
boot.initrd.availableKernelModules = [
|
||||
# list of initrd modules stolen from
|
||||
# https://github.com/AsahiLinux/asahi-scripts/blob/e4d6151a7dcb63ae5e3779c3cf57362eb37d908a/initcpio/install/asahi
|
||||
"apple-mailbox"
|
||||
"nvme_apple"
|
||||
"pinctrl-apple-gpio"
|
||||
"macsmc"
|
||||
"macsmc-rtkit"
|
||||
"i2c-apple"
|
||||
"tps6598x"
|
||||
"apple-dart"
|
||||
"dwc3"
|
||||
"dwc3-of-simple"
|
||||
"xhci-pci"
|
||||
"pcie-apple"
|
||||
"gpio_macsmc"
|
||||
"spi-apple"
|
||||
"spi-hid-apple"
|
||||
"spi-hid-apple-of"
|
||||
"rtc-macsmc"
|
||||
"simple-mfd-spmi"
|
||||
"spmi-apple-controller"
|
||||
"nvmem_spmi_mfd"
|
||||
"apple-dockchannel"
|
||||
"dockchannel-hid"
|
||||
"apple-rtkit-helper"
|
||||
"dm_crypt"
|
||||
|
||||
# additional stuff necessary to boot off USB for the installer
|
||||
# and if the initrd (i.e. stage 1) goes wrong
|
||||
"usb-storage"
|
||||
"xhci-plat-hcd"
|
||||
"usbhid"
|
||||
"hid_generic"
|
||||
];
|
||||
|
||||
boot.kernelParams = [
|
||||
"earlycon"
|
||||
@@ -45,18 +76,23 @@
|
||||
};
|
||||
};
|
||||
|
||||
options.boot.kernelBuildIsCross = lib.mkOption {
|
||||
imports = [
|
||||
(lib.mkRemovedOptionModule [ "boot" "kernelBuildIsCross" ] ''
|
||||
If it should still be true (which is unlikely), replace it
|
||||
with 'hardware.asahi.pkgsSystem = "x86_64-linux"'. Otherwise, delete it.
|
||||
'')
|
||||
|
||||
(lib.mkRemovedOptionModule [ "boot" "kernelBuildIs16K" ] ''
|
||||
Replaced with 'hardware.asahi.use4KPages' which defaults to false.
|
||||
'')
|
||||
];
|
||||
|
||||
options.hardware.asahi.use4KPages = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Set that the Asahi Linux kernel should be cross-compiled.";
|
||||
};
|
||||
|
||||
options.boot.kernelBuildIs16K = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Set that the Asahi Linux kernel should be built with 16K pages and various
|
||||
software patched to be compatible. Some software may still be broken.
|
||||
Build the Asahi Linux kernel with 4K pages to improve compatibility in
|
||||
some cases at the cost of performance in others.
|
||||
'';
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,10 @@
|
||||
{ pkgs, crossBuild ? false, _16KBuild ? false }: let
|
||||
buildPkgs = if crossBuild then
|
||||
import (pkgs.path) {
|
||||
system = "x86_64-linux";
|
||||
crossSystem.system = "aarch64-linux";
|
||||
}
|
||||
else pkgs;
|
||||
{ pkgs, _4KBuild ? false }: let
|
||||
localPkgs =
|
||||
# we do this so the config can be read on any system and not affect
|
||||
# the output hash
|
||||
if builtins ? currentSystem then import (pkgs.path) { system = builtins.currentSystem; }
|
||||
else pkgs;
|
||||
|
||||
# we do this so the config can be read on any system and not affect
|
||||
# the output hash
|
||||
localPkgs = import (pkgs.path) { system = "aarch64-linux"; };
|
||||
readConfig = configfile: import (localPkgs.runCommand "config.nix" {} ''
|
||||
echo "{" > "$out"
|
||||
while IFS='=' read key val; do
|
||||
@@ -23,28 +19,35 @@
|
||||
linuxKernel.manualConfig rec {
|
||||
inherit stdenv lib;
|
||||
|
||||
version = "5.19.0-rc7-asahi";
|
||||
version = "6.1.0-rc6-asahi";
|
||||
modDirVersion = version;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
# tracking branch: https://github.com/AsahiLinux/linux/tree/asahi
|
||||
# tracking: https://github.com/AsahiLinux/PKGBUILDs/blob/stable/linux-asahi/PKGBUILD
|
||||
owner = "AsahiLinux";
|
||||
repo = "linux";
|
||||
rev = "c7d02d6615a5fb4afefd3084fce93d86e5fb184d";
|
||||
hash = "sha256-sed405+6L5U7S+Na2DNLGPNTNf3tv96LjK3CimeRjNU=";
|
||||
rev = "asahi-6.1-rc6-5";
|
||||
hash = "sha256-HHPfAtNh5wR0TCsEYuMdSbp55p1IVhF07tg4dlfgXk0=";
|
||||
};
|
||||
|
||||
kernelPatches = [
|
||||
] ++ lib.optionals (!_16KBuild) [
|
||||
# sven says this is okay since our kernel config supports it, and that
|
||||
# it will be fixed at some point to not be necessary. but this allows
|
||||
# new kernels to get USB up with old device trees
|
||||
{ name = "0001-drivers-usb-dwc3-remove-apple-dr_mode-check";
|
||||
patch = ./0001-drivers-usb-dwc3-remove-apple-dr_mode-check.patch;
|
||||
}
|
||||
] ++ lib.optionals _4KBuild [
|
||||
# thanks to Sven Peter
|
||||
# https://lore.kernel.org/linux-iommu/20211019163737.46269-1-sven@svenpeter.dev/
|
||||
{ name = "sven-iommu-4k";
|
||||
patch = ./sven-iommu-4k.patch;
|
||||
}
|
||||
] ++ lib.optionals _16KBuild [
|
||||
# patch the kernel to set the default size to 16k so we don't need to
|
||||
# convert our config to the nixos infrastructure or patch it and thus
|
||||
# introduce a dependency on the host system architecture
|
||||
] ++ lib.optionals (!_4KBuild) [
|
||||
# patch the kernel to set the default size to 16k instead of modifying
|
||||
# the config so we don't need to convert our config to the nixos
|
||||
# infrastructure or patch it and thus introduce a dependency on the host
|
||||
# system architecture
|
||||
{ name = "default-pagesize-16k";
|
||||
patch = ./default-pagesize-16k.patch;
|
||||
}
|
||||
@@ -53,15 +56,8 @@
|
||||
configfile = ./config;
|
||||
config = readConfig configfile;
|
||||
|
||||
extraMeta.branch = "5.19";
|
||||
extraMeta.branch = "6.1";
|
||||
} // (args.argsOverride or {});
|
||||
|
||||
linux_asahi = (buildPkgs.callPackage linux_asahi_pkg { }).overrideAttrs (o: {
|
||||
# use 5.19 suitable randstruct seed patch
|
||||
# to be removed when https://github.com/NixOS/nixpkgs/pull/180750 is
|
||||
# accepted and percolates through
|
||||
patches = (builtins.filter
|
||||
(v: (pkgs.lib.hasInfix "randstruct" (builtins.path { path = v; })) != true)
|
||||
o.patches) ++ [ ./randstruct-provide-seed-5.19.patch ];
|
||||
});
|
||||
in buildPkgs.recurseIntoAttrs (buildPkgs.linuxPackagesFor linux_asahi)
|
||||
linux_asahi = (pkgs.callPackage linux_asahi_pkg { });
|
||||
in pkgs.recurseIntoAttrs (pkgs.linuxPackagesFor linux_asahi)
|
||||
@@ -1,13 +0,0 @@
|
||||
diff --git a/scripts/gen-randstruct-seed.sh b/scripts/gen-randstruct-seed.sh
|
||||
index 61017b36c464..7bb494dd2e18 100755
|
||||
--- a/scripts/gen-randstruct-seed.sh
|
||||
+++ b/scripts/gen-randstruct-seed.sh
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
-SEED=$(od -A n -t x8 -N 32 /dev/urandom | tr -d ' \n')
|
||||
+SEED="NIXOS_RANDSTRUCT_SEED"
|
||||
echo "$SEED" > "$1"
|
||||
HASH=$(echo -n "$SEED" | sha256sum | cut -d" " -f1)
|
||||
echo "#define RANDSTRUCT_HASHED_SEED \"$HASH\"" > "$2"
|
||||
@@ -446,4 +446,4 @@ index 9208eca4b0d1..dec2dd70a876 100644
|
||||
+
|
||||
enum iommu_cap {
|
||||
IOMMU_CAP_CACHE_COHERENCY, /* IOMMU can enforce cache coherent DMA
|
||||
transactions */
|
||||
transactions */
|
||||
Reference in New Issue
Block a user