[Skiboot] [PATCH linux 4/4] powerpc/powernv: Add debugfs files to XIVE
Cédric Le Goater
clg at kaod.org
Fri Nov 6 03:15:42 AEDT 2020
Signed-off-by: Cédric Le Goater <clg at kaod.org>
---
arch/powerpc/sysdev/xive/xive-internal.h | 2 +-
arch/powerpc/sysdev/xive/common.c | 8 --------
arch/powerpc/sysdev/xive/native.c | 23 ++++++++++++++++++++++-
arch/powerpc/sysdev/xive/spapr.c | 9 ++++++++-
4 files changed, 31 insertions(+), 11 deletions(-)
diff --git a/arch/powerpc/sysdev/xive/xive-internal.h b/arch/powerpc/sysdev/xive/xive-internal.h
index b7b901da2168..09205d2d48f1 100644
--- a/arch/powerpc/sysdev/xive/xive-internal.h
+++ b/arch/powerpc/sysdev/xive/xive-internal.h
@@ -64,7 +64,7 @@ struct xive_ops {
bool xive_core_init(const struct xive_ops *ops, void __iomem *area, u32 offset,
u8 max_prio);
__be32 *xive_queue_page_alloc(unsigned int cpu, u32 queue_shift);
-int xive_core_debug_init(void);
+struct dentry *xive_core_debugfs_create(void);
static inline u32 xive_alloc_order(u32 queue_shift)
{
diff --git a/arch/powerpc/sysdev/xive/common.c b/arch/powerpc/sysdev/xive/common.c
index 1b1d3caebfac..9eacc26cb0ff 100644
--- a/arch/powerpc/sysdev/xive/common.c
+++ b/arch/powerpc/sysdev/xive/common.c
@@ -1681,11 +1681,3 @@ struct dentry *xive_core_debugfs_create(void)
return xive_debug_dir;
}
-
-int xive_core_debug_init(void)
-{
- if (xive_enabled())
- xive_core_debugfs_create();
-
- return 0;
-}
diff --git a/arch/powerpc/sysdev/xive/native.c b/arch/powerpc/sysdev/xive/native.c
index cb58ec7ce77a..1201f9ffeac5 100644
--- a/arch/powerpc/sysdev/xive/native.c
+++ b/arch/powerpc/sysdev/xive/native.c
@@ -548,6 +548,8 @@ EXPORT_SYMBOL_GPL(xive_native_default_eq_shift);
unsigned long xive_tima_os;
EXPORT_SYMBOL_GPL(xive_tima_os);
+static struct device_node *xive_native_node;
+
bool __init xive_native_init(void)
{
struct device_node *np;
@@ -628,6 +630,8 @@ bool __init xive_native_init(void)
return false;
}
pr_info("Using %dkB queues\n", 1 << (xive_queue_shift - 10));
+
+ xive_native_node = np;
return true;
}
@@ -854,4 +858,21 @@ int xive_native_get_vp_state(u32 vp_id, u64 *out_state)
}
EXPORT_SYMBOL_GPL(xive_native_get_vp_state);
-machine_arch_initcall(powernv, xive_core_debug_init);
+static int xive_native_debug_init(void)
+{
+ if (xive_enabled() && IS_ENABLED(CONFIG_DEBUG_FS)) {
+ struct device_node *child;
+ struct dentry *xive_dir;
+ struct dentry *xive_debug_dir;
+
+ xive_dir = xive_core_debugfs_create();
+ xive_debug_dir = debugfs_create_dir("debug", xive_dir);
+
+ for_each_child_of_node(xive_native_node, child)
+ if (of_device_is_compatible(child, "ibm,opal-debug"))
+ opal_debug_create(child, xive_debug_dir);
+ }
+ return 0;
+}
+
+machine_arch_initcall(powernv, xive_native_debug_init);
diff --git a/arch/powerpc/sysdev/xive/spapr.c b/arch/powerpc/sysdev/xive/spapr.c
index 1e3674d7ea7b..ea51967a4193 100644
--- a/arch/powerpc/sysdev/xive/spapr.c
+++ b/arch/powerpc/sysdev/xive/spapr.c
@@ -864,4 +864,11 @@ bool __init xive_spapr_init(void)
return true;
}
-machine_arch_initcall(pseries, xive_core_debug_init);
+static int xive_spapr_debug_init(void)
+{
+ if (xive_enabled() && IS_ENABLED(CONFIG_DEBUG_FS))
+ xive_core_debugfs_create();
+ return 0;
+}
+
+machine_arch_initcall(pseries, xive_spapr_debug_init);
--
2.26.2
More information about the Skiboot
mailing list