Firmware / Hypervisor / TZ kills Linux for touching at context bank registers
Marc Gonzalez
mgonzalez at freebox.fr
Mon Jul 29 09:40:23 PDT 2024
Hello everyone,
I'm running v6.11-rc1 on qcom msm8998.
I cherry-picked AngeloGioacchino's patch adding lpass_q6_smmu:
lpass_q6_smmu: iommu at 5100000 {
compatible = "qcom,msm8998-smmu-v2", "qcom,smmu-v2";
reg = <0x05100000 0x40000>;
clocks = <&gcc HLOS1_VOTE_LPASS_ADSP_SMMU_CLK>;
clock-names = "iface";
#global-interrupts = <0>;
#iommu-cells = <1>;
interrupts =
<GIC_SPI 226 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 393 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 394 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 395 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 396 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 397 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 398 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 399 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 400 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 401 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 402 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 403 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>;
power-domains = <&gcc LPASS_ADSP_GDSC>;
status = "disabled";
};
System freezes & reboots in the lpass_q6_smmu setup.
(Firmware / Hypervisor / TZ is zapping Linux for daring
to touch to reserved registers)
Specifically:
1) In arm_smmu_device_reset(),
dev_warn(smmu->dev, "YO %s:%d ctxbank=%d GO", __func__, __LINE__, i);
arm_smmu_write_context_bank(smmu, i);
arm_smmu_cb_write(smmu, i, ARM_SMMU_CB_FSR, ARM_SMMU_CB_FSR_FAULT);
dev_warn(smmu->dev, "YO %s:%d ctxbank=%d OK", __func__, __LINE__, i);
Linux freezes in arm_smmu_write_context_bank(smmu, 12);
(FW reserves context bank #12 for itself, probably)
2) thus this fails as well:
qsmmu->bypass_cbndx = smmu->num_context_banks - 1;
dev_warn(smmu->dev, "YO %s:%d ctxbank=%u GO", __func__, __LINE__, qsmmu->bypass_cbndx);
arm_smmu_cb_write(smmu, qsmmu->bypass_cbndx, ARM_SMMU_CB_SCTLR, 0);
dev_warn(smmu->dev, "YO %s:%d ctxbank=%u OK", __func__, __LINE__, qsmmu->bypass_cbndx);
Linux freezes in arm_smmu_cb_write(smmu, 12, ARM_SMMU_CB_SCTLR, 0);
12 is chosen since it's the last context bank, but assumption
that it will be free is false.
AngeloGioacchino has several patches to deal with this situation,
but I wanted to know what would be an acceptable solution?
AngeloGioacchino's solution consists in
optionally specifying in DTS which context bank to use,
and a list of context banks to not reset.
In my specific case, we just need to avoid using CB 12,
because it is reserved by the FW under Linux.
What do you think?
Regards
More information about the linux-arm-kernel
mailing list