Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: Will Deacon <will@kernel.org>
Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
	Rob Clark <robdclark@gmail.com>, Sean Paul <sean@poorly.run>,
	Abhinav Kumar <quic_abhinavk@quicinc.com>,
	freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org,
	Bjorn Andersson <andersson@kernel.org>,
	dri-devel@lists.freedesktop.org,
	Stephen Boyd <swboyd@chromium.org>,
	David Heidelberg <david@ixit.cz>
Subject: Re: [PATCH] drm/msm/a6xx: don't set IO_PGTABLE_QUIRK_ARM_OUTER_WBWA with coherent SMMU
Date: Fri, 29 Sep 2023 18:25:21 +0100	[thread overview]
Message-ID: <70d975d0-8ee7-9f08-7fae-4652a18df598@arm.com> (raw)
In-Reply-To: <20230929154507.GA30764@willie-the-truck>

On 29/09/2023 4:45 pm, Will Deacon wrote:
> On Mon, Sep 25, 2023 at 06:54:42PM +0100, Robin Murphy wrote:
>> On 2023-04-10 19:52, Dmitry Baryshkov wrote:
>>> If the Adreno SMMU is dma-coherent, allocation will fail unless we
>>> disable IO_PGTABLE_QUIRK_ARM_OUTER_WBWA. Skip setting this quirk for the
>>> coherent SMMUs (like we have on sm8350 platform).
>>
>> Hmm, but is it right that it should fail in the first place? The fact is
>> that if the SMMU is coherent then walks *will* be outer-WBWA, so I honestly
>> can't see why the io-pgtable code is going out of its way to explicitly
>> reject a request to give them the same attribute it's already giving then
>> anyway :/
>>
>> Even if the original intent was for the quirk to have an over-specific
>> implication of representing inner-NC as well, that hardly seems useful if
>> what we've ended up with in practice is a nonsensical-looking check in one
>> place and then a weird hacky bodge in another purely to work around it.
>>
>> Does anyone know a good reason why this is the way it is?
> 
> I think it was mainly because the quick doesn't make sense for a coherent
> page-table walker and we could in theory use that bit for something else
> in that case.

Yuck, even if we did want some horrible notion of quirks being 
conditional on parts of the config rather than just the format, then the 
users would need to be testing for the same condition as the pagetable 
code itself (i.e. cfg->coherent_walk), rather than hoping some other 
property of something else indirectly reflects the right information - 
e.g. there'd be no hope of backporting this particular bodge before 5.19 
where the old iommu_capable(IOMMU_CAP_CACHE_COHERENCY) always returned 
true, and in future we could conceivably support coherent SMMUs being 
configured for non-coherent walks on a per-domain basis.

Furthermore, if we did overload a flag to have multiple meanings, then 
we'd have no way of knowing which one the caller was actually expecting, 
thus the illusion of being able to validate calls in the meantime isn't 
necessarily as helpful as it seems, particularly in a case where the 
"wrong" interpretation would be to have no effect anyway. Mostly though 
I'd hope that if we ever got anywhere near the point of running out of 
quirk bits we'd have already realised that it's time for a better 
interface :(

Based on that, I think that when I do get round to needing to touch this 
code, I'll propose just streamlining the whole quirk.

Cheers,
Robin.

  reply	other threads:[~2023-09-29 17:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-10 18:52 [PATCH] drm/msm/a6xx: don't set IO_PGTABLE_QUIRK_ARM_OUTER_WBWA with coherent SMMU Dmitry Baryshkov
2023-04-10 20:19 ` David Heidelberg
2023-05-16  1:39 ` Konrad Dybcio
2023-05-23 13:48 ` Bjorn Andersson
2023-09-25 17:54 ` Robin Murphy
2023-09-29 15:45   ` Will Deacon
2023-09-29 17:25     ` Robin Murphy [this message]
2023-10-02 10:10       ` Will Deacon

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=70d975d0-8ee7-9f08-7fae-4652a18df598@arm.com \
    --to=robin.murphy@arm.com \
    --cc=andersson@kernel.org \
    --cc=david@ixit.cz \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=quic_abhinavk@quicinc.com \
    --cc=robdclark@gmail.com \
    --cc=sean@poorly.run \
    --cc=swboyd@chromium.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