Skip to content

AppleVTD_English

杆杆只爱学习 edited this page Jul 21, 2024 · 7 revisions

Overview

The purpose of this article is to talk about the features of AppleVTD and how to enable it properly under Hackintosh.

Requirements

Devices
Motherboards Motherboards that support Intel VT-d
CPU Compatible with Intel VT-d CPU
macOS Versions macOS Monterey and later

AppleVTD and DriverKit

AppleVTD

AppleVTD is Apple Virtualisation, the main functionality of which is provided by Intel VT-d. It allows the use of [VT-d] for Apple-native hardware. It provides DMA remapping policies for Apple native hardware using the DriverKit driver.

  • Starting with macOS Monterey, Thunderbolt controllers require this feature to be enabled.
  • Starting with macOS Ventura, network adapters can use this feature.

DriverKit builds drivers that run in "user space" rather than as "kernel extensions", which improves system stability and security.

  • But does it really improve system stability? In fact, no. Most of DriverKit's drivers are extremely unstable. Moreover, DriverKit runs at the user level, which theoretically does not lead to Kernel Panic, but once it crashes, it will crash the DriverKit framework, and the crash log after the crash is not clear, making it difficult to troubleshoot the problem.

Another purpose of DriverKit is to pave the way for Apple Silicon. For example, the Apollo Thunderbolt driver and the Blackmagic Design driver are DriverKit drivers on Apple Silicon Macs, while they remain kernel extensions on Intel-powered Macs.

Enabling AppleVTD

I: Enable VT-d in BIOS/UEFI

II: Configure Quirks in OpenCore

  1. Mount the EFI partition
  2. Open config.plist from the EFI/OC directory
  3. In the Kernel - Quirks option
    • DisableIoMapper: to enable AppleVTD, disable this option
    • DisableIoMapperMapping (macOS 13.3 and later only): Enable this option when you meet any of the following conditions
      • With 16G or more RAM
      • Internal graphics is enabled
      • When your DMAR table contains one or more Reserved Memory Regions. For details on DMAR tables and Reserved Memory Regions, see Fix DMAR Tables. Quirks
  4. Remove dart=0 from boot-args in config.plist
  5. Save config.plist

III: Reboot

At this point, only some computers should be able to enable AppleVTD properly. you should continue reading this article to enable AppleVTD properly.

Fixing the DMAR Table

There are two scenarios we need to discuss in this section of fixing the DMAR table.

  • PCs with Intel 12th generation processors (600 series motherboards) and newer configurations, and without internal graphics enabled.
  • PCs with Intel 11th generation processors (500 series motherboards) and earlier configurations, PCs with Intel 12th generation processors (600 series motherboards) and newer configurations, and with internal graphics enabled.

If you are in the first category, congratulations, your AppleVTD should have been enabled correctly; if you are in the second category, please continue reading this article to fix your DMAR table.

I: Extracting the native DMAR table

The first step is to extract the native DMAR table. You can use MaciASL to extract DMAR table directly.

  1. Open MaciASL
  2. Click on the File - Get from ACPI option to open the DMAR table. Open the DMAR table by clicking on the File - Get from ACPI option. ACPI_DMAR

II: Removing Reserved Memory Regions

After obtaining the DMAR table, the next step is to delete the Reserved Memory Regions.

  1. Locate the sections with Reserved Memory Region and delete them. Note: The two blank lines under Reserved Memory Region need to be deleted as well.

    Remove_Reserved_Memory_Regions

    1. Click File - Save As in the upper left corner, select ACPI Machine Language Binary in the File Format option, and rename it to SSDT-DMAR.

III: Enabling SSDT

The next step is to enable the modified SSDT-DMAR.

  1. Mount the EFI partition
  2. Copy SSDT-DMAR.aml to the EFI/OC/ACPI directory. You will also need to add the same ACPI entry in ACPI>Add in config.plist SSDT-DMAR
  3. Save your config.plist

IV: Deleting the original DMAR table

The next step is to delete the native DMAR table to prevent it from loading and instead use the repaired version of the DMAR table.

  1. Open config.plist in the EFI/OC directory using any editor.
  2. Add the DMAR to TableSignature under the ACPI>Delete section of config.plist and enable this. Drop_DMAR
  3. save your config.plist

V: Restart

Verify AppleVTD

After rebooting, the last step is to check and verify that the AppleVTD feature, is loaded under macOS.

I:Download and open IOReg

Verify the AppleVTD. The AppleVTD is located under the AppleACPIPlatformExpert node.

Note: If there is no AppleVTD under the AppleACPIPlatformExpert node, you need to add [SSDT-DMAC](https://github.com/Fu-Yuxuan-hub/General-EFI-for-H610-B660- Z690-B760-Z790/wiki/AppleVTD_Simplified_Chinese#dmacdirect-memory-access-controller)

IOReg_AppleVTD

DMAC(Direct Memory Access Controller)

If AppleVTD still doesn't work, adding a DMAC device via SSDT-DMAC, which macOS can pass through in order to access all areas of memory, may solve the problem and make AppleVTD work. However, AppleVTD works without DMAC injection in most cases, so it is not common.

DMAC applies to the following SMBIOS:
iMac: 5,1 to 20,x
   iMacPro1,1
   MacBook: 1,1 to 9,1
   MacBookAir: 1,1 to 9,1
   MacBookPro: 1,1 to 16,1
   MacMini: 1,1 to 8,1
   MacPro: 1,1 to 7,1
   Xserve: 1,3 to 3,1;
   

I:Add SSDT-DMAC

SSDT-DMAC

//Add DMAC
DefinitionBlock ("", "SSDT", 2, "OCLT", "DMAC", 0)
{
 External(_SB.PCI0.LPCB, DeviceObj)
 Scope (_SB.PCI0.LPCB)
 {
     Device (DMAC)
     {
         Name (_HID, EisaId ("PNP0200"))
         Name (_CRS, ResourceTemplate ()
         {
             IO (Decode16,
                 0x0000, // Range Minimum
                 0x0000, // Range Maximum
                 0x01, // Alignment
                 0x20, // Length
                 )
             IO (Decode16,
                 0x0081, // Range Minimum
                 0x0081, // Range Maximum
                 0x01, // Alignment
                 0x11, // Length
                 )
             IO (Decode16,
                 0x0093, // Range Minimum
                 0x0093, // Range Maximum
                 0x01, // Alignment
                 0x0D, // Length
                 )
             IO (Decode16, // Range Minimum, // Range Maximum )
                 0x00C0, // Range Minimum
                 0x00C0, // Range Maximum
                 0x01, // Alignment
                 0x20, // Length
                 )
             DMA (Compatibility, NotBusMaster, Transfer8_16, )
                 {4}
         })
         Method (_STA, 0, NotSerialized)
         Method (_STA, 0, NotSerialized) {
             If (_OSI ("Darwin"))
             If (_OSI ("Darwin")) {
                 Return (0x0F)
             }
             Else
             If (_OSI ("Darwin") { Return (0x0F) } Else
                 Return (Zero)
             }
         }
     }
 }
}

Note:

  • If this device already exists when you search for PNP0200 or DMAC in DSDT, do not add it again. If it is missing, add this item (export as .aml)
  • When using this patch, make sure that the ACPI path for the LPC Bus (LPC or LPCB) used in the SSDT is the same as the one used in the system DSDT.

II: Verifying DMAC Devices

  1. Add SSDT-DMAC.aml to the ACPI folder of your EFI and to config.plist.
  2. Reboot
  3. Open IOReg and search for DMAC.
  4. If the addition is successful, as shown below. The array IODeviceMemory should contain more entries and data: IOReg_DMAC

© 杆杆只爱学习, Released under the MIT License.

--May 27, 2023