Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1283335pxj; Sat, 15 May 2021 09:31:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzEbze+AhEUMzNgrly6u/nCByk3H5vQ2cYcZ5EjqDJjVunNNZLI0SqyD0Hn1arIJt/vyqyD X-Received: by 2002:a17:906:374b:: with SMTP id e11mr53976395ejc.328.1621096263020; Sat, 15 May 2021 09:31:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621096263; cv=none; d=google.com; s=arc-20160816; b=OabsZup8QAftIUAYOJ/VKwrb9oTQSVd36NXdI0ViluJ4ICoGvdOpJe7vr05w/F3SM5 JSOfZZwn9ShLo5QAm97CgvoyjcO7Q7E0pKpglfT69wBh+gs7lmMG5BQnq4xTymT2SzoT PuLBeRdy/rubtzYrs+PLQmLEdS9o/MQjgaZ0Cd7LShGbNFwq7m67nyqOBPdIN11icebj SddmZWg9E8xzeRuKHmiRsptx3KaOirlnemgkYTQkd9TanT2Gz6lYTml/ramu/8yomwlR yHKY4pFnF/Ch/kwfJs5rI9kRLHmDN2IQjFcm6V0rBjzogcrerfy4Tc5tjFyKHkFllmUD sN9Q== 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:dkim-filter; bh=Pp3H4wowDSakYjyqaCVoE74o+aiaxAZ5r2kcK+Y7ACE=; b=sUr4u0V21n3Plb1sUPsUVe4k8IKwnzlGcJCs5X35uuRlEGKxqyjzfBMCzh+bqKFEB2 pHOS46Kz63KubAX7FnBDpx3ZqGHVJAgAt0UF3rzs0y+bcvWIyYPYULSLpyKDIW3nlvnH YhqewdtMmkcQVtkFEsxO2u7QtjE7SsZALLZJFahnV8z84JJt4V0HSoi7yvo/hqS+FbTt whICbE8mfCsRNb8Iup+hKi+6i1iqDz9Bkmdeg3yOlb946Hk2EK5Kl7hKV5++tPpgbnYY h24xwoJFFkdYZ7RpSRaea+LiNadR7iEmLHpICgmdK1NFXwBFwyxRj1nnuBuyB0GE0yMG Huow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zytor.com header.s=2021042801 header.b=hJ1+CJ+o; 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=NONE dis=NONE) header.from=zytor.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p31si11026068edb.415.2021.05.15.09.30.19; Sat, 15 May 2021 09:31:03 -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=@zytor.com header.s=2021042801 header.b=hJ1+CJ+o; 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=NONE dis=NONE) header.from=zytor.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234844AbhEOBpm (ORCPT + 99 others); Fri, 14 May 2021 21:45:42 -0400 Received: from terminus.zytor.com ([198.137.202.136]:35017 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234798AbhEOBpe (ORCPT ); Fri, 14 May 2021 21:45:34 -0400 Received: from tazenda.hos.anvin.org ([IPv6:2601:646:8602:8be0:7285:c2ff:fefb:fd4]) (authenticated bits=0) by mail.zytor.com (8.16.1/8.15.2) with ESMTPSA id 14F1i7al3212185 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 14 May 2021 18:44:16 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 14F1i7al3212185 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2021042801; t=1621043056; bh=Pp3H4wowDSakYjyqaCVoE74o+aiaxAZ5r2kcK+Y7ACE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hJ1+CJ+o906g8q8XKq+iMMKIiGlfxMfyItoiqXknHkJq5Yi9kbhvKmvw5wIrCkgYB 3HVB1HlNdbNKWAVtoO025tRw+M7r1On1jbTDi0f890q3egLjpYV8QSrN7BtHj7G/hH B0HS73GJnL/hBydtltWBgfyDLymmGGHP/1uUnkP/W9i7yiJHPgJJO3NNgV/1OXrDS/ wvDrovmuHHgEHfASNCRhE5UShD3n96QVmSglLyidO+E9X202+eKpyyR1OMotrulcMK 39/IkUe9MxU0UGn2uWIrcfXxTNy2LKH4phj61gcc2uu+1PaJPo3qOhjAXqH+ubkNXh yyh9VPL/z++eg== From: "H. Peter Anvin" To: Thomas Gleixner , Ingo Molnar , Andy Lutomirski , Borislav Petkov , "H. Peter Anvin" Cc: Linux Kernel Mailing List Subject: [PATCH v2 5/9] x86/desc: add native_[ig]dt_invalidate() to Date: Fri, 14 May 2021 18:43:57 -0700 Message-Id: <20210515014400.2999028-6-hpa@zytor.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210515014400.2999028-1-hpa@zytor.com> References: <20210515014400.2999028-1-hpa@zytor.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "H. Peter Anvin (Intel)" In some places, we want the native forms of descriptor table invalidation. Rather than open-coding them, add explicitly native functions to invalidate the GDT and IDT. Signed-off-by: H. Peter Anvin (Intel) --- arch/x86/include/asm/desc.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/arch/x86/include/asm/desc.h b/arch/x86/include/asm/desc.h index b8429ae50b71..aa366b2bbc41 100644 --- a/arch/x86/include/asm/desc.h +++ b/arch/x86/include/asm/desc.h @@ -224,6 +224,21 @@ static inline void store_idt(struct desc_ptr *dtr) asm volatile("sidt %0":"=m" (*dtr)); } +static const struct desc_ptr __invalid_gdt_idt_ptr __maybe_unused = { + .address = 0, + .size = 0 +}; + +static inline void native_gdt_invalidate(void) +{ + native_load_gdt(&__invalid_gdt_idt_ptr); +} + +static inline void native_idt_invalidate(void) +{ + native_load_idt(&__invalid_gdt_idt_ptr); +} + /* * The LTR instruction marks the TSS GDT entry as busy. On 64-bit, the GDT is * a read-only remapping. To prevent a page fault, the GDT is switched to the -- 2.31.1