Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5354381pxb; Sun, 6 Feb 2022 23:18:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJz4WTAD5Gf3Cegl5/DfaZ+yQrYN4XJxO5mrbhqWlX5nck/Z9t27WZmoM9+L3QNf59NNN6Xl X-Received: by 2002:a17:906:9756:: with SMTP id o22mr9184374ejy.448.1644218328438; Sun, 06 Feb 2022 23:18:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644218328; cv=none; d=google.com; s=arc-20160816; b=zOHxzy57FWNzHEfY/ygxwVkYbDfe38OUBISywkJLjs+uDMF+gyCgY/Pwk/4jUoSXuT w7KV5Hfn9IwhYDGgp3ydBbzR3mKUvvYd1PQchpv7sdGciikNOxA3nOrs7bbDvYK96Idc 1Us17jtALVxkbHHd5QfR1kF8p9x8kCcwRIP3oXWV5GxY/QvKlJ15OHK/oeh5e2WmV5fQ UokTvoa+1Qh7el28nrdEdvlYUmxKcAtZqXdne5f3bGM+NYDA3Y2avth8riMqoLnBo1n2 W9295/Pk6mS3KqWQqkzlWjnz5HVP+lHkFHHVhbvmdFNBp3yB0htNvgBAyd07m/y+Mzsp ngqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=qZ+JC0pRfH6lWrzUrFpqkRDFcjI46nKdneyEJN06nQk=; b=l+moj6bkWXksepcc+MskEXjgHoLGgnOSHYF/k3WHtJppyKnl4Z7adXRdH5fuQpc3Aw 7Vl36nF5pk/vxn1UnsTCjxUvKjCHcuZK9oANHewafIEtnEVck7IWm9SmOo3BNPVoNKLJ yomP7vo5LGiwf4OtJWKFFkZHbeT6+h8aLhG530tLqJhTcQWFn+VTKjbSycAld/8KqIk2 AZvkIxAtO+9wKjAExy75Eatr3v7eydDY8gt1kGQ8FRfU+uk0dQl2jaB9uXP8AkS0dWM5 2dthbVTdiDPwS/VvghQI8Wk+4AsUXAY4aJbEQSWq0RHH++tqVAz9ib/bYMQCozVXm7h5 4t+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=ow+htihM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hr22si264022ejc.24.2022.02.06.23.18.24; Sun, 06 Feb 2022 23:18:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=ow+htihM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232982AbiBFTVR (ORCPT + 99 others); Sun, 6 Feb 2022 14:21:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230064AbiBFTVP (ORCPT ); Sun, 6 Feb 2022 14:21:15 -0500 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C548EC06173B; Sun, 6 Feb 2022 11:21:12 -0800 (PST) Received: from zn.tnic (dslb-088-067-221-104.088.067.pools.vodafone-ip.de [88.67.221.104]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 98F631EC0441; Sun, 6 Feb 2022 20:21:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1644175266; h=from:from: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:in-reply-to:in-reply-to: references:references; bh=qZ+JC0pRfH6lWrzUrFpqkRDFcjI46nKdneyEJN06nQk=; b=ow+htihMgw4Pxti4RYLXi7ZysyRUArvgHjhpsNxhff27JMNO7FScwt2OQO9fzKzRUJgWyp a9pywRwMPeVHB+ZsGjFJ7ZKvh86sn2s5riv1j+ZZQXvSxDz6cXpBOFY/xpIV01KjbfMZId U4VUF69EB5x5H4KIHMBT1WoxuL/t7FM= Date: Sun, 6 Feb 2022 20:21:00 +0100 From: Borislav Petkov To: Brijesh Singh Cc: x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-efi@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-coco@lists.linux.dev, linux-mm@kvack.org, Thomas Gleixner , Ingo Molnar , Joerg Roedel , Tom Lendacky , "H. Peter Anvin" , Ard Biesheuvel , Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Jim Mattson , Andy Lutomirski , Dave Hansen , Sergio Lopez , Peter Gonda , Peter Zijlstra , Srinivas Pandruvada , David Rientjes , Dov Murik , Tobin Feldman-Fitzthum , Michael Roth , Vlastimil Babka , "Kirill A . Shutemov" , Andi Kleen , "Dr . David Alan Gilbert" , brijesh.ksingh@gmail.com, tony.luck@intel.com, marcorr@google.com, sathyanarayanan.kuppuswamy@linux.intel.com Subject: Re: [PATCH v9 36/43] x86/compressed/64: Add identity mapping for Confidential Computing blob Message-ID: References: <20220128171804.569796-1-brijesh.singh@amd.com> <20220128171804.569796-37-brijesh.singh@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220128171804.569796-37-brijesh.singh@amd.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 28, 2022 at 11:17:57AM -0600, Brijesh Singh wrote: > From: Michael Roth > > The run-time kernel will need to access the Confidential Computing > blob very early in boot to access the CPUID table it points to. At > that stage of boot it will be relying on the identity-mapped page table > set up by boot/compressed kernel, so make sure the blob and the CPUID > table it points to are mapped in advance. > > Signed-off-by: Michael Roth > Signed-off-by: Brijesh Singh > --- > arch/x86/boot/compressed/ident_map_64.c | 3 ++- > arch/x86/boot/compressed/misc.h | 2 ++ > arch/x86/boot/compressed/sev.c | 22 ++++++++++++++++++++++ > 3 files changed, 26 insertions(+), 1 deletion(-) Do this ontop: --- diff --git a/arch/x86/boot/compressed/sev.c b/arch/x86/boot/compressed/sev.c index faf432684870..a5a9210d73b6 100644 --- a/arch/x86/boot/compressed/sev.c +++ b/arch/x86/boot/compressed/sev.c @@ -500,7 +500,7 @@ bool snp_init(struct boot_params *bp) void sev_prep_identity_maps(unsigned long top_level_pgt) { /* - * The ConfidentialComputing blob is used very early in uncompressed + * The Confidential Computing blob is used very early in uncompressed * kernel to find the in-memory cpuid table to handle cpuid * instructions. Make sure an identity-mapping exists so it can be * accessed after switchover. @@ -509,11 +509,10 @@ void sev_prep_identity_maps(unsigned long top_level_pgt) unsigned long cc_info_pa = boot_params->cc_blob_address; struct cc_blob_sev_info *cc_info; - kernel_add_identity_map(cc_info_pa, - cc_info_pa + sizeof(*cc_info)); + kernel_add_identity_map(cc_info_pa, cc_info_pa + sizeof(*cc_info)); + cc_info = (struct cc_blob_sev_info *)cc_info_pa; - kernel_add_identity_map((unsigned long)cc_info->cpuid_phys, - (unsigned long)cc_info->cpuid_phys + cc_info->cpuid_len); + kernel_add_identity_map(cc_info->cpuid_phys, cc_info->cpuid_phys + cc_info->cpuid_len); } sev_verify_cbit(top_level_pgt); -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette