arch-arm: Simplify TLB invalidation with flushMva

The method is no longer calling the lookup method which
had been complicated by the introduction of partial translations.
(which is now called during address translation only)

The lookup method is iterating over all TLB Entries until a non
partial translation is found. Using lookup in flushMva makes it
O(n^2). With this patch we iterate over the TLB entries only once
(making flushMva O(n))

Change-Id: I8f2ae56192812cee231baf6943068abea4d7ef91
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/61752
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Richard Cooper <richard.cooper@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Giacomo Travaglini
2022-07-12 17:24:01 +01:00
parent bad3e14bd7
commit 1290d15973

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2013, 2016-2021 Arm Limited
* Copyright (c) 2010-2013, 2016-2022 Arm Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
@@ -598,6 +598,7 @@ TLB::_flushMva(Addr mva, uint64_t asn, bool secure_lookup,
bool ignore_asn, ExceptionLevel target_el, bool in_host,
TypeTLB entry_type)
{
int x = 0;
TlbEntry *te;
Lookup lookup_data;
@@ -612,15 +613,17 @@ TLB::_flushMva(Addr mva, uint64_t asn, bool secure_lookup,
lookup_data.inHost = in_host;
lookup_data.mode = BaseMMU::Read;
te = lookup(lookup_data);
while (te != NULL) {
bool matching_type = (te->type & entry_type);
if (matching_type && secure_lookup == !te->nstid) {
DPRINTF(TLB, " - %s\n", te->print());
te->valid = false;
stats.flushedEntries++;
while (x < size) {
if (table[x].match(lookup_data)) {
te = &table[x];
bool matching_type = (te->type & entry_type);
if (matching_type && secure_lookup == !te->nstid) {
DPRINTF(TLB, " - %s\n", te->print());
te->valid = false;
stats.flushedEntries++;
}
}
te = lookup(lookup_data);
++x;
}
}