On Sat, May 20, 2023 at 1:34 AM Zibin Liu <ghostfly23333@xxxxxxxxx> 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 > >