1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* Copyright (C) 2013--2024 Intel Corporation */
10 #include <linux/list.h>
11 #include <linux/spinlock_types.h>
12 #include <linux/types.h>
16 struct ipu6_hw_variants
;
18 struct ipu6_mmu_info
{
28 u32 dummy_page_pteval
;
30 dma_addr_t aperture_start
;
31 dma_addr_t aperture_end
;
32 unsigned long pgsize_bitmap
;
34 spinlock_t lock
; /* Serialize access to users */
35 struct ipu6_dma_mapping
*dmap
;
39 struct list_head node
;
41 struct ipu6_mmu_hw
*mmu_hw
;
48 struct ipu6_dma_mapping
*dmap
;
49 struct list_head vma_list
;
51 struct page
*trash_page
;
52 dma_addr_t pci_trash_page
; /* IOVA from PCI DMA services (parent) */
53 dma_addr_t iova_trash_page
; /* IOVA for IPU6 child nodes to use */
56 spinlock_t ready_lock
; /* Serialize access to bool ready */
58 void (*tlb_invalidate
)(struct ipu6_mmu
*mmu
);
61 struct ipu6_mmu
*ipu6_mmu_init(struct device
*dev
,
62 void __iomem
*base
, int mmid
,
63 const struct ipu6_hw_variants
*hw
);
64 void ipu6_mmu_cleanup(struct ipu6_mmu
*mmu
);
65 int ipu6_mmu_hw_init(struct ipu6_mmu
*mmu
);
66 void ipu6_mmu_hw_cleanup(struct ipu6_mmu
*mmu
);
67 int ipu6_mmu_map(struct ipu6_mmu_info
*mmu_info
, unsigned long iova
,
68 phys_addr_t paddr
, size_t size
);
69 void ipu6_mmu_unmap(struct ipu6_mmu_info
*mmu_info
, unsigned long iova
,
71 phys_addr_t
ipu6_mmu_iova_to_phys(struct ipu6_mmu_info
*mmu_info
,