Hi,

On peripheral regions mapped as nGnRE, and by browsing git history, I can only really tell that this mapping exists since first TF-A commit in 2013 (!). 
https://git.trustedfirmware.org/plugins/gitiles/TF-A/trusted-firmware-a/+/4f6ad66ae9fcc8bcb3b0fcee10b7ab1ffcaf1a56/include/aarch64/arch.h#264

I'm a bit nervous about changing this attribute globally which will affect all peripherals mapped as MT_DEVICE.

For the use case you mention, I appreciate you're intending to map a 'normal' memory region e.g. DRAM or SRAM (as opposed to a peripheral MMIO), so I'd be inclined to say you could map this region as MT_NON_CACHEABLE achieving the same purpose?

Regards,
Olivier.




From: Olivier Deprez <Olivier.Deprez@arm.com>
Sent: 13 May 2025 13:42
To: Andrei Stefanescu <andrei.stefanescu@nxp.com>; tf-a@lists.trustedfirmware.org <tf-a@lists.trustedfirmware.org>
Cc: Ghennadi Procopciuc <ghennadi.procopciuc@nxp.com>; Ciprian Marian Costea <ciprianmarian.costea@nxp.com>; Alexandru-Catalin Ionita <alexandru-catalin.ionita@nxp.com>
Subject: Re: Question about memory mapping attributes for MT_DEVICE
 
The email was moderated, re-sending on behalf of Andrei.


From: Andrei Stefanescu <andrei.stefanescu@nxp.com>
Sent: 13 May 2025 12:35
To: tf-a@lists.trustedfirmware.org <tf-a@lists.trustedfirmware.org>
Cc: Ghennadi Procopciuc <ghennadi.procopciuc@nxp.com>; Ciprian Marian Costea <ciprianmarian.costea@nxp.com>; Alexandru-Catalin Ionita <alexandru-catalin.ionita@nxp.com>
Subject: Question about memory mapping attributes for MT_DEVICE
 

Hi,

I noticed that the memory mapping attributes for MT_DEVICE memory are defined to: nGnRE [1]. Why was nGnRE selected instead of nGnRnE?

Platforms which have USE_COHERENT_MEM set to 1 will map the coherent memory area as MT_DEVICE. This area is helpful for cases where a backery lock is shared between cores which have MMU enabled and cores which don’t (whose access is equivalent to nGnRnE). This would generate an access attributes mismatch for the coherent memory area.

Would it be ok to send a patch which changes the ATTR_DEVICE to nGnRnE?

Best regards,
Andrei Stefanescu


[1] -
https://git.trustedfirmware.org/plugins/gitiles/TF-A/trusted-firmware-a.git/+/refs/heads/master/include/lib/xlat_tables/xlat_tables_defs.h#152