iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Tomasz Nowicki <tn@semihalf.com>
To: Robin Murphy <robin.murphy@arm.com>,
	will@kernel.org, joro@8bytes.org, gregory.clement@bootlin.com,
	robh+dt@kernel.org, hannah@marvell.com
Cc: devicetree@vger.kernel.org, catalin.marinas@arm.com,
	linux-kernel@vger.kernel.org, nadavh@marvell.com,
	iommu@lists.linux-foundation.org, mw@semihalf.com,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v3 1/4] iommu/arm-smmu: Add SMMU ID2 register fixup hook
Date: Fri, 3 Jul 2020 11:19:11 +0200	[thread overview]
Message-ID: <8758046a-9e11-8d21-26ff-2f02a315f3d4@semihalf.com> (raw)
In-Reply-To: <d3540512-09c7-0fa5-2b35-6f1112a575a9@arm.com>

On 03.07.2020 10:24, Robin Murphy wrote:
> On 2020-07-02 21:16, Tomasz Nowicki wrote:
>> We already have 'cfg_probe' hook which meant to override and apply
>> workarounds while probing ID registers. However, 'cfg_probe' is called
>> at the very end and therefore for some cases fixing up things becomes 
>> complex
>> or requires exporting of SMMU driver structures. Hence, seems it is 
>> better and
>> cleaner to do ID fixup right away. In preparation for adding Marvell
>> errata add an extra ID2 fixup hook.
> 
> Hmm, the intent of ->cfg_probe was very much to give impl a chance to 
> adjust the detected features before we start consuming them, with this 
> exact case in mind. Since the Cavium quirk isn't actually doing that - 
> it just needs to run *anywhere* in the whole probe process - I'm under 
> no illusion that I put the hook in exactly the right place first time 
> around ;)
> 
> The diff below should be more on the mark...
> 
> Robin.
> 
> ----->8-----
> diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
> index 243bc4cb2705..884ffca5b1eb 100644
> --- a/drivers/iommu/arm-smmu.c
> +++ b/drivers/iommu/arm-smmu.c
> @@ -1891,6 +1891,9 @@ static int arm_smmu_device_cfg_probe(struct 
> arm_smmu_device *smmu)
>               smmu->features |= ARM_SMMU_FEAT_FMT_AARCH64_64K;
>       }
> 
> +    if (smmu->impl && smmu->impl->cfg_probe)
> +        return smmu->impl->cfg_probe(smmu);
> +
>       /* Now we've corralled the various formats, what'll it do? */
>       if (smmu->features & ARM_SMMU_FEAT_FMT_AARCH32_S)
>           smmu->pgsize_bitmap |= SZ_4K | SZ_64K | SZ_1M | SZ_16M;
> @@ -1909,7 +1912,6 @@ static int arm_smmu_device_cfg_probe(struct 
> arm_smmu_device *smmu)
>       dev_notice(smmu->dev, "\tSupported page sizes: 0x%08lx\n",
>              smmu->pgsize_bitmap);
> 
> -
>       if (smmu->features & ARM_SMMU_FEAT_TRANS_S1)
>           dev_notice(smmu->dev, "\tStage-1: %lu-bit VA -> %lu-bit IPA\n",
>                  smmu->va_size, smmu->ipa_size);
> @@ -1918,9 +1920,6 @@ static int arm_smmu_device_cfg_probe(struct 
> arm_smmu_device *smmu)
>           dev_notice(smmu->dev, "\tStage-2: %lu-bit IPA -> %lu-bit PA\n",
>                  smmu->ipa_size, smmu->pa_size);
> 
> -    if (smmu->impl && smmu->impl->cfg_probe)
> -        return smmu->impl->cfg_probe(smmu);
> -
>       return 0;
>   }
> 

I was under impression that ->cfg_probe was meant for Cavium alike 
errata (position independent). Then I will move ->cfg_probe as you 
suggested. I prefer not to add yet another impl hook too :)

Thanks,
Tomasz
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  reply	other threads:[~2020-07-03  9:19 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-02 20:16 [PATCH v3 0/4] Add system mmu support for Armada-806 Tomasz Nowicki
2020-07-02 20:16 ` [PATCH v3 1/4] iommu/arm-smmu: Add SMMU ID2 register fixup hook Tomasz Nowicki
2020-07-03  8:24   ` Robin Murphy
2020-07-03  9:19     ` Tomasz Nowicki [this message]
2020-07-02 20:16 ` [PATCH v3 2/4] iommu/arm-smmu: Workaround for Marvell Armada-AP806 SoC erratum #582743 Tomasz Nowicki
2020-07-03  9:03   ` Robin Murphy
2020-07-03 11:24     ` Tomasz Nowicki
2020-07-02 20:16 ` [PATCH v3 3/4] dt-bindings: arm-smmu: add compatible string for Marvell Armada-AP806 SMMU-500 Tomasz Nowicki
2020-07-03  9:05   ` Robin Murphy
2020-07-03  9:26     ` Tomasz Nowicki
2020-07-13 21:36       ` Rob Herring
2020-07-02 20:16 ` [PATCH v3 4/4] arm64: dts: marvell: add SMMU support Tomasz Nowicki
2020-07-03  9:16   ` Robin Murphy
2020-07-03  9:33     ` Tomasz Nowicki
2020-07-03 10:38       ` Marcin Wojtas
2020-07-14  8:19 ` [PATCH v3 0/4] Add system mmu support for Armada-806 Will Deacon
2020-07-14 10:26   ` Tomasz Nowicki

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=8758046a-9e11-8d21-26ff-2f02a315f3d4@semihalf.com \
    --to=tn@semihalf.com \
    --cc=catalin.marinas@arm.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gregory.clement@bootlin.com \
    --cc=hannah@marvell.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mw@semihalf.com \
    --cc=nadavh@marvell.com \
    --cc=robh+dt@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;
as well as URLs for NNTP newsgroup(s).