powerpc/pseries: Macros and wrapper functions for H_HTM call
Subsystems (2)
PATCH RESEND v6 1/3 powerpc/pseries: Macros and wrapper functions for H_HTM call
From: Abhishek Dubey <[email protected]>
Define macros and wrapper functions to handleH_HTM (Hardware Trace Macro) hypervisor call.H_HTM is new HCALL added to export data from
Hardware Trace Macro (HTM) function.
---
v3 patch:
https://lore.kernel.org/linuxppc-dev/[email protected]/
arch/powerpc/include/asm/hvcall.h | 34 +++++++++++++++++++++++ arch/powerpc/include/asm/plpar_wrappers.h | 21 ++++++++++++++ 2 files changed, 55 insertions(+)
arch/powerpc/include/asm/hvcall.h +34 -0
@@ -348,6 +348,7 @@#define H_SCM_FLUSH 0x44C#define H_GET_ENERGY_SCALE_INFO 0x450#define H_PKS_SIGNED_UPDATE 0x454 +#define H_HTM 0x458#define H_WATCHDOG 0x45C#define H_GUEST_GET_CAPABILITIES 0x460#define H_GUEST_SET_CAPABILITIES 0x464
@@ -498,6 +499,39 @@#define H_GUEST_CAP_POWER11 (1UL<<(63-3))#define H_GUEST_CAP_BITMAP2 (1UL<<(63-63)) +/* +* Defines for H_HTM - Macros for hardware trace macro (HTM) function. +*/ +#define H_HTM_FLAGS_HARDWARE_TARGET (1ul << 63) +#define H_HTM_FLAGS_LOGICAL_TARGET (1ul << 62) +#define H_HTM_FLAGS_PROCID_TARGET (1ul << 61) +#define H_HTM_FLAGS_NOWRAP (1ul << 60) + +#define H_HTM_OP_SHIFT (63-15) +#define H_HTM_OP (x) ((unsigned long)(x)<<H_HTM_OP_SHIFT) +#define H_HTM_OP_CAPABILITIES 0x01 +#define H_HTM_OP_STATUS 0x02 +#define H_HTM_OP_SETUP 0x03 +#define H_HTM_OP_CONFIGURE 0x04 +#define H_HTM_OP_START 0x05 +#define H_HTM_OP_STOP 0x06 +#define H_HTM_OP_DECONFIGURE 0x07 +#define H_HTM_OP_DUMP_DETAILS 0x08 +#define H_HTM_OP_DUMP_DATA 0x09 +#define H_HTM_OP_DUMP_SYSMEM_CONF 0x0a +#define H_HTM_OP_DUMP_SYSPROC_CONF 0x0b + +#define H_HTM_TYPE_SHIFT (63-31) +#define H_HTM_TYPE (x) ((unsigned long)(x)<<H_HTM_TYPE_SHIFT) +#define H_HTM_TYPE_NEST 0x01 +#define H_HTM_TYPE_CORE 0x02 +#define H_HTM_TYPE_LLAT 0x03 +#define H_HTM_TYPE_GLOBAL 0xff + +#define H_HTM_TARGET_NODE_INDEX (x) ((unsigned long)(x)<<(63-15)) +#define H_HTM_TARGET_NODAL_CHIP_INDEX (x) ((unsigned long)(x)<<(63-31)) +#define H_HTM_TARGET_CORE_INDEX_ON_CHIP (x) ((unsigned long)(x)<<(63-47)) +#ifndef __ASSEMBLY__#include <linux/types.h>
arch/powerpc/include/asm/plpar_wrappers.h +21 -0
@@ -65,6 +65,27 @@ static inline long register_dtl(unsigned long cpu, unsigned long vpa)return vpa_call (H_VPA_REG_DTL , cpu, vpa); } +static inline long htm_call (unsigned long flags,unsigned long target, +unsigned long operation,unsigned long param1, +unsigned long param2,unsigned long param3) +{ +return plpar_hcall_norets (H_HTM , flags, target, operation, + param1, param2, param3); +} + +static inline long htm_get_dump_hardware (unsigned long nodeindex, +unsigned long nodalchipindex,unsigned long coreindexonchip, +unsigned long type,unsigned long addr,unsigned long size, +unsigned long offset) +{ +return htm_call (H_HTM_FLAGS_HARDWARE_TARGET , +H_HTM_TARGET_NODE_INDEX (nodeindex) | +H_HTM_TARGET_NODAL_CHIP_INDEX (nodalchipindex) | +H_HTM_TARGET_CORE_INDEX_ON_CHIP (coreindexonchip), +H_HTM_OP (H_HTM_OP_DUMP_DATA ) |H_HTM_TYPE (type), + addr, size, offset); +} +extern void vpa_init (int cpu); static inline long plpar_pte_enter(unsigned long flags,
Signature · 1 line
2.39.3
PATCH RESEND v6 2/3 powerpc/pseries: Export hardware trace macro dump via debugfs
From: Abhishek Dubey <[email protected]>
This patch adds debugfs interface to export Hardware Trace Macro (HTM) function data in a LPAR. New hypervisor call "H_HTM" has been defined to setup, configure, control and dump the HTM data. This patch supports only dumping of HTM data in a LPAR.
New debugfs folder called "htmdump" has been added under /sys/kernel/debug/arch path which contains files need to pass required parameters for the H_HTM dump function. New Kconfig option called "CONFIG_HTMDUMP" is added in platform/pseries for the same.
With this module loaded, list of files in debugfs path
/sys/kernel/debug/powerpc/htmdump
coreindexonchip htmtype nodalchipindex nodeindex trace
---
Changelog:
v5->v6 : Header file inclusion
v4->v5 : Removed offset from available calculation, as offset is
always zero leading to buffur size reads. Edited comments and commit message
v3 patch:
https://lore.kernel.org/linuxppc-dev/[email protected]/
arch/powerpc/platforms/pseries/Kconfig | 9 ++ arch/powerpc/platforms/pseries/Makefile | 1 + arch/powerpc/platforms/pseries/htmdump.c | 121 +++++++++++++++++++++++ 3 files changed, 131 insertions(+) create mode 100644 arch/powerpc/platforms/pseries/htmdump.c
arch/powerpc/platforms/pseries/Kconfig +9 -0
@@ -128,6 +128,15 @@ config CMM will be reused for other LPARs. The interface allows firmware to balance memory across many LPARs. +config HTMDUMP + tristate "PowerVM data dumper" + depends on PPC_PSERIES && DEBUG_FS + default m + help + Select this option, if you want to enable the kernel debugfs + interface to dump the Hardware Trace Macro (HTM) function data + in the LPAR. + config HV_PERF_CTRS bool "Hypervisor supplied PMU events (24x7 & GPCI)" default y
arch/powerpc/platforms/pseries/Makefile +1 -0
@@ -19,6 +19,7 @@ obj-$(CONFIG_HVC_CONSOLE) += hvconsole.o obj-$(CONFIG_HVCS) += hvcserver.o obj-$(CONFIG_HCALL_STATS) += hvCall_inst.o obj-$(CONFIG_CMM) += cmm.o +obj-$(CONFIG_HTMDUMP) += htmdump.o obj-$(CONFIG_IO_EVENT_IRQ) += io_event_irq.o obj-$(CONFIG_LPARCFG) += lparcfg.o obj-$(CONFIG_IBMVIO) += vio.o
arch/powerpc/platforms/pseries/htmdump.c new file +121 -0
121 lines not on this page · raw message
Signature · 1 line
2.39.3
PATCH RESEND v6 3/3 powerpc: Document details on H_HTM hcall
In reply to [email protected]From: Abhishek Dubey <[email protected]>
Add documentation to 'papr_hcalls.rst' describing the input, output and return values of the H_HTM hcall as per the internal specification.
---
v3 patch:
https://lore.kernel.org/linuxppc-dev/[email protected]/
Documentation/arch/powerpc/papr_hcalls.rst | 11 +++++++++++ 1 file changed, 11 insertions(+)
Documentation/arch/powerpc/papr_hcalls.rst +11 -0
@@ -289,6 +289,17 @@ to be issued multiple times in order to be completely serviced. The subsequent hcalls to the hypervisor until the hcall is completely serviced at which point H_SUCCESS or other error is returned by the hypervisor. +**H_HTM** + +| Input: flags, target, operation (op), op-param1, op-param2, op-param3 +| Out: *dumphtmbufferdata* +| Return Value: *H_Success,H_Busy,H_LongBusyOrder,H_Partial,H_Parameter, + H_P2,H_P3,H_P4,H_P5,H_P6,H_State,H_Not_Available,H_Authority* + +H_HTM supports setup, configuration, control and dumping of Hardware Trace +Macro (HTM) function and its data. HTM buffer stores tracing data for functions +like core instruction, core LLAT and nest. + References ========== .. [1] "Power Architecture Platform Reference"
Signature · 1 line
2.39.3
Quoted 6 lines · On Mon, 13 Jan 2025 11:40:37 -0500, [email protected] wrote:
Define macros and wrapper functions to handle
H_HTM(Hardware Trace Macro) hypervisor call.H_HTMis new HCALL added to export data from Hardware Trace Macro (HTM) function.
Applied to powerpc/next.
[1/3] powerpc/pseries: Macros and wrapper functions for H_HTM call
https://git.kernel.org/powerpc/c/708220ae50251212d8d33683c7b48eb5c4db237e [2/3] powerpc/pseries: Export hardware trace macro dump via debugfs https://git.kernel.org/powerpc/c/81c3d637c30f82966e551452e061d6e7b0d8df37 [3/3] powerpc: Document details on H_HTM hcall https://git.kernel.org/powerpc/c/ddcb883fd49c5d81f0d6e8c60332bab5d3b4c86f
Thanks