Skip to content
Permalink
Browse files
8262491: AArch64: CPU description should contain compatible board list
Reviewed-by: akozlov, aph
  • Loading branch information
YaSuenag committed Mar 13, 2021
1 parent 86e4c75 commit a5287710647c61c01fc98c71f77edaf9f89d9804
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -130,6 +130,8 @@ class VM_Version : public Abstract_VM_Version {

static bool supports_fast_class_init_checks() { return true; }
constexpr static bool supports_stack_watermark_barrier() { return true; }

static void get_compatible_board(char *buf, int buflen);
};

#endif // CPU_AARCH64_VM_VERSION_AARCH64_HPP
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -51,7 +51,12 @@ void VM_Version_Ext::initialize_cpu_information(void) {
_no_of_threads = _no_of_cores;
_no_of_sockets = _no_of_cores;
snprintf(_cpu_name, CPU_TYPE_DESC_BUF_SIZE - 1, "AArch64");
snprintf(_cpu_desc, CPU_DETAILED_DESC_BUF_SIZE, "AArch64 %s", _features_string);

int desc_len = snprintf(_cpu_desc, CPU_DETAILED_DESC_BUF_SIZE, "AArch64 ");
VM_Version::get_compatible_board(_cpu_desc + desc_len, CPU_DETAILED_DESC_BUF_SIZE - desc_len);
desc_len = (int)strlen(_cpu_desc);
snprintf(_cpu_desc + desc_len, CPU_DETAILED_DESC_BUF_SIZE - desc_len, " %s", _features_string);

_initialized = true;
}

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -167,3 +167,25 @@ void VM_Version::get_os_cpu_info() {
fclose(f);
}
}

void VM_Version::get_compatible_board(char *buf, int buflen) {
assert(buf != NULL, "invalid argument");
assert(buflen >= 1, "invalid argument");
*buf = '\0';
int fd = open("/proc/device-tree/compatible", O_RDONLY);
if (fd != -1) {
ssize_t read_sz = read(fd, buf, buflen - 1);
if (read_sz > 0) {
buf[read_sz] = '\0';
// Replace '\0' to ' '
for (char *ch = buf; ch < buf + read_sz; ch++) {
if (*ch == '\0') {
*ch = ' ';
}
}
} else {
*buf = '\0';
}
close(fd);
}
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, Microsoft Corporation. All rights reserved.
* Copyright (c) 2020, 2021, Microsoft Corporation. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -97,3 +97,9 @@ void VM_Version::get_os_cpu_info() {
}
}
}

void VM_Version::get_compatible_board(char *buf, int buflen) {
assert(buf != NULL, "invalid argument");
assert(buflen >= 1, "invalid argument");
*buf = '\0';
}

1 comment on commit a528771

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on a528771 Mar 13, 2021

Please sign in to comment.