-
Notifications
You must be signed in to change notification settings - Fork 54
[linux-nvidia-6.17] arm64: Add workaround to convert MT_NORMAL_NC to Device-nGnRE #288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 24.04_linux-nvidia-6.17-next
Are you sure you want to change the base?
[linux-nvidia-6.17] arm64: Add workaround to convert MT_NORMAL_NC to Device-nGnRE #288
Conversation
nirmoy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Acked-by: Nirmoy Das <nirmoyd@nvidia.com>
clsotog
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Acked-by: Carol L Soto <csoto@nvidia.com>
…evice-nGnRE
Add CONFIG_ARM64_WORKAROUND_NC_TO_NGNRE configuration option that
enables conversion of MT_NORMAL_NC (Normal Non-Cacheable) memory
attribute to Device-nGnRE memory type in MAIR_EL1 for hardware that
requires stricter memory ordering or has issues with Non-Cacheable
memory mappings.
Key changes:
1. New memory type MT_NORMAL_NC_DMA (Attr5):
- Introduced specifically for DMA coherent memory mappings
- Configured with the same Normal Non-Cacheable attribute (0x44)
as MT_NORMAL_NC (Attr2) by default
- pgprot_dmacoherent uses MT_NORMAL_NC_DMA when workaround is
enabled, MT_NORMAL_NC otherwise
2. MAIR_EL1 conversion via alternatives framework:
- arch/arm64/mm/proc.S uses ARM64 alternatives to patch MAIR_EL1
during early boot
- Converts MT_NORMAL_NC (Attr2) from 0x44 to 0x04 (Device-nGnRE)
using efficient bfi instruction
- MT_NORMAL_NC_DMA (Attr5) keeps the same attribute value as
MT_NORMAL_NC originally had
- Zero performance overhead when workaround is disabled
3. Boot-time configuration:
- Enabled via kernel command line: mair_el1_nc_to_ngnre=1
- Boot CPU fixup in enable_nc_to_ngnre() applies conversion before
alternatives are patched
- Secondary CPUs automatically use patched alternatives in
__cpu_setup
- Runtime changes not supported as alternatives cannot be
re-patched after boot
4. Errata framework integration:
- Registered in arm64_errata[] array as ARM64_WORKAROUND_NC_TO_NGNRE
- Capability type: ARM64_CPUCAP_BOOT_CPU_FEATURE
- Uses cpucap_is_possible() for build-time capability checking
The workaround preserves pgprot_dmacoherent behavior while allowing
MT_NORMAL_NC to be converted to Device memory type for other mappings
that may be affected by hardware issues. Ensure NC memory attribute
assignment is prevented for passthrough device MMIO regions.
Signed-off-by: Shanker Donthineni <sdonthineni@nvidia.com>
Signed-off-by: Matthew R. Ochs <mochs@nvidia.com>
Enable the workaround to convert MT_NORMAL_NC to Device-nGnRE by setting CONFIG_ARM64_WORKAROUND_NC_TO_NGNRE=y. Signed-off-by: Matthew R. Ochs <mochs@nvidia.com>
b41ae2c to
6c8e70f
Compare
|
|
clsotog
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Acked-by: Carol L Soto <csoto@nvidia.com>
|
|
Add CONFIG_ARM64_WORKAROUND_NC_TO_NGNRE configuration option that
enables conversion of MT_NORMAL_NC (Normal Non-Cacheable) memory
attribute to Device-nGnRE memory type in MAIR_EL1 for hardware that
requires stricter memory ordering or has issues with Non-Cacheable
memory mappings.
Tested kernel parameter enabled and disabled:
LP: https://bugs.launchpad.net/ubuntu/+source/linux-nvidia/+bug/2138952