diff options
author | Ben Goz <ben.goz@amd.com> | 2015-01-02 16:43:19 -0500 |
---|---|---|
committer | Oded Gabbay <oded.gabbay@amd.com> | 2015-01-02 16:43:19 -0500 |
commit | 08dcc57fcd240922347c8a9f14d18e67a3f9f1a9 (patch) | |
tree | 324c02f25a64bc9caa246da8b1a8ae3b0bcf43c9 /drivers/gpu/drm/radeon | |
parent | fc83975348ebce07793e6b9f780edc3cbcffa9fc (diff) |
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>
Diffstat (limited to 'drivers/gpu/drm/radeon')
-rw-r--r-- | drivers/gpu/drm/radeon/cik.c | 24 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_kfd.c | 39 |
2 files changed, 24 insertions, 39 deletions
diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c index 6dcde3798b45..14d173e2a8f7 100644 --- a/drivers/gpu/drm/radeon/cik.c +++ b/drivers/gpu/drm/radeon/cik.c | |||
@@ -5707,6 +5707,28 @@ void cik_pcie_gart_tlb_flush(struct radeon_device *rdev) | |||
5707 | WREG32(VM_INVALIDATE_REQUEST, 0x1); | 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 | * cik_pcie_gart_enable - gart enable | 5733 | * cik_pcie_gart_enable - gart enable |
5712 | * | 5734 | * |
@@ -5820,6 +5842,8 @@ static int cik_pcie_gart_enable(struct radeon_device *rdev) | |||
5820 | cik_srbm_select(rdev, 0, 0, 0, 0); | 5842 | cik_srbm_select(rdev, 0, 0, 0, 0); |
5821 | mutex_unlock(&rdev->srbm_mutex); | 5843 | mutex_unlock(&rdev->srbm_mutex); |
5822 | 5844 | ||
5845 | cik_pcie_init_compute_vmid(rdev); | ||
5846 | |||
5823 | cik_pcie_gart_tlb_flush(rdev); | 5847 | cik_pcie_gart_tlb_flush(rdev); |
5824 | DRM_INFO("PCIE GART of %uM enabled (table at 0x%016llX).\n", | 5848 | DRM_INFO("PCIE GART of %uM enabled (table at 0x%016llX).\n", |
5825 | (unsigned)(rdev->mc.gtt_size >> 20), | 5849 | (unsigned)(rdev->mc.gtt_size >> 20), |
diff --git a/drivers/gpu/drm/radeon/radeon_kfd.c b/drivers/gpu/drm/radeon/radeon_kfd.c index cae11eefecf0..13e8066aef70 100644 --- a/drivers/gpu/drm/radeon/radeon_kfd.c +++ b/drivers/gpu/drm/radeon/radeon_kfd.c | |||
@@ -63,8 +63,6 @@ static void kgd_program_sh_mem_settings(struct kgd_dev *kgd, uint32_t vmid, | |||
63 | static int kgd_set_pasid_vmid_mapping(struct kgd_dev *kgd, unsigned int pasid, | 63 | static int kgd_set_pasid_vmid_mapping(struct kgd_dev *kgd, unsigned int pasid, |
64 | unsigned int vmid); | 64 | unsigned int vmid); |
65 | 65 | ||
66 | static int kgd_init_memory(struct kgd_dev *kgd); | ||
67 | |||
68 | static int kgd_init_pipeline(struct kgd_dev *kgd, uint32_t pipe_id, | 66 | static int kgd_init_pipeline(struct kgd_dev *kgd, uint32_t pipe_id, |
69 | uint32_t hpd_size, uint64_t hpd_gpu_addr); | 67 | uint32_t hpd_size, uint64_t hpd_gpu_addr); |
70 | 68 | ||
@@ -89,7 +87,6 @@ static const struct kfd2kgd_calls kfd2kgd = { | |||
89 | .get_max_engine_clock_in_mhz = get_max_engine_clock_in_mhz, | 87 | .get_max_engine_clock_in_mhz = get_max_engine_clock_in_mhz, |
90 | .program_sh_mem_settings = kgd_program_sh_mem_settings, | 88 | .program_sh_mem_settings = kgd_program_sh_mem_settings, |
91 | .set_pasid_vmid_mapping = kgd_set_pasid_vmid_mapping, | 89 | .set_pasid_vmid_mapping = kgd_set_pasid_vmid_mapping, |
92 | .init_memory = kgd_init_memory, | ||
93 | .init_pipeline = kgd_init_pipeline, | 90 | .init_pipeline = kgd_init_pipeline, |
94 | .hqd_load = kgd_hqd_load, | 91 | .hqd_load = kgd_hqd_load, |
95 | .hqd_sdma_load = kgd_hqd_sdma_load, | 92 | .hqd_sdma_load = kgd_hqd_sdma_load, |
@@ -375,42 +372,6 @@ static int kgd_set_pasid_vmid_mapping(struct kgd_dev *kgd, unsigned int pasid, | |||
375 | return 0; | 372 | return 0; |
376 | } | 373 | } |
377 | 374 | ||
378 | static int kgd_init_memory(struct kgd_dev *kgd) | ||
379 | { | ||
380 | /* | ||
381 | * Configure apertures: | ||
382 | * LDS: 0x60000000'00000000 - 0x60000001'00000000 (4GB) | ||
383 | * Scratch: 0x60000001'00000000 - 0x60000002'00000000 (4GB) | ||
384 | * GPUVM: 0x60010000'00000000 - 0x60020000'00000000 (1TB) | ||
385 | */ | ||
386 | int i; | ||
387 | uint32_t sh_mem_bases = PRIVATE_BASE(0x6000) | SHARED_BASE(0x6000); | ||
388 | |||
389 | for (i = 8; i < 16; i++) { | ||
390 | uint32_t sh_mem_config; | ||
391 | |||
392 | lock_srbm(kgd, 0, 0, 0, i); | ||
393 | |||
394 | sh_mem_config = ALIGNMENT_MODE(SH_MEM_ALIGNMENT_MODE_UNALIGNED); | ||
395 | sh_mem_config |= DEFAULT_MTYPE(MTYPE_NONCACHED); | ||
396 | |||
397 | write_register(kgd, SH_MEM_CONFIG, sh_mem_config); | ||
398 | |||
399 | write_register(kgd, SH_MEM_BASES, sh_mem_bases); | ||
400 | |||
401 | /* Scratch aperture is not supported for now. */ | ||
402 | write_register(kgd, SH_STATIC_MEM_CONFIG, 0); | ||
403 | |||
404 | /* APE1 disabled for now. */ | ||
405 | write_register(kgd, SH_MEM_APE1_BASE, 1); | ||
406 | write_register(kgd, SH_MEM_APE1_LIMIT, 0); | ||
407 | |||
408 | unlock_srbm(kgd); | ||
409 | } | ||
410 | |||
411 | return 0; | ||
412 | } | ||
413 | |||
414 | static int kgd_init_pipeline(struct kgd_dev *kgd, uint32_t pipe_id, | 375 | static int kgd_init_pipeline(struct kgd_dev *kgd, uint32_t pipe_id, |
415 | uint32_t hpd_size, uint64_t hpd_gpu_addr) | 376 | uint32_t hpd_size, uint64_t hpd_gpu_addr) |
416 | { | 377 | { |