All of lore.kernel.org
 help / color / mirror / Atom feed
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>,
	boris.ostrovsky@oracle.com, 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, Thomas Gleixner <tglx@linutronix.de>,
	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: [Xen-devel] [PATCH 1/3] arm/arm64/xen: use C inlines for privcmd_call
Date: Fri, 22 Nov 2019 00:34:03 +0000	[thread overview]
Message-ID: <20191122003403.GG25745@shell.armlinux.org.uk> (raw)
In-Reply-To: <CA+CK2bDtADA2eVwJAUEPhpic8vXWegh8yLjo6Q6WmXZDxAfJpA@mail.gmail.com>

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.

-- 
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

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

WARNING: multiple messages have this Message-ID (diff)
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>,
	boris.ostrovsky@oracle.com, 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, Thomas Gleixner <tglx@linutronix.de>,
	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:34:03 +0000	[thread overview]
Message-ID: <20191122003403.GG25745@shell.armlinux.org.uk> (raw)
In-Reply-To: <CA+CK2bDtADA2eVwJAUEPhpic8vXWegh8yLjo6Q6WmXZDxAfJpA@mail.gmail.com>

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.

-- 
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

WARNING: multiple messages have this Message-ID (diff)
From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: Pavel Tatashin <pasha.tatashin@soleen.com>
Cc: James Morris <jmorris@namei.org>, Sasha Levin <sashal@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	steve.capper@arm.com,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	Marc Zyngier <marc.zyngier@arm.com>,
	James Morse <james.morse@arm.com>,
	Vladimir Murzin <vladimir.murzin@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	allison@lohutok.net, info@metux.net, alexios.zavras@intel.com,
	sstabellini@kernel.org, boris.ostrovsky@oracle.com,
	jgross@suse.com, stefan@agner.ch,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH 1/3] arm/arm64/xen: use C inlines for privcmd_call
Date: Fri, 22 Nov 2019 00:34:03 +0000	[thread overview]
Message-ID: <20191122003403.GG25745@shell.armlinux.org.uk> (raw)
In-Reply-To: <CA+CK2bDtADA2eVwJAUEPhpic8vXWegh8yLjo6Q6WmXZDxAfJpA@mail.gmail.com>

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.

-- 
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

  reply	other threads:[~2019-11-22  0:35 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-21 18:48 [Xen-devel] [PATCH 0/3] Use C inlines for uaccess Pavel Tatashin
2019-11-21 18:48 ` Pavel Tatashin
2019-11-21 18:48 ` Pavel Tatashin
2019-11-21 18:48 ` [Xen-devel] [PATCH 1/3] arm/arm64/xen: use C inlines for privcmd_call Pavel Tatashin
2019-11-21 18:48   ` Pavel Tatashin
2019-11-21 18:48   ` Pavel Tatashin
2019-11-22  0:22   ` [Xen-devel] " Russell King - ARM Linux admin
2019-11-22  0:22     ` Russell King - ARM Linux admin
2019-11-22  0:22     ` Russell King - ARM Linux admin
2019-11-22  0:30     ` [Xen-devel] " Pavel Tatashin
2019-11-22  0:30       ` Pavel Tatashin
2019-11-22  0:30       ` Pavel Tatashin
2019-11-22  0:34       ` Russell King - ARM Linux admin [this message]
2019-11-22  0:34         ` Russell King - ARM Linux admin
2019-11-22  0:34         ` Russell King - ARM Linux admin
2019-11-22  0:35         ` [Xen-devel] " Russell King - ARM Linux admin
2019-11-22  0:35           ` Russell King - ARM Linux admin
2019-11-22  0:35           ` Russell King - ARM Linux admin
2019-11-22  0:39           ` [Xen-devel] " Pavel Tatashin
2019-11-22  0:39             ` Pavel Tatashin
2019-11-22  0:39             ` Pavel Tatashin
2019-11-22  0:53             ` [Xen-devel] " Russell King - ARM Linux admin
2019-11-22  0:53               ` Russell King - ARM Linux admin
2019-11-22  0:53               ` Russell King - ARM Linux admin
2019-11-21 18:48 ` [Xen-devel] [PATCH 2/3] arm64: remove uaccess_ttbr0 asm macros from cache functions Pavel Tatashin
2019-11-21 18:48   ` Pavel Tatashin
2019-11-21 18:48   ` Pavel Tatashin
2019-11-21 18:48 ` [Xen-devel] [PATCH 3/3] arm64: remove the rest of asm-uaccess.h Pavel Tatashin
2019-11-21 18:48   ` Pavel Tatashin
2019-11-21 18:48   ` Pavel Tatashin
2019-11-22  1:26   ` [Xen-devel] " Max Filippov
2019-11-22  1:26     ` Max Filippov
2019-11-22  1:26     ` Max Filippov
2019-11-22  2:20     ` [Xen-devel] " Pavel Tatashin
2019-11-22  2:20       ` Pavel Tatashin
2019-11-22  2:20       ` Pavel Tatashin
  -- strict thread matches above, loose matches on Subject: below --
2019-11-27 18:44 [Xen-devel] [PATCH 0/3] Use C inlines for uaccess Pavel Tatashin
2019-11-27 18:44 ` [Xen-devel] [PATCH 1/3] arm/arm64/xen: use C inlines for privcmd_call Pavel Tatashin
2019-11-29 15:05   ` Julien Grall
2019-11-29 15:09     ` Andrew Cooper
2019-11-29 15:09       ` Andrew Cooper
2019-11-29 15:09       ` Andrew Cooper
2019-12-04 17:55       ` Pavel Tatashin
2019-12-04 17:55         ` Pavel Tatashin
2019-12-04 17:55         ` Pavel Tatashin
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=20191122003403.GG25745@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.