Skip to content
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

8263260: [s390] Support latest hardware (z14 and z15) #2918

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
133 changes: 81 additions & 52 deletions src/hotspot/cpu/s390/vm_version_s390.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include "compiler/disassembler.hpp"
#include "code/compiledIC.hpp"
#include "memory/resourceArea.hpp"
#include "runtime/globals_extension.hpp"
#include "runtime/java.hpp"
#include "runtime/stubCodeGenerator.hpp"
#include "runtime/vm_version.hpp"
Expand All @@ -48,9 +47,25 @@ unsigned int VM_Version::_nmsgdigest_features = 0;
unsigned int VM_Version::_Dcache_lineSize = DEFAULT_CACHE_LINE_SIZE;
unsigned int VM_Version::_Icache_lineSize = DEFAULT_CACHE_LINE_SIZE;

static const char* z_gen[] = {" ", "G1", "G2", "G3", "G4", "G5", "G6", "G7" };
static const char* z_machine[] = {" ", "2064", "2084", "2094", "2097", "2817", " ", "2964" };
static const char* z_name[] = {" ", "z900", "z990", "z9 EC", "z10 EC", "z196 EC", "ec12", "z13" };
// The following list contains the (approximate) announcement/availability
// dates of the many System z generations in existence as of now.
// Information compiled from https://www.ibm.com/support/techdocs/atsmastr.nsf/WebIndex/TD105503
// z900: 2000-10
// z990: 2003-06
// z9: 2005-09
// z10: 2007-04
// z10: 2008-02
// z196: 2010-08
// ec12: 2012-09
// z13: 2015-03
// z14: 2017-09
// z15: 2019-09

static const char* z_gen[] = {" ", "G1", "G2", "G3", "G4", "G5", "G6", "G7", "G8", "G9" };
static const char* z_machine[] = {" ", "2064", "2084", "2094", "2097", "2817", "2827", "2964", "3906", "8561" };
static const char* z_name[] = {" ", "z900", "z990", "z9 EC", "z10 EC", "z196 EC", "ec12", "z13", "z14", "z15" };
static const char* z_WDFM[] = {" ", "2006-06-30", "2008-06-30", "2010-06-30", "2012-06-30", "2014-06-30", "2016-12-31", "2019-06-30", "2021-06-30", "tbd" };
static const char* z_EOS[] = {" ", "2014-12-31", "2014-12-31", "2017-10-31", "2019-12-31", "2021-12-31", "tbd", "tbd", "tbd", "tbd" };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Table provides a nice overview, but seems like only z_name is used in the code. The rest only serves as comments.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, as of now, the tables are mostly for documentation. z_EOS is used now to fill _features_string. I'd like to keep the tables as they are for possible future use.


void VM_Version::initialize() {
determine_features(); // Get processor capabilities.
Expand Down Expand Up @@ -273,72 +288,86 @@ void VM_Version::set_features_string() {
// Furthermore, use one, and only one, separator space between features.
// Multiple spaces are considered separate tokens, messing up everything.
unsigned int ambiguity = 0;
_model_string = z_name[0];
unsigned int model_ix = 0;
if (is_z15()) {
_features_string = "system-z g9-z15 ldisp_fast, extimm, pcrel_load/store, cmpb, cond_load/store, interlocked_update, txm, vectorinstr, instrext2, venh1, instrext3, VEnh2 )";
model_ix = 9;
ambiguity++;
}
if (is_z14()) {
_features_string = "system-z g8-z14 ldisp_fast, extimm, pcrel_load/store, cmpb, cond_load/store, interlocked_update, txm, vectorinstr, instrext2, venh1)";
model_ix = 8;
ambiguity++;
}
if (is_z13()) {
_features_string = "system-z, g7-z13, ldisp_fast, extimm, pcrel_load/store, cmpb, cond_load/store, interlocked_update, txm, vectorinstr";
_model_string = z_name[7];
model_ix = 7;
ambiguity++;
}
if (is_ec12()) {
_features_string = "system-z, g6-ec12, ldisp_fast, extimm, pcrel_load/store, cmpb, cond_load/store, interlocked_update, txm";
_model_string = z_name[6];
model_ix = 6;
ambiguity++;
}
if (is_z196()) {
_features_string = "system-z, g5-z196, ldisp_fast, extimm, pcrel_load/store, cmpb, cond_load/store, interlocked_update";
_model_string = z_name[5];
model_ix = 5;
ambiguity++;
}
if (is_z10()) {
_features_string = "system-z, g4-z10, ldisp_fast, extimm, pcrel_load/store, cmpb";
_model_string = z_name[4];
model_ix = 4;
ambiguity++;
}
if (is_z9()) {
_features_string = "system-z, g3-z9, ldisp_fast, extimm, out-of-support as of 2016-04-01";
_model_string = z_name[3];
_features_string = "system-z, g3-z9, ldisp_fast, extimm";
model_ix = 3;
ambiguity++;
}
if (is_z990()) {
_features_string = "system-z, g2-z990, ldisp_fast, out-of-support as of 2014-07-01";
_model_string = z_name[2];
_features_string = "system-z, g2-z990, ldisp_fast";
model_ix = 2;
ambiguity++;
}
if (is_z900()) {
_features_string = "system-z, g1-z900, ldisp, out-of-support as of 2014-07-01";
_model_string = z_name[1];
_features_string = "system-z, g1-z900, ldisp";
model_ix = 1;
ambiguity++;
}

char buf[512];
if (ambiguity == 0) {
_features_string = "z/Architecture (unknown generation)";
strcpy(buf, "z/Architecture (unknown generation)");
} else if (ambiguity == 1) {
_model_string = z_name[model_ix];
jio_snprintf(buf, sizeof(buf), "%s, out-of-support_as_of_", _features_string, z_EOS[model_ix]);
} else if (ambiguity > 1) {
tty->print_cr("*** WARNING *** Ambiguous z/Architecture detection, ambiguity = %d", ambiguity);
tty->print_cr(" oldest detected generation is %s", _features_string);
_features_string = "z/Architecture (ambiguous detection)";
strcpy(buf, "z/Architecture (ambiguous detection)");
}
_features_string = os::strdup(buf);

if (has_Crypto_AES()) {
char buf[256];
assert(strlen(_features_string) + 3*8 < sizeof(buf), "increase buffer size");
jio_snprintf(buf, sizeof(buf), "%s%s%s%s",
_features_string,
has_Crypto_AES128() ? ", aes128" : "",
has_Crypto_AES192() ? ", aes192" : "",
has_Crypto_AES256() ? ", aes256" : "");
os::free((void *)_features_string);
_features_string = os::strdup(buf);
}

if (has_Crypto_SHA()) {
char buf[256];
assert(strlen(_features_string) + 6 + 2*8 + 7 < sizeof(buf), "increase buffer size");
jio_snprintf(buf, sizeof(buf), "%s%s%s%s%s",
_features_string,
has_Crypto_SHA1() ? ", sha1" : "",
has_Crypto_SHA256() ? ", sha256" : "",
has_Crypto_SHA512() ? ", sha512" : "",
has_Crypto_GHASH() ? ", ghash" : "");
if (has_Crypto_AES()) { os::free((void *)_features_string); }
os::free((void *)_features_string);
_features_string = os::strdup(buf);
}
}
Expand Down Expand Up @@ -431,11 +460,14 @@ void VM_Version::print_features_internal(const char* text, bool print_anyway) {
if (has_CryptoExt5() ) tty->print_cr("available: %s", "Crypto Extensions 5");
if (has_DFPPackedConversion() ) tty->print_cr("available: %s", "DFP Packed Conversions");
if (has_VectorFacility() ) tty->print_cr("available: %s", "Vector Facility");
// test switches
if (has_TestFeature1Impl() ) tty->print_cr("available: %s", "TestFeature1Impl");
if (has_TestFeature2Impl() ) tty->print_cr("available: %s", "TestFeature2Impl");
if (has_TestFeature4Impl() ) tty->print_cr("available: %s", "TestFeature4Impl");
if (has_TestFeature8Impl() ) tty->print_cr("available: %s", "TestFeature8Impl");
// z14
if (has_MiscInstrExt2() ) tty->print_cr("available: %s", "Miscelaneous Instruction Extensions 2");
if (has_VectorEnhancements1() ) tty->print_cr("available: %s", "Vector Facility Enhancements 3");
if (has_CryptoExt8() ) tty->print_cr("available: %s", "Crypto Extensions 8");
// z15
if (has_MiscInstrExt3() ) tty->print_cr("available: %s", "Miscelaneous Instruction Extensions 3");
if (has_VectorEnhancements2() ) tty->print_cr("available: %s", "Vector Facility Enhancements 3");
if (has_CryptoExt9() ) tty->print_cr("available: %s", "Crypto Extensions 9");

if (has_Crypto()) {
tty->cr();
Expand Down Expand Up @@ -643,6 +675,26 @@ void VM_Version::set_features_z13(bool reset) {
set_has_VectorFacility();
}

void VM_Version::set_features_z14(bool reset) {
reset_features(reset);

set_features_z13(false);
set_has_MiscInstrExt2();
set_has_VectorEnhancements1();
has_VectorPackedDecimal();
set_has_CryptoExt8();
}

void VM_Version::set_features_z15(bool reset) {
reset_features(reset);

set_features_z14(false);
set_has_MiscInstrExt3();
set_has_VectorEnhancements2();
has_VectorPackedDecimalEnh();
set_has_CryptoExt9();
}

void VM_Version::set_features_from(const char* march) {
bool err = false;
bool prt = false;
Expand Down Expand Up @@ -672,33 +724,10 @@ void VM_Version::set_features_from(const char* march) {
set_features_ec12();
} else if (!strcmp(march, "z13")) {
set_features_z13();
} else if (!strcmp(buf, "ztest")) {
assert(!has_TestFeaturesImpl(), "possible facility list flag conflict");
if (strlen(march) > hdr_len) {
int itest = 0;
if ((strlen(march)-hdr_len) >= buf_len) err = true;
if (!err) {
memcpy(buf, &march[hdr_len], strlen(march)-hdr_len);
buf[strlen(march)-hdr_len] = '\00';
for (size_t i = 0; !err && (i < strlen(buf)); i++) {
itest = itest*10 + buf[i]-'0';
err = err || ((buf[i]-'0') < 0) || ((buf[i]-'0') > 9) || (itest > 15);
}
}
if (!err) {
prt = true;
if (itest & 0x01) { set_has_TestFeature1Impl(); }
if (itest & 0x02) { set_has_TestFeature2Impl(); }
if (itest & 0x04) { set_has_TestFeature4Impl(); }
if (itest & 0x08) { set_has_TestFeature8Impl(); }
}
} else {
prt = true;
set_has_TestFeature1Impl();
set_has_TestFeature2Impl();
set_has_TestFeature4Impl();
set_has_TestFeature8Impl();
}
} else if (!strcmp(march, "z14")) {
set_features_z14();
} else if (!strcmp(march, "z15")) {
set_features_z15();
} else {
err = true;
}
Expand Down
Loading