• Stars
    star
    685
  • Rank 65,982 (Top 2 %)
  • Language
    C++
  • License
    Other
  • Created almost 5 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

NVMeFix

Build Status Scan Status

NOTE: NVMeFix supports up to macOS Sonoma (14), but some features might not be available on newer versions as of now, like the timeout panic fix.

NVMeFix is a set of patches for the Apple NVMe storage driver, IONVMeFamily. Its goal is to improve compatibility with non-Apple SSDs. It may be used both on Apple and non-Apple computers.

The following features are implemented:

  • Autonomous Power State Transition to reduce idle power consumption of the controller.
  • Host-driver active power state management.
  • Workaround for timeout panics on certain controllers (VMware, Samsung PM981).

Other incompatibilities with third-party SSDs may be addressed provided enough information is submitted to our bugtracker.

Unfortunately, some issues cannot be fixed purely by a kernel-side driver. For example, MacBookPro 11,1 EFI includes an old version of NVMHCI DXE driver that causes a hang when resuming from hibernaton with full disk encryption on.

Installation

NVMeFix requires at least Lilu 1.4.1 and at least 10.14 system version. It may be compatible with older systems, but has not been tested.

It may be installed to /Library/Extensions on 10.15 and earlier, or injected by the bootloader on all versions.

Configuration

-nvmefdbg enables detailed logging for DEBUG build.

-nvmefoff disables the kext.

-nvmefaspm forces ASPM L1 on all the devices. This argument is recommended exclusively for testing purposes, as for daily usage one could inject pci-aspm-default device property with <02 00 00 00> value into the SSD devices and bridge devices they are connected to onboard. Updated values will be visible as pci-aspm-custom in the affected devices.

Some SSDs misbehave when APST is on. NVMeFix attempts to detect broken motherboard and SSD combinations and work around them. Motherboard is detected via IORegistry keys injected by Clover, or NVRAM variables provided by OpenCore.

APST table entries specify minimum idle latency for the transition to occur. Maximum acceptable latency is 100000 microseconds, and may be overriden via little-endian 8-byte property ps-max-latency-us of parent PCI device (e.g. IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/RP06@1C,5/IOPP/SSD0@0). If set to 0, APST will be disabled completely.

Diagnostics

RELEASE build will only log high-level information about failures.

DEBUG build will additionally log used power states, detailed error messages, and attempt to fetch APST status and table from the controller.

APST enable status is posted to the IONVMeController IORegistry entry apst key.

If active power management initialisation is successful, an NVMePMProxy entry will be created in the IOPower IORegistry plane with IOPowerManagement dictionary.

Information about power states supported by the controller may be obtained e.g. using smartmontools. For example, in the following output the controller reports 5 states, where the former three high-power states will be used by NVMeFix for active power management, and the latter two may be used for APST depending on ps-max-latency-us.

Supported Power States
St Op     Max   Active     Idle   RL RT WL WT  Ent_Lat  Ex_Lat
 0 +     9.00W       -        -    0  0  0  0        0       0
 1 +     4.60W       -        -    1  1  1  1        0       0
 2 +     3.80W       -        -    2  2  2  2        0       0
 3 -   0.0450W       -        -    3  3  3  3     2000    2000
 4 -   0.0040W       -        -    4  4  4  4     6000    8000

IONVMeFamily supports the following debug flag bitfield, which are passed either via nvme bootarg or debug.NVMe sysctl:

1: Log some events via kprintf
2: Detailed event trace via kernel_debug with 0x61500xx debugid
4: PRP-related event trace via kernel_debug with 0x61540xx debugid
8: Force disable LPSR for Apple controllers
16: Perform only PCI initialisation of NVMe controller
32: Ignore initialisation errors
128: Disable LPSR for Apple controllers
512: Disable Unmap feature for IONVMeBlockStorageDevice

IONVMeFamily supports the following additional bootargs:

nand-io-timeoutms: Timeout for NVMe requests in ms, 35 s by default
enable-IO-log: Issue CORE_DEBUG_ENABLE_IOLOG ASP command (for Apple controllers)

More Repositories

1

OpenCorePkg

OpenCore bootloader
C
13,029
star
2

Lilu

Arbitrary kext and process patching on macOS
C
3,585
star
3

AppleALC

Native macOS HD audio for not officially supported codecs
C++
3,439
star
4

WhateverGreen

Various patches necessary for certain ATI/AMD/Intel/Nvidia GPUs
C++
3,236
star
5

VirtualSMC

SMC emulator layer
C++
1,664
star
6

BrcmPatchRAM

C++
1,037
star
7

MaciASL

ACPI editing IDE for macOS
Objective-C
749
star
8

OcBinaryData

733
star
9

AirportBrcmFixup

An open source kernel extension providing a set of patches required for non-native Airport Broadcom Wi-Fi cards.
C++
643
star
10

MacHyperVSupport

Hyper-V integration support for macOS
C++
620
star
11

AppleSupportPkg

AppleSupportPkg - contains UEFI drivers for Apple environment support
559
star
12

CPUFriend

Dynamic macOS CPU power management data injection
C++
535
star
13

VoodooPS2

C++
513
star
14

IntelMausi

Intel Ethernet LAN driver for macOS
C
390
star
15

bugtracker

Acidanthera Bugtracker
375
star
16

HibernationFixup

A Lilu plugin intended to fix hibernation compatibility issues
C++
371
star
17

FeatureUnlock

Add Sidecar support to unsupported models
C++
362
star
18

gfxutil

Device Properties conversion tool
C
274
star
19

MacInfoPkg

Mac Platform Information
249
star
20

RestrictEvents

C++
249
star
21

CpuTscSync

It is a Lilu plugin, combining functionality of VoodooTSCSync and disabling xcpm_urgency if TSC is not in sync. It should solve kernel panics after wake.
C++
171
star
22

MacKernelSDK

macOS kernel SDK targeting various XNU versions
C
167
star
23

AptioFixPkg

AptioFixPkg drivers to workaround macOS compatibility with APTIO UEFI FW
161
star
24

Shiki

Protected video playback support and hardware video acceleration on various hardware.
152
star
25

VoodooInput

Generic Multitouch Handler kernel extension for macOS
C++
151
star
26

BrightnessKeys

Handler for brightness keys without DSDT patches
C++
132
star
27

RTCMemoryFixup

open source kernel extension providing a way to emulate some offsets in your CMOS (RTC) memory
C++
97
star
28

macserial

Decode mac serial number
96
star
29

CryptexFixup

Various patches to install Rosetta Cryptex
C++
88
star
30

BT4LEContinuityFixup

72
star
31

OcSupportPkg

OpenCore common libraries
71
star
32

IOJones

Realtime I/O Registry viewer
60
star
33

DebugEnhancer

A Lilu plugin intended to enable debug output in the macOS kernel
C++
58
star
34

audk

Acidanthera UEFI Development Kit based on EDK II edk2-stable202405
C
57
star
35

dmidecode

dmidecode version with macOS specific improvements
C
40
star
36

ocbuild

Shell
39
star
37

EmeraldSDHC

SD host controller support for macOS
C++
39
star
38

OpenCoreShell

Patched UDK Shell adopted for wide firmware range
38
star
39

EfiPkg

38
star
40

UEFIGraphicsFB

UEFI framebuffer driver for macOS
C++
28
star
41

mac-efi-firmware

C
24
star
42

CpuTopologySync

Rebuild asymmetric CPU topology on macOS.
23
star
43

DuetPkg

Duet UEFI firmware emulator
15
star
44

ocmtoc

C
7
star
45

OcLegacyPkg

Legacy OpenCorePkg repository left for historical purposes
7
star