From mboxrd@z Thu Jan 1 00:00:00 1970 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05341C433F5 for ; Wed, 13 Oct 2021 13:32:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D2EFE610E7 for ; Wed, 13 Oct 2021 13:32:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234162AbhJMNe2 (ORCPT ); Wed, 13 Oct 2021 09:34:28 -0400 Received: from mga05.intel.com ([192.55.52.43]:6646 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229535AbhJMNeV (ORCPT ); Wed, 13 Oct 2021 09:34:21 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10135"; a="313625336" X-IronPort-AV: E=Sophos;i="5.85,371,1624345200"; d="scan'208";a="313625336" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2021 06:32:17 -0700 X-IronPort-AV: E=Sophos;i="5.85,371,1624345200"; d="scan'208";a="486907483" Received: from dravindr-mobl.amr.corp.intel.com (HELO skuppusw-desk1.amr.corp.intel.com) ([10.254.11.40]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2021 06:32:16 -0700 Subject: Re: [PATCH v10 03/11] x86/cpufeatures: Add TDX Guest CPU feature To: Borislav Petkov , Kuppuswamy Sathyanarayanan Cc: Thomas Gleixner , Ingo Molnar , x86@kernel.org, Paolo Bonzini , David Hildenbrand , Andrea Arcangeli , Josh Poimboeuf , Juergen Gross , Deep Shah , VMware Inc , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Peter H Anvin , Dave Hansen , Tony Luck , Dan Williams , Andi Kleen , Kirill Shutemov , Sean Christopherson , Kuppuswamy Sathyanarayanan , linux-kernel@vger.kernel.org References: <20211009053747.1694419-1-sathyanarayanan.kuppuswamy@linux.intel.com> <20211009053747.1694419-4-sathyanarayanan.kuppuswamy@linux.intel.com> From: Sathyanarayanan Kuppuswamy Message-ID: <221e9a08-9380-5503-063c-897621757eb4@linux.intel.com> Date: Wed, 13 Oct 2021 06:32:16 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/13/21 1:18 AM, Borislav Petkov wrote: > On Fri, Oct 08, 2021 at 10:37:39PM -0700, Kuppuswamy Sathyanarayanan wrote: >> @@ -500,6 +501,14 @@ asmlinkage __visible void __init x86_64_start_kernel(char * real_mode_data) >> >> copy_bootdata(__va(real_mode_data)); >> >> + /* >> + * A future dependency on cmdline parameters is expected (for >> + * adding debug options). So the order of calling it should be >> + * after copy_bootdata() (in which command line parameter is >> + * initialized). >> + */ > Plain and simple: > > /* > * Keep this after copy_bootdata() so that TDX cmdline options can take > * effect. > */ ok. I will fix this in next version. > > >> + tdx_early_init(); >> + >> /* >> * Load microcode early on BSP. >> */ >> diff --git a/arch/x86/kernel/tdx.c b/arch/x86/kernel/tdx.c >> new file mode 100644 >> index 000000000000..88bf12788684 >> --- /dev/null >> +++ b/arch/x86/kernel/tdx.c >> @@ -0,0 +1,38 @@ >> +// SPDX-License-Identifier: GPL-2.0 >> +/* Copyright (C) 2020 Intel Corporation */ >> + >> +#undef pr_fmt >> +#define pr_fmt(fmt) "tdx: " fmt >> + >> +#include >> + >> +bool is_tdx_guest(void) >> +{ >> + static int tdx_guest = -1; > Put that one at the top of the file because such static variables do not > belong among the automatic function vars. ok. I will fix this in next version. > > Thx. > -- Sathyanarayanan Kuppuswamy Linux Kernel Developer