qualcomm/qbox
Loading...
Searching...
No Matches
smmuv3_extensions.h
1/*
2 * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause-Clear
5 */
6
7#ifndef _SMMUV3_EXTENSIONS_H_
8#define _SMMUV3_EXTENSIONS_H_
9
10#include <tlm>
11#include <cstdint>
12
13namespace gs {
14
15// SS = SubStream: an upstream device may tag a transaction with a sub-channel id (similar to a process/address-space
16// tag)
17class smmuv3_ss_extension : public tlm::tlm_extension<smmuv3_ss_extension>
18{
19public:
20 uint32_t substream_id = 0; // Sub-channel id within a stream; selects one Context Descriptor under a given StreamID
21 bool ssv = false; // SSV = SubStream Valid: tells the SMMU that substream_id above is meaningful
22
23 tlm::tlm_extension_base* clone() const override { return new smmuv3_ss_extension(*this); }
24 void copy_from(const tlm::tlm_extension_base& ext) override
25 {
26 const auto& other = static_cast<const smmuv3_ss_extension&>(ext);
27 substream_id = other.substream_id;
28 ssv = other.ssv;
29 }
30};
31
32// ATS = Address Translation Service: an upstream device asks the SMMU to translate an address
33// (and cache the result locally) instead of having the SMMU translate every transaction.
34class smmuv3_ats_extension : public tlm::tlm_extension<smmuv3_ats_extension>
35{
36public:
37 bool is_translation_request = false; // True for an ATS query (translate this VA, do not actually access memory)
38 bool is_translated = false; // True when the upstream device is presenting an already-translated PA
39 uint32_t prg_index = 0; // PRG = Page Request Group: id used to match a page-fault response to its request
40
41 uint64_t pa = 0; // PA = Physical Address: the SMMU fills this in with the translation result
42 uint8_t granule_log2 = 0; // log2 of page size of the result (e.g. 12 = 4 KiB)
43 uint8_t prot = 0; // Read/Write permissions encoded into the IOMMUAccessFlags scheme
44 uint8_t fault_type = 0; // Reason code if the translation failed
45 bool faulted = false; // True if the SMMU could not translate (see fault_type)
46
47 tlm::tlm_extension_base* clone() const override { return new smmuv3_ats_extension(*this); }
48 void copy_from(const tlm::tlm_extension_base& ext) override
49 {
50 const auto& other = static_cast<const smmuv3_ats_extension&>(ext);
51 is_translation_request = other.is_translation_request;
52 is_translated = other.is_translated;
53 prg_index = other.prg_index;
54 pa = other.pa;
55 granule_log2 = other.granule_log2;
56 prot = other.prot;
57 fault_type = other.fault_type;
58 faulted = other.faulted;
59 }
60};
61
62} // namespace gs
63
64#endif
Definition smmuv3_extensions.h:35
Definition smmuv3_extensions.h:18
Tool which reads a Lua configuration file and sets parameters.
Definition biflow.cc:10