mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
iommu/vt-d: Setup pasid entries for iova over first level
Intel VT-d in scalable mode supports two types of page tables for IOVA translation: first level and second level. The IOMMU driver can choose one from both for IOVA translation according to the use case. This sets up the pasid entry if a domain is selected to use the first-level page table for iova translation. Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> Signed-off-by: Joerg Roedel <jroedel@suse.de>
This commit is contained in:
parent
87208f22a4
commit
ddf09b6d43
2 changed files with 62 additions and 11 deletions
|
@ -34,10 +34,13 @@
|
|||
#define VTD_STRIDE_SHIFT (9)
|
||||
#define VTD_STRIDE_MASK (((u64)-1) << VTD_STRIDE_SHIFT)
|
||||
|
||||
#define DMA_PTE_READ (1)
|
||||
#define DMA_PTE_WRITE (2)
|
||||
#define DMA_PTE_LARGE_PAGE (1 << 7)
|
||||
#define DMA_PTE_SNP (1 << 11)
|
||||
#define DMA_PTE_READ BIT_ULL(0)
|
||||
#define DMA_PTE_WRITE BIT_ULL(1)
|
||||
#define DMA_PTE_LARGE_PAGE BIT_ULL(7)
|
||||
#define DMA_PTE_SNP BIT_ULL(11)
|
||||
|
||||
#define DMA_FL_PTE_PRESENT BIT_ULL(0)
|
||||
#define DMA_FL_PTE_XD BIT_ULL(63)
|
||||
|
||||
#define CONTEXT_TT_MULTI_LEVEL 0
|
||||
#define CONTEXT_TT_DEV_IOTLB 1
|
||||
|
@ -610,10 +613,11 @@ static inline void dma_clear_pte(struct dma_pte *pte)
|
|||
static inline u64 dma_pte_addr(struct dma_pte *pte)
|
||||
{
|
||||
#ifdef CONFIG_64BIT
|
||||
return pte->val & VTD_PAGE_MASK;
|
||||
return pte->val & VTD_PAGE_MASK & (~DMA_FL_PTE_XD);
|
||||
#else
|
||||
/* Must have a full atomic 64-bit read */
|
||||
return __cmpxchg64(&pte->val, 0ULL, 0ULL) & VTD_PAGE_MASK;
|
||||
return __cmpxchg64(&pte->val, 0ULL, 0ULL) &
|
||||
VTD_PAGE_MASK & (~DMA_FL_PTE_XD);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue