Skip to contentSkip to conversation

powerpc: Add interrupt mode information in /proc/cpuinfo

PATCH In review Cédric Le Goater 2 participants 3 messages Apr 27, 2020 – Apr 28, 2020 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc: Add interrupt mode information in /proc/cpuinfo

PowerNV and pSeries machines can run using the XIVE or XICS interrupt mode. Report this information in /proc/cpuinfo :

    timebase    : 512000000
    platform    : PowerNV
    model       : 9006-22C
    machine     : PowerNV 9006-22C
    firmware    : OPAL
    MMU         : Radix
    IRQ         : XIVE

and use seq_puts() where we can.

---
 arch/powerpc/platforms/powernv/setup.c | 12 ++++++++----
 arch/powerpc/platforms/pseries/setup.c |  8 ++++++--
 2 files changed, 14 insertions(+), 6 deletions(-)
arch/powerpc/platforms/powernv/setup.c +8 -4
index 3bc188da82ba..39ef3394038d 100644
@@ -196,14 +196,18 @@ static void pnv_show_cpuinfo(struct seq_file *m)
 		model = of_get_property(root, "model", NULL);
 	seq_printf(m, "machine\t\t: PowerNV %s\n", model);
 	if (firmware_has_feature(FW_FEATURE_OPAL))
-		seq_printf(m, "firmware\t: OPAL\n");
+		seq_puts(m, "firmware\t: OPAL\n");
 	else
-		seq_printf(m, "firmware\t: BML\n");
+		seq_puts(m, "firmware\t: BML\n");
 	of_node_put(root);
 	if (radix_enabled())
-		seq_printf(m, "MMU\t\t: Radix\n");
+		seq_puts(m, "MMU\t\t: Radix\n");
 	else
-		seq_printf(m, "MMU\t\t: Hash\n");
+		seq_puts(m, "MMU\t\t: Hash\n");
+	if (xive_enabled())
+		seq_puts(m, "IRQ\t\t: XIVE\n");
+	else
+		seq_puts(m, "IRQ\t\t: XICS\n");
 }
 
 static void pnv_prepare_going_down(void)
arch/powerpc/platforms/pseries/setup.c +6 -2
index 0c8421dd01ab..d248fca67797 100644
@@ -95,9 +95,13 @@ static void pSeries_show_cpuinfo(struct seq_file *m)
 	seq_printf(m, "machine\t\t: CHRP %s\n", model);
 	of_node_put(root);
 	if (radix_enabled())
-		seq_printf(m, "MMU\t\t: Radix\n");
+		seq_puts(m, "MMU\t\t: Radix\n");
 	else
-		seq_printf(m, "MMU\t\t: Hash\n");
+		seq_puts(m, "MMU\t\t: Hash\n");
+	if (xive_enabled())
+		seq_puts(m, "IRQ\t\t: XIVE\n");
+	else
+		seq_puts(m, "IRQ\t\t: XICS\n");
 }
 
 /* Initialize firmware assisted non-maskable interrupts if
Signature · 1 line
2.25.3
#1 lore raw
Quoted 10 lines · Cédric Le Goater

PowerNV and pSeries machines can run using the XIVE or XICS interrupt mode. Report this information in /proc/cpuinfo :

    timebase    : 512000000
    platform    : PowerNV
    model       : 9006-22C
    machine     : PowerNV 9006-22C
    firmware    : OPAL
    MMU         : Radix
    IRQ         : XIVE

Hmmmm, I dunno. At what point do we stop putting random non CPU-related things in cpuinfo? :)

The IRQ mode is (reasonably) easily discovered in sys, eg:

  $ cat /sys/kernel/irq/*/chip_name | grep -m 1 XIVE
  XIVE-IRQ

vs:

  $ cat /sys/kernel/irq/*/chip_name | grep -m 1 XICS
  XICS

cheers

Quoted 49 lines
arch/powerpc/platforms/powernv/setup.c +8 -4
index 3bc188da82ba..39ef3394038d 100644
@@ -196,14 +196,18 @@ static void pnv_show_cpuinfo(struct seq_file *m)
 		model = of_get_property(root, "model", NULL);
 	seq_printf(m, "machine\t\t: PowerNV %s\n", model);
 	if (firmware_has_feature(FW_FEATURE_OPAL))
-		seq_printf(m, "firmware\t: OPAL\n");
+		seq_puts(m, "firmware\t: OPAL\n");
 	else
-		seq_printf(m, "firmware\t: BML\n");
+		seq_puts(m, "firmware\t: BML\n");
 	of_node_put(root);
 	if (radix_enabled())
-		seq_printf(m, "MMU\t\t: Radix\n");
+		seq_puts(m, "MMU\t\t: Radix\n");
 	else
-		seq_printf(m, "MMU\t\t: Hash\n");
+		seq_puts(m, "MMU\t\t: Hash\n");
+	if (xive_enabled())
+		seq_puts(m, "IRQ\t\t: XIVE\n");
+	else
+		seq_puts(m, "IRQ\t\t: XICS\n");
 }
 
 static void pnv_prepare_going_down(void)
arch/powerpc/platforms/pseries/setup.c +6 -2
index 0c8421dd01ab..d248fca67797 100644
@@ -95,9 +95,13 @@ static void pSeries_show_cpuinfo(struct seq_file *m)
 	seq_printf(m, "machine\t\t: CHRP %s\n", model);
 	of_node_put(root);
 	if (radix_enabled())
-		seq_printf(m, "MMU\t\t: Radix\n");
+		seq_puts(m, "MMU\t\t: Radix\n");
 	else
-		seq_printf(m, "MMU\t\t: Hash\n");
+		seq_puts(m, "MMU\t\t: Hash\n");
+	if (xive_enabled())
+		seq_puts(m, "IRQ\t\t: XIVE\n");
+	else
+		seq_puts(m, "IRQ\t\t: XICS\n");
 }
 
 /* Initialize firmware assisted non-maskable interrupts if
Signature · 1 line
2.25.3
#2 lore raw
Quoted 12 lines · Michael Ellerman
Quoted 10 lines · Cédric Le Goater

PowerNV and pSeries machines can run using the XIVE or XICS interrupt mode. Report this information in /proc/cpuinfo :

    timebase    : 512000000
    platform    : PowerNV
    model       : 9006-22C
    machine     : PowerNV 9006-22C
    firmware    : OPAL
    MMU         : Radix
    IRQ         : XIVE
Quoted 2 lines

Hmmmm, I dunno. At what point do we stop putting random non CPU-related things in cpuinfo? :)

True.

Quoted 9 lines

The IRQ mode is (reasonably) easily discovered in sys, eg:

  $ cat /sys/kernel/irq/*/chip_name | grep -m 1 XIVE
  XIVE-IRQ

vs:

  $ cat /sys/kernel/irq/*/chip_name | grep -m 1 XICS
  XICS

That's good enough for error reporting

Thanks.

C.

Quoted 52 lines

cheers

Quoted 49 lines
arch/powerpc/platforms/powernv/setup.c +8 -4
index 3bc188da82ba..39ef3394038d 100644
@@ -196,14 +196,18 @@ static void pnv_show_cpuinfo(struct seq_file *m)
 		model = of_get_property(root, "model", NULL);
 	seq_printf(m, "machine\t\t: PowerNV %s\n", model);
 	if (firmware_has_feature(FW_FEATURE_OPAL))
-		seq_printf(m, "firmware\t: OPAL\n");
+		seq_puts(m, "firmware\t: OPAL\n");
 	else
-		seq_printf(m, "firmware\t: BML\n");
+		seq_puts(m, "firmware\t: BML\n");
 	of_node_put(root);
 	if (radix_enabled())
-		seq_printf(m, "MMU\t\t: Radix\n");
+		seq_puts(m, "MMU\t\t: Radix\n");
 	else
-		seq_printf(m, "MMU\t\t: Hash\n");
+		seq_puts(m, "MMU\t\t: Hash\n");
+	if (xive_enabled())
+		seq_puts(m, "IRQ\t\t: XIVE\n");
+	else
+		seq_puts(m, "IRQ\t\t: XICS\n");
 }
 
 static void pnv_prepare_going_down(void)
arch/powerpc/platforms/pseries/setup.c +6 -2
index 0c8421dd01ab..d248fca67797 100644
@@ -95,9 +95,13 @@ static void pSeries_show_cpuinfo(struct seq_file *m)
 	seq_printf(m, "machine\t\t: CHRP %s\n", model);
 	of_node_put(root);
 	if (radix_enabled())
-		seq_printf(m, "MMU\t\t: Radix\n");
+		seq_puts(m, "MMU\t\t: Radix\n");
 	else
-		seq_printf(m, "MMU\t\t: Hash\n");
+		seq_puts(m, "MMU\t\t: Hash\n");
+	if (xive_enabled())
+		seq_puts(m, "IRQ\t\t: XIVE\n");
+	else
+		seq_puts(m, "IRQ\t\t: XICS\n");
 }
 
 /* Initialize firmware assisted non-maskable interrupts if
Signature · 1 line
2.25.3