Hi All,

In AARCH64 MMU configuration code, sharable attribute will be set to inner sharable when memory attribute is write back. However, I have 2 questions about this code: 1. Why is it set to inner sharable only when memory attribute is write back? Either write through or uncached will use non-shareable for TCR. 2. All memory regions will be set to none shareable in AARCH64 MMU configuration code, whatever cachable attribute they have (WB, WT or UC). In my opinion, TCR attribute should be kept consistent with the memory where translation tables are located, i.e. TCR_SH_NON_SHAREABLE will always be the proper attribute for TCR.

So could you help to confirm whether there is anything wrong with the code?

Thanks.

ArmPkg/Library/ArmLib/AArch64/AArch64Mmu.c


if ((TranslationTableAttribute == ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBUFFERED) || (TranslationTableAttribute == ARM_MEMORY_REGION_ATTRIBUTE_NONSECURE_UNCACHED_UNBUFFERED)) { TCR |= TCR_SH_NON_SHAREABLE | TCR_RGN_OUTER_NON_CACHEABLE | TCR_RGN_INNER_NON_CACHEABLE; } else if ((TranslationTableAttribute == ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK) || (TranslationTableAttribute == ARM_MEMORY_REGION_ATTRIBUTE_NONSECURE_WRITE_BACK)) {

++ TCR |= **TCR_SH_INNER_SHAREABLE** | TCR_RGN_OUTER_WRITE_BACK_ALLOC | TCR_RGN_INNER_WRITE_BACK_ALLOC;


} else if ((TranslationTableAttribute == ARM_MEMORY_REGION_ATTRIBUTE_WRITE_THROUGH) || (TranslationTableAttribute == ARM_MEMORY_REGION_ATTRIBUTE_NONSECURE_WRITE_THROUGH)) { TCR |= TCR_SH_NON_SHAREABLE | TCR_RGN_OUTER_WRITE_THROUGH | TCR_RGN_INNER_WRITE_THROUGH;

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to