1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-09 21:51:45 +00:00

exo: disable untranslated gpu accesses on mariko

This commit is contained in:
Michael Scire 2020-11-15 00:45:41 -08:00
parent 3c595994df
commit ee3a7e7740
3 changed files with 19 additions and 0 deletions

View file

@ -814,6 +814,16 @@ namespace ams::secmon {
reg::Read(MC + MC_IRAM_REG_CTRL);
}
void DisableUntranslatedDeviceMemoryAccess() {
/* If we can (mariko only), disable GMMU accesses that bypass the SMMU. */
/* Additionally, force all untranslated acccesses to hit one of the carveouts. */
if (GetSocType() == fuse::SocType_Mariko) {
reg::Write(MC + MC_UNTRANSLATED_REGION_CHECK, MC_REG_BITS_ENUM(UNTRANSLATED_REGION_CHECK_UNTRANSLATED_REGION_CHECK_ACCESS, DISABLED),
MC_REG_BITS_ENUM(UNTRANSLATED_REGION_CHECK_REQUIRE_UNTRANSLATED_CLIENTS_HIT_CARVEOUT, ENABLED),
MC_REG_BITS_ENUM(UNTRANSLATED_REGION_CHECK_REQUIRE_UNTRANSLATED_GPU_HIT_CARVEOUT, ENABLED));
}
}
void FinalizeCarveoutSecureScratchRegisters() {
/* Define carveout scratch values. */
constexpr uintptr_t WarmbootCarveoutAddress = MemoryRegionDram.GetAddress();
@ -1145,6 +1155,9 @@ namespace ams::secmon {
/* Disable the ARC. */
DisableArc();
/* Disable untranslated memory accesses by devices. */
DisableUntranslatedDeviceMemoryAccess();
/* Further protections aren't applied on <= 1.0.0. */
if (GetTargetFirmware() <= TargetFirmware_1_0_0) {
return;

View file

@ -103,4 +103,6 @@ namespace ams::diag {
warmboot::ExceptionHandler();
}
#include <exosphere/diag/diag_detailed_assertion_impl.inc>
}

View file

@ -163,6 +163,7 @@
#define MC_EMEM_ARB_TIMING_CCDMW (0x6C4)
#define MC_EMEM_ARB_REFPB_HP_CTRL (0x6F0)
#define MC_EMEM_ARB_REFPB_BANK_CTRL (0x6F4)
#define MC_UNTRANSLATED_REGION_CHECK (0x948)
#define MC_PTSA_GRANT_DECREMENT (0x960)
#define MC_CLIENT_HOTRESET_CTRL_1 (0x970)
#define MC_CLIENT_HOTRESET_STATUS_1 (0x974)
@ -553,3 +554,6 @@ DEFINE_MC_REG(IRAM_TOM_IRAM_TOM, 12, BITSIZEOF(u32) - 12);
DEFINE_MC_REG_BIT_ENUM(IRAM_REG_CTRL_IRAM_CFG_WRITE_ACCESS, 0, ENABLED, DISABLED);
DEFINE_MC_REG_BIT_ENUM(UNTRANSLATED_REGION_CHECK_UNTRANSLATED_REGION_CHECK_ACCESS, 0, ENABLED, DISABLED);
DEFINE_MC_REG_BIT_ENUM(UNTRANSLATED_REGION_CHECK_REQUIRE_UNTRANSLATED_CLIENTS_HIT_CARVEOUT, 8, DISABLED, ENABLED);
DEFINE_MC_REG_BIT_ENUM(UNTRANSLATED_REGION_CHECK_REQUIRE_UNTRANSLATED_GPU_HIT_CARVEOUT, 9, DISABLED, ENABLED);