From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1FF81C432C0 for ; Fri, 22 Nov 2019 00:35:44 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D9E5A206B6 for ; Fri, 22 Nov 2019 00:35:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="txsisENb"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="L+ozNyJ+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D9E5A206B6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gPGL/Q6Sc9a9cm7yqYD9HjFdNKQyhbfc4uNhQntZSL8=; b=txsisENbQILJaQ RwgQAKxJ96Vmkfrszs+/ExZ32I+1hsuvyM3mFhdCjpTHvEw07MJrLn9Pl9mpy4n53yVm7jRy3rjec 9NDIIabG8p7zlTZDVPHmJPzK7Bbz6DsoAxBT5nfZoepXRQoc08H95CRGSt5uTUoNVYP/Tk4MH9OAT zrMyfPOefEwRhzcreEhqbGTqLuu30bIBv30+auVUp+m8brnscNbN8zJoKtBT5PVcWNYKCsF0aUaR6 +jcoP73C4po8Fkay5ZciHPV0b0Dp3cQIzqA6qlP4G2Ju76ArAUSmJJPts77UUxjoU/KGakLD6b1NS vFYe/+b17dNmD1uOqAWA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iXwvH-0005aC-BQ; Fri, 22 Nov 2019 00:35:43 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:3201:214:fdff:fe10:1be6]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iXwvD-0005Zj-RR for linux-arm-kernel@lists.infradead.org; Fri, 22 Nov 2019 00:35:41 +0000 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=aNyMrZGi1ytX4T6Y1L2udQxbuMw2fttK87FjgMDAYUk=; b=L+ozNyJ+BLJds7rUUZwTGmJ7R 5e4PdATY1wuc72kBvYhSNqzWkMLSHsiNJaRKKZ+QW6c/CaPxnlL0mM/RPN1bk4jPOFZREl6QSpL4L U3SAD87N8NAF8bzJqfo9CxhGXIHbgmAZZDd6BRqC9ys8sxVq7Xz172xTF71hYopdiv8Ho/rc7y1Yp 9U9/ujkr8zeakeK8TCVh42YDuJelKERsJKDzxphKgN/A7SiBXQtk6Xcx/3Op+FveXgSucAFoCOSum XMJNkFyEpvPjQWNAF0yn6kqWii0P0XsxVVkOtrF7xV1CzBDQeXXUUFjx0ebt5BwyPw9NsN4yUw2ZV 6LjfuU4/g==; Received: from shell.armlinux.org.uk ([2002:4e20:1eda:1:5054:ff:fe00:4ec]:38750) by pandora.armlinux.org.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1iXwuz-0001fH-G7; Fri, 22 Nov 2019 00:35:25 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1iXwuy-0003Cf-Q2; Fri, 22 Nov 2019 00:35:24 +0000 Date: Fri, 22 Nov 2019 00:35:24 +0000 From: Russell King - ARM Linux admin To: Pavel Tatashin Subject: Re: [PATCH 1/3] arm/arm64/xen: use C inlines for privcmd_call Message-ID: <20191122003524.GH25745@shell.armlinux.org.uk> References: <20191121184805.414758-1-pasha.tatashin@soleen.com> <20191121184805.414758-2-pasha.tatashin@soleen.com> <20191122002258.GD25745@shell.armlinux.org.uk> <20191122003403.GG25745@shell.armlinux.org.uk> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20191122003403.GG25745@shell.armlinux.org.uk> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191121_163539_942389_EA8EB575 X-CRM114-Status: GOOD ( 16.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Catalin Marinas , stefan@agner.ch, Masahiro Yamada , Will Deacon , Thomas Gleixner , Sasha Levin , sstabellini@kernel.org, James Morris , Linux ARM , xen-devel@lists.xenproject.org, Vladimir Murzin , Marc Zyngier , alexios.zavras@intel.com, boris.ostrovsky@oracle.com, allison@lohutok.net, jgross@suse.com, steve.capper@arm.com, Greg Kroah-Hartman , LKML , James Morse , info@metux.net Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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