From patchwork Wed Dec 20 10:04:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 181585 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2537401dyi; Wed, 20 Dec 2023 02:16:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IGx5ypwWsZEWVb7mh8NYb86zCEvw9fzHlWZe2lCM7MSZeE0ibfCq92xVD5MVQlB0sIcICHv X-Received: by 2002:a17:906:644e:b0:a1f:6551:6405 with SMTP id l14-20020a170906644e00b00a1f65516405mr2629808ejn.37.1703067401363; Wed, 20 Dec 2023 02:16:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703067401; cv=none; d=google.com; s=arc-20160816; b=GDgSrju40a6PkcLUd60mflNlY8f5nP6QaiODDPn/i6xpkzVpYkV9IqPmb5LiY8yhes BncJUs73iSyUHdNAatTOfLAyRffuGD8YMA/XeHi8RZyfi6Lzv16dA5bIWR+n40uTxPLH 2tD34DfaSAfGAY2oAMvdrsd0PswJZNcYVm2RVv6F2PgC0qcSYHyXh92pGHj3ECmFfa3Z kv0HHlGK1v/FrY3WHuAX4lCEpYsvXOy6IC0q+TEbG2sNoBELkArIn2EdPO5ODOfsMzk0 sqk0cKzVUWM0SOdqTpRg62JG2ByVyNT4Hh/LqNInKhaGsTysWD9E1GDsjMlmZVyej+Pa Ebwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=yYfBJlxTG3aKsBJQ89DaFh+wXp49c/rVSIv+pRMLbPY=; fh=d3rITi3gY706tNT9KFsDpD/R32FlLciJYQ0Rks1Xg5k=; b=RP6dgQAO4BPxcxVXGBXjkHiI9OvVSTvCf7oeWYGYMI95Ct2RKlQyykRdlDDqqu+vwx +haEaOPggt1e8gYZsLx8YXDBFlzZ0yPBxwIUPt5p2CEcCiy1IslTs/edEAbBgN0vnqxi S0GR3KOOhEfudVZ838ZBnNX77y89Lr2gjka/dwCin/g5mxW5BwInZ8TwabtIoXRIfZJu x5XLe+F6Et9SFPgcuL58j8GyvIl8OSjeUmozmesW8OsCIxXNCAj5JuDXI869X8ue2hJn ZuUl+BK/YVR5zGQXzuSRDtDeiWdufxlZvHypvBjxLcGJK6yvEx8eFJyGl4pxMgWWXcxS Udpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Hizdu3wr; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="O3Dc/amU"; spf=pass (google.com: domain of linux-kernel+bounces-6687-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6687-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id m9-20020a1709060d8900b00a2685a293a1si1083029eji.362.2023.12.20.02.16.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 02:16:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-6687-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Hizdu3wr; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="O3Dc/amU"; spf=pass (google.com: domain of linux-kernel+bounces-6687-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6687-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E33FD1F271A6 for ; Wed, 20 Dec 2023 10:07:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 838E220B2E; Wed, 20 Dec 2023 10:04:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Hizdu3wr"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="O3Dc/amU" X-Original-To: linux-kernel@vger.kernel.org Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 174D920DEF; Wed, 20 Dec 2023 10:04:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Wed, 20 Dec 2023 10:04:01 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1703066642; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yYfBJlxTG3aKsBJQ89DaFh+wXp49c/rVSIv+pRMLbPY=; b=Hizdu3wrqHDrJ7Ob1tVJp9w3NJcLMHleWjrCzvzmnbzR7ZIAYsvUllBdrf9wE4rPDUxY7u O5Slukfn+NyFXCSVTmeq+US+PEpD53b/UudJo2KyvqJuRsBJZbnIvpxVD6/fE4WA0z2MBM a3ebd3J69pidNvz+CC5vi8Q6y234VOcsVhaX9siQZby6n1ZQ+d57jIOjQVbVUjyXD7wJHz dKAD2zirBY0NGn6FV5GvjjRgD0Tn4WZDH1a43CI+kIEGuGKQza4mtdQv8M3c/oAuFMJBby Yd6XmxQlnwg8QGjQoqqRbzF6yqMhUW4EfHJZkSAEPUmh4NPP6+++Oe8M/0BsWw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1703066642; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yYfBJlxTG3aKsBJQ89DaFh+wXp49c/rVSIv+pRMLbPY=; b=O3Dc/amU7ofRTkR2F8zJF/gJx6aE909qcMh/l6EIuATsBHgc06vRRZ8WbJ8XvZOJ64MTCW v+AmKNMDh9QSDZDw== From: "tip-bot2 for Vegard Nossum" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/asm] x86/asm: Replace magic numbers in GDT descriptors, preparations Cc: Vegard Nossum , Ingo Molnar , Linus Torvalds , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231219151200.2878271-3-vegard.nossum@oracle.com> References: <20231219151200.2878271-3-vegard.nossum@oracle.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <170306664164.398.4293804017901105347.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785795603465846799 X-GMAIL-MSGID: 1785795603465846799 The following commit has been merged into the x86/asm branch of tip: Commit-ID: 41ef75c848e33beb1f7b981866b62b0066f744c7 Gitweb: https://git.kernel.org/tip/41ef75c848e33beb1f7b981866b62b0066f744c7 Author: Vegard Nossum AuthorDate: Tue, 19 Dec 2023 16:11:57 +01:00 Committer: Ingo Molnar CommitterDate: Wed, 20 Dec 2023 10:57:20 +01:00 x86/asm: Replace magic numbers in GDT descriptors, preparations We'd like to replace all the magic numbers in various GDT descriptors with new, semantically meaningful, symbolic values. In order to be able to verify that the change doesn't cause any actual changes to the compiled binary code, I've split the change into two patches: - Part 1 (this commit): everything _but_ actually replacing the numbers - Part 2 (the following commit): _only_ replacing the numbers The reason we need this split for verification is that including new headers causes some spurious changes to the object files, mostly line number changes in the debug info but occasionally other subtle codegen changes. Signed-off-by: Vegard Nossum Signed-off-by: Ingo Molnar Acked-by: Linus Torvalds Link: https://lore.kernel.org/r/20231219151200.2878271-3-vegard.nossum@oracle.com --- arch/x86/boot/pm.c | 1 + arch/x86/include/asm/desc_defs.h | 2 ++ arch/x86/kernel/cpu/common.c | 8 -------- arch/x86/platform/pvh/head.S | 1 + arch/x86/realmode/rm/reboot.S | 1 + 5 files changed, 5 insertions(+), 8 deletions(-) diff --git a/arch/x86/boot/pm.c b/arch/x86/boot/pm.c index 40031a6..0361b53 100644 --- a/arch/x86/boot/pm.c +++ b/arch/x86/boot/pm.c @@ -11,6 +11,7 @@ */ #include "boot.h" +#include #include /* diff --git a/arch/x86/include/asm/desc_defs.h b/arch/x86/include/asm/desc_defs.h index 7c08cbf..33d229e 100644 --- a/arch/x86/include/asm/desc_defs.h +++ b/arch/x86/include/asm/desc_defs.h @@ -144,6 +144,7 @@ struct gate_struct { typedef struct gate_struct gate_desc; +#ifndef _SETUP static inline unsigned long gate_offset(const gate_desc *g) { #ifdef CONFIG_X86_64 @@ -158,6 +159,7 @@ static inline unsigned long gate_segment(const gate_desc *g) { return g->segment; } +#endif struct desc_ptr { unsigned short size; diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index b14fc8c..ceb6e4b 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -204,25 +204,17 @@ DEFINE_PER_CPU_PAGE_ALIGNED(struct gdt_page, gdt_page) = { .gdt = { * They code segments and data segments have fixed 64k limits, * the transfer segment sizes are set at run time. */ - /* 32-bit code */ [GDT_ENTRY_PNPBIOS_CS32] = GDT_ENTRY_INIT(0x409a, 0, 0xffff), - /* 16-bit code */ [GDT_ENTRY_PNPBIOS_CS16] = GDT_ENTRY_INIT(0x009a, 0, 0xffff), - /* 16-bit data */ [GDT_ENTRY_PNPBIOS_DS] = GDT_ENTRY_INIT(0x0092, 0, 0xffff), - /* 16-bit data */ [GDT_ENTRY_PNPBIOS_TS1] = GDT_ENTRY_INIT(0x0092, 0, 0), - /* 16-bit data */ [GDT_ENTRY_PNPBIOS_TS2] = GDT_ENTRY_INIT(0x0092, 0, 0), /* * The APM segments have byte granularity and their bases * are set at run time. All have 64k limits. */ - /* 32-bit code */ [GDT_ENTRY_APMBIOS_BASE] = GDT_ENTRY_INIT(0x409a, 0, 0xffff), - /* 16-bit code */ [GDT_ENTRY_APMBIOS_BASE+1] = GDT_ENTRY_INIT(0x009a, 0, 0xffff), - /* data */ [GDT_ENTRY_APMBIOS_BASE+2] = GDT_ENTRY_INIT(0x4092, 0, 0xffff), [GDT_ENTRY_ESPFIX_SS] = GDT_ENTRY_INIT(0xc092, 0, 0xfffff), diff --git a/arch/x86/platform/pvh/head.S b/arch/x86/platform/pvh/head.S index c4365a0..9bcafdd 100644 --- a/arch/x86/platform/pvh/head.S +++ b/arch/x86/platform/pvh/head.S @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include diff --git a/arch/x86/realmode/rm/reboot.S b/arch/x86/realmode/rm/reboot.S index f10515b..4476418 100644 --- a/arch/x86/realmode/rm/reboot.S +++ b/arch/x86/realmode/rm/reboot.S @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0 */ #include +#include #include #include #include