Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp525032iof; Mon, 6 Jun 2022 07:56:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJydMw7Vz1p2y7o9KNrPXBNUBgVmGA5XSJRWSeFf2+izp7GpY8QpVKqtfMlD20JFfH0xjuUm X-Received: by 2002:a63:2482:0:b0:3fc:55e3:1410 with SMTP id k124-20020a632482000000b003fc55e31410mr22368722pgk.583.1654527372820; Mon, 06 Jun 2022 07:56:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654527372; cv=none; d=google.com; s=arc-20160816; b=B8kFmQD33zChxTMWCqVsgNhKu5NXq/9DE+rhAAU36EwC1mzWTSQQE0lhXxAJOgDCQM zu/ZfeNFjeMWlh07NJEwc6K+JDXRVLBAq/4veuaKztS2nqZTd100h2JbnzHm7+sHqF2+ DadofIbrZZLNxFg6OCUOeysCr/EWpgKgPPO7mOJsgnhOOKMhrsF62omy0dvIAdA/oeJi txQrOc8QErfRShRwMLVzhP1eGUcja8ZMYStCEQvQWrvuqsOgZjKva2bY8mvh1aEebQgO H4m3tuHj5bwl6An+5sv3zKkQrQqVrFdAGz9T4cWfB5+sCELwLU5cgxGMuMws0GqrCHCj BL1A== 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=OkYs0lk3nHyAZKJDGCn/29siMwWnrfKmu5gV1SS4NfQ=; b=r+R3G8Cq3fb5EkXQ0YalXDOFwfoMKppU6Mpbt9froQlVLrbrDbgrzgNo9qMvL7R9P2 +nVNEqaWCbasapYLs3QtVX/RAgFIs4gVQNW769PGB84URXveHuaTzf8c+X9ShhJeizR0 0rXjdOlDruGq+bQApZRnHWcNYWidZD0F/2Z4v1Sh/2VBLpb7zoSKJ1GMA1qz/G1uvQCz lkzeZFiaDJ6fsmFszU5QZhjQJlMWMDeeHWzG850vzFK9ag2ZBy5Mneewil7TJzH7duMd mV4U+RPb5v39V6pXBJynHBCWb9yb4ns+n95Rs4UxmME2C9YGGIc3iWtRmFdZ1OY0phly kQQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=M8NSMNiA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id a187-20020a6390c4000000b003fc7efb0a2esi20549816pge.327.2022.06.06.07.56.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 07:56:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=M8NSMNiA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3A54150B3D; Mon, 6 Jun 2022 07:44:45 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239933AbiFFOoj (ORCPT + 99 others); Mon, 6 Jun 2022 10:44:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239910AbiFFOof (ORCPT ); Mon, 6 Jun 2022 10:44:35 -0400 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0232C50074 for ; Mon, 6 Jun 2022 07:44:34 -0700 (PDT) Received: by mail-pf1-x42b.google.com with SMTP id b135so12852471pfb.12 for ; Mon, 06 Jun 2022 07:44:33 -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=OkYs0lk3nHyAZKJDGCn/29siMwWnrfKmu5gV1SS4NfQ=; b=M8NSMNiAVGRL+nc2mCIZaZ52gNNlHv8ElkKTH8jMWhW6xYbpoJqgWNTveOmWj+1VvN 5Pxw/X7rDUCCWrK1Lwtx+GnHB4eRtniUw6zQyhdkyFaOYKRknod5kLfZ+gglaM1Jqkg5 FSmzdu/P7mLn7MDh8T3Bma2ZSKZySHLfNnoJgHM/WCQHuIokrSAR+VlZ67ouch65D4B/ 5kfFTTUK7MEXauaF7F71rJUaVFpwnHYP1XJ4Z7bg2zcgWDcY7GccWB7cOvKbySi+pkQP Zut6wSD1y0/SOXFnEVM5ZZaBfmzs+UUGCCpXYJb1muBe/pAGDHdBMmWy+RQGMgsdRbgk xx2Q== 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=OkYs0lk3nHyAZKJDGCn/29siMwWnrfKmu5gV1SS4NfQ=; b=MawyNES1m55mgst1rIGJ4vnpGhr3083aFepyJ8iZ20AKeJcSKjEQkgLUJmSS3ou4Wy ljSxJnY801z8X/UkjMTsq9IRncMAa2Lfrd/sBm33bTO9z4nkj3fO4F43Vo7/VOM3zIZn BfHjzAhxDTXs3wsvquNuRzRw7oVLCmHQv6biw1hW+dSTsriU5fG35ZP1emfT6p8x7fPS 7lQ+Rm32tUGXHRKXAggR2jhaYIHiMmtHz4IC6zTev2wRNpycci3bQ/PPsHcLIj7T4VfW Sz2xMeIkFzFv2HiuapDHDMAoJKKqN7v0Cq98h224yvPP0Ok2dfMI/o0MRLVYtW7yCPG5 CspA== X-Gm-Message-State: AOAM531HaaWNkJf5R9iqXvbrHqtQHhEixq0vKBuVYlJn9OdiMYtz86TA FZmkLl0oddDmg4WghLCjUGAfrcigy5Q= X-Received: by 2002:a65:6d87:0:b0:3fd:a62e:dc0a with SMTP id bc7-20020a656d87000000b003fda62edc0amr6427969pgb.286.1654526673290; Mon, 06 Jun 2022 07:44:33 -0700 (PDT) Received: from localhost ([198.11.178.15]) by smtp.gmail.com with ESMTPSA id iw22-20020a170903045600b0015e8d4eb2afsm10666584plb.249.2022.06.06.07.44.32 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Jun 2022 07:44:32 -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 V3 2/7] x86/entry: Move PTI_USER_* to arch/x86/include/asm/processor-flags.h Date: Mon, 6 Jun 2022 22:45:04 +0800 Message-Id: <20220606144509.617611-3-jiangshanlai@gmail.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20220606144509.617611-1-jiangshanlai@gmail.com> References: <20220606144509.617611-1-jiangshanlai@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 29b36e9e4e74..331a44994cc0 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