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;