summaryrefslogtreecommitdiff
path: root/usr/src/uts/sun4v/cpu/niagara2.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/uts/sun4v/cpu/niagara2.c')
-rw-r--r--usr/src/uts/sun4v/cpu/niagara2.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/usr/src/uts/sun4v/cpu/niagara2.c b/usr/src/uts/sun4v/cpu/niagara2.c
index 1503304a30..2735b47016 100644
--- a/usr/src/uts/sun4v/cpu/niagara2.c
+++ b/usr/src/uts/sun4v/cpu/niagara2.c
@@ -72,6 +72,19 @@ static hsvc_info_t niagara2_hsvc = {
NIAGARA2_HSVC_MINOR, cpu_module_name
};
+#ifdef N2_1x_CPC_WORKAROUNDS
+static uint64_t cpu_ver; /* Niagara2 CPU version reg */
+uint64_t ni2_1x_perf_workarounds = 0;
+
+/* Niagara2 CPU version register */
+#define VER_MASK_MAJOR_SHIFT 28
+#define VER_MASK_MAJOR_MASK 0xf
+
+extern uint64_t va_to_pa(void *);
+extern uint64_t ni2_getver(); /* HV code to get %hver */
+extern uint64_t niagara2_getver(uint64_t ni2_getver_ra, uint64_t *cpu_version);
+#endif
+
void
cpu_setup(void)
{
@@ -79,6 +92,15 @@ cpu_setup(void)
extern int cpc_has_overflow_intr;
int status;
+#ifdef N2_1x_CPC_WORKAROUNDS
+ /*
+ * Get CPU version for Niagara2 part.
+ */
+ if (niagara2_getver(va_to_pa((void *)ni2_getver), &cpu_ver) == H_EOK &&
+ ((cpu_ver >> VER_MASK_MAJOR_SHIFT) & VER_MASK_MAJOR_MASK) <= 1)
+ ni2_1x_perf_workarounds = 1;
+#endif
+
/*
* Negotiate the API version for Niagara2 specific hypervisor
* services.