Commit e0372d69 authored by John Allen's avatar John Allen Committed by Borislav Petkov (AMD)

RAS/AMD/ATL: Implement DF 4.5 NP2 denormalization

Unlike with previous Data Fabric versions, with Data Fabric 4.5
non-power-of-2 denormalization, there are bits of the system physical
address that can't be fully reconstructed from the normalized address.

To determine the proper combination of missing system physical address
bits, iterate through each possible combination of these bits, normalize
the resulting system physical address, and compare to the original
address that is being translated. If the addresses match, then the
correct permutation of bits has been found.
Signed-off-by: default avatarJohn Allen <john.allen@amd.com>
Signed-off-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: default avatarYazen Ghannam <yazen.ghannam@amd.com>
Link: https://lore.kernel.org/r/20240606203313.51197-6-john.allen@amd.com
parent d5811a16
This diff is collapsed.
...@@ -37,6 +37,8 @@ ...@@ -37,6 +37,8 @@
#define DF_DRAM_BASE_LIMIT_LSB 28 #define DF_DRAM_BASE_LIMIT_LSB 28
#define MI300_DRAM_LIMIT_LSB 20 #define MI300_DRAM_LIMIT_LSB 20
#define INVALID_SPA ~0ULL
enum df_revisions { enum df_revisions {
UNKNOWN, UNKNOWN,
DF2, DF2,
...@@ -93,6 +95,44 @@ enum intlv_modes { ...@@ -93,6 +95,44 @@ enum intlv_modes {
DF4p5_NPS1_10CHAN_2K_HASH = 0x49, DF4p5_NPS1_10CHAN_2K_HASH = 0x49,
}; };
struct df4p5_denorm_ctx {
/* Indicates the number of "lost" bits. This will be 1, 2, or 3. */
u8 perm_shift;
/* A mask indicating the bits that need to be rehashed. */
u16 rehash_vector;
/*
* Represents the value that the high bits of the normalized address
* are divided by during normalization. This value will be 3 for
* interleave modes with a number of channels divisible by 3 or the
* value will be 5 for interleave modes with a number of channels
* divisible by 5. Power-of-two interleave modes are handled
* separately.
*/
u8 mod_value;
/*
* Represents the bits that can be directly pulled from the normalized
* address. In each case, pass through bits [7:0] of the normalized
* address. The other bits depend on the interleave bit position which
* will be bit 10 for 1K interleave stripe cases and bit 11 for 2K
* interleave stripe cases.
*/
u64 base_denorm_addr;
/*
* Represents the high bits of the physical address that have been
* divided by the mod_value.
*/
u64 div_addr;
u64 current_spa;
u64 resolved_spa;
u16 coh_st_fabric_id;
};
struct df_flags { struct df_flags {
__u8 legacy_ficaa : 1, __u8 legacy_ficaa : 1,
socket_id_shift_quirk : 1, socket_id_shift_quirk : 1,
......
...@@ -696,6 +696,26 @@ static int validate_address_map(struct addr_ctx *ctx) ...@@ -696,6 +696,26 @@ static int validate_address_map(struct addr_ctx *ctx)
goto err; goto err;
break; break;
case DF4p5_NPS4_3CHAN_1K_HASH:
case DF4p5_NPS4_3CHAN_2K_HASH:
case DF4p5_NPS2_5CHAN_1K_HASH:
case DF4p5_NPS2_5CHAN_2K_HASH:
case DF4p5_NPS2_6CHAN_1K_HASH:
case DF4p5_NPS2_6CHAN_2K_HASH:
case DF4p5_NPS1_10CHAN_1K_HASH:
case DF4p5_NPS1_10CHAN_2K_HASH:
case DF4p5_NPS1_12CHAN_1K_HASH:
case DF4p5_NPS1_12CHAN_2K_HASH:
if (ctx->map.num_intlv_sockets != 1 || !map_bits_valid(ctx, 8, 0, 1, 1))
goto err;
break;
case DF4p5_NPS0_24CHAN_1K_HASH:
case DF4p5_NPS0_24CHAN_2K_HASH:
if (ctx->map.num_intlv_sockets < 2 || !map_bits_valid(ctx, 8, 0, 1, 2))
goto err;
break;
case MI3_HASH_8CHAN: case MI3_HASH_8CHAN:
case MI3_HASH_16CHAN: case MI3_HASH_16CHAN:
case MI3_HASH_32CHAN: case MI3_HASH_32CHAN:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment