Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1801306pxj; Wed, 19 May 2021 14:23:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwLtXP0k9Lbokf9Vm9W5yi8NA8g/HAN7eYXFpLYdThLhiWOoo7HYop5bQ+3BSfpDBae3943 X-Received: by 2002:a92:d24a:: with SMTP id v10mr1138933ilg.247.1621459389203; Wed, 19 May 2021 14:23:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621459389; cv=none; d=google.com; s=arc-20160816; b=YEKN7XYL8ZadVSdBXEC+AvCyzA8uITDXhpbsa5yy99dtvWAtR5UOyOBF/s1JXY4gma JygUQuTCn6R/aF8fLWU6Y94I3ltZw+tPFGiEIGEHCDSE52hAxnkPhZPLnal6LWyaabRS Fvs2kLrS5fp2o/0KMzRjBIPPffkNQMVo1ITo6GpRftT++oE/aALOhDD2rADnDGlXBXoi WdiH1hE7W4wylQE3QmrddQZnd8KjQfn6Y3qO5vxrxwANgqnIrPRXtp5rIr6eHdYIBAC6 B7Gdfx2OYD/OYTu6v3yQesOytDDbEWEc77Rsz9aq9d0E7zdLzwhqAaApzOZpv3b4zTGh Dv9w== 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=XOgTt/mBuEZ+uV89tStLvmmy0bfAE5L/fc5xFERnK2g=; b=EHEPU5KMH6+qVa5mPSnpN5JAY84Tkvm/YVKv7bz7c0jCy4NLNTnfRSb5697MrsfTZo NrO5GOhh3Mqu3vai0Xx85PNN7jSABYk7+QM2IOJL5ylwvlO/wL84zRvtEPWPEvIFRCcM 9wNX/PmcSdSthJ3y+fDM4KFhIipqFbzBKSUv+t1K8txiYm/cZNGqaqvngO/Ovivq+eZ4 R5vH1V8k4pUVY4I3wRQ8ytHvaciA6U6NB2XVW7or/ozw4heGnCeC67zAV69mkBW55BAp 1/rpbQzkCn5AmtZC9bAa9cutX13LpYPe5tyuqiXiAB5j3HkHGP5PeRLfKiBW0WgLAoms +8pQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zytor.com header.s=2021042801 header.b=aH5XZztX; 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 p5si920187ilm.11.2021.05.19.14.22.54; Wed, 19 May 2021 14:23:09 -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=aH5XZztX; 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 S229610AbhESVXn (ORCPT + 99 others); Wed, 19 May 2021 17:23:43 -0400 Received: from terminus.zytor.com ([198.137.202.136]:33339 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229498AbhESVXm (ORCPT ); Wed, 19 May 2021 17:23:42 -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 14JLM1Ed4187848 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 19 May 2021 14:22:12 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 14JLM1Ed4187848 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2021042801; t=1621459332; bh=XOgTt/mBuEZ+uV89tStLvmmy0bfAE5L/fc5xFERnK2g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aH5XZztXrMcSwVNOk3EPWIICT3MlLis4no0kQVBd0JWPHKJGhOflW5Mj394jaAmcZ dz+3L4BoV6eexJNf7Z1XKME0WBnv0ZAbMpJR871Do3YNXHybbsx0533/q29EGVTntB 3eMboN16wk9MCXwu21SavlC6tNPjiGwRWknf9DzEKP44+pXrEYcYN2t89GxSDEUSgx Sy/Ybw3rLAnWjGIiRl4vGbPeJehXKIye0uyFp/C0pt1G+ouDmm/NKwtNWz6lTtgtot Y774RJgKeDmx7pq+k8OR/b6XNuyF01+zTNLDANnVOwgfxHANoQzJV3YlMDqoaWzllg Fh/iLSYNZb0YA== From: "H. Peter Anvin" To: Thomas Gleixner , Ingo Molnar , Andy Lutomirski , Borislav Petkov , "H. Peter Anvin" Cc: Linux Kernel Mailing List Subject: [PATCH v3 5/8] x86/desc: add native_[ig]dt_invalidate() to Date: Wed, 19 May 2021 14:21:51 -0700 Message-Id: <20210519212154.511983-6-hpa@zytor.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210519212154.511983-1-hpa@zytor.com> References: <20210519212154.511983-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 | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/arch/x86/include/asm/desc.h b/arch/x86/include/asm/desc.h index b8429ae50b71..400c17862870 100644 --- a/arch/x86/include/asm/desc.h +++ b/arch/x86/include/asm/desc.h @@ -224,6 +224,26 @@ static inline void store_idt(struct desc_ptr *dtr) asm volatile("sidt %0":"=m" (*dtr)); } +static inline void native_gdt_invalidate(void) +{ + const struct desc_ptr invalid_gdt = { + .address = 0, + .size = 0 + }; + + native_load_gdt(&invalid_gdt); +} + +static inline void native_idt_invalidate(void) +{ + const struct desc_ptr invalid_idt = { + .address = 0, + .size = 0 + }; + + native_load_idt(&invalid_idt); +} + /* * 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