Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Richard Acayan <mailingradian@gmail.com>
To: Konrad Dybcio <konrad.dybcio@somainline.org>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
	Richard Acayan <mailingradian@gmail.com>,
	linux-arm-msm@vger.kernel.org, Will Deacon <will@kernel.org>,
	Robin Murphy <robin.murphy@arm.com>,
	Joerg Roedel <joro@8bytes.org>, Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Bjorn Andersson <andersson@kernel.org>,
	Sai Prakash Ranjan <quic_saipraka@quicinc.com>,
	Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
	Rob Clark <robdclark@chromium.org>,
	Sibi Sankar <sibis@codeaurora.org>,
	Loic Poulain <loic.poulain@linaro.org>,
	Vinod Koul <vkoul@kernel.org>,
	iommu@lists.linux.dev, devicetree@vger.kernel.org
Subject: Re: [PATCH 2/2] iommu: arm-smmu-qcom: add sdm670 compatible
Date: Wed, 21 Sep 2022 22:38:34 -0400	[thread overview]
Message-ID: <20220922023833.178076-1-mailingradian@gmail.com> (raw)
In-Reply-To: <5f629a95-8ee4-7cf8-f471-0b50e311d3b7@somainline.org>

>On 21.09.2022 21:05, Krzysztof Kozlowski wrote:
>> On 21/09/2022 20:48, Konrad Dybcio wrote:
>>>
>>>
>>> On 21.09.2022 20:47, Konrad Dybcio wrote:
>>>>
>>>>
>>>> On 21.09.2022 09:31, Krzysztof Kozlowski wrote:
>>>>> On 21/09/2022 00:39, Richard Acayan wrote:
>>>>>> The Snapdragon 670 needs the IOMMU for GENI I2C. Add a compatible string to
>>>>>> support it.
>>>>>>
>>>>>> Signed-off-by: Richard Acayan <mailingradian@gmail.com>
>>>>>> ---
>>>>>>  drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 1 +
>>>>>>  1 file changed, 1 insertion(+)
>>>>>>
>>>>>> diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
>>>>>> index b2708de25ea3..bf9653b9eb89 100644
>>>>>> --- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
>>>>>> +++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
>>>>>> @@ -431,6 +431,7 @@ static const struct of_device_id __maybe_unused qcom_smmu_impl_of_match[] = {
>>>>>>  	{ .compatible = "qcom,sc8180x-smmu-500" },
>>>>>>  	{ .compatible = "qcom,sc8280xp-smmu-500" },
>>>>>>  	{ .compatible = "qcom,sdm630-smmu-v2" },
>>>>>> +	{ .compatible = "qcom,sdm670-smmu-500" },
>>>>>
>>>>> Why do we keep adding compatibles to the driver for apparently
>>>>> compatible devices?
>>>>
>>>> Because Linux has not funny run on bare Qualcomm hardware ever since at least msm8x60 times and
>>> s/funny/fully
>>>
>>> unfortunate typo, this is not funny, quite the contrary..
>>>
>>> Konrad
>>>> we are not interacting with real hardware, only with Qualcomm's flawed virtual implementation
>>>> of it, that's abstracted to us through various generations of their saddening software stack. This
>>>> is also the case for many more standard components, even as far as the GIC on recent boards..
>> 
>> Unfortunately I don't get this explanation... you mean some other
>> firmware requires Linux drivers to use specific compatibles instead of
>> one fallback?
> No, perhaps I misunderstood you.
>
>> 
>> All of these do not have driver data, so they are essentially compatible
>> for Linux driver. Growing this list in the driver seems pointless. What
>> is the benefit of growing driver with same entries, except more patches?
> Compatible lists in smmu-impl files allow matching driver quirks for SMMUs themselves
>and consumer devices (such as MDSS). The situation is more complicated, because some
>qcom SMMUs also require more quirks than others (think 8974 vs 8994 vs 8996/pro&660&8998
>vs 845+ vs adreno smmu in various flavours), so all qcom SMMUs need to use
> `qcom_smmu_impl` and some others need even more quirks on top of that (that generally
>hurt performance or functionality, so we don't want them when they're unnecessary).
> If all generations of qcom SMMU implementation that bear the same name behaved anywhere
>near consistent, there would be no need for keeping this around, instead requiring only
> "qcom,broken-smmu" or something".

Hi, just stopping by to share my own thoughts.

First, I don't mind if this series doesn't get applied as-is. After seeing
the eMMC driver in its current state:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/mmc/host/sdhci-msm.c?h=v6.0-rc6#n2437

I can understand that the devicetree maintainers don't want to see new SoCs
touching drivers unnecessarily. Second, I don't see enough quirks to
justify needing all compatible strings in the driver (2 quirky SoCs
compared to 16 total not counting adreno iommu):

    $ grep qcom, drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
    	if (of_device_is_compatible(np, "qcom,msm8996-smmu-v2"))
    	* All targets that use the qcom,adreno-smmu compatible string *should*
    	{ .compatible = "qcom,adreno" },
    	{ .compatible = "qcom,mdp4" },
    	{ .compatible = "qcom,mdss" },
    	{ .compatible = "qcom,sc7180-mdss" },
    	{ .compatible = "qcom,sc7180-mss-pil" },
    	{ .compatible = "qcom,sc7280-mdss" },
    	{ .compatible = "qcom,sc7280-mss-pil" },
    	{ .compatible = "qcom,sc8180x-mdss" },
    	{ .compatible = "qcom,sm8250-mdss" },
    	{ .compatible = "qcom,sdm845-mdss" },
    	{ .compatible = "qcom,sdm845-mss-pil" },
    	if (of_device_is_compatible(np, "qcom,sdm845-smmu-500"))
    	{ .compatible = "qcom,msm8998-smmu-v2" },
    	{ .compatible = "qcom,qcm2290-smmu-500" },
    	{ .compatible = "qcom,sc7180-smmu-500" },
    	{ .compatible = "qcom,sc7280-smmu-500" },
    	{ .compatible = "qcom,sc8180x-smmu-500" },
    	{ .compatible = "qcom,sc8280xp-smmu-500" },
    	{ .compatible = "qcom,sdm630-smmu-v2" },
    	{ .compatible = "qcom,sdm670-smmu-500" },
    	{ .compatible = "qcom,sdm845-smmu-500" },
    	{ .compatible = "qcom,sm6125-smmu-500" },
    	{ .compatible = "qcom,sm6350-smmu-500" },
    	{ .compatible = "qcom,sm6375-smmu-500" },
    	{ .compatible = "qcom,sm8150-smmu-500" },
    	{ .compatible = "qcom,sm8250-smmu-500" },
    	{ .compatible = "qcom,sm8350-smmu-500" },
    	{ .compatible = "qcom,sm8450-smmu-500" },
    	if (of_device_is_compatible(np, "qcom,adreno-smmu"))

I don't know if it's better to get myself involved in fixing this, though.
There is no fallback that encompasses qcom devices but not all arm devices.
Either way, I'll have to add a new compatible string to the driver.

If something like this is fine for now, I'll format it properly tomorrow:

--- a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
+++ b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
@@ -48,6 +48,13 @@ properties:
               - qcom,sm8350-smmu-500
               - qcom,sm8450-smmu-500
           - const: arm,mmu-500
+
+      - description: Qcom SoCs implementing "qcom,smmu-500"
+        items:
+          - enum:
+              - qcom,sdm670-smmu-500
+          - const: qcom,smmu-500
+
       - description: Qcom Adreno GPUs implementing "arm,smmu-v2"
         items:
           - enum:
--- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
+++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
@@ -424,6 +424,7 @@ static struct arm_smmu_device *qcom_smmu_create(struct arm_smmu_device *smmu,
 }
 
 static const struct of_device_id __maybe_unused qcom_smmu_impl_of_match[] = {
+       { .compatible = "qcom,smmu-500" },
        { .compatible = "qcom,msm8998-smmu-v2" },
        { .compatible = "qcom,qcm2290-smmu-500" },
        { .compatible = "qcom,sc7180-smmu-500" },

>
> Konrad
>> 
>> Best regards,
>> Krzysztof
>> 

  reply	other threads:[~2022-09-22  2:40 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-20 22:39 [PATCH 0/2] iommu: SMMU for SDM670 Richard Acayan
2022-09-20 22:39 ` [PATCH 1/2] dt-bindings: iommu: arm-smmu: add sdm670 compatible Richard Acayan
2022-09-21  7:31   ` Krzysztof Kozlowski
2022-09-20 22:39 ` [PATCH 2/2] iommu: arm-smmu-qcom: " Richard Acayan
2022-09-20 23:45   ` Konrad Dybcio
2022-09-21  7:31   ` Krzysztof Kozlowski
2022-09-21 18:47     ` Konrad Dybcio
2022-09-21 18:48       ` Konrad Dybcio
2022-09-21 19:05         ` Krzysztof Kozlowski
2022-09-21 21:14           ` Konrad Dybcio
2022-09-22  2:38             ` Richard Acayan [this message]
2022-09-22  6:41               ` Krzysztof Kozlowski
2022-09-22 10:48                 ` Konrad Dybcio
2022-09-22 12:18                   ` Krzysztof Kozlowski
2022-09-23 22:24                     ` Richard Acayan
2022-09-22  6:39             ` Krzysztof Kozlowski
2022-10-18 10:21             ` Dmitry Baryshkov

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=20220922023833.178076-1-mailingradian@gmail.com \
    --to=mailingradian@gmail.com \
    --cc=andersson@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=konrad.dybcio@somainline.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=loic.poulain@linaro.org \
    --cc=quic_saipraka@quicinc.com \
    --cc=robdclark@chromium.org \
    --cc=robh+dt@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=sibis@codeaurora.org \
    --cc=vkoul@kernel.org \
    --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