Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/radeon: Initialize compute vmid

This patch moves to radeon the initialization of compute vmid.

That initializations was done in kfd-->kgd interface, but doing it in radeon
as part of radeon's H/W initialization routines is more appropriate.

In addition, this simplifies the kfd-->kgd interface.

The patch removes the function from the interface file and from the interface
declaration file.

The function initializes memory apertures to fixed base/limit address and non
cached memory types.

Signed-off-by: Ben Goz <ben.goz@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Ben Goz and committed by
Oded Gabbay
08dcc57f fc839753

+24 -43
-4
drivers/gpu/drm/amd/include/kgd_kfd_interface.h
··· 129 129 * @set_pasid_vmid_mapping: Exposes pasid/vmid pair to the H/W for no cp 130 130 * scheduling mode. Only used for no cp scheduling mode. 131 131 * 132 - * @init_memory: Initializes memory apertures to fixed base/limit address 133 - * and non cached memory types. 134 - * 135 132 * @init_pipeline: Initialized the compute pipelines. 136 133 * 137 134 * @hqd_load: Loads the mqd structure to a H/W hqd slot. used only for no cp ··· 172 175 int (*set_pasid_vmid_mapping)(struct kgd_dev *kgd, unsigned int pasid, 173 176 unsigned int vmid); 174 177 175 - int (*init_memory)(struct kgd_dev *kgd); 176 178 int (*init_pipeline)(struct kgd_dev *kgd, uint32_t pipe_id, 177 179 uint32_t hpd_size, uint64_t hpd_gpu_addr); 178 180
+24
drivers/gpu/drm/radeon/cik.c
··· 5707 5707 WREG32(VM_INVALIDATE_REQUEST, 0x1); 5708 5708 } 5709 5709 5710 + static void cik_pcie_init_compute_vmid(struct radeon_device *rdev) 5711 + { 5712 + int i; 5713 + uint32_t sh_mem_bases, sh_mem_config; 5714 + 5715 + sh_mem_bases = 0x6000 | 0x6000 << 16; 5716 + sh_mem_config = ALIGNMENT_MODE(SH_MEM_ALIGNMENT_MODE_UNALIGNED); 5717 + sh_mem_config |= DEFAULT_MTYPE(MTYPE_NONCACHED); 5718 + 5719 + mutex_lock(&rdev->srbm_mutex); 5720 + for (i = 8; i < 16; i++) { 5721 + cik_srbm_select(rdev, 0, 0, 0, i); 5722 + /* CP and shaders */ 5723 + WREG32(SH_MEM_CONFIG, sh_mem_config); 5724 + WREG32(SH_MEM_APE1_BASE, 1); 5725 + WREG32(SH_MEM_APE1_LIMIT, 0); 5726 + WREG32(SH_MEM_BASES, sh_mem_bases); 5727 + } 5728 + cik_srbm_select(rdev, 0, 0, 0, 0); 5729 + mutex_unlock(&rdev->srbm_mutex); 5730 + } 5731 + 5710 5732 /** 5711 5733 * cik_pcie_gart_enable - gart enable 5712 5734 * ··· 5841 5819 } 5842 5820 cik_srbm_select(rdev, 0, 0, 0, 0); 5843 5821 mutex_unlock(&rdev->srbm_mutex); 5822 + 5823 + cik_pcie_init_compute_vmid(rdev); 5844 5824 5845 5825 cik_pcie_gart_tlb_flush(rdev); 5846 5826 DRM_INFO("PCIE GART of %uM enabled (table at 0x%016llX).\n",
-39
drivers/gpu/drm/radeon/radeon_kfd.c
··· 63 63 static int kgd_set_pasid_vmid_mapping(struct kgd_dev *kgd, unsigned int pasid, 64 64 unsigned int vmid); 65 65 66 - static int kgd_init_memory(struct kgd_dev *kgd); 67 - 68 66 static int kgd_init_pipeline(struct kgd_dev *kgd, uint32_t pipe_id, 69 67 uint32_t hpd_size, uint64_t hpd_gpu_addr); 70 68 ··· 87 89 .get_max_engine_clock_in_mhz = get_max_engine_clock_in_mhz, 88 90 .program_sh_mem_settings = kgd_program_sh_mem_settings, 89 91 .set_pasid_vmid_mapping = kgd_set_pasid_vmid_mapping, 90 - .init_memory = kgd_init_memory, 91 92 .init_pipeline = kgd_init_pipeline, 92 93 .hqd_load = kgd_hqd_load, 93 94 .hqd_sdma_load = kgd_hqd_sdma_load, ··· 368 371 (1U << vmid))) 369 372 cpu_relax(); 370 373 write_register(kgd, ATC_VMID_PASID_MAPPING_UPDATE_STATUS, 1U << vmid); 371 - 372 - return 0; 373 - } 374 - 375 - static int kgd_init_memory(struct kgd_dev *kgd) 376 - { 377 - /* 378 - * Configure apertures: 379 - * LDS: 0x60000000'00000000 - 0x60000001'00000000 (4GB) 380 - * Scratch: 0x60000001'00000000 - 0x60000002'00000000 (4GB) 381 - * GPUVM: 0x60010000'00000000 - 0x60020000'00000000 (1TB) 382 - */ 383 - int i; 384 - uint32_t sh_mem_bases = PRIVATE_BASE(0x6000) | SHARED_BASE(0x6000); 385 - 386 - for (i = 8; i < 16; i++) { 387 - uint32_t sh_mem_config; 388 - 389 - lock_srbm(kgd, 0, 0, 0, i); 390 - 391 - sh_mem_config = ALIGNMENT_MODE(SH_MEM_ALIGNMENT_MODE_UNALIGNED); 392 - sh_mem_config |= DEFAULT_MTYPE(MTYPE_NONCACHED); 393 - 394 - write_register(kgd, SH_MEM_CONFIG, sh_mem_config); 395 - 396 - write_register(kgd, SH_MEM_BASES, sh_mem_bases); 397 - 398 - /* Scratch aperture is not supported for now. */ 399 - write_register(kgd, SH_STATIC_MEM_CONFIG, 0); 400 - 401 - /* APE1 disabled for now. */ 402 - write_register(kgd, SH_MEM_APE1_BASE, 1); 403 - write_register(kgd, SH_MEM_APE1_LIMIT, 0); 404 - 405 - unlock_srbm(kgd); 406 - } 407 374 408 375 return 0; 409 376 }