Commit ebd4a5a3 authored by Thiago Jung Bauermann's avatar Thiago Jung Bauermann Committed by Michael Ellerman

powerpc/perf/hv-24x7: Minor improvements

There's an H24x7_DATA_BUFFER_SIZE constant, so use it in init_24x7_request.

There's also an HV_PERF_DOMAIN_MAX constant, so use it in
h_24x7_event_init. This makes the comment above the check redundant,
so remove it.

In add_event_to_24x7_request, a statement is terminated with a comma
instead of a semicolon. Fix it.

In hv-24x7.h, improve comments in struct hv_24x7_result.
Signed-off-by: default avatarThiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 38d81846
...@@ -1049,8 +1049,8 @@ static void init_24x7_request(struct hv_24x7_request_buffer *request_buffer, ...@@ -1049,8 +1049,8 @@ static void init_24x7_request(struct hv_24x7_request_buffer *request_buffer,
struct hv_24x7_data_result_buffer *result_buffer) struct hv_24x7_data_result_buffer *result_buffer)
{ {
memset(request_buffer, 0, 4096); memset(request_buffer, 0, H24x7_DATA_BUFFER_SIZE);
memset(result_buffer, 0, 4096); memset(result_buffer, 0, H24x7_DATA_BUFFER_SIZE);
request_buffer->interface_version = HV_24X7_IF_VERSION_CURRENT; request_buffer->interface_version = HV_24X7_IF_VERSION_CURRENT;
/* memset above set request_buffer->num_requests to 0 */ /* memset above set request_buffer->num_requests to 0 */
...@@ -1126,7 +1126,7 @@ static int add_event_to_24x7_request(struct perf_event *event, ...@@ -1126,7 +1126,7 @@ static int add_event_to_24x7_request(struct perf_event *event,
req->performance_domain = event_get_domain(event); req->performance_domain = event_get_domain(event);
req->data_size = cpu_to_be16(8); req->data_size = cpu_to_be16(8);
req->data_offset = cpu_to_be32(event_get_offset(event)); req->data_offset = cpu_to_be32(event_get_offset(event));
req->starting_lpar_ix = cpu_to_be16(event_get_lpar(event)), req->starting_lpar_ix = cpu_to_be16(event_get_lpar(event));
req->max_num_lpars = cpu_to_be16(1); req->max_num_lpars = cpu_to_be16(1);
req->starting_ix = cpu_to_be16(idx); req->starting_ix = cpu_to_be16(idx);
req->max_ix = cpu_to_be16(1); req->max_ix = cpu_to_be16(1);
...@@ -1218,9 +1218,8 @@ static int h_24x7_event_init(struct perf_event *event) ...@@ -1218,9 +1218,8 @@ static int h_24x7_event_init(struct perf_event *event)
return -EINVAL; return -EINVAL;
} }
/* Domains above 6 are invalid */
domain = event_get_domain(event); domain = event_get_domain(event);
if (domain > 6) { if (domain >= HV_PERF_DOMAIN_MAX) {
pr_devel("invalid domain %d\n", domain); pr_devel("invalid domain %d\n", domain);
return -EINVAL; return -EINVAL;
} }
......
...@@ -71,6 +71,10 @@ struct hv_24x7_result_element { ...@@ -71,6 +71,10 @@ struct hv_24x7_result_element {
} __packed; } __packed;
struct hv_24x7_result { struct hv_24x7_result {
/*
* The index of the 24x7 Request Structure in the 24x7 Request Buffer
* used to request this result.
*/
__u8 result_ix; __u8 result_ix;
/* /*
...@@ -81,7 +85,12 @@ struct hv_24x7_result { ...@@ -81,7 +85,12 @@ struct hv_24x7_result {
__u8 results_complete; __u8 results_complete;
__be16 num_elements_returned; __be16 num_elements_returned;
/* This is a copy of @data_size from the corresponding hv_24x7_request */ /*
* This is a copy of @data_size from the corresponding hv_24x7_request
*
* Warning: to obtain the size of each element in @elements you have
* to add the size of the other members of the result_element struct.
*/
__be16 result_element_data_size; __be16 result_element_data_size;
__u8 reserved[0x2]; __u8 reserved[0x2];
......
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