Merge pull request #1013 from dortania/disable-mediad

Work-around mediaanalysisd crashing
This commit is contained in:
Mykola Grymalyuk
2022-11-06 08:23:42 -07:00
committed by GitHub
11 changed files with 63 additions and 54 deletions

View File

@@ -6,12 +6,15 @@
- AMD Polaris and legacy GCN cannot be mixed in the same system
- Legacy GCN support will be prioritized when both are present
- AMD Polaris GPU can still be used headless for rendering with legacy GCN (ex. [macOS: Prefer External GPU option](https://support.apple.com/en-ca/HT208544))
- Disables unsupported `mediaanalysisd` on Ivy Bridge and Haswell
- Alleviates kernel panic on Ivy Bridge and Haswell when on prolonged idle
- Work-around MacPro6,1 and Lilu race condition
- Ensure Model and Board ID are set correctly before Lilu loads
- Increment Binaries:
- AirPortBrcmFixup 2.1.6 - release
- DebugEnhancer 1.0.7 - release
- FeatureUnlock 1.1.0 - rolling (2bb3c50)
- RestrictEvents 1.0.9 - rolling (5535237)
## 0.5.1
- Add support for `APPLE SSD TS0128F/256F` SSDs in macOS Ventura

View File

@@ -1,12 +0,0 @@
diff --git a/RestrictEvents/RestrictEvents.cpp b/RestrictEvents/RestrictEvents.cpp
index 27562f0..66365a3 100644
--- a/RestrictEvents/RestrictEvents.cpp
+++ b/RestrictEvents/RestrictEvents.cpp
@@ -61,6 +61,7 @@ struct RestrictEventsPolicy {
static const char *procBlacklist[] {
"/System/Library/CoreServices/ExpansionSlotNotification",
"/System/Library/CoreServices/MemorySlotNotification",
+ "/usr/libexec/displaypolicyd",
};
char pathbuf[MAXPATHLEN];

View File

@@ -109,22 +109,21 @@ class BuildOpenCore:
# Essential kexts
("Lilu.kext", self.constants.lilu_version, self.constants.lilu_path, lambda: True),
("WhateverGreen.kext", self.constants.whatevergreen_version, self.constants.whatevergreen_path, lambda: self.constants.allow_oc_everywhere is False and self.constants.serial_settings != "None"),
("RestrictEvents.kext", self.constants.restrictevents_version, self.constants.restrictevents_path, lambda: self.model in model_array.MacPro),
("SMC-Spoof.kext", self.constants.smcspoof_version, self.constants.smcspoof_path, lambda: self.constants.allow_oc_everywhere is False and self.constants.serial_settings != "None"),
# CPU patches
("AAAMouSSE.kext", self.constants.mousse_version, self.constants.mousse_path, lambda: smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.penryn.value),
(
"telemetrap.kext",
self.constants.telemetrap_version,
self.constants.telemetrap_path,
lambda: smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.penryn.value,
),
(
"CPUFriend.kext",
self.constants.cpufriend_version,
self.constants.cpufriend_path,
lambda: self.model not in ["iMac7,1", "Xserve2,1", "Dortania1,1"] and self.constants.disallow_cpufriend is False and self.constants.serial_settings != "None",
),
(
"telemetrap.kext",
self.constants.telemetrap_version,
self.constants.telemetrap_path,
lambda: smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.penryn.value,
),
# Legacy audio
(
"AppleALC.kext",
@@ -195,10 +194,6 @@ class BuildOpenCore:
# Only inject on older OSes if user requests
self.get_item_by_kv(self.config["Kernel"]["Add"], "BundlePath", "ASPP-Override.kext")["MinKernel"] = ""
if self.model in ["MacBookPro6,1", "MacBookPro6,2", "MacBookPro9,1", "MacBookPro10,1"]:
# Modded RestrictEvents with displaypolicyd blocked to fix dGPU switching
self.enable_kext("RestrictEvents.kext", self.constants.restrictevents_mbp_version, self.constants.restrictevents_mbp_path)
if not self.constants.custom_model and self.constants.computer.ethernet:
for controller in self.constants.computer.ethernet:
if isinstance(controller, device_probe.BroadcomEthernet) and controller.chipset == device_probe.BroadcomEthernet.Chipsets.AppleBCM5701Ethernet:
@@ -917,23 +912,6 @@ class BuildOpenCore:
except KeyError:
pass
# With macOS 13, Ventura, Apple removed the Skylake graphics stack. However due to the lack of inovation
# with the Kaby lake and Coffee Lake iGPUs, we're able to spoof ourselves to natively support them
# Currently the following iGPUs we need to be considerate of:
# - HD530 (mobile): 0x191B0006
# | GPU | Model | Device ID | Platform ID | New Device ID | New Platform ID |
# | -------- | ---------------- | --------- | ----------- | ------------- | --------------- |
# | HD 515 | MacBook9,1 | 0x191E | 0x131E0003 |
# | Iris 540 | MacBookPro13,1/2 | 0x1926 | 0x19160002 | 0x5926 | 0x59260002
# | HD 530 | MacBookPro13,3 | 0x191B | 0x191B0006 | 0x591B | 0x591B0006 |
# | HD 530 | iMac17,1 | 0x1912 | 0x19120001 | 0x5912 | 0x59120003 |
if self.constants.xhci_boot is True:
print("- Adding USB 3.0 Controller Patch")
print("- Adding XhciDxe.efi and UsbBusDxe.efi")
@@ -996,6 +974,57 @@ class BuildOpenCore:
self.config["UEFI"]["Quirks"]["ForgeUefiSupport"] = True
self.config["UEFI"]["Quirks"]["ReloadOptionRoms"] = True
# RestrictEvents handling
block_args = ""
if self.model in ["MacBookPro6,1", "MacBookPro6,2", "MacBookPro9,1", "MacBookPro10,1"]:
block_args += "gmux,"
if self.model in model_array.MacPro:
print("- Disabling memory error reporting")
block_args += "pcie,"
gpu_dict = []
if not self.constants.custom_model:
gpu_dict = self.constants.computer.gpus
else:
if self.model in smbios_data.smbios_dictionary:
gpu_dict = smbios_data.smbios_dictionary[self.model]["Stock GPUs"]
for gpu in gpu_dict:
if not self.constants.custom_model:
gpu = gpu.arch
if gpu in [
device_probe.Intel.Archs.Ivy_Bridge,
device_probe.Intel.Archs.Haswell,
device_probe.NVIDIA.Archs.Kepler,
]:
print("- Disabling mediaanalysisd")
block_args += "media,"
break
if block_args.endswith(","):
block_args = block_args[:-1]
if block_args != "":
print(f"- Setting RestrictEvents block arguments: {block_args}")
if self.get_kext_by_bundle_path("RestrictEvents.kext")["Enabled"] is False:
self.enable_kext("RestrictEvents.kext", self.constants.restrictevents_version, self.constants.restrictevents_path)
self.config["NVRAM"]["Add"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"]["revblock"] = block_args
patch_args = ""
if self.get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Reroute kern.hv_vmm_present patch (1)")["Enabled"] is True and self.constants.set_content_caching is True:
print("- Fixing Content Caching support")
patch_args += "content-caching,"
if patch_args.endswith(","):
patch_args = patch_args[:-1]
if block_args != "" and patch_args == "":
# Disable unneeded Userspace patching (cs_validate_page is quite expensive)
patch_args = "none"
if patch_args != "":
print(f"- Setting RestrictEvents patch arguments: {patch_args}")
if self.get_kext_by_bundle_path("RestrictEvents.kext")["Enabled"] is False:
self.enable_kext("RestrictEvents.kext", self.constants.restrictevents_version, self.constants.restrictevents_path)
self.config["NVRAM"]["Add"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"]["revpatch"] = patch_args
# DEBUG Settings
if self.constants.verbose_debug is True:
print("- Enabling Verbose boot")
@@ -1123,16 +1152,10 @@ class BuildOpenCore:
if self.constants.nvram_write is False:
print("- Disabling Hardware NVRAM Write")
self.config["NVRAM"]["WriteFlash"] = False
if self.get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Reroute kern.hv_vmm_present patch (1)")["Enabled"] is True and self.constants.set_content_caching is True:
# Add Content Caching patch
print("- Fixing Content Caching support")
if self.get_kext_by_bundle_path("RestrictEvents.kext")["Enabled"] is False:
self.enable_kext("RestrictEvents.kext", self.constants.restrictevents_version, self.constants.restrictevents_path)
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " -revasset"
if self.get_kext_by_bundle_path("RestrictEvents.kext")["Enabled"] is False:
# Ensure this is done at the end so all previous RestrictEvents patches are applied
# RestrictEvents and EFICheckDisabler will conflict if both are injected
self.enable_kext("EFICheckDisabler.kext", self.constants.restrictevents_version, self.constants.efi_disabler_path)
self.enable_kext("EFICheckDisabler.kext", "", self.constants.efi_disabler_path)
if self.constants.set_vmm_cpuid is True:
# Should be unneeded with our sysctl VMM patch, however for reference purposes we'll leave it here
# Ref: https://forums.macrumors.com/threads/opencore-on-the-mac-pro.2207814/

View File

@@ -37,8 +37,7 @@ class Constants:
self.airportbcrmfixup_version = "2.1.6" # AirPortBrcmFixup
self.nvmefix_version = "1.0.9" # NVMeFix
self.applealc_version = "1.6.3" # AppleALC
self.restrictevents_version = "1.0.6" # RestrictEvents
self.restrictevents_mbp_version = "1.0.6" # RestrictEvents blocking displaypolicyd (see RestrictEvents-MBP91.patch)
self.restrictevents_version = "1.0.9" # RestrictEvents
self.featureunlock_version = "1.1.0" # FeatureUnlock
self.debugenhancer_version = "1.0.7" # DebugEnhancer
self.cpufriend_version = "1.2.5" # CPUFriend
@@ -292,11 +291,7 @@ class Constants:
@property
def efi_disabler_path(self):
return self.payload_kexts_path / Path(f"Acidanthera/EFICheckDisabler-v{self.restrictevents_version}.zip")
@property
def restrictevents_mbp_path(self):
return self.payload_kexts_path / Path(f"Acidanthera/RestrictEvents-MBP91-v{self.restrictevents_mbp_version}-{self.kext_variant}.zip")
return self.payload_kexts_path / Path(f"Acidanthera/EFICheckDisabler.zip")
@property
def bcm570_path(self):