gem5  v22.1.0.0
pagetable.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021 Advanced Micro Devices, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  *
11  * 2. Redistributions in binary form must reproduce the above copyright notice,
12  * this list of conditions and the following disclaimer in the documentation
13  * and/or other materials provided with the distribution.
14  *
15  * 3. Neither the name of the copyright holder nor the names of its
16  * contributors may be used to endorse or promote products derived from this
17  * software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 #ifndef __ARCH_AMDGPU_VEGA_PAGETABLE_H__
33 #define __ARCH_AMDGPU_VEGA_PAGETABLE_H__
34 
36 #include "base/bitunion.hh"
37 #include "base/types.hh"
38 #include "sim/serialize.hh"
39 
40 namespace gem5
41 {
42 namespace VegaISA
43 {
44 
52  Bitfield<58,57> m;
53  Bitfield<56> f;
54  Bitfield<55> l;
55  Bitfield<53,52> sw;
56  Bitfield<51> t;
57  Bitfield<47, 12> ppn;
58  Bitfield<11, 7> fragment;
59  Bitfield<6> w;
60  Bitfield<5> r;
61  Bitfield<4> x;
62  Bitfield<3> z;
63  Bitfield<2> c;
64  Bitfield<1> s;
65  Bitfield<0> v;
67 
68 BitUnion64(PageDirectoryEntry)
69  Bitfield<63,59> blockFragmentSize;
70  Bitfield<54> p;
71  Bitfield<47, 6> baseAddr;
72  Bitfield<2> c;
73  Bitfield<1> s;
74  Bitfield<0> v;
75 EndBitUnion(PageDirectoryEntry)
76 
77 struct VegaTlbEntry : public Serializable
78 {
79  uint16_t vmid;
80 
81  // The base of the physical page.
82  Addr paddr;
83 
84  // The beginning of the virtual page this entry maps.
85  Addr vaddr;
86  // The size of the page this represents, in address bits.
87  unsigned logBytes;
88 
89  PageTableEntry pte;
90 
91  // Read permission is always available, assuming it isn't blocked by
92  // other mechanisms.
93  bool writable() { return pte.w; };
94  // Whether the page is cacheable or not.
95  bool uncacheable() { return !pte.c; };
96  // Whether or not memory on this page can be executed.
97  bool noExec() { return !pte.x; };
98 
99  // A sequence number to keep track of LRU.
100  uint64_t lruSeq;
101 
102  VegaTlbEntry()
103  : vmid(0), paddr(0), vaddr(0), logBytes(PageShift), pte(), lruSeq(0)
104  {}
105 
106  VegaTlbEntry(Addr _vmid, Addr _vaddr, Addr _paddr, unsigned _logBytes,
107  PageTableEntry _pte)
108  : vmid(_vmid), paddr(_paddr), vaddr(_vaddr), logBytes(_logBytes),
109  pte(_pte), lruSeq(0)
110  {}
111 
112  // Return the page size in bytes
113  Addr size() const
114  {
115  return (static_cast<Addr>(1) << logBytes);
116  }
117 
118  void serialize(CheckpointOut &cp) const override;
119  void unserialize(CheckpointIn &cp) override;
120 };
121 
122 } // namespace VegaISA
123 } // namespace gem5
124 
125 #endif // __ARCH_AMDGPU_VEGA_PAGETABLE_H__
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
Basic support for object serialization.
Definition: serialize.hh:170
EndBitUnion(PageTableEntry) BitUnion64(PageDirectoryEntry) Bitfield< 63
BitUnion64(PageTableEntry) Bitfield< 58
The page table entry is reverse engineered from the macros here:
Bitfield< 5 > r
Definition: pagetable.hh:60
Bitfield< 11, 7 > fragment
Definition: pagetable.hh:58
Bitfield< 1 > s
Definition: pagetable.hh:64
Bitfield< 53, 52 > sw
Definition: pagetable.hh:55
Bitfield< 4 > x
Definition: pagetable.hh:61
Bitfield< 55 > l
Definition: pagetable.hh:54
Bitfield< 47, 12 > ppn
Definition: pagetable.hh:57
const Addr PageShift
Definition: page_size.hh:41
Bitfield< 0 > v
Definition: pagetable.hh:65
Bitfield< 3 > z
Definition: pagetable.hh:62
Bitfield< 2 > c
Definition: pagetable.hh:63
Bitfield< 6 > w
Definition: pagetable.hh:59
Bitfield< 51 > t
Definition: pagetable.hh:56
Bitfield< 56 > f
Definition: pagetable.hh:53
Bitfield< 47, 6 > baseAddr
Definition: pagetable.hh:71
Bitfield< 54 > p
Definition: pagetable.hh:70
Bitfield< 12 > writable
Definition: misc.hh:1001
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
std::ostream CheckpointOut
Definition: serialize.hh:66
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
void unserialize(ThreadContext &tc, CheckpointIn &cp)
void serialize(const ThreadContext &tc, CheckpointOut &cp)
Thread context serialization helpers.

Generated on Wed Dec 21 2022 10:22:24 for gem5 by doxygen 1.9.1