Re: [PATCH v6 00/12] dmaengine: qcom: bam_dma: add cmd descriptor support

From: brgl
Date: Thu Feb 20 2025 - 09:35:33 EST


On Wed, 15 Jan 2025 11:29:52 +0100, Md Sadre Alam
<quic_mdalam@xxxxxxxxxxx> said:
> Requirements:
> In QCE crypto driver we are accessing the crypto engine registers
> directly via CPU read/write. Trust Zone could possibly to perform some
> crypto operations simultaneously, a race condition will be created and
> this could result in undefined behavior.
>
> To avoid this behavior we need to use BAM HW LOCK/UNLOCK feature on BAM
> pipes, and this LOCK/UNLOCK will be set via sending a command descriptor,
> where the HLOS/TZ QCE crypto driver prepares a command descriptor with a
> dummy write operation on one of the QCE crypto engine register and pass
> the LOCK/UNLOCK flag along with it.
>

On rb3gen2 I'm seeing the following when running cryptsetup benchmark:

# cryptsetup benchmark
# Tests are approximate using memory only (no storage IO).
PBKDF2-sha1 1452321 iterations per second for 256-bit key
PBKDF2-sha256 2641249 iterations per second for 256-bit key
PBKDF2-sha512 1278751 iterations per second for 256-bit key
PBKDF2-ripemd160 760940 iterations per second for 256-bit key
PBKDF2-whirlpool N/A
argon2i 4 iterations, 1008918 memory, 4 parallel threads (CPUs)
for 256-bit key (requested 2000 ms time)
argon2id 4 iterations, 1048576 memory, 4 parallel threads (CPUs)
for 256-bit key (requested 2000 ms time)
[ 43.558496] NET: Registered PF_ALG protocol family
[ 43.570034] arm-smmu 15000000.iommu: Unhandled context fault:
fsr=0x402, iova=0xfffdf000, fsynr=0x7b0003, cbfrsynra=0x4e4, cb=0
[ 43.582069] arm-smmu 15000000.iommu: FSR = 00000402 [Format=2
TF], SID=0x4e4
[ 43.592758] arm-smmu 15000000.iommu: FSYNR0 = 007b0003 [S1CBNDX=123 PLVL=3]
[ 43.608107] Internal error: synchronous external abort:
0000000096000010 [#1] PREEMPT SMP
[ 43.616509] Modules linked in: algif_skcipher af_alg bluetooth
ecdh_generic ecc ipv6 snd_soc_hdmi_codec phy_qcom_edp venus_dec
venus_enc videobuf2_dma_contig videobuf2_memops nb7vpq904m
lontium_lt9611uxc msm leds_qcom_lpg qcom_battmgr pmic_glink_altmode
aux_hpd_bridge ocmem qcom_pbs venus_core ucsi_glink drm_exec
typec_ucsi qcom_pon qcom_spmi_adc5 led_class_multicolor
qcom_spmi_temp_alarm rtc_pm8xxx gpu_sched v4l2_mem2mem ath11k_ahb
qcom_vadc_common nvmem_qcom_spmi_sdam drm_dp_aux_bus videobuf2_v4l2
qcom_stats dispcc_sc7280 drm_display_helper videodev ath11k
videobuf2_common coresight_stm drm_client_lib camcc_sc7280
videocc_sc7280 mac80211 mc i2c_qcom_geni phy_qcom_qmp_combo stm_core
coresight_replicator aux_bridge coresight_tmc coresight_funnel
llcc_qcom libarc4 gpi icc_bwmon typec phy_qcom_snps_femto_v2 coresight
qcrypto qcom_q6v5_pas authenc qcom_pil_info qcom_q6v5 gpucc_sc7280
ufs_qcom libdes qcom_sysmon qcom_common pinctrl_sc7280_lpass_lpi
qcom_glink_smem mdt_loader phy_qcom_qmp_ufs lpassaudiocc_sc7280
[ 43.616763] pinctrl_lpass_lpi cfg80211 phy_qcom_qmp_pcie
icc_osm_l3 rfkill qcom_rng qrtr nvmem_reboot_mode display_connector
socinfo drm_kms_helper pmic_glink pdr_interface qcom_pdr_msg
qmi_helpers drm backlight
[ 43.727571] CPU: 0 UID: 0 PID: 0 Comm: swapper/0 Not tainted
6.14.0-rc3-next-20250220-00012-g2a8d60663e03-dirty #53
[ 43.738291] Hardware name: Qualcomm Technologies, Inc. Robotics RB3gen2 (DT)
[ 43.745535] pstate: 604000c5 (nZCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[ 43.752685] pc : bam_dma_irq+0x374/0x3b0
[ 43.756736] lr : bam_dma_irq+0x2c8/0x3b0
[ 43.760781] sp : ffff800080003e90
[ 43.764200] x29: ffff800080003e90 x28: ffffd03eaae84880 x27: 000000009edf8000
[ 43.771543] x26: ffff45a746642c80 x25: 0000000a24f8499b x24: ffff45a742dca080
[ 43.778886] x23: ffff45a742df7600 x22: 000000000000006e x21: ffff8000811c3000
[ 43.786228] x20: ffff45a742df7630 x19: ffff45a742eaab80 x18: 0000000000000001
[ 43.793568] x17: ffff75698e7b4000 x16: ffff800080000000 x15: 0000000000000034
[ 43.800902] x14: 0000000000000038 x13: 0000000000010008 x12: 071c71c71c71c71c
[ 43.808244] x11: 0000000000000040 x10: ffff45a74000a230 x9 : ffff45a74000a228
[ 43.815587] x8 : ffff45a7407a1dd0 x7 : 0000000000000000 x6 : 0000000000000000
[ 43.822920] x5 : ffff45a7407a1da8 x4 : 0000000000000000 x3 : 0000000000000018
[ 43.830253] x2 : ffff8000811c0000 x1 : ffff8000811c0018 x0 : 0000000000000002
[ 43.837594] Call trace:
[ 43.840115] bam_dma_irq+0x374/0x3b0 (P)
[ 43.844163] __handle_irq_event_percpu+0x48/0x140
[ 43.849006] handle_irq_event+0x4c/0xb0
[ 43.852961] handle_fasteoi_irq+0xa0/0x1bc
[ 43.857186] handle_irq_desc+0x34/0x58
[ 43.861054] generic_handle_domain_irq+0x1c/0x28
[ 43.865812] gic_handle_irq+0x4c/0x120
[ 43.869680] call_on_irq_stack+0x24/0x64
[ 43.873728] do_interrupt_handler+0x80/0x84
[ 43.878039] el1_interrupt+0x34/0x68
[ 43.881732] el1h_64_irq_handler+0x18/0x24
[ 43.885955] el1h_64_irq+0x6c/0x70
[ 43.889465] cpuidle_enter_state+0xac/0x320 (P)
[ 43.894133] cpuidle_enter+0x38/0x50
[ 43.897826] do_idle+0x1e4/0x260
[ 43.901151] cpu_startup_entry+0x38/0x3c
[ 43.905195] rest_init+0xdc/0xe0
[ 43.908531] console_on_rootfs+0x0/0x6c
[ 43.912490] __primary_switched+0x88/0x90
[ 43.916621] Code: b9409063 1b047c21 8b030021 8b010041 (b9000020)
[ 43.922881] ---[ end trace 0000000000000000 ]---
[ 43.927633] Kernel panic - not syncing: synchronous external abort:
Fatal exception in interrupt
[ 43.936653] SMP: stopping secondary CPUs
[ 43.941042] Kernel Offset: 0x503e28e00000 from 0xffff800080000000
[ 43.947306] PHYS_OFFSET: 0xfff0ba59c0000000
[ 43.951615] CPU features: 0x300,00000170,00801250,8200720b
[ 43.957257] Memory Limit: none
[ 43.960405] ---[ end Kernel panic - not syncing: synchronous
external abort: Fatal exception in interrupt ]---

Bartosz