Matthew Poremba has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/36156 )
Change subject: arch-x86: Make CPUID vendor string a param
......................................................................
arch-x86: Make CPUID vendor string a param
Modern libraries such as ROCm, MPI, and libnuma use files in Linux'
sysfs to determine the system topology such as number of CPUs, cache
size, cache associativity, etc. If Linux does not recognize the vendor
string returned by CPUID in x86 it will do a generic initialization
which does not include creating these files. In the case of ROCm
(specifically ROCt) this causes failures when getting device properties.
This can be solved by setting the vendor string to, for example,
AuthenticAMD (as qemu does) so that Linux will create the relevant sysfs
files. Unfortunately, simply changing the string in cpuid.cc to
AuthenticAMD causes simulation slowdown and may not be desirable to all
users. This change creates a parameter, defaulting to M5 Simulator as it
currently is, which can be set in python configuration files to change
the vendor string. Example of how to configure this is:
for i in range(len(self.cpus)):
for j in range(len(self.cpus[i].isa)):
self.cpus[i].isa[j].vendor_string = "AuthenticAMD"
Change-Id: I8de26d5a145867fa23518718a799dd96b5b9bffa
---
M src/arch/x86/X86ISA.py
M src/arch/x86/cpuid.cc
2 files changed, 29 insertions(+), 14 deletions(-)
diff --git a/src/arch/x86/X86ISA.py b/src/arch/x86/X86ISA.py
index d73d99a..1503f5f 100644
--- a/src/arch/x86/X86ISA.py
+++ b/src/arch/x86/X86ISA.py
@@ -34,8 +34,12 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
from m5.objects.BaseISA import BaseISA
+from m5.params import *
class X86ISA(BaseISA):
type = 'X86ISA'
cxx_class = 'X86ISA::ISA'
cxx_header = "arch/x86/isa.hh"
+
+ vendor_string = Param.String("M5 Simulator",
+ "Vendor string for CPUID instruction")
diff --git a/src/arch/x86/cpuid.cc b/src/arch/x86/cpuid.cc
index 64d4544..7b8c250 100644
--- a/src/arch/x86/cpuid.cc
+++ b/src/arch/x86/cpuid.cc
@@ -30,6 +30,7 @@
#include "base/bitfield.hh"
#include "cpu/thread_context.hh"
+#include "params/X86ISA.hh"
namespace X86ISA {
enum StandardCpuidFunction {
@@ -67,8 +68,6 @@
NumExtendedCpuidFuncs
};
- static const int vendorStringSize = 13;
- static const char vendorString[vendorStringSize] = "M5 Simulator";
static const int nameStringSize = 48;
static const char nameString[nameStringSize] = "Fake M5 x86_64 CPU";
@@ -93,12 +92,18 @@
// The extended functions
switch (funcNum) {
case VendorAndLargestExtFunc:
- assert(vendorStringSize >= 12);
- result = CpuidResult(
- 0x80000000 + NumExtendedCpuidFuncs - 1,
- stringToRegister(vendorString),
- stringToRegister(vendorString + 4),
- stringToRegister(vendorString + 8));
+ {
+ const X86ISAParams *p = dynamic_cast<const
X86ISAParams*>(
+
&tc->getIsaPtr()->params());
+ const char *vendor_string = p->vendor_string.c_str();
+ const int vendor_string_size = p->vendor_string.size();
+ assert(vendor_string_size >= 12);
+ result = CpuidResult(
+ 0x80000000 + NumExtendedCpuidFuncs - 1,
+ stringToRegister(vendor_string),
+ stringToRegister(vendor_string + 4),
+ stringToRegister(vendor_string + 8));
+ }
break;
case FamilyModelSteppingBrandFeatures:
result = CpuidResult(0x00020f51, 0x00000405,
@@ -151,12 +156,18 @@
// The standard functions
switch (funcNum) {
case VendorAndLargestStdFunc:
- assert(vendorStringSize >= 12);
- result = CpuidResult(
- NumStandardCpuidFuncs - 1,
- stringToRegister(vendorString),
- stringToRegister(vendorString + 4),
- stringToRegister(vendorString + 8));
+ {
+ const X86ISAParams *p = dynamic_cast<const
X86ISAParams*>(
+
&tc->getIsaPtr()->params());
+ const char *vendor_string = p->vendor_string.c_str();
+ const int vendor_string_size = p->vendor_string.size();
+ assert(vendor_string_size >= 12);
+ result = CpuidResult(
+ NumExtendedCpuidFuncs - 1,
+ stringToRegister(vendor_string),
+ stringToRegister(vendor_string + 4),
+ stringToRegister(vendor_string + 8));
+ }
break;
case FamilyModelStepping:
result = CpuidResult(0x00020f51, 0x00000805,
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/36156
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I8de26d5a145867fa23518718a799dd96b5b9bffa
Gerrit-Change-Number: 36156
Gerrit-PatchSet: 1
Gerrit-Owner: Matthew Poremba <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s