Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3920939ybb; Mon, 6 Apr 2020 19:22:14 -0700 (PDT) X-Google-Smtp-Source: APiQypLI7oOPeWgv2iZCQvqvr0wFu3rGGh6GJnuS+VSfMTGUkvytE98blMhLNOIll3iMGYNtLxQ4 X-Received: by 2002:a54:4e0e:: with SMTP id a14mr100332oiy.88.1586226133924; Mon, 06 Apr 2020 19:22:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586226133; cv=none; d=google.com; s=arc-20160816; b=Tdvckdr1cxs8JEOOlk1RiHCIwHrn7OBQMIrvpQCIQDK6v321HXLTLEoYABswGecDUq SO3LdOz4dn/C+Br/0viXX99VFMbfinEDnxjOIwwdgAwUdXTH0Go13HE2qxJjF6TMgNkb BGe8eJjfa6+weVETHPI6v24HoxJhjOq44mmNA+ijw7hDn9zGAteBZo87p514Pu6ubOCG U+ZcaJHVxbl5s5DTGamrt6dXkAsGTe9jcO1/mJxNJsv+kJRvLDVcfeLpHtnxz0/vszuj LQMSRZ26PoEb5AUxSQB97G/Ammo2wf4JGDQsKaUyz2ihsZx+LN5LbZ4GJcC5j8r/nX1+ XJ3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:date:from :dkim-signature; bh=d3OTp6P4iJBpO32UtjNgagNZnorXfs0OTex38lW1SVE=; b=t7He9S69K0ViOpTvuhEiNorPGJFT2sB0IszaQLg2SoixYYF8BXHo0RZdadLJQVKbX4 fmDS2YwY/gdDcS9IjhFeY8gQ3Ghu865lVvWvMc889wamZrpGzkLKv129IeUzEWiJFqMU ejEkqxY9Bfph2kBPK+E0bGSRoN/lBXDLc9h45jCqt9XofRpo+RJr1IKTozjA7Og2dKog qOGqZ/WOae03DpBwkPLqgZWZGPWVXLLJVwHnD0rcdEj+UfUF/ydyvhPmJl9zaLQEzN5m chkfQA8JpMNKfm5m6f8PwP1YucalAuFvXY0+WBenZ9h3CV/df01rNlMx0ci6e8e+QLKs 5kpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=VnfVn5XD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c22si65865oib.266.2020.04.06.19.22.01; Mon, 06 Apr 2020 19:22:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=VnfVn5XD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726481AbgDGCVd (ORCPT + 99 others); Mon, 6 Apr 2020 22:21:33 -0400 Received: from mail-qk1-f196.google.com ([209.85.222.196]:43971 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726310AbgDGCVd (ORCPT ); Mon, 6 Apr 2020 22:21:33 -0400 Received: by mail-qk1-f196.google.com with SMTP id 13so201148qko.10; Mon, 06 Apr 2020 19:21:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=d3OTp6P4iJBpO32UtjNgagNZnorXfs0OTex38lW1SVE=; b=VnfVn5XD09eRBnimploj/xWSm6LUt5UTw/kdQVNivaRARmZcQGlEg0ad4AT/uNyH1U OICvUgi3Xpnt2oRVXzDo8+rmnXTVKpFPZAcjvfNnHEsh5Iw3sKVsbIHngQYJ5LVTvWja D7sth7PFP/9nYi+ybYpJiAKZBd68zGWO7rLNIrbr4993aEZSgqLDpRfEziYa3W+tsKb3 UKDmiz3Tf/cQuT3gpDdnwDOesFS1OYz7YX5dgNFrpFYQAokyLNI+cnG6jQb2A0Muzaq5 6xz35Kffsdl7kPHOIBI3SunSe3bweGHZg6MMRa6TFOf4JlXyRea75KaGNMyKZ2QqkPpW YAvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:date:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=d3OTp6P4iJBpO32UtjNgagNZnorXfs0OTex38lW1SVE=; b=ZL3+zDCtSqk+OcbsAbvyXRVWuESw0iN622UCD1auB4IdpAjvfSs2tsHfLvrCKE4Thm ne4Zk/8w8WLXSxxZosgWj5tNX4pXRoehB5fWPSK5ZQuIdSPVzG0RpqVFbb5WOSlgEHk8 o1rwkj/7OtxwVNkD3HYv47tNNxyojQAwPa3jXCVgOz4mzvknPWWPNVm6+fEyJRuRmRFX hb/acuh2K3WZl14JXMVrM4u/LGtf2XMdx1HMClBh2LvuyyBAGuQI9s9JUzmgk4NTuiPe GJ/QPfLlHicsc34sXNmT7hhKaco+Bq13BoSYA6YDaNGQCaZMyuOzzJmHSzcMt4s1fDWH WNpQ== X-Gm-Message-State: AGi0PuYkKc9QrPZQ8e4lnxOaZNmMsjMr5ygsU9392flSRDqJ0Xoi+Wod +DLiGrAR2ebK/57+V5zAK8g= X-Received: by 2002:a37:7fc3:: with SMTP id a186mr46264qkd.251.1586226090068; Mon, 06 Apr 2020 19:21:30 -0700 (PDT) Received: from rani.riverdale.lan ([2001:470:1f07:5f3::b55f]) by smtp.gmail.com with ESMTPSA id f68sm15720856qtb.19.2020.04.06.19.21.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Apr 2020 19:21:29 -0700 (PDT) From: Arvind Sankar X-Google-Original-From: Arvind Sankar Date: Mon, 6 Apr 2020 22:21:27 -0400 To: Joerg Roedel Cc: x86@kernel.org, hpa@zytor.com, Andy Lutomirski , Dave Hansen , Peter Zijlstra , Thomas Hellstrom , Jiri Slaby , Dan Williams , Tom Lendacky , Juergen Gross , Kees Cook , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, Joerg Roedel Subject: Re: [PATCH 12/70] x86/boot/compressed/64: Add IDT Infrastructure Message-ID: <20200407022127.GA1048595@rani.riverdale.lan> References: <20200319091407.1481-1-joro@8bytes.org> <20200319091407.1481-13-joro@8bytes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200319091407.1481-13-joro@8bytes.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 19, 2020 at 10:13:09AM +0100, Joerg Roedel wrote: > From: Joerg Roedel > > Add code needed to setup an IDT in the early pre-decompression > boot-code. The IDT is loaded first in startup_64, which is after > EfiExitBootServices() has been called, and later reloaded when the > kernel image has been relocated to the end of the decompression area. > > This allows to setup different IDT handlers before and after the > relocation. > > Signed-off-by: Joerg Roedel > --- > diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S > index 1f1f6c8139b3..d27a9ce1bcb0 100644 > --- a/arch/x86/boot/compressed/head_64.S > +++ b/arch/x86/boot/compressed/head_64.S > @@ -465,6 +470,16 @@ SYM_FUNC_END_ALIAS(efi_stub_entry) > .text > SYM_FUNC_START_LOCAL_NOALIGN(.Lrelocated) > > +/* > + * Reload GDT after relocation - The GDT at the non-relocated position > + * might be overwritten soon by the in-place decompression, so reload > + * GDT at the relocated address. The GDT is referenced by exception > + * handling and needs to be set up correctly. > + */ > + leaq gdt(%rip), %rax > + movq %rax, gdt64+2(%rip) > + lgdt gdt64(%rip) > + > /* > * Clear BSS (stack is currently empty) > */ Note that this is now done in mainline as of commit c98a76eabbb6e, just prior to jumping to .Lrelocated, so this can be dropped on the next rebase. Thanks.