smmu_v3_ptops.hh revision 14039
111320Ssteve.reinhardt@amd.com/* 210328Smitch.hayenga@arm.com * Copyright (c) 2013, 2018-2019 ARM Limited 39444SAndreas.Sandberg@ARM.com * All rights reserved 49444SAndreas.Sandberg@ARM.com * 59444SAndreas.Sandberg@ARM.com * The license below extends only to copyright in the software and shall 69444SAndreas.Sandberg@ARM.com * not be construed as granting a license to any other intellectual 79444SAndreas.Sandberg@ARM.com * property including but not limited to intellectual property relating 89444SAndreas.Sandberg@ARM.com * to a hardware implementation of the functionality of the software 99444SAndreas.Sandberg@ARM.com * licensed hereunder. You may use the software subject to the license 109444SAndreas.Sandberg@ARM.com * terms below provided that you ensure that this notice is replicated 119444SAndreas.Sandberg@ARM.com * unmodified and in its entirety in all distributions of the software, 129444SAndreas.Sandberg@ARM.com * modified or unmodified, in source code or in binary form. 139444SAndreas.Sandberg@ARM.com * 142329SN/A * Redistribution and use in source and binary forms, with or without 151689SN/A * modification, are permitted provided that the following conditions are 161689SN/A * met: redistributions of source code must retain the above copyright 171689SN/A * notice, this list of conditions and the following disclaimer; 181689SN/A * redistributions in binary form must reproduce the above copyright 191689SN/A * notice, this list of conditions and the following disclaimer in the 201689SN/A * documentation and/or other materials provided with the distribution; 211689SN/A * neither the name of the copyright holders nor the names of its 221689SN/A * contributors may be used to endorse or promote products derived from 231689SN/A * this software without specific prior written permission. 241689SN/A * 251689SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 261689SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 271689SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 281689SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 291689SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 301689SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 311689SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 321689SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 331689SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 341689SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 351689SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 361689SN/A * 371689SN/A * Authors: Stan Czerniawski 381689SN/A */ 392665Ssaidi@eecs.umich.edu 402665Ssaidi@eecs.umich.edu#ifndef __DEV_ARM_SMMU_V3_PTOPS_HH__ 411689SN/A#define __DEV_ARM_SMMU_V3_PTOPS_HH__ 421689SN/A 439944Smatt.horsnell@ARM.com#include <stdint.h> 449944Smatt.horsnell@ARM.com 459944Smatt.horsnell@ARM.com#include "base/types.hh" 468230Snate@binkert.org 478230Snate@binkert.orgstruct PageTableOps 486658Snate@binkert.org{ 491717SN/A typedef int64_t pte_t; 508230Snate@binkert.org 518232Snate@binkert.org virtual bool isValid(pte_t pte, unsigned level) const = 0; 528232Snate@binkert.org virtual bool isLeaf(pte_t pte, unsigned level) const = 0; 539527SMatt.Horsnell@arm.com virtual bool isWritable(pte_t pte, unsigned level, bool stage2) const = 0; 546221Snate@binkert.org virtual Addr nextLevelPointer(pte_t pte, unsigned level) const = 0; 558793Sgblack@eecs.umich.edu virtual Addr index(Addr va, unsigned level) const = 0; 561060SN/A virtual Addr pageMask(pte_t pte, unsigned level) const = 0; 578737Skoansin.tan@gmail.com virtual Addr walkMask(unsigned level) const = 0; 588737Skoansin.tan@gmail.com virtual unsigned firstLevel() const = 0; 598737Skoansin.tan@gmail.com virtual unsigned lastLevel() const = 0; 605529Snate@binkert.org}; 611060SN/A 625529Snate@binkert.orgstruct V7LPageTableOps : public PageTableOps 634329Sktlim@umich.edu{ 644329Sktlim@umich.edu virtual bool isValid(pte_t pte, unsigned level) const; 652292SN/A virtual bool isLeaf(pte_t pte, unsigned level) const; 662292SN/A virtual bool isWritable(pte_t pte, unsigned level, bool stage2) const; 672292SN/A virtual Addr nextLevelPointer(pte_t pte, unsigned level) const; 682292SN/A virtual Addr index(Addr va, unsigned level) const; 695529Snate@binkert.org virtual Addr pageMask(pte_t pte, unsigned level) const; 701060SN/A virtual Addr walkMask(unsigned level) const; 7110172Sdam.sunwoo@arm.com virtual unsigned firstLevel() const; 7210172Sdam.sunwoo@arm.com virtual unsigned lastLevel() const; 7310172Sdam.sunwoo@arm.com}; 7410172Sdam.sunwoo@arm.com 7510172Sdam.sunwoo@arm.comstruct V8PageTableOps4k : public PageTableOps 769444SAndreas.Sandberg@ARM.com{ 779444SAndreas.Sandberg@ARM.com virtual bool isValid(pte_t pte, unsigned level) const; 7813453Srekai.gonzalezalberquilla@arm.com virtual bool isLeaf(pte_t pte, unsigned level) const; 7913453Srekai.gonzalezalberquilla@arm.com virtual bool isWritable(pte_t pte, unsigned level, bool stage2) const; 8013453Srekai.gonzalezalberquilla@arm.com virtual Addr nextLevelPointer(pte_t pte, unsigned level) const; 8113453Srekai.gonzalezalberquilla@arm.com virtual Addr index(Addr va, unsigned level) const; 8213453Srekai.gonzalezalberquilla@arm.com virtual Addr pageMask(pte_t pte, unsigned level) const; 8313453Srekai.gonzalezalberquilla@arm.com virtual Addr walkMask(unsigned level) const; 8413453Srekai.gonzalezalberquilla@arm.com virtual unsigned firstLevel() const; 859444SAndreas.Sandberg@ARM.com virtual unsigned lastLevel() const; 869444SAndreas.Sandberg@ARM.com}; 879444SAndreas.Sandberg@ARM.com 889444SAndreas.Sandberg@ARM.comstruct V8PageTableOps64k : public PageTableOps 899444SAndreas.Sandberg@ARM.com{ 909444SAndreas.Sandberg@ARM.com virtual bool isValid(pte_t pte, unsigned level) const; 919444SAndreas.Sandberg@ARM.com virtual bool isLeaf(pte_t pte, unsigned level) const; 929444SAndreas.Sandberg@ARM.com virtual bool isWritable(pte_t pte, unsigned level, bool stage2) const; 939444SAndreas.Sandberg@ARM.com virtual Addr nextLevelPointer(pte_t pte, unsigned level) const; 949444SAndreas.Sandberg@ARM.com virtual Addr index(Addr va, unsigned level) const; 959444SAndreas.Sandberg@ARM.com virtual Addr pageMask(pte_t pte, unsigned level) const; 9613641Sqtt2@cornell.edu virtual Addr walkMask(unsigned level) const; 9713641Sqtt2@cornell.edu virtual unsigned firstLevel() const; 9813641Sqtt2@cornell.edu virtual unsigned lastLevel() const; 9913641Sqtt2@cornell.edu}; 10013641Sqtt2@cornell.edu 10113641Sqtt2@cornell.edu#endif /* __DEV_ARM_SMMU_V3_PTOPS_HH__ */ 10213641Sqtt2@cornell.edu