Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1413025pxb; Fri, 27 Aug 2021 08:20:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwidC4eCSkUCjAV6Jiv4+g+zOBi6bR2brWLnG3skZCR6IxXEU0dRaNxgP9S0fPkcE+x3QtR X-Received: by 2002:a92:c609:: with SMTP id p9mr6892928ilm.135.1630077608591; Fri, 27 Aug 2021 08:20:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630077608; cv=none; d=google.com; s=arc-20160816; b=cKQB/8marDSSqRDI4YrqwtnRy0Jq2tE8OM8zK7zjAqc3Mv1w/bZcteRnGaaOzdrIKU SBwAvtRjo8fuOKOZzc7Xxv62tCqNMu0oLN5uRidFprux8A2+arqWzb5NN2Euvxeuj1wc wIF/uniuAgz1qshYEhE2CV7Ig9MzEW5sO7F8Dw/R3O7QP9xDN2lrV3aElv8PwVUkiV/A UQW5dw3ggg5Qg3xAEg7xV4DpXJYw5eM+VvWr3E50QT6hXejx7OQFHrIwak+3vvkxAJNW TN3cGWARWjQNoXGMydP9JMTcTVHhvZLHVxl9nOxsTlv4YlSOdKweN8LjQQTI4Pd+EIk2 pu1A== 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=ZslriKHxbCHlChlqpQpN8Ct1kTFVcJmfBH1i2TOMis0=; b=Ghj4+ltoxYtoNXlVI1hcZLLDmXbBJ5ZUj+DjszkQ/TZ+BsXaXDFu9bELdZ6UOePnLw HkyQ6l/UDBL4xeNWej7FphOhCOUJN+CyMuY0foAFW44JVVyQBIjJmz+pM4fj/vTiS19x JJZfoCru6M1YUlcNcTDM2ArrXDwhHRk9jM/+PlKCLKKAHXVzl0HpkaiUzWGhRkH0g2bb z5wh7+AdY4a1tHuzYpc9kN+QtTsI6pFwQdEMvS/LGNb6AOfP9WyB/iHc/6joY9q/exfF EWyGrwj6Z4GbhfXvFvTjPxjUaXa8kXRb1CQSL/B6Hba2KgtXjmRexV/ZInB9u24Mm+m5 WsrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=dS9d0tdM; 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 x4si6168926ilj.121.2021.08.27.08.19.55; Fri, 27 Aug 2021 08:20:08 -0700 (PDT) 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=dS9d0tdM; 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 S245451AbhH0PTL (ORCPT + 99 others); Fri, 27 Aug 2021 11:19:11 -0400 Received: from mail.skyhub.de ([5.9.137.197]:49636 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245404AbhH0PTJ (ORCPT ); Fri, 27 Aug 2021 11:19:09 -0400 Received: from zn.tnic (p200300ec2f1117008c66b42124dc6a0e.dip0.t-ipconnect.de [IPv6:2003:ec:2f11:1700:8c66:b421:24dc:6a0e]) (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 661E41EC0493; Fri, 27 Aug 2021 17:18:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1630077493; 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=ZslriKHxbCHlChlqpQpN8Ct1kTFVcJmfBH1i2TOMis0=; b=dS9d0tdMHelX7BeSkD5dirk3h3ErCw77WLAuqdv85ajmebrGqQhIMoW5u1vhc6oTuaqaKy LjB5nMNTRp8Q3EzgAOD0U+X0ai7Hy9JvEQKMg2IlniiG9AWAWuejj0XN486YyVD21OT7fs +wU9HdR9Y57TbcWeSNGREZ1ynEyPloE= Date: Fri, 27 Aug 2021 17:18:49 +0200 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 , Wanpeng Li , 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 , tony.luck@intel.com, marcorr@google.com, sathyanarayanan.kuppuswamy@linux.intel.com Subject: Re: [PATCH Part1 v5 32/38] x86/sev: enable SEV-SNP-validated CPUID in #VC handlers Message-ID: References: <20210820151933.22401-1-brijesh.singh@amd.com> <20210820151933.22401-33-brijesh.singh@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210820151933.22401-33-brijesh.singh@amd.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 20, 2021 at 10:19:27AM -0500, Brijesh Singh wrote: > From: Michael Roth > > This adds support for utilizing the SEV-SNP-validated CPUID table in s/This adds support for utilizing/Utilize/ Yap, it can really be that simple. :) > the various #VC handler routines used throughout boot/run-time. Mostly > this is handled by re-using the CPUID lookup code introduced earlier > for the boot/compressed kernel, but at various stages of boot some work > needs to be done to ensure the CPUID table is set up and remains > accessible throughout. The following init routines are introduced to > handle this: Do not talk about what your patch does - that should hopefully be visible in the diff itself. Rather, talk about *why* you're doing what you're doing. > sev_snp_cpuid_init(): This one is not really introduced - it is already there. So this patch is making my head spin. It seems we're dancing a lot of dance just to have our CPUID page present at all times. Which begs the question: do we need it during the whole lifetime of the guest? Regardless, I think this can be simplified by orders of magnitude if we allocated statically 4K for that CPUID page in arch/x86/boot/compressed/mem_encrypt.S, copied the supplied CPUID page from the firmware to it and from now on, work with our own copy. You probably would need to still remap it for kernel proper but it would get rid of all that crazy in this patch here. Hmmm? -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette