Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3711460iob; Tue, 17 May 2022 05:57:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwkK4p420TudGbIlxp67luEHhJjubYYIFf1ZmWwTNPvMCBRvpF1d99nCTb3dAXSHTjFIMKI X-Received: by 2002:a17:907:60d3:b0:6f5:c4c3:2f96 with SMTP id hv19-20020a17090760d300b006f5c4c32f96mr19476136ejc.724.1652792277436; Tue, 17 May 2022 05:57:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652792277; cv=none; d=google.com; s=arc-20160816; b=rdohWiWVPcvSGWRPqI0kab4Vn/ySDRJUBSWLoQMxDqpRZtricMIqLDpuaJn2P1N0B8 gTHoUUdLNbLNRejklC0RTONJSPvnuHsaTXLKglDAGMurfq80+nxi+9qhsnaBxUPv26/z ofv6d4B8idGLCoGjFiRr+ZBFbynUVItiJUH58TutO9Diii/hKlmxA8dF3/D39Mu9fVD4 brUebjN0n3sIovVpYnWLLfcBmgvifZ3wWkMqVGhnRUZvF8X8ZvMtFgNUwacPliZ46wvY SmwZoN68JPIbZaU2RP0r+NHfx/k5RfvKKWIKVaqwOXi+iyG4ZIkah5JErPOlKr3xKZEK Jd2g== 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=EGwJvdx17QQnoYP69Pr2C9PuIA0fCg3Px0T/9mdBCv4=; b=eSMRfcUpSP83YqjMBTbK3QMwUHm6E7K6hWM6ajuUkwD4WsK0eikLq0o16rEMIPnjW0 oBONRRzwzk3aYE0K9xoddeta2QgCZjI0ZDAW30OYvKQyPgZ4IHrfRuuQXaEsrBVozDsU prWEIRhCBoEuCSUzu8i+MtOy6aNxwHVpRvqs1mv1Atz9m+Iyngh9kFFqPu5LoOyGbHKc n7jpwQnLQlBS/H4VSa0bzZXM6az6MxNJtxLUy94NFQHWVzhYjwK2y7ltg84tmmlZsAhL LqECtN+uPW0bdcDiHruCGm6r6baiOZ7fhCAraCI1QI5FQCG8e6v82o6Jipa7mAsU/zek vgZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="Sa/AVjaJ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ne6-20020a1709077b8600b006e7f47d22a9si2745109ejc.434.2022.05.17.05.57.30; Tue, 17 May 2022 05:57:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="Sa/AVjaJ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S241730AbiEPNRP (ORCPT + 99 others); Mon, 16 May 2022 09:17:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243733AbiEPNRI (ORCPT ); Mon, 16 May 2022 09:17:08 -0400 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A9C324595 for ; Mon, 16 May 2022 06:17:07 -0700 (PDT) Received: by mail-pg1-x52e.google.com with SMTP id 202so14042090pgc.9 for ; Mon, 16 May 2022 06:17:07 -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=EGwJvdx17QQnoYP69Pr2C9PuIA0fCg3Px0T/9mdBCv4=; b=Sa/AVjaJl2CVdPszAmhuAcV6Mbr8GE/PU96pQtUg/45ECD7xZOOycZUec+JP53+ZSK BiLVmf9tWXJUKBCn6Y4nfbsLs6zqCclJaeurHB3WwZAqQ6CP0ut+8CW5iZlfg18H8CNl 0zndtNZTvH33J1UGPxBUoupht6P5COVr5yqjVa+9ySiAJ3lRhgwpR6I1GC9AHRV8qsH3 PmI42q7EWuEud2ryZmi424LzgHEPuHn5lM0EdAjsqgnc+kV6LURWvpPRfNRPBfhsRZOL o3hc1nOS7QpB4vjBU+QCLNtE+v0AmGoGmI0eioBkhne9tDrhkrpPpZO6Pl5z8FU2Lv2d YsrQ== 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=EGwJvdx17QQnoYP69Pr2C9PuIA0fCg3Px0T/9mdBCv4=; b=0AP2vnt9Gi0hIaf3aPa/5e9sQDe/sCe+L873DaMHu+R0qzyLhXDmJy3e8gccof/p3r DgVXQ+qF4K4SR4OhlbnmpUaeQNDJy9+NkLHu4zN8HYV1ndFbXBLk+jub3oKoZX5MnDUW hNBnOIZMrtHbyWBQ3qLU5qDrNFqt0mMZ6b9ND+avm4iGciqEHFgd1jIVcggaCkmhhQRR GF4vDNaq559JXffH+EuJnXGVigyQqU6Q0rxyM8Bzm8iQXmlLKY+cCaGBxI61nIbusmho 02ClCso7wxkVSbGtoQcB4A6QXlJYtZ1W1iy7FgYBTwPqRD675zRTqryQeJaK+F/DReSL CTKA== X-Gm-Message-State: AOAM530tsuFEkvoIYYuv17sSePsuPfma7KI0Ujm7CqxFbtHciDgE4j// 6UH7RN7fxXiqvHbiFEOR+v3tsXxqljk= X-Received: by 2002:a63:f959:0:b0:3da:ed42:5f7c with SMTP id q25-20020a63f959000000b003daed425f7cmr15331306pgk.361.1652707026802; Mon, 16 May 2022 06:17:06 -0700 (PDT) Received: from localhost ([47.251.4.198]) by smtp.gmail.com with ESMTPSA id cu8-20020a056a00448800b0050dc76281b3sm6935816pfb.141.2022.05.16.06.17.06 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 May 2022 06:17:06 -0700 (PDT) From: Lai Jiangshan To: linux-kernel@vger.kernel.org Cc: Borislav Petkov , Peter Zijlstra , Josh Poimboeuf , Andy Lutomirski , Thomas Gleixner , x86@kernel.org, Lai Jiangshan , Ingo Molnar , Dave Hansen , "H. Peter Anvin" Subject: [PATCH V2 2/7] x86/entry: Move PTI_USER_* to arch/x86/include/asm/processor-flags.h Date: Mon, 16 May 2022 21:17:33 +0800 Message-Id: <20220516131739.521817-3-jiangshanlai@gmail.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20220516131739.521817-1-jiangshanlai@gmail.com> References: <20220516131739.521817-1-jiangshanlai@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lai Jiangshan These constants will be also used in C file. Move them to arch/x86/include/asm/processor-flags.h which already has a kin X86_CR3_PTI_PCID_USER_BIT defined. Signed-off-by: Lai Jiangshan --- arch/x86/entry/calling.h | 10 ---------- arch/x86/include/asm/processor-flags.h | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/arch/x86/entry/calling.h b/arch/x86/entry/calling.h index a97cc78ecb92..f0f60810aee7 100644 --- a/arch/x86/entry/calling.h +++ b/arch/x86/entry/calling.h @@ -142,16 +142,6 @@ For 32-bit we have the following conventions - kernel is built with #ifdef CONFIG_PAGE_TABLE_ISOLATION -/* - * PAGE_TABLE_ISOLATION PGDs are 8k. Flip bit 12 to switch between the two - * halves: - */ -#define PTI_USER_PGTABLE_BIT PAGE_SHIFT -#define PTI_USER_PGTABLE_MASK (1 << PTI_USER_PGTABLE_BIT) -#define PTI_USER_PCID_BIT X86_CR3_PTI_PCID_USER_BIT -#define PTI_USER_PCID_MASK (1 << PTI_USER_PCID_BIT) -#define PTI_USER_PGTABLE_AND_PCID_MASK (PTI_USER_PCID_MASK | PTI_USER_PGTABLE_MASK) - .macro SET_NOFLUSH_BIT reg:req bts $X86_CR3_PCID_NOFLUSH_BIT, \reg .endm diff --git a/arch/x86/include/asm/processor-flags.h b/arch/x86/include/asm/processor-flags.h index 02c2cbda4a74..4dd2fbbc861a 100644 --- a/arch/x86/include/asm/processor-flags.h +++ b/arch/x86/include/asm/processor-flags.h @@ -4,6 +4,7 @@ #include #include +#include #ifdef CONFIG_VM86 #define X86_VM_MASK X86_EFLAGS_VM @@ -50,7 +51,21 @@ #endif #ifdef CONFIG_PAGE_TABLE_ISOLATION + # define X86_CR3_PTI_PCID_USER_BIT 11 + +#ifdef CONFIG_X86_64 +/* + * PAGE_TABLE_ISOLATION PGDs are 8k. Flip bit 12 to switch between the two + * halves: + */ +#define PTI_USER_PGTABLE_BIT PAGE_SHIFT +#define PTI_USER_PGTABLE_MASK (1 << PTI_USER_PGTABLE_BIT) +#define PTI_USER_PCID_BIT X86_CR3_PTI_PCID_USER_BIT +#define PTI_USER_PCID_MASK (1 << PTI_USER_PCID_BIT) +#define PTI_USER_PGTABLE_AND_PCID_MASK (PTI_USER_PCID_MASK | PTI_USER_PGTABLE_MASK) +#endif + #endif #endif /* _ASM_X86_PROCESSOR_FLAGS_H */ -- 2.19.1.6.gb485710b