Skip to content

Commit 4f2ed18

Browse files
LuBaolujoergroedel
authored andcommitted
iommu/vt-d: Move page table helpers into header
So that they could also be used in other source files. Cc: Ashok Raj <ashok.raj@intel.com> Cc: Jacob Pan <jacob.jun.pan@linux.intel.com> Cc: Kevin Tian <kevin.tian@intel.com> Cc: Liu Yi L <yi.l.liu@intel.com> Cc: Sanjay Kumar <sanjay.k.kumar@intel.com> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> Reviewed-by: Ashok Raj <ashok.raj@intel.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent 0bbeb01 commit 4f2ed18

File tree

2 files changed

+43
-43
lines changed

2 files changed

+43
-43
lines changed

drivers/iommu/intel-iommu.c

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -290,49 +290,6 @@ static inline void context_clear_entry(struct context_entry *context)
290290
context->hi = 0;
291291
}
292292

293-
/*
294-
* 0: readable
295-
* 1: writable
296-
* 2-6: reserved
297-
* 7: super page
298-
* 8-10: available
299-
* 11: snoop behavior
300-
* 12-63: Host physcial address
301-
*/
302-
struct dma_pte {
303-
u64 val;
304-
};
305-
306-
static inline void dma_clear_pte(struct dma_pte *pte)
307-
{
308-
pte->val = 0;
309-
}
310-
311-
static inline u64 dma_pte_addr(struct dma_pte *pte)
312-
{
313-
#ifdef CONFIG_64BIT
314-
return pte->val & VTD_PAGE_MASK;
315-
#else
316-
/* Must have a full atomic 64-bit read */
317-
return __cmpxchg64(&pte->val, 0ULL, 0ULL) & VTD_PAGE_MASK;
318-
#endif
319-
}
320-
321-
static inline bool dma_pte_present(struct dma_pte *pte)
322-
{
323-
return (pte->val & 3) != 0;
324-
}
325-
326-
static inline bool dma_pte_superpage(struct dma_pte *pte)
327-
{
328-
return (pte->val & DMA_PTE_LARGE_PAGE);
329-
}
330-
331-
static inline int first_pte_in_page(struct dma_pte *pte)
332-
{
333-
return !((unsigned long)pte & ~VTD_PAGE_MASK);
334-
}
335-
336293
/*
337294
* This domain is a statically identity mapping domain.
338295
* 1. This domain creats a static 1:1 mapping to all usable memory.

include/linux/intel-iommu.h

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,49 @@ static inline void __iommu_flush_cache(
590590
clflush_cache_range(addr, size);
591591
}
592592

593+
/*
594+
* 0: readable
595+
* 1: writable
596+
* 2-6: reserved
597+
* 7: super page
598+
* 8-10: available
599+
* 11: snoop behavior
600+
* 12-63: Host physcial address
601+
*/
602+
struct dma_pte {
603+
u64 val;
604+
};
605+
606+
static inline void dma_clear_pte(struct dma_pte *pte)
607+
{
608+
pte->val = 0;
609+
}
610+
611+
static inline u64 dma_pte_addr(struct dma_pte *pte)
612+
{
613+
#ifdef CONFIG_64BIT
614+
return pte->val & VTD_PAGE_MASK;
615+
#else
616+
/* Must have a full atomic 64-bit read */
617+
return __cmpxchg64(&pte->val, 0ULL, 0ULL) & VTD_PAGE_MASK;
618+
#endif
619+
}
620+
621+
static inline bool dma_pte_present(struct dma_pte *pte)
622+
{
623+
return (pte->val & 3) != 0;
624+
}
625+
626+
static inline bool dma_pte_superpage(struct dma_pte *pte)
627+
{
628+
return (pte->val & DMA_PTE_LARGE_PAGE);
629+
}
630+
631+
static inline int first_pte_in_page(struct dma_pte *pte)
632+
{
633+
return !((unsigned long)pte & ~VTD_PAGE_MASK);
634+
}
635+
593636
extern struct dmar_drhd_unit * dmar_find_matched_drhd_unit(struct pci_dev *dev);
594637
extern int dmar_find_matched_atsr_unit(struct pci_dev *dev);
595638

0 commit comments

Comments
 (0)