Commit 4c7e8855 authored by Chunming Zhou's avatar Chunming Zhou Committed by Alex Deucher

drm/amdgpu: update pt shadow while updating pt V2

V2:
move shadow parameter to amdgpu_pte_update_params.
Signed-off-by: default avatarChunming Zhou <David1.Zhou@amd.com>
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Cc: minutemaidpark@hotmail.com
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 6557e3d2
...@@ -65,6 +65,8 @@ struct amdgpu_pte_update_params { ...@@ -65,6 +65,8 @@ struct amdgpu_pte_update_params {
void (*func)(struct amdgpu_pte_update_params *params, uint64_t pe, void (*func)(struct amdgpu_pte_update_params *params, uint64_t pe,
uint64_t addr, unsigned count, uint32_t incr, uint64_t addr, unsigned count, uint32_t incr,
uint32_t flags); uint32_t flags);
/* indicate update pt or its shadow */
bool shadow;
}; };
/** /**
...@@ -761,7 +763,11 @@ static void amdgpu_vm_update_ptes(struct amdgpu_pte_update_params *params, ...@@ -761,7 +763,11 @@ static void amdgpu_vm_update_ptes(struct amdgpu_pte_update_params *params,
addr = start; addr = start;
pt_idx = addr >> amdgpu_vm_block_size; pt_idx = addr >> amdgpu_vm_block_size;
pt = vm->page_tables[pt_idx].entry.robj; pt = vm->page_tables[pt_idx].entry.robj;
if (params->shadow) {
if (!pt->shadow)
return;
pt = vm->page_tables[pt_idx].entry.robj->shadow;
}
if ((addr & ~mask) == (end & ~mask)) if ((addr & ~mask) == (end & ~mask))
nptes = end - addr; nptes = end - addr;
else else
...@@ -780,6 +786,11 @@ static void amdgpu_vm_update_ptes(struct amdgpu_pte_update_params *params, ...@@ -780,6 +786,11 @@ static void amdgpu_vm_update_ptes(struct amdgpu_pte_update_params *params,
while (addr < end) { while (addr < end) {
pt_idx = addr >> amdgpu_vm_block_size; pt_idx = addr >> amdgpu_vm_block_size;
pt = vm->page_tables[pt_idx].entry.robj; pt = vm->page_tables[pt_idx].entry.robj;
if (params->shadow) {
if (!pt->shadow)
return;
pt = vm->page_tables[pt_idx].entry.robj->shadow;
}
if ((addr & ~mask) == (end & ~mask)) if ((addr & ~mask) == (end & ~mask))
nptes = end - addr; nptes = end - addr;
...@@ -1004,6 +1015,9 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev, ...@@ -1004,6 +1015,9 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
if (r) if (r)
goto error_free; goto error_free;
params.shadow = true;
amdgpu_vm_frag_ptes(&params, vm, start, last + 1, addr, flags);
params.shadow = false;
amdgpu_vm_frag_ptes(&params, vm, start, last + 1, addr, flags); amdgpu_vm_frag_ptes(&params, vm, start, last + 1, addr, flags);
amdgpu_ring_pad_ib(ring, params.ib); amdgpu_ring_pad_ib(ring, params.ib);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment