From: Tyrel Datwyler <tyreld@linux.ibm.com>
To: Scott Cheloha <cheloha@linux.ibm.com>, linuxppc-dev@ozlabs.org
Cc: Nathan Lynch <nathanl@linux.ibm.com>
Subject: Re: [PATCH v2 1/2] powerpc/perf: consolidate GPCI hcall structs into asm/hvcall.h
Date: Wed, 5 Aug 2020 15:37:32 -0700 [thread overview]
Message-ID: <44fe3f95-5516-05da-8fcb-a3ad60d3127d@linux.ibm.com> (raw)
In-Reply-To: <20200727184605.2945095-1-cheloha@linux.ibm.com>
On 7/27/20 11:46 AM, Scott Cheloha wrote:
> 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: Scott Cheloha <cheloha@linux.ibm.com>
> ---
> arch/powerpc/include/asm/hvcall.h | 36 +++++++++++++++++++++++++++++++
> arch/powerpc/perf/hv-gpci.c | 9 --------
> arch/powerpc/perf/hv-gpci.h | 27 -----------------------
> 3 files changed, 36 insertions(+), 36 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/hvcall.h b/arch/powerpc/include/asm/hvcall.h
> index e90c073e437e..c338480b4551 100644
> --- a/arch/powerpc/include/asm/hvcall.h
> +++ b/arch/powerpc/include/asm/hvcall.h
> @@ -527,6 +527,42 @@ struct hv_guest_state {
> /* Latest version of hv_guest_state structure */
> #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 /* __KERNEL__ */
> #endif /* _ASM_POWERPC_HVCALL_H */
> diff --git a/arch/powerpc/perf/hv-gpci.c b/arch/powerpc/perf/hv-gpci.c
> index 6884d16ec19b..1667315b82e9 100644
> --- a/arch/powerpc/perf/hv-gpci.c
> +++ b/arch/powerpc/perf/hv-gpci.c
> @@ -123,17 +123,8 @@ static const struct attribute_group *attr_groups[] = {
> 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));
>
> -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,
> u16 secondary_index, u8 version_in, u32 offset, u8 length,
> u64 *value)
> diff --git a/arch/powerpc/perf/hv-gpci.h b/arch/powerpc/perf/hv-gpci.h
> index a3053eda5dcc..4d108262bed7 100644
> --- a/arch/powerpc/perf/hv-gpci.h
> +++ b/arch/powerpc/perf/hv-gpci.h
> @@ -2,33 +2,6 @@
> #ifndef 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;
> -
Hmm, this pretty much guts this header which normally I'd be inclined to suggest
moving the whole thing. The remainder of that header for context:
> /*
> * counter info version => fw version/reference (spec version)
> *
>
* 8 => power8 (1.07)
* [7 is skipped by spec 1.07]
* 6 => TLBIE (1.07)
* 5 => v7r7m0.phyp (1.05)
* [4 skipped]
* 3 => v7r6m0.phyp (?)
* [1,2 skipped]
* 0 => v7r{2,3,4}m0.phyp (?)
*/
#define COUNTER_INFO_VERSION_CURRENT 0x8
/* capability mask masks. */
enum {
HV_GPCI_CM_GA = (1 << 7),
HV_GPCI_CM_EXPANDED = (1 << 6),
HV_GPCI_CM_LAB = (1 << 5)
};
#define REQUEST_FILE "../hv-gpci-requests.h"
#define NAME_LOWER hv_gpci
#define NAME_UPPER HV_GPCI
#include "req-gen/perf.h"
#undef REQUEST_FILE
#undef NAME_LOWER
#undef NAME_UPPER
The side effect of moving seems that we would have to drag "hv-gpci-requests.h"
along as well. So, maybe its best just moving the struct as you've done so it
can be used by code outside of perf.
-Tyrel
next prev parent reply other threads:[~2020-08-05 22:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-27 18:46 [PATCH v2 1/2] powerpc/perf: consolidate GPCI hcall structs into asm/hvcall.h Scott Cheloha
2020-07-27 18:46 ` [PATCH v2 2/2] powerpc/pseries: new lparcfg key/value pair: partition_affinity_score Scott Cheloha
2020-08-05 22:42 ` Tyrel Datwyler
2020-08-06 12:44 ` Michael Ellerman
2020-08-06 15:17 ` Nathan Lynch
2020-08-06 15:18 ` Nathan Lynch
2020-08-05 22:37 ` Tyrel Datwyler [this message]
2020-08-06 15:19 ` [PATCH v2 1/2] powerpc/perf: consolidate GPCI hcall structs into asm/hvcall.h Nathan Lynch
2020-09-09 13:27 ` Michael Ellerman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=44fe3f95-5516-05da-8fcb-a3ad60d3127d@linux.ibm.com \
--to=tyreld@linux.ibm.com \
--cc=cheloha@linux.ibm.com \
--cc=linuxppc-dev@ozlabs.org \
--cc=nathanl@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).