| 1 | /* |
| 2 | * General vIOMMU flags |
| 3 | * |
| 4 | * Copyright (C) 2026 Intel Corporation. |
| 5 | * |
| 6 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 7 | */ |
| 8 | |
| 9 | #ifndef HW_IOMMU_H |
| 10 | #define HW_IOMMU_H |
| 11 | |
| 12 | #include "qemu/bitops.h" |
| 13 | |
| 14 | /* |
| 15 | * Theoretical vIOMMU flags. Only determined by the vIOMMU device properties and |
| 16 | * independent on the actual host IOMMU capabilities they may depend on. Each |
| 17 | * flag can be an expectation or request to other sub-system or just a pure |
| 18 | * vIOMMU capability. vIOMMU can choose which flags to expose. |
| 19 | */ |
| 20 | enum viommu_flags { |
| 21 | /* vIOMMU needs nesting parent HWPT to create nested HWPT */ |
| 22 | VIOMMU_FLAG_WANT_NESTING_PARENT = BIT_ULL(0), |
| 23 | /* |
| 24 | * vIOMMU supports PASID capability, VFIO checks this flag and synthesize |
| 25 | * a PASID capability. |
| 26 | */ |
| 27 | VIOMMU_FLAG_PASID_SUPPORTED = BIT_ULL(1), |
| 28 | /* vIOMMU needs dirty tracking on the nesting parent HWPT for nested use */ |
| 29 | VIOMMU_FLAG_WANT_NESTING_DIRTY_TRACKING = BIT_ULL(2), |
| 30 | /* |
| 31 | * vIOMMU requests other sub-system like VFIO to create a HWPT that can be |
| 32 | * used with PASID attachment. VIOMMU_FLAG_PASID_SUPPORTED can't be used |
| 33 | * for this purpose as PASID attachment is needed by VTD IOMMU but not ARM |
| 34 | * SMMU. |
| 35 | */ |
| 36 | VIOMMU_FLAG_WANT_PASID_ATTACH = BIT_ULL(3), |
| 37 | }; |
| 38 | |
| 39 | /* Host IOMMU quirks. Extracted from host IOMMU capabilities */ |
| 40 | enum host_iommu_quirks { |
| 41 | HOST_IOMMU_QUIRK_NESTING_PARENT_BYPASS_RO = BIT_ULL(0), |
| 42 | }; |
| 43 | |
| 44 | /* ABI constant: IOMMU_NO_PASID must always be 0 (keep in sync with kernel) */ |
| 45 | #define IOMMU_NO_PASID 0 |
| 46 | |
| 47 | #endif /* HW_IOMMU_H */ |