[Pdbg] [PATCH 03/12] libpdbg: Fix some bit definitions for P9

Jordan Niethe jniethe5 at gmail.com
Mon Aug 2 15:41:03 AEST 2021


Signed-off-by: Jordan Niethe <jniethe5 at gmail.com>
---
 libpdbg/htm.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/libpdbg/htm.c b/libpdbg/htm.c
index ded46d2987a1..ac0668631001 100644
--- a/libpdbg/htm.c
+++ b/libpdbg/htm.c
@@ -76,10 +76,13 @@
 #define   HTM_MEM_SCOPE			PPC_BITMASK(1,3)
 /* Note: the next 3 change on P9 */
 #define   HTM_MEM_PRIORITY		PPC_BITMASK(4,5)
+#define   HTM_MEM_PRIORITY_P9		PPC_BITMASK(4)
 #define   HTM_MEM_PRIORITY_P10		PPC_BITMASK(4)
 #define   HTM_MEM_SIZE_SMALL		PPC_BIT(13)
+#define   HTM_MEM_SIZE_SMALL_P9		PPC_BIT(5)
 #define   HTM_MEM_SIZE_SMALL_P10	PPC_BIT(5)
 #define   HTM_MEM_BASE			PPC_BITMASK(14,39)
+#define   HTM_MEM_BASE_P9		PPC_BITMASK(8,39)
 #define   HTM_MEM_BASE_P10		PPC_BITMASK(8,39)
 #define	  HTM_MEM_SIZE			PPC_BITMASK(40,48)
 #define HTM_STATUS			2
@@ -457,6 +460,9 @@ static int get_status(struct htm *htm, struct htm_status *status)
 	if (pdbg_target_compatible(&htm->target, "ibm,power10-nhtm")) {
 		status->mem_size_select = val & HTM_MEM_SIZE_SMALL_P10;
 		status->mem_base = val & HTM_MEM_BASE_P10;
+	} else if (pdbg_target_compatible(&htm->target, "ibm,power9-nhtm")) {
+		status->mem_size_select = val & HTM_MEM_SIZE_SMALL_P9;
+		status->mem_base = val & HTM_MEM_BASE_P9;
 	} else {
 		status->mem_size_select = val & HTM_MEM_SIZE_SMALL;
 		status->mem_base = val & HTM_MEM_BASE;
@@ -885,6 +891,8 @@ static int configure_memory(struct htm *htm)
 		small = 1;
 	if (pdbg_target_compatible(&htm->target, "ibm,power10-nhtm"))
 		val = SETFIELD(HTM_MEM_SIZE_SMALL_P10, val, small);
+	else if (pdbg_target_compatible(&htm->target, "ibm,power9-nhtm"))
+		val = SETFIELD(HTM_MEM_SIZE_SMALL_P9, val, small);
 	else
 		val = SETFIELD(HTM_MEM_SIZE_SMALL, val, small);
 	shift = 29; /* large */
@@ -901,6 +909,8 @@ static int configure_memory(struct htm *htm)
 	 */
 	if (pdbg_target_compatible(&htm->target, "ibm,power10-nhtm"))
 		val = SETFIELD(HTM_MEM_BASE_P10, val, 0);
+	else if (pdbg_target_compatible(&htm->target, "ibm,power9-nhtm"))
+		val = SETFIELD(HTM_MEM_BASE_P9, val, 0);
 	else
 		val = SETFIELD(HTM_MEM_BASE, val, 0);
 	val |= base;
-- 
2.25.1



More information about the Pdbg mailing list