Commit ea4e757d authored by Daniel Kurtz's avatar Daniel Kurtz Committed by Commit Bot

Add support for AMD Excavator Microarchitecture

Currently the Microarchitecture table in cpu_identity only supports Intel
Microarchitectures.  Add an entry for the AMD Excavator microarchitecture.

BUG=b:69376360
TEST=unit_tests --gtest_filter="CpuIdentityTest.*"
R=chongjiang@chromium.org,sque@chromium.org

Change-Id: I255596e330e0353ab4bec2d51ea25d2420cbcb30
Reviewed-on: https://chromium-review.googlesource.com/1033457Reviewed-by: default avatarSimon Que <sque@chromium.org>
Commit-Queue: Daniel Kurtz <djkurtz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555469}
parent 67e2237c
......@@ -59,6 +59,7 @@ const CpuUarchTableEntry kCpuUarchTable[] = {
{"0F_03", "Prescott"},
{"0F_04", "Prescott"},
{"0F_06", "Presler"},
{"0F_70", "Excavator"}, // AMD Stoney Ridge
};
const CpuUarchTableEntry* kCpuUarchTableEnd =
......@@ -78,8 +79,8 @@ CPUIdentity::CPUIdentity(const CPUIdentity& other) = default;
CPUIdentity::~CPUIdentity() {}
std::string GetCpuUarch(const CPUIdentity& cpuid) {
if (cpuid.vendor != "GenuineIntel")
return std::string(); // Non-Intel
if (cpuid.vendor != "GenuineIntel" && cpuid.vendor != "AuthenticAMD")
return std::string(); // Non-Intel or -AMD
std::string family_model =
base::StringPrintf("%02X_%02X", cpuid.family, cpuid.model);
......
......@@ -32,8 +32,8 @@ struct CPUIdentity {
CPUIdentity GetCPUIdentity();
// Return the CPU microarchitecture based on the family and model derived
// from |cpuid|, and kCpuUarchTable, or the empty string for non-Intel or
// unknown microarchitectures.
// from |cpuid|, and kCpuUarchTable, or the empty string for unknown
// microarchitectures.
std::string GetCpuUarch(const CPUIdentity& cpuid);
// Simplify a CPU model name. The rules are:
......
......@@ -37,6 +37,16 @@ TEST(CpuIdentityTest, DefaultCommandsBasedOnUarch_SandyBridge) {
EXPECT_EQ("SandyBridge", GetCpuUarch(cpuid));
}
TEST(CpuIdentityTest, DefaultCommandsBasedOnUarch_Excavator) {
CPUIdentity cpuid;
cpuid.arch = "x86_64";
cpuid.vendor = "AuthenticAMD";
cpuid.family = 0x0f;
cpuid.model = 0x70; // Excavator
cpuid.model_name = "";
EXPECT_EQ("Excavator", GetCpuUarch(cpuid));
}
TEST(CpuIdentityTest, DefaultCommandsBasedOnArch_x86_32) {
CPUIdentity cpuid;
cpuid.arch = "x86";
......@@ -50,7 +60,7 @@ TEST(CpuIdentityTest, DefaultCommandsBasedOnArch_x86_32) {
TEST(CpuIdentityTest, DefaultCommandsBasedOnArch_Unknown) {
CPUIdentity cpuid;
cpuid.arch = "x86_64";
cpuid.vendor = "NotIntel";
cpuid.vendor = "NotIntelOrAmd";
cpuid.family = 0;
cpuid.model = 0;
cpuid.model_name = "";
......
......@@ -274,7 +274,8 @@ std::vector<RandomSelector::WeightAndValue> GetDefaultCommandsForCpu(
// that is the narrowest match for the CPU identified by |cpuid|.
// Valid CPU specifiers, in increasing order of specificity, are:
// "default", a system architecture (e.g. "x86_64"), a CPU microarchitecture
// (currently only Intel uarchs supported), or a CPU model name substring.
// (currently only some Intel and AMD uarchs supported), or a CPU model name
// substring.
std::string FindBestCpuSpecifierFromParams(
const std::map<std::string, std::string>& params,
const CPUIdentity& cpuid);
......
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