Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp423330lqp; Wed, 22 May 2024 08:27:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWmLUldi4bIUpcdy0AFzslXj59dey8vEJFqi5pSobacO+OK+IQi3JoUCZzMaZnFOJZExfYVj4Z/+l9akpezOvvtTVRBRnjdoNbZOdkCXg== X-Google-Smtp-Source: AGHT+IGx0rF+5/KcolvuIqPvJURAW1V9OhfNHsV0UJXNn5kCcDvJ+/L9QP9x/ZwaWlYdS/Hgp71k X-Received: by 2002:a05:6a20:551d:b0:1b1:f122:6610 with SMTP id adf61e73a8af0-1b1f87f9c2amr1984052637.26.1716391668784; Wed, 22 May 2024 08:27:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716391668; cv=pass; d=google.com; s=arc-20160816; b=Es1Cxd947Uz0swpcUShUi825CIiY6dXEFAzFqS/WLbMoW6GP1IZReiUhsAMSxNqZiQ zVJuekAvyTzy19cXgjZjim4259Yd6rgJlg8uvzaVw7D3PajST0y7yyY5TN2nyOoRGKkO 09OYJLePGpEN1e3n5R+8gDt27aw0qOcbSRChpaGnsPExIz4CEcHHBwPC0phw0QsUqSK+ 7l9M/BgpNQzPEypmIbbmyp2+FzEn1zinXNZ9taDitLkmVOPFjQYKi2n70GADQ7bER2AX +IdzR94qY2+53KaTD73A9o8+2v5IYbNsTbK3n9E/y5Glg5Z4zXOJYn0CQVz5aNI4yjD3 WRNA== 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=OB6gaqSjxiAFW2RlpmSCnZD7Qhpu4drPtRMxzaVxZVU=; fh=yOXSm0E/8tOfmRnhk0JfE6MKLQieMwDr2DHng9Fw+Y4=; b=1C1XAztVtkMbTsOL9Px3CYPIDcMQT6ZnCj6aqZRipI0YuNJzNHKDnHTtPbpH3ZKYvE 1ljjwWOSTDKYI+4e4wtVjeRvtlaRPA+/9sbjgGBN7XqDOHlf6kjjdWH6JVFEyYNo3M/J M6z0VxWLDJWXMcQIqiW6dsE8hz6CtLF1pteCBPG9facROSdCXdXtelFjZZ44HCixXH/o Keb3BJmam7iv155Wy54O4CzNfSlHl1K1VTVobse4vYdLYevQgwKgO5MUqrjsdsPdMIN4 P2XoTkjg54v2f81GvxlPHSNYolI0/5OtQ+KLDPL4XazAAMMJGPIuAfxQ8J1kVVwBqOVt ZSsA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@alien8.de header.s=alien8 header.b=A8fJFvta; 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-186429-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-186429-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. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-63412a4ddd7si25924967a12.688.2024.05.22.08.27.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 08:27:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-186429-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=alien8 header.b=A8fJFvta; 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-186429-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-186429-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 6A570283AF6 for ; Wed, 22 May 2024 15:27:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5B3AE77116; Wed, 22 May 2024 15:27:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (4096-bit key) header.d=alien8.de header.i=@alien8.de header.b="A8fJFvta" 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 654E4200DE for ; Wed, 22 May 2024 15:27:38 +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=1716391661; cv=none; b=Vc38reJaZPhAclu0ObwybEefXhm/cH80CjXY5U61bq9lP2RCVYvbX96CHpddJewCN94xVvsVbo2PNaXsDMLtWi3YcEwJZwJN82h2jt4C5RwgI3OMZbe5qHllRL7A1fyXPapkte/Jc6RRzrIK+Y2vldwkK1Dav8a7eo0Bi0YY78E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716391661; c=relaxed/simple; bh=MfXp2+EG7ERX2DY/SopiVU4eFwkrfqmHs9m9kRKheAk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=uryZjXht1vRyupYcniw1Kl7qXVbDITYoFQDrKYk+TG64OpqlBKgXjqhIVeIYeLlcTyIePolocvZ3rjDCVQTCvMkTf+4wl3bmVzR49yN9s/lPwsu+IX4t2piZVFdF9W4rxsQlUFZ3A2Dq+iNhpajTGMAlgX+X8oZi30mQ9H5F4V0= 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=A8fJFvta; 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 D4EDD40E0254; Wed, 22 May 2024 15:27:35 +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 W8sZeqrRUy6c; Wed, 22 May 2024 15:27:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=alien8; t=1716391651; bh=OB6gaqSjxiAFW2RlpmSCnZD7Qhpu4drPtRMxzaVxZVU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=A8fJFvtaQXZh+IL0mQwaxVMveFNb0QaGouYARbnD32GFsrOSxHs2vSfrlSvWx8b3q 8lGZBwsSfTj864KzXx/ix/EpMEfgk/n3juA6cjSkdyBf+id1aSxWyi8j3oIjWbeSNE cpCYADDFi2pVs5ywMf9m2E9QdQY5NER4FJnDXqa4t+tNnVN3Pz61c/dFlDY6ormuQa 98znUkYr3r8VPxX1Pc7y+142KbgLiAuAq2UJsNC08fY+PyDsIs36f8bGSjl6UYCRVc j278zltej0G+BTKXXM7U7zLosQMjnK1c7/U+jBDXqU69V9LqNPFydqbeSs+ryv+Dhq 9BysgszjnuutjF0s0gZeNyZMv9/RCs7Ej5R5iB4ega8J0ZLrVu8ojtE3VU9wQARuAB czOq3WxNbEuEbyV8kTylOrU/hHikgLwVXG/TKCShxqNwat1Aac6twPuYzpbHdzCL2r IKxAYL1MSZe4TMnZczgyFvjt3OnKc9U1CZHqab36ipRTvI3cQeu7D+w9FRDaL25tqZ jpWxJd2DSePTMNKR+dJS2k18uMiae1r3Gt6lfAu8/jo6Fq1/kZBpXQLn+vV3GWI4Jo USwLrSY/1tkfpdTWR84zycBGaOnwsuAkFue5w0hwMrZYb7GB4sFrD1DUXHOc9TFdeu bbY2n7Ph8A+OoBSJWeKq9mFg= Received: from zn.tnic (p5de8ee85.dip0.t-ipconnect.de [93.232.238.133]) (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 929BE40E023A; Wed, 22 May 2024 15:27:17 +0000 (UTC) Date: Wed, 22 May 2024 17:27:12 +0200 From: Borislav Petkov To: Tom Lendacky Cc: linux-kernel@vger.kernel.org, x86@kernel.org, linux-coco@lists.linux.dev, svsm-devel@coconut-svsm.dev, Thomas Gleixner , Ingo Molnar , Dave Hansen , "H. Peter Anvin" , Andy Lutomirski , Peter Zijlstra , Dan Williams , Michael Roth , Ashish Kalra Subject: Re: [PATCH v4 04/15] x86/sev: Check for the presence of an SVSM in the SNP Secrets page Message-ID: <20240522152712.GBZk4O0LIl2r0dH--H@fat_crate.local> References: <6cf54cac47f212f4c2b59b123855d8c183989022.1713974291.git.thomas.lendacky@amd.com> <20240502093520.GRZjNeWLXU5j2UMOAM@fat_crate.local> <66928741-aa5c-4bbb-9155-dc3a0609c50a@amd.com> <20240517155858.GDZkd-wkWmYegos-eT@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 Mon, May 20, 2024 at 08:57:43AM -0500, Tom Lendacky wrote: > So this will be a new shared directory in the top level include directory > (as PAGE_ALIGNED is defined in include/linux/mm.h), not just in the > arch/x86/include directory like the others (io.h, msr.h and tdx.h). Is that > what you want? You can actually do this - it is a lot easier and still clean: diff --git a/arch/x86/boot/compressed/sev.c b/arch/x86/boot/compressed/sev.c index cb771b380a6b..5ee53a7a060e 100644 --- a/arch/x86/boot/compressed/sev.c +++ b/arch/x86/boot/compressed/sev.c @@ -12,7 +12,6 @@ */ #include "misc.h" -#include #include #include #include diff --git a/arch/x86/kernel/sev-shared.c b/arch/x86/kernel/sev-shared.c index 46ea4e5e118a..bd4bbb30ef0c 100644 --- a/arch/x86/kernel/sev-shared.c +++ b/arch/x86/kernel/sev-shared.c @@ -1329,7 +1329,12 @@ static void __head setup_svsm_ca(const struct cc_blob_sev_info *cc_info) vmpl = secrets_page->svsm_guest_vmpl; caa = secrets_page->svsm_caa; - if (!PAGE_ALIGNED(caa)) + + /* + * Open-code PAGE_ALIGNED() to avoid pulling in the world and + * more by including linux/mm.h. + */ + if (caa & (PAGE_SIZE - 1)) sev_es_terminate(SEV_TERM_SET_LINUX, GHCB_TERM_SVSM_CAA); /* -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette