From patchwork Wed Jul 18 09:40:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 10531817 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 8C83B600F4 for ; Wed, 18 Jul 2018 09:41:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7E76F28FD5 for ; Wed, 18 Jul 2018 09:41:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 723C62900B; Wed, 18 Jul 2018 09:41:45 +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=unavailable 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 1E95528FD5 for ; Wed, 18 Jul 2018 09:41:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7EDEB6B0276; Wed, 18 Jul 2018 05:41:30 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 7C54B6B0278; Wed, 18 Jul 2018 05:41:30 -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 5F1EE6B0277; Wed, 18 Jul 2018 05:41:30 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by kanga.kvack.org (Postfix) with ESMTP id E23EC6B0273 for ; Wed, 18 Jul 2018 05:41:29 -0400 (EDT) Received: by mail-ed1-f69.google.com with SMTP id r21-v6so1627318edp.23 for ; Wed, 18 Jul 2018 02:41:29 -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=py3uRBEbzNRNczSezHkRmbKwiCkXwATJsymFfRUC3JU=; b=IaSbnP+lKkcWzbtVGckC3f74a1bHfpJJEr22N/4uk4X0kyYrU2cD+4+y9MkQ4atizY 7wq81D7ZN8+8Zh2juQnnv6xx938cNV8CI1xm/r2L3m38hn5XpifhcE1q7+RxNpam7K+p nMGWBWyWzSZGsjdy3iL7L+8nzmyOHmSbPIHH3HV6NSQlFHwMuyDPuQ8bL+ggDKMEFsCd rPsvrpDbx1QCMAFGMmVhAbuTPu/0fT6kH9y+Oi3Gc472ez5pCr9sCmKhd7wezuTms969 93OLbSQEcMPbAezOoZhNpS+aQXHHdSz1phKyEUh7aGkazLC18RQvCCfAa7ELXEaa4vOk ZZcQ== X-Gm-Message-State: AOUpUlG1nIAQceocIRCMFdZEC56p/TmUGydNDMlj8ces3BajgLYG5ha3 K5wtNMMIpZMdHwauY5E7OMebke1wgnAPnFKAyeFNacVPd1IUteZ9qiYovZKQ/nYiO3db/6mqlpH afxRnc/FXfzpCaPqwmTczLPwy0CFkoX0xbmpGxq4a7SwoPENoX4wRtoJUAhCG0a1qKA== X-Received: by 2002:a50:a804:: with SMTP id j4-v6mr6643194edc.61.1531906889493; Wed, 18 Jul 2018 02:41:29 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcFHmma8rYvXGuwOPos6qP0ho6vLaqpPmk0C1Rl2iiNkhb6/ewh5RldwkvmH+bCd0irN7sJ X-Received: by 2002:a50:a804:: with SMTP id j4-v6mr6643151edc.61.1531906888781; Wed, 18 Jul 2018 02:41:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531906888; cv=none; d=google.com; s=arc-20160816; b=EwFC9E/Qz7OYOvLS4IYM0qL+1c0I7rslf8e8AfDzuzC9KT3KH1FVV2OzuwaxbcMN1S /5ZW4UDUJp2lN61SyHMtywcPsWuDAflmHYdKNNcbR/r8a/9JFLDpidHAbyz2GU8p8bZj nEkjTYwONLAwy8UV7RIgigm0ia8G+W9G1hGNiEw45XZEdhpu+bWowOgKP6U7yDGCI9VH egbDMA0QoC81moJC8jmniCqB4sydWXpmzrA1RplM4dmV4WtK/L01+VRfyoGcR9CNeexH FQ19TyL7L43oz8ANGYQBohRWD117Zt0RUfxzEvxGLGIwfnN8+Rriax4c3mLr96CfiRez ydAA== 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=py3uRBEbzNRNczSezHkRmbKwiCkXwATJsymFfRUC3JU=; b=XItE9dep9alIf9FJzZX5ir5EiIiOnNGVT5Nb9JbD4Ekku3yb2AD8Ei/Vy3hhKzFaug S98S9hjYCt4DI9vsLMqj0VhHiWI25ohDZQmB5BEJF22OLQD0cT/cBB3OkYaF1I26r2oE JQFG0ViEOkB1aAzgsdLx8CNDP8uOKiKfo5uKONJvpHCKO4A4fbU+hyRNvX9ahPjNdad+ WISU+nmDhePth4POOLunPlCgLxjWLnAU5x8n85opugekGMXynDhRIYf1YI5wXa/d/A7H EWaHsdMCYBG/iGAzJKjRqr9qTx6L43dWn+KdRdH0naxnuBbLpHNRq3GASIqBCuN7lJlU pIxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@8bytes.org header.s=mail-1 header.b=kpXBKJ84; 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 w14-v6si2137488edf.375.2018.07.18.02.41.28 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Jul 2018 02:41:28 -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=kpXBKJ84; 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 F10431EB; Wed, 18 Jul 2018 11:41:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=8bytes.org; s=mail-1; t=1531906879; bh=tBQeAPEhZDXMWlEdVdPUoS/6lqKWJotcyx8Q5rA+wVw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kpXBKJ84Rnkydo9G99f0PrjyzUffqCvUUdM6KPpOqOCOqkxCUiPpHDzVbA+SiCTpG U5yjmYCRly+U+JbO8vZ54JIzgR7lzNS+jsVDxgEpgKoitbUO9/k6sL9wBgECoA5n58 CEWkseq0GKPT0LwUv370mIgJi3VZrn3JQjeiPrJP5FRypkdAjnz1HP7tR7/O+WLTmt 9T63Ca4ItJ+Xx6JXSe/giyxe9YyehwRXd8BmYzjgBEyW9Vycsiq5JSxZ3t9SgEozo2 lfivVVLhBB+tGYt7rA4VdWH6gVy+/U57DjBqZKA6QFnAzcFpTn2FaWtPEd+/uAa11w vAiUd3HncLMkg== 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, 18 Jul 2018 11:40:46 +0200 Message-Id: <1531906876-13451-10-git-send-email-joro@8bytes.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1531906876-13451-1-git-send-email-joro@8bytes.org> References: <1531906876-13451-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 a905e62..7635925 100644 --- a/arch/x86/entry/entry_32.S +++ b/arch/x86/entry/entry_32.S @@ -181,6 +181,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 @@ -227,6 +230,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) @@ -1161,7 +1168,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 @@ -1189,7 +1196,7 @@ ENTRY(nmi) .Lnmi_return: CHECK_AND_APPLY_ESPFIX - RESTORE_REGS 4 + RESTORE_ALL_NMI pop=4 jmp .Lirq_return #ifdef CONFIG_X86_ESPFIX32 @@ -1205,12 +1212,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