Commit 59562b5c authored by Scott Cheloha's avatar Scott Cheloha Committed by Michael Ellerman

powerpc/perf: consolidate GPCI hcall structs into asm/hvcall.h

The H_GetPerformanceCounterInfo (GPCI) hypercall input/output structs are
useful to modules outside of perf/, so move them into asm/hvcall.h to live
alongside the other powerpc hypercall structs.

Leave the perf-specific GPCI stuff in perf/hv-gpci.h.
Signed-off-by: default avatarScott Cheloha <cheloha@linux.ibm.com>
Acked-by: default avatarNathan Lynch <nathanl@linux.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200727184605.2945095-1-cheloha@linux.ibm.com
parent 82eb1792
...@@ -560,6 +560,42 @@ struct hv_guest_state { ...@@ -560,6 +560,42 @@ struct hv_guest_state {
/* Latest version of hv_guest_state structure */ /* Latest version of hv_guest_state structure */
#define HV_GUEST_STATE_VERSION 1 #define HV_GUEST_STATE_VERSION 1
/*
* From the document "H_GetPerformanceCounterInfo Interface" v1.07
*
* H_GET_PERF_COUNTER_INFO argument
*/
struct hv_get_perf_counter_info_params {
__be32 counter_request; /* I */
__be32 starting_index; /* IO */
__be16 secondary_index; /* IO */
__be16 returned_values; /* O */
__be32 detail_rc; /* O, only needed when called via *_norets() */
/*
* O, size each of counter_value element in bytes, only set for version
* >= 0x3
*/
__be16 cv_element_size;
/* I, 0 (zero) for versions < 0x3 */
__u8 counter_info_version_in;
/* O, 0 (zero) if version < 0x3. Must be set to 0 when making hcall */
__u8 counter_info_version_out;
__u8 reserved[0xC];
__u8 counter_value[];
} __packed;
#define HGPCI_REQ_BUFFER_SIZE 4096
#define HGPCI_MAX_DATA_BYTES \
(HGPCI_REQ_BUFFER_SIZE - sizeof(struct hv_get_perf_counter_info_params))
struct hv_gpci_request_buffer {
struct hv_get_perf_counter_info_params params;
uint8_t bytes[HGPCI_MAX_DATA_BYTES];
} __packed;
#endif /* __ASSEMBLY__ */ #endif /* __ASSEMBLY__ */
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* _ASM_POWERPC_HVCALL_H */ #endif /* _ASM_POWERPC_HVCALL_H */
...@@ -123,17 +123,8 @@ static const struct attribute_group *attr_groups[] = { ...@@ -123,17 +123,8 @@ static const struct attribute_group *attr_groups[] = {
NULL, NULL,
}; };
#define HGPCI_REQ_BUFFER_SIZE 4096
#define HGPCI_MAX_DATA_BYTES \
(HGPCI_REQ_BUFFER_SIZE - sizeof(struct hv_get_perf_counter_info_params))
static DEFINE_PER_CPU(char, hv_gpci_reqb[HGPCI_REQ_BUFFER_SIZE]) __aligned(sizeof(uint64_t)); static DEFINE_PER_CPU(char, hv_gpci_reqb[HGPCI_REQ_BUFFER_SIZE]) __aligned(sizeof(uint64_t));
struct hv_gpci_request_buffer {
struct hv_get_perf_counter_info_params params;
uint8_t bytes[HGPCI_MAX_DATA_BYTES];
} __packed;
static unsigned long single_gpci_request(u32 req, u32 starting_index, static unsigned long single_gpci_request(u32 req, u32 starting_index,
u16 secondary_index, u8 version_in, u32 offset, u8 length, u16 secondary_index, u8 version_in, u32 offset, u8 length,
u64 *value) u64 *value)
......
...@@ -2,33 +2,6 @@ ...@@ -2,33 +2,6 @@
#ifndef LINUX_POWERPC_PERF_HV_GPCI_H_ #ifndef LINUX_POWERPC_PERF_HV_GPCI_H_
#define LINUX_POWERPC_PERF_HV_GPCI_H_ #define LINUX_POWERPC_PERF_HV_GPCI_H_
#include <linux/types.h>
/* From the document "H_GetPerformanceCounterInfo Interface" v1.07 */
/* H_GET_PERF_COUNTER_INFO argument */
struct hv_get_perf_counter_info_params {
__be32 counter_request; /* I */
__be32 starting_index; /* IO */
__be16 secondary_index; /* IO */
__be16 returned_values; /* O */
__be32 detail_rc; /* O, only needed when called via *_norets() */
/*
* O, size each of counter_value element in bytes, only set for version
* >= 0x3
*/
__be16 cv_element_size;
/* I, 0 (zero) for versions < 0x3 */
__u8 counter_info_version_in;
/* O, 0 (zero) if version < 0x3. Must be set to 0 when making hcall */
__u8 counter_info_version_out;
__u8 reserved[0xC];
__u8 counter_value[];
} __packed;
/* /*
* counter info version => fw version/reference (spec version) * counter info version => fw version/reference (spec version)
* *
......
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