tlbi_op.hh revision 13882
12SN/A/* 21762SN/A * Copyright (c) 2018-2019 ARM Limited 32SN/A * All rights reserved 42SN/A * 52SN/A * The license below extends only to copyright in the software and shall 62SN/A * not be construed as granting a license to any other intellectual 72SN/A * property including but not limited to intellectual property relating 82SN/A * to a hardware implementation of the functionality of the software 92SN/A * licensed hereunder. You may use the software subject to the license 102SN/A * terms below provided that you ensure that this notice is replicated 112SN/A * unmodified and in its entirety in all distributions of the software, 122SN/A * modified or unmodified, in source code or in binary form. 132SN/A * 142SN/A * Redistribution and use in source and binary forms, with or without 152SN/A * modification, are permitted provided that the following conditions are 162SN/A * met: redistributions of source code must retain the above copyright 172SN/A * notice, this list of conditions and the following disclaimer; 182SN/A * redistributions in binary form must reproduce the above copyright 192SN/A * notice, this list of conditions and the following disclaimer in the 202SN/A * documentation and/or other materials provided with the distribution; 212SN/A * neither the name of the copyright holders nor the names of its 222SN/A * contributors may be used to endorse or promote products derived from 232SN/A * this software without specific prior written permission. 242SN/A * 252SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 262SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 272665Ssaidi@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 282665Ssaidi@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 292665Ssaidi@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 302SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 312SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 325569Snate@binkert.org * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 335569Snate@binkert.org * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 342SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 355569Snate@binkert.org * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 363614Sgblack@eecs.umich.edu * 377678Sgblack@eecs.umich.edu * Authors: Giacomo Travaglini 383614Sgblack@eecs.umich.edu */ 393614Sgblack@eecs.umich.edu 402166SN/A#ifndef __ARCH_ARM_TLBI_HH__ 412147SN/A#define __ARCH_ARM_TLBI_HH__ 425569Snate@binkert.org 432167SN/A#include "arch/arm/system.hh" 442147SN/A#include "arch/arm/tlb.hh" 452090SN/A#include "cpu/thread_context.hh" 462222SN/A 472090SN/A/** 482201SN/A * @file 492201SN/A * The file contains the definition of a set of TLB Invalidate 502201SN/A * Instructions. Those are the ISA interface for TLB flushing 512112SN/A * operations. 522174SN/A */ 537678Sgblack@eecs.umich.edunamespace ArmISA { 547678Sgblack@eecs.umich.edu 552174SN/Aclass TLBIOp 562175SN/A{ 572222SN/A public: 582SN/A TLBIOp(ExceptionLevel _targetEL, bool _secure) 592SN/A : secureLookup(_secure), targetEL(_targetEL) 602203SN/A {} 612166SN/A 622166SN/A virtual ~TLBIOp() {} 632203SN/A virtual void operator()(ThreadContext* tc) {} 642166SN/A 652222SN/A /** 665569Snate@binkert.org * Broadcast the TLB Invalidate operation to all 672166SN/A * TLBs in the Arm system. 684695Sgblack@eecs.umich.edu * @param tc Thread Context 692166SN/A */ 702222SN/A void 714695Sgblack@eecs.umich.edu broadcast(ThreadContext *tc) 722166SN/A { 732166SN/A System *sys = tc->getSystemPtr(); 742203SN/A for (int x = 0; x < sys->numContexts(); x++) { 752166SN/A ThreadContext *oc = sys->getThreadContext(x); 762166SN/A (*this)(oc); 772203SN/A } 782166SN/A } 792222SN/A 805569Snate@binkert.org protected: 812166SN/A bool secureLookup; 824695Sgblack@eecs.umich.edu ExceptionLevel targetEL; 832166SN/A}; 842222SN/A 854695Sgblack@eecs.umich.edu/** TLB Invalidate All */ 862166SN/Aclass TLBIALL : public TLBIOp 872166SN/A{ 882166SN/A public: 892166SN/A TLBIALL(ExceptionLevel _targetEL, bool _secure) 902203SN/A : TLBIOp(_targetEL, _secure) 912166SN/A {} 922166SN/A 932147SN/A void operator()(ThreadContext* tc) override; 942090SN/A}; 952147SN/A 962147SN/A/** Instruction TLB Invalidate All */ 972147SN/Aclass ITLBIALL : public TLBIOp 982222SN/A{ 995569Snate@binkert.org public: 1002112SN/A ITLBIALL(ExceptionLevel _targetEL, bool _secure) 1014695Sgblack@eecs.umich.edu : TLBIOp(_targetEL, _secure) 1022147SN/A {} 1032222SN/A 1042147SN/A void broadcast(ThreadContext *tc) = delete; 1052090SN/A 1062147SN/A void operator()(ThreadContext* tc) override; 1072090SN/A}; 1082147SN/A 1092147SN/A/** Data TLB Invalidate All */ 1102147SN/Aclass DTLBIALL : public TLBIOp 1112222SN/A{ 1125569Snate@binkert.org public: 1135569Snate@binkert.org DTLBIALL(ExceptionLevel _targetEL, bool _secure) 1145569Snate@binkert.org : TLBIOp(_targetEL, _secure) 1155569Snate@binkert.org {} 1162112SN/A 1174695Sgblack@eecs.umich.edu void broadcast(ThreadContext *tc) = delete; 1182147SN/A 1192222SN/A void operator()(ThreadContext* tc) override; 1202203SN/A}; 1217678Sgblack@eecs.umich.edu 1227678Sgblack@eecs.umich.edu/** TLB Invalidate by ASID match */ 1232203SN/Aclass TLBIASID : public TLBIOp 1242147SN/A{ 1252090SN/A public: 1262147SN/A TLBIASID(ExceptionLevel _targetEL, bool _secure, uint16_t _asid) 1272090SN/A : TLBIOp(_targetEL, _secure), asid(_asid) 1282147SN/A {} 1292147SN/A 1302147SN/A void operator()(ThreadContext* tc) override; 1312222SN/A 1325569Snate@binkert.org protected: 1335569Snate@binkert.org uint16_t asid; 1345569Snate@binkert.org}; 1355569Snate@binkert.org 1362112SN/A/** Instruction TLB Invalidate by ASID match */ 1374695Sgblack@eecs.umich.educlass ITLBIASID : public TLBIOp 1382147SN/A{ 1392222SN/A public: 1402147SN/A ITLBIASID(ExceptionLevel _targetEL, bool _secure, uint16_t _asid) 1412090SN/A : TLBIOp(_targetEL, _secure), asid(_asid) 1422502SN/A {} 1432502SN/A 1444997Sgblack@eecs.umich.edu void broadcast(ThreadContext *tc) = delete; 1455568Snate@binkert.org 1465736Snate@binkert.org void operator()(ThreadContext* tc) override; 1472502SN/A 1485569Snate@binkert.org protected: 1492502SN/A uint16_t asid; 1505736Snate@binkert.org}; 1512502SN/A 1522502SN/A/** Data TLB Invalidate by ASID match */ 1534695Sgblack@eecs.umich.educlass DTLBIASID : public TLBIOp 1542502SN/A{ 1552502SN/A public: 1562502SN/A DTLBIASID(ExceptionLevel _targetEL, bool _secure, uint16_t _asid) 1577678Sgblack@eecs.umich.edu : TLBIOp(_targetEL, _secure), asid(_asid) 1587678Sgblack@eecs.umich.edu {} 1592502SN/A 1602502SN/A void broadcast(ThreadContext *tc) = delete; 1612502SN/A 1622502SN/A void operator()(ThreadContext* tc) override; 1632090SN/A 1642147SN/A protected: 1652147SN/A uint16_t asid; 1662147SN/A}; 1672222SN/A 1685569Snate@binkert.org/** TLB Invalidate All, Non-Secure */ 1692112SN/Aclass TLBIALLN : public TLBIOp 1705736Snate@binkert.org{ 1712502SN/A public: 1722502SN/A TLBIALLN(ExceptionLevel _targetEL) 1734695Sgblack@eecs.umich.edu : TLBIOp(_targetEL, false) 1742147SN/A {} 1752222SN/A 1764997Sgblack@eecs.umich.edu void operator()(ThreadContext* tc) override; 1777678Sgblack@eecs.umich.edu}; 1787678Sgblack@eecs.umich.edu 1794997Sgblack@eecs.umich.edu/** TLB Invalidate by VA, All ASID */ 1802147SN/Aclass TLBIMVAA : public TLBIOp 1812090SN/A{ 1822502SN/A public: 1832090SN/A TLBIMVAA(ExceptionLevel _targetEL, bool _secure, 1842147SN/A Addr _addr) 1852147SN/A : TLBIOp(_targetEL, _secure), addr(_addr) 1862147SN/A {} 1872222SN/A 1885569Snate@binkert.org void operator()(ThreadContext* tc) override; 1892112SN/A 1905736Snate@binkert.org protected: 1912502SN/A Addr addr; 1922502SN/A}; 1934695Sgblack@eecs.umich.edu 1942147SN/A/** TLB Invalidate by VA */ 1952222SN/Aclass TLBIMVA : public TLBIOp 1962147SN/A{ 1972090SN/A public: 1982502SN/A TLBIMVA(ExceptionLevel _targetEL, bool _secure, 1992090SN/A Addr _addr, uint16_t _asid) 2002147SN/A : TLBIOp(_targetEL, _secure), addr(_addr), asid(_asid) 2012147SN/A {} 2022147SN/A 2032222SN/A void operator()(ThreadContext* tc) override; 2045569Snate@binkert.org 2052112SN/A protected: 2065736Snate@binkert.org Addr addr; 2072502SN/A uint16_t asid; 2082502SN/A}; 2094695Sgblack@eecs.umich.edu 2102147SN/A/** Instruction TLB Invalidate by VA */ 2112222SN/Aclass ITLBIMVA : public TLBIOp 2122147SN/A{ 2132090SN/A public: 2142502SN/A ITLBIMVA(ExceptionLevel _targetEL, bool _secure, 2152090SN/A Addr _addr, uint16_t _asid) 2162147SN/A : TLBIOp(_targetEL, _secure), addr(_addr), asid(_asid) 2172147SN/A {} 2182147SN/A 2192222SN/A void broadcast(ThreadContext *tc) = delete; 2205569Snate@binkert.org 2212112SN/A void operator()(ThreadContext* tc) override; 2225736Snate@binkert.org 2232502SN/A protected: 2242502SN/A Addr addr; 2254695Sgblack@eecs.umich.edu uint16_t asid; 2262147SN/A}; 2272222SN/A 2282147SN/A/** Data TLB Invalidate by VA */ 2292090SN/Aclass DTLBIMVA : public TLBIOp 2302502SN/A{ 2312090SN/A public: 2322147SN/A DTLBIMVA(ExceptionLevel _targetEL, bool _secure, 2332147SN/A Addr _addr, uint16_t _asid) 2342147SN/A : TLBIOp(_targetEL, _secure), addr(_addr), asid(_asid) 2352222SN/A {} 2365569Snate@binkert.org 2372112SN/A void broadcast(ThreadContext *tc) = delete; 2385736Snate@binkert.org 2392502SN/A void operator()(ThreadContext* tc) override; 2402502SN/A 2414695Sgblack@eecs.umich.edu protected: 2422147SN/A Addr addr; 2432222SN/A uint16_t asid; 2442147SN/A}; 2452090SN/A 2462502SN/A/** TLB Invalidate by Intermediate Physical Address */ 2472502SN/Aclass TLBIIPA : public TLBIOp 2484997Sgblack@eecs.umich.edu{ 2492502SN/A public: 2505569Snate@binkert.org TLBIIPA(ExceptionLevel _targetEL, bool _secure, Addr _addr) 2512502SN/A : TLBIOp(_targetEL, _secure), addr(_addr) 2525569Snate@binkert.org {} 2534695Sgblack@eecs.umich.edu 2542505SN/A void operator()(ThreadContext* tc) override; 2552505SN/A 2562502SN/A protected: 2577678Sgblack@eecs.umich.edu Addr addr; 2587678Sgblack@eecs.umich.edu}; 2592502SN/A 2602502SN/A} // namespace ArmISA 2612502SN/A 2622502SN/A#endif //__ARCH_ARM_TLBI_HH__ 2632090SN/A