103d2ea139
Simplify and unify naming convention in MMU600 page tables configuration. All DMA addresses in page tables directly accessed by VPU are called with _dma sufix and all CPU pointers to those page tables have _ptr sufix. Base pointers used to do a page walk on the CPU have corresponding names: pud_ptrs (pointers used to get access to PUD DMA) pmd_ptrs (pointers used to get access to PMD DMA) pte_ptrs (pointers used to get access to PTE DMA) with the following convention: u64 *pud_dma_ptr = pud_ptrs[pgd_idx]; *pud_dma_ptr = pud_dma; u64 *pmd_dma_ptr = pmd_ptrs[pgd_idx][pud_idx]; *pmd_dma_ptr = pmd_dma; u64 *pte_dma_ptr = pte_ptrs[pgd_idx][pud_idx][pmd_idx]; *pte_dma_ptr = pte_dma; On the way change to coherent dma allocation, _wc is only valid on ARM and was used by mistake. Signed-off-by: Karol Wachowski <karol.wachowski@linux.intel.com> Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com> Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com> Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230518131605.650622-5-stanislaw.gruszka@linux.intel.com
52 lines
1.6 KiB
C
52 lines
1.6 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Copyright (C) 2020-2023 Intel Corporation
|
|
*/
|
|
|
|
#ifndef __IVPU_MMU_CONTEXT_H__
|
|
#define __IVPU_MMU_CONTEXT_H__
|
|
|
|
#include <drm/drm_mm.h>
|
|
|
|
struct ivpu_device;
|
|
struct ivpu_file_priv;
|
|
struct ivpu_addr_range;
|
|
|
|
#define IVPU_MMU_PGTABLE_ENTRIES 512ull
|
|
|
|
struct ivpu_mmu_pgtable {
|
|
u64 ***pte_ptrs[IVPU_MMU_PGTABLE_ENTRIES];
|
|
u64 **pmd_ptrs[IVPU_MMU_PGTABLE_ENTRIES];
|
|
u64 *pud_ptrs[IVPU_MMU_PGTABLE_ENTRIES];
|
|
u64 *pgd_dma_ptr;
|
|
dma_addr_t pgd_dma;
|
|
};
|
|
|
|
struct ivpu_mmu_context {
|
|
struct mutex lock; /* protects: mm, pgtable, bo_list */
|
|
struct drm_mm mm;
|
|
struct ivpu_mmu_pgtable pgtable;
|
|
struct list_head bo_list;
|
|
u32 id;
|
|
};
|
|
|
|
int ivpu_mmu_global_context_init(struct ivpu_device *vdev);
|
|
void ivpu_mmu_global_context_fini(struct ivpu_device *vdev);
|
|
|
|
int ivpu_mmu_user_context_init(struct ivpu_device *vdev, struct ivpu_mmu_context *ctx, u32 ctx_id);
|
|
void ivpu_mmu_user_context_fini(struct ivpu_device *vdev, struct ivpu_mmu_context *ctx);
|
|
void ivpu_mmu_user_context_mark_invalid(struct ivpu_device *vdev, u32 ssid);
|
|
|
|
int ivpu_mmu_context_insert_node_locked(struct ivpu_mmu_context *ctx,
|
|
const struct ivpu_addr_range *range,
|
|
u64 size, struct drm_mm_node *node);
|
|
void ivpu_mmu_context_remove_node_locked(struct ivpu_mmu_context *ctx,
|
|
struct drm_mm_node *node);
|
|
|
|
int ivpu_mmu_context_map_sgt(struct ivpu_device *vdev, struct ivpu_mmu_context *ctx,
|
|
u64 vpu_addr, struct sg_table *sgt, bool llc_coherent);
|
|
void ivpu_mmu_context_unmap_sgt(struct ivpu_device *vdev, struct ivpu_mmu_context *ctx,
|
|
u64 vpu_addr, struct sg_table *sgt);
|
|
|
|
#endif /* __IVPU_MMU_CONTEXT_H__ */
|