Commit 6a7cf55e authored by Mike Travis's avatar Mike Travis Committed by Borislav Petkov

x86/platform/uv: Update UV5 TSC checking

Update check of BIOS TSC sync status to include both possible "invalid"
states provided by newer UV5 BIOS.
Signed-off-by: default avatarMike Travis <mike.travis@hpe.com>
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Reviewed-by: default avatarSteve Wahl <steve.wahl@hpe.com>
Link: https://lkml.kernel.org/r/20201005203929.148656-12-mike.travis@hpe.com
parent d6922eff
...@@ -726,7 +726,7 @@ extern void uv_nmi_setup_hubless(void); ...@@ -726,7 +726,7 @@ extern void uv_nmi_setup_hubless(void);
#define UVH_TSC_SYNC_SHIFT_UV2K 16 /* UV2/3k have different bits */ #define UVH_TSC_SYNC_SHIFT_UV2K 16 /* UV2/3k have different bits */
#define UVH_TSC_SYNC_MASK 3 /* 0011 */ #define UVH_TSC_SYNC_MASK 3 /* 0011 */
#define UVH_TSC_SYNC_VALID 3 /* 0011 */ #define UVH_TSC_SYNC_VALID 3 /* 0011 */
#define UVH_TSC_SYNC_INVALID 2 /* 0010 */ #define UVH_TSC_SYNC_UNKNOWN 0 /* 0000 */
/* BMC sets a bit this MMR non-zero before sending an NMI */ /* BMC sets a bit this MMR non-zero before sending an NMI */
#define UVH_NMI_MMR UVH_BIOS_KERNEL_MMR #define UVH_NMI_MMR UVH_BIOS_KERNEL_MMR
......
...@@ -197,36 +197,32 @@ static void __init uv_tsc_check_sync(void) ...@@ -197,36 +197,32 @@ static void __init uv_tsc_check_sync(void)
int sync_state; int sync_state;
int mmr_shift; int mmr_shift;
char *state; char *state;
bool valid;
/* Accommodate different UV arch BIOSes */ /* Different returns from different UV BIOS versions */
mmr = uv_early_read_mmr(UVH_TSC_SYNC_MMR); mmr = uv_early_read_mmr(UVH_TSC_SYNC_MMR);
mmr_shift = mmr_shift =
is_uv2_hub() ? UVH_TSC_SYNC_SHIFT_UV2K : UVH_TSC_SYNC_SHIFT; is_uv2_hub() ? UVH_TSC_SYNC_SHIFT_UV2K : UVH_TSC_SYNC_SHIFT;
sync_state = (mmr >> mmr_shift) & UVH_TSC_SYNC_MASK; sync_state = (mmr >> mmr_shift) & UVH_TSC_SYNC_MASK;
/* Check if TSC is valid for all sockets */
switch (sync_state) { switch (sync_state) {
case UVH_TSC_SYNC_VALID: case UVH_TSC_SYNC_VALID:
state = "in sync"; state = "in sync";
valid = true; mark_tsc_async_resets("UV BIOS");
break; break;
case UVH_TSC_SYNC_INVALID: /* If BIOS state unknown, don't do anything */
state = "unstable"; case UVH_TSC_SYNC_UNKNOWN:
valid = false; state = "unknown";
break; break;
/* Otherwise, BIOS indicates problem with TSC */
default: default:
state = "unknown: assuming valid"; state = "unstable";
valid = true; mark_tsc_unstable("UV BIOS");
break; break;
} }
pr_info("UV: TSC sync state from BIOS:0%d(%s)\n", sync_state, state); pr_info("UV: TSC sync state from BIOS:0%d(%s)\n", sync_state, state);
/* Mark flag that says TSC != 0 is valid for socket 0 */
if (valid)
mark_tsc_async_resets("UV BIOS");
else
mark_tsc_unstable("UV BIOS");
} }
/* Selector for (4|4A|5) structs */ /* Selector for (4|4A|5) structs */
......
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