|
XenevaOS
|
#include <linux/bug.h>#include <linux/rbtree.h>#include <linux/limits.h>#include <linux/mm_types.h>#include <linux/list.h>#include <linux/spinlock.h>#include <linux/bitops.h>#include <linux/types.h>

Go to the source code of this file.
Classes | |
| struct | drm_mm_node |
| struct | drm_mm |
| struct | drm_mm_scan |
Macros | |
| #define | DRM_MM_BUG_ON(expr) BUILD_BUG_ON_INVALID(expr) |
| #define | DRM_MM_NODE_ALLOCATED_BIT 0 |
| #define | DRM_MM_NODE_SCANNED_BIT 1 |
| #define | drm_mm_nodes(mm) (&(mm)->head_node.node_list) |
| #define | drm_mm_for_each_node(entry, mm) list_for_each_entry(entry, drm_mm_nodes(mm), node_list) |
| #define | drm_mm_for_each_node_safe(entry, next, mm) list_for_each_entry_safe(entry, next, drm_mm_nodes(mm), node_list) |
| #define | drm_mm_for_each_hole(pos, mm, hole_start, hole_end) |
| #define | drm_mm_for_each_node_in_range(node__, mm__, start__, end__) |
Enumerations | |
| enum | drm_mm_insert_mode { DRM_MM_INSERT_BEST = 0 , DRM_MM_INSERT_LOW , DRM_MM_INSERT_HIGH , DRM_MM_INSERT_EVICT , DRM_MM_INSERT_ONCE = BIT(31) , DRM_MM_INSERT_HIGHEST = DRM_MM_INSERT_HIGH | DRM_MM_INSERT_ONCE , DRM_MM_INSERT_LOWEST = DRM_MM_INSERT_LOW | DRM_MM_INSERT_ONCE } |
Functions | |
| int | drm_mm_reserve_node (struct drm_mm *mm, struct drm_mm_node *node) |
| int | drm_mm_insert_node_in_range (struct drm_mm *mm, struct drm_mm_node *node, u64 size, u64 alignment, unsigned long color, u64 start, u64 end, enum drm_mm_insert_mode mode) |
| void | drm_mm_remove_node (struct drm_mm_node *node) |
| void | drm_mm_init (struct drm_mm *mm, u64 start, u64 size) |
| void | drm_mm_takedown (struct drm_mm *mm) |
| struct drm_mm_node * | __drm_mm_interval_first (const struct drm_mm *mm, u64 start, u64 last) |
| void | drm_mm_scan_init_with_range (struct drm_mm_scan *scan, struct drm_mm *mm, u64 size, u64 alignment, unsigned long color, u64 start, u64 end, enum drm_mm_insert_mode mode) |
| bool | drm_mm_scan_add_block (struct drm_mm_scan *scan, struct drm_mm_node *node) |
| bool | drm_mm_scan_remove_block (struct drm_mm_scan *scan, struct drm_mm_node *node) |
| struct drm_mm_node * | drm_mm_scan_color_evict (struct drm_mm_scan *scan) |
| void | drm_mm_print (const struct drm_mm *mm, struct drm_printer *p) |
| #define DRM_MM_BUG_ON | ( | expr | ) | BUILD_BUG_ON_INVALID(expr) |
| #define drm_mm_for_each_hole | ( | pos, | |
| mm, | |||
| hole_start, | |||
| hole_end | |||
| ) |
drm_mm_for_each_hole - iterator to walk over all holes @pos: &drm_mm_node used internally to track progress @mm: &drm_mm allocator to walk @hole_start: ulong variable to assign the hole start to on each iteration @hole_end: ulong variable to assign the hole end to on each iteration
This iterator walks over all holes in the range allocator. It is implemented with list_for_each(), so not save against removal of elements. @entry is used internally and will not reflect a real drm_mm_node for the very first hole. Hence users of this iterator may not access it.
Implementation Note: We need to inline list_for_each_entry in order to be able to set hole_start and hole_end on each iteration while keeping the macro sane.
| #define drm_mm_for_each_node | ( | entry, | |
| mm | |||
| ) | list_for_each_entry(entry, drm_mm_nodes(mm), node_list) |
drm_mm_for_each_node - iterator to walk over all allocated nodes @entry: &struct drm_mm_node to assign to in each iteration step @mm: &drm_mm allocator to walk
This iterator walks over all nodes in the range allocator. It is implemented with list_for_each(), so not save against removal of elements.
| #define drm_mm_for_each_node_in_range | ( | node__, | |
| mm__, | |||
| start__, | |||
| end__ | |||
| ) |
drm_mm_for_each_node_in_range - iterator to walk over a range of allocated nodes @node__: drm_mm_node structure to assign to in each iteration step @mm__: drm_mm allocator to walk @start__: starting offset, the first node will overlap this @end__: ending offset, the last node will start before this (but may overlap)
This iterator walks over all nodes in the range allocator that lie between @start and @end. It is implemented similarly to list_for_each(), but using the internal interval tree to accelerate the search for the starting node, and so not safe against removal of elements. It assumes that @end is within (or is the upper limit of) the drm_mm allocator. If [@start, @end] are beyond the range of the drm_mm, the iterator may walk over the special unallocated &drm_mm.head_node, and may even continue indefinitely.
| #define drm_mm_for_each_node_safe | ( | entry, | |
| next, | |||
| mm | |||
| ) | list_for_each_entry_safe(entry, next, drm_mm_nodes(mm), node_list) |
drm_mm_for_each_node_safe - iterator to walk over all allocated nodes @entry: &struct drm_mm_node to assign to in each iteration step @next: &struct drm_mm_node to store the next step @mm: &drm_mm allocator to walk
This iterator walks over all nodes in the range allocator. It is implemented with list_for_each_safe(), so save against removal of elements.
| #define DRM_MM_NODE_ALLOCATED_BIT 0 |
| #define DRM_MM_NODE_SCANNED_BIT 1 |
| #define drm_mm_nodes | ( | mm | ) | (&(mm)->head_node.node_list) |
drm_mm_nodes - list of nodes under the drm_mm range manager @mm: the struct drm_mm range manager
As the drm_mm range manager hides its node_list deep with its structure, extracting it looks painful and repetitive. This is not expected to be used outside of the drm_mm_for_each_node() macros and similar internal functions.
Returns: The node list, may be empty.
| enum drm_mm_insert_mode |
enum drm_mm_insert_mode - control search and allocation behaviour
The &struct drm_mm range manager supports finding a suitable modes using a number of search trees. These trees are oranised by size, by address and in most recent eviction order. This allows the user to find either the smallest hole to reuse, the lowest or highest address to reuse, or simply reuse the most recent eviction that fits. When allocating the &drm_mm_node from within the hole, the &drm_mm_insert_mode also dictate whether to allocate the lowest matching address or the highest.
| Enumerator | |
|---|---|
| DRM_MM_INSERT_BEST | @DRM_MM_INSERT_BEST: Search for the smallest hole (within the search range) that fits the desired node. Allocates the node from the bottom of the found hole. |
| DRM_MM_INSERT_LOW | @DRM_MM_INSERT_LOW: Search for the lowest hole (address closest to 0, within the search range) that fits the desired node. Allocates the node from the bottom of the found hole. |
| DRM_MM_INSERT_HIGH | @DRM_MM_INSERT_HIGH: Search for the highest hole (address closest to U64_MAX, within the search range) that fits the desired node. Allocates the node from the top of the found hole. The specified alignment for the node is applied to the base of the node (&drm_mm_node.start). |
| DRM_MM_INSERT_EVICT | @DRM_MM_INSERT_EVICT: Search for the most recently evicted hole (within the search range) that fits the desired node. This is appropriate for use immediately after performing an eviction scan (see drm_mm_scan_init()) and removing the selected nodes to form a hole. Allocates the node from the bottom of the found hole. |
| DRM_MM_INSERT_ONCE | @DRM_MM_INSERT_ONCE: Only check the first hole for suitablity and report -ENOSPC immediately otherwise, rather than check every hole until a suitable one is found. Can only be used in conjunction with another search method such as DRM_MM_INSERT_HIGH or DRM_MM_INSERT_LOW. |
| DRM_MM_INSERT_HIGHEST | @DRM_MM_INSERT_HIGHEST: Only check the highest hole (the hole with the largest address) and insert the node at the top of the hole or report -ENOSPC if unsuitable. Does not search all holes. |
| DRM_MM_INSERT_LOWEST | @DRM_MM_INSERT_LOWEST: Only check the lowest hole (the hole with the smallest address) and insert the node at the bottom of the hole or report -ENOSPC if unsuitable. Does not search all holes. |
| struct drm_mm_node * __drm_mm_interval_first | ( | const struct drm_mm * | mm, |
| u64 | start, | ||
| u64 | last | ||
| ) |
| int drm_mm_insert_node_in_range | ( | struct drm_mm * | mm, |
| struct drm_mm_node * | node, | ||
| u64 | size, | ||
| u64 | alignment, | ||
| unsigned long | color, | ||
| u64 | start, | ||
| u64 | end, | ||
| enum drm_mm_insert_mode | mode | ||
| ) |
| void drm_mm_print | ( | const struct drm_mm * | mm, |
| struct drm_printer * | p | ||
| ) |
| void drm_mm_remove_node | ( | struct drm_mm_node * | node | ) |
| int drm_mm_reserve_node | ( | struct drm_mm * | mm, |
| struct drm_mm_node * | node | ||
| ) |
| bool drm_mm_scan_add_block | ( | struct drm_mm_scan * | scan, |
| struct drm_mm_node * | node | ||
| ) |
| struct drm_mm_node * drm_mm_scan_color_evict | ( | struct drm_mm_scan * | scan | ) |
| void drm_mm_scan_init_with_range | ( | struct drm_mm_scan * | scan, |
| struct drm_mm * | mm, | ||
| u64 | size, | ||
| u64 | alignment, | ||
| unsigned long | color, | ||
| u64 | start, | ||
| u64 | end, | ||
| enum drm_mm_insert_mode | mode | ||
| ) |
| bool drm_mm_scan_remove_block | ( | struct drm_mm_scan * | scan, |
| struct drm_mm_node * | node | ||
| ) |
| void drm_mm_takedown | ( | struct drm_mm * | mm | ) |