Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1558797pxb; Tue, 26 Oct 2021 11:13:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVzaercUOKBJNsI2TPXV+gaJe+qpmD0YsCJLbFZNISgDRfPkEvLEvNKOsgc0aEplJHXg3c X-Received: by 2002:a17:90b:4b03:: with SMTP id lx3mr302052pjb.51.1635272017254; Tue, 26 Oct 2021 11:13:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635272017; cv=none; d=google.com; s=arc-20160816; b=fFxg4p5fz+v+/M47GkbsojvvlMp9SBZpo1bGPCzYGJdnX5xLdPnTWrzZ0gg6YJRcgn pDYoH8cUc4xr1D7LNhhqP09Pvrk14L5XFRHkpii0K/pdzLQ8TdyRQNSfXjFnNqE5pPsL mbOfaNjlPM+1K/odpT0RUgNcb8iz5zGovf+spWnjpxn16bhlKkOa8CEm6K2z8rmsUEIS ZJjdqedIsV/rZl995gcsCKqKZSpNrfbRmjoYI+gTlr4yTwVckoqwSxGNVH2jURbWymgP UUuiIVMSe8rQztrN0CsxohOCnlRuCycZr+m1ihUSxONrlM9rIfT+x6o/EbhPPxMZ4t4S F4EQ== 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=P6Gz7Sa13Nz5wo9ag7NEcCeQMS9LijqUptPqbUded4Q=; b=zCgjQOmzilnTuDRzf/syvCVMXkQmiDnyKXjANrAkJ0q3CBILLIaNlFKrKD0lZ3pxeG LXy/yUM9HSR37yCiE1Or0RtCPN0DVAKP8T1cyKrD09eOlG216yOnAK5+NwDIXO141I0R GJ6B4xTYpubbhlM8nnPbH6s5EVeK/UiG5Qk5OhKUH0veCqqSoolMPkXv4bMDG1/Cq5Hh Pk/DcV4ODBWkqfoZ1/tHFEJW/Iq1B9MxATODuBnnW0OsIuO0u4jplkH72RaxAyTeetDo 5ncVjHYhFvwPxzi5a1+vVQKVG6wLC33WVQDpTQ5IC0MDe6t9Hk3yUuaskgm9MwqxknMJ a7BA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=SaA1NiEk; 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 207si1885210pgc.350.2021.10.26.11.13.21; Tue, 26 Oct 2021 11:13:37 -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=SaA1NiEk; 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 S236526AbhJZOaw (ORCPT + 99 others); Tue, 26 Oct 2021 10:30:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236548AbhJZOam (ORCPT ); Tue, 26 Oct 2021 10:30:42 -0400 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 970C3C061220 for ; Tue, 26 Oct 2021 07:28:18 -0700 (PDT) Received: by mail-pg1-x535.google.com with SMTP id 75so14323768pga.3 for ; Tue, 26 Oct 2021 07:28:18 -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=P6Gz7Sa13Nz5wo9ag7NEcCeQMS9LijqUptPqbUded4Q=; b=SaA1NiEkGHtN4J7DUi4X7jm28lADdnHv49wQpaqQkXFoB3SNf/82h5rLTh4jJY4Btt sFX2i9TuLjwdwGWgH7TovhRpmtYSb8F3S8/SF+Js4n7qJH5WqiiAObzWOKaCxGiQUoOZ lRjd5HXOhUrmi/i/sVwbQZ4i2aUE1KBlebPKGVkCZ5Jw2u4FeUV8ILl9fCefkH06AWF5 YP6cWCZozd8+6gVWPwKbpp86ulEUgae4TWI0CNK4fQp1aZJ1mby9DfMh2H9mdK8yLgM/ gifQFzxuM+NzCSPWqivCCRVQXJHkJg8aSzz1bC/gIZ1wCvIuwe44h0xPltgYmEjt9ujs KNAA== 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=P6Gz7Sa13Nz5wo9ag7NEcCeQMS9LijqUptPqbUded4Q=; b=F72jRUhdAFHXp9ZgAUsIz7vapA0q4zWLyKn84bpCjRN4m0TPVhfRE1HRFj/GYANn3R Tv8hUdBnpAKMPPg4tgoBh/GqcNYln9YbYJ12lUIHliY4fx+wVL6B3jnhFs3xlVAttCJy MhWSJYASAuiaDlv5qma78Habnw0RNbemcos40jRvYNzqvPtETEoN1yNuhxNh2ePIR+Oq +0A4c2/x0Xg7zivOiUAc5A5tV/eEWHvgu3Yxha7YEJ89mfu5qmqpsTfqwUQDadGs0azB RmGraXdoWA0YZrMnqH/5qpBfrNYX+hNsj1fgfZOXO3Zf/8OOw6jZez6qg8bOGqOO1xWg DhyA== X-Gm-Message-State: AOAM532xygXAvqxwA9Lye+R1az1YTIiDUo7rTRkcFElB97A+eCopWRjZ SOGHjVJCFuKFEqwT6zoLxlQ7rxTlSYA= X-Received: by 2002:a65:55c5:: with SMTP id k5mr4400286pgs.471.1635258498025; Tue, 26 Oct 2021 07:28:18 -0700 (PDT) Received: from localhost ([47.88.5.130]) by smtp.gmail.com with ESMTPSA id v8sm1228106pjd.7.2021.10.26.07.28.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Oct 2021 07:28:17 -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" , Ben Widawsky , Dave Jiang , Dan Williams , Peter Zijlstra , Kees Cook Subject: [PATCH V4 11/50] x86: Mark __native_read_cr3() & native_write_cr3() as __always_inline Date: Tue, 26 Oct 2021 22:27:43 +0800 Message-Id: <20211026142824.18362-1-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 We need __native_read_cr3() & native_write_cr3() to be ensured noinstr. It is prepared for later patches which implement entry code in C file. Some of the code needs to handle KPTI and has to read/write CR3. Signed-off-by: Lai Jiangshan --- arch/x86/include/asm/special_insns.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/special_insns.h b/arch/x86/include/asm/special_insns.h index 68c257a3de0d..fbb057ba60e6 100644 --- a/arch/x86/include/asm/special_insns.h +++ b/arch/x86/include/asm/special_insns.h @@ -42,14 +42,14 @@ static __always_inline void native_write_cr2(unsigned long val) asm volatile("mov %0,%%cr2": : "r" (val) : "memory"); } -static inline unsigned long __native_read_cr3(void) +static __always_inline unsigned long __native_read_cr3(void) { unsigned long val; asm volatile("mov %%cr3,%0\n\t" : "=r" (val) : __FORCE_ORDER); return val; } -static inline void native_write_cr3(unsigned long val) +static __always_inline void native_write_cr3(unsigned long val) { asm volatile("mov %0,%%cr3": : "r" (val) : "memory"); } -- 2.19.1.6.gb485710b