[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK8P3a2U7U31eF_POU2=eCU+E1DH-wnR2uHr-VZYWLy25hLjKg@mail.gmail.com>
Date: Mon, 14 Oct 2019 13:19:46 +0200
From: Arnd Bergmann <arnd@...db.de>
To: Daniel Palmer <daniel@...f.com>
Cc: Daniel Palmer <daniel@...ngy.jp>, Rob Herring <robh+dt@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Russell King <linux@...linux.org.uk>,
Maxime Ripard <mripard@...nel.org>,
Heiko Stuebner <heiko@...ech.de>,
Shawn Guo <shawnguo@...nel.org>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Icenowy Zheng <icenowy@...c.io>,
Mauro Carvalho Chehab <mchehab+samsung@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>,
"Paul E. McKenney" <paulmck@...ux.ibm.com>,
Linus Walleij <linus.walleij@...aro.org>,
Paul Burton <paul.burton@...s.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Mike Rapoport <rppt@...ux.ibm.com>,
Bartosz Golaszewski <bgolaszewski@...libre.com>,
Doug Anderson <armlinux@...isordat.com>,
Ard Biesheuvel <ard.biesheuvel@...aro.org>,
Benjamin Gaignard <benjamin.gaignard@...aro.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Stefan Agner <stefan@...er.ch>,
Nicolas Pitre <nico@...xnic.net>,
Masahiro Yamada <yamada.masahiro@...ionext.com>,
Nathan Chancellor <natechancellor@...il.com>,
Andreas Färber <afaerber@...e.de>,
Nathan Huckleberry <nhuck15@...il.com>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
DTML <devicetree@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/4] ARM: mstar: Add machine for MStar infinity family SoCs
On Mon, Oct 14, 2019 at 8:21 AM Daniel Palmer <daniel@...f.com> wrote:
>
> Initial support for the MStar infinity/infinity3 series of Cortex A7
> based IP camera SoCs.
>
> These chips are interesting in that they contain a Cortex A7,
> peripherals and system memory in a single tiny QFN package that
> can be hand soldered allowing almost anyone to embed Linux
> in their projects.
>
> Signed-off-by: Daniel Palmer <daniel@...f.com>
> +
> +static void __init infinity_map_io(void)
> +{
> + iotable_init(infinity_io_desc, ARRAY_SIZE(infinity_io_desc));
> + miu_flush = (void __iomem *)(infinity_io_desc[0].virtual
> + + INFINITY_L3BRIDGE_FLUSH);
> + miu_status = (void __iomem *)(infinity_io_desc[0].virtual
> + + INFINITY_L3BRIDGE_STATUS);
> +}
If you do this a little later in .init_machine, you can use a simple ioremap()
rather than picking a hardcoded physical address. It looks like nothing
uses the mapping before you set soc_mb anyway.
> +static DEFINE_SPINLOCK(infinity_mb_lock);
> +
> +static void infinity_mb(void)
> +{
> + unsigned long flags;
> +
> + spin_lock_irqsave(&infinity_mb_lock, flags);
> + /* toggle the flush miu pipe fire bit */
> + writel_relaxed(0, miu_flush);
> + writel_relaxed(INFINITY_L3BRIDGE_FLUSH_TRIGGER, miu_flush);
> + while (!(readl_relaxed(miu_status) & INFINITY_L3BRIDGE_STATUS_DONE)) {
> + /* wait for flush to complete */
> + }
> + spin_unlock_irqrestore(&infinity_mb_lock, flags);
> +}
Wow, this is a heavy barrier. From your description it doesn't sound like
there is anything to be done about it unfortunately.
Two possible issues I see here:
* It looks like it relies on CONFIG_ARM_HEAVY_BARRIER, but your Kconfig
entry does not select that. In many configurations, CACHE_L2X0 would
be set, but there is no need for yours on the Cortex-A7.
* You might get into a deadlock if you get an FIQ (NMI) interrupt while
holding the infinity_mb_lock, and then issue another memory barrier
from that handler, so you might need to use
local_irq_disable()+local_fiq_disable()+raw_spin_lock() here, making
it even more expensive.
Not sure if it matters in practice, as almost nothing uses fiq any more.
OTOH, maybe the lock is not needed at all? AFAICT if the sequence
gets interrupted by a handler that also calls mb(), you would still
continue in the original thread while observing a full l3 barrier. ;-)
Arnd
Powered by blists - more mailing lists