-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Identify and arbitrate based on the ARM CPU version
- Loading branch information
1 parent
f7e851a
commit 4b59510
Showing
8 changed files
with
241 additions
and
46 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright 2019-2022 Lawrence Livermore National Security, LLC and other | ||
// Variorum Project Developers. See the top-level LICENSE file for details. | ||
// | ||
// SPDX-License-Identifier: MIT | ||
|
||
#ifndef ARM_JUNO_R2_H_INCLUDE | ||
#define ARM_JUNO_R2_H_INCLUDE | ||
|
||
#include <jansson.h> | ||
|
||
int arm_juno_r2_get_power(int long_ver); | ||
|
||
int arm_juno_r2_get_thermals(int long_ver); | ||
|
||
int arm_juno_r2_get_clocks(int long_ver); | ||
|
||
int arm_juno_r2_get_frequencies(void); | ||
|
||
int arm_juno_r2_cap_socket_frequency(int cpuid, int freq); | ||
|
||
int arm_juno_r2_get_power_json(char **get_power_obj_str); | ||
|
||
int arm_juno_r2_get_power_domain_info_json(char **get_domain_obj_str); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
// Copyright 2019-2022 Lawrence Livermore National Security, LLC and other | ||
// Variorum Project Developers. See the top-level LICENSE file for details. | ||
// | ||
// SPDX-License-Identifier: MIT | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <inttypes.h> | ||
#include <unistd.h> | ||
#include <sys/types.h> | ||
#include <sys/stat.h> | ||
|
||
#include <ARM_Neoverse_N1.h> | ||
#include <config_architecture.h> | ||
#include <variorum_error.h> | ||
#include <power_features.h> | ||
|
||
int arm_neoverse_n1_get_power(int long_ver) | ||
{ | ||
int ret = 0; | ||
|
||
char *val = getenv("VARIORUM_LOG"); | ||
if (val != NULL && atoi(val) == 1) | ||
{ | ||
printf("Running %s\n", __FUNCTION__); | ||
} | ||
|
||
ret = get_power_data(long_ver, stdout); | ||
|
||
return ret; | ||
} | ||
|
||
int arm_neoverse_n1_get_thermals(int long_ver) | ||
{ | ||
int ret = 0; | ||
|
||
char *val = getenv("VARIORUM_LOG"); | ||
if (val != NULL && atoi(val) == 1) | ||
{ | ||
printf("Running %s\n", __FUNCTION__); | ||
} | ||
|
||
ret = get_thermal_data(long_ver, stdout); | ||
|
||
return ret; | ||
} | ||
|
||
int arm_neoverse_n1_get_clocks(int long_ver) | ||
{ | ||
int ret = 0; | ||
unsigned iter = 0; | ||
unsigned nsockets; | ||
|
||
char *val = getenv("VARIORUM_LOG"); | ||
if (val != NULL && atoi(val) == 1) | ||
{ | ||
printf("Running %s\n", __FUNCTION__); | ||
} | ||
|
||
variorum_get_topology(&nsockets, NULL, NULL, P_ARM_CPU_IDX); | ||
for (iter = 0; iter < nsockets; iter++) | ||
{ | ||
ret = get_clocks_data(iter, long_ver, stdout); | ||
} | ||
|
||
return ret; | ||
} | ||
|
||
int arm_neoverse_n1_get_frequencies(void) | ||
{ | ||
int ret = 0; | ||
unsigned iter = 0; | ||
unsigned nsockets; | ||
|
||
char *val = getenv("VARIORUM_LOG"); | ||
if (val != NULL && atoi(val) == 1) | ||
{ | ||
printf("Running %s\n", __FUNCTION__); | ||
} | ||
|
||
variorum_get_topology(&nsockets, NULL, NULL, P_ARM_CPU_IDX); | ||
for (iter = 0; iter < nsockets; iter++) | ||
{ | ||
ret = get_frequencies(iter, stdout); | ||
} | ||
|
||
return ret; | ||
} | ||
|
||
int arm_neoverse_n1_cap_socket_frequency(int cpuid, int freq) | ||
{ | ||
int ret = 0; | ||
unsigned nsockets; | ||
|
||
char *val = getenv("VARIORUM_LOG"); | ||
if (val != NULL && atoi(val) == 1) | ||
{ | ||
printf("Running %s\n", __FUNCTION__); | ||
} | ||
|
||
variorum_get_topology(&nsockets, NULL, NULL, P_ARM_CPU_IDX); | ||
if (cpuid < 0 || cpuid >= (int)nsockets) | ||
{ | ||
fprintf(stdout, "The specified CPU ID does not exist\n"); | ||
return -1; | ||
} | ||
ret = cap_socket_frequency(cpuid, freq); | ||
|
||
return ret; | ||
} | ||
|
||
int arm_neoverse_n1_get_power_json(char **get_power_obj_str) | ||
{ | ||
int ret = 0; | ||
|
||
char *val = getenv("VARIORUM_LOG"); | ||
if (val != NULL && atoi(val) == 1) | ||
{ | ||
printf("Running %s\n", __FUNCTION__); | ||
} | ||
|
||
json_t *get_power_obj = json_object(); | ||
|
||
ret = json_get_power_data(get_power_obj); | ||
|
||
*get_power_obj_str = json_dumps(get_power_obj, 0); | ||
json_decref(get_power_obj); | ||
|
||
return ret; | ||
} | ||
|
||
int arm_neoverse_n1_get_power_domain_info_json(char **get_domain_obj_str) | ||
{ | ||
int ret = 0; | ||
|
||
char *val = getenv("VARIORUM_LOG"); | ||
if (val != NULL && atoi(val) == 1) | ||
{ | ||
printf("Running %s\n", __FUNCTION__); | ||
} | ||
|
||
json_t *get_domain_obj = json_object(); | ||
|
||
ret = json_get_power_domain_info(get_domain_obj); | ||
|
||
*get_domain_obj_str = json_dumps(get_domain_obj, 0); | ||
json_decref(get_domain_obj); | ||
|
||
return ret; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright 2019-2022 Lawrence Livermore National Security, LLC and other | ||
// Variorum Project Developers. See the top-level LICENSE file for details. | ||
// | ||
// SPDX-License-Identifier: MIT | ||
|
||
#ifndef ARM_NEOVERSE_N1_H_INCLUDE | ||
#define ARM_NEOVERSE_N1_H_INCLUDE | ||
|
||
#include <jansson.h> | ||
|
||
int arm_neoverse_n1_get_power(int long_ver); | ||
|
||
int arm_neoverse_n1_get_thermals(int long_ver); | ||
|
||
int arm_neoverse_n1_get_clocks(int long_ver); | ||
|
||
int arm_neoverse_n1_get_frequencies(void); | ||
|
||
int arm_neoverse_n1_cap_socket_frequency(int cpuid, int freq); | ||
|
||
int arm_neoverse_n1_get_power_json(char **get_power_obj_str); | ||
|
||
int arm_neoverse_n1_get_power_domain_info_json(char **get_domain_obj_str); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters