[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191122003524.GH25745@shell.armlinux.org.uk>
Date: Fri, 22 Nov 2019 00:35:24 +0000
From: Russell King - ARM Linux admin <linux@...linux.org.uk>
To: Pavel Tatashin <pasha.tatashin@...een.com>
Cc: Mark Rutland <mark.rutland@....com>,
Catalin Marinas <catalin.marinas@....com>, stefan@...er.ch,
Masahiro Yamada <yamada.masahiro@...ionext.com>,
Will Deacon <will@...nel.org>, boris.ostrovsky@...cle.com,
Sasha Levin <sashal@...nel.org>, sstabellini@...nel.org,
James Morris <jmorris@...ei.org>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
xen-devel@...ts.xenproject.org,
Vladimir Murzin <vladimir.murzin@....com>,
Marc Zyngier <marc.zyngier@....com>, alexios.zavras@...el.com,
Thomas Gleixner <tglx@...utronix.de>, allison@...utok.net,
jgross@...e.com, steve.capper@....com,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
LKML <linux-kernel@...r.kernel.org>,
James Morse <james.morse@....com>, info@...ux.net
Subject: Re: [PATCH 1/3] arm/arm64/xen: use C inlines for privcmd_call
On Fri, Nov 22, 2019 at 12:34:03AM +0000, Russell King - ARM Linux admin wrote:
> On Thu, Nov 21, 2019 at 07:30:41PM -0500, Pavel Tatashin wrote:
> > > > +#ifdef CONFIG_CPU_SW_DOMAIN_PAN
> > > > +static __always_inline void uaccess_enable(void)
> > > > +{
> > > > + unsigned long val = DACR_UACCESS_ENABLE;
> > > > +
> > > > + asm volatile("mcr p15, 0, %0, c3, c0, 0" : : "r" (val));
> > > > + isb();
> > > > +}
> > > > +
> > > > +static __always_inline void uaccess_disable(void)
> > > > +{
> > > > + unsigned long val = DACR_UACCESS_ENABLE;
> >
> > Oops, should be DACR_UACCESS_DISABLE.
> >
> > > > +
> > > > + asm volatile("mcr p15, 0, %0, c3, c0, 0" : : "r" (val));
> > > > + isb();
> > > > +}
> > >
> > > Rather than inventing these, why not use uaccess_save_and_enable()..
> > > uaccess_restore() around the Xen call?
> >
> > Thank you for suggestion: uaccess_enable() and uaccess_disable() are
> > common calls with arm64, so I will need them, but I think I can use
> > set_domain() with DACR_UACCESS_DISABLE /DACR_UACCESS_ENABLE inside
> > these inlines.
>
> That may be, but be very careful that you only use them in ARMv7-only
> code. Using them elsewhere is unsafe as the domain register is used
> for other purposes, and merely blatting over it (as your
> uaccess_enable and uaccess_disable functions do) is unsafe.
In fact, I'll turn that into a bit more than a suggestion. I'll make
it a NAK on adding them to 32-bit ARM.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up
Powered by blists - more mailing lists