Sunday, January 22, 2023

Again on the Quartz64 sata

Regarding the Quartz64 topic, last year I investigated an issue with the Quartz64's SATA support[1][2][3]. While the device is sold with SATA support, Linux upstream does not provide it due to minor hardware issues and a lack of development resources. However, a proposed patch can resolve the issue unless specific conditions are present.
When using the device, I found it to be less performant than I had expected. I did not investigate the causes, as my requirements were only for storage. However, when using the device to build kernels, I found it to be too slow.
I decided to update the kernel in hopes of improving performance. Manjaro ships with a fairly new kernel (5.19), but I hoped that version 6.1 would have a positive impact on performance. The Rockchip 3566 and the Quartz64 board have most of the drivers already upstream, so I did not spend time collecting files from a BSP and instead moved forward to build a new kernel.
To do this, I used the configuration that Manjaro used to build their kernel as a base. However, once the kernel was newly built, the SATA stopped working.
After investigating the kernel log, I found that the issue began with a commit that removed compatibility for the DWC AHCI SATA driver with Synopsys AHCI SATA devices[4]. I then noticed that the SATA controller for the Quartz64 is compatible with Synopsys AHCI SATA drivers.
I applied a patch[5] to restore the Quartz64's functionality as it was before. However, I then questioned why this change was made and concluded that perhaps the Manjaro team missed something.
I hypothesized that the presence of the SATA controller driver in the Manjaro kernel was not related to the onboard SATA controller on the Quartz64. To test this, I enabled the CONFIG_AHCI_DWC (Synopsys DWC AHCI SATA) support and found that the SATA subsystem not only performed better but also made the previous patch obsolete.



[1]. http://carminatialessandro.blogspot.com/2022/09/use-quartz64-sata-controller.html
[2]. http://lists.infradead.org/pipermail/linux-arm-kernel/2022-September/775209.html
[3]. https://gist.github.com/alessandrocarminati/e4f6f7b2871957b939cab0f4eeaa97f7
[4]. https://github.com/torvalds/linux/commit/33629d35090f5ce2b1b4ce78aa39954c603536d5
[5]. https://gist.github.com/alessandrocarminati/34df822565fdad0b6c057e3b6d639403