Skip to content

Commit 06630fb

Browse files
candicelicyalexdeucher
authored andcommitted
drm/amdgpu: Support umc node harvest config on umc v8_10
Don't need to query error count and error address on harvest umc nodes. v2: Fix code bug, use active_mask instead of harvsest_config and remove unnecessary argument in LOOP macro. v3: Leave adev->gmc.num_umc unchanged. Signed-off-by: Candice Li <[email protected]> Reviewed-by: Tao Zhou <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 7d38697 commit 06630fb

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,7 @@ static void amdgpu_discovery_read_from_harvest_table(struct amdgpu_device *adev,
543543
struct harvest_table *harvest_info;
544544
u16 offset;
545545
int i;
546+
uint32_t umc_harvest_config = 0;
546547

547548
bhdr = (struct binary_header *)adev->mman.discovery_bin;
548549
offset = le16_to_cpu(bhdr->table_list[HARVEST_INFO].offset);
@@ -570,12 +571,17 @@ static void amdgpu_discovery_read_from_harvest_table(struct amdgpu_device *adev,
570571
adev->harvest_ip_mask |= AMD_HARVEST_IP_DMU_MASK;
571572
break;
572573
case UMC_HWID:
574+
umc_harvest_config |=
575+
1 << (le16_to_cpu(harvest_info->list[i].number_instance));
573576
(*umc_harvest_count)++;
574577
break;
575578
default:
576579
break;
577580
}
578581
}
582+
583+
adev->umc.active_mask = ((1 << adev->umc.node_inst_num) - 1) &
584+
~umc_harvest_config;
579585
}
580586

581587
/* ================================================== */
@@ -1156,8 +1162,10 @@ static int amdgpu_discovery_reg_base_init(struct amdgpu_device *adev)
11561162
AMDGPU_MAX_SDMA_INSTANCES);
11571163
}
11581164

1159-
if (le16_to_cpu(ip->hw_id) == UMC_HWID)
1165+
if (le16_to_cpu(ip->hw_id) == UMC_HWID) {
11601166
adev->gmc.num_umc++;
1167+
adev->umc.node_inst_num++;
1168+
}
11611169

11621170
for (k = 0; k < num_base_address; k++) {
11631171
/*

drivers/gpu/drm/amd/amdgpu/amdgpu_umc.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
#define LOOP_UMC_INST_AND_CH(umc_inst, ch_inst) LOOP_UMC_INST((umc_inst)) LOOP_UMC_CH_INST((ch_inst))
4343

4444
#define LOOP_UMC_NODE_INST(node_inst) \
45-
for ((node_inst) = 0; (node_inst) < adev->umc.node_inst_num; (node_inst)++)
45+
for_each_set_bit((node_inst), &(adev->umc.active_mask), adev->umc.node_inst_num)
4646

4747
#define LOOP_UMC_EACH_NODE_INST_AND_CH(node_inst, umc_inst, ch_inst) \
4848
LOOP_UMC_NODE_INST((node_inst)) LOOP_UMC_INST_AND_CH((umc_inst), (ch_inst))
@@ -69,7 +69,7 @@ struct amdgpu_umc {
6969
/* number of umc instance with memory map register access */
7070
uint32_t umc_inst_num;
7171

72-
/*number of umc node instance with memory map register access*/
72+
/* Total number of umc node instance including harvest one */
7373
uint32_t node_inst_num;
7474

7575
/* UMC regiser per channel offset */
@@ -82,6 +82,9 @@ struct amdgpu_umc {
8282

8383
const struct amdgpu_umc_funcs *funcs;
8484
struct amdgpu_umc_ras *ras;
85+
86+
/* active mask for umc node instance */
87+
unsigned long active_mask;
8588
};
8689

8790
int amdgpu_umc_ras_late_init(struct amdgpu_device *adev, struct ras_common_if *ras_block);

drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,6 @@ static void gmc_v11_0_set_umc_funcs(struct amdgpu_device *adev)
567567
case IP_VERSION(8, 10, 0):
568568
adev->umc.channel_inst_num = UMC_V8_10_CHANNEL_INSTANCE_NUM;
569569
adev->umc.umc_inst_num = UMC_V8_10_UMC_INSTANCE_NUM;
570-
adev->umc.node_inst_num = adev->gmc.num_umc;
571570
adev->umc.max_ras_err_cnt_per_query = UMC_V8_10_TOTAL_CHANNEL_NUM(adev);
572571
adev->umc.channel_offs = UMC_V8_10_PER_CHANNEL_OFFSET;
573572
adev->umc.retire_unit = UMC_V8_10_NA_COL_2BITS_POWER_OF_2_NUM;

drivers/gpu/drm/amd/amdgpu/umc_v8_10.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
/* number of umc instance with memory map register access */
3232
#define UMC_V8_10_UMC_INSTANCE_NUM 2
3333

34-
/* Total channel instances for all umc nodes */
34+
/* Total channel instances for all available umc nodes */
3535
#define UMC_V8_10_TOTAL_CHANNEL_NUM(adev) \
36-
(UMC_V8_10_CHANNEL_INSTANCE_NUM * UMC_V8_10_UMC_INSTANCE_NUM * (adev)->umc.node_inst_num)
36+
(UMC_V8_10_CHANNEL_INSTANCE_NUM * UMC_V8_10_UMC_INSTANCE_NUM * (adev)->gmc.num_umc)
3737

3838
/* UMC regiser per channel offset */
3939
#define UMC_V8_10_PER_CHANNEL_OFFSET 0x400

0 commit comments

Comments
 (0)