forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/gpu/drm/msm/msm_mmu.h
....@@ -1,18 +1,7 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * Copyright (C) 2013 Red Hat
34 * Author: Rob Clark <robdclark@gmail.com>
4
- *
5
- * This program is free software; you can redistribute it and/or modify it
6
- * under the terms of the GNU General Public License version 2 as published by
7
- * the Free Software Foundation.
8
- *
9
- * This program is distributed in the hope that it will be useful, but WITHOUT
10
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12
- * more details.
13
- *
14
- * You should have received a copy of the GNU General Public License along with
15
- * this program. If not, see <http://www.gnu.org/licenses/>.
165 */
176
187 #ifndef __MSM_MMU_H__
....@@ -21,13 +10,17 @@
2110 #include <linux/iommu.h>
2211
2312 struct msm_mmu_funcs {
24
- int (*attach)(struct msm_mmu *mmu, const char * const *names, int cnt);
25
- void (*detach)(struct msm_mmu *mmu, const char * const *names, int cnt);
13
+ void (*detach)(struct msm_mmu *mmu);
2614 int (*map)(struct msm_mmu *mmu, uint64_t iova, struct sg_table *sgt,
27
- unsigned len, int prot);
28
- int (*unmap)(struct msm_mmu *mmu, uint64_t iova, struct sg_table *sgt,
29
- unsigned len);
15
+ size_t len, int prot);
16
+ int (*unmap)(struct msm_mmu *mmu, uint64_t iova, size_t len);
3017 void (*destroy)(struct msm_mmu *mmu);
18
+};
19
+
20
+enum msm_mmu_type {
21
+ MSM_MMU_GPUMMU,
22
+ MSM_MMU_IOMMU,
23
+ MSM_MMU_IOMMU_PAGETABLE,
3124 };
3225
3326 struct msm_mmu {
....@@ -35,13 +28,15 @@
3528 struct device *dev;
3629 int (*handler)(void *arg, unsigned long iova, int flags);
3730 void *arg;
31
+ enum msm_mmu_type type;
3832 };
3933
4034 static inline void msm_mmu_init(struct msm_mmu *mmu, struct device *dev,
41
- const struct msm_mmu_funcs *funcs)
35
+ const struct msm_mmu_funcs *funcs, enum msm_mmu_type type)
4236 {
4337 mmu->dev = dev;
4438 mmu->funcs = funcs;
39
+ mmu->type = type;
4540 }
4641
4742 struct msm_mmu *msm_iommu_new(struct device *dev, struct iommu_domain *domain);
....@@ -54,4 +49,13 @@
5449 mmu->handler = handler;
5550 }
5651
52
+struct msm_mmu *msm_iommu_pagetable_create(struct msm_mmu *parent);
53
+
54
+void msm_gpummu_params(struct msm_mmu *mmu, dma_addr_t *pt_base,
55
+ dma_addr_t *tran_error);
56
+
57
+
58
+int msm_iommu_pagetable_params(struct msm_mmu *mmu, phys_addr_t *ttbr,
59
+ int *asid);
60
+
5761 #endif /* __MSM_MMU_H__ */