575.51.02

This commit is contained in:
Bernhard Stoeckner
2025-04-17 19:35:38 +02:00
parent e8113f665d
commit 4159579888
1142 changed files with 309085 additions and 272273 deletions

View File

@@ -711,6 +711,12 @@ static uvm_va_range_device_p2p_t *uvm_va_range_device_p2p_find(uvm_va_space_t *v
return uvm_va_range_to_device_p2p(va_range);
}
// Returns true if this va_range can be mapped via the GMMU
static bool uvm_va_range_is_gmmu_mappable(uvm_va_range_t *va_range)
{
return va_range->type != UVM_VA_RANGE_TYPE_DEVICE_P2P;
}
static uvm_ext_gpu_map_t *uvm_ext_gpu_map_container(uvm_range_tree_node_t *node)
{
if (!node)
@@ -732,10 +738,17 @@ static uvm_ext_gpu_map_t *uvm_ext_gpu_map_container(uvm_range_tree_node_t *node)
// Returns the first va_range in the range [start, end], if any
uvm_va_range_t *uvm_va_space_iter_first(uvm_va_space_t *va_space, NvU64 start, NvU64 end);
// Returns the first va_range in [start, end] that is gmmu mappable
uvm_va_range_t *uvm_va_space_iter_gmmu_mappable_first(uvm_va_space_t *va_space, NvU64 start);
// Returns the va_range following the provided va_range in address order, if
// that va_range's start <= the provided end.
uvm_va_range_t *uvm_va_space_iter_next(uvm_va_range_t *va_range, NvU64 end);
// Returns the va_range preceding the provided va_range in address order, if
// that va_range's start >= the provided start.
uvm_va_range_t *uvm_va_space_iter_prev(uvm_va_range_t *va_range, NvU64 start);
// Like uvm_va_space_iter_next, but also returns NULL if the next va_range
// is not adjacent to the provided va_range.
static uvm_va_range_t *uvm_va_space_iter_next_contig(uvm_va_range_t *va_range, NvU64 end)
@@ -859,6 +872,30 @@ static uvm_va_range_managed_t *uvm_va_space_iter_managed_next_contig(uvm_va_rang
vma->vm_start, \
vma->vm_end - 1)
static uvm_va_range_t *uvm_va_range_gmmu_mappable_next(uvm_va_range_t *va_range)
{
for (va_range = uvm_va_space_iter_next(va_range, ~0ULL);
va_range;
va_range = uvm_va_space_iter_next(va_range, ~0ULL)) {
if (uvm_va_range_is_gmmu_mappable(va_range))
break;
}
return va_range;
}
static uvm_va_range_t *uvm_va_range_gmmu_mappable_prev(uvm_va_range_t *va_range)
{
for (va_range = uvm_va_space_iter_prev(va_range, 0ULL);
va_range;
va_range = uvm_va_space_iter_prev(va_range, 0ULL)) {
if (uvm_va_range_is_gmmu_mappable(va_range))
break;
}
return va_range;
}
// Only call this if you're sure that either:
// 1) You have a reference on the vma's vm_mm and that vma->vm_mm's mmap_lock is
// held; or