Add "no-reset" DT property to optionally avoid resetting the SEC#3131
Add "no-reset" DT property to optionally avoid resetting the SEC#3131Brandon-Hurst wants to merge 2 commits intoanalogdevicesinc:adsp-6.12.0-yfrom
Conversation
be36c9c to
9f9dc23
Compare
|
Willing to document this if there's a good place -- let me know :) I'm aware of this spot but doesn't seem like there's much DT documentation there just yet: |
9f9dc23 to
214abab
Compare
nunojsa
left a comment
There was a problem hiding this comment.
Some comments from me...
Documentation/devicetree/bindings/soc/adi/adi,system-event-controller.yaml
Show resolved
Hide resolved
| ADI_SEC_REG_CCTL_BASE + (cores + | ||
| 1) * | ||
| ADI_SEC_CCTL_SIZE); | ||
| if (!(of_property_read_bool(np, "no-reset"))) { |
There was a problem hiding this comment.
I wonder if there's any way to check the SHARC status so that we don't need a new property?
There was a problem hiding this comment.
I'm not sure if there's a way to do this that could easily cut across SC-58X, SC-59X, etc.
For the SC589, the HRM does give a bit in the RCU_MSG register that indicates the SEC has been initialized already:

https://www.analog.com/media/en/dsp-documentation/processor-manuals/SC58x-2158x-hrm.pdf
Pg. 234 / 6-17
Also, the SEC Core Interfaces do respectively have some enable bits in the SEC_CCTL ("SCI Control") registers for each core:

Pg 271 / 7-26
I'm not generally aware of how the hardware looks on the other SHARC cores, perhaps there is a portable solution that can be unified.
I see some benefit in having something in the bindings files (e.g. a DT property) in that it at least offers a bit of a general warning about shared resources...this bug took many months to identify, and one of the things that helped was looking back to older kernels and seeing they had a kernel CLI option for this. I consider a DT prop to be similarly informative. There are certainly more places where problems like this can creep in, and this fix doesn't attempt to account for all of them. But the indication in this case was helpful since the SEC is a critical system resource.
I could see the below as a solution. Let me know if this makes sense and I'll give it a build/test.
Disclosure: I had an LLM look through the PDF to find the register fields and recommend a solution. The only thing that seems not real here is the RCU0_MSG_SECINIT field, which would need to be defined.
include/linux/soc/adi/rcu.h
/* Bit values for the RCU0_MSG register */
//...
#define RCU0_MSG_C1ACTIVATE 0x00080000 /* Core 1 Activated */
#define RCU0_MSG_C2ACTIVATE 0x00100000 /* Core 2 Activated */
#define RCU0_MSG_SECINIT 0x00200000 /* SEC Initialized */drivers/soc/adi/mach-sc5xx/sec.c
/* Check the SHARC cores & SEC for early runtime activity */
u32 rcu_msg = adi_rcu_readl(adi_rcu, ADI_RCU_REG_MSG);
bool sharc_active = (rcu_msg & (RCU0_MSG_C1ACTIVATE | RCU0_MSG_C2ACTIVATE)) != 0;
bool sec_initialized = (rcu_msg & RCU0_MSG_SECINIT) != 0;
/* Reset the SEC if the ARM core is first to boot */
if (!(sharc_active || sec_initialized)) {
dev_info(dev, "SHARC cores active, skipping SEC reset\n");
}
else {
/* Reset the SEC */
//...
}There was a problem hiding this comment.
This is really a hack for an unsupported use case, but better to keep the hack in tree than e-mail a patch to a customer. This will never go upstream so the commit message should include a [ADI] prefix.
There was a problem hiding this comment.
Disclosure: I had an LLM look through the PDF to find the register fields and recommend a solution. The only thing that seems not real here is the RCU0_MSG_SECINIT field, which would need to be defined.
Well, if we have a reliable way of detect that the core is up and running and we do not want/should reset it, it should be a viable upstream patch. I mean, if there's a real usecase for it...
I see some benefit in having something in the bindings files (e.g. a DT property) in that it at least offers a bit of a general warning about shared resources...
However, as a DT property might be harder to sell. DT is about HW descriptions and this looks like policy/config. However the line is thin and it could be acceptable if there's no other reliable way to detect this during early boot (and again, there are real usecases for it).
In cases where the SHARC cores absolutely must be booted before ARM Linux, applications utilizing ADI's SHARC FreeRTOS image will crash if the SEC is reset due to using the SEC for the rescheduler interrupt. This is due to a silicon anomaly that prevents utilizing SHARC core-level interrupts instead of the SEC. Therefore, an optional DT property is added to the SEC driver which allows NOT resetting the SEC in the event that an RTOS-based application is running prior to ARM Linux booting. - Add boolean "no-reset" property to DT bindings for ADI SEC driver - Add condition check to NOT reset the SEC if "no-reset" is set in DT Signed-off-by: Brandon Hurst <brandon.hurst97@gmail.com> Signed-off-by: Brandon Hurst <brandon.hurst97@gmail.com>
Add optional boolean "no-reset" property to System Event Controller driver to allow not resetting the SEC in systems where the SHARC cores are initialized before the ARM core. - Add "no-reset" proprty to adi,system-event-controller.yaml Signed-off-by: Brandon Hurst <brandon.hurst97@gmail.com>
214abab to
7388241
Compare
|
Unfortunately, some warnings to not fail CI/CD, but should still get fixed: https://github.com/analogdevicesinc/linux/actions/runs/22081840180/job/63808472717?pr=3131#step:7:25 And the Signed-off-by and author e-mail should be analog.com |
| description: Number of SHARC cores available | ||
|
|
||
| "no-reset": | ||
| description: Prevents resetting the SEC to preserve SHARC interrupts |
There was a problem hiding this comment.
| description: Prevents resetting the SEC to preserve SHARC interrupts | |
| description: Prevents resetting the SEC to preserve SHARC interrupts if Linux boots after the SHARC cores are booted. This is not an officially supported boot flow and other system issues may occur |
Something along those lines
PR Description
This is a carryover of PR 32 on the lnxdsp-linux repo: analogdevicesinc/lnxdsp-linux#32
In cases where the SHARC cores absolutely must be booted before ARM Linux, applications utilizing ADI's SHARC FreeRTOS image will crash if the SEC is reset due to using a System Event Controller (SEC) soft interrupt to drive the rescheduler. This is due to a silicon anomaly that prevents utilizing SHARC core-level interrupts instead of the SEC.
Therefore, an optional DT property is added to the SEC driver which allows NOT resetting the SEC in the event that an RTOS-based application is running prior to ARM Linux booting.
Please let me know if there are any specific unmet needs regarding contribution format / CI.
PR Type
PR Checklist