Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp443034lqg; Fri, 1 Mar 2024 09:43:36 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUBidcZ7SoqJUwdmz3CFBa5pzV5KLjlEKHuXMgJx37P8G1ugN5DWbRHG8zeRIrU4xPM+p+bNDQYITx3UvdpYSK7GLe17Q7c0Cs9HXTb2w== X-Google-Smtp-Source: AGHT+IEkrAL83tvQQHtSzEpL1SzZdvnBXyY4eBmvlrFT6CdDxHmeLKRaD79LOmsRzyTQIt1IDyUJ X-Received: by 2002:a05:6a00:1988:b0:6e5:3777:fcd3 with SMTP id d8-20020a056a00198800b006e53777fcd3mr3163926pfl.13.1709315016545; Fri, 01 Mar 2024 09:43:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709315016; cv=pass; d=google.com; s=arc-20160816; b=imdWPvSstZZcrs3I7ZyK/pEAzN9R1vy7Olzzl5fk0vim5VGxqWj+4jL+gWSvkGPQLc RIf4O/0QlN8/jY24vglgrqXl8BydpNHKLPjxMZ7xdqUKb3ULazlfF8h+okCU6SqdZyf6 YCGv5zbeCora1EGzc8HwaTcv4H4G0bmKzVW6TBa/nfu2UPRgW7siwhzVoeud9Uq/YaK1 cCIq/q1hXMCYjF0QEMjE/UQ2xC5yFWXoOc1LAKEf35KGD1bbj4Pi/Xji9kwzuHU87+Ci Lo7Mrp5iRA9ey7if8NkF0cVtfdfl+VRB06BVUsAefR1i6DZanljYQzFoFOQrVjz1+i2w iD0A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=0spoTuQNwBK1qcqroj+kYN6zrHCgNmlEdBFjW5XSE+g=; fh=cDHoXATbYNu4l85KZVSK4PkyqnGOGDn/kBaoOEMG9tU=; b=PeN7r+YhK95qf/g21/rPhgQJLmuazWFmkEfhJZi0jQHrNzrHcTsmDK3BXEQA2t+lm7 NGynh4pFjOKpWSA2W/euLFHrp1LtvQ2SkB5K+y2X6qKgiKDdwve2JPFosbJosAtXyby0 tKCcl8wWJgfUV/alFJA0rhl6UzzThgxFHtu7/mXj+X7EUutoPEZ8YLPwecJgy7GbJHaN QH1X499sUChrZLomRFTnHhG5Cfw/xPKhe37y5qXkwg7vCdDUe8lc7PSUWlhTJsQcQw61 1XJsIz2VfpDjLCxQCtX8xgSao6taRWxDeF8u2+df2UE2VM3Yl3RPh0tu9rJhbrkoNN6n nP1Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@alien8.de header.s=alien8 header.b=UTWarH1+; arc=pass (i=1 spf=pass spfdomain=alien8.de dkim=pass dkdomain=alien8.de dmarc=pass fromdomain=alien8.de); spf=pass (google.com: domain of linux-kernel+bounces-88841-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88841-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id o124-20020a62cd82000000b006e5605abd8bsi3875353pfg.344.2024.03.01.09.43.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 09:43:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88841-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=alien8 header.b=UTWarH1+; arc=pass (i=1 spf=pass spfdomain=alien8.de dkim=pass dkdomain=alien8.de dmarc=pass fromdomain=alien8.de); spf=pass (google.com: domain of linux-kernel+bounces-88841-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88841-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 8467828FF2C for ; Fri, 1 Mar 2024 17:35:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3BCA127459; Fri, 1 Mar 2024 17:33:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (4096-bit key) header.d=alien8.de header.i=@alien8.de header.b="UTWarH1+" Received: from mail.alien8.de (mail.alien8.de [65.109.113.108]) (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 137F525740 for ; Fri, 1 Mar 2024 17:33:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=65.109.113.108 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709314430; cv=none; b=td649d//Ke/jdf2owEWs3TmD08I0efQOtYAY6v0PFcdqHYxUdLIiWfLEwlH9kah/+cXTYd0HKR4wFSQoYJHg50tH/ig6WaXjjvuP1QF2JbhRXw+kEns/MS356/+gY+gUSPfByge2Y0K+9vDJqslLwJeOlur1JuekW14e8XFFk7k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709314430; c=relaxed/simple; bh=uPcrWwZo51EZo9dE7TOvBkTfx+6v7yhA6bRe7BwSO+0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Ie+9955uS/AJusdvTEJzAj55ZBbnIhNkBwqOUcNlC8VAWSBtKuXpt7kVrjPnwa78QdwjsBZ5+jAmqEF57HRYhAZmYdSPtnd5tw65JiP12KASAT+rqzTR6O63AlLT8L7UzpalHXVKU1DK2W/chhoSJEhHu1yGZ0PSDR4KtwSe+6o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=alien8.de; spf=pass smtp.mailfrom=alien8.de; dkim=pass (4096-bit key) header.d=alien8.de header.i=@alien8.de header.b=UTWarH1+; arc=none smtp.client-ip=65.109.113.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=alien8.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=alien8.de Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTP id 8C2CE40E0028; Fri, 1 Mar 2024 17:33:45 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at mail.alien8.de Authentication-Results: mail.alien8.de (amavisd-new); dkim=pass (4096-bit key) header.d=alien8.de Received: from mail.alien8.de ([127.0.0.1]) by localhost (mail.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 6E5IhuBVq3GX; Fri, 1 Mar 2024 17:33:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=alien8; t=1709314422; bh=0spoTuQNwBK1qcqroj+kYN6zrHCgNmlEdBFjW5XSE+g=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=UTWarH1+F3ypn+rMp1530yxS1poDgUq7Tm+/oBGi10vSklLnOV2oFwFu8NOTM6hb2 fpK2bKMZQulEvRVEa76LHm6gBBOA0GKvQwkvKWCcgG3rMpyDkOthba8QORvMTCohXv 3dN69w5idhdZO+1Y6QNlaaTAvld37Z6y4uYoJNEgAfihGhOHngn77ImkmwpJQAxThr oqDOwC0lPcDEURVvf1i5zTEAAxzRdkdNCJOURujATuEvFtaoDSgHYUmzSWeB4rX0mQ y4Bo+RJQErHw0jFfqRb3rae0DL9/qHQ91dR9kPwwE76q2WHiaiuaVNMNqaNF4yyGv6 38T0NrMM7arGfxy+Gw7JPDXocgCaJjiA5WDS1h/8/YGYBhx0dkAxjM+9tzyyt8CdQM neHAbJGRZkEYnrg2EYa80PASfZ68GSWzY3+mNWD27ymllMhVTiSc0MwPYeqUzLtYwt 4fw3RvtPsJ0q9EAoiBeoIMKtrzbCv9sVRntQjZblnR3q5g5TDZk1ZKD5OOsEsoNdff AXzwLLP6j0ruDGspiv8pK7bLW/fo2dJQIw4pFDGZYw6Aj2bDa9hKMVjm1Vy6BUqZ8o qnr9ka87yXK/eblWXUxPFoOct7tgzbqHLb91gzDcthlypxvsp8YmRxxHnfw4RoGLcR K8uB8p6UV5/RsEbxg2AEoAk8= Received: from zn.tnic (pd953021b.dip0.t-ipconnect.de [217.83.2.27]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id B1E1340E0196; Fri, 1 Mar 2024 17:33:31 +0000 (UTC) Date: Fri, 1 Mar 2024 18:33:23 +0100 From: Borislav Petkov To: Ard Biesheuvel Cc: Ard Biesheuvel , linux-kernel@vger.kernel.org, Kevin Loughlin , Tom Lendacky , Dionna Glaze , Thomas Gleixner , Ingo Molnar , Dave Hansen , Andy Lutomirski , Brian Gerst Subject: Re: [PATCH v7 2/9] x86/startup_64: Defer assignment of 5-level paging global variables Message-ID: <20240301173323.GDZeIRY_BVBqpudkEo@fat_crate.local> References: <20240227151907.387873-11-ardb+git@google.com> <20240227151907.387873-13-ardb+git@google.com> <20240228205540.GIZd-dzFYIBbtfIAo3@fat_crate.local> <20240301160921.GBZeH9sZhp73xX40ze@fat_crate.local> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: On Fri, Mar 01, 2024 at 06:09:53PM +0100, Ard Biesheuvel wrote: > On Fri, 1 Mar 2024 at 17:09, Borislav Petkov wrote: > > > > On Fri, Mar 01, 2024 at 11:01:33AM +0100, Ard Biesheuvel wrote: > > > The scenario that I have not managed to test is entering from EFI with > > > 5 levels of paging enabled, and switching back to 4 levels (which > > > should work regardless of CONFIG_X86_5LEVEL). However, no firmware in > > > existence actually supports that today, and I am pretty sure that this > > > code has never been tested under those conditions to begin with. (OVMF > > > patches are under review atm to allow 5-level paging to be enabled in > > > the firmware) > > > > Aha. > > > > I've built a debug OVMF image using the latest version of the series, > and put it at [0] > > Run like this > > qemu-system-x86_64 -M q35 \ > -cpu qemu64,+la57 -smp 4 \ > -bios OVMF-5level.fd \ > -kernel arch/x86/boot/bzImage \ > -append console=ttyS0\ earlyprintk=ttyS0 \ > -vga none -nographic -m 1g \ > -initrd > > and you will get loads of DEBUG output from the firmware first, and > then boot into Linux. (initrd can be omitted) > > Right before entering, it will print > > CpuDxe: 5-Level Paging = 1 > > which confirms that the firmware is running with 5 levels of paging. > > I've confirmed that this boots happily with this series applied, > including when using 'no5lvl' on the command line, or when disabling > CONFIG_X86_5LEVEL [confirmed by inspecting > /sys/kernel/debug/page_tables/kernel]. > > > [0] http://files.workofard.com/OVMF-5level.fd.gz Nice, that might come in handy for other testing too. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette