Received: by 10.223.185.116 with SMTP id b49csp2509938wrg; Thu, 15 Feb 2018 12:45:05 -0800 (PST) X-Google-Smtp-Source: AH8x225qnsnbABKPM5IYr+DoYssanncLo2TmIF6Y+6bHVvNcsU6gXPNNq/MhlcZPVXqgbIKyhFEK X-Received: by 2002:a17:902:5a88:: with SMTP id r8-v6mr3795064pli.426.1518727505258; Thu, 15 Feb 2018 12:45:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518727505; cv=none; d=google.com; s=arc-20160816; b=cErVbmihoAdDKb96NbZDGG8iwQVtkR/9piyix6OWVZ0MBJ9MroHyMST4vvC2Tjf8Kx bfORb+f5GDBa42NdgU/n+q9/6w28+NaUErkr/vymAmXylxsqXIdZL60x8+N6TjZMC7Mq RxRTRtkxeXqB1uXTFdM5L4/ir/6YWkUppuKMqRWy0I9duyBy3LFlop4cFnMY8T3x9Y/O mkeB9oKltNwqI4e/4V4kDjIWlACqKRAuWl9LCgrvR+1mLuoU61Vo0NcocamS4AIebYqS PTR8lAR08K9Tchr+aYD5ZIEnzCbY2ky1al2qQmsSSV4Hf+Y4FylB2ubKzLgIU6FrTwRs MGeQ== 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=YJCB/7umahOcSxDUIGemTgIudEOGydY5KvgWlWdqAk4=; b=xSQywrqryMrFXoH7uc5wWuJohND36kfi2G0goNwBDViEhgiRxKeMYegEFk7a9U0ioW PO3ar4WRFzTzZJ5wySNjIGhOgOSsvmZbvYcGuA/vhOMMGB+AW4F2Div/fO+Ie7kmgAI3 8ON/R9udbO7hGVl99CbItHVFmS1jOSLmNEldj6rwjyrs9cla0D1Yp3+YnUXBccRZHRSm u/NDC2xeZ6GNyv0jWvfS8urTEihNryxhCEemMkXJye896ff/iyInW2CUL8ysIK6LYcOQ pxH8yhVVcYy2fhtOrvHgmHaefP1WqyzxBGdMxAbnRxsWUYymQ/QhOKM6yKi9YWxCT4In JLwg== 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 z1-v6si1892924plb.178.2018.02.15.12.44.50; Thu, 15 Feb 2018 12:45:05 -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 S1161943AbeBOPVD (ORCPT + 99 others); Thu, 15 Feb 2018 10:21:03 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:48480 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161799AbeBOPU6 (ORCPT ); Thu, 15 Feb 2018 10:20:58 -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 CEF63110C; Thu, 15 Feb 2018 15:20:57 +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.4 006/108] powerpc/64: Add macros for annotating the destination of rfid/hrfid Date: Thu, 15 Feb 2018 16:16:03 +0100 Message-Id: <20180215151223.225237960@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151222.267507937@linuxfoundation.org> References: <20180215151222.267507937@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.4-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 @@ -50,6 +50,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) \ ld r12,PACAKBASE(r13); /* get high part of &label */ \