s32g3 kernel configuration item clarification.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

s32g3 kernel configuration item clarification.

1,093 Views
acarmina
Contributor I

During the process of enabling the S32G3 in our Linux environment, I encountered the following configuration within the BSP:

CONFIG_CMA_SIZE_MBYTES=256

I noticed that if this option is not specified, the system fails to boot.

I investigated the issue and found that no code appears to be utilizing the Contiguous Memory Allocator (CMA) subsystem. However, the system still fails to boot without the option set.

Upon further investigation, I surmised that the CMA configuration itself might not be the critical factor, but rather that the kernel is attempting to use the 256MB memory region starting at 0xf0000000. I was able to successfully run the kernel by explicitly reserving this memory region in the Device Tree with the following entry:

DummyUnknown: memory@f0000000 {
        compatible = "reserved-memory";
        reg = <0x0 0xf0000000 0x0 0x010000000>;
        no-map;
};

While this allows me to proceed without knowing the precise cause, I noted that when using the BSP firmware (ATF + U-Boot) with EFIBOOT, the kernel again fails to boot. Looking at U-Boot's memory usage, I discovered that EFI variables and SMI data are situated in this region at 0xfa000000, which leads me to believe this is one of the reasons for the unsuccessful boot.

By trying to restrict the reservation, I was able to narrow the required memory area to a 16MB region starting at 0xfb000000, which also allows the kernel to run successfully in EFI mode.

I've conducted various experiments on this area and established that its relevance is only during early boot, where failing to reserve it leads to a silent kernel hang. Before or after the kernel has fully started, the area can be overwritten by any data without visible consequences.

I have analyzed both the ATF and U-Boot BSP codebases without finding any explicit reference to this critical area.

Since my use case is aimed at the functional safety domain, and the underlying reasons behind this malfunction are not yet fully understood, I am requesting clarification on the original CONFIG_CMA_SIZE_MBYTES=256 statement in the kernel configuration and how it relates to my findings.

Tags (4)
0 Kudos
Reply
3 Replies

1,054 Views
acarmina
Contributor I

the current firmware is bsp41, (atf+u-boot).
i'm trying to switch to the bsp44, but I'm having troubles since the bl2 to the bl31 hangs on the eret, when it run the new imagenot sure why, currently under investigation.
```
NOTICE:  Reset status: Power-On Reset
INFO:    Switch to 50 MHz SD frequency (High Speed Mode)
INFO:    BL2: FIP offset = 0x100000
NOTICE:  BL2: v2.10.14(debug):bsp44.0-2.10.14
NOTICE:  BL2: Built : 11:58:50, Oct 17 2025
INFO:    BL2: Loading image id 39
VERBOSE: FIP header looks OK.
INFO:    Loading image id=39 at address 0x343ec000
INFO:    Image id=39 loaded: 0x343ec000 - 0x343fe570
INFO:    BL2: Loading image id 3
VERBOSE: FIP header looks OK.
INFO:    Loading image id=3 at address 0xff600000
INFO:    Image id=3 loaded: 0xff600000 - 0xff647065
INFO:    BL2: Loading image id 5
VERBOSE: FIP header looks OK.
INFO:    Loading image id=5 at address 0xff8a0000
INFO:    Image id=5 loaded: 0xff8a0000 - 0xff970168
NOTICE:  BL2: Booting BL31
INFO:    Entry point address = 0xff600000
INFO:    SPSR = 0x3cd
VERBOSE: Argument #0 = 0x34339418
VERBOSE: Argument #1 = 0x0
VERBOSE: Argument #2 = 0x0
VERBOSE: Argument #3 = 0x0
VERBOSE: Argument #4 = 0x0
VERBOSE: Argument #5 = 0x0
VERBOSE: Argument #6 = 0x0
VERBOSE: Argument #7 = 0x0
```

0 Kudos
Reply

991 Views
Joey_z
NXP Employee
NXP Employee

hi,acarmina

Thank you for your reply.

The kernel allows the creation of default CMA through Kconfig, kernel parameters, and DT. Once created successfully, a chunk of contiguous physical memory will be reserved and not participate in the general allocation, thereby avoiding early stampedes.
Under your EFI path, the EFI subsystem of U-Boot places EFI variables /SMI and other structures in the 0xFA000000 area. If Linux considers this piece available without seeing any reserved tags, it may overwrite these structures, leading to an early silent freeze.

BR

Joey

0 Kudos
Reply

1,060 Views
Joey_z
NXP Employee
NXP Employee

hi,acarmina

Thank you for contacting us and the information.

Which the version of BSP are you using?

BR

Joey

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2188109%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3Es32g3%20kernel%20configuration%20item%20clarification.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2188109%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EDuring%20the%20process%20of%20enabling%20the%20S32G3%20in%20our%20Linux%20environment%2C%20I%20encountered%20the%20following%20configuration%20within%20the%20BSP%3A%3C%2FP%3E%3CDIV%20class%3D%22%22%3ECONFIG_CMA_SIZE_MBYTES%3D256%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FDIV%3E%3CP%3EI%20noticed%20that%20if%20this%20option%20is%20%3CSTRONG%3Enot%20specified%2C%20the%20system%20fails%20to%20boot%3C%2FSTRONG%3E.%3C%2FP%3E%3CP%3EI%20investigated%20the%20issue%20and%20found%20that%20no%20code%20appears%20to%20be%20utilizing%20the%20Contiguous%20Memory%20Allocator%20(%3CSTRONG%3ECMA%3C%2FSTRONG%3E)%20subsystem.%20However%2C%20the%20system%20still%20fails%20to%20boot%20without%20the%20option%20set.%3C%2FP%3E%3CP%3EUpon%20further%20investigation%2C%20I%20surmised%20that%20the%20CMA%20configuration%20itself%20might%20not%20be%20the%20critical%20factor%2C%20but%20rather%20that%20the%20kernel%20is%20attempting%20to%20use%20the%20%3CSPAN%20class%3D%22%22%3E256MB%3C%2FSPAN%3E%26nbsp%3Bmemory%20region%20starting%20at%20%3CSPAN%20class%3D%22%22%3E0xf0000000.%3C%2FSPAN%3E%26nbsp%3BI%20was%20able%20to%20successfully%20run%20the%20kernel%20by%20explicitly%20reserving%20this%20memory%20region%20in%20the%20Device%20Tree%20with%20the%20following%20entry%3A%3C%2FP%3E%3CDIV%20class%3D%22%22%3E%3CDIV%20class%3D%22%22%3E%3CDIV%20class%3D%22%22%3E%3CPRE%3EDummyUnknown%3A%20memory%40f0000000%20%7B%0A%20%20%20%20%20%20%20%20compatible%20%3D%20%22reserved-memory%22%3B%0A%20%20%20%20%20%20%20%20reg%20%3D%20%26lt%3B0x0%200xf0000000%200x0%200x010000000%26gt%3B%3B%0A%20%20%20%20%20%20%20%20no-map%3B%0A%7D%3B%3C%2FPRE%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3CP%3EWhile%20this%20allows%20me%20to%20proceed%20without%20knowing%20the%20precise%20cause%2C%20I%20noted%20that%20when%20using%20the%20BSP%20firmware%20(ATF%20%2B%20U-Boot)%20with%20EFIBOOT%2C%20the%20kernel%20again%20fails%20to%20boot.%20Looking%20at%20U-Boot's%20memory%20usage%2C%20I%20discovered%20that%20EFI%20variables%20and%20SMI%20data%20are%20situated%20in%20this%20region%20at%20%3CSPAN%20class%3D%22%22%3E0xfa000000%3C%2FSPAN%3E%2C%20which%20leads%20me%20to%20believe%20this%20is%20one%20of%20the%20reasons%20for%20the%20unsuccessful%20boot.%3C%2FP%3E%3CP%3EBy%20trying%20to%20restrict%20the%20reservation%2C%20I%20was%20able%20to%20narrow%20the%20required%20memory%20area%20to%20a%20%3CSPAN%20class%3D%22%22%3E16MB%3C%2FSPAN%3E%26nbsp%3Bregion%20starting%20at%20%3CSPAN%20class%3D%22%22%3E0xfb000000%3C%2FSPAN%3E%2C%20which%20also%20allows%20the%20kernel%20to%20run%20successfully%20in%20EFI%20mode.%3C%2FP%3E%3CP%3EI've%20conducted%20various%20experiments%20on%20this%20area%20and%20established%20that%20its%20relevance%20is%20only%20during%20early%20boot%2C%20where%20failing%20to%20reserve%20it%20leads%20to%20a%20silent%20kernel%20hang.%20Before%20or%20after%20the%20kernel%20has%20fully%20started%2C%20the%20area%20can%20be%20overwritten%20by%20any%20data%20without%20visible%20consequences.%3C%2FP%3E%3CP%3EI%20have%20analyzed%20both%20the%20ATF%20and%20U-Boot%20BSP%20codebases%20without%20finding%20any%20explicit%20reference%20to%20this%20critical%20area.%3C%2FP%3E%3CP%3ESince%20my%20use%20case%20is%20aimed%20at%20the%20functional%20safety%20domain%2C%20and%20the%20underlying%20reasons%20behind%20this%20malfunction%20are%20not%20yet%20fully%20understood%2C%20I%20am%20requesting%20clarification%20on%20the%20original%20%3CSPAN%20class%3D%22%22%3ECONFIG_CMA_SIZE_MBYTES%3D256%3C%2FSPAN%3E%26nbsp%3Bstatement%20in%20the%20kernel%20configuration%20and%20how%20it%20relates%20to%20my%20findings.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2188821%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20s32g3%20kernel%20configuration%20item%20clarification.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2188821%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3Ehi%2C%3CSPAN%3Eacarmina%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EThank%20you%20for%20your%20reply.%3C%2FP%3E%0A%3CP%3EThe%20kernel%20allows%20the%20creation%20of%20default%20CMA%20through%20Kconfig%2C%20kernel%20parameters%2C%20and%20DT.%20Once%20created%20successfully%2C%20a%20chunk%20of%20contiguous%20physical%20memory%20will%20be%20reserved%20and%20not%20participate%20in%20the%20general%20allocation%2C%20thereby%20avoiding%20early%20stampedes.%3CBR%20%2F%3EUnder%20your%20EFI%20path%2C%20the%20EFI%20subsystem%20of%20U-Boot%20places%20EFI%20variables%20%2FSMI%20and%20other%20structures%20in%20the%200xFA000000%20area.%20If%20Linux%20considers%20this%20piece%20available%20without%20seeing%20any%20reserved%20tags%2C%20it%20may%20overwrite%20these%20structures%2C%20leading%20to%20an%20early%20silent%20freeze.%3C%2FP%3E%0A%3CP%3EBR%3C%2FP%3E%0A%3CP%3EJoey%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2188425%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20s32g3%20kernel%20configuration%20item%20clarification.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2188425%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3Ethe%20current%20firmware%20is%20bsp41%2C%20(atf%2Bu-boot).%3CBR%20%2F%3Ei'm%20trying%20to%20switch%20to%20the%20bsp44%2C%20but%20I'm%20having%20troubles%20since%20the%20bl2%20to%20the%20bl31%20hangs%20on%20the%20eret%2C%20when%20it%20run%20the%20new%20imagenot%20sure%20why%2C%20currently%20under%20investigation.%3CBR%20%2F%3E%60%60%60%3CBR%20%2F%3E%3CSPAN%3ENOTICE%3A%20%26nbsp%3BReset%20status%3A%20Power-On%20Reset%3CBR%20%2F%3EINFO%3A%20%26nbsp%3B%26nbsp%3B%26nbsp%3BSwitch%20to%2050%20MHz%20SD%20frequency%20(High%20Speed%20Mode)%3CBR%20%2F%3EINFO%3A%20%26nbsp%3B%26nbsp%3B%26nbsp%3BBL2%3A%20FIP%20offset%20%3D%200x100000%3CBR%20%2F%3ENOTICE%3A%20%26nbsp%3BBL2%3A%20v2.10.14(debug)%3Absp44.0-2.10.14%3CBR%20%2F%3ENOTICE%3A%20%26nbsp%3BBL2%3A%20Built%20%3A%2011%3A58%3A50%2C%20Oct%2017%202025%3CBR%20%2F%3EINFO%3A%20%26nbsp%3B%26nbsp%3B%26nbsp%3BBL2%3A%20Loading%20image%20id%2039%3CBR%20%2F%3EVERBOSE%3A%20FIP%20header%20looks%20OK.%3CBR%20%2F%3EINFO%3A%20%26nbsp%3B%26nbsp%3B%26nbsp%3BLoading%20image%20id%3D39%20at%20address%200x343ec000%3CBR%20%2F%3EINFO%3A%20%26nbsp%3B%26nbsp%3B%26nbsp%3BImage%20id%3D39%20loaded%3A%200x343ec000%20-%200x343fe570%3CBR%20%2F%3EINFO%3A%20%26nbsp%3B%26nbsp%3B%26nbsp%3BBL2%3A%20Loading%20image%20id%203%3CBR%20%2F%3EVERBOSE%3A%20FIP%20header%20looks%20OK.%3CBR%20%2F%3EINFO%3A%20%26nbsp%3B%26nbsp%3B%26nbsp%3BLoading%20image%20id%3D3%20at%20address%200xff600000%3CBR%20%2F%3EINFO%3A%20%26nbsp%3B%26nbsp%3B%26nbsp%3BImage%20id%3D3%20loaded%3A%200xff600000%20-%200xff647065%3CBR%20%2F%3EINFO%3A%20%26nbsp%3B%26nbsp%3B%26nbsp%3BBL2%3A%20Loading%20image%20id%205%3CBR%20%2F%3EVERBOSE%3A%20FIP%20header%20looks%20OK.%3CBR%20%2F%3EINFO%3A%20%26nbsp%3B%26nbsp%3B%26nbsp%3BLoading%20image%20id%3D5%20at%20address%200xff8a0000%3CBR%20%2F%3EINFO%3A%20%26nbsp%3B%26nbsp%3B%26nbsp%3BImage%20id%3D5%20loaded%3A%200xff8a0000%20-%200xff970168%3CBR%20%2F%3ENOTICE%3A%20%26nbsp%3BBL2%3A%20Booting%20BL31%3CBR%20%2F%3EINFO%3A%20%26nbsp%3B%26nbsp%3B%26nbsp%3BEntry%20point%20address%20%3D%200xff600000%3CBR%20%2F%3EINFO%3A%20%26nbsp%3B%26nbsp%3B%26nbsp%3BSPSR%20%3D%200x3cd%3CBR%20%2F%3EVERBOSE%3A%20Argument%20%230%20%3D%200x34339418%3CBR%20%2F%3EVERBOSE%3A%20Argument%20%231%20%3D%200x0%3CBR%20%2F%3EVERBOSE%3A%20Argument%20%232%20%3D%200x0%3CBR%20%2F%3EVERBOSE%3A%20Argument%20%233%20%3D%200x0%3CBR%20%2F%3EVERBOSE%3A%20Argument%20%234%20%3D%200x0%3CBR%20%2F%3EVERBOSE%3A%20Argument%20%235%20%3D%200x0%3CBR%20%2F%3EVERBOSE%3A%20Argument%20%236%20%3D%200x0%3CBR%20%2F%3EVERBOSE%3A%20Argument%20%237%20%3D%200x0%3CBR%20%2F%3E%3C%2FSPAN%3E%60%60%60%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2188368%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20s32g3%20kernel%20configuration%20item%20clarification.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2188368%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3Ehi%2C%3CSPAN%3Eacarmina%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EThank%20you%20for%20contacting%20us%20and%20the%20information.%3C%2FP%3E%0A%3CP%3EWhich%20the%20version%20of%20BSP%20are%20you%20using%3F%3C%2FP%3E%0A%3CP%3EBR%3C%2FP%3E%0A%3CP%3EJoey%3C%2FP%3E%3C%2FLINGO-BODY%3E