1/* SPDX-License-Identifier: MIT */
2/*
3 * Copyright © 2025 Intel Corporation
4 */
5
6#ifndef _XE_VRAM_TYPES_H_
7#define _XE_VRAM_TYPES_H_
8
9#if IS_ENABLED(CONFIG_DRM_XE_PAGEMAP)
10#include <drm/drm_pagemap.h>
11#endif
12
13#include "xe_ttm_vram_mgr_types.h"
14
15struct xe_device;
16struct xe_migrate;
17
18/**
19 * struct xe_vram_region - memory region structure
20 * This is used to describe a memory region in xe
21 * device, such as HBM memory or CXL extension memory.
22 */
23struct xe_vram_region {
24 /** @xe: Back pointer to xe device */
25 struct xe_device *xe;
26 /**
27 * @id: VRAM region instance id
28 *
29 * The value should be unique for VRAM region.
30 */
31 u8 id;
32 /** @io_start: IO start address of this VRAM instance */
33 resource_size_t io_start;
34 /**
35 * @io_size: IO size of this VRAM instance
36 *
37 * This represents how much of this VRAM we can access
38 * via the CPU through the VRAM BAR. This can be smaller
39 * than @usable_size, in which case only part of VRAM is CPU
40 * accessible (typically the first 256M). This
41 * configuration is known as small-bar.
42 */
43 resource_size_t io_size;
44 /** @dpa_base: This memory regions's DPA (device physical address) base */
45 resource_size_t dpa_base;
46 /**
47 * @usable_size: usable size of VRAM
48 *
49 * Usable size of VRAM excluding reserved portions
50 * (e.g stolen mem)
51 */
52 resource_size_t usable_size;
53 /**
54 * @actual_physical_size: Actual VRAM size
55 *
56 * Actual VRAM size including reserved portions
57 * (e.g stolen mem)
58 */
59 resource_size_t actual_physical_size;
60 /** @mapping: pointer to VRAM mappable space */
61 void __iomem *mapping;
62 /** @ttm: VRAM TTM manager */
63 struct xe_ttm_vram_mgr ttm;
64 /** @placement: TTM placement dedicated for this region */
65 u32 placement;
66#if IS_ENABLED(CONFIG_DRM_XE_PAGEMAP)
67 /** @migrate: Back pointer to migrate */
68 struct xe_migrate *migrate;
69 /** @pagemap: Used to remap device memory as ZONE_DEVICE */
70 struct dev_pagemap pagemap;
71 /**
72 * @dpagemap: The struct drm_pagemap of the ZONE_DEVICE memory
73 * pages of this tile.
74 */
75 struct drm_pagemap dpagemap;
76 /**
77 * @hpa_base: base host physical address
78 *
79 * This is generated when remap device memory as ZONE_DEVICE
80 */
81 resource_size_t hpa_base;
82#endif
83};
84
85#endif
86

source code of linux/drivers/gpu/drm/xe/xe_vram_types.h