Commit 378f956e authored by Souvik Kumar Chakravarty's avatar Souvik Kumar Chakravarty Committed by Darren Hart

platform/x86: Add Intel Telemetry Core Driver

Intel PM Telemetry is a software mechanism via which various SoC
PM and performance related parameters like PM counters, firmware
trace verbosity, the status of different devices inside the SoC, etc.
can be monitored and analyzed. The different samples that may be
monitored can be configured at runtime via exported APIs.

This patch adds the telemetry core driver that implements basic
exported APIs.
Signed-off-by: default avatarSouvik Kumar Chakravarty <souvik.k.chakravarty@intel.com>
Signed-off-by: default avatarDarren Hart <dvhart@linux.intel.com>
parent 3fae7574
......@@ -5701,6 +5701,13 @@ F: drivers/platform/x86/intel_punit_ipc.c
F: arch/x86/include/asm/intel_pmc_ipc.h
F: arch/x86/include/asm/intel_punit_ipc.h
INTEL TELEMETRY DRIVER
M: Souvik Kumar Chakravarty <souvik.k.chakravarty@intel.com>
L: platform-driver-x86@vger.kernel.org
S: Maintained
F: drivers/platform/x86/intel_telemetry_core.c
F: arch/x86/include/asm/intel_telemetry.h
IOC3 ETHERNET DRIVER
M: Ralf Baechle <ralf@linux-mips.org>
L: linux-mips@linux-mips.org
......
/*
* Intel SOC Telemetry Driver Header File
* Copyright (C) 2015, Intel Corporation.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
*/
#ifndef INTEL_TELEMETRY_H
#define INTEL_TELEMETRY_H
#define TELEM_MAX_EVENTS_SRAM 28
#define TELEM_MAX_OS_ALLOCATED_EVENTS 20
enum telemetry_unit {
TELEM_PSS = 0,
TELEM_IOSS,
TELEM_UNIT_NONE
};
struct telemetry_evtlog {
u32 telem_evtid;
u64 telem_evtlog;
};
struct telemetry_evtconfig {
/* Array of Event-IDs to Enable */
u32 *evtmap;
/* Number of Events (<29) in evtmap */
u8 num_evts;
/* Sampling period */
u8 period;
};
struct telemetry_evtmap {
const char *name;
u32 evt_id;
};
struct telemetry_unit_config {
struct telemetry_evtmap *telem_evts;
void __iomem *regmap;
u32 ssram_base_addr;
u8 ssram_evts_used;
u8 curr_period;
u8 max_period;
u8 min_period;
u32 ssram_size;
};
struct telemetry_plt_config {
struct telemetry_unit_config pss_config;
struct telemetry_unit_config ioss_config;
struct mutex telem_trace_lock;
struct mutex telem_lock;
bool telem_in_use;
};
struct telemetry_core_ops {
int (*get_sampling_period)(u8 *pss_min_period, u8 *pss_max_period,
u8 *ioss_min_period, u8 *ioss_max_period);
int (*get_eventconfig)(struct telemetry_evtconfig *pss_evtconfig,
struct telemetry_evtconfig *ioss_evtconfig,
int pss_len, int ioss_len);
int (*update_events)(struct telemetry_evtconfig pss_evtconfig,
struct telemetry_evtconfig ioss_evtconfig);
int (*set_sampling_period)(u8 pss_period, u8 ioss_period);
int (*get_trace_verbosity)(enum telemetry_unit telem_unit,
u32 *verbosity);
int (*set_trace_verbosity)(enum telemetry_unit telem_unit,
u32 verbosity);
int (*raw_read_eventlog)(enum telemetry_unit telem_unit,
struct telemetry_evtlog *evtlog,
int len, int log_all_evts);
int (*read_eventlog)(enum telemetry_unit telem_unit,
struct telemetry_evtlog *evtlog,
int len, int log_all_evts);
int (*add_events)(u8 num_pss_evts, u8 num_ioss_evts,
u32 *pss_evtmap, u32 *ioss_evtmap);
int (*reset_events)(void);
};
int telemetry_set_pltdata(struct telemetry_core_ops *ops,
struct telemetry_plt_config *pltconfig);
int telemetry_clear_pltdata(void);
int telemetry_pltconfig_valid(void);
int telemetry_get_evtname(enum telemetry_unit telem_unit,
const char **name, int len);
int telemetry_update_events(struct telemetry_evtconfig pss_evtconfig,
struct telemetry_evtconfig ioss_evtconfig);
int telemetry_add_events(u8 num_pss_evts, u8 num_ioss_evts,
u32 *pss_evtmap, u32 *ioss_evtmap);
int telemetry_reset_events(void);
int telemetry_get_eventconfig(struct telemetry_evtconfig *pss_config,
struct telemetry_evtconfig *ioss_config,
int pss_len, int ioss_len);
int telemetry_read_events(enum telemetry_unit telem_unit,
struct telemetry_evtlog *evtlog, int len);
int telemetry_raw_read_events(enum telemetry_unit telem_unit,
struct telemetry_evtlog *evtlog, int len);
int telemetry_read_eventlog(enum telemetry_unit telem_unit,
struct telemetry_evtlog *evtlog, int len);
int telemetry_raw_read_eventlog(enum telemetry_unit telem_unit,
struct telemetry_evtlog *evtlog, int len);
int telemetry_get_sampling_period(u8 *pss_min_period, u8 *pss_max_period,
u8 *ioss_min_period, u8 *ioss_max_period);
int telemetry_set_sampling_period(u8 pss_period, u8 ioss_period);
int telemetry_set_trace_verbosity(enum telemetry_unit telem_unit,
u32 verbosity);
int telemetry_get_trace_verbosity(enum telemetry_unit telem_unit,
u32 *verbosity);
#endif /* INTEL_TELEMETRY_H */
......@@ -977,4 +977,15 @@ config INTEL_PUNIT_IPC
---help---
This driver provides support for Intel P-Unit Mailbox IPC mechanism,
which is used to bridge the communications between kernel and P-Unit.
config INTEL_TELEMETRY
tristate "Intel SoC Telemetry Driver"
default n
depends on INTEL_PMC_IPC && INTEL_PUNIT_IPC && X86_64
---help---
This driver provides interfaces to configure and use
telemetry for INTEL SoC from APL onwards. It is also
used to get various SoC events and parameters
directly via debugfs files. Various tools may use
this interface for SoC state monitoring.
endif # X86_PLATFORM_DEVICES
......@@ -65,3 +65,4 @@ obj-$(CONFIG_ALIENWARE_WMI) += alienware-wmi.o
obj-$(CONFIG_INTEL_PMC_IPC) += intel_pmc_ipc.o
obj-$(CONFIG_SURFACE_PRO3_BUTTON) += surfacepro3_button.o
obj-$(CONFIG_INTEL_PUNIT_IPC) += intel_punit_ipc.o
obj-$(CONFIG_INTEL_TELEMETRY) += intel_telemetry_core.o
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment