From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x224Vs3Map91OtMarfCJk/b2gIcaYE9sPstBP6xWj8Lj+bJABN0YNVNgU93y/GI56/Q0J5pHp ARC-Seal: i=1; a=rsa-sha256; t=1516611067; cv=none; d=google.com; s=arc-20160816; b=PmDCn/miItsxCV7E0r096+2ACZOcf47ylgizfR017TLW3gLNK+apbfRm+WviANqXQf a/YM/cktVwRQbXbKEJqAyNu3N2nsvofOpcRXCOm9QC2ahNEa2Uczrq58uI/phJ7i16Nv /3L0pTxv82Mf2aCpHWodN12Nrv56IoATPjnFItaiotTB2jHRTJ4bs1KMkMl6wReUrbhg c5U1nuThOaTaDxBhQWhiLpU09CXRFjEZ+jcEboOEvuo+FmpouIu3W28Qud2zz2aJKyfi YxoDiAyCswb+QCt6DZBzpz51AtgYr5aH+iKjSfhbaN2TJwqJhtVVL3w+MmL2e1ZEl1b8 aLWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=909fbrDfbCj4Crrhd/8avsj73G81W630GdGPnNZj/zA=; b=xL8EMRLInUw95Xzu2LXkcn4dwLF6cu+ywwzDbIyivny8HEejKPofYoW1aEmRzdKY3k j28bqS5nRAOHN3fgGuNk4h2x5rgPtiBBOMyiOQqBQsqdAbPpAvmICKd0tGsfgWiocEAr PB0G8O+1fNtOI4YHtIlETsx1wQiGoLZCAgfoOj34EBWTO8BTCGw3pQbK30CVEKNNbfKe csDvIhssi0WWF652H2+Euc9b15bya+V7PH8ZVphpk56QY8tb+8pHP80yOtDF8uoFohLW rxltm9Ic+mWb2m7K7S46nunApJ9l8IpKWM2OU0Iq4kpvuFYkaUUCZGgEhYqpe5rrfOSD hjpA== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Piggin , Michael Ellerman Subject: [PATCH 4.14 07/89] powerpc/64: Add macros for annotating the destination of rfid/hrfid Date: Mon, 22 Jan 2018 09:44:47 +0100 Message-Id: <20180122083955.434722988@linuxfoundation.org> X-Mailer: git-send-email 2.16.0 In-Reply-To: <20180122083954.683903493@linuxfoundation.org> References: <20180122083954.683903493@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-LABELS: =?utf-8?b?IlxcU2VudCI=?= X-GMAIL-THRID: =?utf-8?q?1590281966128243751?= X-GMAIL-MSGID: =?utf-8?q?1590281966128243751?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Nicholas Piggin commit 50e51c13b3822d14ff6df4279423e4b7b2269bc3 upstream. The rfid/hrfid ((Hypervisor) Return From Interrupt) instruction is used for switching from the kernel to userspace, and from the hypervisor to the guest kernel. However it can and is also used for other transitions, eg. from real mode kernel code to virtual mode kernel code, and it's not always clear from the code what the destination context is. To make it clearer when reading the code, add macros which encode the expected destination context. Signed-off-by: Nicholas Piggin Signed-off-by: Michael Ellerman Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/include/asm/exception-64e.h | 6 ++++++ arch/powerpc/include/asm/exception-64s.h | 29 +++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) --- a/arch/powerpc/include/asm/exception-64e.h +++ b/arch/powerpc/include/asm/exception-64e.h @@ -209,5 +209,11 @@ exc_##label##_book3e: ori r3,r3,vector_offset@l; \ mtspr SPRN_IVOR##vector_number,r3; +#define RFI_TO_KERNEL \ + rfi + +#define RFI_TO_USER \ + rfi + #endif /* _ASM_POWERPC_EXCEPTION_64E_H */ --- a/arch/powerpc/include/asm/exception-64s.h +++ b/arch/powerpc/include/asm/exception-64s.h @@ -69,6 +69,35 @@ */ #define EX_R3 EX_DAR +/* Macros for annotating the expected destination of (h)rfid */ + +#define RFI_TO_KERNEL \ + rfid + +#define RFI_TO_USER \ + rfid + +#define RFI_TO_USER_OR_KERNEL \ + rfid + +#define RFI_TO_GUEST \ + rfid + +#define HRFI_TO_KERNEL \ + hrfid + +#define HRFI_TO_USER \ + hrfid + +#define HRFI_TO_USER_OR_KERNEL \ + hrfid + +#define HRFI_TO_GUEST \ + hrfid + +#define HRFI_TO_UNKNOWN \ + hrfid + #ifdef CONFIG_RELOCATABLE #define __EXCEPTION_RELON_PROLOG_PSERIES_1(label, h) \ mfspr r11,SPRN_##h##SRR0; /* save SRR0 */ \