arch-arm: Rename TlbEntry::Lookup into TlbEntry::KeyType

KeyType definition is required if we want to store the TlbEntry
within an AssociativeCache. We could add an alias and keep the
Lookup name but this will just create extra confusion

Change-Id: Ib0b7c9529498f0f6f15ddd0e7cf3cec52966e8df
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
This commit is contained in:
Giacomo Travaglini
2024-08-16 16:33:29 +01:00
parent c83321b843
commit ab6354a9cc
5 changed files with 33 additions and 33 deletions

View File

@@ -185,7 +185,7 @@ MMU::translateFunctional(ThreadContext *tc, Addr va, Addr &pa)
auto tlb = getTlb(BaseMMU::Read, state.directToStage2);
TlbEntry::Lookup lookup_data;
TlbEntry::KeyType lookup_data;
lookup_data.va = va;
lookup_data.asn = state.asid;
@@ -1475,7 +1475,7 @@ MMU::lookup(Addr va, uint16_t asid, vmid_t vmid, SecurityState ss,
{
TLB *tlb = getTlb(mode, stage2);
TlbEntry::Lookup lookup_data;
TlbEntry::KeyType lookup_data;
lookup_data.va = va;
lookup_data.asn = asid;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2012-2013, 2021, 2023-2024 ARM Limited
* Copyright (c) 2010, 2012-2013, 2021, 2023-2024 Arm Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
@@ -233,7 +233,7 @@ struct TlbEntry : public ReplaceableEntry, Serializable
{
public:
using LookupLevel = enums::ArmLookupLevel;
using Lookup = TLBTypes::KeyType;
using KeyType = TLBTypes::KeyType;
using IndexingPolicy = TLBIndexingPolicy;
enum class MemoryType : std::uint8_t
@@ -389,7 +389,7 @@ struct TlbEntry : public ReplaceableEntry, Serializable
}
/** Need for compliance with the AssociativeCache interface */
void insert(const Lookup &lookup) {}
void insert(const KeyType &key) {}
/** Need for compliance with the AssociativeCache interface */
bool isValid() const { return valid; }
@@ -407,32 +407,32 @@ struct TlbEntry : public ReplaceableEntry, Serializable
}
bool
matchAddress(const Lookup &lookup) const
matchAddress(const KeyType &key) const
{
Addr page_addr = vpn << N;
if (lookup.size) {
if (key.size) {
// This is a range based loookup
return lookup.va <= page_addr + size &&
lookup.va + lookup.size > page_addr;
return key.va <= page_addr + size &&
key.va + key.size > page_addr;
} else {
// This is a normal lookup
return lookup.va >= page_addr && lookup.va <= page_addr + size;
return key.va >= page_addr && key.va <= page_addr + size;
}
}
bool
match(const Lookup &lookup) const
match(const KeyType &key) const
{
bool match = false;
if (valid && matchAddress(lookup) && lookup.ss == ss)
if (valid && matchAddress(key) && key.ss == ss)
{
match = checkRegime(lookup.targetRegime);
match = checkRegime(key.targetRegime);
if (match && !lookup.ignoreAsn) {
match = global || (lookup.asn == asid);
if (match && !key.ignoreAsn) {
match = global || (key.asn == asid);
}
if (match && useVMID(lookup.targetRegime)) {
match = lookup.vmid == vmid;
if (match && useVMID(key.targetRegime)) {
match = key.vmid == vmid;
}
}
return match;

View File

@@ -168,7 +168,7 @@ class TLB : public BaseTLB
public:
using Params = ArmTLBParams;
using Lookup = TlbEntry::Lookup;
using Lookup = TlbEntry::KeyType;
using LookupLevel = enums::ArmLookupLevel;
TLB(const Params &p);

View File

@@ -206,10 +206,10 @@ TLBIALLN::matchEntry(TlbEntry* te, vmid_t vmid) const
te->checkRegime(targetRegime);
}
TlbEntry::Lookup
TlbEntry::KeyType
TLBIMVAA::lookupGen(vmid_t vmid) const
{
TlbEntry::Lookup lookup_data;
TlbEntry::KeyType lookup_data;
lookup_data.va = sext<56>(addr);
lookup_data.ignoreAsn = true;
lookup_data.vmid = vmid;
@@ -234,15 +234,15 @@ TLBIMVAA::operator()(ThreadContext* tc)
bool
TLBIMVAA::matchEntry(TlbEntry* te, vmid_t vmid) const
{
TlbEntry::Lookup lookup_data = lookupGen(vmid);
TlbEntry::KeyType lookup_data = lookupGen(vmid);
return te->match(lookup_data) && (!lastLevel || !te->partial);
}
TlbEntry::Lookup
TlbEntry::KeyType
TLBIMVA::lookupGen(vmid_t vmid) const
{
TlbEntry::Lookup lookup_data;
TlbEntry::KeyType lookup_data;
lookup_data.va = sext<56>(addr);
lookup_data.asn = asid;
lookup_data.ignoreAsn = false;
@@ -269,7 +269,7 @@ TLBIMVA::operator()(ThreadContext* tc)
bool
TLBIMVA::matchEntry(TlbEntry* te, vmid_t vmid) const
{
TlbEntry::Lookup lookup_data = lookupGen(vmid);
TlbEntry::KeyType lookup_data = lookupGen(vmid);
return te->match(lookup_data) && (!lastLevel || !te->partial);
}
@@ -309,10 +309,10 @@ TLBIIPA::operator()(ThreadContext* tc)
}
}
TlbEntry::Lookup
TlbEntry::KeyType
TLBIIPA::lookupGen(vmid_t vmid) const
{
TlbEntry::Lookup lookup_data;
TlbEntry::KeyType lookup_data;
lookup_data.va = szext<56>(addr);
lookup_data.ignoreAsn = true;
lookup_data.vmid = vmid;
@@ -326,7 +326,7 @@ TLBIIPA::lookupGen(vmid_t vmid) const
bool
TLBIIPA::matchEntry(TlbEntry* te, vmid_t vmid) const
{
TlbEntry::Lookup lookup_data = lookupGen(vmid);
TlbEntry::KeyType lookup_data = lookupGen(vmid);
return te->match(lookup_data) && (!lastLevel || !te->partial) &&
ipaSpace == te->ipaSpace;
@@ -335,7 +335,7 @@ TLBIIPA::matchEntry(TlbEntry* te, vmid_t vmid) const
bool
TLBIRMVA::matchEntry(TlbEntry* te, vmid_t vmid) const
{
TlbEntry::Lookup lookup_data = lookupGen(vmid);
TlbEntry::KeyType lookup_data = lookupGen(vmid);
lookup_data.size = rangeSize();
auto addr_match = te->match(lookup_data) && (!lastLevel || !te->partial);
@@ -351,7 +351,7 @@ TLBIRMVA::matchEntry(TlbEntry* te, vmid_t vmid) const
bool
TLBIRMVAA::matchEntry(TlbEntry* te, vmid_t vmid) const
{
TlbEntry::Lookup lookup_data = lookupGen(vmid);
TlbEntry::KeyType lookup_data = lookupGen(vmid);
lookup_data.size = rangeSize();
auto addr_match = te->match(lookup_data) && (!lastLevel || !te->partial);
@@ -367,7 +367,7 @@ TLBIRMVAA::matchEntry(TlbEntry* te, vmid_t vmid) const
bool
TLBIRIPA::matchEntry(TlbEntry* te, vmid_t vmid) const
{
TlbEntry::Lookup lookup_data = lookupGen(vmid);
TlbEntry::KeyType lookup_data = lookupGen(vmid);
lookup_data.size = rangeSize();
auto addr_match = te->match(lookup_data) && (!lastLevel || !te->partial);

View File

@@ -279,7 +279,7 @@ class TLBIALLN : public TLBIOp
class TLBIMVAA : public TLBIOp
{
protected:
TlbEntry::Lookup lookupGen(vmid_t vmid) const;
TlbEntry::KeyType lookupGen(vmid_t vmid) const;
public:
TLBIMVAA(TranslationRegime _target_regime, SecurityState _ss,
Addr _addr, bool last_level, Attr _attr=Attr::None)
@@ -299,7 +299,7 @@ class TLBIMVAA : public TLBIOp
class TLBIMVA : public TLBIOp
{
protected:
TlbEntry::Lookup lookupGen(vmid_t vmid) const;
TlbEntry::KeyType lookupGen(vmid_t vmid) const;
public:
TLBIMVA(TranslationRegime _target_regime, SecurityState _ss,
@@ -405,7 +405,7 @@ class TLBIRange
class TLBIIPA : public TLBIOp
{
protected:
TlbEntry::Lookup lookupGen(vmid_t vmid) const;
TlbEntry::KeyType lookupGen(vmid_t vmid) const;
public:
TLBIIPA(TranslationRegime _target_regime, SecurityState _ss, Addr _addr,
bool last_level, Attr _attr=Attr::None)