Contribute
Register

[SUCCESS] Gigabyte Designare Z390 (Thunderbolt 3) + i7-9700K + AMD RX 580

** Patch Theory **
Fixing
WiFi and Ethernet in macOS 13.3 with AppleVTD


Purpose:
As requested by some, this post explains how the patch was found and what the patch does.

Discovery:
Sometimes it is helpful to participate in the Apple public beta program. When the first 13.3 public beta was released we found some issues related to CPU topology that affected (a) Intel processors with P-cores and E-cores, and (b) all AMD processors. But WiFi and Ethernet worked properly.

In the last two 13.3 public betas, however, WiFi and Ethernet were adversely impacted. The problem was limited to kexts (not to dexts) when AppleVTD was enabled and the system had more than 16GB memory.

Discovery Stage 1:
Not knowing where the problem lay, it was first necessary to isolate the root cause. The first question was, is the problem in one of the kernel extensions or is it deeper within the kernel itself or some other part of the OS? To answer this, the following was done:
  • Late beta of 13.3 was installed on a spare SSD
  • All files in /System/Library/Extensions were replaced by those from an early 13.3 beta build
  • A Frankenstein hybrid was thereby created and it booted and worked perfectly
Discovery Stage 2:
The next question was, which kext or kexts is the culprit? There are hundreds of kexts, but only a handful are responsible for WiFi and Ethernet. The steps of Discovery Stage 1 were repeated, but instead of replacing all kexts, one or two were replaced at a time:
  • Replaced IONetworkingFamily.kext
  • Result: No good -- WiFi and Ethernet still down
Then:
  • Replaced IO80211FamilyLegacy.kext that governs Broadcom WiFi
  • Result: No good -- WiFi still down
Then:
  • Replaced all 5 Broadcom firmware kexts
  • Result: No good -- WiFi still down
Then:
  • Realizing that WiFi and Ethernet are down, there must be a common higher-level kext that affects them both. Because the problem occurs only when AppleVTD is enabled, and because AppleVTD is managed by IOPCIFamily, the next step was:
    • Replace IOPCIFamily.kext
    • Result: Everything works!
Discovery Stage 3:
Now it was a matter of comparing IOPCIFamily between early and late builds of 13.3. This effort was greatly facilitated by the Ghidra disassembler, which has an option to generate C-like pseudo code from a compiled x86 binary.

Comparing the disassembled code revealed two new functions: addMemoryRange and reserveRanges. The latter was examined first. It turns out that reserveRanges is the result of some minor refactoring of existing code, but it contains a little bit of new code as well. The first inclination was to patch-out the new code from this function, which is shown in the dotted box:
Screenshot 2023-04-03 at 6.03.31 AM.png

This did not work: The first patch failed and was discarded. Attention turned to the other new function addMemoryRange. To determine where this function is called from, it was simply a matter of searching the pseudo-code file in BBEdit:

Screenshot 2023-04-03 at 6.07.35 AM.png


We can see that addMemoryRange is newly added in late 13.3. Interesting. So what would happen if we magically erased this call? That was done by finding the relevant section in Hopper disassembler and replacing it with a series of No-Operations:
Screenshot 2023-04-03 at 6.11.49 AM.png
Screenshot 2023-04-03 at 6.13.55 AM.png

After applying this patch and rebooting, success.

Screenshot 2023-04-02 at 12.27.23 PM.png
Screenshot 2023-04-02 at 12.28.51 PM.png
 
Last edited:
@CaseySJ,

Excellent detective work, many thanks for posting your explanation.

Cheers
Jay
 
My bad, it was not; I didn't have Vt-D enabled in the BIOS. I've enabled now. The patch was necessary and working.

Still no private relay (private relay is unavailable), is this the same for everyone?
It seems to be okay for me:

Screenshot 2023-04-03 at 7.36.02 AM.png
 
@CaseySJ Thanks for your explanation. Now that the patch is released, documented and is being tested by various users, likely on a variety of systems as well, I suppose that the next step is a pull request to OpenCore.
 
@CaseySJ Thanks for your explanation. Now that the patch is released, documented and is being tested by various users, likely on a variety of systems as well, I suppose that the next step is a pull request to OpenCore.
As we can see here, this takes a lot of work and affects a handful of files. Me scared to mess with that. :)

Update: On second thought, it doesn't look too bad. Will create a private OpenCore build to test it out.
 
Last edited:
** Experimental OpenCore.efi with FixAppleVTD Kernel Quirk **
Purpose:
The patch to fix WiFi and Ethernet issues in macOS 13.3 has been incorporated directly into a test version of OpenCore that is attached to this post. This means it's not necessary to add the patch manually to config.plist.

Instead, a new Kernel Quirk called FixAppleVTD has been introduced that can be enabled and disabled as needed. When enabled, OpenCore itself will inject the patch into the right version of macOS.

Version:
This version of OpenCore.efi is based on the just-released OpenCore 0.9.1 code base, so it includes everything that's in 0.9.1.

Procedure:
  1. Disable the Kernel -> Patch if the patch has already been added and enabled.
  2. Replace existing OpenCore.efi in EFI/OC folder with the version attached below.
  3. Add these two lines (manually for now) into config.plist using a text editor as shown. The lines must be added in the Kernel Quirks section.
XML:
<key>FixAppleVTD</key>
<true/>
Screenshot 2023-04-03 at 11.52.05 AM.png

Save config.plist and reboot. Do WiFi and Ethernet continue to work?
 

Attachments

  • OpenCore.efi.zip
    270.4 KB · Views: 63
Last edited:
@CaseySJ
Hi Casey,
I tried to have a fresh install Ventura and OpenCore 0.9.1 on my old Big Sur, here’s what I did:
- Create bootable Ventura
- Edit Sample.plist in OpenCore Configurator 2.68
- Copy Sample.plist to folder X64/EFI/OC and rename to config.plist
- Copy everything inside EFI flash disk to Ventura EFI folder
- Reboot then F12, I select USB drive, it takes it then goes back to F12 selection again without continuing to next step.
Please help, or do have any fresh install instructions with Ventura?

Note: I tried your guide with OC 0.8.3, however I couldn’t find Configurator for 0.8.3.
 
@CaseySJ
Hi Casey,
I tried to have a fresh install Ventura and OpenCore 0.9.1 on my old Big Sur, here’s what I did:
- Create bootable Ventura
- Edit Sample.plist in OpenCore Configurator 2.68
- Copy Sample.plist to folder X64/EFI/OC and rename to config.plist
- Copy everything inside EFI flash disk to Ventura EFI folder
- Reboot then F12, I select USB drive, it takes it then goes back to F12 selection again without continuing to next step.
Please help, or do have any fresh install instructions with Ventura?

Note: I tried your guide with OC 0.8.3, however I couldn’t find Configurator for 0.8.3.
Please try the attached OpenCore 0.9.1 EFI folder. The only thing you'll need to add are your serial numbers in:
  • PlatformInfo -> DataHub
Please use OpenCore Configurator 2.68.0.0 (latest version) and set it to OpenCore 0.9.1 Development Version.

Screenshot 2023-04-03 at 5.45.09 PM.png
 

Attachments

  • EFI-091-Z30-Designare.zip
    46.7 MB · Views: 97
Please try the attached OpenCore 0.9.1 EFI folder. The only thing you'll need to add are your serial numbers in:
  • PlatformInfo -> DataHub
Please use OpenCore Configurator 2.68.0.0 (latest version) and set it to OpenCore 0.9.1 Development Version.

View attachment 565401
Hi Casey,

Thanks for your help in advance!

Follow your instructions, I was able to select USB drive, then next screen select Install macOS Ventura, then Apple logo displays forever without doing anything, I waited for 30 mins and still not seeing anything happens, pls help.
 
Back
Top