From: Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org>
To: Vivek Gautam <vivek.gautam-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
Cc: pdaly-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
linux-arm-msm
<linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
open list <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
"list-Y9sIeH5OGRo@public.gmane.org:IOMMU DRIVERS
<iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>,
Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>,
"
<iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH 1/1] iommu/arm-smmu: Add support to use Last level cache
Date: Wed, 27 Jun 2018 17:37:50 +0100 [thread overview]
Message-ID: <20180627163749.GA8729@arm.com> (raw)
In-Reply-To: <CAFp+6iFm29ufb2Pr7Gb-2O_aN3GQLH4rcyWhbQGZ3QiwCC8vPg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
Hi Vivek,
On Tue, Jun 19, 2018 at 02:04:44PM +0530, Vivek Gautam wrote:
> On Fri, Jun 15, 2018 at 10:22 PM, Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org> wrote:
> > On Fri, Jun 15, 2018 at 04:23:29PM +0530, Vivek Gautam wrote:
> >> Qualcomm SoCs have an additional level of cache called as
> >> System cache or Last level cache[1]. This cache sits right
> >> before the DDR, and is tightly coupled with the memory
> >> controller.
> >> The cache is available to all the clients present in the
> >> SoC system. The clients request their slices from this system
> >> cache, make it active, and can then start using it. For these
> >> clients with smmu, to start using the system cache for
> >> dma buffers and related page tables [2], few of the memory
> >> attributes need to be set accordingly.
> >> This change makes the related memory Outer-Shareable, and
> >> updates the MAIR with necessary protection.
> >>
> >> The MAIR attribute requirements are:
> >> Inner Cacheablity = 0
> >> Outer Cacheablity = 1, Write-Back Write Allocate
> >> Outer Shareablity = 1
> >
> > Hmm, so is this cache coherent with the CPU or not?
>
> Thanks for reviewing.
> Yes, this LLC is cache coherent with CPU, so we mark for Outer-cacheable.
> The different masters such as GPU as able to allocated and activate a slice
> in this Last Level Cache.
What I mean is, for example, if the CPU writes some data using Normal, Inner
Shareable, Inner/Outer Cacheable, Inner/Outer Write-back, Non-transient
Read/Write-allocate and a device reads that data using your MAIR encoding
above, is the device guaranteed to see the CPU writes after the CPU has
executed a DSB instruction?
I don't think so, because the ARM ARM would say that there's a mismatch on
the Inner Cacheability attribute.
> > Why don't normal
> > non-cacheable mappings allocated in the LLC by default?
>
> Sorry, I couldn't fully understand your question here.
> Few of the masters on qcom socs are not io-coherent, so for them
> the IC has to be marked as 0.
By IC you mean Inner Cacheability? In your MAIR encoding above, it is zero
so I don't understand the problem. What goes wrong if non-coherent devices
use your MAIR encoding for their DMA buffers?
> But they are able to use the LLC with OC marked as 1.
The issue here is that whatever attributes we put in the SMMU need to align
with the attributes used by the CPU in order to avoid introducing mismatched
aliases. Currently, we support three types of mapping in the SMMU:
1. DMA non-coherent (e.g. "dma-coherent" is not set on the device)
Normal, Inner Shareable, Inner/Outer Non-Cacheable
2. DMA coherent (e.g. "dma-coherent" is set on the device) [IOMMU_CACHE]
Normal, Inner Shareable, Inner/Outer Cacheable, Inner/Outer
Write-back, Non-transient Read/Write-allocate
3. MMIO (e.g. MSI doorbell) [IOMMU_MMIO]
Device-nGnRE (Outer Shareable)
So either you override one of these types (I was suggesting (1)) or you need
to create a new memory type, along with the infrastructure for it to be
recognised on a per-device basis and used by the DMA API so that we don't
get mismatched aliases on the CPU.
Will
next prev parent reply other threads:[~2018-06-27 16:37 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-15 10:53 [PATCH 1/1] iommu/arm-smmu: Add support to use Last level cache Vivek Gautam
[not found] ` <20180615105329.26800-1-vivek.gautam-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-06-15 16:52 ` Will Deacon
[not found] ` <20180615165232.GE2202-5wv7dgnIgG8@public.gmane.org>
2018-06-15 17:12 ` Jordan Crouse
2018-06-19 8:34 ` Vivek Gautam
[not found] ` <CAFp+6iFm29ufb2Pr7Gb-2O_aN3GQLH4rcyWhbQGZ3QiwCC8vPg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-06-27 16:37 ` Will Deacon [this message]
[not found] ` <20180627163749.GA8729-5wv7dgnIgG8@public.gmane.org>
2018-07-24 9:43 ` Vivek Gautam
[not found] ` <CAFp+6iHnA1Jj8wKO08YYEBKVF2_3oEuOQOcW2boL=AYZ9+b=UA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-09-19 19:35 ` Jordan Crouse
2018-09-20 10:25 ` Vivek Gautam
2018-09-20 11:41 ` Vivek Gautam
2018-09-28 13:19 ` Will Deacon
2018-10-05 5:25 ` Vivek Gautam
2018-10-23 4:15 ` Tomasz Figa
2018-10-24 17:48 ` Vivek Gautam
-- strict thread matches above, loose matches on Subject: below --
2018-12-04 11:01 Vivek Gautam
2018-12-04 15:21 ` Robin Murphy
[not found] ` <99682bd2-1ca6-406a-890c-b34c25a1b2b3-5wv7dgnIgG8@public.gmane.org>
2018-12-07 9:24 ` Vivek Gautam
2018-12-13 3:50 ` Tomasz Figa
[not found] ` <CAAFQd5C+BygjdBhBOsiBW=4kOgC0a=V8s9om6jqa6yzmn0TEWw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-01-02 7:22 ` Vivek Gautam
[not found] ` <CAFp+6iE7U3HCJwHkeL9A4DXUVryt13YxDCYfBDxcSSM2Z_vqcg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-01-02 7:52 ` Vivek Gautam
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=20180627163749.GA8729@arm.com \
--to=will.deacon-5wv7dgnigg8@public.gmane.org \
--cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=pdaly-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
--cc=vivek.gautam-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.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).