@samitouri / QOSamiQemu / commits / a6e6a91c2a

intel_iommu: Do not report recoverable faults to host

Signed-off-by: Clement Mathieu--Drif <clement.mathieu--drif@eviden.com> Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-Id: <20260208082252.288-1-clement.mathieu--drif@eviden.com>

Clement Mathieu--Drif committed Feb 8, 2026 at 08:22 UTC a6e6a91c2ad1d5c9a770997a2ac3aad46a8e418c
1 file changed +24 -2
hw/i386/intel_iommu.c
+24 -2
@@ -1857,6 +1857,21 @@ static const bool vtd_qualified_faults[] = {
1857 [VTD_FR_MAX] = false,
1858 };
1859
1860 +static const bool vtd_recoverable_faults[] = {
1861 + [VTD_FR_WRITE] = true,
1862 + [VTD_FR_READ] = true,
1863 + [VTD_FR_PASID_DIR_ENTRY_P] = true,
1864 + [VTD_FR_PASID_ENTRY_P] = true,
1865 + [VTD_FR_FS_PAGING_ENTRY_INV] = true,
1866 + [VTD_FR_FS_PAGING_ENTRY_P] = true,
1867 + [VTD_FR_FS_PAGING_ENTRY_RSVD] = true,
1868 + [VTD_FR_PASID_ENTRY_FSPTPTR_INV] = true,
1869 + [VTD_FR_FS_NON_CANONICAL] = true,
1870 + [VTD_FR_FS_PAGING_ENTRY_US] = true,
1871 + [VTD_FR_SM_WRITE] = true,
1872 + [VTD_FR_MAX] = false,
1873 +};
1874 +
1875 /* To see if a fault condition is "qualified", which is reported to software
1876 * only if the FPD field in the context-entry used to process the faulting
1877 * request is 0.
@@ -1866,6 +1881,11 @@ static inline bool vtd_is_qualified_fault(VTDFaultReason fault)
1881 return vtd_qualified_faults[fault];
1882 }
1883
1884 +static inline bool vtd_is_recoverable_fault(VTDFaultReason fault, int iommu_idx)
1885 +{
1886 + return iommu_idx == VTD_IDX_ATS && vtd_recoverable_faults[fault];
1887 +}
1888 +
1889 static inline bool vtd_is_interrupt_addr(hwaddr addr)
1890 {
1891 return VTD_INTERRUPT_ADDR_FIRST <= addr && addr <= VTD_INTERRUPT_ADDR_LAST;
@@ -2237,8 +2257,10 @@ static bool vtd_do_iommu_translate(VTDAddressSpace *vtd_as, PCIBus *bus,
2257 }
2258
2259 if (ret_fr) {
2240 - vtd_report_fault(s, -ret_fr, is_fpd_set, source_id,
2241 - addr, is_write, pasid != PCI_NO_PASID, pasid);
2260 + if (!vtd_is_recoverable_fault(-ret_fr, iommu_idx)) {
2261 + vtd_report_fault(s, -ret_fr, is_fpd_set, source_id,
2262 + addr, is_write, pasid != PCI_NO_PASID, pasid);
2263 + }
2264 goto error;
2265 }
2266