535.43.02

This commit is contained in:
Andy Ritger
2023-05-30 10:11:36 -07:00
parent 6dd092ddb7
commit eb5c7665a1
1403 changed files with 295367 additions and 86235 deletions

View File

@@ -100,6 +100,22 @@ typedef enum
// It is duplicated because we do not want to expose it as an API.
static uvm_pmm_gpu_memory_type_t pmm_squash_memory_type(uvm_parent_gpu_t *parent_gpu, uvm_pmm_gpu_memory_type_t type)
{
if (uvm_conf_computing_mode_enabled_parent(parent_gpu))
return type;
// Enforce the contract that when the Confidential Computing feature is
// disabled, all user types are alike, as well as all kernel types,
// respectively. See uvm_pmm_gpu_memory_type_t.
switch (type) {
case UVM_PMM_GPU_MEMORY_TYPE_USER: // Alias UVM_PMM_GPU_MEMORY_TYPE_USER_PROTECTED
case UVM_PMM_GPU_MEMORY_TYPE_USER_UNPROTECTED:
return UVM_PMM_GPU_MEMORY_TYPE_USER;
case UVM_PMM_GPU_MEMORY_TYPE_KERNEL: // Alias UVM_PMM_GPU_MEMORY_TYPE_KERNEL_PROTECTED
case UVM_PMM_GPU_MEMORY_TYPE_KERNEL_UNPROTECTED:
return UVM_PMM_GPU_MEMORY_TYPE_KERNEL;
default:
UVM_ASSERT(0);
}
return type;
}
@@ -306,6 +322,13 @@ static NV_STATUS gpu_mem_check(uvm_gpu_t *gpu,
NvU32 *verif_cpu_addr = uvm_mem_get_cpu_addr_kernel(verif_mem);
size_t i;
// TODO: Bug 3839176: [UVM][HCC][uvm_test] Update tests that assume GPU
// engines can directly access sysmem
// Skip this test for now. To enable this test under SEV,
// The GPU->CPU CE copy needs to be updated so it uses encryption when
// CC is enabled.
if (uvm_conf_computing_mode_enabled(gpu))
return NV_OK;
UVM_ASSERT(verif_mem->size >= size);
memset(verif_cpu_addr, 0, size);
@@ -341,6 +364,11 @@ static NV_STATUS gpu_mem_check(uvm_gpu_t *gpu,
return NV_OK;
}
static uvm_gpu_address_t chunk_copy_addr(uvm_gpu_t *gpu, uvm_gpu_chunk_t *chunk)
{
return uvm_gpu_address_copy(gpu, uvm_gpu_phys_address(UVM_APERTURE_VID, chunk->address));
}
static NV_STATUS init_test_chunk(uvm_va_space_t *va_space,
uvm_pmm_gpu_t *pmm,
test_chunk_t *test_chunk,
@@ -362,10 +390,7 @@ static NV_STATUS init_test_chunk(uvm_va_space_t *va_space,
TEST_NV_CHECK_GOTO(uvm_mmu_chunk_map(test_chunk->chunk), chunk_free);
if (uvm_mmu_gpu_needs_static_vidmem_mapping(gpu) || uvm_mmu_gpu_needs_dynamic_vidmem_mapping(gpu))
chunk_addr = uvm_gpu_address_virtual_from_vidmem_phys(gpu, test_chunk->chunk->address);
else
chunk_addr = uvm_gpu_address_physical(UVM_APERTURE_VID, test_chunk->chunk->address);
chunk_addr = chunk_copy_addr(gpu, test_chunk->chunk);
// Fill the chunk
TEST_NV_CHECK_GOTO(do_memset_4(gpu, chunk_addr, pattern, size, &test_chunk->tracker), chunk_unmap);
@@ -407,15 +432,10 @@ static NV_STATUS destroy_test_chunk(uvm_pmm_gpu_t *pmm, test_chunk_t *test_chunk
{
uvm_gpu_t *gpu = uvm_pmm_to_gpu(pmm);
NV_STATUS status;
uvm_gpu_address_t chunk_addr;
uvm_gpu_chunk_t *chunk = test_chunk->chunk;
uvm_gpu_address_t chunk_addr = chunk_copy_addr(gpu, chunk);
uvm_chunk_size_t size = uvm_gpu_chunk_get_size(chunk);
if (uvm_mmu_gpu_needs_static_vidmem_mapping(gpu) || uvm_mmu_gpu_needs_dynamic_vidmem_mapping(gpu))
chunk_addr = uvm_gpu_address_virtual_from_vidmem_phys(gpu, chunk->address);
else
chunk_addr = uvm_gpu_address_physical(UVM_APERTURE_VID, chunk->address);
status = gpu_mem_check(gpu, verif_mem, chunk_addr, size, test_chunk->pattern, &test_chunk->tracker);
list_del(&test_chunk->node);
@@ -511,7 +531,7 @@ static NV_STATUS basic_test(uvm_va_space_t *va_space, uvm_gpu_t *gpu,
if (mode == UvmTestPmmSanityModeBasic) {
first_memory_type = UVM_PMM_GPU_MEMORY_TYPE_USER;
last_memory_type = UVM_PMM_GPU_MEMORY_TYPE_USER;
last_memory_type = UVM_PMM_GPU_MEMORY_TYPE_USER_UNPROTECTED;
first_free_pattern = BASIC_TEST_FREE_PATTERN_EVERY_N;
last_free_pattern = BASIC_TEST_FREE_PATTERN_EVERY_N;
}
@@ -867,6 +887,8 @@ NV_STATUS uvm_test_pmm_check_leak(UVM_TEST_PMM_CHECK_LEAK_PARAMS *params, struct
uvm_pmm_gpu_memory_type_t last_user_mode = UVM_PMM_GPU_MEMORY_TYPE_USER;
uvm_pmm_gpu_memory_type_t current_user_mode = first_user_mode;
last_user_mode = UVM_PMM_GPU_MEMORY_TYPE_USER_UNPROTECTED;
if (params->alloc_limit < -1)
return NV_ERR_INVALID_ARGUMENT;
@@ -1002,6 +1024,8 @@ NV_STATUS uvm_test_pmm_async_alloc(UVM_TEST_PMM_ASYNC_ALLOC_PARAMS *params, stru
uvm_pmm_gpu_memory_type_t last_user_mode = UVM_PMM_GPU_MEMORY_TYPE_USER;
uvm_pmm_gpu_memory_type_t current_user_mode = first_user_mode;
last_user_mode = UVM_PMM_GPU_MEMORY_TYPE_USER_UNPROTECTED;
uvm_va_space_down_read(va_space);
gpu = uvm_va_space_get_gpu_by_uuid(va_space, &params->gpu_uuid);
if (!gpu) {
@@ -1226,7 +1250,7 @@ static NV_STATUS test_indirect_peers(uvm_gpu_t *owning_gpu, uvm_gpu_t *accessing
}
// Check that accessing_gpu can read and write
local_addr = uvm_gpu_address_physical(UVM_APERTURE_VID, chunks[0]->address);
local_addr = chunk_copy_addr(owning_gpu, chunks[0]);
peer_addr = uvm_pmm_gpu_peer_copy_address(&owning_gpu->pmm, chunks[0], accessing_gpu);
// Init on local GPU
@@ -1391,7 +1415,7 @@ NV_STATUS uvm_test_pmm_chunk_with_elevated_page(UVM_TEST_PMM_CHUNK_WITH_ELEVATED
uvm_va_space_down_read(va_space);
for_each_va_space_gpu(gpu, va_space) {
if (!gpu->parent->numa_info.enabled)
if (!gpu->mem_info.numa.enabled)
continue;
ran_test = true;