>-----Original Message----- >From: CLEMENT MATHIEU--DRIF <clement.mathieu--d...@eviden.com> >Subject: [PATCH ats_vtd v1 07/24] memory: add permissions in >IOMMUAccessFlags > >This will be necessary for devices implementing ATS. >We also define a new macro IOMMU_ACCESS_FLAG_FULL in addition to >IOMMU_ACCESS_FLAG to support more access flags. >IOMMU_ACCESS_FLAG is kept for convenience and backward compatibility. > >Here are the flags added (defined by the PCIe 5 specification) : > - Execute Requested > - Privileged Mode Requested > - Global > - Untranslated Only > >IOMMU_ACCESS_FLAG sets the additional flags to 0 > >Signed-off-by: Clément Mathieu--Drif <clement.mathieu--d...@eviden.com> >--- > include/exec/memory.h | 33 ++++++++++++++++++++++++++------- > 1 file changed, 26 insertions(+), 7 deletions(-) > >diff --git a/include/exec/memory.h b/include/exec/memory.h >index 8626a355b3..304504de02 100644 >--- a/include/exec/memory.h >+++ b/include/exec/memory.h >@@ -110,22 +110,41 @@ struct MemoryRegionSection { > > typedef struct IOMMUTLBEntry IOMMUTLBEntry; > >-/* See address_space_translate: bit 0 is read, bit 1 is write. */ >+/* >+ * See address_space_translate: >+ * - bit 0 : read >+ * - bit 1 : write >+ * - bit 2 : exec >+ * - bit 3 : priv >+ * - bit 4 : global >+ * - bit 5 : untranslated only >+ */ > typedef enum { > IOMMU_NONE = 0, > IOMMU_RO = 1, > IOMMU_WO = 2, > IOMMU_RW = 3, >+ IOMMU_EXEC = 4, >+ IOMMU_PRIV = 8, >+ IOMMU_GLOBAL = 16, >+ IOMMU_UNTRANSLATED_ONLY = 32, > } IOMMUAccessFlags; > >-#define IOMMU_ACCESS_FLAG(r, w) (((r) ? IOMMU_RO : 0) | ((w) ? >IOMMU_WO : 0)) >+#define IOMMU_ACCESS_FLAG(r, w) (((r) ? IOMMU_RO : 0) | \ >+ ((w) ? IOMMU_WO : 0)) >+#define IOMMU_ACCESS_FLAG_FULL(r, w, x, p, g, uo) \ >+ (IOMMU_ACCESS_FLAG(r, w) | \ >+ ((x) ? IOMMU_EXEC : 0) | \ >+ ((p) ? IOMMU_PRIV : 0) | \ >+ ((g) ? IOMMU_GLOBAL : 0) | \ >+ ((uo) ? IOMMU_UNTRANSLATED_ONLY : 0)) > > struct IOMMUTLBEntry { >- AddressSpace *target_as; >- hwaddr iova; >- hwaddr translated_addr; >- hwaddr addr_mask; /* 0xfff = 4k translation */ >- IOMMUAccessFlags perm; >+ AddressSpace *target_as; >+ hwaddr iova; >+ hwaddr translated_addr; >+ hwaddr addr_mask; /* 0xfff = 4k translation */ >+ IOMMUAccessFlags perm; > };
Any reason for this change? Thanks Zhenzhong