# Define if the GICv3 controller should use the GICv2 legacy\r
gArmTokenSpaceGuid.PcdArmGicV3WithV2Legacy|FALSE|BOOLEAN|0x00000042\r
\r
+[PcdsFeatureFlag.ARM]\r
+ # Whether to map normal memory as non-shareable. FALSE is the safe choice, but\r
+ # TRUE may be appropriate to fix performance problems if you don't care about\r
+ # hardware coherency (i.e., no virtualization or cache coherent DMA)\r
+ gArmTokenSpaceGuid.PcdNormalMemoryNonshareableOverride|FALSE|BOOLEAN|0x00000043\r
+\r
[PcdsFixedAtBuild.common]\r
gArmTokenSpaceGuid.PcdTrustzoneSupport|FALSE|BOOLEAN|0x00000006\r
\r
break;\r
}\r
\r
+ if (FeaturePcdGet(PcdNormalMemoryNonshareableOverride)) {\r
+ PageAttributes &= ~TT_DESCRIPTOR_PAGE_S_SHARED;\r
+ }\r
+\r
// Check if the Section Entry has already been populated. Otherwise attach a\r
// Level 2 Translation Table to it\r
if (*SectionEntry != 0) {\r
break;\r
}\r
\r
+ if (FeaturePcdGet(PcdNormalMemoryNonshareableOverride)) {\r
+ Attributes &= ~TT_DESCRIPTOR_SECTION_S_SHARED;\r
+ }\r
+\r
// Get the first section entry for this mapping\r
SectionEntry = TRANSLATION_TABLE_ENTRY_FOR_VIRTUAL_ADDRESS(TranslationTable, MemoryRegion->VirtualBase);\r
\r
}\r
\r
if (TTBRAttributes & TTBR_SHAREABLE) {\r
- //\r
- // Unlike the S bit in the short descriptors, which implies inner shareable\r
- // on an implementation that supports two levels, the meaning of the S bit\r
- // in the TTBR depends on the NOS bit, which defaults to Outer Shareable.\r
- // However, we should only set this bit after we have confirmed that the\r
- // implementation supports multiple levels, or else the NOS bit is UNK/SBZP\r
- //\r
- if (((ArmReadIdMmfr0 () >> 12) & 0xf) != 0) {\r
- TTBRAttributes |= TTBR_NOT_OUTER_SHAREABLE;\r
+ if (FeaturePcdGet(PcdNormalMemoryNonshareableOverride)) {\r
+ TTBRAttributes ^= TTBR_SHAREABLE;\r
+ } else {\r
+ //\r
+ // Unlike the S bit in the short descriptors, which implies inner shareable\r
+ // on an implementation that supports two levels, the meaning of the S bit\r
+ // in the TTBR depends on the NOS bit, which defaults to Outer Shareable.\r
+ // However, we should only set this bit after we have confirmed that the\r
+ // implementation supports multiple levels, or else the NOS bit is UNK/SBZP\r
+ //\r
+ if (((ArmReadIdMmfr0 () >> 12) & 0xf) != 0) {\r
+ TTBRAttributes |= TTBR_NOT_OUTER_SHAREABLE;\r
+ }\r
}\r
}\r
\r