提交 c013cea2 编写于 作者: A Alex Deucher

drm/amdgpu/soc15: return cached values for some registers (v2)

Required for SR-IOV and saves MMIO transactions.

v2: drop cached RB harvest registers
Reviewed-by: NChristian König <christian.koenig@amd.com>
Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
上级 2572c24c
...@@ -322,6 +322,22 @@ static uint32_t soc15_read_indexed_register(struct amdgpu_device *adev, u32 se_n ...@@ -322,6 +322,22 @@ static uint32_t soc15_read_indexed_register(struct amdgpu_device *adev, u32 se_n
return val; return val;
} }
static uint32_t soc15_get_register_value(struct amdgpu_device *adev,
bool indexed, u32 se_num,
u32 sh_num, u32 reg_offset)
{
if (indexed) {
return soc15_read_indexed_register(adev, se_num, sh_num, reg_offset);
} else {
switch (reg_offset) {
case SOC15_REG_OFFSET(GC, 0, mmGB_ADDR_CONFIG):
return adev->gfx.config.gb_addr_config;
default:
return RREG32(reg_offset);
}
}
}
static int soc15_read_register(struct amdgpu_device *adev, u32 se_num, static int soc15_read_register(struct amdgpu_device *adev, u32 se_num,
u32 sh_num, u32 reg_offset, u32 *value) u32 sh_num, u32 reg_offset, u32 *value)
{ {
...@@ -345,10 +361,9 @@ static int soc15_read_register(struct amdgpu_device *adev, u32 se_num, ...@@ -345,10 +361,9 @@ static int soc15_read_register(struct amdgpu_device *adev, u32 se_num,
if (reg_offset != asic_register_entry->reg_offset) if (reg_offset != asic_register_entry->reg_offset)
continue; continue;
if (!asic_register_entry->untouched) if (!asic_register_entry->untouched)
*value = asic_register_entry->grbm_indexed ? *value = soc15_get_register_value(adev,
soc15_read_indexed_register(adev, se_num, asic_register_entry->grbm_indexed,
sh_num, reg_offset) : se_num, sh_num, reg_offset);
RREG32(reg_offset);
return 0; return 0;
} }
} }
...@@ -358,10 +373,9 @@ static int soc15_read_register(struct amdgpu_device *adev, u32 se_num, ...@@ -358,10 +373,9 @@ static int soc15_read_register(struct amdgpu_device *adev, u32 se_num,
continue; continue;
if (!soc15_allowed_read_registers[i].untouched) if (!soc15_allowed_read_registers[i].untouched)
*value = soc15_allowed_read_registers[i].grbm_indexed ? *value = soc15_get_register_value(adev,
soc15_read_indexed_register(adev, se_num, soc15_allowed_read_registers[i].grbm_indexed,
sh_num, reg_offset) : se_num, sh_num, reg_offset);
RREG32(reg_offset);
return 0; return 0;
} }
return -EINVAL; return -EINVAL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册