-
Notifications
You must be signed in to change notification settings - Fork 355
Add initial support for powerpc64le initialization. #267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
68fecdb
71c527b
7a0371d
120dbed
33cc865
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,9 @@ | |
#define CORE_ID_FILENAME_FORMAT "/sys/devices/system/cpu/cpu%" PRIu32 "/topology/core_id" | ||
#define CORE_ID_FILESIZE 32 | ||
|
||
#define PROCESSOR_ONLINE_FILENAME_SIZE (sizeof("/sys/devices/system/cpu/cpu" STRINGIFY(UINT32_MAX) "/online")) | ||
#define PROCESSOR_ONLINE_FILENAME_FORMAT "/sys/devices/system/cpu/cpu%" PRIu32 "/online" | ||
#define PROCESSOR_ONLINE_FILESIZE 32 | ||
#define CORE_CPUS_FILENAME_SIZE (sizeof("/sys/devices/system/cpu/cpu" STRINGIFY(UINT32_MAX) "/topology/core_cpus_list")) | ||
#define CORE_CPUS_FILENAME_FORMAT "/sys/devices/system/cpu/cpu%" PRIu32 "/topology/core_cpus_list" | ||
#define CORE_SIBLINGS_FILENAME_SIZE \ | ||
|
@@ -280,6 +283,31 @@ bool cpuinfo_linux_get_processor_package_id(uint32_t processor, uint32_t package | |
} | ||
} | ||
|
||
bool cpuinfo_linux_get_processor_online_status(uint32_t processor, uint32_t* online_status_ptr) { | ||
char processor_online_filename[PROCESSOR_ONLINE_FILENAME_SIZE]; | ||
const int chars_formatted = | ||
snprintf(processor_online_filename, PROCESSOR_ONLINE_FILENAME_SIZE, PROCESSOR_ONLINE_FILENAME_FORMAT, processor); | ||
if ((unsigned int)chars_formatted >= PROCESSOR_ONLINE_FILENAME_SIZE) { | ||
cpuinfo_log_warning("failed to format filename for online status of processor %" PRIu32, processor); | ||
return 0; | ||
} | ||
uint32_t online_status; | ||
if (cpuinfo_linux_parse_small_file(processor_online_filename, PROCESSOR_ONLINE_FILESIZE, uint32_parser, &online_status)) { | ||
cpuinfo_log_debug( | ||
"parsed online status value of %" PRIu32 " for logical processor %" PRIu32 " from %s", | ||
online_status, | ||
processor, | ||
processor_online_filename); | ||
*online_status_ptr = online_status; | ||
return true; | ||
} else { | ||
cpuinfo_log_info( | ||
"failed to parse online status for processor %" PRIu32 " from %s", processor, processor_online_filename); | ||
return false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indent seems wrong here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah, I will fix all the indent errors There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @malfet I have fixed indentation. could you review it |
||
} | ||
} | ||
|
||
|
||
static bool max_processor_number_parser(uint32_t processor_list_start, uint32_t processor_list_end, void* context) { | ||
uint32_t* processor_number_ptr = (uint32_t*)context; | ||
const uint32_t processor_list_last = processor_list_end - 1; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#pragma once | ||
|
||
#include <stdbool.h> | ||
#include <stdint.h> | ||
|
||
#include <cpuinfo.h> | ||
|
||
enum cpuinfo_powerpc_chipset_vendor { | ||
cpuinfo_powerpc_chipset_vendor_unknown = 0, | ||
cpuinfo_powerpc_chipset_vendor_ibm | ||
}; | ||
void cpuinfo_powerpc_decode_vendor_uarch( | ||
uint32_t vendor_id, | ||
enum cpuinfo_vendor vendor[restrict static 1], | ||
enum cpuinfo_uarch uarch[restrict static 1]); | ||
|
||
void cpuinfo_powerpc_decode_cache( | ||
struct cpuinfo_cache l1i[restrict static 1], | ||
struct cpuinfo_cache l1d[restrict static 1], | ||
struct cpuinfo_cache l2[restrict static 1], | ||
struct cpuinfo_cache l3[restrict static 1]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please mention in PR description that it adds a new property (though I though there were already one) And where is it initialized for other architectures?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @malfet for reviewing it. Updated the commit description and the Processor Version Register (PVR) on PowerPC (ppc64) architectures uniquely identifies the processor version and revision. Other CPU architectures provide similar capabilities, though they go by different names and mechanisms , for example
ARM / AArch64 : MIDR
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @malfet
The 'disabled' field was declared for configurations other than SMT8 mode, but it is already handled during PowerPC64 Linux system initialization. This latest commit removes the redundant code. please review it