Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 82B8EC433F5 for ; Wed, 15 Dec 2021 18:34:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343860AbhLOSeT (ORCPT ); Wed, 15 Dec 2021 13:34:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343840AbhLOSdx (ORCPT ); Wed, 15 Dec 2021 13:33:53 -0500 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C7FEC061401; Wed, 15 Dec 2021 10:33:51 -0800 (PST) Received: from zn.tnic (dslb-088-067-202-008.088.067.pools.vodafone-ip.de [88.67.202.8]) (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 317B01EC02B9; Wed, 15 Dec 2021 19:33:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1639593225; 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=pI1cfs0sye4rkAbVP9bxLeZ1PzV7S4Ntz69iDw6ZWT0=; b=nuPlfwo/nPurBQL3rwNReGM0rLIfsiRLAoa5oV0W/SnMy9FEcPKfJ0+Ricsb/6GnvX3xOo Pg1dCcrPSPvjYOV5vPrn8O4XoVxHhDwDNhSIizJhjQqkoY0MEiAezSjOK++g2oabzvnLFc bzFMjpublalbdEUXDyFvJnCl2jjn0Xc= Date: Wed, 15 Dec 2021 19:33:47 +0100 From: Borislav Petkov To: Venu Busireddy Cc: Michael Roth , Tom Lendacky , Brijesh Singh , 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 , "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 , 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 01/40] x86/compressed/64: detect/setup SEV/SME features earlier in boot Message-ID: References: <20211210154332.11526-1-brijesh.singh@amd.com> <20211210154332.11526-2-brijesh.singh@amd.com> <20211215174934.tgn3c7c4s3toelbq@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 15, 2021 at 12:17:44PM -0600, Venu Busireddy wrote: > Boris & Tom, which implementation would you prefer? I'd like to see how that sme_sev_parse_cpuid() would look like. And that function should be called sev_parse_cpuid(), btw. Because if that function turns out to be a subset of your suggestion, functionality-wise, then we should save us the churn and simply do one generic helper. Btw 2, that helper should be in arch/x86/kernel/sev-shared.c so that it gets shared by both kernel stages instead having an inline function in some random header. Btw 3, I'm not crazy about the feature testing with the @features param either. Maybe that function should return the eYx register directly, like the cpuid_eYx() variants in the kernel do, where Y in { a, b, c, d }. The caller can than do its own testing: eax = sev_parse_cpuid(RET_EAX, ...) if (eax > 0) { if (eax & BIT(1)) ... Something along those lines, for example. But I'd have to see a concrete diff from Michael to get a better idea how that CPUID parsing from the CPUID page is going to look like. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette