xref: /linux/drivers/gpu/drm/xe/xe_tile.h (revision c0d6f52f9b62479d61f8cd4faf9fb2f8bce6e301)
1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2023 Intel Corporation
4  */
5 
6 #ifndef _XE_TILE_H_
7 #define _XE_TILE_H_
8 
9 #include "xe_device_types.h"
10 
11 struct xe_pagemap;
12 struct xe_tile;
13 
14 int xe_tile_init_early(struct xe_tile *tile, struct xe_device *xe, u8 id);
15 int xe_tile_init_noalloc(struct xe_tile *tile);
16 int xe_tile_init(struct xe_tile *tile);
17 
18 int xe_tile_alloc_vram(struct xe_tile *tile);
19 
20 void xe_tile_migrate_wait(struct xe_tile *tile);
21 
22 static inline bool xe_tile_is_root(struct xe_tile *tile)
23 {
24 	return tile->id == 0;
25 }
26 
27 /**
28  * xe_tile_to_vr() - Return the struct xe_vram_region pointer from a
29  * struct xe_tile pointer
30  * @tile: Pointer to the struct xe_tile.
31  *
32  * Return: Pointer to the struct xe_vram_region embedded in *@tile.
33  */
34 static inline struct xe_vram_region *xe_tile_to_vr(struct xe_tile *tile)
35 {
36 	return tile->mem.vram;
37 }
38 
39 #if IS_ENABLED(CONFIG_DRM_XE_PAGEMAP)
40 struct drm_pagemap *xe_tile_local_pagemap(struct xe_tile *tile);
41 #else
42 static inline struct drm_pagemap *xe_tile_local_pagemap(struct xe_tile *tile)
43 {
44 	return NULL;
45 }
46 #endif
47 #endif
48