public inbox for linux-kernel@vger.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: jmorris@namei.org, sashal@kernel.org,
	linux-kernel@vger.kernel.org, catalin.marinas@arm.com,
	will@kernel.org, steve.capper@arm.com,
	linux-arm-kernel@lists.infradead.org, marc.zyngier@arm.com,
	james.morse@arm.com, vladimir.murzin@arm.com,
	mark.rutland@arm.com, tglx@linutronix.de,
	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,
	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:22:58 +0000	[thread overview]
Message-ID: <20191122002258.GD25745@shell.armlinux.org.uk> (raw)
In-Reply-To: <20191121184805.414758-2-pasha.tatashin@soleen.com>

On Thu, Nov 21, 2019 at 01:48:03PM -0500, Pavel Tatashin wrote:
> privcmd_call requires to enable access to userspace for the
> duration of the hypercall.
> 
> Currently, this is done via assembly macros. Change it to C
> inlines instead.
> 
> Signed-off-by: Pavel Tatashin <pasha.tatashin@soleen.com>
> ---
>  arch/arm/include/asm/assembler.h |  2 +-
>  arch/arm/include/asm/uaccess.h   | 32 ++++++++++++++++++++++++++------
>  arch/arm/xen/enlighten.c         |  2 +-
>  arch/arm/xen/hypercall.S         | 15 ++-------------
>  arch/arm64/xen/hypercall.S       | 19 ++-----------------
>  include/xen/arm/hypercall.h      | 23 ++++++++++++++++++++---
>  6 files changed, 52 insertions(+), 41 deletions(-)
> 
> diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h
> index 99929122dad7..8e9262a0f016 100644
> --- a/arch/arm/include/asm/assembler.h
> +++ b/arch/arm/include/asm/assembler.h
> @@ -480,7 +480,7 @@ THUMB(	orr	\reg , \reg , #PSR_T_BIT	)
>  	.macro	uaccess_disable, tmp, isb=1
>  #ifdef CONFIG_CPU_SW_DOMAIN_PAN
>  	/*
> -	 * Whenever we re-enter userspace, the domains should always be
> +	 * Whenever we re-enter kernel, the domains should always be
>  	 * set appropriately.
>  	 */
>  	mov	\tmp, #DACR_UACCESS_DISABLE
> diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h
> index 98c6b91be4a8..79d4efa3eb62 100644
> --- a/arch/arm/include/asm/uaccess.h
> +++ b/arch/arm/include/asm/uaccess.h
> @@ -16,6 +16,23 @@
>  
>  #include <asm/extable.h>
>  
> +#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;
> +
> +	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?

-- 
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:23 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 [this message]
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
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=20191122002258.GD25745@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