Received: by 10.223.176.5 with SMTP id f5csp727618wra; Fri, 9 Feb 2018 06:18:41 -0800 (PST) X-Google-Smtp-Source: AH8x224t5QSzIhuEEtLPJxP+M150gpJxbzaX7t46hoj/chv5Ym9BrJqjZ26ok/hCEjkh2bTU7IQb X-Received: by 2002:a17:902:6e4:: with SMTP id 91-v6mr2718322plh.26.1518185921667; Fri, 09 Feb 2018 06:18:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518185921; cv=none; d=google.com; s=arc-20160816; b=IafX05Ho6PNZVXImR+FZpIcbEg5C9PVxMWALlNYApq1ZDaQPUIgMK8USmN3TEj6sms kC23ixkzR8ns3SQ8MHsDVWCcXn548LT7FiuW9mho3u9xj0TkevG5wrm8Jdi3JZ4fw2Hb LF7zulzabqMVp3+Klk+UJTzmTbADstw7seRgUKfHtjGMb+oPH2SU0SGnqBFSMFy7yJ7D Z8o9uc03MQ15PedhVziTYbX0xtTzY1y63gkdQUVnCgdezo75wqsatUe/XO78dsGbQnw9 yGiTOLxoaOUMvERpt6mYVYiK2IMiuT/hKIM/AESybuWsdBltkGhjM4yEEBGV9DVi7YJA 048A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=5G3VjcOW+CZF3LTaF83ocnNeFX2n3DyMZf4AGBUS0dc=; b=cKxB/5d7mCzb1nyGuvjAUbi+3fCEos0JCJoDzqflRkZa9H0KjbVuOpdIiHyBjKQ2AL uc6Ucp7HD+3xcYZAc6ciyMq3YIn3KLSx1mUHvpLtWhu12cwStBZlsSTuZH5sEadLEfbi aDz/Iqo8T/zTKCVhF7rPJT7q9qSObavRgog3+uPWPHCgJCBZnH/fct5UoKfLvS1SnLtZ ZKPGG4swsfZwyAPmjrm77eVC4v2CpFeohZDZDFhIGZ0aapEq58mgvmrhabmuELDvpH6C mfvKl1yAGtGR9bGxjDhAEw0Io3WRGxNd6C8q7dTfq2RfYe34sFVTKjH8EYJ5FBaILlN9 a/qg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m27si1774062pfg.64.2018.02.09.06.18.27; Fri, 09 Feb 2018 06:18:41 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752046AbeBINkl (ORCPT + 99 others); Fri, 9 Feb 2018 08:40:41 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:48234 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750970AbeBINkh (ORCPT ); Fri, 9 Feb 2018 08:40:37 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 23DCE1027; Fri, 9 Feb 2018 13:40:36 +0000 (UTC) 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.9 02/92] powerpc/64: Add macros for annotating the destination of rfid/hrfid Date: Fri, 9 Feb 2018 14:38:31 +0100 Message-Id: <20180209133931.373303369@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180209133931.211869118@linuxfoundation.org> References: <20180209133931.211869118@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-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 @@ -51,6 +51,35 @@ #define EX_PPR 88 /* SMT thread status register (priority) */ #define EX_CTR 96 +/* 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 */ \