1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /**************************************************************************
3 * Copyright (c) 2007-2011, Intel Corporation.
6 **************************************************************************/
11 struct psb_mmu_driver
{
12 /* protects driver- and pd structures. Always take in read mode
13 * before taking the page table spinlock.
15 struct rw_semaphore sem
;
17 /* protects page tables, directory tables and pt tables.
22 atomic_t needs_tlbflush
;
23 atomic_t
*msvdx_mmu_invaldc
;
24 struct psb_mmu_pd
*default_pd
;
28 unsigned long clflush_mask
;
30 struct drm_device
*dev
;
36 struct psb_mmu_pd
*pd
;
44 struct psb_mmu_driver
*driver
;
46 struct psb_mmu_pt
**tables
;
48 struct page
*dummy_pt
;
49 struct page
*dummy_page
;
55 extern struct psb_mmu_driver
*psb_mmu_driver_init(struct drm_device
*dev
,
58 atomic_t
*msvdx_mmu_invaldc
);
59 extern void psb_mmu_driver_takedown(struct psb_mmu_driver
*driver
);
60 extern struct psb_mmu_pd
*psb_mmu_get_default_pd(struct psb_mmu_driver
62 extern struct psb_mmu_pd
*psb_mmu_alloc_pd(struct psb_mmu_driver
*driver
,
65 extern void psb_mmu_free_pagedir(struct psb_mmu_pd
*pd
);
66 extern void psb_mmu_flush(struct psb_mmu_driver
*driver
);
67 extern void psb_mmu_remove_pfn_sequence(struct psb_mmu_pd
*pd
,
68 unsigned long address
,
70 extern int psb_mmu_insert_pfn_sequence(struct psb_mmu_pd
*pd
,
72 unsigned long address
,
73 uint32_t num_pages
, int type
);
74 extern int psb_mmu_virtual_to_pfn(struct psb_mmu_pd
*pd
, uint32_t virtual,
76 extern void psb_mmu_set_pd_context(struct psb_mmu_pd
*pd
, int hw_context
);
77 extern int psb_mmu_insert_pages(struct psb_mmu_pd
*pd
, struct page
**pages
,
78 unsigned long address
, uint32_t num_pages
,
79 uint32_t desired_tile_stride
,
80 uint32_t hw_tile_stride
, int type
);
81 extern void psb_mmu_remove_pages(struct psb_mmu_pd
*pd
,
82 unsigned long address
, uint32_t num_pages
,
83 uint32_t desired_tile_stride
,
84 uint32_t hw_tile_stride
);