Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1593668pxb; Tue, 26 Oct 2021 11:54:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBnnYiVje1XmC5m3ySuWaWaTtOA+cpnJallbaIEb7yyiBYbnmtXIQM/P/C4A9I2HukS5+m X-Received: by 2002:a17:90a:7d11:: with SMTP id g17mr536677pjl.19.1635274474262; Tue, 26 Oct 2021 11:54:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635274474; cv=none; d=google.com; s=arc-20160816; b=UmH1KtXsdD49ZUSfjTVnDhc8600Gtf0vWZYyygEA+BMzJ6kgKaWgTDPumoh08ucoug GmWx9KyGB6RmYYiMGKp/OuHONj9k7E6VEMiQxcJ5/eE/LgQjoLQsosqefLYexthEZTbL fC6zr/GkRkTXAe/3Bz8QAdygzzp4MgorQGPxPBYyQjeLHuizM5h72EuHTyAHD2UhO8pm 909I4XcAqCtHFVudAvrE+r+OAuO3vcx/Oeh7NgGoYSydGtdqtrsDEkiwyUxg38rDNBQx muOMy0Rf38ft02biVK3cL5kr4BUCx+FaGjQCg1CB5qrOvyqT8yGPhwZUcNBj8HlLYHhv 5N7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=s4xTx9uXh+TQYumyL6QT72i8i7PX2Kdt0mjHDXtVPEA=; b=LbxyznMJIXfKfiGnUrwi3mhMDVvY1gQtfiyXAAkhJFZmOFy7H4n0xXu/1TgNVbpQgv BFThQ870+ED6xxu8CW5FWRC0zLlWJRNAFAHTMqV+NVykgE3EV5goXker7Y0WcwcVZIEZ Oe1NuxDliXd2L7AdWT5mfUqRC7wZPlBeQIis8CHjFSHL21nPBB+Ts3mLiqiUFX4lFwg2 /ry2pmz3PPpfPO3/OckYV1RmYDasaSXEOMg/39R0bDDOuXjGZWTLeTA/ikxrBvzd9Zmp eEu8Z5LwGkn6c13lamvCkrk3ap46MjBf8Wntkp9ESXoJfhWyxI4gtXNghSDM/SqjVjJ7 xf6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="EHl3xDR/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id on1si2243809pjb.110.2021.10.26.11.54.17; Tue, 26 Oct 2021 11:54:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="EHl3xDR/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236825AbhJZOj0 (ORCPT + 99 others); Tue, 26 Oct 2021 10:39:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236757AbhJZOjN (ORCPT ); Tue, 26 Oct 2021 10:39:13 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3A94C061745 for ; Tue, 26 Oct 2021 07:36:49 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id na16-20020a17090b4c1000b0019f5bb661f9so1888995pjb.0 for ; Tue, 26 Oct 2021 07:36:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=s4xTx9uXh+TQYumyL6QT72i8i7PX2Kdt0mjHDXtVPEA=; b=EHl3xDR/Fb6/fJhOsAJRVI2qJpmBLVwsoJ1H9u22ysEQ/TziqM4jI9BFVXSLooTZJT rDqlpf0aTNOpnlO83uSbuS6yznb1D+Nl47i8d7XKv8+bHs7ykwqyOBgby8movi5OsLsy IbyYofaQP1tmKinx4LCaXgaQZPlKipK1flTyjT8SfsEqOIehBjU7+DPFgv/vfG/xyceA 5Nra1Flqwb/ybq1OgPoVBXLT7ycYUZqjkvxDKQKC6xAlbqSMIjjbBMgX9a8VWayJfxYa sXukEiSW7IZaY02OfX11SwqW/jbK4FF4XFrfGcbRNtDe9ZQbtMJTsaP3yiTT4fpftcQL LyJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=s4xTx9uXh+TQYumyL6QT72i8i7PX2Kdt0mjHDXtVPEA=; b=oDHqy1K7EsbUR3O9+WWqoavS3+AlyD0aE44NhbtlV2Ig3Hm91Ms3yCNFiMC44ryyXW bKU70fS4VywpYAWWVTBEMbpcbVZ2+vBIb/wIio/fb+UvKQYvAsh8TzvoM47jCRYS7Qni wJokB4VKA0itxDcm+8oNJMNU5NN+PjaBkT/5Cvv4Gg8JxXS+XgGHGvjIPZht2GY5q4AJ GcKhhSwDEeDnHctT53NviokUiLhl/GfpizcyeaTqVrBKXih0zlxmUo1INI8aqpYAreFH qXIEWvsHPj0tZGpKwuwuSGJt4EdlgHidUfsuXPc0mKQpBFm/1/ulq4yEXgIr8yl9IXqe 50Ew== X-Gm-Message-State: AOAM530Oi23ayJHhkGGoLWtKxDFYjilIM2w+z7x08msI39Tpe40UZhMT FyKmRJOCjAPta278GYqpjbaVbSrW+b4= X-Received: by 2002:a17:90b:38c1:: with SMTP id nn1mr14104131pjb.83.1635259009244; Tue, 26 Oct 2021 07:36:49 -0700 (PDT) Received: from localhost ([47.88.5.130]) by smtp.gmail.com with ESMTPSA id p1sm10821685pfo.143.2021.10.26.07.36.48 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Oct 2021 07:36:48 -0700 (PDT) From: Lai Jiangshan To: linux-kernel@vger.kernel.org Cc: x86@kernel.org, Lai Jiangshan , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Juergen Gross , "Peter Zijlstra (Intel)" , Joerg Roedel Subject: [PATCH V4 43/50] x86/entry: Add a C macro to define the function body for IST in .entry.text with an error code Date: Tue, 26 Oct 2021 22:34:29 +0800 Message-Id: <20211026143436.19071-18-jiangshanlai@gmail.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20211026141420.17138-1-jiangshanlai@gmail.com> References: <20211026141420.17138-1-jiangshanlai@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lai Jiangshan Add DEFINE_IDTENTRY_IST_ETNRY_ERRORCODE() macro to define C code to implement the ASM code which calls paranoid_entry(), modify orig_ax, cfunc(), paranoid_exit() in series for IST exceptions with an error code. Not functional difference intended. Signed-off-by: Lai Jiangshan --- arch/x86/include/asm/idtentry.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/arch/x86/include/asm/idtentry.h b/arch/x86/include/asm/idtentry.h index 57636844b0fd..c57606948433 100644 --- a/arch/x86/include/asm/idtentry.h +++ b/arch/x86/include/asm/idtentry.h @@ -351,6 +351,22 @@ __visible __entry_text void ist_##func(struct pt_regs *regs) \ ist_paranoid_exit(cr3, gsbase); \ } +/** + * DEFINE_IDTENTRY_IST_ENTRY_ERRORCODE - Emit __entry_text code for IST + * entry points with an error code + * @func: Function name of the entry point + */ +#define DEFINE_IDTENTRY_IST_ETNRY_ERRORCODE(func) \ +__visible __entry_text void ist_##func(struct pt_regs *regs) \ +{ \ + unsigned long cr3, gsbase, error_code = regs->orig_ax; \ + \ + ist_paranoid_entry(&cr3, &gsbase); \ + regs->orig_ax = -1; /* no syscall to restart */ \ + func(regs, error_code); \ + ist_paranoid_exit(cr3, gsbase); \ +} + /** * DEFINE_IDTENTRY_IST - Emit code for IST entry points * @func: Function name of the entry point -- 2.19.1.6.gb485710b