mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiaxun Yang <jiaxun.yang@flygoat.com>
To: Serge Semin <Sergey.Semin@baikalelectronics.ru>,
	Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Serge Semin <fancer.lancer@gmail.com>,
	Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>,
	Pavel Parkhomenko <Pavel.Parkhomenko@baikalelectronics.ru>,
	Vadim Vlasov <V.Vlasov@baikalelectronics.ru>,
	"Maciej W . Rozycki" <macro@linux-mips.org>,
	linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] mips: Add strong UC ordering config
Date: Fri, 25 Sep 2020 11:54:20 +0800	[thread overview]
Message-ID: <57fb837a-d884-b368-7a72-d010b5e52f2a@flygoat.com> (raw)
In-Reply-To: <20200920110010.16796-2-Sergey.Semin@baikalelectronics.ru>



在 2020/9/20 19:00, Serge Semin 写道:
> In accordance with [1, 2] memory transactions using CCA=2 (Uncached
> Cacheability and Coherency Attribute) are always strongly ordered. This
> means the younger memory accesses using CCA=2 are never allowed to be
> executed before older memory accesses using CCA=2 (no bypassing is
> allowed), and Loads and Stores using CCA=2 are never speculative. It is
> expected by the specification that the rest of the system maintains these
> properties for processor initiated uncached accesses. So the system IO
> interconnect doesn't reorder uncached transactions once they have left the
> processor subsystem. Taking into account these properties and what [3]
> says about the relaxed IO-accessors we can infer that normal Loads and
> Stores from/to CCA=2 memory and without any additional execution barriers
> will fully comply with the {read,write}X_relaxed() methods requirements.
>
> Let's convert then currently generated relaxed IO-accessors to being pure
> Loads and Stores. Seeing the commit 3d474dacae72 ("MIPS: Enforce strong
> ordering for MMIO accessors") and commit 8b656253a7a4 ("MIPS: Provide
> actually relaxed MMIO accessors") have already made a preparation in the
> corresponding macro, we can do that just by replacing the "barrier"
> parameter utilization with the "relax" one. Note the "barrier" macro
> argument can be removed, since it isn't fully used anyway other than being
> always assigned to 1.
>
> Of course it would be fullish to believe that all the available MIPS-based
> CPUs completely follow the denoted specification, especially considering
> how old the architecture is. Instead we introduced a dedicated kernel
> config, which when enabled will convert the relaxed IO-accessors to being
> pure Loads and Stores without any additional barriers around. So if some
> CPU supports the strongly ordered UC memory access, it can enable that
> config and use a fully optimized relaxed IO-methods. For instance,
> Baikal-T1 architecture support code will do that.
>
> [1] MIPS Coherence Protocol Specification, Document Number: MD00605,
>      Revision 01.01. September 14, 2015, 4.2 Execution Order Behavior,
>      p. 33
>
> [2] MIPS Coherence Protocol Specification, Document Number: MD00605,
>      Revision 01.01. September 14, 2015, 4.8.1 IO Device Access, p. 58
>
> [3] "LINUX KERNEL MEMORY BARRIERS", Documentation/memory-barriers.txt,
>      Section "KERNEL I/O BARRIER EFFECTS"
>
> Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
> Cc: Maciej W. Rozycki <macro@linux-mips.org>
Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>


Based on #mipslinus discussions, I suspect this option can be selected by
most modern MIPS processors including all IMG/MTI cores,
Ingenic and Loongson.

Thanks.

- Jiaxun

> ---
>   arch/mips/Kconfig          |  8 ++++++++
>   arch/mips/include/asm/io.h | 20 ++++++++++----------
>   2 files changed, 18 insertions(+), 10 deletions(-)
>

  reply	other threads:[~2020-09-25  3:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-20 11:00 [PATCH 0/2] mips: Introduce some IO-accessors optimizations Serge Semin
2020-09-20 11:00 ` [PATCH 1/2] mips: Add strong UC ordering config Serge Semin
2020-09-25  3:54   ` Jiaxun Yang [this message]
2020-09-25 18:18     ` Serge Semin
2020-09-20 11:00 ` [PATCH 2/2] mips: Introduce MIPS CM2 GCR Control register accessors Serge Semin
2020-09-29 21:12 ` [PATCH 0/2] mips: Introduce some IO-accessors optimizations Serge Semin
2020-09-30 10:15   ` Thomas Bogendoerfer
2020-09-30 13:23     ` Serge Semin

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=57fb837a-d884-b368-7a72-d010b5e52f2a@flygoat.com \
    --to=jiaxun.yang@flygoat.com \
    --cc=Alexey.Malahov@baikalelectronics.ru \
    --cc=Pavel.Parkhomenko@baikalelectronics.ru \
    --cc=Sergey.Semin@baikalelectronics.ru \
    --cc=V.Vlasov@baikalelectronics.ru \
    --cc=fancer.lancer@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=macro@linux-mips.org \
    --cc=tsbogend@alpha.franken.de \
    /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®