From: Marc Gonzalez <mgonzalez@freebox.fr>
To: Bjorn Andersson <andersson@kernel.org>
Cc: Rob Clark <robdclark@gmail.com>, Will Deacon <will@kernel.org>,
Robin Murphy <robin.murphy@arm.com>,
Joerg Roedel <joro@8bytes.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
iommu@lists.linux.dev, linux-arm-msm@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
Konrad Dybcio <konradybcio@kernel.org>,
Arnaud Vrac <avrac@freebox.fr>,
Pierre-Hugues Husson <phhusson@freebox.fr>,
Marijn Suijten <marijn.suijten@somainline.org>
Subject: Re: [PATCH 2/2] iommu/arm-smmu-qcom: hide last context bank from linux
Date: Wed, 14 Aug 2024 19:33:09 +0200 [thread overview]
Message-ID: <dfd80103-391a-4777-8944-296ba31a11dd@freebox.fr> (raw)
In-Reply-To: <a7j3lz62bp6pceuq472muioinjzfgw2mec5pv256zfr7yjsn3p@ok6nfsbsabig>
On 14/08/2024 17:29, Bjorn Andersson wrote:
> On Wed, Aug 14, 2024 at 03:59:56PM GMT, Marc Gonzalez wrote:
>> On qcom msm8998, writing to the last context bank of lpass_q6_smmu
>> (base address 0x05100000) produces a system freeze & reboot.
>>
>> Specifically, here:
>>
>> qsmmu->bypass_cbndx = smmu->num_context_banks - 1;
>> arm_smmu_cb_write(smmu, qsmmu->bypass_cbndx, ARM_SMMU_CB_SCTLR, 0);
>>
>> and here:
>>
>> arm_smmu_write_context_bank(smmu, i);
>> arm_smmu_cb_write(smmu, i, ARM_SMMU_CB_FSR, ARM_SMMU_CB_FSR_FAULT);
>>
>> It is likely that FW reserves the last context bank for its own use,
>> thus a simple work-around would be: DON'T USE IT in Linux.
>>
>> If we decrease the number of context banks, last one will be "hidden".
>
> I asked you to write something like "the hardware/hypervisor reports 12
> context banks for the lpass smmu on msm8998, but only 11 are
> accessible...override the number of context banks"
I don't understand how the exact number of context banks is relevant?
It's just that the FW reserves one for itself, which happens to be the last,
probably because some FW dev thought that was a good idea.
Also, I don't like the phrasing "override the number of context banks"
because while this is indeed what is done in the code, the *intent*
is to "lie" to Linux about the existence of the last context bank.
> It also seems, as the different SMMUs in this platform behave
> differently it might be worth giving them further specific compatibles,
> in which case we could just check if it's the qcom,msm8998-lpass-smmu,
> instead of inventing a property for this quirk.
Wouldn't that be too specific?
Angelo's patches were even more generic than mine, as he supported
a list of context banks not-to-be-used-by-linux.
Do you say the LPASS SMMU behaves differently because it's (currently,
to the best of my knowledge) the only SMMU where a context bank
(the last) is not available to Linux?
For easy future reference, here are the reports for the 5 SMMUs enabled on my system.
[ 0.137343] arm-smmu 1680000.iommu: probing hardware configuration...
[ 0.137354] arm-smmu 1680000.iommu: SMMUv2 with:
[ 0.137381] arm-smmu 1680000.iommu: stage 1 translation
[ 0.137390] arm-smmu 1680000.iommu: address translation ops
[ 0.137399] arm-smmu 1680000.iommu: non-coherent table walk
[ 0.137406] arm-smmu 1680000.iommu: (IDR0.CTTW overridden by FW configuration)
[ 0.137417] arm-smmu 1680000.iommu: stream matching with 16 register groups
[ 0.137447] arm-smmu 1680000.iommu: 6 context banks (0 stage-2 only)
[ 0.137733] arm-smmu 1680000.iommu: Supported page sizes: 0x63315000
[ 0.137743] arm-smmu 1680000.iommu: Stage-1: 36-bit VA -> 36-bit IPA
[ 0.137833] arm-smmu 1680000.iommu: preserved 0 boot mappings
[ 0.138963] arm-smmu 16c0000.iommu: probing hardware configuration...
[ 0.138974] arm-smmu 16c0000.iommu: SMMUv2 with:
[ 0.138994] arm-smmu 16c0000.iommu: stage 1 translation
[ 0.139003] arm-smmu 16c0000.iommu: address translation ops
[ 0.139011] arm-smmu 16c0000.iommu: non-coherent table walk
[ 0.139019] arm-smmu 16c0000.iommu: (IDR0.CTTW overridden by FW configuration)
[ 0.139030] arm-smmu 16c0000.iommu: stream matching with 14 register groups
[ 0.139058] arm-smmu 16c0000.iommu: 10 context banks (0 stage-2 only)
[ 0.139255] arm-smmu 16c0000.iommu: Supported page sizes: 0x63315000
[ 0.139265] arm-smmu 16c0000.iommu: Stage-1: 36-bit VA -> 36-bit IPA
[ 0.139341] arm-smmu 16c0000.iommu: preserved 0 boot mappings
[ 2.424369] arm-smmu 5040000.iommu: probing hardware configuration...
[ 2.428581] arm-smmu 5040000.iommu: SMMUv2 with:
[ 2.434914] arm-smmu 5040000.iommu: stage 1 translation
[ 2.439584] arm-smmu 5040000.iommu: address translation ops
[ 2.444881] arm-smmu 5040000.iommu: non-coherent table walk
[ 2.450522] arm-smmu 5040000.iommu: (IDR0.CTTW overridden by FW configuration)
[ 2.456175] arm-smmu 5040000.iommu: stream matching with 3 register groups
[ 2.463216] arm-smmu 5040000.iommu: 3 context banks (0 stage-2 only)
[ 2.483555] arm-smmu 5040000.iommu: Supported page sizes: 0x63315000
[ 2.490455] arm-smmu 5040000.iommu: Stage-1: 48-bit VA -> 36-bit IPA
[ 2.497171] arm-smmu 5040000.iommu: preserved 0 boot mappings
[ 2.546101] arm-smmu 5100000.iommu: probing hardware configuration...
[ 2.552439] arm-smmu 5100000.iommu: SMMUv2 with:
[ 2.558945] arm-smmu 5100000.iommu: stage 1 translation
[ 2.563627] arm-smmu 5100000.iommu: address translation ops
[ 2.568923] arm-smmu 5100000.iommu: non-coherent table walk
[ 2.574566] arm-smmu 5100000.iommu: (IDR0.CTTW overridden by FW configuration)
[ 2.580220] arm-smmu 5100000.iommu: stream matching with 12 register groups
[ 2.587263] arm-smmu 5100000.iommu: 13 context banks (0 stage-2 only)
[ 2.594544] arm-smmu 5100000.iommu: hiding last ctx bank from linux
[ 2.614447] arm-smmu 5100000.iommu: Supported page sizes: 0x63315000
[ 2.621358] arm-smmu 5100000.iommu: Stage-1: 36-bit VA -> 36-bit IPA
[ 2.627772] arm-smmu 5100000.iommu: preserved 0 boot mappings
[ 2.806781] arm-smmu cd00000.iommu: probing hardware configuration...
[ 2.813029] arm-smmu cd00000.iommu: SMMUv2 with:
[ 2.819627] arm-smmu cd00000.iommu: stage 1 translation
[ 2.824304] arm-smmu cd00000.iommu: address translation ops
[ 2.829601] arm-smmu cd00000.iommu: non-coherent table walk
[ 2.835243] arm-smmu cd00000.iommu: (IDR0.CTTW overridden by FW configuration)
[ 2.840897] arm-smmu cd00000.iommu: stream matching with 54 register groups
[ 2.847954] arm-smmu cd00000.iommu: 17 context banks (0 stage-2 only)
[ 2.869307] arm-smmu cd00000.iommu: Supported page sizes: 0x63315000
[ 2.875785] arm-smmu cd00000.iommu: Stage-1: 32-bit VA -> 36-bit IPA
[ 2.882205] arm-smmu cd00000.iommu: preserved 0 boot mappings
[ 24.525457] arm-smmu 16c0000.iommu: FSR = 00000402 [Format=2 TF], SID=0x1900
[ 24.525604] arm-smmu 16c0000.iommu: FSYNR0 = 00000001 [S1CBNDX=0 PLVL=1]
[ 24.721874] arm-smmu 16c0000.iommu: FSR = 00000402 [Format=2 TF], SID=0x1900
[ 24.722033] arm-smmu 16c0000.iommu: FSYNR0 = 00000001 [S1CBNDX=0 PLVL=1]
next prev parent reply other threads:[~2024-08-14 17:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-14 13:59 [PATCH 0/2] Work around reserved SMMU context bank on msm8998 Marc Gonzalez
2024-08-14 13:59 ` [PATCH 1/2] dt-bindings: arm-smmu: Add qcom,last-ctx-bank-reserved Marc Gonzalez
2024-08-18 15:25 ` Rob Herring
2024-08-19 11:37 ` Marc Gonzalez
2024-08-19 12:57 ` Robin Murphy
2024-08-19 15:02 ` Marc Gonzalez
2024-08-19 22:04 ` Bjorn Andersson
2024-08-14 13:59 ` [PATCH 2/2] iommu/arm-smmu-qcom: hide last context bank from linux Marc Gonzalez
2024-08-14 15:29 ` Bjorn Andersson
2024-08-14 17:33 ` Marc Gonzalez [this message]
2024-08-15 13:01 ` Caleb Connolly
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dfd80103-391a-4777-8944-296ba31a11dd@freebox.fr \
--to=mgonzalez@freebox.fr \
--cc=andersson@kernel.org \
--cc=avrac@freebox.fr \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marijn.suijten@somainline.org \
--cc=phhusson@freebox.fr \
--cc=robdclark@gmail.com \
--cc=robh@kernel.org \
--cc=robin.murphy@arm.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®