[gem5-dev] Change in gem5/gem5[develop]: fastmodel: replace memory space id lookup with getMemorySpaceId

2021-08-01 Thread Yu-hsin Wang (Gerrit) via gem5-dev
Yu-hsin Wang has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/48868 )


Change subject: fastmodel: replace memory space id lookup with  
getMemorySpaceId

..

fastmodel: replace memory space id lookup with getMemorySpaceId

Change-Id: Ib16ea3b92dadc149461fc40f8d85554b7afed656
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48868
Reviewed-by: Gabe Black 
Maintainer: Gabe Black 
Tested-by: kokoro 
---
M src/arch/arm/fastmodel/CortexA76/thread_context.cc
M src/arch/arm/fastmodel/CortexR52/thread_context.cc
2 files changed, 18 insertions(+), 34 deletions(-)

Approvals:
  Gabe Black: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/arch/arm/fastmodel/CortexA76/thread_context.cc  
b/src/arch/arm/fastmodel/CortexA76/thread_context.cc

index 47e5ab0..735e06d 100644
--- a/src/arch/arm/fastmodel/CortexA76/thread_context.cc
+++ b/src/arch/arm/fastmodel/CortexA76/thread_context.cc
@@ -67,15 +67,8 @@
 Iris::PhysicalMemorySecureMsn : Iris::PhysicalMemoryNonSecureMsn;

 // Figure out what memory spaces match the canonical numbers we need.
-iris::MemorySpaceId in = iris::IRIS_UINT64_MAX;
-iris::MemorySpaceId out = iris::IRIS_UINT64_MAX;
-
-for (auto : memorySpaces) {
-if (space.canonicalMsn == in_msn)
-in = space.spaceId;
-else if (space.canonicalMsn == out_msn)
-out = space.spaceId;
-}
+iris::MemorySpaceId in = getMemorySpaceId(in_msn);
+iris::MemorySpaceId out = getMemorySpaceId(out_msn);

 panic_if(in == iris::IRIS_UINT64_MAX || out == iris::IRIS_UINT64_MAX,
 "Canonical IRIS memory space numbers not found.");
@@ -188,14 +181,13 @@
 CortexA76TC::getBpSpaceIds() const
 {
 if (bpSpaceIds.empty()) {
-for (auto : memorySpaces) {
-auto cmsn = space.canonicalMsn;
-if (cmsn == Iris::SecureMonitorMsn ||
-cmsn == Iris::GuestMsn ||
-cmsn == Iris::NsHypMsn ||
-cmsn == Iris::HypAppMsn) {
-bpSpaceIds.push_back(space.spaceId);
-}
+std::vector msns{
+Iris::SecureMonitorMsn, Iris::GuestMsn, Iris::NsHypMsn,
+Iris::HypAppMsn};
+for (auto  : msns) {
+auto id = getMemorySpaceId(msn);
+if (id != iris::IRIS_UINT64_MAX)
+bpSpaceIds.push_back(id);
 }
 panic_if(bpSpaceIds.empty(),
 "Unable to find address space(s) for breakpoints.");
diff --git a/src/arch/arm/fastmodel/CortexR52/thread_context.cc  
b/src/arch/arm/fastmodel/CortexR52/thread_context.cc

index 5bedf5a..0f2dfa0 100644
--- a/src/arch/arm/fastmodel/CortexR52/thread_context.cc
+++ b/src/arch/arm/fastmodel/CortexR52/thread_context.cc
@@ -67,15 +67,8 @@
 Iris::PhysicalMemorySecureMsn : Iris::PhysicalMemoryNonSecureMsn;

 // Figure out what memory spaces match the canonical numbers we need.
-iris::MemorySpaceId in = iris::IRIS_UINT64_MAX;
-iris::MemorySpaceId out = iris::IRIS_UINT64_MAX;
-
-for (auto : memorySpaces) {
-if (space.canonicalMsn == in_msn)
-in = space.spaceId;
-else if (space.canonicalMsn == out_msn)
-out = space.spaceId;
-}
+iris::MemorySpaceId in = getMemorySpaceId(in_msn);
+iris::MemorySpaceId out = getMemorySpaceId(out_msn);

 panic_if(in == iris::IRIS_UINT64_MAX || out == iris::IRIS_UINT64_MAX,
 "Canonical IRIS memory space numbers not found.");
@@ -155,14 +148,13 @@
 CortexR52TC::getBpSpaceIds() const
 {
 if (bpSpaceIds.empty()) {
-for (auto : memorySpaces) {
-auto cmsn = space.canonicalMsn;
-if (cmsn == Iris::SecureMonitorMsn ||
-cmsn == Iris::GuestMsn ||
-cmsn == Iris::NsHypMsn ||
-cmsn == Iris::HypAppMsn) {
-bpSpaceIds.push_back(space.spaceId);
-}
+std::vector msns{
+Iris::SecureMonitorMsn, Iris::GuestMsn, Iris::NsHypMsn,
+Iris::HypAppMsn};
+for (auto  : msns) {
+auto id = getMemorySpaceId(msn);
+if (id != iris::IRIS_UINT64_MAX)
+bpSpaceIds.push_back(id);
 }
 panic_if(bpSpaceIds.empty(),
 "Unable to find address space(s) for breakpoints.");

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/48868
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: Ib16ea3b92dadc149461fc40f8d85554b7afed656
Gerrit-Change-Number: 48868
Gerrit-PatchSet: 2
Gerrit-Owner: Yu-hsin Wang 
Gerrit-Reviewer: Earl Ou 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Yu-hsin Wang 
Gerrit-Reviewer: kokoro 

[gem5-dev] Change in gem5/gem5[develop]: fastmodel: replace memory space id lookup with getMemorySpaceId

2021-07-29 Thread Yu-hsin Wang (Gerrit) via gem5-dev
Yu-hsin Wang has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/48868 )



Change subject: fastmodel: replace memory space id lookup with  
getMemorySpaceId

..

fastmodel: replace memory space id lookup with getMemorySpaceId

Change-Id: Ib16ea3b92dadc149461fc40f8d85554b7afed656
---
M src/arch/arm/fastmodel/CortexA76/thread_context.cc
M src/arch/arm/fastmodel/CortexR52/thread_context.cc
2 files changed, 18 insertions(+), 34 deletions(-)



diff --git a/src/arch/arm/fastmodel/CortexA76/thread_context.cc  
b/src/arch/arm/fastmodel/CortexA76/thread_context.cc

index 47e5ab0..735e06d 100644
--- a/src/arch/arm/fastmodel/CortexA76/thread_context.cc
+++ b/src/arch/arm/fastmodel/CortexA76/thread_context.cc
@@ -67,15 +67,8 @@
 Iris::PhysicalMemorySecureMsn : Iris::PhysicalMemoryNonSecureMsn;

 // Figure out what memory spaces match the canonical numbers we need.
-iris::MemorySpaceId in = iris::IRIS_UINT64_MAX;
-iris::MemorySpaceId out = iris::IRIS_UINT64_MAX;
-
-for (auto : memorySpaces) {
-if (space.canonicalMsn == in_msn)
-in = space.spaceId;
-else if (space.canonicalMsn == out_msn)
-out = space.spaceId;
-}
+iris::MemorySpaceId in = getMemorySpaceId(in_msn);
+iris::MemorySpaceId out = getMemorySpaceId(out_msn);

 panic_if(in == iris::IRIS_UINT64_MAX || out == iris::IRIS_UINT64_MAX,
 "Canonical IRIS memory space numbers not found.");
@@ -188,14 +181,13 @@
 CortexA76TC::getBpSpaceIds() const
 {
 if (bpSpaceIds.empty()) {
-for (auto : memorySpaces) {
-auto cmsn = space.canonicalMsn;
-if (cmsn == Iris::SecureMonitorMsn ||
-cmsn == Iris::GuestMsn ||
-cmsn == Iris::NsHypMsn ||
-cmsn == Iris::HypAppMsn) {
-bpSpaceIds.push_back(space.spaceId);
-}
+std::vector msns{
+Iris::SecureMonitorMsn, Iris::GuestMsn, Iris::NsHypMsn,
+Iris::HypAppMsn};
+for (auto  : msns) {
+auto id = getMemorySpaceId(msn);
+if (id != iris::IRIS_UINT64_MAX)
+bpSpaceIds.push_back(id);
 }
 panic_if(bpSpaceIds.empty(),
 "Unable to find address space(s) for breakpoints.");
diff --git a/src/arch/arm/fastmodel/CortexR52/thread_context.cc  
b/src/arch/arm/fastmodel/CortexR52/thread_context.cc

index 5bedf5a..0f2dfa0 100644
--- a/src/arch/arm/fastmodel/CortexR52/thread_context.cc
+++ b/src/arch/arm/fastmodel/CortexR52/thread_context.cc
@@ -67,15 +67,8 @@
 Iris::PhysicalMemorySecureMsn : Iris::PhysicalMemoryNonSecureMsn;

 // Figure out what memory spaces match the canonical numbers we need.
-iris::MemorySpaceId in = iris::IRIS_UINT64_MAX;
-iris::MemorySpaceId out = iris::IRIS_UINT64_MAX;
-
-for (auto : memorySpaces) {
-if (space.canonicalMsn == in_msn)
-in = space.spaceId;
-else if (space.canonicalMsn == out_msn)
-out = space.spaceId;
-}
+iris::MemorySpaceId in = getMemorySpaceId(in_msn);
+iris::MemorySpaceId out = getMemorySpaceId(out_msn);

 panic_if(in == iris::IRIS_UINT64_MAX || out == iris::IRIS_UINT64_MAX,
 "Canonical IRIS memory space numbers not found.");
@@ -155,14 +148,13 @@
 CortexR52TC::getBpSpaceIds() const
 {
 if (bpSpaceIds.empty()) {
-for (auto : memorySpaces) {
-auto cmsn = space.canonicalMsn;
-if (cmsn == Iris::SecureMonitorMsn ||
-cmsn == Iris::GuestMsn ||
-cmsn == Iris::NsHypMsn ||
-cmsn == Iris::HypAppMsn) {
-bpSpaceIds.push_back(space.spaceId);
-}
+std::vector msns{
+Iris::SecureMonitorMsn, Iris::GuestMsn, Iris::NsHypMsn,
+Iris::HypAppMsn};
+for (auto  : msns) {
+auto id = getMemorySpaceId(msn);
+if (id != iris::IRIS_UINT64_MAX)
+bpSpaceIds.push_back(id);
 }
 panic_if(bpSpaceIds.empty(),
 "Unable to find address space(s) for breakpoints.");

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/48868
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: Ib16ea3b92dadc149461fc40f8d85554b7afed656
Gerrit-Change-Number: 48868
Gerrit-PatchSet: 1
Gerrit-Owner: Yu-hsin Wang 
Gerrit-MessageType: newchange
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s