diff mbox series

[v5,09/10] Add POWER9 Cumulus processor PVR type

Message ID 20200422050419.72957-10-svaidy@linux.ibm.com
State New
Headers show
Series Initial fused-core support for POWER9 | expand

Checks

Context Check Description
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot-dco success Signed-off-by present
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot success Test snowpatch/job/snowpatch-skiboot on branch master
snowpatch_ozlabs/apply_patch success Successfully applied on branch master (9547b3da44d546f0083dd3aeb5436226fccf81e3)

Commit Message

Vaidyanathan Srinivasan April 22, 2020, 5:04 a.m. UTC
From: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>

Add PVR checks and feature mapping for POWER9 Cumulus chip.

Signed-off-by: Vaidyanathan Srinivasan <svaidy@linux.ibm.com>
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
---
 core/cpufeatures.c  | 19 +++++++++++++++++++
 include/processor.h | 14 ++++++++++++++
 2 files changed, 33 insertions(+)
diff mbox series

Patch

diff --git a/core/cpufeatures.c b/core/cpufeatures.c
index c6754abb..7bc72e24 100644
--- a/core/cpufeatures.c
+++ b/core/cpufeatures.c
@@ -943,6 +943,25 @@  void dt_add_cpufeatures(struct dt_node *root)
 			default:
 				assert(0);
 			}
+		} else if (is_power9c(version) &&
+                            (PVR_VERS_MAJ(version) == 1)) {
+                          /* P9C DD1.x */
+			switch (PVR_VERS_MIN(version)) {
+                        case 1:
+				/* Cumulus DD1.1 => Nimbus DD2.1 */
+				cpu_feature_cpu = CPU_P9_DD2_0_1;
+				break;
+			case 2:
+				/* Cumulus DD1.2 */
+				cpu_feature_cpu = CPU_P9_DD2_2;
+				break;
+			case 3:
+				/* Cumulus DD1.3 */
+				cpu_feature_cpu = CPU_P9_DD2_3;
+				break;
+			default:
+				assert(0);
+			}
 		} else {
 			assert(0);
 		}
diff --git a/include/processor.h b/include/processor.h
index 57c2ee13..8977dfec 100644
--- a/include/processor.h
+++ b/include/processor.h
@@ -228,6 +228,20 @@  static inline bool is_power9n(uint32_t version)
 	return true;
 }
 
+static inline bool is_power9c(uint32_t version) {
+
+	if (PVR_TYPE(version) != PVR_TYPE_P9)
+		return false;
+	/*
+	 * Bit 13 tells us:
+	 *   0 = Scale out (aka Nimbus)
+	 *   1 = Scale up  (aka Cumulus)
+	 */
+	if (!((version >> 13) & 1))
+		return false;
+	return true;
+}
+
 #ifndef __TEST__
 
 /*