Received: by 2002:a05:6a10:8395:0:0:0:0 with SMTP id n21csp429562pxh; Wed, 10 Nov 2021 04:07:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJyPNT4NrFT/2Utc+rf3VkpAOE55Oxn0cK4Kjo1r0Ro1jwGOzjalgkRys/MbI+3shzIqUx+s X-Received: by 2002:a05:6402:26c5:: with SMTP id x5mr20789441edd.156.1636546071160; Wed, 10 Nov 2021 04:07:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636546071; cv=none; d=google.com; s=arc-20160816; b=YR5e1CStMy1XhY8jQdB0JNXDKQRORPaxLmDomBvwDiWt35Bh/D2X+Wc6wbk07AxNnC 1q9CRhudOne5ZCDNxSSSFUPWvh7y1Gq1x2zIgrq8nquBozSbdyJtutq0+kOirUGCJRTw VUyZPaVennVDkV9tF8Gr1vbJ9Lbk5/nnKSiRV+VH3H7tZ6LKp80oQG+JuAHSCgIJIJs5 7nkTSCTbshHB39Jy7S9osKqvsc8C2Vh9U0r6s3/mmc7EPiOWooxkJF+H1bNdKSet3xgU CKLE6IrRbZevmFMyXEXaobwL1H7x8vxQII+E7dPBiLJXY6FD31URhzWBlK8tptWPuhfv 27Eg== 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=X1SrmVsVj/8riq8Zu11HU29nfsCt2CipbOtY3TsCm9Y=; b=CkdXF4s7oTVgwKLMrLDNpjd2qamhNo65ZdwZ4DMEOPX7gvv6drJcDU7xARyYuZFQWr gCP2X2njzXTPPYH6GjhLVFdNjdfwF7CxBoLrOvGZxa50VCJDZjU1VkpKCvb1VKane6Ei efOqkgXaz35TOtkUeXDG1Vn62margHaujLv1KF67UiK9VP/a/P7fTgMyKk6m+fi1pbZP thqp5HVHZzVI0+IPkZxQr/oTrt5f36pJKSZBC6oL/bTCe7Y58LiUap6PAmRlV+vHgltm QkAD4OY1zxRjdUFbnAI9zu5AjbJYkmPRNpZO3QG0RSHbKnXh1LsFvYRWS4Egzn1SBlgI cEWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="LT/90z8Y"; 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 y24si19580663edl.115.2021.11.10.04.07.20; Wed, 10 Nov 2021 04:07:51 -0800 (PST) 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="LT/90z8Y"; 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 S231607AbhKJMEO (ORCPT + 99 others); Wed, 10 Nov 2021 07:04:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231555AbhKJMEO (ORCPT ); Wed, 10 Nov 2021 07:04:14 -0500 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4068C061764 for ; Wed, 10 Nov 2021 04:01:26 -0800 (PST) Received: by mail-pg1-x52c.google.com with SMTP id 200so2082406pga.1 for ; Wed, 10 Nov 2021 04:01:26 -0800 (PST) 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=X1SrmVsVj/8riq8Zu11HU29nfsCt2CipbOtY3TsCm9Y=; b=LT/90z8YJ/QbWW07QUH+vjcl+3wdr1fYB0bZS1zbG3ZRt8JjbgRcpThMkJyUswMVEv KfSph25OpOfKWM0S6YRr5sE7YUioq876SEiw8L2/e1HRHwrYYQGCHb6SaBErmsQEk3Lk qfRw0f11nn2AUG0HEHcGphIievu66ghWtrde3d9+H3iK5eCH4+w00+/mTaBkxzF2v6gc ZCeplsy0S1XYHb74F7KRJk+EAFj66+PLoaY4isgllyHUnTw1qC2JQsgMdav2YKEE1E8r E9LDo0UxcMsxJGvlyaGz3WqW0V5xwHJ8+dVGvJjIQfNL6vrNyABZhQJb8uZJ7rgZ0g65 NWhw== 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=X1SrmVsVj/8riq8Zu11HU29nfsCt2CipbOtY3TsCm9Y=; b=L91k6OTGXEcT1vu0xcPjShFIC36bZevwU7WAqjdzt1uZHNmIzK9cx7dCrY5NWGMIQY PC/dmWTIxo8RlBt1MwlE01B1PZfA4kbB8WNRaPspfsrfgsu//GBQOFtUiJOyL57AUpXl zeNv13x2OEuW7gvApr1+ou+rypIVyBV/EC+fX7B2uPv8yczKhoYWlVWqFzPnjogQbdIm tKjlbUENT5mi7WG3nlgzLKKTlARrfHbDonmdqQQN1tmPBWEXk5cYXTxCOZOoFqaucfCz OxaxnC85c++p1duVuBTl0yGSwVe0sQXtJJhI79S67ak6T6cMrN/+Q6/0JGsLchiEG2zg thTg== X-Gm-Message-State: AOAM531OPVuf/1VwHX526qNb5P8LQD8Wf93ByYraD8T+Zwo+ehtPeGlm jPk2rwt7+EEhAXN3aUIsEopNNhm0Iqc= X-Received: by 2002:a65:5589:: with SMTP id j9mr11275200pgs.291.1636545686306; Wed, 10 Nov 2021 04:01:26 -0800 (PST) Received: from localhost ([198.11.178.15]) by smtp.gmail.com with ESMTPSA id 145sm22090839pfx.87.2021.11.10.04.01.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Nov 2021 04:01:25 -0800 (PST) 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 V5 38/50] x86/entry: Add a C macro to define the function body for IST in .entry.text Date: Wed, 10 Nov 2021 19:57:24 +0800 Message-Id: <20211110115736.3776-39-jiangshanlai@gmail.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20211110115736.3776-1-jiangshanlai@gmail.com> References: <20211110115736.3776-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() macro to define C code to implement the ASM code which calls paranoid_entry(), cfunc(), paranoid_exit() in series for IST exceptions without error code. Not functional difference intended. Signed-off-by: Lai Jiangshan --- arch/x86/include/asm/idtentry.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/arch/x86/include/asm/idtentry.h b/arch/x86/include/asm/idtentry.h index cf41901227ed..0f615943a460 100644 --- a/arch/x86/include/asm/idtentry.h +++ b/arch/x86/include/asm/idtentry.h @@ -337,6 +337,20 @@ void ist_paranoid_exit(unsigned long cr3, unsigned long gsbase); __visible noinstr void kernel_##func(struct pt_regs *regs, unsigned long error_code); \ __visible noinstr void user_##func(struct pt_regs *regs, unsigned long error_code) +/** + * DEFINE_IDTENTRY_IST_ENTRY - Emit __entry_text code for IST entry points + * @func: Function name of the entry point + */ +#define DEFINE_IDTENTRY_IST_ETNRY(func) \ +__visible __entry_text void ist_##func(struct pt_regs *regs) \ +{ \ + unsigned long cr3, gsbase; \ + \ + ist_paranoid_entry(&cr3, &gsbase); \ + func(regs); \ + 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