[QUESTION] gfvhub_v2_1 updates CNTL regs before initialize related page table address
Alex Deucher
alexdeucher at gmail.com
Mon May 22 14:03:29 UTC 2023
On Sat, May 20, 2023 at 1:34 AM Zibin Liu <ghostfly23333 at gmail.com> wrote:
>
> Hi,
>
> I'm looking at the initialization sequences in gfxhub_v2_1.c. I'm confused on whether the GCVM_CONTEXT1_CNTL CNTL reg can be written before the corresponding GCVM_CONTEXT1_PAGE_TABLE_START_ADDR and GCVM_CONTEXT1_PAGE_TABLE_END_ADDR reg is written.
>
> Here is the background:
> * gfxhub_v2_1_setup_vmid_config() enables GPU clients to use GPUVM VMIDs to access memory.
>
> The code related to this questions is below:
>
> 324 WREG32_SOC15_OFFSET(GC, 0, mmGCVM_CONTEXT1_CNTL,
> 325 i * hub->ctx_distance, tmp);
>
> 326 WREG32_SOC15_OFFSET(GC, 0, mmGCVM_CONTEXT1_PAGE_TABLE_START_ADDR_LO32,
> 327 i * hub->ctx_addr_distance, 0);
> 328 WREG32_SOC15_OFFSET(GC, 0, mmGCVM_CONTEXT1_PAGE_TABLE_START_ADDR_HI32,
> 329 i * hub->ctx_addr_distance, 0);
> 330 WREG32_SOC15_OFFSET(GC, 0, mmGCVM_CONTEXT1_PAGE_TABLE_END_ADDR_LO32,
> 331 i * hub->ctx_addr_distance,
> 332 lower_32_bits(adev->vm_manager.max_pfn - 1));
> 333 WREG32_SOC15_OFFSET(GC, 0, mmGCVM_CONTEXT1_PAGE_TABLE_END_ADDR_HI32,
> 334 i * hub->ctx_addr_distance,
> 335 upper_32_bits(adev->vm_manager.max_pfn - 1));
>
> Just wondering, is the behavior expected or is it a bug?
As long as the memory hub is idle, I don't think there are any
ordering requirements for programming it. I suppose if you wanted to
be really safe, you could set VM_CONTEXT1_CNTL.ENABLE_CONTEXT=0 before
programming everything and then set it to 1 at the end.
Alex
>
> Thanks,
> Zibin Liu
>
>
More information about the amd-gfx
mailing list