Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp4502652pxb; Tue, 25 Jan 2022 11:46:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJxcSHbmz8GVLJxAvpTcf7In/Tnd+803oBJzIKgdFseqjqBhVQAJI6iTyfgGGKLA+m0oXQvt X-Received: by 2002:a17:907:2dac:: with SMTP id gt44mr3088505ejc.493.1643139992340; Tue, 25 Jan 2022 11:46:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643139992; cv=none; d=google.com; s=arc-20160816; b=HZaowTJRwknKUMQI7tzY2NkRtjscpqnFe2bI8Zs+tmc2sWDv3yNkum6IvqyuRRKAuP +y1nh+tNVn5DXS1+pHeEXUkTxd0cVqgqqmj9I+q1q9cdplZytCt0/vMS1ju80QvrNkqy 4WzKk7XuEeUxKgwhoxap0yhRv8rI3Az9GjJLIAxL6J9N7iGXv4N5feDKEsILoZpDXRfW PIfzgBSO2Vagm5YeBm5fWF/LR+P1vrTARnYar/m/XS4XK1Q3zbEN7ZcqP/Svxe1U61ou ijhxO0odEyaTn0kb5Kj5A/HTV3k0dtutCT+CFx+4Jb3zx+L7ncIabFAbJefQ+9VpoDDW pbyg== 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=JQN8XD6k6puvlSUuf8A5aQx4ew310N7RwtnuTiZnHb8=; b=bHfLds2O9RBGja2U3nvVmghQnT7Pwn9CUYt959qGuslzywpIUGLfZ4WVhbqAFOQtId m86DD6Oyfk0LFuEeSz1aSNqwUuj8eZtuF+Srtwa3txGeQpgCxAN30/9iaDY+JcwVID20 BP2pVltDIjs7SeA2qJoT8UfJK5QKW/Eg7hT5om80QIfVxCI9w7LEnxNqqKzOPeFDLubW fHOOhsT/kW5WYbnqu9Y+1TFE0u5wtx1qEqF4AChVZiaTV81CW1ofeW78IWd2HJPOAPkx 3XaA3NelB+eVIPrMsdcAMsZ99rUTblYLaKeERGLQZOh1p5UH3G9WeilrgJniSHkmPaqV N6Zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=EBAYLLI8; 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=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hr42si5034298ejc.818.2022.01.25.11.46.03; Tue, 25 Jan 2022 11:46:32 -0800 (PST) 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=@alien8.de header.s=dkim header.b=EBAYLLI8; 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=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348606AbiAYNvk (ORCPT + 99 others); Tue, 25 Jan 2022 08:51:40 -0500 Received: from mail.skyhub.de ([5.9.137.197]:32900 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1577805AbiAYNtD (ORCPT ); Tue, 25 Jan 2022 08:49:03 -0500 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 376201EC01B7; Tue, 25 Jan 2022 14:48:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1643118536; 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=JQN8XD6k6puvlSUuf8A5aQx4ew310N7RwtnuTiZnHb8=; b=EBAYLLI8ZKdEmazAnudhSelafx11VzBXAhRuc9nYJyQhp2LpsI0UmGGAOdRz66aFffbETc hCkJcMLrjFST9eUShtGEQdgddvtR0BF2inaRz6BebGta3+5aTH7+CKm3Dp4uIM8Y6HCT4A SbwvPtfNj63BrzWM1xMA1pzgCEGYiwE= Date: Tue, 25 Jan 2022 14:48:51 +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" , tony.luck@intel.com, marcorr@google.com, sathyanarayanan.kuppuswamy@linux.intel.com Subject: Re: [PATCH v8 33/40] x86/compressed/64: add identity mapping for Confidential Computing blob Message-ID: References: <20211210154332.11526-1-brijesh.singh@amd.com> <20211210154332.11526-34-brijesh.singh@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20211210154332.11526-34-brijesh.singh@amd.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 10, 2021 at 09:43:25AM -0600, Brijesh Singh wrote: > +static void sev_prep_identity_maps(void) > +{ > + /* > + * The ConfidentialComputing 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. > + */ > + if (sev_snp_enabled()) { > + struct cc_blob_sev_info *cc_info = > + (void *)(unsigned long)boot_params->cc_blob_address; > + > + add_identity_map((unsigned long)cc_info, > + (unsigned long)cc_info + sizeof(*cc_info)); > + add_identity_map((unsigned long)cc_info->cpuid_phys, > + (unsigned long)cc_info->cpuid_phys + cc_info->cpuid_len); > + } > + > + sev_verify_cbit(top_level_pgt); > +} > + Also, that function can just as well live in compressed/sev.c and you can export add_identity_map() instead. That latter function calls kernel_ident_mapping_init() which is already exported. add_identity_map() doesn't do anything special and it is limited to the decompressor kernel so nothing stands in the way of exporting it in a pre-patch and renaming it there to kernel_add_identity_map() or so... Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette