Fix it now
Both stop codes are the IOMMU reporting a page fault it cannot accept: 0x00000158 for an address space identifier that is invalid and may already have been reused, 0x00000159 for one that was being freed while a driver still had requests in flight. On a host using Discrete Device Assignment, the assigned device and its driver are where to look.
Get-VMHostAssignableDevice
Get-VM | Get-VMAssignableDevice
Remove-VMAssignableDevice -VMName <vm> -LocationPath "<path>"
Mount-VMHostAssignableDevice -LocationPath "<path>"
- Make sure the host will keep the evidence. In System Properties, Advanced, Startup and Recovery, set the debugging information to Automatic or Kernel memory dump, and copy the dump off the host after the next stop.
- Read the System log entry the stop wrote. Microsoft’s guidance is that the event carries the four stop-code parameters; for 0x158 they are the invalid ASID, the number in use, the owning process and the reference count.
- In the host firmware, confirm Intel VT-d or the AMD IOMMU is on. Device assignment will not work without it, and a firmware reset can silently turn it off.
- Give the device back to the host with the two commands above and run the host without the assignment. If it stays up, the fault belongs to the assigned device, its firmware or the guest driver programming it.
- Reintroduce one device at a time with Add-VMAssignableDevice so you know which one is responsible.
Dismounting a device stops everything using it. Check what depends on that adapter, controller or GPU before you take it away, particularly where the same card also carries management or storage traffic.
If removing the assignment settles the host, you have found the device and the next section explains what it did. If the host still stops with nothing assigned, read on: the same codes appear without passthrough.
Why it happens
An IOMMU gives every device its own view of memory. Each device or group of devices is handed an address space, identified by an address space identifier, and the unit translates the addresses that device puts on the bus against that space. Anything outside it is refused. That is what makes it safe to let a virtual machine program a physical device directly, because the guest cannot point the device at the host’s memory.
0x00000158 is not the IOMMU refusing an address. It is the IOMMU delivering a page fault packet tagged with an ASID that is not valid, which Microsoft describes as unsafe because that ASID may already have been handed to something else. Acting on the fault could attribute it to the wrong owner, so the kernel stops instead. 0x00000159 is the same family with the blame already assigned: the fault arrived against an ASID that was in the process of being freed, and the documentation says plainly that a driver was responsible for completing its in-flight requests before that point and did not.
That distinction matters for where you spend your time. These are not usually configuration faults, and they are not usually Windows defects. They point at a device whose firmware keeps issuing transactions after it has been told to stop, a device that does not implement the isolation and reset behaviour assignment depends on, or a driver in the guest that tears down its mappings in the wrong order.
The device is not genuinely suitable for assignment
You have this one if It behaves perfectly while the host drives it and stops the host as soon as a guest does, and the hardware vendor does not list device assignment among its supported configurations.
- Check the vendor’s documentation for explicit support of assigning that device to a virtual machine. Silence is not endorsement.
- Run Microsoft’s published survey script for device assignment, which reports whether a device exposes the capabilities assignment requires, including function level reset.
- Where the device does not qualify, use a supported alternative instead: SR-IOV virtual functions for networking, or an ordinary virtual switch.
A card that appears to work is not the same as one the vendor will support. These stops often appear only under sustained load, months after the build.
A guest driver is not draining its requests before teardown
You have this one if Stop code 0x00000159 rather than 0x00000158, and the crashes line up with the guest starting, stopping, resetting the device or reloading its driver.
- Match the guest driver to the firmware level the device vendor pairs it with, in both directions: a newer driver on old firmware fails the same way as the reverse.
- Reproduce deliberately by stopping and starting the guest a dozen times, which is the cycle that exercises the teardown path.
- Send the dump to the device vendor. The documentation names the driver as responsible for this one, so it is theirs to fix.
Firmware settings were reset or changed underneath you
You have this one if The problem began immediately after a firmware update, a battery replacement or a settings reset, and no software changed.
- Re-enable the IOMMU: VT-d on Intel platforms, IOMMU or AMD-Vi on AMD platforms.
- Enable access control services support where your server vendor exposes it, since assignment relies on devices being isolated from one another on the bus.
- Reapply the vendor’s recommended firmware profile for virtualisation hosts rather than setting options one at a time.
A DMA-capable device in the host, with no passthrough involved
You have this one if The host has no assigned devices at all and the stops continue. An external enclosure, dock, capture card or add-in controller is present.
- Remove non-essential expansion and external devices, then reintroduce them one at a time.
- Update the firmware of any storage or network controller that remains.
- If one device reproduces the fault reliably, replace it. A device that violates its address mappings is not something you configure your way around.
The guest has too little memory mapped I/O space
You have this one if A GPU or other device that exposes large memory regions fails to start or stops the host, on a virtual machine that starts normally without it.
- Set the stop action to turn off rather than save state:
Set-VM -Name <vm> -AutomaticStopAction TurnOff, and use static rather than dynamic memory. - Enlarge the mapped I/O space with
Set-VM -Name <vm> -GuestControlledCacheTypes $true -LowMemoryMappedIoSpace 3Gb -HighMemoryMappedIoSpace 33280Mb, adjusting the high value to what the device vendor specifies. - Start the machine and confirm the device enumerates in the guest before putting load on it.
The values a device needs come from its vendor. Guessing high wastes address space; guessing low reproduces the fault.
Full reference
The four codes you may see together, and what each one blames
| Stop code | Name | Who it points at |
|---|---|---|
| 0x00000158 | ILLEGAL_IOMMU_PAGE_FAULT | The fault arrived tagged with an invalid ASID. Parameters give the ASID, the number in use, the owning process and the reference count |
| 0x00000159 | HAL_ILLEGAL_IOMMU_PAGE_FAULT | A driver left requests in flight while the ASID was being freed. The documentation names the driver as responsible |
| 0x000001D9 | HAL_IOMMU_INTERNAL_ERROR | An internal error in the HAL IOMMU library. Parameter 1 says which operation failed: deleting a domain, unmapping pages or leaving a domain |
| 0x000001E9 | ILLEGAL_ATS_INITIALIZATION | A driver tried to enable Address Translation Services on a device already enabled for Shared Virtual Memory |
| 0x00020001 | HYPERVISOR_ERROR | The hypervisor hit a fatal error. All four parameters are reserved, so the dump is the only useful evidence |
Commands worth having open on the host
| Command | What it does |
|---|---|
Get-VMHostAssignableDevice |
Lists devices available for assignment, filterable by instance path or location path |
Get-VM | Get-VMAssignableDevice |
Shows which devices are assigned to which virtual machines |
Dismount-VMHostAssignableDevice -LocationPath "<path>" |
Takes a device away from the host so it can be assigned. -Force skips the warning where no mitigation driver is present |
Add-VMAssignableDevice -LocationPath "<path>" -VMName <vm> |
Assigns the dismounted device to a virtual machine |
Remove-VMAssignableDevice -LocationPath "<path>" -VMName <vm> |
Takes the device back from the virtual machine |
Mount-VMHostAssignableDevice -LocationPath "<path>" |
Returns the device to the host |
Location paths look like PCIROOT(20)#PCI(0300)#PCI(0000). Take them from Get-VMHostAssignableDevice rather than typing them, because a wrong path silently addresses a different device.
Using Driver Verifier without losing the host
Verifier will find a driver misusing DMA faster than waiting for the next stop, and it will also stop a host booting if the driver it is watching misbehaves during startup. Point it at a named list of third-party drivers only, never at everything, and only outside production hours.
verifier /standard /driver vendor1.sys vendor2.sys
verifier /querysettings
rem to switch it off again
verifier /reset
verifier /reset clears all Driver Verifier settings so that nothing is verified after the next boot. Know how you would reach a recovery console to run it before you enable verification on a host you cannot afford to lose.
Memory mapped I/O sizing for large devices
| Setting | Purpose |
|---|---|
-AutomaticStopAction TurnOff |
Required by device assignment; save state is not available to a machine holding an assigned device |
-GuestControlledCacheTypes $true |
Lets the guest control cache types, which enables write-combining on the processor |
-LowMemoryMappedIoSpace |
The 32-bit mapped I/O window, documented with 3Gb as the worked example |
-HighMemoryMappedIoSpace |
The above-32-bit window, documented with 33280Mb as the worked example |
When nothing is assigned and it still stops
- Read the driver named in the dump before changing anything. For 0x000001D9 the failed operation in parameter 1 tells you whether the HAL was deleting a domain, unmapping pages or leaving one, which narrows it to a driver’s teardown path.
- Check whether virtualisation-based security is enabled. It uses the IOMMU too, so a host with no virtual machines at all can still meet these codes.
- Update the platform firmware, the management controller and the firmware of every storage and network controller. Match driver versions to the firmware the vendor tested them against.
- Where the crashes correlate with activity inside a guest rather than with the host, suspect the guest driver even though the host is the machine that stopped.
- 0x000001E9 is narrow and specific: a driver enabled ATS on a device already set up for Shared Virtual Memory. That is a driver defect with a named device object in parameter 1, and it goes back to the vendor rather than into a configuration change.
Every code this article covers
| Code | What it points at | Source |
|---|---|---|
0x00000158 |
ILLEGAL_IOMMU_PAGE_FAULT: the IOMMU delivered a page fault packet for an invalid address space identifier, which is unsafe because that identifier may already have been reused | Microsoft Learn |
0x00000159 |
HAL_ILLEGAL_IOMMU_PAGE_FAULT: a page fault arrived against an address space identifier that was being freed, because a driver did not complete its in-flight requests first | Microsoft Learn |
0x00020001 |
HYPERVISOR_ERROR: the hypervisor encountered a fatal error. All four parameters are reserved | Microsoft Learn |
0x000001D9 |
HAL_IOMMU_INTERNAL_ERROR: an internal error in the HAL IOMMU library, with parameter 1 naming the operation that failed | Microsoft Learn |
0x000001E9 |
ILLEGAL_ATS_INITIALIZATION: a driver tried to enable Address Translation Services on a device already enabled for Shared Virtual Memory | Microsoft Learn |
Confirm the fix worked
- Restore the assignment and run the host through a full working day, including the workload that used to trigger the stop.
- Confirm no new dump has appeared in the Windows folder or its Minidump subfolder.
- Check the System log for any new bugcheck event and read its stop-code parameters if one appears.
- Confirm the assigned device enumerates cleanly inside the guest and survives a sustained load test.
- Run
verifier /querysettingsand confirm no drivers are left under verification before handing the host back.
Questions people ask about this
Can I disable VT-d or the IOMMU to stop the crashes?
You can stop them that way and you should not. Discrete Device Assignment requires the IOMMU, so switching it off removes the feature you were using, and on any host it removes the isolation that stops a misbehaving device reaching arbitrary memory.
How do I tell 0x158 and 0x159 apart in practice?
By who is at fault. 0x158 says the fault packet carried an identifier the kernel cannot trust, which is a platform and device question. 0x159 says the identifier was being torn down while requests were still outstanding, and the documentation puts that on a driver. If you are getting 0x159, chase the driver named in the dump.
Can I assign any graphics card to a virtual machine?
No. The device has to expose the isolation and reset capabilities assignment depends on, the platform has to support it, and the vendor has to support that configuration. Run Microsoft’s survey script before you plan around a card.
Do I need Datacenter edition for device assignment?
Device assignment is a Hyper-V capability rather than something edition licensing gates. What the edition decides is how many virtual instances you are licensed to run, so that question is driven by density, not by this feature.
Does fixing this cost anything?
Not in software. The work is firmware updates, driver alignment and configuration, all of which come from your hardware vendor at no charge. If a device turns out to be unsuitable for assignment, the cost is replacing that device.
