• C
    x86/amd-iommu: Pt mode fix for domain_destroy · 04e856c0
    Chris Wright 提交于
    After a guest is shutdown, assigned devices are not properly
    returned to the pt domain.  This can leave the device using
    stale cached IOMMU data, and result in a non-functional
    device after it's re-bound to the host driver.  For example,
    I see this upon rebinding:
    
     AMD-Vi: Event logged [IO_PAGE_FAULT device=02:00.0 domain=0x0000 address=0x000000007e2a8000 flags=0x0050]
     AMD-Vi: Event logged [IO_PAGE_FAULT device=02:00.0 domain=0x0000 address=0x000000007e2a8040 flags=0x0050]
     AMD-Vi: Event logged [IO_PAGE_FAULT device=02:00.0 domain=0x0000 address=0x000000007e2a8080 flags=0x0050]
     AMD-Vi: Event logged [IO_PAGE_FAULT device=02:00.0 domain=0x0000 address=0x000000007e2a80c0 flags=0x0050]
     0000:02:00.0: eth2: Detected Hardware Unit Hang:
     ...
    
    The amd_iommu_destroy_domain() function calls do_detach()
    which doesn't reattach the pt domain to the device.
    Use __detach_device() instead.
    
    Cc: stable@kernel.org
    Signed-off-by: NChris Wright <chrisw@sous-sol.org>
    Signed-off-by: NJoerg Roedel <joerg.roedel@amd.com>
    04e856c0
amd_iommu.c 58.7 KB