2009-04-06 03:53:15 +02:00
|
|
|
/*
|
2016-05-26 18:38:15 +02:00
|
|
|
* Copyright (c) 2010-2013, 2016 ARM Limited
|
2010-06-02 19:57:59 +02:00
|
|
|
* All rights reserved
|
|
|
|
*
|
|
|
|
* The license below extends only to copyright in the software and shall
|
|
|
|
* not be construed as granting a license to any other intellectual
|
|
|
|
* property including but not limited to intellectual property relating
|
|
|
|
* to a hardware implementation of the functionality of the software
|
|
|
|
* licensed hereunder. You may use the software subject to the license
|
|
|
|
* terms below provided that you ensure that this notice is replicated
|
|
|
|
* unmodified and in its entirety in all distributions of the software,
|
|
|
|
* modified or unmodified, in source code or in binary form.
|
|
|
|
*
|
2009-04-06 03:53:15 +02:00
|
|
|
* Copyright (c) 2001-2005 The Regents of The University of Michigan
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are
|
|
|
|
* met: redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer;
|
|
|
|
* redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution;
|
|
|
|
* neither the name of the copyright holders nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived from
|
|
|
|
* this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
2010-06-02 19:58:16 +02:00
|
|
|
* Authors: Ali Saidi
|
|
|
|
* Nathan Binkert
|
2009-04-06 03:53:15 +02:00
|
|
|
* Steve Reinhardt
|
|
|
|
*/
|
|
|
|
|
2015-06-21 21:48:33 +02:00
|
|
|
#include "arch/arm/tlb.hh"
|
|
|
|
|
2014-10-16 11:49:51 +02:00
|
|
|
#include <memory>
|
2009-04-06 03:53:15 +02:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
2009-04-22 00:40:25 +02:00
|
|
|
#include "arch/arm/faults.hh"
|
2009-04-06 03:53:15 +02:00
|
|
|
#include "arch/arm/pagetable.hh"
|
2011-11-02 09:25:15 +01:00
|
|
|
#include "arch/arm/system.hh"
|
2011-10-16 14:06:38 +02:00
|
|
|
#include "arch/arm/table_walker.hh"
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
#include "arch/arm/stage2_lookup.hh"
|
|
|
|
#include "arch/arm/stage2_mmu.hh"
|
2009-04-06 03:53:15 +02:00
|
|
|
#include "arch/arm/utility.hh"
|
|
|
|
#include "base/inifile.hh"
|
|
|
|
#include "base/str.hh"
|
|
|
|
#include "base/trace.hh"
|
2014-01-24 22:29:30 +01:00
|
|
|
#include "cpu/base.hh"
|
2009-04-06 03:53:15 +02:00
|
|
|
#include "cpu/thread_context.hh"
|
2011-04-15 19:44:32 +02:00
|
|
|
#include "debug/Checkpoint.hh"
|
|
|
|
#include "debug/TLB.hh"
|
|
|
|
#include "debug/TLBVerbose.hh"
|
2009-04-06 03:53:15 +02:00
|
|
|
#include "mem/page_table.hh"
|
|
|
|
#include "params/ArmTLB.hh"
|
2011-10-16 14:06:38 +02:00
|
|
|
#include "sim/full_system.hh"
|
2009-04-22 00:40:25 +02:00
|
|
|
#include "sim/process.hh"
|
2009-04-06 03:53:15 +02:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
using namespace ArmISA;
|
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
TLB::TLB(const ArmTLBParams *p)
|
|
|
|
: BaseTLB(p), table(new TlbEntry[p->size]), size(p->size),
|
2014-09-27 15:08:37 +02:00
|
|
|
isStage2(p->is_stage2), stage2Req(false), _attr(0),
|
|
|
|
directToStage2(false), tableWalker(p->walker), stage2Tlb(NULL),
|
2016-03-21 16:54:58 +01:00
|
|
|
stage2Mmu(NULL), test(nullptr), rangeMRU(1),
|
2014-11-14 09:53:51 +01:00
|
|
|
aarch64(false), aarch64EL(EL0), isPriv(false), isSecure(false),
|
|
|
|
isHyp(false), asid(0), vmid(0), dacr(0),
|
2015-09-30 18:14:19 +02:00
|
|
|
miscRegValid(false), miscRegContext(0), curTranType(NormalTran)
|
2009-04-06 03:53:15 +02:00
|
|
|
{
|
2010-06-02 19:58:16 +02:00
|
|
|
tableWalker->setTlb(this);
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
|
|
|
|
// Cache system-level properties
|
|
|
|
haveLPAE = tableWalker->haveLPAE();
|
|
|
|
haveVirtualization = tableWalker->haveVirtualization();
|
|
|
|
haveLargeAsid64 = tableWalker->haveLargeAsid64();
|
2009-04-06 03:53:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
TLB::~TLB()
|
|
|
|
{
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
delete[] table;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TLB::init()
|
|
|
|
{
|
|
|
|
if (stage2Mmu && !isStage2)
|
|
|
|
stage2Tlb = stage2Mmu->stage2Tlb();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-03-02 10:00:42 +01:00
|
|
|
TLB::setMMU(Stage2MMU *m, MasterID master_id)
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
{
|
|
|
|
stage2Mmu = m;
|
2015-03-02 10:00:42 +01:00
|
|
|
tableWalker->setMMU(m, master_id);
|
2009-04-06 03:53:15 +02:00
|
|
|
}
|
|
|
|
|
2010-10-01 23:03:27 +02:00
|
|
|
bool
|
|
|
|
TLB::translateFunctional(ThreadContext *tc, Addr va, Addr &pa)
|
|
|
|
{
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
updateMiscReg(tc);
|
|
|
|
|
|
|
|
if (directToStage2) {
|
|
|
|
assert(stage2Tlb);
|
|
|
|
return stage2Tlb->translateFunctional(tc, va, pa);
|
|
|
|
}
|
|
|
|
|
|
|
|
TlbEntry *e = lookup(va, asid, vmid, isHyp, isSecure, true, false,
|
|
|
|
aarch64 ? aarch64EL : EL1);
|
2010-10-01 23:03:27 +02:00
|
|
|
if (!e)
|
|
|
|
return false;
|
|
|
|
pa = e->pAddr(va);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-06-03 13:55:41 +02:00
|
|
|
Fault
|
|
|
|
TLB::finalizePhysical(RequestPtr req, ThreadContext *tc, Mode mode) const
|
|
|
|
{
|
|
|
|
return NoFault;
|
|
|
|
}
|
|
|
|
|
2010-06-02 19:58:16 +02:00
|
|
|
TlbEntry*
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
TLB::lookup(Addr va, uint16_t asn, uint8_t vmid, bool hyp, bool secure,
|
|
|
|
bool functional, bool ignore_asn, uint8_t target_el)
|
2009-04-06 03:53:15 +02:00
|
|
|
{
|
2010-06-02 19:58:16 +02:00
|
|
|
|
|
|
|
TlbEntry *retval = NULL;
|
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
// Maintaining LRU array
|
2010-06-02 19:58:16 +02:00
|
|
|
int x = 0;
|
|
|
|
while (retval == NULL && x < size) {
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
if ((!ignore_asn && table[x].match(va, asn, vmid, hyp, secure, false,
|
|
|
|
target_el)) ||
|
|
|
|
(ignore_asn && table[x].match(va, vmid, hyp, secure, target_el))) {
|
|
|
|
// We only move the hit entry ahead when the position is higher
|
|
|
|
// than rangeMRU
|
2013-02-15 23:40:10 +01:00
|
|
|
if (x > rangeMRU && !functional) {
|
2010-10-01 23:04:04 +02:00
|
|
|
TlbEntry tmp_entry = table[x];
|
2016-02-07 02:21:19 +01:00
|
|
|
for (int i = x; i > 0; i--)
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
table[i] = table[i - 1];
|
2010-10-01 23:04:04 +02:00
|
|
|
table[0] = tmp_entry;
|
|
|
|
retval = &table[0];
|
|
|
|
} else {
|
|
|
|
retval = &table[x];
|
|
|
|
}
|
2010-06-02 19:58:16 +02:00
|
|
|
break;
|
|
|
|
}
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
++x;
|
2010-06-02 19:58:16 +02:00
|
|
|
}
|
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
DPRINTF(TLBVerbose, "Lookup %#x, asn %#x -> %s vmn 0x%x hyp %d secure %d "
|
|
|
|
"ppn %#x size: %#x pa: %#x ap:%d ns:%d nstid:%d g:%d asid: %d "
|
|
|
|
"el: %d\n",
|
|
|
|
va, asn, retval ? "hit" : "miss", vmid, hyp, secure,
|
|
|
|
retval ? retval->pfn : 0, retval ? retval->size : 0,
|
|
|
|
retval ? retval->pAddr(va) : 0, retval ? retval->ap : 0,
|
|
|
|
retval ? retval->ns : 0, retval ? retval->nstid : 0,
|
|
|
|
retval ? retval->global : 0, retval ? retval->asid : 0,
|
2014-09-12 16:22:47 +02:00
|
|
|
retval ? retval->el : 0);
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
|
2010-06-02 19:58:16 +02:00
|
|
|
return retval;
|
2009-04-06 03:53:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// insert a new TLB entry
|
|
|
|
void
|
2010-06-02 19:58:16 +02:00
|
|
|
TLB::insert(Addr addr, TlbEntry &entry)
|
|
|
|
{
|
|
|
|
DPRINTF(TLB, "Inserting entry into TLB with pfn:%#x size:%#x vpn: %#x"
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
" asid:%d vmid:%d N:%d global:%d valid:%d nc:%d xn:%d"
|
|
|
|
" ap:%#x domain:%#x ns:%d nstid:%d isHyp:%d\n", entry.pfn,
|
|
|
|
entry.size, entry.vpn, entry.asid, entry.vmid, entry.N,
|
|
|
|
entry.global, entry.valid, entry.nonCacheable, entry.xn,
|
|
|
|
entry.ap, static_cast<uint8_t>(entry.domain), entry.ns, entry.nstid,
|
|
|
|
entry.isHyp);
|
|
|
|
|
|
|
|
if (table[size - 1].valid)
|
|
|
|
DPRINTF(TLB, " - Replacing Valid entry %#x, asn %d vmn %d ppn %#x "
|
|
|
|
"size: %#x ap:%d ns:%d nstid:%d g:%d isHyp:%d el: %d\n",
|
2010-10-01 23:04:04 +02:00
|
|
|
table[size-1].vpn << table[size-1].N, table[size-1].asid,
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
table[size-1].vmid, table[size-1].pfn << table[size-1].N,
|
|
|
|
table[size-1].size, table[size-1].ap, table[size-1].ns,
|
|
|
|
table[size-1].nstid, table[size-1].global, table[size-1].isHyp,
|
|
|
|
table[size-1].el);
|
2010-06-02 19:58:16 +02:00
|
|
|
|
2010-10-01 23:04:04 +02:00
|
|
|
//inserting to MRU position and evicting the LRU one
|
2010-06-02 19:58:16 +02:00
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
for (int i = size - 1; i > 0; --i)
|
|
|
|
table[i] = table[i-1];
|
2010-10-01 23:04:04 +02:00
|
|
|
table[0] = entry;
|
2010-11-08 20:58:25 +01:00
|
|
|
|
|
|
|
inserts++;
|
2014-10-16 11:49:41 +02:00
|
|
|
ppRefills->notify(1);
|
2010-06-02 19:58:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
TLB::printTlb() const
|
2009-04-06 03:53:15 +02:00
|
|
|
{
|
2010-06-02 19:58:16 +02:00
|
|
|
int x = 0;
|
|
|
|
TlbEntry *te;
|
|
|
|
DPRINTF(TLB, "Current TLB contents:\n");
|
|
|
|
while (x < size) {
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
te = &table[x];
|
|
|
|
if (te->valid)
|
|
|
|
DPRINTF(TLB, " * %s\n", te->print());
|
|
|
|
++x;
|
2010-06-02 19:58:16 +02:00
|
|
|
}
|
2009-04-06 03:53:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
TLB::flushAllSecurity(bool secure_lookup, uint8_t target_el, bool ignore_el)
|
2009-04-06 03:53:15 +02:00
|
|
|
{
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
DPRINTF(TLB, "Flushing all TLB entries (%s lookup)\n",
|
|
|
|
(secure_lookup ? "secure" : "non-secure"));
|
2010-06-02 19:58:16 +02:00
|
|
|
int x = 0;
|
|
|
|
TlbEntry *te;
|
|
|
|
while (x < size) {
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
te = &table[x];
|
|
|
|
if (te->valid && secure_lookup == !te->nstid &&
|
|
|
|
(te->vmid == vmid || secure_lookup) &&
|
|
|
|
checkELMatch(target_el, te->el, ignore_el)) {
|
2010-06-02 19:58:16 +02:00
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
DPRINTF(TLB, " - %s\n", te->print());
|
|
|
|
te->valid = false;
|
|
|
|
flushedEntries++;
|
|
|
|
}
|
|
|
|
++x;
|
|
|
|
}
|
2010-11-08 20:58:25 +01:00
|
|
|
|
|
|
|
flushTlb++;
|
2009-04-06 03:53:15 +02:00
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
// If there's a second stage TLB (and we're not it) then flush it as well
|
|
|
|
// if we're currently in hyp mode
|
|
|
|
if (!isStage2 && isHyp) {
|
|
|
|
stage2Tlb->flushAllSecurity(secure_lookup, true);
|
|
|
|
}
|
|
|
|
}
|
2010-06-02 19:58:16 +02:00
|
|
|
|
|
|
|
void
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
TLB::flushAllNs(bool hyp, uint8_t target_el, bool ignore_el)
|
2010-06-02 19:58:16 +02:00
|
|
|
{
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
DPRINTF(TLB, "Flushing all NS TLB entries (%s lookup)\n",
|
|
|
|
(hyp ? "hyp" : "non-hyp"));
|
|
|
|
int x = 0;
|
2010-06-02 19:58:16 +02:00
|
|
|
TlbEntry *te;
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
while (x < size) {
|
|
|
|
te = &table[x];
|
|
|
|
if (te->valid && te->nstid && te->isHyp == hyp &&
|
|
|
|
checkELMatch(target_el, te->el, ignore_el)) {
|
2010-06-02 19:58:16 +02:00
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
DPRINTF(TLB, " - %s\n", te->print());
|
|
|
|
flushedEntries++;
|
|
|
|
te->valid = false;
|
|
|
|
}
|
|
|
|
++x;
|
|
|
|
}
|
|
|
|
|
|
|
|
flushTlb++;
|
|
|
|
|
|
|
|
// If there's a second stage TLB (and we're not it) then flush it as well
|
|
|
|
if (!isStage2 && !hyp) {
|
|
|
|
stage2Tlb->flushAllNs(false, true);
|
2010-06-02 19:58:16 +02:00
|
|
|
}
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TLB::flushMvaAsid(Addr mva, uint64_t asn, bool secure_lookup, uint8_t target_el)
|
|
|
|
{
|
|
|
|
DPRINTF(TLB, "Flushing TLB entries with mva: %#x, asid: %#x "
|
|
|
|
"(%s lookup)\n", mva, asn, (secure_lookup ?
|
|
|
|
"secure" : "non-secure"));
|
|
|
|
_flushMva(mva, asn, secure_lookup, false, false, target_el);
|
2010-11-08 20:58:25 +01:00
|
|
|
flushTlbMvaAsid++;
|
2010-06-02 19:58:16 +02:00
|
|
|
}
|
|
|
|
|
2009-04-06 03:53:15 +02:00
|
|
|
void
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
TLB::flushAsid(uint64_t asn, bool secure_lookup, uint8_t target_el)
|
2009-04-06 03:53:15 +02:00
|
|
|
{
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
DPRINTF(TLB, "Flushing TLB entries with asid: %#x (%s lookup)\n", asn,
|
|
|
|
(secure_lookup ? "secure" : "non-secure"));
|
2009-04-06 03:53:15 +02:00
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
int x = 0 ;
|
2010-06-02 19:58:16 +02:00
|
|
|
TlbEntry *te;
|
|
|
|
|
|
|
|
while (x < size) {
|
|
|
|
te = &table[x];
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
if (te->valid && te->asid == asn && secure_lookup == !te->nstid &&
|
|
|
|
(te->vmid == vmid || secure_lookup) &&
|
|
|
|
checkELMatch(target_el, te->el, false)) {
|
|
|
|
|
2010-06-02 19:58:16 +02:00
|
|
|
te->valid = false;
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
DPRINTF(TLB, " - %s\n", te->print());
|
2010-11-08 20:58:25 +01:00
|
|
|
flushedEntries++;
|
2010-06-02 19:58:16 +02:00
|
|
|
}
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
++x;
|
2010-06-02 19:58:16 +02:00
|
|
|
}
|
2010-11-08 20:58:25 +01:00
|
|
|
flushTlbAsid++;
|
2010-06-02 19:58:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
TLB::flushMva(Addr mva, bool secure_lookup, bool hyp, uint8_t target_el)
|
2010-06-02 19:58:16 +02:00
|
|
|
{
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
DPRINTF(TLB, "Flushing TLB entries with mva: %#x (%s lookup)\n", mva,
|
|
|
|
(secure_lookup ? "secure" : "non-secure"));
|
|
|
|
_flushMva(mva, 0xbeef, secure_lookup, hyp, true, target_el);
|
|
|
|
flushTlbMva++;
|
|
|
|
}
|
2010-06-02 19:58:16 +02:00
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
void
|
|
|
|
TLB::_flushMva(Addr mva, uint64_t asn, bool secure_lookup, bool hyp,
|
|
|
|
bool ignore_asn, uint8_t target_el)
|
|
|
|
{
|
2010-06-02 19:58:16 +02:00
|
|
|
TlbEntry *te;
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
// D5.7.2: Sign-extend address to 64 bits
|
|
|
|
mva = sext<56>(mva);
|
|
|
|
te = lookup(mva, asn, vmid, hyp, secure_lookup, false, ignore_asn,
|
|
|
|
target_el);
|
|
|
|
while (te != NULL) {
|
|
|
|
if (secure_lookup == !te->nstid) {
|
|
|
|
DPRINTF(TLB, " - %s\n", te->print());
|
2010-06-02 19:58:16 +02:00
|
|
|
te->valid = false;
|
2010-11-08 20:58:25 +01:00
|
|
|
flushedEntries++;
|
2010-06-02 19:58:16 +02:00
|
|
|
}
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
te = lookup(mva, asn, vmid, hyp, secure_lookup, false, ignore_asn,
|
|
|
|
target_el);
|
2009-04-06 03:53:15 +02:00
|
|
|
}
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
TLB::checkELMatch(uint8_t target_el, uint8_t tentry_el, bool ignore_el)
|
|
|
|
{
|
|
|
|
bool elMatch = true;
|
|
|
|
if (!ignore_el) {
|
|
|
|
if (target_el == 2 || target_el == 3) {
|
|
|
|
elMatch = (tentry_el == target_el);
|
|
|
|
} else {
|
|
|
|
elMatch = (tentry_el == 0) || (tentry_el == 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return elMatch;
|
2009-04-06 03:53:15 +02:00
|
|
|
}
|
|
|
|
|
2013-01-07 19:05:45 +01:00
|
|
|
void
|
|
|
|
TLB::drainResume()
|
|
|
|
{
|
|
|
|
// We might have unserialized something or switched CPUs, so make
|
|
|
|
// sure to re-read the misc regs.
|
|
|
|
miscRegValid = false;
|
|
|
|
}
|
|
|
|
|
2014-05-10 00:58:47 +02:00
|
|
|
void
|
|
|
|
TLB::takeOverFrom(BaseTLB *_otlb)
|
|
|
|
{
|
|
|
|
TLB *otlb = dynamic_cast<TLB*>(_otlb);
|
|
|
|
/* Make sure we actually have a valid type */
|
|
|
|
if (otlb) {
|
|
|
|
_attr = otlb->_attr;
|
|
|
|
haveLPAE = otlb->haveLPAE;
|
|
|
|
directToStage2 = otlb->directToStage2;
|
|
|
|
stage2Req = otlb->stage2Req;
|
|
|
|
|
|
|
|
/* Sync the stage2 MMU if they exist in both
|
|
|
|
* the old CPU and the new
|
|
|
|
*/
|
|
|
|
if (!isStage2 &&
|
|
|
|
stage2Tlb && otlb->stage2Tlb) {
|
|
|
|
stage2Tlb->takeOverFrom(otlb->stage2Tlb);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
panic("Incompatible TLB type!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-02 19:58:16 +02:00
|
|
|
void
|
2015-07-07 10:51:03 +02:00
|
|
|
TLB::serialize(CheckpointOut &cp) const
|
2010-06-02 19:58:16 +02:00
|
|
|
{
|
2010-11-08 20:58:25 +01:00
|
|
|
DPRINTF(Checkpoint, "Serializing Arm TLB\n");
|
|
|
|
|
|
|
|
SERIALIZE_SCALAR(_attr);
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
SERIALIZE_SCALAR(haveLPAE);
|
|
|
|
SERIALIZE_SCALAR(directToStage2);
|
|
|
|
SERIALIZE_SCALAR(stage2Req);
|
2011-06-16 22:08:12 +02:00
|
|
|
|
|
|
|
int num_entries = size;
|
|
|
|
SERIALIZE_SCALAR(num_entries);
|
2016-02-07 02:21:19 +01:00
|
|
|
for (int i = 0; i < size; i++)
|
2015-07-07 10:51:03 +02:00
|
|
|
table[i].serializeSection(cp, csprintf("TlbEntry%d", i));
|
2010-06-02 19:58:16 +02:00
|
|
|
}
|
|
|
|
|
2009-04-06 03:53:15 +02:00
|
|
|
void
|
2015-07-07 10:51:03 +02:00
|
|
|
TLB::unserialize(CheckpointIn &cp)
|
2009-04-06 03:53:15 +02:00
|
|
|
{
|
2010-11-08 20:58:25 +01:00
|
|
|
DPRINTF(Checkpoint, "Unserializing Arm TLB\n");
|
2009-04-06 03:53:15 +02:00
|
|
|
|
2010-11-08 20:58:25 +01:00
|
|
|
UNSERIALIZE_SCALAR(_attr);
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
UNSERIALIZE_SCALAR(haveLPAE);
|
|
|
|
UNSERIALIZE_SCALAR(directToStage2);
|
|
|
|
UNSERIALIZE_SCALAR(stage2Req);
|
|
|
|
|
2011-06-16 22:08:12 +02:00
|
|
|
int num_entries;
|
|
|
|
UNSERIALIZE_SCALAR(num_entries);
|
2016-02-07 02:21:19 +01:00
|
|
|
for (int i = 0; i < min(size, num_entries); i++)
|
2015-07-07 10:51:03 +02:00
|
|
|
table[i].unserializeSection(cp, csprintf("TlbEntry%d", i));
|
2009-04-06 03:53:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TLB::regStats()
|
|
|
|
{
|
2016-06-06 18:16:43 +02:00
|
|
|
BaseTLB::regStats();
|
2010-11-08 20:58:25 +01:00
|
|
|
instHits
|
|
|
|
.name(name() + ".inst_hits")
|
|
|
|
.desc("ITB inst hits")
|
|
|
|
;
|
|
|
|
|
|
|
|
instMisses
|
|
|
|
.name(name() + ".inst_misses")
|
|
|
|
.desc("ITB inst misses")
|
|
|
|
;
|
|
|
|
|
|
|
|
instAccesses
|
|
|
|
.name(name() + ".inst_accesses")
|
|
|
|
.desc("ITB inst accesses")
|
|
|
|
;
|
|
|
|
|
|
|
|
readHits
|
2009-04-06 03:53:15 +02:00
|
|
|
.name(name() + ".read_hits")
|
|
|
|
.desc("DTB read hits")
|
|
|
|
;
|
|
|
|
|
2010-11-08 20:58:25 +01:00
|
|
|
readMisses
|
2009-04-06 03:53:15 +02:00
|
|
|
.name(name() + ".read_misses")
|
|
|
|
.desc("DTB read misses")
|
|
|
|
;
|
|
|
|
|
2010-11-08 20:58:25 +01:00
|
|
|
readAccesses
|
2009-04-06 03:53:15 +02:00
|
|
|
.name(name() + ".read_accesses")
|
|
|
|
.desc("DTB read accesses")
|
|
|
|
;
|
|
|
|
|
2010-11-08 20:58:25 +01:00
|
|
|
writeHits
|
2009-04-06 03:53:15 +02:00
|
|
|
.name(name() + ".write_hits")
|
|
|
|
.desc("DTB write hits")
|
|
|
|
;
|
|
|
|
|
2010-11-08 20:58:25 +01:00
|
|
|
writeMisses
|
2009-04-06 03:53:15 +02:00
|
|
|
.name(name() + ".write_misses")
|
|
|
|
.desc("DTB write misses")
|
|
|
|
;
|
|
|
|
|
2010-11-08 20:58:25 +01:00
|
|
|
writeAccesses
|
2009-04-06 03:53:15 +02:00
|
|
|
.name(name() + ".write_accesses")
|
|
|
|
.desc("DTB write accesses")
|
|
|
|
;
|
|
|
|
|
|
|
|
hits
|
|
|
|
.name(name() + ".hits")
|
|
|
|
.desc("DTB hits")
|
|
|
|
;
|
|
|
|
|
|
|
|
misses
|
|
|
|
.name(name() + ".misses")
|
|
|
|
.desc("DTB misses")
|
|
|
|
;
|
|
|
|
|
|
|
|
accesses
|
|
|
|
.name(name() + ".accesses")
|
|
|
|
.desc("DTB accesses")
|
|
|
|
;
|
|
|
|
|
2010-11-08 20:58:25 +01:00
|
|
|
flushTlb
|
|
|
|
.name(name() + ".flush_tlb")
|
|
|
|
.desc("Number of times complete TLB was flushed")
|
|
|
|
;
|
|
|
|
|
|
|
|
flushTlbMva
|
|
|
|
.name(name() + ".flush_tlb_mva")
|
|
|
|
.desc("Number of times TLB was flushed by MVA")
|
|
|
|
;
|
|
|
|
|
|
|
|
flushTlbMvaAsid
|
|
|
|
.name(name() + ".flush_tlb_mva_asid")
|
|
|
|
.desc("Number of times TLB was flushed by MVA & ASID")
|
|
|
|
;
|
|
|
|
|
|
|
|
flushTlbAsid
|
|
|
|
.name(name() + ".flush_tlb_asid")
|
|
|
|
.desc("Number of times TLB was flushed by ASID")
|
|
|
|
;
|
|
|
|
|
|
|
|
flushedEntries
|
|
|
|
.name(name() + ".flush_entries")
|
|
|
|
.desc("Number of entries that have been flushed from TLB")
|
|
|
|
;
|
|
|
|
|
|
|
|
alignFaults
|
|
|
|
.name(name() + ".align_faults")
|
|
|
|
.desc("Number of TLB faults due to alignment restrictions")
|
|
|
|
;
|
|
|
|
|
|
|
|
prefetchFaults
|
|
|
|
.name(name() + ".prefetch_faults")
|
|
|
|
.desc("Number of TLB faults due to prefetch")
|
|
|
|
;
|
|
|
|
|
|
|
|
domainFaults
|
|
|
|
.name(name() + ".domain_faults")
|
|
|
|
.desc("Number of TLB faults due to domain restrictions")
|
|
|
|
;
|
|
|
|
|
|
|
|
permsFaults
|
|
|
|
.name(name() + ".perms_faults")
|
|
|
|
.desc("Number of TLB faults due to permissions restrictions")
|
|
|
|
;
|
|
|
|
|
|
|
|
instAccesses = instHits + instMisses;
|
|
|
|
readAccesses = readHits + readMisses;
|
|
|
|
writeAccesses = writeHits + writeMisses;
|
|
|
|
hits = readHits + writeHits + instHits;
|
|
|
|
misses = readMisses + writeMisses + instMisses;
|
|
|
|
accesses = readAccesses + writeAccesses + instAccesses;
|
2009-04-06 03:53:15 +02:00
|
|
|
}
|
|
|
|
|
2014-10-16 11:49:41 +02:00
|
|
|
void
|
|
|
|
TLB::regProbePoints()
|
|
|
|
{
|
|
|
|
ppRefills.reset(new ProbePoints::PMU(getProbeManager(), "Refills"));
|
|
|
|
}
|
|
|
|
|
2010-06-02 19:58:16 +02:00
|
|
|
Fault
|
|
|
|
TLB::translateSe(RequestPtr req, ThreadContext *tc, Mode mode,
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
Translation *translation, bool &delay, bool timing)
|
2010-06-02 19:58:16 +02:00
|
|
|
{
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
updateMiscReg(tc);
|
|
|
|
Addr vaddr_tainted = req->getVaddr();
|
|
|
|
Addr vaddr = 0;
|
|
|
|
if (aarch64)
|
2015-05-26 09:21:42 +02:00
|
|
|
vaddr = purifyTaggedAddr(vaddr_tainted, tc, aarch64EL, ttbcr);
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
else
|
|
|
|
vaddr = vaddr_tainted;
|
2010-06-02 19:58:10 +02:00
|
|
|
uint32_t flags = req->getFlags();
|
|
|
|
|
2010-06-02 19:58:16 +02:00
|
|
|
bool is_fetch = (mode == Execute);
|
|
|
|
bool is_write = (mode == Write);
|
2010-06-02 19:58:10 +02:00
|
|
|
|
2010-06-02 19:58:16 +02:00
|
|
|
if (!is_fetch) {
|
|
|
|
assert(flags & MustBeOne);
|
|
|
|
if (sctlr.a || !(flags & AllowUnaligned)) {
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
if (vaddr & mask(flags & AlignmentMask)) {
|
|
|
|
// LPAE is always disabled in SE mode
|
2014-10-16 11:49:51 +02:00
|
|
|
return std::make_shared<DataAbort>(
|
|
|
|
vaddr_tainted,
|
|
|
|
TlbEntry::DomainType::NoAccess, is_write,
|
|
|
|
ArmFault::AlignmentFault, isStage2,
|
|
|
|
ArmFault::VmsaTran);
|
2010-06-02 19:58:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-04-06 03:53:15 +02:00
|
|
|
|
2012-01-29 11:04:34 +01:00
|
|
|
Addr paddr;
|
|
|
|
Process *p = tc->getProcessPtr();
|
2010-06-02 19:58:16 +02:00
|
|
|
|
2012-01-29 11:04:34 +01:00
|
|
|
if (!p->pTable->translate(vaddr, paddr))
|
2014-10-16 11:49:51 +02:00
|
|
|
return std::make_shared<GenericPageTableFault>(vaddr_tainted);
|
2012-01-29 11:04:34 +01:00
|
|
|
req->setPaddr(paddr);
|
2009-04-06 03:53:15 +02:00
|
|
|
|
|
|
|
return NoFault;
|
2010-06-02 19:58:16 +02:00
|
|
|
}
|
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
Fault
|
|
|
|
TLB::checkPermissions(TlbEntry *te, RequestPtr req, Mode mode)
|
|
|
|
{
|
|
|
|
Addr vaddr = req->getVaddr(); // 32-bit don't have to purify
|
|
|
|
uint32_t flags = req->getFlags();
|
|
|
|
bool is_fetch = (mode == Execute);
|
|
|
|
bool is_write = (mode == Write);
|
|
|
|
bool is_priv = isPriv && !(flags & UserMode);
|
|
|
|
|
|
|
|
// Get the translation type from the actuall table entry
|
|
|
|
ArmFault::TranMethod tranMethod = te->longDescFormat ? ArmFault::LpaeTran
|
|
|
|
: ArmFault::VmsaTran;
|
|
|
|
|
|
|
|
// If this is the second stage of translation and the request is for a
|
|
|
|
// stage 1 page table walk then we need to check the HCR.PTW bit. This
|
|
|
|
// allows us to generate a fault if the request targets an area marked
|
|
|
|
// as a device or strongly ordered.
|
|
|
|
if (isStage2 && req->isPTWalk() && hcr.ptw &&
|
|
|
|
(te->mtype != TlbEntry::MemoryType::Normal)) {
|
2014-10-16 11:49:51 +02:00
|
|
|
return std::make_shared<DataAbort>(
|
|
|
|
vaddr, te->domain, is_write,
|
|
|
|
ArmFault::PermissionLL + te->lookupLevel,
|
|
|
|
isStage2, tranMethod);
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Generate an alignment fault for unaligned data accesses to device or
|
|
|
|
// strongly ordered memory
|
|
|
|
if (!is_fetch) {
|
|
|
|
if (te->mtype != TlbEntry::MemoryType::Normal) {
|
|
|
|
if (vaddr & mask(flags & AlignmentMask)) {
|
|
|
|
alignFaults++;
|
2014-10-16 11:49:51 +02:00
|
|
|
return std::make_shared<DataAbort>(
|
|
|
|
vaddr, TlbEntry::DomainType::NoAccess, is_write,
|
|
|
|
ArmFault::AlignmentFault, isStage2,
|
|
|
|
tranMethod);
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (te->nonCacheable) {
|
|
|
|
// Prevent prefetching from I/O devices.
|
|
|
|
if (req->isPrefetch()) {
|
|
|
|
// Here we can safely use the fault status for the short
|
|
|
|
// desc. format in all cases
|
2014-10-16 11:49:51 +02:00
|
|
|
return std::make_shared<PrefetchAbort>(
|
|
|
|
vaddr, ArmFault::PrefetchUncacheable,
|
|
|
|
isStage2, tranMethod);
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!te->longDescFormat) {
|
|
|
|
switch ((dacr >> (static_cast<uint8_t>(te->domain) * 2)) & 0x3) {
|
|
|
|
case 0:
|
|
|
|
domainFaults++;
|
|
|
|
DPRINTF(TLB, "TLB Fault: Data abort on domain. DACR: %#x"
|
|
|
|
" domain: %#x write:%d\n", dacr,
|
|
|
|
static_cast<uint8_t>(te->domain), is_write);
|
|
|
|
if (is_fetch)
|
2014-10-16 11:49:51 +02:00
|
|
|
return std::make_shared<PrefetchAbort>(
|
|
|
|
vaddr,
|
|
|
|
ArmFault::DomainLL + te->lookupLevel,
|
|
|
|
isStage2, tranMethod);
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
else
|
2014-10-16 11:49:51 +02:00
|
|
|
return std::make_shared<DataAbort>(
|
|
|
|
vaddr, te->domain, is_write,
|
|
|
|
ArmFault::DomainLL + te->lookupLevel,
|
|
|
|
isStage2, tranMethod);
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
case 1:
|
|
|
|
// Continue with permissions check
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
panic("UNPRED domain\n");
|
|
|
|
case 3:
|
|
|
|
return NoFault;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// The 'ap' variable is AP[2:0] or {AP[2,1],1b'0}, i.e. always three bits
|
|
|
|
uint8_t ap = te->longDescFormat ? te->ap << 1 : te->ap;
|
|
|
|
uint8_t hap = te->hap;
|
|
|
|
|
|
|
|
if (sctlr.afe == 1 || te->longDescFormat)
|
|
|
|
ap |= 1;
|
|
|
|
|
|
|
|
bool abt;
|
|
|
|
bool isWritable = true;
|
|
|
|
// If this is a stage 2 access (eg for reading stage 1 page table entries)
|
|
|
|
// then don't perform the AP permissions check, we stil do the HAP check
|
|
|
|
// below.
|
|
|
|
if (isStage2) {
|
|
|
|
abt = false;
|
|
|
|
} else {
|
|
|
|
switch (ap) {
|
|
|
|
case 0:
|
|
|
|
DPRINTF(TLB, "Access permissions 0, checking rs:%#x\n",
|
|
|
|
(int)sctlr.rs);
|
|
|
|
if (!sctlr.xp) {
|
|
|
|
switch ((int)sctlr.rs) {
|
|
|
|
case 2:
|
|
|
|
abt = is_write;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
abt = is_write || !is_priv;
|
|
|
|
break;
|
|
|
|
case 0:
|
|
|
|
case 3:
|
|
|
|
default:
|
|
|
|
abt = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
abt = true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
abt = !is_priv;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
abt = !is_priv && is_write;
|
|
|
|
isWritable = is_priv;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
abt = false;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
panic("UNPRED premissions\n");
|
|
|
|
case 5:
|
|
|
|
abt = !is_priv || is_write;
|
|
|
|
isWritable = false;
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
case 7:
|
|
|
|
abt = is_write;
|
|
|
|
isWritable = false;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
panic("Unknown permissions %#x\n", ap);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool hapAbt = is_write ? !(hap & 2) : !(hap & 1);
|
|
|
|
bool xn = te->xn || (isWritable && sctlr.wxn) ||
|
|
|
|
(ap == 3 && sctlr.uwxn && is_priv);
|
|
|
|
if (is_fetch && (abt || xn ||
|
2016-05-26 18:38:15 +02:00
|
|
|
(te->longDescFormat && te->pxn && is_priv) ||
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
(isSecure && te->ns && scr.sif))) {
|
|
|
|
permsFaults++;
|
|
|
|
DPRINTF(TLB, "TLB Fault: Prefetch abort on permission check. AP:%d "
|
|
|
|
"priv:%d write:%d ns:%d sif:%d sctlr.afe: %d \n",
|
|
|
|
ap, is_priv, is_write, te->ns, scr.sif,sctlr.afe);
|
2014-10-16 11:49:51 +02:00
|
|
|
return std::make_shared<PrefetchAbort>(
|
|
|
|
vaddr,
|
|
|
|
ArmFault::PermissionLL + te->lookupLevel,
|
|
|
|
isStage2, tranMethod);
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
} else if (abt | hapAbt) {
|
|
|
|
permsFaults++;
|
|
|
|
DPRINTF(TLB, "TLB Fault: Data abort on permission check. AP:%d priv:%d"
|
|
|
|
" write:%d\n", ap, is_priv, is_write);
|
2014-10-16 11:49:51 +02:00
|
|
|
return std::make_shared<DataAbort>(
|
|
|
|
vaddr, te->domain, is_write,
|
|
|
|
ArmFault::PermissionLL + te->lookupLevel,
|
|
|
|
isStage2 | !abt, tranMethod);
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
}
|
|
|
|
return NoFault;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Fault
|
|
|
|
TLB::checkPermissions64(TlbEntry *te, RequestPtr req, Mode mode,
|
|
|
|
ThreadContext *tc)
|
2010-06-02 19:58:16 +02:00
|
|
|
{
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
assert(aarch64);
|
|
|
|
|
|
|
|
Addr vaddr_tainted = req->getVaddr();
|
2015-05-26 09:21:42 +02:00
|
|
|
Addr vaddr = purifyTaggedAddr(vaddr_tainted, tc, aarch64EL, ttbcr);
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
|
|
|
|
uint32_t flags = req->getFlags();
|
|
|
|
bool is_fetch = (mode == Execute);
|
|
|
|
bool is_write = (mode == Write);
|
|
|
|
bool is_priv M5_VAR_USED = isPriv && !(flags & UserMode);
|
|
|
|
|
|
|
|
updateMiscReg(tc, curTranType);
|
|
|
|
|
|
|
|
// If this is the second stage of translation and the request is for a
|
|
|
|
// stage 1 page table walk then we need to check the HCR.PTW bit. This
|
|
|
|
// allows us to generate a fault if the request targets an area marked
|
|
|
|
// as a device or strongly ordered.
|
|
|
|
if (isStage2 && req->isPTWalk() && hcr.ptw &&
|
|
|
|
(te->mtype != TlbEntry::MemoryType::Normal)) {
|
2014-10-16 11:49:51 +02:00
|
|
|
return std::make_shared<DataAbort>(
|
|
|
|
vaddr_tainted, te->domain, is_write,
|
|
|
|
ArmFault::PermissionLL + te->lookupLevel,
|
|
|
|
isStage2, ArmFault::LpaeTran);
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Generate an alignment fault for unaligned accesses to device or
|
|
|
|
// strongly ordered memory
|
|
|
|
if (!is_fetch) {
|
|
|
|
if (te->mtype != TlbEntry::MemoryType::Normal) {
|
|
|
|
if (vaddr & mask(flags & AlignmentMask)) {
|
|
|
|
alignFaults++;
|
2014-10-16 11:49:51 +02:00
|
|
|
return std::make_shared<DataAbort>(
|
|
|
|
vaddr_tainted,
|
|
|
|
TlbEntry::DomainType::NoAccess, is_write,
|
|
|
|
ArmFault::AlignmentFault, isStage2,
|
|
|
|
ArmFault::LpaeTran);
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (te->nonCacheable) {
|
|
|
|
// Prevent prefetching from I/O devices.
|
|
|
|
if (req->isPrefetch()) {
|
|
|
|
// Here we can safely use the fault status for the short
|
|
|
|
// desc. format in all cases
|
2014-10-16 11:49:51 +02:00
|
|
|
return std::make_shared<PrefetchAbort>(
|
|
|
|
vaddr_tainted,
|
|
|
|
ArmFault::PrefetchUncacheable,
|
|
|
|
isStage2, ArmFault::LpaeTran);
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8_t ap = 0x3 & (te->ap); // 2-bit access protection field
|
|
|
|
bool grant = false;
|
|
|
|
|
|
|
|
uint8_t xn = te->xn;
|
|
|
|
uint8_t pxn = te->pxn;
|
|
|
|
bool r = !is_write && !is_fetch;
|
|
|
|
bool w = is_write;
|
|
|
|
bool x = is_fetch;
|
|
|
|
DPRINTF(TLBVerbose, "Checking permissions: ap:%d, xn:%d, pxn:%d, r:%d, "
|
|
|
|
"w:%d, x:%d\n", ap, xn, pxn, r, w, x);
|
|
|
|
|
|
|
|
if (isStage2) {
|
2016-08-02 11:38:02 +02:00
|
|
|
assert(ArmSystem::haveVirtualization(tc) && aarch64EL != EL2);
|
|
|
|
// In stage 2 we use the hypervisor access permission bits.
|
|
|
|
// The following permissions are described in ARM DDI 0487A.f
|
|
|
|
// D4-1802
|
|
|
|
uint8_t hap = 0x3 & te->hap;
|
|
|
|
if (is_fetch) {
|
|
|
|
// sctlr.wxn overrides the xn bit
|
|
|
|
grant = !sctlr.wxn && !xn;
|
|
|
|
} else if (is_write) {
|
|
|
|
grant = hap & 0x2;
|
|
|
|
} else { // is_read
|
|
|
|
grant = hap & 0x1;
|
|
|
|
}
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
} else {
|
|
|
|
switch (aarch64EL) {
|
|
|
|
case EL0:
|
|
|
|
{
|
|
|
|
uint8_t perm = (ap << 2) | (xn << 1) | pxn;
|
|
|
|
switch (perm) {
|
|
|
|
case 0:
|
|
|
|
case 1:
|
|
|
|
case 8:
|
|
|
|
case 9:
|
|
|
|
grant = x;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
case 5:
|
|
|
|
grant = r || w || (x && !sctlr.wxn);
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
case 7:
|
|
|
|
grant = r || w;
|
|
|
|
break;
|
|
|
|
case 12:
|
|
|
|
case 13:
|
|
|
|
grant = r || x;
|
|
|
|
break;
|
|
|
|
case 14:
|
|
|
|
case 15:
|
|
|
|
grant = r;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
grant = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case EL1:
|
|
|
|
{
|
|
|
|
uint8_t perm = (ap << 2) | (xn << 1) | pxn;
|
|
|
|
switch (perm) {
|
|
|
|
case 0:
|
|
|
|
case 2:
|
|
|
|
grant = r || w || (x && !sctlr.wxn);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
case 3:
|
|
|
|
case 4:
|
|
|
|
case 5:
|
|
|
|
case 6:
|
|
|
|
case 7:
|
|
|
|
// regions that are writeable at EL0 should not be
|
|
|
|
// executable at EL1
|
|
|
|
grant = r || w;
|
|
|
|
break;
|
|
|
|
case 8:
|
|
|
|
case 10:
|
|
|
|
case 12:
|
|
|
|
case 14:
|
|
|
|
grant = r || x;
|
|
|
|
break;
|
|
|
|
case 9:
|
|
|
|
case 11:
|
|
|
|
case 13:
|
|
|
|
case 15:
|
|
|
|
grant = r;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
grant = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case EL2:
|
|
|
|
case EL3:
|
|
|
|
{
|
|
|
|
uint8_t perm = (ap & 0x2) | xn;
|
|
|
|
switch (perm) {
|
|
|
|
case 0:
|
|
|
|
grant = r || w || (x && !sctlr.wxn) ;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
grant = r || w;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
grant = r || x;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
grant = r;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
grant = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!grant) {
|
|
|
|
if (is_fetch) {
|
|
|
|
permsFaults++;
|
|
|
|
DPRINTF(TLB, "TLB Fault: Prefetch abort on permission check. "
|
|
|
|
"AP:%d priv:%d write:%d ns:%d sif:%d "
|
|
|
|
"sctlr.afe: %d\n",
|
|
|
|
ap, is_priv, is_write, te->ns, scr.sif, sctlr.afe);
|
|
|
|
// Use PC value instead of vaddr because vaddr might be aligned to
|
|
|
|
// cache line and should not be the address reported in FAR
|
2014-10-16 11:49:51 +02:00
|
|
|
return std::make_shared<PrefetchAbort>(
|
|
|
|
req->getPC(),
|
|
|
|
ArmFault::PermissionLL + te->lookupLevel,
|
|
|
|
isStage2, ArmFault::LpaeTran);
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
} else {
|
|
|
|
permsFaults++;
|
|
|
|
DPRINTF(TLB, "TLB Fault: Data abort on permission check. AP:%d "
|
|
|
|
"priv:%d write:%d\n", ap, is_priv, is_write);
|
2014-10-16 11:49:51 +02:00
|
|
|
return std::make_shared<DataAbort>(
|
|
|
|
vaddr_tainted, te->domain, is_write,
|
|
|
|
ArmFault::PermissionLL + te->lookupLevel,
|
|
|
|
isStage2, ArmFault::LpaeTran);
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-02 19:58:16 +02:00
|
|
|
return NoFault;
|
|
|
|
}
|
|
|
|
|
2010-06-02 19:58:16 +02:00
|
|
|
Fault
|
|
|
|
TLB::translateFs(RequestPtr req, ThreadContext *tc, Mode mode,
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
Translation *translation, bool &delay, bool timing,
|
|
|
|
TLB::ArmTranslationType tranType, bool functional)
|
2010-06-02 19:58:16 +02:00
|
|
|
{
|
2012-01-31 16:46:03 +01:00
|
|
|
// No such thing as a functional timing access
|
|
|
|
assert(!(timing && functional));
|
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
updateMiscReg(tc, tranType);
|
2010-11-15 21:04:03 +01:00
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
Addr vaddr_tainted = req->getVaddr();
|
|
|
|
Addr vaddr = 0;
|
|
|
|
if (aarch64)
|
2015-05-26 09:21:42 +02:00
|
|
|
vaddr = purifyTaggedAddr(vaddr_tainted, tc, aarch64EL, ttbcr);
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
else
|
|
|
|
vaddr = vaddr_tainted;
|
2010-06-02 19:58:16 +02:00
|
|
|
uint32_t flags = req->getFlags();
|
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
bool is_fetch = (mode == Execute);
|
|
|
|
bool is_write = (mode == Write);
|
2016-06-02 17:44:57 +02:00
|
|
|
bool long_desc_format = aarch64 || longDescFormatInUse(tc);
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
ArmFault::TranMethod tranMethod = long_desc_format ? ArmFault::LpaeTran
|
|
|
|
: ArmFault::VmsaTran;
|
|
|
|
|
|
|
|
req->setAsid(asid);
|
2010-06-02 19:58:16 +02:00
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
DPRINTF(TLBVerbose, "CPSR is priv:%d UserMode:%d secure:%d S1S2NsTran:%d\n",
|
|
|
|
isPriv, flags & UserMode, isSecure, tranType & S1S2NsTran);
|
2011-09-13 19:06:13 +02:00
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
DPRINTF(TLB, "translateFs addr %#x, mode %d, st2 %d, scr %#x sctlr %#x "
|
|
|
|
"flags %#x tranType 0x%x\n", vaddr_tainted, mode, isStage2,
|
|
|
|
scr, sctlr, flags, tranType);
|
|
|
|
|
2010-08-23 18:18:41 +02:00
|
|
|
if ((req->isInstFetch() && (!sctlr.i)) ||
|
|
|
|
((!req->isInstFetch()) && (!sctlr.c))){
|
2015-05-05 09:22:33 +02:00
|
|
|
req->setFlags(Request::UNCACHEABLE | Request::STRICT_ORDER);
|
2010-08-23 18:18:41 +02:00
|
|
|
}
|
2010-06-02 19:58:16 +02:00
|
|
|
if (!is_fetch) {
|
|
|
|
assert(flags & MustBeOne);
|
|
|
|
if (sctlr.a || !(flags & AllowUnaligned)) {
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
if (vaddr & mask(flags & AlignmentMask)) {
|
2010-11-08 20:58:25 +01:00
|
|
|
alignFaults++;
|
2014-10-16 11:49:51 +02:00
|
|
|
return std::make_shared<DataAbort>(
|
|
|
|
vaddr_tainted,
|
|
|
|
TlbEntry::DomainType::NoAccess, is_write,
|
|
|
|
ArmFault::AlignmentFault, isStage2,
|
|
|
|
tranMethod);
|
2010-06-02 19:58:16 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
// If guest MMU is off or hcr.vm=0 go straight to stage2
|
|
|
|
if ((isStage2 && !hcr.vm) || (!isStage2 && !sctlr.m)) {
|
2010-06-02 19:58:16 +02:00
|
|
|
|
2010-06-02 19:57:59 +02:00
|
|
|
req->setPaddr(vaddr);
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
// When the MMU is off the security attribute corresponds to the
|
|
|
|
// security state of the processor
|
|
|
|
if (isSecure)
|
|
|
|
req->setFlags(Request::SECURE);
|
|
|
|
|
|
|
|
// @todo: double check this (ARM ARM issue C B3.2.1)
|
|
|
|
if (long_desc_format || sctlr.tre == 0) {
|
2015-05-05 09:22:33 +02:00
|
|
|
req->setFlags(Request::UNCACHEABLE | Request::STRICT_ORDER);
|
2010-06-02 19:58:16 +02:00
|
|
|
} else {
|
|
|
|
if (nmrr.ir0 == 0 || nmrr.or0 == 0 || prrr.tr0 != 0x2)
|
2015-05-05 09:22:33 +02:00
|
|
|
req->setFlags(Request::UNCACHEABLE | Request::STRICT_ORDER);
|
2010-06-02 19:58:16 +02:00
|
|
|
}
|
2010-06-02 19:58:18 +02:00
|
|
|
|
|
|
|
// Set memory attributes
|
|
|
|
TlbEntry temp_te;
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
temp_te.ns = !isSecure;
|
|
|
|
if (isStage2 || hcr.dc == 0 || isSecure ||
|
|
|
|
(isHyp && !(tranType & S1CTran))) {
|
|
|
|
|
|
|
|
temp_te.mtype = is_fetch ? TlbEntry::MemoryType::Normal
|
|
|
|
: TlbEntry::MemoryType::StronglyOrdered;
|
|
|
|
temp_te.innerAttrs = 0x0;
|
|
|
|
temp_te.outerAttrs = 0x0;
|
|
|
|
temp_te.shareable = true;
|
|
|
|
temp_te.outerShareable = true;
|
|
|
|
} else {
|
|
|
|
temp_te.mtype = TlbEntry::MemoryType::Normal;
|
|
|
|
temp_te.innerAttrs = 0x3;
|
|
|
|
temp_te.outerAttrs = 0x3;
|
|
|
|
temp_te.shareable = false;
|
|
|
|
temp_te.outerShareable = false;
|
|
|
|
}
|
|
|
|
temp_te.setAttributes(long_desc_format);
|
2014-09-12 16:22:47 +02:00
|
|
|
DPRINTF(TLBVerbose, "(No MMU) setting memory attributes: shareable: "
|
|
|
|
"%d, innerAttrs: %d, outerAttrs: %d, isStage2: %d\n",
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
temp_te.shareable, temp_te.innerAttrs, temp_te.outerAttrs,
|
|
|
|
isStage2);
|
2010-06-02 19:58:18 +02:00
|
|
|
setAttr(temp_te.attributes);
|
|
|
|
|
2016-03-21 16:54:58 +01:00
|
|
|
return testTranslation(req, mode, TlbEntry::DomainType::NoAccess);
|
2010-06-02 19:58:16 +02:00
|
|
|
}
|
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
DPRINTF(TLBVerbose, "Translating %s=%#x context=%d\n",
|
|
|
|
isStage2 ? "IPA" : "VA", vaddr_tainted, asid);
|
2010-06-02 19:58:16 +02:00
|
|
|
// Translation enabled
|
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
TlbEntry *te = NULL;
|
|
|
|
TlbEntry mergeTe;
|
|
|
|
Fault fault = getResultTe(&te, req, tc, mode, translation, timing,
|
|
|
|
functional, &mergeTe);
|
|
|
|
// only proceed if we have a valid table entry
|
|
|
|
if ((te == NULL) && (fault == NoFault)) delay = true;
|
2010-11-08 20:58:25 +01:00
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
// If we have the table entry transfer some of the attributes to the
|
|
|
|
// request that triggered the translation
|
|
|
|
if (te != NULL) {
|
|
|
|
// Set memory attributes
|
|
|
|
DPRINTF(TLBVerbose,
|
2014-09-12 16:22:47 +02:00
|
|
|
"Setting memory attributes: shareable: %d, innerAttrs: %d, "
|
|
|
|
"outerAttrs: %d, mtype: %d, isStage2: %d\n",
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
te->shareable, te->innerAttrs, te->outerAttrs,
|
|
|
|
static_cast<uint8_t>(te->mtype), isStage2);
|
|
|
|
setAttr(te->attributes);
|
2015-05-05 09:22:33 +02:00
|
|
|
|
|
|
|
if (te->nonCacheable)
|
2015-05-05 09:22:34 +02:00
|
|
|
req->setFlags(Request::UNCACHEABLE);
|
|
|
|
|
|
|
|
// Require requests to be ordered if the request goes to
|
|
|
|
// strongly ordered or device memory (i.e., anything other
|
|
|
|
// than normal memory requires strict order).
|
|
|
|
if (te->mtype != TlbEntry::MemoryType::Normal)
|
|
|
|
req->setFlags(Request::STRICT_ORDER);
|
2010-11-15 21:04:03 +01:00
|
|
|
|
2014-10-30 05:18:26 +01:00
|
|
|
Addr pa = te->pAddr(vaddr);
|
|
|
|
req->setPaddr(pa);
|
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
if (isSecure && !te->ns) {
|
|
|
|
req->setFlags(Request::SECURE);
|
|
|
|
}
|
|
|
|
if ((!is_fetch) && (vaddr & mask(flags & AlignmentMask)) &&
|
|
|
|
(te->mtype != TlbEntry::MemoryType::Normal)) {
|
|
|
|
// Unaligned accesses to Device memory should always cause an
|
|
|
|
// abort regardless of sctlr.a
|
|
|
|
alignFaults++;
|
2014-10-16 11:49:51 +02:00
|
|
|
return std::make_shared<DataAbort>(
|
|
|
|
vaddr_tainted,
|
|
|
|
TlbEntry::DomainType::NoAccess, is_write,
|
|
|
|
ArmFault::AlignmentFault, isStage2,
|
|
|
|
tranMethod);
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
}
|
2010-06-02 19:58:16 +02:00
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
// Check for a trickbox generated address fault
|
2016-03-21 16:54:58 +01:00
|
|
|
if (fault == NoFault)
|
|
|
|
fault = testTranslation(req, mode, te->domain);
|
2010-06-02 19:58:16 +02:00
|
|
|
}
|
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
// Generate Illegal Inst Set State fault if IL bit is set in CPSR
|
|
|
|
if (fault == NoFault) {
|
|
|
|
if (aarch64 && is_fetch && cpsr.il == 1) {
|
2014-10-16 11:49:51 +02:00
|
|
|
return std::make_shared<IllegalInstSetStateFault>();
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
}
|
|
|
|
}
|
2010-06-02 19:58:16 +02:00
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
return fault;
|
2010-06-02 19:58:16 +02:00
|
|
|
}
|
2009-11-18 01:02:08 +01:00
|
|
|
|
2010-06-02 19:58:16 +02:00
|
|
|
Fault
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
TLB::translateAtomic(RequestPtr req, ThreadContext *tc, Mode mode,
|
|
|
|
TLB::ArmTranslationType tranType)
|
2010-06-02 19:58:16 +02:00
|
|
|
{
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
updateMiscReg(tc, tranType);
|
|
|
|
|
|
|
|
if (directToStage2) {
|
|
|
|
assert(stage2Tlb);
|
|
|
|
return stage2Tlb->translateAtomic(req, tc, mode, tranType);
|
|
|
|
}
|
|
|
|
|
2010-06-02 19:58:16 +02:00
|
|
|
bool delay = false;
|
|
|
|
Fault fault;
|
2011-10-16 14:06:38 +02:00
|
|
|
if (FullSystem)
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
fault = translateFs(req, tc, mode, NULL, delay, false, tranType);
|
2011-10-16 14:06:38 +02:00
|
|
|
else
|
|
|
|
fault = translateSe(req, tc, mode, NULL, delay, false);
|
2010-06-02 19:58:16 +02:00
|
|
|
assert(!delay);
|
|
|
|
return fault;
|
2009-04-06 03:53:15 +02:00
|
|
|
}
|
|
|
|
|
2012-01-31 16:46:03 +01:00
|
|
|
Fault
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
TLB::translateFunctional(RequestPtr req, ThreadContext *tc, Mode mode,
|
|
|
|
TLB::ArmTranslationType tranType)
|
2012-01-31 16:46:03 +01:00
|
|
|
{
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
updateMiscReg(tc, tranType);
|
|
|
|
|
|
|
|
if (directToStage2) {
|
|
|
|
assert(stage2Tlb);
|
|
|
|
return stage2Tlb->translateFunctional(req, tc, mode, tranType);
|
|
|
|
}
|
|
|
|
|
2012-01-31 16:46:03 +01:00
|
|
|
bool delay = false;
|
|
|
|
Fault fault;
|
2012-02-01 07:40:08 +01:00
|
|
|
if (FullSystem)
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
fault = translateFs(req, tc, mode, NULL, delay, false, tranType, true);
|
|
|
|
else
|
2012-02-01 07:40:08 +01:00
|
|
|
fault = translateSe(req, tc, mode, NULL, delay, false);
|
2012-01-31 16:46:03 +01:00
|
|
|
assert(!delay);
|
|
|
|
return fault;
|
|
|
|
}
|
|
|
|
|
2010-06-02 19:58:16 +02:00
|
|
|
Fault
|
2009-04-22 00:40:25 +02:00
|
|
|
TLB::translateTiming(RequestPtr req, ThreadContext *tc,
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
Translation *translation, Mode mode, TLB::ArmTranslationType tranType)
|
2009-04-06 19:19:36 +02:00
|
|
|
{
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
updateMiscReg(tc, tranType);
|
|
|
|
|
|
|
|
if (directToStage2) {
|
|
|
|
assert(stage2Tlb);
|
|
|
|
return stage2Tlb->translateTiming(req, tc, translation, mode, tranType);
|
|
|
|
}
|
|
|
|
|
2009-04-06 19:19:36 +02:00
|
|
|
assert(translation);
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
|
|
|
|
return translateComplete(req, tc, translation, mode, tranType, isStage2);
|
|
|
|
}
|
|
|
|
|
|
|
|
Fault
|
|
|
|
TLB::translateComplete(RequestPtr req, ThreadContext *tc,
|
|
|
|
Translation *translation, Mode mode, TLB::ArmTranslationType tranType,
|
|
|
|
bool callFromS2)
|
|
|
|
{
|
2010-06-02 19:58:16 +02:00
|
|
|
bool delay = false;
|
|
|
|
Fault fault;
|
2011-10-16 14:06:38 +02:00
|
|
|
if (FullSystem)
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
fault = translateFs(req, tc, mode, translation, delay, true, tranType);
|
2011-10-16 14:06:38 +02:00
|
|
|
else
|
|
|
|
fault = translateSe(req, tc, mode, translation, delay, true);
|
2011-08-19 22:08:08 +02:00
|
|
|
DPRINTF(TLBVerbose, "Translation returning delay=%d fault=%d\n", delay, fault !=
|
2011-02-23 22:10:49 +01:00
|
|
|
NoFault);
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
// If we have a translation, and we're not in the middle of doing a stage
|
|
|
|
// 2 translation tell the translation that we've either finished or its
|
|
|
|
// going to take a while. By not doing this when we're in the middle of a
|
|
|
|
// stage 2 translation we prevent marking the translation as delayed twice,
|
|
|
|
// one when the translation starts and again when the stage 1 translation
|
|
|
|
// completes.
|
|
|
|
if (translation && (callFromS2 || !stage2Req || req->hasPaddr() || fault != NoFault)) {
|
|
|
|
if (!delay)
|
|
|
|
translation->finish(fault, req, tc, mode);
|
|
|
|
else
|
|
|
|
translation->markDelayed();
|
|
|
|
}
|
2010-06-02 19:58:16 +02:00
|
|
|
return fault;
|
2009-04-06 03:53:15 +02:00
|
|
|
}
|
|
|
|
|
2012-10-15 14:12:35 +02:00
|
|
|
BaseMasterPort*
|
MEM: Introduce the master/slave port sub-classes in C++
This patch introduces the notion of a master and slave port in the C++
code, thus bringing the previous classification from the Python
classes into the corresponding simulation objects and memory objects.
The patch enables us to classify behaviours into the two bins and add
assumptions and enfore compliance, also simplifying the two
interfaces. As a starting point, isSnooping is confined to a master
port, and getAddrRanges to slave ports. More of these specilisations
are to come in later patches.
The getPort function is not getMasterPort and getSlavePort, and
returns a port reference rather than a pointer as NULL would never be
a valid return value. The default implementation of these two
functions is placed in MemObject, and calls fatal.
The one drawback with this specific patch is that it requires some
code duplication, e.g. QueuedPort becomes QueuedMasterPort and
QueuedSlavePort, and BusPort becomes BusMasterPort and BusSlavePort
(avoiding multiple inheritance). With the later introduction of the
port interfaces, moving the functionality outside the port itself, a
lot of the duplicated code will disappear again.
2012-03-30 15:40:11 +02:00
|
|
|
TLB::getMasterPort()
|
2010-12-08 01:19:57 +01:00
|
|
|
{
|
2015-03-02 10:00:42 +01:00
|
|
|
return &stage2Mmu->getPort();
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TLB::updateMiscReg(ThreadContext *tc, ArmTranslationType tranType)
|
|
|
|
{
|
|
|
|
// check if the regs have changed, or the translation mode is different.
|
|
|
|
// NOTE: the tran type doesn't affect stage 2 TLB's as they only handle
|
|
|
|
// one type of translation anyway
|
2015-09-30 18:14:19 +02:00
|
|
|
if (miscRegValid && miscRegContext == tc->contextId() &&
|
|
|
|
((tranType == curTranType) || isStage2)) {
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
DPRINTF(TLBVerbose, "TLB variables changed!\n");
|
2015-05-26 09:21:42 +02:00
|
|
|
cpsr = tc->readMiscReg(MISCREG_CPSR);
|
2016-05-31 13:14:37 +02:00
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
// Dependencies: SCR/SCR_EL3, CPSR
|
2016-05-31 13:14:37 +02:00
|
|
|
isSecure = inSecureState(tc) &&
|
|
|
|
!(tranType & HypMode) && !(tranType & S1S2NsTran);
|
|
|
|
|
|
|
|
const OperatingMode op_mode = (OperatingMode) (uint8_t)cpsr.mode;
|
|
|
|
aarch64 = opModeIs64(op_mode) ||
|
|
|
|
(opModeToEL(op_mode) == EL0 && ELIs64(tc, EL1));
|
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
if (aarch64) { // AArch64
|
2016-08-02 11:38:02 +02:00
|
|
|
// determine EL we need to translate in
|
|
|
|
switch (tranType) {
|
|
|
|
case S1E0Tran:
|
|
|
|
case S12E0Tran:
|
|
|
|
aarch64EL = EL0;
|
|
|
|
break;
|
|
|
|
case S1E1Tran:
|
|
|
|
case S12E1Tran:
|
|
|
|
aarch64EL = EL1;
|
|
|
|
break;
|
|
|
|
case S1E2Tran:
|
|
|
|
aarch64EL = EL2;
|
|
|
|
break;
|
|
|
|
case S1E3Tran:
|
|
|
|
aarch64EL = EL3;
|
|
|
|
break;
|
|
|
|
case NormalTran:
|
|
|
|
case S1CTran:
|
|
|
|
case S1S2NsTran:
|
|
|
|
case HypMode:
|
|
|
|
aarch64EL = (ExceptionLevel) (uint8_t) cpsr.el;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
switch (aarch64EL) {
|
|
|
|
case EL0:
|
|
|
|
case EL1:
|
|
|
|
{
|
|
|
|
sctlr = tc->readMiscReg(MISCREG_SCTLR_EL1);
|
|
|
|
ttbcr = tc->readMiscReg(MISCREG_TCR_EL1);
|
|
|
|
uint64_t ttbr_asid = ttbcr.a1 ?
|
|
|
|
tc->readMiscReg(MISCREG_TTBR1_EL1) :
|
|
|
|
tc->readMiscReg(MISCREG_TTBR0_EL1);
|
|
|
|
asid = bits(ttbr_asid,
|
|
|
|
(haveLargeAsid64 && ttbcr.as) ? 63 : 55, 48);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case EL2:
|
|
|
|
sctlr = tc->readMiscReg(MISCREG_SCTLR_EL2);
|
|
|
|
ttbcr = tc->readMiscReg(MISCREG_TCR_EL2);
|
|
|
|
asid = -1;
|
|
|
|
break;
|
|
|
|
case EL3:
|
|
|
|
sctlr = tc->readMiscReg(MISCREG_SCTLR_EL3);
|
|
|
|
ttbcr = tc->readMiscReg(MISCREG_TCR_EL3);
|
|
|
|
asid = -1;
|
|
|
|
break;
|
|
|
|
}
|
2016-08-02 11:38:02 +02:00
|
|
|
hcr = tc->readMiscReg(MISCREG_HCR_EL2);
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
scr = tc->readMiscReg(MISCREG_SCR_EL3);
|
|
|
|
isPriv = aarch64EL != EL0;
|
2016-08-02 11:38:02 +02:00
|
|
|
if (haveVirtualization) {
|
|
|
|
vmid = bits(tc->readMiscReg(MISCREG_VTTBR_EL2), 55, 48);
|
|
|
|
isHyp = tranType & HypMode;
|
|
|
|
isHyp &= (tranType & S1S2NsTran) == 0;
|
|
|
|
isHyp &= (tranType & S1CTran) == 0;
|
|
|
|
// Work out if we should skip the first stage of translation and go
|
|
|
|
// directly to stage 2. This value is cached so we don't have to
|
|
|
|
// compute it for every translation.
|
|
|
|
stage2Req = isStage2 ||
|
|
|
|
(hcr.vm && !isHyp && !isSecure &&
|
2016-08-02 11:38:02 +02:00
|
|
|
!(tranType & S1CTran) && (aarch64EL < EL2) &&
|
|
|
|
!(tranType & S1E1Tran)); // <--- FIX THIS HACK
|
2016-08-02 11:38:02 +02:00
|
|
|
directToStage2 = !isStage2 && stage2Req && !sctlr.m;
|
|
|
|
} else {
|
|
|
|
vmid = 0;
|
|
|
|
isHyp = false;
|
|
|
|
directToStage2 = false;
|
|
|
|
stage2Req = false;
|
|
|
|
}
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
} else { // AArch32
|
|
|
|
sctlr = tc->readMiscReg(flattenMiscRegNsBanked(MISCREG_SCTLR, tc,
|
|
|
|
!isSecure));
|
|
|
|
ttbcr = tc->readMiscReg(flattenMiscRegNsBanked(MISCREG_TTBCR, tc,
|
|
|
|
!isSecure));
|
|
|
|
scr = tc->readMiscReg(MISCREG_SCR);
|
|
|
|
isPriv = cpsr.mode != MODE_USER;
|
2016-06-02 17:44:57 +02:00
|
|
|
if (longDescFormatInUse(tc)) {
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
uint64_t ttbr_asid = tc->readMiscReg(
|
|
|
|
flattenMiscRegNsBanked(ttbcr.a1 ? MISCREG_TTBR1
|
|
|
|
: MISCREG_TTBR0,
|
|
|
|
tc, !isSecure));
|
|
|
|
asid = bits(ttbr_asid, 55, 48);
|
2016-06-02 17:44:57 +02:00
|
|
|
} else { // Short-descriptor translation table format in use
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
CONTEXTIDR context_id = tc->readMiscReg(flattenMiscRegNsBanked(
|
|
|
|
MISCREG_CONTEXTIDR, tc,!isSecure));
|
|
|
|
asid = context_id.asid;
|
|
|
|
}
|
|
|
|
prrr = tc->readMiscReg(flattenMiscRegNsBanked(MISCREG_PRRR, tc,
|
|
|
|
!isSecure));
|
|
|
|
nmrr = tc->readMiscReg(flattenMiscRegNsBanked(MISCREG_NMRR, tc,
|
|
|
|
!isSecure));
|
|
|
|
dacr = tc->readMiscReg(flattenMiscRegNsBanked(MISCREG_DACR, tc,
|
|
|
|
!isSecure));
|
|
|
|
hcr = tc->readMiscReg(MISCREG_HCR);
|
|
|
|
|
|
|
|
if (haveVirtualization) {
|
|
|
|
vmid = bits(tc->readMiscReg(MISCREG_VTTBR), 55, 48);
|
|
|
|
isHyp = cpsr.mode == MODE_HYP;
|
|
|
|
isHyp |= tranType & HypMode;
|
|
|
|
isHyp &= (tranType & S1S2NsTran) == 0;
|
|
|
|
isHyp &= (tranType & S1CTran) == 0;
|
|
|
|
if (isHyp) {
|
|
|
|
sctlr = tc->readMiscReg(MISCREG_HSCTLR);
|
|
|
|
}
|
|
|
|
// Work out if we should skip the first stage of translation and go
|
|
|
|
// directly to stage 2. This value is cached so we don't have to
|
|
|
|
// compute it for every translation.
|
|
|
|
stage2Req = hcr.vm && !isStage2 && !isHyp && !isSecure &&
|
|
|
|
!(tranType & S1CTran);
|
|
|
|
directToStage2 = stage2Req && !sctlr.m;
|
|
|
|
} else {
|
|
|
|
vmid = 0;
|
|
|
|
stage2Req = false;
|
|
|
|
isHyp = false;
|
|
|
|
directToStage2 = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
miscRegValid = true;
|
2015-09-30 18:14:19 +02:00
|
|
|
miscRegContext = tc->contextId();
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
curTranType = tranType;
|
|
|
|
}
|
|
|
|
|
|
|
|
Fault
|
|
|
|
TLB::getTE(TlbEntry **te, RequestPtr req, ThreadContext *tc, Mode mode,
|
|
|
|
Translation *translation, bool timing, bool functional,
|
|
|
|
bool is_secure, TLB::ArmTranslationType tranType)
|
|
|
|
{
|
|
|
|
bool is_fetch = (mode == Execute);
|
|
|
|
bool is_write = (mode == Write);
|
|
|
|
|
|
|
|
Addr vaddr_tainted = req->getVaddr();
|
|
|
|
Addr vaddr = 0;
|
|
|
|
ExceptionLevel target_el = aarch64 ? aarch64EL : EL1;
|
|
|
|
if (aarch64) {
|
2015-05-26 09:21:42 +02:00
|
|
|
vaddr = purifyTaggedAddr(vaddr_tainted, tc, target_el, ttbcr);
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
} else {
|
|
|
|
vaddr = vaddr_tainted;
|
|
|
|
}
|
|
|
|
*te = lookup(vaddr, asid, vmid, isHyp, is_secure, false, false, target_el);
|
|
|
|
if (*te == NULL) {
|
|
|
|
if (req->isPrefetch()) {
|
|
|
|
// if the request is a prefetch don't attempt to fill the TLB or go
|
|
|
|
// any further with the memory access (here we can safely use the
|
|
|
|
// fault status for the short desc. format in all cases)
|
|
|
|
prefetchFaults++;
|
2014-10-16 11:49:51 +02:00
|
|
|
return std::make_shared<PrefetchAbort>(
|
|
|
|
vaddr_tainted, ArmFault::PrefetchTLBMiss, isStage2);
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (is_fetch)
|
|
|
|
instMisses++;
|
|
|
|
else if (is_write)
|
|
|
|
writeMisses++;
|
|
|
|
else
|
|
|
|
readMisses++;
|
|
|
|
|
|
|
|
// start translation table walk, pass variables rather than
|
|
|
|
// re-retreaving in table walker for speed
|
|
|
|
DPRINTF(TLB, "TLB Miss: Starting hardware table walker for %#x(%d:%d)\n",
|
|
|
|
vaddr_tainted, asid, vmid);
|
|
|
|
Fault fault;
|
|
|
|
fault = tableWalker->walk(req, tc, asid, vmid, isHyp, mode,
|
|
|
|
translation, timing, functional, is_secure,
|
2016-08-02 11:38:02 +02:00
|
|
|
tranType, stage2Req);
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
// for timing mode, return and wait for table walk,
|
|
|
|
if (timing || fault != NoFault) {
|
|
|
|
return fault;
|
|
|
|
}
|
|
|
|
|
|
|
|
*te = lookup(vaddr, asid, vmid, isHyp, is_secure, false, false, target_el);
|
|
|
|
if (!*te)
|
|
|
|
printTlb();
|
|
|
|
assert(*te);
|
|
|
|
} else {
|
|
|
|
if (is_fetch)
|
|
|
|
instHits++;
|
|
|
|
else if (is_write)
|
|
|
|
writeHits++;
|
|
|
|
else
|
|
|
|
readHits++;
|
|
|
|
}
|
|
|
|
return NoFault;
|
|
|
|
}
|
2010-12-08 01:19:57 +01:00
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
Fault
|
|
|
|
TLB::getResultTe(TlbEntry **te, RequestPtr req, ThreadContext *tc, Mode mode,
|
|
|
|
Translation *translation, bool timing, bool functional,
|
|
|
|
TlbEntry *mergeTe)
|
|
|
|
{
|
|
|
|
Fault fault;
|
2016-08-02 11:38:02 +02:00
|
|
|
|
|
|
|
if (isStage2) {
|
|
|
|
// We are already in the stage 2 TLB. Grab the table entry for stage
|
|
|
|
// 2 only. We are here because stage 1 translation is disabled.
|
|
|
|
TlbEntry *s2Te = NULL;
|
|
|
|
// Get the stage 2 table entry
|
|
|
|
fault = getTE(&s2Te, req, tc, mode, translation, timing, functional,
|
|
|
|
isSecure, curTranType);
|
|
|
|
// Check permissions of stage 2
|
|
|
|
if ((s2Te != NULL) && (fault = NoFault)) {
|
|
|
|
if(aarch64)
|
|
|
|
fault = checkPermissions64(s2Te, req, mode, tc);
|
|
|
|
else
|
|
|
|
fault = checkPermissions(s2Te, req, mode);
|
|
|
|
}
|
|
|
|
*te = s2Te;
|
|
|
|
return fault;
|
|
|
|
}
|
|
|
|
|
arm: Add support for ARMv8 (AArch64 & AArch32)
Note: AArch64 and AArch32 interworking is not supported. If you use an AArch64
kernel you are restricted to AArch64 user-mode binaries. This will be addressed
in a later patch.
Note: Virtualization is only supported in AArch32 mode. This will also be fixed
in a later patch.
Contributors:
Giacomo Gabrielli (TrustZone, LPAE, system-level AArch64, AArch64 NEON, validation)
Thomas Grocutt (AArch32 Virtualization, AArch64 FP, validation)
Mbou Eyole (AArch64 NEON, validation)
Ali Saidi (AArch64 Linux support, code integration, validation)
Edmund Grimley-Evans (AArch64 FP)
William Wang (AArch64 Linux support)
Rene De Jong (AArch64 Linux support, performance opt.)
Matt Horsnell (AArch64 MP, validation)
Matt Evans (device models, code integration, validation)
Chris Adeniyi-Jones (AArch64 syscall-emulation)
Prakash Ramrakhyani (validation)
Dam Sunwoo (validation)
Chander Sudanthi (validation)
Stephan Diestelhorst (validation)
Andreas Hansson (code integration, performance opt.)
Eric Van Hensbergen (performance opt.)
Gabe Black
2014-01-24 22:29:34 +01:00
|
|
|
TlbEntry *s1Te = NULL;
|
|
|
|
|
|
|
|
Addr vaddr_tainted = req->getVaddr();
|
|
|
|
|
|
|
|
// Get the stage 1 table entry
|
|
|
|
fault = getTE(&s1Te, req, tc, mode, translation, timing, functional,
|
|
|
|
isSecure, curTranType);
|
|
|
|
// only proceed if we have a valid table entry
|
|
|
|
if ((s1Te != NULL) && (fault == NoFault)) {
|
|
|
|
// Check stage 1 permissions before checking stage 2
|
|
|
|
if (aarch64)
|
|
|
|
fault = checkPermissions64(s1Te, req, mode, tc);
|
|
|
|
else
|
|
|
|
fault = checkPermissions(s1Te, req, mode);
|
|
|
|
if (stage2Req & (fault == NoFault)) {
|
|
|
|
Stage2LookUp *s2Lookup = new Stage2LookUp(this, stage2Tlb, *s1Te,
|
|
|
|
req, translation, mode, timing, functional, curTranType);
|
|
|
|
fault = s2Lookup->getTe(tc, mergeTe);
|
|
|
|
if (s2Lookup->isComplete()) {
|
|
|
|
*te = mergeTe;
|
|
|
|
// We've finished with the lookup so delete it
|
|
|
|
delete s2Lookup;
|
|
|
|
} else {
|
|
|
|
// The lookup hasn't completed, so we can't delete it now. We
|
|
|
|
// get round this by asking the object to self delete when the
|
|
|
|
// translation is complete.
|
|
|
|
s2Lookup->setSelfDelete();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// This case deals with an S1 hit (or bypass), followed by
|
|
|
|
// an S2 hit-but-perms issue
|
|
|
|
if (isStage2) {
|
|
|
|
DPRINTF(TLBVerbose, "s2TLB: reqVa %#x, reqPa %#x, fault %p\n",
|
|
|
|
vaddr_tainted, req->hasPaddr() ? req->getPaddr() : ~0, fault);
|
|
|
|
if (fault != NoFault) {
|
|
|
|
ArmFault *armFault = reinterpret_cast<ArmFault *>(fault.get());
|
|
|
|
armFault->annotate(ArmFault::S1PTW, false);
|
|
|
|
armFault->annotate(ArmFault::OVA, vaddr_tainted);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*te = s1Te;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return fault;
|
|
|
|
}
|
2010-12-08 01:19:57 +01:00
|
|
|
|
2016-03-21 16:54:58 +01:00
|
|
|
void
|
|
|
|
TLB::setTestInterface(SimObject *_ti)
|
|
|
|
{
|
|
|
|
if (!_ti) {
|
|
|
|
test = nullptr;
|
|
|
|
} else {
|
|
|
|
TlbTestInterface *ti(dynamic_cast<TlbTestInterface *>(_ti));
|
|
|
|
fatal_if(!ti, "%s is not a valid ARM TLB tester\n", _ti->name());
|
|
|
|
test = ti;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Fault
|
|
|
|
TLB::testTranslation(RequestPtr req, Mode mode, TlbEntry::DomainType domain)
|
|
|
|
{
|
2016-07-11 11:39:56 +02:00
|
|
|
if (!test || !req->hasSize() || req->getSize() == 0) {
|
2016-03-21 16:54:58 +01:00
|
|
|
return NoFault;
|
|
|
|
} else {
|
|
|
|
return test->translationCheck(req, isPriv, mode, domain);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Fault
|
|
|
|
TLB::testWalk(Addr pa, Addr size, Addr va, bool is_secure, Mode mode,
|
|
|
|
TlbEntry::DomainType domain, LookupLevel lookup_level)
|
|
|
|
{
|
|
|
|
if (!test) {
|
|
|
|
return NoFault;
|
|
|
|
} else {
|
|
|
|
return test->walkCheck(pa, size, va, is_secure, isPriv, mode,
|
|
|
|
domain, lookup_level);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-04-22 00:40:25 +02:00
|
|
|
ArmISA::TLB *
|
|
|
|
ArmTLBParams::create()
|
2009-04-06 03:53:15 +02:00
|
|
|
{
|
2009-04-22 00:40:25 +02:00
|
|
|
return new ArmISA::TLB(this);
|
2009-04-06 03:53:15 +02:00
|
|
|
}
|