From patchwork Wed Jul 11 11:29:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 10519445 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8B9D4603D7 for ; Wed, 11 Jul 2018 11:30:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F2B228D22 for ; Wed, 11 Jul 2018 11:30:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8D38D28D4E; Wed, 11 Jul 2018 11:30:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2187828D50 for ; Wed, 11 Jul 2018 11:30:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4F2086B0275; Wed, 11 Jul 2018 07:30:11 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 4CAFC6B027B; Wed, 11 Jul 2018 07:30:11 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 27BD06B027C; Wed, 11 Jul 2018 07:30:11 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by kanga.kvack.org (Postfix) with ESMTP id B627E6B0275 for ; Wed, 11 Jul 2018 07:30:10 -0400 (EDT) Received: by mail-ed1-f70.google.com with SMTP id r9-v6so6133408edh.14 for ; Wed, 11 Jul 2018 04:30:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references; bh=LvHd0mkadNuu39M7KqawUyw+SX//3in2eQxs+tc8wuw=; b=Ay12A4qm96kgy+x/lHkRwT4LZbO+JRnBTMdj6bj3Wu5AWocRd23XVAvYNh+SY3NyaI QP+7XdgYs6wjynhZKzAEMS7aaDafdqpbN7LaMCef8quN2YDm0iJj87xc/HdRwDUwkzef 6mNBxpbr4IJ5uYkMtOTCTDNHlMmczpnlPC1j+ESAqXHIsjbbQIn5ukcRTX1OTxJwISA9 pizAgGMWAIIUulm49JgQuejwaUBNIwng65f0JQxm6GvroRFmV/5ik1FXJJNWDxKDSitW jqCq0UvoMtk87Z+0srdvAQy+lksweWmFk9/7gkYyBg9aGytUxHJ6MOCkKgXkVHMuCYUx wHhw== X-Gm-Message-State: APt69E2ZywIV4cF5L2ywoTO5sXJtCyBpcE4QvcwzIZF9KT3NEoUBesPo +SiRr93/qQB1geC/JhKJpkDX/CT75YZdMaMaNV23zlKNEVB3afm0oX5tPDw8ak4OlbQwhFMOy45 AUag1f4r7K2Zu0tev2sfJ7JF1gAhM90a+QnUoI6+IL9AtwLgdwl9P21031Vej297QBg== X-Received: by 2002:aa7:d786:: with SMTP id s6-v6mr27593874edq.228.1531308610281; Wed, 11 Jul 2018 04:30:10 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcqwkxMDM7hM7aZUnBHUY+08U05QJlnFZzrfYg1bKKS3uzcVgh/o4hwp2swaAAJT3PWXsgP X-Received: by 2002:aa7:d786:: with SMTP id s6-v6mr27593830edq.228.1531308609609; Wed, 11 Jul 2018 04:30:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531308609; cv=none; d=google.com; s=arc-20160816; b=k/X4LPCi+B0467Jfcbkwn7twYXSOqh3X+zgUoOEOrDQIOJcYPtZvCa3qwmElgC8l2+ YX5F06Jdx/2Kp64R3pavrjk6rVx57J2qaP678aECqYvQ74k9VReaDbgPcw8q4sAZiWS0 EuvtwxE84miyLORZX3J+yKhe/IVoYxezFVd5j4nhL8WCN/jOlJmEc0ZDFhXWtNHrk0gK zlC2J7NBnWNuOhEIs3iBjB5dosBDBhfokloGXgUlQC3MyekQ69B8IYt3yN+kyCJRiXaD 0DzFpQuCTH7VKPyWh/Cf+xEURuzPA5UZMcPjVeQHRZjL7XExxQ6Tx+UNhfAtFNfIs3bu 2JOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=LvHd0mkadNuu39M7KqawUyw+SX//3in2eQxs+tc8wuw=; b=t+9em6dUP5LcrO8+lUPy+AfUk+lLT3zILWwZZBTWBaYcuiudhFt3Yp6gg7j7vxbPTD TB6SmBcPWyIdy8z35x2d8KVVC8rFrpcLE3mbFDgtnGSQ3LKAcRIPGk0L0b45t0o2Lw4j gA2PvXaJimkIAwVFQpFcnYcD0SBpp+BeMcc4lM3BvwO9m2uHTimcF1WE1cO+4xjTGxzM /f7eSWsesX2rEzqe25NzjuP7DySenKQPj8W5U7UhVOeg9tEGuqRIjkEaaqOqikNdkNV2 6BvA4uSKR7xWMT7d4TEQcJ9eLFTdYi3bKwUNo16INAITczDGatbPh8jdjNAxDcz31fr5 mv3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@8bytes.org header.s=mail-1 header.b=mqdU1iK7; spf=pass (google.com: domain of joro@8bytes.org designates 81.169.241.247 as permitted sender) smtp.mailfrom=joro@8bytes.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: from theia.8bytes.org (8bytes.org. [81.169.241.247]) by mx.google.com with ESMTPS id o34-v6si216973edb.336.2018.07.11.04.30.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Jul 2018 04:30:09 -0700 (PDT) Received-SPF: pass (google.com: domain of joro@8bytes.org designates 81.169.241.247 as permitted sender) client-ip=81.169.241.247; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@8bytes.org header.s=mail-1 header.b=mqdU1iK7; spf=pass (google.com: domain of joro@8bytes.org designates 81.169.241.247 as permitted sender) smtp.mailfrom=joro@8bytes.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: by theia.8bytes.org (Postfix, from userid 1000) id D2AF88BF; Wed, 11 Jul 2018 13:30:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=8bytes.org; s=mail-1; t=1531308601; bh=dE5Du25H3GHCdusG5adfggGX+IxWvScVWSNVItKKg/I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mqdU1iK78mrWr7uDZJgO4UjEWUJfhkf/d6NxKnvtUI06A74OuZTAxY3lmG1pGsSNy t7WQFxDNdZy7HdD5f1VoZpfDydzBPbHR7Ir181aHSd5mpXeEqtl9N7PYF6NQxuJgBT Doeh2IoDZbahHr1K2tiGhkGjMFIKscKOpzEMOfhQ94EsBnmriXEqklaYw59UweUvdP vZjmT86p8wAulSkPVn5tCZ8ill7h67TkTd63OZuUApofyr6LftB+qv+V0fCYbC819+ fxHps9vFI22nsaS0mbzB+5DNv50K9XdclA0LwmUf5hL17Xgo4VkwcAsTlFVkgtzK50 t6ip5+J/9mAaw== From: Joerg Roedel To: Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" Cc: x86@kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Linus Torvalds , Andy Lutomirski , Dave Hansen , Josh Poimboeuf , Juergen Gross , Peter Zijlstra , Borislav Petkov , Jiri Kosina , Boris Ostrovsky , Brian Gerst , David Laight , Denys Vlasenko , Eduardo Valentin , Greg KH , Will Deacon , aliguori@amazon.com, daniel.gruss@iaik.tugraz.at, hughd@google.com, keescook@google.com, Andrea Arcangeli , Waiman Long , Pavel Machek , "David H . Gutteridge" , jroedel@suse.de, joro@8bytes.org Subject: [PATCH 09/39] x86/entry/32: Introduce SAVE_ALL_NMI and RESTORE_ALL_NMI Date: Wed, 11 Jul 2018 13:29:16 +0200 Message-Id: <1531308586-29340-10-git-send-email-joro@8bytes.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1531308586-29340-1-git-send-email-joro@8bytes.org> References: <1531308586-29340-1-git-send-email-joro@8bytes.org> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP From: Joerg Roedel These macros will be used in the NMI handler code and replace plain SAVE_ALL and RESTORE_REGS there. We will add the NMI-specific CR3-switch to these macros later. Signed-off-by: Joerg Roedel --- arch/x86/entry/entry_32.S | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/arch/x86/entry/entry_32.S b/arch/x86/entry/entry_32.S index 357b82b..3d1a114 100644 --- a/arch/x86/entry/entry_32.S +++ b/arch/x86/entry/entry_32.S @@ -186,6 +186,9 @@ .endm +.macro SAVE_ALL_NMI + SAVE_ALL +.endm /* * This is a sneaky trick to help the unwinder find pt_regs on the stack. The * frame pointer is replaced with an encoded pointer to pt_regs. The encoding @@ -232,6 +235,10 @@ POP_GS_EX .endm +.macro RESTORE_ALL_NMI pop=0 + RESTORE_REGS pop=\pop +.endm + .macro CHECK_AND_APPLY_ESPFIX #ifdef CONFIG_X86_ESPFIX32 #define GDT_ESPFIX_SS PER_CPU_VAR(gdt_page) + (GDT_ENTRY_ESPFIX_SS * 8) @@ -1166,7 +1173,7 @@ ENTRY(nmi) #endif pushl %eax # pt_regs->orig_ax - SAVE_ALL + SAVE_ALL_NMI ENCODE_FRAME_POINTER xorl %edx, %edx # zero error code movl %esp, %eax # pt_regs pointer @@ -1194,7 +1201,7 @@ ENTRY(nmi) .Lnmi_return: CHECK_AND_APPLY_ESPFIX - RESTORE_REGS 4 + RESTORE_ALL_NMI pop=4 jmp .Lirq_return #ifdef CONFIG_X86_ESPFIX32 @@ -1210,12 +1217,12 @@ ENTRY(nmi) pushl 16(%esp) .endr pushl %eax - SAVE_ALL + SAVE_ALL_NMI ENCODE_FRAME_POINTER FIXUP_ESPFIX_STACK # %eax == %esp xorl %edx, %edx # zero error code call do_nmi - RESTORE_REGS + RESTORE_ALL_NMI lss 12+4(%esp), %esp # back to espfix stack jmp .Lirq_return #endif