I use macPro 2019. The problem is with my NVMe RAID controller. It uses its own driver instead of the system's NVMe driver.
In the macOS 13 system, after installing the driver and restarting the system, during the startup process, the driver has a "vtd fault" error when loading, causing the driver to fail to initialize. My driver works fine on macos11/12. I upgraded my system to the latest macOS 13 beta and the problem appeared. The error message is as follows: vtd[0] fault: device 83:0:0 reason 0x6 R:0x101700000
A vtd fault error means that the pcie peripheral has accessed a physical address of memory that should not be accessed. After debugging, I found out that address 0x101700000 is exactly the physical address of the memory range my driver allocated.
In my driver, I allocate memory buffers like this: IOBufferMemoryDescriptor::inTaskWithPhysicalMask(current_task(), kIODirectionOut | kIODirectionIn | kIOMemoryPhysicallyContiguous, (mach_vm_size_t)size, ~((mach_vm_address_t)(alignment - 1)));
Then allocate the IODMACommand object: IODMACommand::withSpecification(kIODMACommandOutputHost64, 64, 0, IODMACommand::kMapped, 0, alignment, NULL);
Then get the physical address of the buffer: dmaCommand->setMemoryDescriptor(memDesc) dmaCommand->gen64IOVMSegments(&offset, &segments[0], &numSeg); When the pci peripheral reads this address, a vtd fault occurs.
Later, I plugged the NVMe RAID controller into a thunderbolt box, then started macos, and after entering the system, I used Thunderbolt-capable to connect the box to the macPro. At this time, the NVMe RAID driver could be loaded normally without vtd error.
vtd fault occurs only when the system starts. How to solve this problem?