From a0c57256cc020ead59173cc4ee97bff20c3091de Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Mon, 25 Oct 2021 22:54:03 +0100 Subject: [PATCH] Hookup FlatMemoryManager for SMMU into SoC The SMMU is used to control the mappings of peripherals such as the VIC and NVDEC. --- app/CMakeLists.txt | 1 + app/src/main/cpp/skyline/soc.h | 4 +++- app/src/main/cpp/skyline/soc/smmu.cpp | 10 ++++++++++ app/src/main/cpp/skyline/soc/smmu.h | 16 ++++++++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 app/src/main/cpp/skyline/soc/smmu.cpp create mode 100644 app/src/main/cpp/skyline/soc/smmu.h diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 43d02e79..c7d8ca01 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -135,6 +135,7 @@ add_library(skyline SHARED ${source_DIR}/skyline/gpu/presentation_engine.cpp ${source_DIR}/skyline/gpu/interconnect/command_executor.cpp ${source_DIR}/skyline/gpu/interconnect/command_nodes.cpp + ${source_DIR}/skyline/soc/smmu.cpp ${source_DIR}/skyline/soc/host1x/syncpoint.cpp ${source_DIR}/skyline/soc/gm20b/channel.cpp ${source_DIR}/skyline/soc/gm20b/gpfifo.cpp diff --git a/app/src/main/cpp/skyline/soc.h b/app/src/main/cpp/skyline/soc.h index 32c13d59..be537d11 100644 --- a/app/src/main/cpp/skyline/soc.h +++ b/app/src/main/cpp/skyline/soc.h @@ -3,16 +3,18 @@ #pragma once +#include "soc/smmu.h" #include "soc/host1x.h" #include "soc/gm20b/gpfifo.h" namespace skyline::soc { /** * @brief An interface into all emulated components of the Tegra X1 SoC - * @note Refer to the Tegra X1 Processor Block Diagram (1.2) for more information + * @note Refer to the Tegra X1 Processor Block Diagram (1.2) in the TRM for more information */ class SOC { public: + SMMU smmu; host1x::Host1X host1x; SOC(const DeviceState &state) {} diff --git a/app/src/main/cpp/skyline/soc/smmu.cpp b/app/src/main/cpp/skyline/soc/smmu.cpp new file mode 100644 index 00000000..80015136 --- /dev/null +++ b/app/src/main/cpp/skyline/soc/smmu.cpp @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright © 2021 Skyline Team and Contributors (https://github.com/skyline-emu/) + +#include +#include "smmu.h" + +namespace skyline { + template class FlatAddressSpaceMap; + template class FlatMemoryManager; +} diff --git a/app/src/main/cpp/skyline/soc/smmu.h b/app/src/main/cpp/skyline/soc/smmu.h new file mode 100644 index 00000000..e0ae4e9b --- /dev/null +++ b/app/src/main/cpp/skyline/soc/smmu.h @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright © 2021 Skyline Team and Contributors (https://github.com/skyline-emu/) + +#pragma once + +#include + +namespace skyline::soc { + static constexpr u8 SmmuAddressSpaceBits{32}; //!< The size of the SMMU AS in bits + + /** + * @brief The SMMU (System Memory Management Unit) class handles mapping between the host1x peripheral virtual address space and an application's address space + * @note The SMMU is implemented entirely as a template specialization over FlatMemoryManager + */ + using SMMU = FlatMemoryManager; +}