Lines Matching +full:4 +full:- +full:temp

1 // SPDX-License-Identifier: GPL-2.0-or-later
16 * MI300 has a fixed, model-specific mapping between a UMC instance and
39 u16 umc_id = FIELD_GET(UMC_ID_MI300, err->ipid); in get_coh_st_inst_id_mi300()
70 #define NUM_BANK_BITS 4
114 #define ADDR_SEL_BANK1 GENMASK(7, 4)
122 #define COL_SEL_LO_COL1 GENMASK(7, 4)
127 #define ADDR_SEL_2_BANK5 GENMASK(4, 0)
147 u32 temp; in get_umc_info_mi300() local
152 ret = amd_smn_read(0, MI300_ADDR_HASH_BANK0 + (i * 4), &temp); in get_umc_info_mi300()
156 addr_hash.bank[i].xor_enable = FIELD_GET(ADDR_HASH_XOR_EN, temp); in get_umc_info_mi300()
157 addr_hash.bank[i].col_xor = FIELD_GET(ADDR_HASH_COL_XOR, temp); in get_umc_info_mi300()
158 addr_hash.bank[i].row_xor = FIELD_GET(ADDR_HASH_ROW_XOR, temp); in get_umc_info_mi300()
161 ret = amd_smn_read(0, MI300_ADDR_HASH_PC, &temp); in get_umc_info_mi300()
165 addr_hash.pc.xor_enable = FIELD_GET(ADDR_HASH_XOR_EN, temp); in get_umc_info_mi300()
166 addr_hash.pc.col_xor = FIELD_GET(ADDR_HASH_COL_XOR, temp); in get_umc_info_mi300()
167 addr_hash.pc.row_xor = FIELD_GET(ADDR_HASH_ROW_XOR, temp); in get_umc_info_mi300()
169 ret = amd_smn_read(0, MI300_ADDR_HASH_PC2, &temp); in get_umc_info_mi300()
173 addr_hash.bank_xor = FIELD_GET(ADDR_HASH_BANK_XOR, temp); in get_umc_info_mi300()
175 ret = amd_smn_read(0, MI300_ADDR_CFG, &temp); in get_umc_info_mi300()
179 bit_shifts.num_row_hi = FIELD_GET(ADDR_CFG_NUM_ROW_HI, temp); in get_umc_info_mi300()
180 bit_shifts.num_row_lo = 10 + FIELD_GET(ADDR_CFG_NUM_ROW_LO, temp); in get_umc_info_mi300()
182 ret = amd_smn_read(0, MI300_ADDR_SEL, &temp); in get_umc_info_mi300()
186 bit_shifts.bank[0] = 5 + FIELD_GET(ADDR_SEL_BANK0, temp); in get_umc_info_mi300()
187 bit_shifts.bank[1] = 5 + FIELD_GET(ADDR_SEL_BANK1, temp); in get_umc_info_mi300()
188 bit_shifts.bank[2] = 5 + FIELD_GET(ADDR_SEL_BANK2, temp); in get_umc_info_mi300()
189 bit_shifts.bank[3] = 5 + FIELD_GET(ADDR_SEL_BANK3, temp); in get_umc_info_mi300()
191 bit_shifts.sid[0] = 5 + FIELD_GET(ADDR_SEL_BANK4, temp); in get_umc_info_mi300()
192 bit_shifts.row_lo = 12 + FIELD_GET(ADDR_SEL_ROW_LO, temp); in get_umc_info_mi300()
193 bit_shifts.row_hi = 24 + FIELD_GET(ADDR_SEL_ROW_HI, temp); in get_umc_info_mi300()
195 ret = amd_smn_read(0, MI300_COL_SEL_LO, &temp); in get_umc_info_mi300()
199 bit_shifts.col[0] = 2 + FIELD_GET(COL_SEL_LO_COL0, temp); in get_umc_info_mi300()
200 bit_shifts.col[1] = 2 + FIELD_GET(COL_SEL_LO_COL1, temp); in get_umc_info_mi300()
201 bit_shifts.col[2] = 2 + FIELD_GET(COL_SEL_LO_COL2, temp); in get_umc_info_mi300()
202 bit_shifts.col[3] = 2 + FIELD_GET(COL_SEL_LO_COL3, temp); in get_umc_info_mi300()
203 bit_shifts.col[4] = 2 + FIELD_GET(COL_SEL_LO_COL4, temp); in get_umc_info_mi300()
205 ret = amd_smn_read(0, MI300_ADDR_SEL_2, &temp); in get_umc_info_mi300()
210 bit_shifts.sid[1] = 5 + FIELD_GET(ADDR_SEL_2_BANK5, temp); in get_umc_info_mi300()
211 bit_shifts.pc = 5 + FIELD_GET(ADDR_SEL_2_CHAN, temp); in get_umc_info_mi300()
227 * MCA_ADDR[27:0] = {S[1:0], P[0], R[14:0], B[3:0], C[4:0], Z[0]}
241 u32 temp; in convert_dram_to_norm_addr_mi300() local
254 temp = bitwise_xor_bits(col & addr_hash.bank[i].col_xor); in convert_dram_to_norm_addr_mi300()
255 temp ^= bitwise_xor_bits(row & addr_hash.bank[i].row_xor); in convert_dram_to_norm_addr_mi300()
256 bank ^= temp << i; in convert_dram_to_norm_addr_mi300()
261 temp = bitwise_xor_bits(col & addr_hash.pc.col_xor); in convert_dram_to_norm_addr_mi300()
262 temp ^= bitwise_xor_bits(row & addr_hash.pc.row_xor); in convert_dram_to_norm_addr_mi300()
263 /* Bits SID[1:0] act as Bank[5:4] for PC hash, so apply them here. */ in convert_dram_to_norm_addr_mi300()
264 temp ^= bitwise_xor_bits((bank | sid << NUM_BANK_BITS) & addr_hash.bank_xor); in convert_dram_to_norm_addr_mi300()
265 pc ^= temp; in convert_dram_to_norm_addr_mi300()
268 /* Reconstruct the normalized address starting with NA[4:0] = 0 */ in convert_dram_to_norm_addr_mi300()
273 temp = (col >> i) & 0x1; in convert_dram_to_norm_addr_mi300()
274 addr |= temp << bit_shifts.col[i]; in convert_dram_to_norm_addr_mi300()
279 temp = (bank >> i) & 0x1; in convert_dram_to_norm_addr_mi300()
280 addr |= temp << bit_shifts.bank[i]; in convert_dram_to_norm_addr_mi300()
285 temp = (row >> i) & 0x1; in convert_dram_to_norm_addr_mi300()
286 addr |= temp << (i + bit_shifts.row_lo); in convert_dram_to_norm_addr_mi300()
291 temp = (row >> (i + bit_shifts.num_row_lo)) & 0x1; in convert_dram_to_norm_addr_mi300()
292 addr |= temp << (i + bit_shifts.row_hi); in convert_dram_to_norm_addr_mi300()
300 temp = (sid >> i) & 0x1; in convert_dram_to_norm_addr_mi300()
301 addr |= temp << bit_shifts.sid[i]; in convert_dram_to_norm_addr_mi300()
330 a_err->addr &= ~MI300_UMC_MCA_COL; in retire_row_mi300()
331 a_err->addr |= FIELD_PREP(MI300_UMC_MCA_COL, col); in retire_row_mi300()
374 * needs to be divided by 4 to get the internal Die ID. in get_die_id()
377 u8 node_id = FIELD_GET(MCA_IPID_INST_ID_HI, err->ipid); in get_die_id()
386 return topology_amd_node_id(err->cpu) % topology_amd_nodes_per_pkg(); in get_die_id()
395 return FIELD_GET(UMC_CHANNEL_NUM, err->ipid); in get_coh_st_inst_id()
400 u8 socket_id = topology_physical_package_id(err->cpu); in convert_umc_mca_addr_to_sys_addr()
402 unsigned long addr = get_addr(err->addr); in convert_umc_mca_addr_to_sys_addr()
409 ret_addr = prm_umc_norm_to_sys_addr(socket_id, err->ipid, addr); in convert_umc_mca_addr_to_sys_addr()