Changeset View
Changeset View
Standalone View
Standalone View
sys/x86/x86/mca.c
Show First 20 Lines • Show All 191 Lines • ▼ Show 20 Lines | |||||
static struct amd_et_state **amd_et_state; /* Indexed by cpuid, bank. */ | static struct amd_et_state **amd_et_state; /* Indexed by cpuid, bank. */ | ||||
static int cmc_throttle = 60; /* Time in seconds to throttle CMCI. */ | static int cmc_throttle = 60; /* Time in seconds to throttle CMCI. */ | ||||
static int amd_elvt = -1; | static int amd_elvt = -1; | ||||
static inline bool | static inline bool | ||||
amd_thresholding_supported(void) | amd_thresholding_supported(void) | ||||
{ | { | ||||
if (cpu_vendor_id != CPU_VENDOR_AMD) | if (cpu_vendor_id != CPU_VENDOR_AMD && | ||||
cpu_vendor_id != CPU_VENDOR_HYGON) | |||||
return (false); | return (false); | ||||
/* | /* | ||||
* The RASCap register is wholly reserved in families 0x10-0x15 (through model 1F). | * The RASCap register is wholly reserved in families 0x10-0x15 (through model 1F). | ||||
* | * | ||||
* It begins to be documented in family 0x15 model 30 and family 0x16, | * It begins to be documented in family 0x15 model 30 and family 0x16, | ||||
* but neither of these families documents the ScalableMca bit, which | * but neither of these families documents the ScalableMca bit, which | ||||
* supposedly defines the presence of this feature on family 0x17. | * supposedly defines the presence of this feature on family 0x17. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 991 Lines • ▼ Show 20 Lines | amd_thresholding_monitor(int i) | ||||
if (amd_elvt < 0) { | if (amd_elvt < 0) { | ||||
printf("%s: Bank %d: lapic enable mca elvt failed: %d\n", | printf("%s: Bank %d: lapic enable mca elvt failed: %d\n", | ||||
__func__, i, amd_elvt); | __func__, i, amd_elvt); | ||||
return; | return; | ||||
} | } | ||||
/* Re-use Intel CMC support infrastructure. */ | /* Re-use Intel CMC support infrastructure. */ | ||||
if (bootverbose) | if (bootverbose) | ||||
printf("%s: Starting AMD thresholding on bank %d\n", __func__, | printf("%s: Starting %s thresholding on bank %d\n", __func__, | ||||
cpu_vendor_id == CPU_VENDOR_HYGON ? "Hygon" : "AMD", | |||||
kib: I would suggest to not bother patching this place. | |||||
puwen_hygon.cnAuthorUnsubmitted Done Inline ActionsIf not patch here, there will be "Starting AMD thresholding on bank x" in the dmesg log, which we expect is "Starting Hygon thresholding on bank x". puwen_hygon.cn: If not patch here, there will be "Starting AMD thresholding on bank x" in the dmesg log, which… | |||||
cemUnsubmitted Not Done Inline ActionsThe function is amd_thresholding_monitor and here "AMD" is in contrast to the "Intel." AMD thresholding is an accurate characterization out of the (debug) output string. There's no need to key a string off of CPU_VENDOR for this function, which has the same behavior on AMD and AMD clones like Hygon. cem: The function is `amd_thresholding_monitor` and here "AMD" is in contrast to the "Intel." AMD… | |||||
puwen_hygon.cnAuthorUnsubmitted Not Done Inline ActionsOK, will revert the change here. puwen_hygon.cn: OK, will revert the change here. | |||||
i); | i); | ||||
cc = &amd_et_state[PCPU_GET(cpuid)][i]; | cc = &amd_et_state[PCPU_GET(cpuid)][i]; | ||||
cc->cur_threshold = 1; | cc->cur_threshold = 1; | ||||
amd_thresholding_start(cc, i); | amd_thresholding_start(cc, i); | ||||
/* Mark this bank as monitored. */ | /* Mark this bank as monitored. */ | ||||
PCPU_SET(cmci_mask, PCPU_GET(cmci_mask) | 1 << i); | PCPU_SET(cmci_mask, PCPU_GET(cmci_mask) | 1 << i); | ||||
▲ Show 20 Lines • Show All 213 Lines • Show Last 20 Lines |
I would suggest to not bother patching this place.