From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: Pavel Tatashin <pasha.tatashin@soleen.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
Catalin Marinas <catalin.marinas@arm.com>,
stefan@agner.ch, Masahiro Yamada <yamada.masahiro@socionext.com>,
Will Deacon <will@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Sasha Levin <sashal@kernel.org>,
sstabellini@kernel.org, James Morris <jmorris@namei.org>,
Linux ARM <linux-arm-kernel@lists.infradead.org>,
xen-devel@lists.xenproject.org,
Vladimir Murzin <vladimir.murzin@arm.com>,
Marc Zyngier <marc.zyngier@arm.com>,
alexios.zavras@intel.com, boris.ostrovsky@oracle.com,
allison@lohutok.net, jgross@suse.com, steve.capper@arm.com,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
LKML <linux-kernel@vger.kernel.org>,
James Morse <james.morse@arm.com>,
info@metux.net
Subject: Re: [PATCH 1/3] arm/arm64/xen: use C inlines for privcmd_call
Date: Fri, 22 Nov 2019 00:35:24 +0000 [thread overview]
Message-ID: <20191122003524.GH25745@shell.armlinux.org.uk> (raw)
In-Reply-To: <20191122003403.GG25745@shell.armlinux.org.uk>
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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-11-22 0:35 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-21 18:48 [PATCH 0/3] Use C inlines for uaccess Pavel Tatashin
2019-11-21 18:48 ` [PATCH 1/3] arm/arm64/xen: use C inlines for privcmd_call Pavel Tatashin
2019-11-22 0:22 ` Russell King - ARM Linux admin
2019-11-22 0:30 ` Pavel Tatashin
2019-11-22 0:34 ` Russell King - ARM Linux admin
2019-11-22 0:35 ` Russell King - ARM Linux admin [this message]
2019-11-22 0:39 ` Pavel Tatashin
2019-11-22 0:53 ` Russell King - ARM Linux admin
2019-11-21 18:48 ` [PATCH 2/3] arm64: remove uaccess_ttbr0 asm macros from cache functions Pavel Tatashin
2019-11-21 18:48 ` [PATCH 3/3] arm64: remove the rest of asm-uaccess.h Pavel Tatashin
2019-11-22 1:26 ` Max Filippov
2019-11-22 2:20 ` Pavel Tatashin
-- strict thread matches above, loose matches on Subject: below --
2019-11-27 18:44 [PATCH 0/3] Use C inlines for uaccess Pavel Tatashin
2019-11-27 18:44 ` [PATCH 1/3] arm/arm64/xen: use C inlines for privcmd_call Pavel Tatashin
2019-11-29 15:05 ` Julien Grall
2019-12-04 17:58 ` Pavel Tatashin
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=20191122003524.GH25745@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=alexios.zavras@intel.com \
--cc=allison@lohutok.net \
--cc=boris.ostrovsky@oracle.com \
--cc=catalin.marinas@arm.com \
--cc=gregkh@linuxfoundation.org \
--cc=info@metux.net \
--cc=james.morse@arm.com \
--cc=jgross@suse.com \
--cc=jmorris@namei.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marc.zyngier@arm.com \
--cc=mark.rutland@arm.com \
--cc=pasha.tatashin@soleen.com \
--cc=sashal@kernel.org \
--cc=sstabellini@kernel.org \
--cc=stefan@agner.ch \
--cc=steve.capper@arm.com \
--cc=tglx@linutronix.de \
--cc=vladimir.murzin@arm.com \
--cc=will@kernel.org \
--cc=xen-devel@lists.xenproject.org \
--cc=yamada.masahiro@socionext.com \
/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).