Kernel 6.2: More Rust support for drivers
Daniel Almeida
February 21, 2023
A new kernel version is out and, as usual, Collabora's engineers have contributed changes spanning different domains of expertise. With more SoC support, a new V4L2 driver and a new dma-buf locking convention among its contributions, Collabora was one of the most active employers for this latest kernel development cycle.
After basic infrastructure for Rust drivers landed in the previous release, kernel 6.2 brings new changes that continue to improve Rust support. Driver authors notably gained access to the new #[vtable] macro, which makes it easier to both declare and implement structs of function pointers - also known generically as 'ops' - as Rust traits. This macro provides a Trait::HAS_* constant for each of the trait's functions that are set when drivers actually provide a implementation, thus making it easier to set the function pointers accordingly in the C data structures. The rest of the pr_ macros were implemented as well, which now makes it possible to call the likes of pr_err!() and other previously unsupported friends from Rust code, enhancing logging for Rust drivers.
Also noteworthy is the new and shiny 'accel' subsystem, the origins of which have been brewing for quite some time on the kernel mailing lists. The accel subsystem is dedicated to compute accelerators which can either be standalone ASICs or IP blocks within SoCs/GPUs. The accel core code remains inside the DRM subsystem, and accel devices will be a new type of DRM device. This should facilitate the sharing of code and developer expertise between GPUs and compute devices, as well as provide a more uniform interface to common userspace layers such as PyTorch and TensorFlow.
Here is a closer look at Collabora's contributions for this cycle:
SoC Support
Support for RK3588 upstream is ongoing and this cycle has seen clock and reset unit driver patches by Sebastian Reichel, which completes the basic boot support for that chip apart from the initial device-tree support queued for 6.3. This SoC is key for our multimedia upstream work, as Benjamin Gaignard is working on the V4L2 driver support for the AV1 decoder in the chip, bringing the total of drivers using the tentative AV1 stateless uAPI developed by Collabora to two.
As part of the continued improvement of support for MediaTek SoCs, Nícolas F. R. A. Prado fixed the sound card drivers which were not not being automatically loaded as modules on several MediaTek platforms, and fixed devicetree bindings for RT5682 and RT5682s audio codecs. Several configurations were also enabled on the ARM64 defconfig to get full functionality for mt8183-juniper-jacuzzi devices.
AngeloGioacchino Del Regno added initial support for the MediaTek-powered Sony Xperia M5 smartphone. The device now boots under Linux and a serial connection can be established. This is a result of his work to support the device's underlying SoC, the MT6795. By the same token, there's now support for the Sony Xperia X and X Compact smartphones, which use Qualcomm's Snapdragon 650 (MSM8956) chip. Some other notable work by Angelo this cycle includes device tree and clock cleanups for Mediatek devices, some devicetree patches that increase scheduler performance for the MediaTek's MT8195 SoC and L2 cache power management support for the Snapdragon 650 (MSM8956) and Snapdragon 652 (MSM8976) chips.
Cristian Ciocaltea enabled initial support for the StarFive VisionFive V1 SBC, built around the JH7100 SoC, and claimed to be the world's first generation of affordable RISC-V boards designed to run Linux. There is currently no network or SD card support, but these are some areas we are looking to further improve.
Multimedia
The V4L2 subsystem gained a new virtual driver in 6.2: visl is a virtual stateless decoder driver written by Daniel Almeida for the purposes of aiding V4L2 stateless decoding uAPI development. In a nutshell, userspace applications can use visl to run a decoding loop even when no hardware is available or when the kernel uAPI for the codec has not been upstreamed yet. This can reveal bugs at an early stage. One can also use visl to trace the submitted V4L2 controls via ftrace, or to dump the VB2 buffers through debugfs. The driver is capable of producing capture buffers with various debug information printed to it using V4L2's test pattern generator.
DMA-BUF
In the past, there was no locking convention for dma-buf exporters and importers. When both dma-buf exporter and importer drivers decided to acquire the same nested dma-buf reservation lock, a deadlock happened in kernel. The v6.2 got a new dma-buf locking convention, explicitly telling when exporter and importer shall take the lock and when not. The locking convention was added by Dmitry Osipenko, he also moved all the kernel drivers using dma-buf to the new locking convention. This work allows kernel subsystems to start managing dma-buf locking for the drivers, since now the locking rules are strictly specified. The GPU subsystem core code was already prepared in v6.2 to the new locking convention. In the future this will allow all DRM drivers to transition to using a common reservation GEM lock, which is a longstanding item in the GPU subsystem TODO list.
Below is a full list of contributions made by Collaborans for the 6.2 release, as recorded in the git commit history:
Authored (131):
Andrzej Pietrasiewicz (2):
AngeloGioacchino Del Regno (42):
Arnaud Ferraris (1):
Benjamin Gaignard (1):
Cristian Ciocaltea (4):
Daniel Almeida (2):
David Heidelberg (1):
Detlev Casanova (1):
Dmitry Osipenko (33):
Eugen Hristev (1):
Muhammad Usama Anjum (2):
Nícolas F. R. A. Prado (26):
Ricardo Cañuelo (1):
Robert Beckett (1):
Sebastian Reichel (13):
Maintainer Committed (59):
Dmitry Osipenko (3):
Sebastian Reichel (56):
Signed-off-by (13):
AngeloGioacchino Del Regno (3):
Sebastian Reichel (10):
Reviewed-by (138):
Andrzej Pietrasiewicz (5):
AngeloGioacchino Del Regno (121):
- arm64: dts: mediatek: mt8195: Fix vdosys* compatible strings
- ASoC: SOF: sof-audio: prepare_widgets: Check swidget for NULL on sink failure
- ASoC: SOF: sof-audio: skip prepare/unprepare if swidget is NULL
- iommu/mediatek-v1: Fix an error handling path in mtk_iommu_v1_probe()
- mailbox: mtk-cmdq: Do not request irq until we are ready
- mailbox: mtk-cmdq: add MT8186 support
- mailbox: mtk-cmdq: add gce ddr enable support flow
- mailbox: mtk-cmdq: Use GCE_CTRL_BY_SW definition instead of number
- arm64: dts: mt8183: Fix Mali GPU clock
- arm64: dts: mediatek: mt8195-demo: fix the memory size of node secmon
- soc: mediatek: pm-domains: Fix the power glitch issue
- ASoC: mediatek: mt8195: add sof be ops to check audio active
- dt-bindings: usb: mtk-xhci: add support for mt7986
- spi: spi-mtk-nor: Add recovery mechanism for dma read timeout
- mmc: mtk-sd: fix two spelling mistakes in comment
- mmc: mtk-sd: add Inline Crypto Engine clock control
- dt-bindings: mmc: mtk-sd: add Inline Crypto Engine clock
- mmc: mediatek: add support for MT7986 SoC
- arm64: dts: qcom: sc7180-trogdor: Add missing supplies for rt5682
- dt-bindings: PCI: mediatek-gen3: add SoC based clock config
- spi: mtk-snfi: Add snfi support for MT7986 IC
- pwm: mtk-disp: Propagate errors in .get_state() to the caller
- pwm: mediatek: always use bus clock for PWM on MT7622
- pwm: mtk-disp: Fix the parameters calculated by the enabled flag of disp_pwm
- iommu/mediatek: Fix crash on isr after kexec()
- iommu/mediatek: Remove unused "mapping" member from mtk_iommu_data
- iommu/mediatek: Improve safety for mediatek,smi property in larb nodes
- iommu/mediatek: Validate number of phandles associated with "mediatek,larbs"
- iommu/mediatek: Add error path for loop of mm_dts_parse
- iommu/mediatek: Use component_match_add
- iommu/mediatek: Add platform_device_put for recovering the device refcnt
- dt-bindings: pinctrl: mediatek,mt65xx: Deprecate pins-are-numbered
- pinctrl: mediatek: common: Remove check for pins-are-numbered
- regulator: add mt6357 regulator
- ASoC: SOF: mediatek: add shutdown callback
- clk: mediatek: fix dependency of MT7986 ADC clocks
- clk: mediatek: Change PLL register API for MT8186
- clk: mediatek: Add new clock driver to handle FHCTL hardware
- dt-bindings: clock: mediatek: Add new bindings of MediaTek frequency hopping
- clk: mediatek: Export PLL operations symbols
- spi: mediatek: Enable irq when pdata is ready
- scsi: ufs: ufs-mediatek: Modify the return value
- scsi: ufs: ufs-mediatek: Remove unneeded code
- media: mediatek: vcodec: Core thread depends on core_list
- media: mediatek: vcodec: Setting lat buf to lat_list when lat decode error
- media: mediatek: vcodec: Fix h264 set lat buffer error
- ASoC: mediatek: mt8186: Correct I2S shared clocks
- iio: adc: mt6370: Add MediaTek MT6370 support
- drm/mediatek: Add MT8195 ovl driver support
- drm/mediatek: Add AFBC support to Mediatek DRM driver
- usb: host: xhci-mtk: omit shared hcd if either root hub has no ports
- soc: mediatek: Add deprecated compatible to mmsys
- soc: mediatek: pwrap: add mt8365 SoC support
- soc: mediatek: pwrap: add support for sys & tmr clocks
- dt-bindings: soc: mediatek: pwrap: add MT8365 SoC bindings
- soc: mediatek: add mtk-mmsys support for mt8195 vdosys0
- dt-bindings: arm: mediatek: mmsys: change compatible for MT8195
- arm64: dts: mt7986: add spi related device nodes
- arm64: dts: mt7986: move wed_pcie node
- arm64: dts: mediatek: cherry: Add edptx and dptx support
- arm64: dts: mediatek: cherry: Add dp-intf ports
- arm64: dts: mt8195: Add edptx and dptx nodes
- arm64: dts: mt8195: Add dp-intf nodes
- dt-bindings: watchdog: mediatek,mtk-wdt: Add compatible for MT8173
- watchdog: mediatek: mt8188: add wdt support
- dt-bindings: reset: mt8188: add toprgu reset-controller header file
- dt-bindings: watchdog: Add compatible for MediaTek MT8188
- iommu/mediatek: add support for MT8365 SoC
- iommu/mediatek: add support for 6-bit encoded port IDs
- dt-bindings: iommu: mediatek: add binding documentation for MT8365 SoC
- hw_random: use add_hwgenerator_randomness() for early entropy
- spi: spi-mtk-nor: Optimize timeout for dma read
- drm/mediatek: Fix return type of mtk_hdmi_bridge_mode_valid()
- arm64: dts: mt7986: harmonize device node order
- arm64: dts: mt8195: Add pcie and pcie phy nodes
- dt-bindings: PCI: mediatek-gen3: Support mt8195
- arm64: dts: mt7986: fix trng node name
- pinctrl: mediatek: add pull_type attribute for mediatek MT7986 SoC
- pinctrl: mediatek: extend pinctrl-moore to support new bias functions
- pinctrl: mediatek: fix the pinconf register offset of some pins
- ASoC: mediatek: mt8195-mt6359: Register to module device table
- ASoC: mediatek: mt8192-mt6359: Register to module device table
- ASoC: mediatek: mt8186-rt5682: Register to module device table
- ASoC: mediatek: mt8186-da7219: Register to module device table
- ASoC: mediatek: mt8183-mt6358: Register to module device table
- ASoC: mediatek: mt8183-da7219: Register to module device table
- ASoC: mediatek: mt6797-mt6351: Register to module device table
- ASoC: mediatek: mt2701-wm8960: Register to module device table
- ASoC: mediatek: mt2701-cs42448: Register to module device table
- dt-bindings: pinctrl: mediatek,pinctrl-mt6795: Fix interrupt count
- dt-bindings: pinctrl: mediatek,mt6779-pinctrl: Add MT6797
- dt-bindings: pinctrl: mediatek,mt6779-pinctrl: Make gpio-ranges optional
- dt-bindings: pinctrl: mediatek,mt6779-pinctrl: Improve description
- arm64: dts: mt8195: Add venc node
- arm64: dts: mt7622: drop r_smpl property from mmc node
- arm64: dts: mt8183: drop drv-type from mmc-node
- arm64: dts: mediatek: mt2712e: swap last 2 clocks to match binding
- soc: mediatek: Add all settings to mtk_mmsys_ddp_dpi_fmt_config func
- arm64: dts: mediatek: mt6779: Remove syscon compatible from pin controller
- arm64: dts: mediatek: kukui: Remove i2s-share properties
- ASoC: rt5682: Support DBVDD and LDO1-IN supplies
- ASoC: rt5682s: Support DBVDD and LDO1-IN supplies
- ASoC: dt-bindings: realtek,rt5682s: Add DBVDD and LDO1-IN supplies
- ASoC: dt-bindings: realtek,rt5682s: Add AVDD and MICVDD supplies
- ASoC: mediatek: mt8183-mt6358: Register to module device table
- ASoC: mediatek: mt8183-da7219: Register to module device table
- media: platform: mtk-mdp3: fix error handling in mdp_probe()
- media: platform: mtk-mdp3: fix error handling about components clock_on
- media: platform: mtk-mdp3: fix error handling in mdp_cmdq_send()
- ASoC: mediatek: mt8186-rt5682: Modify machine driver for two DMICs case
- ASoC: mediatek: dt-bindings: modify machine bindings for two MICs case
- i2c: mediatek: add mt7986 support
- dt-bindings: i2c: update bindings for mt7986 soc
- drm/bridge: it6505: Fix return value check for pm_runtime_get_sync
- ASoC: dt-bindings: rt5682: Set sound-dai-cells to 1
- ASoC: dt-bindings: realtek,rt5682s: Add #sound-dai-cells
- media: platform: mtk-mdp3: remove unused VIDEO_MEDIATEK_VPU config
- media: mediatek: vcodec: Skip unsupported h264 encoder profile
- pinctrl: mediatek: Add missing header(s)
- drm/bridge: it6505: Add pre_enable/post_disable callback
- drm/bridge: it6505: Adapt runtime power management framework
Dmitry Osipenko (4):
Muhammad Usama Anjum (1):
Nicolas Dufresne (2):
Nícolas F. R. A. Prado (4):
Pekka Paalanen (1):
Acked-by (4):
Andrej Shadura (1):
Daniel Stone (1):
Sebastian Reichel (2):
Tested-by (6):
AngeloGioacchino Del Regno (5):
Nícolas F. R. A. Prado (1):
Reported-by (1):
AngeloGioacchino Del Regno (1):
Comments (0)
Add a Comment