Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3927564ybc; Thu, 21 Nov 2019 16:26:57 -0800 (PST) X-Google-Smtp-Source: APXvYqwmM+rkjE7q8BEvwJKsss8GWf68BqQa6fQYvXkJuY0ETbOn6p/s52ByInQu3tiVTZ+3qleO X-Received: by 2002:a17:906:6b01:: with SMTP id q1mr17590641ejr.162.1574382417754; Thu, 21 Nov 2019 16:26:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574382417; cv=none; d=google.com; s=arc-20160816; b=oExMq0VPp7Rj+G3Q3smU+iyNdaorqP2cKsXfCq45OxdDYXawwDnKmnvbVVcqF0GKsx MIO3BniTz0e5aKrDtGldNFk+jRqWOIRCoDdrPzOEip8QndAODWACghnusTXIXqIidoR6 EE2wXOG6rlO6C4penBvhDxeRWAimprDIK10QFUtyDWJg9pupbPjWXcCgjLO2ydACW6gf JOVfauuKfu9Y36iN+039uC/gFDJfxoiBqMGuUkxjlhMBsCJHOMACjIDUPs8D9p7tAoYH Sa978C3Q/kMsghcbZFmDP7EhANyP7WWPY9lKV4JRjhQzFof4vtvvnGQo6ediColjPvjF 3rrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=o7hbwuPirwuuz0Y/+39p2Uj5Rp0ENQjemwmV/bfiS70=; b=pmlV7RPRJGrgbli3CUEOzfZV6npaiDuomn3nvwlbH7IwN5N020WWqN2T35f5ZaWeMH StkyT7V0TYZU4YBhJMtjK6AX4ECCRj5K4Em3oNfVo5yc5h3U8jRENI2SgYdXVfpC9cQ8 7n4iSjnAdjoR0Ot7hrV/i4ExMK03gIh0RqlSsPQQE/KR1Ou1cJQJxFQBgmLN8CHscKM9 BmjqIfIFZIHXNyvJLiTlAvHdVVm48Xe93ahp4yvG+I0tv6jZswqXVt9+rBAeCv/maJer ixUPHgf124DoR3XiwyQGwBkmiBF0NzSFZMf/Zm0gVfIMuEeYg41z3giUwf1Q/mqsOiky nkgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=lDIFDmcB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id no6si1057535ejb.203.2019.11.21.16.26.33; Thu, 21 Nov 2019 16:26:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=lDIFDmcB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726714AbfKVAX0 (ORCPT + 99 others); Thu, 21 Nov 2019 19:23:26 -0500 Received: from pandora.armlinux.org.uk ([78.32.30.218]:36096 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726265AbfKVAXZ (ORCPT ); Thu, 21 Nov 2019 19:23:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=o7hbwuPirwuuz0Y/+39p2Uj5Rp0ENQjemwmV/bfiS70=; b=lDIFDmcB6YuQuSGSZlFob0XEu OhD474Hwuwm4BhvW39/sq97d2A4scUWTlIgruSePYHHLwXTuvZd9/Q20du1X8udEiazjEEIqAUIWF Ir3W3OqWGvDVGQuJGVzMMS9QvGdJeCJBEURWMFWoIRXJr89V0FnZOv5Fa4HiHRPT1MZPxq470Pz9W z5ULDYDLKDSWnIOfRhi5FYvorVItrtOwGT8cxcze5eJnY61upZfjtjtUWo4mHYCgXKtaL3NLOx1Sn Ytk+lSYp6UglSzuJ8T0FIybi3aks+UMtn/vFO/bX4FlWtUHHxWicL/seNL8s7AagS6b9LXVAjpFlG iRmWpUnlQ==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:42882) by pandora.armlinux.org.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1iXwj5-0001as-MI; Fri, 22 Nov 2019 00:23:07 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1iXwiw-0003Br-8q; Fri, 22 Nov 2019 00:22:58 +0000 Date: Fri, 22 Nov 2019 00:22:58 +0000 From: Russell King - ARM Linux admin To: Pavel Tatashin 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 Message-ID: <20191122002258.GD25745@shell.armlinux.org.uk> References: <20191121184805.414758-1-pasha.tatashin@soleen.com> <20191121184805.414758-2-pasha.tatashin@soleen.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191121184805.414758-2-pasha.tatashin@soleen.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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 > > +#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