[PATCH 0/3] hwspinlock: sun6i: Allwinner D1 and T113 support

Wilken Gottwalt wilken.gottwalt at posteo.net
Thu Oct 22 12:19:54 PDT 2026


On Thu, 22 Oct 2026 22:01:15 +0300
Indrek Kruusa <indrek.kruusa at gmail.com> wrote:

> Hi,
> 
> I managed to run this patch series on a Sipeed Lichee RV Dock (Allwinner D1),
> in this setup:
> 
>   - FreeRTOS on the HiFi4 DSP, running a task that contends for the lock
>   - a test kernel module touching the same shared memory, with and without
>     taking the lock
> 
> The series is applied on top of v7.3-rc7.
> 
> What I ran:
> 
>   - probe: 3005000.hwlock binds and the driver reports 32 locks
> 
>   - mutual exclusion: lock 0, taken alternately by the C906 and the HiFi4.
>     Each side added 1 to a shared counter under the lock, 1,000,000 times:
> 
>       counter=2000000 expected=2000000 -> EXACT
>       tripwire linux=0 dsp=0 -> no overlap
> 
>     A tripwire field is set while inside the critical section and read by the
>     other side, so overlap is caught independently of the counter.
> 
>   - negative control, identical loop with the lock not taken:
> 
>       counter=1885761 expected=2000000 -> LOST UPDATES   (5.7% lost)
>       tripwire linux=100302 dsp=674915 -> OVERLAP DETECTED
> 
> The loss rate in the negative control varies between runs (5-19% observed);
> the log linked below is one sample.
> 
> Tested-by: Indrek Kruusa <indrek.kruusa at gmail.com>
> 
> I put this test setup together with AI assistance. Sources, build
> instructions, ready-to-use images (DSP firmware included) for the RV Dock
> and for the Nezha (untested), and the captured console logs are here:
> 
>   https://github.com/ikruusa/d1-hwspinlock-test

Just out of curiousity, did you also had the impression, that the spinlocks
are quite slow? I did quite similar tests back then using a H5 SoC.

https://lore.kernel.org/lkml/cover.1615713499.git.wilken.gottwalt@posteo.net/T/

greetings,
Wilken



More information about the linux-riscv mailing list