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 292SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 302SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 318869SAli.Saidi@ARM.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 328869SAli.Saidi@ARM.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 332SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 347840Snate@binkert.org * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 352SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36400SN/A * 377840Snate@binkert.org * Authors: Giacomo Travaglini 387862Sgblack@eecs.umich.edu */ 397870Sgblack@eecs.umich.edu 402SN/A#ifndef __ARCH_ARM_TLBI_HH__ 412SN/A#define __ARCH_ARM_TLBI_HH__ 422SN/A 437840Snate@binkert.org#include "arch/arm/system.hh" 447840Snate@binkert.org#include "arch/arm/tlb.hh" 452SN/A#include "cpu/thread_context.hh" 467840Snate@binkert.org 477840Snate@binkert.org/** 487840Snate@binkert.org * @file 49400SN/A * The file contains the definition of a set of TLB Invalidate 507840Snate@binkert.org * Instructions. Those are the ISA interface for TLB flushing 517840Snate@binkert.org * operations. 527840Snate@binkert.org */ 53400SN/Anamespace ArmISA { 54400SN/A 557862Sgblack@eecs.umich.educlass TLBIOp 567862Sgblack@eecs.umich.edu{ 577862Sgblack@eecs.umich.edu public: 587862Sgblack@eecs.umich.edu TLBIOp(ExceptionLevel _targetEL, bool _secure) 597862Sgblack@eecs.umich.edu : secureLookup(_secure), targetEL(_targetEL) 607862Sgblack@eecs.umich.edu {} 617862Sgblack@eecs.umich.edu 627862Sgblack@eecs.umich.edu virtual ~TLBIOp() {} 637862Sgblack@eecs.umich.edu virtual void operator()(ThreadContext* tc) {} 647862Sgblack@eecs.umich.edu 657862Sgblack@eecs.umich.edu /** 667862Sgblack@eecs.umich.edu * Broadcast the TLB Invalidate operation to all 677862Sgblack@eecs.umich.edu * TLBs in the Arm system. 68400SN/A * @param tc Thread Context 697840Snate@binkert.org */ 70400SN/A void 717840Snate@binkert.org broadcast(ThreadContext *tc) 72400SN/A { 73400SN/A System *sys = tc->getSystemPtr(); 74400SN/A for (int x = 0; x < sys->numContexts(); x++) { 753918Ssaidi@eecs.umich.edu ThreadContext *oc = sys->getThreadContext(x); 767840Snate@binkert.org (*this)(oc); 773918Ssaidi@eecs.umich.edu } 78400SN/A } 793918Ssaidi@eecs.umich.edu 80400SN/A protected: 81400SN/A bool secureLookup; 822SN/A ExceptionLevel targetEL; 832SN/A}; 84400SN/A 85400SN/A/** TLB Invalidate All */ 86400SN/Aclass TLBIALL : public TLBIOp 87400SN/A{ 882SN/A public: 897840Snate@binkert.org TLBIALL(ExceptionLevel _targetEL, bool _secure) 907840Snate@binkert.org : TLBIOp(_targetEL, _secure) 91400SN/A {} 927840Snate@binkert.org 937840Snate@binkert.org void operator()(ThreadContext* tc) override; 947840Snate@binkert.org}; 957840Snate@binkert.org 967840Snate@binkert.org/** Instruction TLB Invalidate All */ 977840Snate@binkert.orgclass ITLBIALL : public TLBIOp 987840Snate@binkert.org{ 997840Snate@binkert.org public: 1007840Snate@binkert.org ITLBIALL(ExceptionLevel _targetEL, bool _secure) 1017840Snate@binkert.org : TLBIOp(_targetEL, _secure) 1027840Snate@binkert.org {} 1037840Snate@binkert.org 1047840Snate@binkert.org void broadcast(ThreadContext *tc) = delete; 1057840Snate@binkert.org 1067840Snate@binkert.org void operator()(ThreadContext* tc) override; 1077840Snate@binkert.org}; 1087840Snate@binkert.org 1097840Snate@binkert.org/** Data TLB Invalidate All */ 1107840Snate@binkert.orgclass DTLBIALL : public TLBIOp 1117840Snate@binkert.org{ 1127840Snate@binkert.org public: 1137840Snate@binkert.org DTLBIALL(ExceptionLevel _targetEL, bool _secure) 1147840Snate@binkert.org : TLBIOp(_targetEL, _secure) 1157840Snate@binkert.org {} 1167840Snate@binkert.org 117400SN/A void broadcast(ThreadContext *tc) = delete; 1182SN/A 1197840Snate@binkert.org void operator()(ThreadContext* tc) override; 1207870Sgblack@eecs.umich.edu}; 1217870Sgblack@eecs.umich.edu 1227870Sgblack@eecs.umich.edu/** TLB Invalidate by ASID match */ 1237870Sgblack@eecs.umich.educlass TLBIASID : public TLBIOp 1247870Sgblack@eecs.umich.edu{ 1257870Sgblack@eecs.umich.edu public: 1267870Sgblack@eecs.umich.edu TLBIASID(ExceptionLevel _targetEL, bool _secure, uint16_t _asid) 1277870Sgblack@eecs.umich.edu : TLBIOp(_targetEL, _secure), asid(_asid) 1287870Sgblack@eecs.umich.edu {} 1297870Sgblack@eecs.umich.edu 1307870Sgblack@eecs.umich.edu void operator()(ThreadContext* tc) override; 1317870Sgblack@eecs.umich.edu 1327870Sgblack@eecs.umich.edu protected: 1337870Sgblack@eecs.umich.edu uint16_t asid; 1347870Sgblack@eecs.umich.edu}; 1357870Sgblack@eecs.umich.edu 1367870Sgblack@eecs.umich.edu/** Instruction TLB Invalidate by ASID match */ 1377870Sgblack@eecs.umich.educlass ITLBIASID : public TLBIOp 1387870Sgblack@eecs.umich.edu{ 1397840Snate@binkert.org public: 140400SN/A ITLBIASID(ExceptionLevel _targetEL, bool _secure, uint16_t _asid) 1417840Snate@binkert.org : TLBIOp(_targetEL, _secure), asid(_asid) 1427840Snate@binkert.org {} 1437840Snate@binkert.org 1447840Snate@binkert.org void broadcast(ThreadContext *tc) = delete; 1457840Snate@binkert.org 1467840Snate@binkert.org void operator()(ThreadContext* tc) override; 1477840Snate@binkert.org 148400SN/A protected: 1498869SAli.Saidi@ARM.com uint16_t asid; 1508869SAli.Saidi@ARM.com}; 1518869SAli.Saidi@ARM.com 1528869SAli.Saidi@ARM.com/** Data TLB Invalidate by ASID match */ 15310531Sandreas.hansson@arm.comclass DTLBIASID : public TLBIOp 15410531Sandreas.hansson@arm.com{ 15510531Sandreas.hansson@arm.com public: 15610531Sandreas.hansson@arm.com DTLBIASID(ExceptionLevel _targetEL, bool _secure, uint16_t _asid) 15710531Sandreas.hansson@arm.com : TLBIOp(_targetEL, _secure), asid(_asid) 15810531Sandreas.hansson@arm.com {} 15910531Sandreas.hansson@arm.com 16010531Sandreas.hansson@arm.com void broadcast(ThreadContext *tc) = delete; 16110531Sandreas.hansson@arm.com 16210531Sandreas.hansson@arm.com void operator()(ThreadContext* tc) override; 16310531Sandreas.hansson@arm.com 16410531Sandreas.hansson@arm.com protected: 16510531Sandreas.hansson@arm.com uint16_t asid; 16610531Sandreas.hansson@arm.com}; 16710531Sandreas.hansson@arm.com 16810531Sandreas.hansson@arm.com/** TLB Invalidate All, Non-Secure */ 16910531Sandreas.hansson@arm.comclass TLBIALLN : public TLBIOp 17010531Sandreas.hansson@arm.com{ 17110531Sandreas.hansson@arm.com public: 17210531Sandreas.hansson@arm.com TLBIALLN(ExceptionLevel _targetEL) 17310531Sandreas.hansson@arm.com : TLBIOp(_targetEL, false) 17410531Sandreas.hansson@arm.com {} 17510531Sandreas.hansson@arm.com 17610531Sandreas.hansson@arm.com void operator()(ThreadContext* tc) override; 17710531Sandreas.hansson@arm.com}; 17810531Sandreas.hansson@arm.com 17910531Sandreas.hansson@arm.com/** TLB Invalidate by VA, All ASID */ 1808869SAli.Saidi@ARM.comclass TLBIMVAA : public TLBIOp 1818869SAli.Saidi@ARM.com{ 182 public: 183 TLBIMVAA(ExceptionLevel _targetEL, bool _secure, 184 Addr _addr) 185 : TLBIOp(_targetEL, _secure), addr(_addr) 186 {} 187 188 void operator()(ThreadContext* tc) override; 189 190 protected: 191 Addr addr; 192}; 193 194/** TLB Invalidate by VA */ 195class TLBIMVA : public TLBIOp 196{ 197 public: 198 TLBIMVA(ExceptionLevel _targetEL, bool _secure, 199 Addr _addr, uint16_t _asid) 200 : TLBIOp(_targetEL, _secure), addr(_addr), asid(_asid) 201 {} 202 203 void operator()(ThreadContext* tc) override; 204 205 protected: 206 Addr addr; 207 uint16_t asid; 208}; 209 210/** Instruction TLB Invalidate by VA */ 211class ITLBIMVA : public TLBIOp 212{ 213 public: 214 ITLBIMVA(ExceptionLevel _targetEL, bool _secure, 215 Addr _addr, uint16_t _asid) 216 : TLBIOp(_targetEL, _secure), addr(_addr), asid(_asid) 217 {} 218 219 void broadcast(ThreadContext *tc) = delete; 220 221 void operator()(ThreadContext* tc) override; 222 223 protected: 224 Addr addr; 225 uint16_t asid; 226}; 227 228/** Data TLB Invalidate by VA */ 229class DTLBIMVA : public TLBIOp 230{ 231 public: 232 DTLBIMVA(ExceptionLevel _targetEL, bool _secure, 233 Addr _addr, uint16_t _asid) 234 : TLBIOp(_targetEL, _secure), addr(_addr), asid(_asid) 235 {} 236 237 void broadcast(ThreadContext *tc) = delete; 238 239 void operator()(ThreadContext* tc) override; 240 241 protected: 242 Addr addr; 243 uint16_t asid; 244}; 245 246/** TLB Invalidate by Intermediate Physical Address */ 247class TLBIIPA : public TLBIOp 248{ 249 public: 250 TLBIIPA(ExceptionLevel _targetEL, bool _secure, Addr _addr) 251 : TLBIOp(_targetEL, _secure), addr(_addr) 252 {} 253 254 void operator()(ThreadContext* tc) override; 255 256 protected: 257 Addr addr; 258}; 259 260} // namespace ArmISA 261 262#endif //__ARCH_ARM_TLBI_HH__ 263