diff mbox

dt: add ibm, tlb-(radix-)congruence-classes for tlbie invalidation

Message ID 20170224124336.29047-1-npiggin@gmail.com
State Changes Requested
Headers show

Commit Message

Nicholas Piggin Feb. 24, 2017, 12:43 p.m. UTC
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 doc/device-tree.rst |  3 +++
 hdata/cpu-common.c  | 15 +++++++++++++++
 2 files changed, 18 insertions(+)

Comments

Benjamin Herrenschmidt Feb. 24, 2017, 8:43 p.m. UTC | #1
On Fri, 2017-02-24 at 22:43 +1000, Nicholas Piggin wrote:
>                        /* TLB congruence classes for TLBIE
> invalidation */
> +                       ibm,tlb-congruence-classes = <0x200>;
> +

Except we need a different number for radix and hash mode :)

Cheers,
Ben.
Benjamin Herrenschmidt Feb. 24, 2017, 8:44 p.m. UTC | #2
On Sat, 2017-02-25 at 07:43 +1100, Benjamin Herrenschmidt wrote:
> On Fri, 2017-02-24 at 22:43 +1000, Nicholas Piggin wrote:
> >                        /* TLB congruence classes for TLBIE
> > invalidation */
> > +                       ibm,tlb-congruence-classes = <0x200>;
> > +
> 
> Except we need a different number for radix and hash mode :)

Ah you have that ! Didn;t ready the patch properly.

Ben.
diff mbox

Patch

diff --git a/doc/device-tree.rst b/doc/device-tree.rst
index fe527c65..b6cc7d2f 100644
--- a/doc/device-tree.rst
+++ b/doc/device-tree.rst
@@ -181,6 +181,9 @@  Root node of device tree
 			/* SLB size, use as-is */
 			ibm,slb-size = <0x20>;
 
+			/* TLB congruence classes for TLBIE invalidation */
+			ibm,tlb-congruence-classes = <0x200>;
+
 			/* VSX support, use as-is */
 			ibm,vmx = <0x2>;
 
diff --git a/hdata/cpu-common.c b/hdata/cpu-common.c
index 50c6adc7..aa2752c1 100644
--- a/hdata/cpu-common.c
+++ b/hdata/cpu-common.c
@@ -64,6 +64,8 @@  struct dt_node * add_core_common(struct dt_node *cpus,
 	       0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, /* 48 .. 55 */
 	       0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, /* 56 .. 63 */
 	};
+	int tlb_congruence = 0;
+	int tlb_radix_congruence = 0;
 
 	const uint8_t *pa_features;
 	size_t pa_features_size;
@@ -84,11 +86,13 @@  struct dt_node * add_core_common(struct dt_node *cpus,
 		name = "PowerPC,POWER7";
 		pa_features = pa_features_p7;
 		pa_features_size = sizeof(pa_features_p7);
+		tlb_congruence = 128;
 		break;
 	case PVR_TYPE_P7P:
 		name = "PowerPC,POWER7+";
 		pa_features = pa_features_p7p;
 		pa_features_size = sizeof(pa_features_p7p);
+		tlb_congruence = 128;
 		break;
 	case PVR_TYPE_P8E:
 	case PVR_TYPE_P8:
@@ -96,6 +100,7 @@  struct dt_node * add_core_common(struct dt_node *cpus,
 		name = "PowerPC,POWER8";
 		pa_features = pa_features_p8;
 		pa_features_size = sizeof(pa_features_p8);
+		tlb_congruence = 512;
 		break;
 	case PVR_TYPE_P9:
 		name = "PowerPC,POWER9";
@@ -106,6 +111,8 @@  struct dt_node * add_core_common(struct dt_node *cpus,
 			pa_features = pa_features_p9_dd2;
 			pa_features_size = sizeof(pa_features_p9_dd2);
 		}
+		tlb_congruence = 256;
+		tlb_radix_congruence = 128;
 		break;
 	default:
 		name = "PowerPC,Unknown";
@@ -147,6 +154,14 @@  struct dt_node * add_core_common(struct dt_node *cpus,
 				pa_features, pa_features_size);
 	}
 	dt_add_property_cells(cpu, "ibm,slb-size", 0x20);
+	if (tlb_congruence) {
+		dt_add_property_cells(cpu, "ibm,tlb-congruence-classes",
+						tlb_congruence);
+	}
+	if (tlb_radix_congruence) {
+		dt_add_property_cells(cpu, "ibm,tlb-radix-congruence-classes",
+						tlb_radix_congruence);
+	}
 
 	dt_add_property_cells(cpu, "ibm,vmx", 0x2);
 	dt_add_property_cells(cpu, "ibm,dfp", 0x2);