diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2016-07-07 15:01:42 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-07-07 15:01:42 -0400 |
commit | b95e31fddabbc38f96c8e991dd7132cea252bf7d (patch) | |
tree | 493024925a553c9e66848759068a4e633ce45ace | |
parent | 4b7d97ac835ee96e46538a1fea38021988440301 (diff) |
drm/amdgpu: move get_gpu_clock_counter into the gfx struct
It's gfx IP specific, not asic specific, so move to a
gfx callback.
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu.h | 10 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/cik.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 7 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gfx_v7_0.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 7 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gfx_v8_0.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/vi.c | 2 |
9 files changed, 22 insertions, 14 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index dcda843468e3..04696ad2720f 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h | |||
@@ -1150,6 +1150,11 @@ struct amdgpu_cu_info { | |||
1150 | uint32_t bitmap[4][4]; | 1150 | uint32_t bitmap[4][4]; |
1151 | }; | 1151 | }; |
1152 | 1152 | ||
1153 | struct amdgpu_gfx_funcs { | ||
1154 | /* get the gpu clock counter */ | ||
1155 | uint64_t (*get_gpu_clock_counter)(struct amdgpu_device *adev); | ||
1156 | }; | ||
1157 | |||
1153 | struct amdgpu_gfx { | 1158 | struct amdgpu_gfx { |
1154 | struct mutex gpu_clock_mutex; | 1159 | struct mutex gpu_clock_mutex; |
1155 | struct amdgpu_gca_config config; | 1160 | struct amdgpu_gca_config config; |
@@ -1186,6 +1191,7 @@ struct amdgpu_gfx { | |||
1186 | /* ce ram size*/ | 1191 | /* ce ram size*/ |
1187 | unsigned ce_ram_size; | 1192 | unsigned ce_ram_size; |
1188 | struct amdgpu_cu_info cu_info; | 1193 | struct amdgpu_cu_info cu_info; |
1194 | const struct amdgpu_gfx_funcs *funcs; | ||
1189 | }; | 1195 | }; |
1190 | 1196 | ||
1191 | int amdgpu_ib_get(struct amdgpu_device *adev, struct amdgpu_vm *vm, | 1197 | int amdgpu_ib_get(struct amdgpu_device *adev, struct amdgpu_vm *vm, |
@@ -1829,8 +1835,6 @@ struct amdgpu_asic_funcs { | |||
1829 | int (*reset)(struct amdgpu_device *adev); | 1835 | int (*reset)(struct amdgpu_device *adev); |
1830 | /* get the reference clock */ | 1836 | /* get the reference clock */ |
1831 | u32 (*get_xclk)(struct amdgpu_device *adev); | 1837 | u32 (*get_xclk)(struct amdgpu_device *adev); |
1832 | /* get the gpu clock counter */ | ||
1833 | uint64_t (*get_gpu_clock_counter)(struct amdgpu_device *adev); | ||
1834 | /* MM block clocks */ | 1838 | /* MM block clocks */ |
1835 | int (*set_uvd_clocks)(struct amdgpu_device *adev, u32 vclk, u32 dclk); | 1839 | int (*set_uvd_clocks)(struct amdgpu_device *adev, u32 vclk, u32 dclk); |
1836 | int (*set_vce_clocks)(struct amdgpu_device *adev, u32 evclk, u32 ecclk); | 1840 | int (*set_vce_clocks)(struct amdgpu_device *adev, u32 evclk, u32 ecclk); |
@@ -2225,7 +2229,6 @@ amdgpu_get_sdma_instance(struct amdgpu_ring *ring) | |||
2225 | #define amdgpu_asic_set_uvd_clocks(adev, v, d) (adev)->asic_funcs->set_uvd_clocks((adev), (v), (d)) | 2229 | #define amdgpu_asic_set_uvd_clocks(adev, v, d) (adev)->asic_funcs->set_uvd_clocks((adev), (v), (d)) |
2226 | #define amdgpu_asic_set_vce_clocks(adev, ev, ec) (adev)->asic_funcs->set_vce_clocks((adev), (ev), (ec)) | 2230 | #define amdgpu_asic_set_vce_clocks(adev, ev, ec) (adev)->asic_funcs->set_vce_clocks((adev), (ev), (ec)) |
2227 | #define amdgpu_asic_get_virtual_caps(adev) ((adev)->asic_funcs->get_virtual_caps((adev))) | 2231 | #define amdgpu_asic_get_virtual_caps(adev) ((adev)->asic_funcs->get_virtual_caps((adev))) |
2228 | #define amdgpu_asic_get_gpu_clock_counter(adev) (adev)->asic_funcs->get_gpu_clock_counter((adev)) | ||
2229 | #define amdgpu_asic_read_disabled_bios(adev) (adev)->asic_funcs->read_disabled_bios((adev)) | 2232 | #define amdgpu_asic_read_disabled_bios(adev) (adev)->asic_funcs->read_disabled_bios((adev)) |
2230 | #define amdgpu_asic_read_bios_from_rom(adev, b, l) (adev)->asic_funcs->read_bios_from_rom((adev), (b), (l)) | 2233 | #define amdgpu_asic_read_bios_from_rom(adev, b, l) (adev)->asic_funcs->read_bios_from_rom((adev), (b), (l)) |
2231 | #define amdgpu_asic_read_register(adev, se, sh, offset, v)((adev)->asic_funcs->read_register((adev), (se), (sh), (offset), (v))) | 2234 | #define amdgpu_asic_read_register(adev, se, sh, offset, v)((adev)->asic_funcs->read_register((adev), (se), (sh), (offset), (v))) |
@@ -2278,6 +2281,7 @@ amdgpu_get_sdma_instance(struct amdgpu_ring *ring) | |||
2278 | #define amdgpu_dpm_print_power_state(adev, ps) (adev)->pm.funcs->print_power_state((adev), (ps)) | 2281 | #define amdgpu_dpm_print_power_state(adev, ps) (adev)->pm.funcs->print_power_state((adev), (ps)) |
2279 | #define amdgpu_dpm_vblank_too_short(adev) (adev)->pm.funcs->vblank_too_short((adev)) | 2282 | #define amdgpu_dpm_vblank_too_short(adev) (adev)->pm.funcs->vblank_too_short((adev)) |
2280 | #define amdgpu_dpm_enable_bapm(adev, e) (adev)->pm.funcs->enable_bapm((adev), (e)) | 2283 | #define amdgpu_dpm_enable_bapm(adev, e) (adev)->pm.funcs->enable_bapm((adev), (e)) |
2284 | #define amdgpu_gfx_get_gpu_clock_counter(adev) (adev)->gfx.funcs->get_gpu_clock_counter((adev)) | ||
2281 | 2285 | ||
2282 | #define amdgpu_dpm_get_temperature(adev) \ | 2286 | #define amdgpu_dpm_get_temperature(adev) \ |
2283 | ((adev)->pp_enabled ? \ | 2287 | ((adev)->pp_enabled ? \ |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c index 32809f749903..d080d0807a5b 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | |||
@@ -240,8 +240,8 @@ uint64_t get_gpu_clock_counter(struct kgd_dev *kgd) | |||
240 | { | 240 | { |
241 | struct amdgpu_device *rdev = (struct amdgpu_device *)kgd; | 241 | struct amdgpu_device *rdev = (struct amdgpu_device *)kgd; |
242 | 242 | ||
243 | if (rdev->asic_funcs->get_gpu_clock_counter) | 243 | if (rdev->gfx.funcs->get_gpu_clock_counter) |
244 | return rdev->asic_funcs->get_gpu_clock_counter(rdev); | 244 | return rdev->gfx.funcs->get_gpu_clock_counter(rdev); |
245 | return 0; | 245 | return 0; |
246 | } | 246 | } |
247 | 247 | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c index f6c89fa63ea7..b464aaa1da3e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | |||
@@ -347,7 +347,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file | |||
347 | return copy_to_user(out, &count, min(size, 4u)) ? -EFAULT : 0; | 347 | return copy_to_user(out, &count, min(size, 4u)) ? -EFAULT : 0; |
348 | } | 348 | } |
349 | case AMDGPU_INFO_TIMESTAMP: | 349 | case AMDGPU_INFO_TIMESTAMP: |
350 | ui64 = amdgpu_asic_get_gpu_clock_counter(adev); | 350 | ui64 = amdgpu_gfx_get_gpu_clock_counter(adev); |
351 | return copy_to_user(out, &ui64, min(size, 8u)) ? -EFAULT : 0; | 351 | return copy_to_user(out, &ui64, min(size, 8u)) ? -EFAULT : 0; |
352 | case AMDGPU_INFO_FW_VERSION: { | 352 | case AMDGPU_INFO_FW_VERSION: { |
353 | struct drm_amdgpu_info_firmware fw_info; | 353 | struct drm_amdgpu_info_firmware fw_info; |
diff --git a/drivers/gpu/drm/amd/amdgpu/cik.c b/drivers/gpu/drm/amd/amdgpu/cik.c index c90bfeec3048..207fdfcd6261 100644 --- a/drivers/gpu/drm/amd/amdgpu/cik.c +++ b/drivers/gpu/drm/amd/amdgpu/cik.c | |||
@@ -2022,8 +2022,6 @@ static const struct amdgpu_asic_funcs cik_asic_funcs = | |||
2022 | .set_uvd_clocks = &cik_set_uvd_clocks, | 2022 | .set_uvd_clocks = &cik_set_uvd_clocks, |
2023 | .set_vce_clocks = &cik_set_vce_clocks, | 2023 | .set_vce_clocks = &cik_set_vce_clocks, |
2024 | .get_virtual_caps = &cik_get_virtual_caps, | 2024 | .get_virtual_caps = &cik_get_virtual_caps, |
2025 | /* these should be moved to their own ip modules */ | ||
2026 | .get_gpu_clock_counter = &gfx_v7_0_get_gpu_clock_counter, | ||
2027 | }; | 2025 | }; |
2028 | 2026 | ||
2029 | static int cik_common_early_init(void *handle) | 2027 | static int cik_common_early_init(void *handle) |
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c index bbce38e7dd49..fe90acffb62c 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | |||
@@ -4138,7 +4138,7 @@ static void gfx_v7_0_fini_pg(struct amdgpu_device *adev) | |||
4138 | * Fetches a GPU clock counter snapshot (SI). | 4138 | * Fetches a GPU clock counter snapshot (SI). |
4139 | * Returns the 64 bit clock counter snapshot. | 4139 | * Returns the 64 bit clock counter snapshot. |
4140 | */ | 4140 | */ |
4141 | uint64_t gfx_v7_0_get_gpu_clock_counter(struct amdgpu_device *adev) | 4141 | static uint64_t gfx_v7_0_get_gpu_clock_counter(struct amdgpu_device *adev) |
4142 | { | 4142 | { |
4143 | uint64_t clock; | 4143 | uint64_t clock; |
4144 | 4144 | ||
@@ -4198,12 +4198,17 @@ static void gfx_v7_0_ring_emit_gds_switch(struct amdgpu_ring *ring, | |||
4198 | amdgpu_ring_write(ring, (1 << (oa_size + oa_base)) - (1 << oa_base)); | 4198 | amdgpu_ring_write(ring, (1 << (oa_size + oa_base)) - (1 << oa_base)); |
4199 | } | 4199 | } |
4200 | 4200 | ||
4201 | static const struct amdgpu_gfx_funcs gfx_v7_0_gfx_funcs = { | ||
4202 | .get_gpu_clock_counter = &gfx_v7_0_get_gpu_clock_counter, | ||
4203 | }; | ||
4204 | |||
4201 | static int gfx_v7_0_early_init(void *handle) | 4205 | static int gfx_v7_0_early_init(void *handle) |
4202 | { | 4206 | { |
4203 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | 4207 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
4204 | 4208 | ||
4205 | adev->gfx.num_gfx_rings = GFX7_NUM_GFX_RINGS; | 4209 | adev->gfx.num_gfx_rings = GFX7_NUM_GFX_RINGS; |
4206 | adev->gfx.num_compute_rings = GFX7_NUM_COMPUTE_RINGS; | 4210 | adev->gfx.num_compute_rings = GFX7_NUM_COMPUTE_RINGS; |
4211 | adev->gfx.funcs = &gfx_v7_0_gfx_funcs; | ||
4207 | gfx_v7_0_set_ring_funcs(adev); | 4212 | gfx_v7_0_set_ring_funcs(adev); |
4208 | gfx_v7_0_set_irq_funcs(adev); | 4213 | gfx_v7_0_set_irq_funcs(adev); |
4209 | gfx_v7_0_set_gds_init(adev); | 4214 | gfx_v7_0_set_gds_init(adev); |
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.h b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.h index e747aa935c88..6b0e568b1433 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.h +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.h | |||
@@ -30,7 +30,6 @@ extern const struct amd_ip_funcs gfx_v7_0_ip_funcs; | |||
30 | void gfx_v7_0_enter_rlc_safe_mode(struct amdgpu_device *adev); | 30 | void gfx_v7_0_enter_rlc_safe_mode(struct amdgpu_device *adev); |
31 | void gfx_v7_0_exit_rlc_safe_mode(struct amdgpu_device *adev); | 31 | void gfx_v7_0_exit_rlc_safe_mode(struct amdgpu_device *adev); |
32 | void gfx_v7_0_rlc_stop(struct amdgpu_device *adev); | 32 | void gfx_v7_0_rlc_stop(struct amdgpu_device *adev); |
33 | uint64_t gfx_v7_0_get_gpu_clock_counter(struct amdgpu_device *adev); | ||
34 | void gfx_v7_0_select_se_sh(struct amdgpu_device *adev, u32 se_num, u32 sh_num); | 33 | void gfx_v7_0_select_se_sh(struct amdgpu_device *adev, u32 se_num, u32 sh_num); |
35 | 34 | ||
36 | #endif | 35 | #endif |
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c index 17b4384dfd6c..c4c09f9af827 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | |||
@@ -5147,7 +5147,7 @@ static int gfx_v8_0_soft_reset(void *handle) | |||
5147 | * Fetches a GPU clock counter snapshot. | 5147 | * Fetches a GPU clock counter snapshot. |
5148 | * Returns the 64 bit clock counter snapshot. | 5148 | * Returns the 64 bit clock counter snapshot. |
5149 | */ | 5149 | */ |
5150 | uint64_t gfx_v8_0_get_gpu_clock_counter(struct amdgpu_device *adev) | 5150 | static uint64_t gfx_v8_0_get_gpu_clock_counter(struct amdgpu_device *adev) |
5151 | { | 5151 | { |
5152 | uint64_t clock; | 5152 | uint64_t clock; |
5153 | 5153 | ||
@@ -5207,12 +5207,17 @@ static void gfx_v8_0_ring_emit_gds_switch(struct amdgpu_ring *ring, | |||
5207 | amdgpu_ring_write(ring, (1 << (oa_size + oa_base)) - (1 << oa_base)); | 5207 | amdgpu_ring_write(ring, (1 << (oa_size + oa_base)) - (1 << oa_base)); |
5208 | } | 5208 | } |
5209 | 5209 | ||
5210 | static const struct amdgpu_gfx_funcs gfx_v8_0_gfx_funcs = { | ||
5211 | .get_gpu_clock_counter = &gfx_v8_0_get_gpu_clock_counter, | ||
5212 | }; | ||
5213 | |||
5210 | static int gfx_v8_0_early_init(void *handle) | 5214 | static int gfx_v8_0_early_init(void *handle) |
5211 | { | 5215 | { |
5212 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | 5216 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
5213 | 5217 | ||
5214 | adev->gfx.num_gfx_rings = GFX8_NUM_GFX_RINGS; | 5218 | adev->gfx.num_gfx_rings = GFX8_NUM_GFX_RINGS; |
5215 | adev->gfx.num_compute_rings = GFX8_NUM_COMPUTE_RINGS; | 5219 | adev->gfx.num_compute_rings = GFX8_NUM_COMPUTE_RINGS; |
5220 | adev->gfx.funcs = &gfx_v8_0_gfx_funcs; | ||
5216 | gfx_v8_0_set_ring_funcs(adev); | 5221 | gfx_v8_0_set_ring_funcs(adev); |
5217 | gfx_v8_0_set_irq_funcs(adev); | 5222 | gfx_v8_0_set_irq_funcs(adev); |
5218 | gfx_v8_0_set_gds_init(adev); | 5223 | gfx_v8_0_set_gds_init(adev); |
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.h b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.h index 16a49f53a2fa..bc82c794312c 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.h +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.h | |||
@@ -26,7 +26,6 @@ | |||
26 | 26 | ||
27 | extern const struct amd_ip_funcs gfx_v8_0_ip_funcs; | 27 | extern const struct amd_ip_funcs gfx_v8_0_ip_funcs; |
28 | 28 | ||
29 | uint64_t gfx_v8_0_get_gpu_clock_counter(struct amdgpu_device *adev); | ||
30 | void gfx_v8_0_select_se_sh(struct amdgpu_device *adev, u32 se_num, u32 sh_num); | 29 | void gfx_v8_0_select_se_sh(struct amdgpu_device *adev, u32 se_num, u32 sh_num); |
31 | 30 | ||
32 | #endif | 31 | #endif |
diff --git a/drivers/gpu/drm/amd/amdgpu/vi.c b/drivers/gpu/drm/amd/amdgpu/vi.c index 168780b381a3..132d5070b050 100644 --- a/drivers/gpu/drm/amd/amdgpu/vi.c +++ b/drivers/gpu/drm/amd/amdgpu/vi.c | |||
@@ -1138,8 +1138,6 @@ static const struct amdgpu_asic_funcs vi_asic_funcs = | |||
1138 | .set_uvd_clocks = &vi_set_uvd_clocks, | 1138 | .set_uvd_clocks = &vi_set_uvd_clocks, |
1139 | .set_vce_clocks = &vi_set_vce_clocks, | 1139 | .set_vce_clocks = &vi_set_vce_clocks, |
1140 | .get_virtual_caps = &vi_get_virtual_caps, | 1140 | .get_virtual_caps = &vi_get_virtual_caps, |
1141 | /* these should be moved to their own ip modules */ | ||
1142 | .get_gpu_clock_counter = &gfx_v8_0_get_gpu_clock_counter, | ||
1143 | }; | 1141 | }; |
1144 | 1142 | ||
1145 | static int vi_common_early_init(void *handle) | 1143 | static int vi_common_early_init(void *handle) |