Page MenuHomeFreeBSD

Patch to disable WFI on aml8726-m3
ClosedPublic

Authored by john-feith.com on May 7 2015, 5:11 PM.
Tags
Referenced Files
Unknown Object (File)
Fri, Nov 15, 6:43 AM
Unknown Object (File)
Fri, Nov 1, 2:32 PM
Unknown Object (File)
Fri, Nov 1, 2:32 PM
Unknown Object (File)
Oct 3 2024, 12:06 AM
Unknown Object (File)
Sep 18 2024, 11:31 AM
Unknown Object (File)
Sep 18 2024, 2:07 AM
Unknown Object (File)
Sep 17 2024, 12:30 AM
Unknown Object (File)
Aug 18 2024, 1:41 PM
Subscribers

Details

Reviewers
ganbold
Summary

My YYHD18 (aml8726-m3 SoC identified as a Cortex A9-r2 rev 4 CPU)
hangs randomly during boot if WFI is used by the kernel.

My ATV102 (aml8726-m6 SoC identified as a Cortex A9-r3 rev 0 CPU)
has no problems booting / running FreeBSD using the same kernel
with or without WFI.

WFI is used by the armv7 cpu_sleep function. cpufunc.c contains:

/* 1 == use cpu_sleep(), 0 == don't */
int cpu_do_powersave;

however, it doesn't appear that the value is actually tested anywhere.

This patch adds a test for cpu_do_powersave to the cpu_sleep macro and
updates the Amlogic startup code so that cpu_do_powersave is cleared
when an aml8726-m3 is encountered.

Test Plan

Tested on YYHD18 (aml8726-m3 SoC), VSATV102-M6 (aml8726-m6 SoC) and
ODROID-C1 (aml8726-m8b SoC).

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

john-feith.com retitled this revision from to Patch to disable WFI on aml8726-m3.
john-feith.com updated this object.
john-feith.com edited the test plan for this revision. (Show Details)
john-feith.com added a reviewer: ganbold.
john-feith.com set the repository for this revision to rS FreeBSD src repository - subversion.
john-feith.com added a project: ARM.

I'm not really sure about this change. Can we find the reason why WFI is causing boot hang in your case?
I talked to ian@ regarding this and it could be that we are not handling some cortex-a9 related errata.

The change merely wires up a feature that the comments in cpufunc.c
claim already exists ... though currently cpu_do_powersave don't seem
to do anything useful.

I considered that this may be a cortex-a9 related errata and started
by mucking locore-v6.S to apply the workarounds for ARM Cortex-A9
errata 742230, 742231, 743622, and 751472 (I lifted the code from
Linux) ... however that didn't fix the problem.

It is interesting that Cortex A9-r3 rev 0 works and Cortex A9-r2 rev 4
doesn't, unfortunately I don't have access to the official ARM errata
documentation so I'm not clear how to continue to troubleshoot this.

I'm open to ideas as I'd like to have WFI working, however disabling
it in the case of the aml8726-m3 seems to be a reasonable solution
for the moment.

I'm not sure I'd call this a feature so much as a stale comment left over from netbsd code import 10-12 years ago. I'd rather delete the comment and the unused variable and not give anyone the impression that wfi is optional.

On the practical side, it's nice to have a system that works while you debug the problem. I wonder if a reasonable one-platform workaround for broken wfi would be to set cpufuncs.cf_sleep = (void*)cpufunc_nullop in your platform_late_init() routine until we figure out the problem? late_init() gets called well before interrupts are enabled and sleeping could happen.

john-feith.com edited edge metadata.

Directly set cpufuncs.cf_sleep rather than using cpu_do_powersave.

ganbold edited edge metadata.
This revision is now accepted and ready to land.May 12 2015, 8:51 AM