Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4196197pxj; Tue, 25 May 2021 02:30:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRhVxsOOHisG2i4Hmn2+SAojJYlHEbmWrKExevrwYKc9IY278wwdiOi+KS4ikhtRpvARhS X-Received: by 2002:a05:6e02:104e:: with SMTP id p14mr22856347ilj.109.1621935039494; Tue, 25 May 2021 02:30:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621935039; cv=none; d=google.com; s=arc-20160816; b=ro2pnU8lpR2ZQPbmMLc93WkgNhpH3Fh9mu4g6++EbcvKF7CrI3XsT1gtZY8FmnWh7O 8MHEoQqR0D/vsofZ5R/TgjHYLBAQLxw3PL8omOxsVbbJBaa4+mPr1ReZGxQtaXH70sba PFUSLvGfYxBk9abnNBwbJzKLr9WZmvRLpiFoDC4snD+/oqeda+w6u8peN82lz6xJVMB/ gLg9t31VcCAwkjiRuXmeoWa61DxWLZErTSoauOlcUn9VCJD7BzvZGerOQQpK5QxchAjD 91V0TIKsJzAWWciv6/9SKSRruOUW4jatUzUikoguUt8Kc/bU6UdPSdOiCZCeTQ/1sMij ZyAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=H+1167+yV7PYchUIxIpvCLfF5JWRF7Pj6K7YzqQ8eOo=; b=vpAd1EnNYxx8eZzi61fXxcBv9cCT7hZ4y6G0yheEQAQaF/kvyxKxSoZm8ILcK3yTfv kjFymyIm+4V9uXv4Og4mh+eMxM/2v1cFKY60cmUWZ3S2ZJJ07LXgK81fopodChhP2ZQ7 eWP4BDuV7iHSdGp8bHiWneFTnoEC1CjJVVjCgd2AU/h9sHczKjDEGDtmm4JxVrLjvUxt T6pRwnPJGO9Kx0N4we11PR/Hx8cfLeJlYo0lH+sbuGcwo7ppiQArATwIHlcSOgjJB8yu V3TzimHPBhc5I1FgXRZb1nMFJtk0bQizINhTNyrIn4HzeveHehJTSsED/eMv8HvIBQR5 ppZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=vUC1ou2Z; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g8si16590041ilk.127.2021.05.25.02.30.25; Tue, 25 May 2021 02:30:39 -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=@linutronix.de header.s=2020 header.b=vUC1ou2Z; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232598AbhEYJav (ORCPT + 99 others); Tue, 25 May 2021 05:30:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232580AbhEYJas (ORCPT ); Tue, 25 May 2021 05:30:48 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54DFCC061574; Tue, 25 May 2021 02:29:18 -0700 (PDT) Date: Tue, 25 May 2021 09:29:15 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1621934956; 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=H+1167+yV7PYchUIxIpvCLfF5JWRF7Pj6K7YzqQ8eOo=; b=vUC1ou2Zx/3q43XMnFJIoBDw4VziBHrV06FygnLUusKSJddb1j6+heJ+anmchuRXMWtKyY oT+9T8XBMyEwg6J37HSucvuGc5RQkqwOyS5OCSKRKLdjB7eof/FV9NZpXme2KC7m0Imo37 syem6qbRAMdH9qsYpVqvUdYqqRUOKoml5Pro65ybrkrCNwV0jM9WON6ZwZBqE6YxRVZsI9 bFkavUXEaZgK3bxFzl9REpwfLMjeesngkvpHhLxNlu3Lq1tBSpOxiG26Srnnloz8hGPOqk jZUvD2h3jT7jShoCO6L3TOwkS0xsS847F8Y3BXuDE3FtPhaOuGn8Cyy8mBHKcQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1621934956; 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=H+1167+yV7PYchUIxIpvCLfF5JWRF7Pj6K7YzqQ8eOo=; b=x7YIzulZ0oU5dfywHXpN3ld+rWjVBD+TGj2swKOjQeCM1O5uhbNOjbg3Rn6uYNdPbxu6KH ShK7wAXRgO8hiuBA== From: "tip-bot2 for H. Peter Anvin (Intel)" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/irq] x86/kexec: Set_[gi]dt() -> native_[gi]dt_invalidate() in machine_kexec_*.c Cc: "H. Peter Anvin (Intel)" , Thomas Gleixner , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20210519212154.511983-7-hpa@zytor.com> References: <20210519212154.511983-7-hpa@zytor.com> MIME-Version: 1.0 Message-ID: <162193495525.29796.7060476140067087676.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/irq branch of tip: Commit-ID: 056c52f5e824c050c58fd27ea6d717cba32239c2 Gitweb: https://git.kernel.org/tip/056c52f5e824c050c58fd27ea6d717cba32239c2 Author: H. Peter Anvin (Intel) AuthorDate: Wed, 19 May 2021 14:21:52 -07:00 Committer: Thomas Gleixner CommitterDate: Fri, 21 May 2021 12:36:45 +02:00 x86/kexec: Set_[gi]dt() -> native_[gi]dt_invalidate() in machine_kexec_*.c These files contain private set_gdt() functions which are only used to invalid the gdt; machine_kexec_64.c also contains a set_idt() function to invalidate the idt. phys_to_virt(0) *really* doesn't make any sense for creating an invalid GDT. A NULL pointer (virtual 0) makes a lot more sense; although neither will allow any actual memory reference, a NULL pointer stands out more. Replace these calls with native_[gi]dt_invalidate(). Signed-off-by: H. Peter Anvin (Intel) Signed-off-by: Thomas Gleixner Link: https://lore.kernel.org/r/20210519212154.511983-7-hpa@zytor.com --- arch/x86/kernel/machine_kexec_32.c | 15 +------------ arch/x86/kernel/machine_kexec_64.c | 33 +---------------------------- 2 files changed, 4 insertions(+), 44 deletions(-) diff --git a/arch/x86/kernel/machine_kexec_32.c b/arch/x86/kernel/machine_kexec_32.c index 1e34fee..1b373d7 100644 --- a/arch/x86/kernel/machine_kexec_32.c +++ b/arch/x86/kernel/machine_kexec_32.c @@ -23,17 +23,6 @@ #include #include -static void set_gdt(void *newgdt, __u16 limit) -{ - struct desc_ptr curgdt; - - /* ia32 supports unaligned loads & stores */ - curgdt.size = limit; - curgdt.address = (unsigned long)newgdt; - - load_gdt(&curgdt); -} - static void load_segments(void) { #define __STR(X) #X @@ -232,8 +221,8 @@ void machine_kexec(struct kimage *image) * The gdt & idt are now invalid. * If you want to load them you must set up your own idt & gdt. */ - idt_invalidate(); - set_gdt(phys_to_virt(0), 0); + native_idt_invalidate(); + native_gdt_invalidate(); /* now call it */ image->start = relocate_kernel_ptr((unsigned long)image->head, diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c index c078b0d..131f30f 100644 --- a/arch/x86/kernel/machine_kexec_64.c +++ b/arch/x86/kernel/machine_kexec_64.c @@ -256,35 +256,6 @@ static int init_pgtable(struct kimage *image, unsigned long start_pgtable) return init_transition_pgtable(image, level4p); } -static void set_idt(void *newidt, u16 limit) -{ - struct desc_ptr curidt; - - /* x86-64 supports unaligned loads & stores */ - curidt.size = limit; - curidt.address = (unsigned long)newidt; - - __asm__ __volatile__ ( - "lidtq %0\n" - : : "m" (curidt) - ); -}; - - -static void set_gdt(void *newgdt, u16 limit) -{ - struct desc_ptr curgdt; - - /* x86-64 supports unaligned loads & stores */ - curgdt.size = limit; - curgdt.address = (unsigned long)newgdt; - - __asm__ __volatile__ ( - "lgdtq %0\n" - : : "m" (curgdt) - ); -}; - static void load_segments(void) { __asm__ __volatile__ ( @@ -379,8 +350,8 @@ void machine_kexec(struct kimage *image) * The gdt & idt are now invalid. * If you want to load them you must set up your own idt & gdt. */ - set_gdt(phys_to_virt(0), 0); - set_idt(phys_to_virt(0), 0); + native_idt_invalidate(); + native_gdt_invalidate(); /* now call it */ image->start = relocate_kernel((unsigned long)image->head,