v2: * Removed amdgpu_amdkfd prefix from static functions * Documented get_tile_config in kgd_kfd_interface.h
Unified · Split
| @@ -138,6 +138,31 @@ static uint16_t get_fw_version(struct kgd_dev *kgd, enum kgd_engine_type type); · 137 unmodified lines | ||
| 138 | 138 | static void set_scratch_backing_va(struct kgd_dev *kgd, |
| 139 | 139 | uint64_t va, uint32_t vmid); |
| 140 | 140 | |
| 141 | +/* Because of REG_GET_FIELD() being used, we put this function in the | |
| 142 | + * asic specific file. | |
| 143 | + */ | |
| 144 | +static int get_tile_config(struct kgd_dev *kgd, | |
| 145 | + struct tile_config *config) | |
| 146 | +{ | |
| 147 | + struct amdgpu_device *adev = (struct amdgpu_device *)kgd; | |
| 148 | + | |
| 149 | + config->gb_addr_config = adev->gfx.config.gb_addr_config; | |
| 150 | + config->num_banks = REG_GET_FIELD(adev->gfx.config.mc_arb_ramcfg, | |
| 151 | + MC_ARB_RAMCFG, NOOFBANK); | |
| 152 | + config->num_ranks = REG_GET_FIELD(adev->gfx.config.mc_arb_ramcfg, | |
| 153 | + MC_ARB_RAMCFG, NOOFRANKS); | |
| 154 | + | |
| 155 | + config->tile_config_ptr = adev->gfx.config.tile_mode_array; | |
| 156 | + config->num_tile_configs = | |
| 157 | + ARRAY_SIZE(adev->gfx.config.tile_mode_array); | |
| 158 | + config->macro_tile_config_ptr = | |
| 159 | + adev->gfx.config.macrotile_mode_array; | |
| 160 | + config->num_macro_tile_configs = | |
| 161 | + ARRAY_SIZE(adev->gfx.config.macrotile_mode_array); | |
| 162 | + | |
| 163 | + return 0; | |
| 164 | +} | |
| 165 | + | |
| 141 | 166 | static const struct kfd2kgd_calls kfd2kgd = { |
| 142 | 167 | .init_gtt_mem_allocation = alloc_gtt_mem, |
| 143 | 168 | .free_gtt_mem = free_gtt_mem, |
| @@ -163,6 +188,7 @@ static const struct kfd2kgd_calls kfd2kgd = { · 19 unmodified lines | ||
| 163 | 188 | .write_vmid_invalidate_request = write_vmid_invalidate_request, |
| 164 | 189 | .get_fw_version = get_fw_version, |
| 165 | 190 | .set_scratch_backing_va = set_scratch_backing_va, |
| 191 | + .get_tile_config = get_tile_config, | |
| 166 | 192 | }; |
| 167 | 193 | |
| 168 | 194 | struct kfd2kgd_calls *amdgpu_amdkfd_gfx_7_get_functions(void) |
| @@ -97,6 +97,31 @@ static uint16_t get_fw_version(struct kgd_dev *kgd, enum kgd_engine_type type); · 96 unmodified lines | ||
| 97 | 97 | static void set_scratch_backing_va(struct kgd_dev *kgd, |
| 98 | 98 | uint64_t va, uint32_t vmid); |
| 99 | 99 | |
| 100 | +/* Because of REG_GET_FIELD() being used, we put this function in the | |
| 101 | + * asic specific file. | |
| 102 | + */ | |
| 103 | +static int get_tile_config(struct kgd_dev *kgd, | |
| 104 | + struct tile_config *config) | |
| 105 | +{ | |
| 106 | + struct amdgpu_device *adev = (struct amdgpu_device *)kgd; | |
| 107 | + | |
| 108 | + config->gb_addr_config = adev->gfx.config.gb_addr_config; | |
| 109 | + config->num_banks = REG_GET_FIELD(adev->gfx.config.mc_arb_ramcfg, | |
| 110 | + MC_ARB_RAMCFG, NOOFBANK); | |
| 111 | + config->num_ranks = REG_GET_FIELD(adev->gfx.config.mc_arb_ramcfg, | |
| 112 | + MC_ARB_RAMCFG, NOOFRANKS); | |
| 113 | + | |
| 114 | + config->tile_config_ptr = adev->gfx.config.tile_mode_array; | |
| 115 | + config->num_tile_configs = | |
| 116 | + ARRAY_SIZE(adev->gfx.config.tile_mode_array); | |
| 117 | + config->macro_tile_config_ptr = | |
| 118 | + adev->gfx.config.macrotile_mode_array; | |
| 119 | + config->num_macro_tile_configs = | |
| 120 | + ARRAY_SIZE(adev->gfx.config.macrotile_mode_array); | |
| 121 | + | |
| 122 | + return 0; | |
| 123 | +} | |
| 124 | + | |
| 100 | 125 | static const struct kfd2kgd_calls kfd2kgd = { |
| 101 | 126 | .init_gtt_mem_allocation = alloc_gtt_mem, |
| 102 | 127 | .free_gtt_mem = free_gtt_mem, |
| @@ -124,6 +149,7 @@ static const struct kfd2kgd_calls kfd2kgd = { · 21 unmodified lines | ||
| 124 | 149 | .write_vmid_invalidate_request = write_vmid_invalidate_request, |
| 125 | 150 | .get_fw_version = get_fw_version, |
| 126 | 151 | .set_scratch_backing_va = set_scratch_backing_va, |
| 152 | + .get_tile_config = get_tile_config, | |
| 127 | 153 | }; |
| 128 | 154 | |
| 129 | 155 | struct kfd2kgd_calls *amdgpu_amdkfd_gfx_8_0_get_functions(void) |
| @@ -87,6 +87,17 @@ struct kgd2kfd_shared_resources { · 86 unmodified lines | ||
| 87 | 87 | size_t doorbell_start_offset; |
| 88 | 88 | }; |
| 89 | 89 | |
| 90 | +struct tile_config { | |
| 91 | + uint32_t *tile_config_ptr; | |
| 92 | + uint32_t *macro_tile_config_ptr; | |
| 93 | + uint32_t num_tile_configs; | |
| 94 | + uint32_t num_macro_tile_configs; | |
| 95 | + | |
| 96 | + uint32_t gb_addr_config; | |
| 97 | + uint32_t num_banks; | |
| 98 | + uint32_t num_ranks; | |
| 99 | +}; | |
| 100 | + | |
| 90 | 101 | /** |
| 91 | 102 | * struct kfd2kgd_calls |
| 92 | 103 | * |
| @@ -131,6 +142,8 @@ struct kgd2kfd_shared_resources { · 38 unmodified lines | ||
| 131 | 142 | * @set_scratch_backing_va: Sets VA for scratch backing memory of a VMID. |
| 132 | 143 | * Only used for no cp scheduling mode |
| 133 | 144 | * |
| 145 | + * @get_tile_config: Returns GPU-specific tiling mode information | |
| 146 | + * | |
| 134 | 147 | * This structure contains function pointers to services that the kgd driver |
| 135 | 148 | * provides to amdkfd driver. |
| 136 | 149 | * |
| @@ -204,6 +217,7 @@ struct kfd2kgd_calls { · 67 unmodified lines | ||
| 204 | 217 | enum kgd_engine_type type); |
| 205 | 218 | void (*set_scratch_backing_va)(struct kgd_dev *kgd, |
| 206 | 219 | uint64_t va, uint32_t vmid); |
| 220 | + int (*get_tile_config)(struct kgd_dev *kgd, struct tile_config *config); | |
| 207 | 221 | }; |
| 208 | 222 | |
| 209 | 223 | /** |