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 X-Spam-Level: X-Spam-Status: No, score=-5.9 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1CA69C47083 for ; Wed, 2 Jun 2021 18:25:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EE31C61029 for ; Wed, 2 Jun 2021 18:25:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229558AbhFBS1c (ORCPT ); Wed, 2 Jun 2021 14:27:32 -0400 Received: from mga06.intel.com ([134.134.136.31]:42858 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229489AbhFBS1b (ORCPT ); Wed, 2 Jun 2021 14:27:31 -0400 IronPort-SDR: tVlssgAe9yFKLFLYOXGmAW27oC3D1hOoRGiWhTAWFkPz1ouGl8H7J5rpYM+J2E3uADXCVNdtPq /AmHa13j2gVg== X-IronPort-AV: E=McAfee;i="6200,9189,10003"; a="265037822" X-IronPort-AV: E=Sophos;i="5.83,242,1616482800"; d="scan'208";a="265037822" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jun 2021 11:25:47 -0700 IronPort-SDR: VVsyhCtSAfniCgZoAi8WEAq1CFWJswCeyVmKtdYKbUkIvJwN79WSKJGVS7LpXvWJ9FeZbBTIdm 3Ka4Iuz7PCww== X-IronPort-AV: E=Sophos;i="5.83,242,1616482800"; d="scan'208";a="416996201" Received: from sboinap-mobl1.amr.corp.intel.com (HELO skuppusw-mobl5.amr.corp.intel.com) ([10.209.150.149]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jun 2021 11:25:46 -0700 Subject: Re: [RFC v2-fix-v2 1/1] x86: Introduce generic protected guest abstraction To: Tom Lendacky , Sean Christopherson Cc: Peter Zijlstra , Andy Lutomirski , Dave Hansen , Tony Luck , Borislav Petkov , Andi Kleen , Kirill Shutemov , Kuppuswamy Sathyanarayanan , Dan Williams , Raj Ashok , linux-kernel@vger.kernel.org References: <20210527042356.3983284-2-sathyanarayanan.kuppuswamy@linux.intel.com> <20210601211417.2177598-1-sathyanarayanan.kuppuswamy@linux.intel.com> <3036a655-9d09-0f04-62a2-7a72ba9af5c7@amd.com> From: "Kuppuswamy, Sathyanarayanan" Message-ID: Date: Wed, 2 Jun 2021 11:25:43 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <3036a655-9d09-0f04-62a2-7a72ba9af5c7@amd.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/2/21 11:15 AM, Tom Lendacky wrote: > The original suggestion from Boris, IIRC, was for protected_guest_has() > function (below) to be: > > if (intel) > return intel_protected_guest_has(); Yes. But for Intel, I think currently we can only check for is_tdx_guest() here. if (is_tdx_guest()) return intel_protected_guest_has(); So if we use is_tdx_guest(), it is better to call tdx_protected_guest_has() here. Once we start using protected_guest_has for other Intel technologies, may be we can generalize it. Let me know your comments. > else if (amd) > return amd_protected_guest_has(); > else > return false; > > And then you could check for TDX or SME/SEV in the respective functions. -- Sathyanarayanan Kuppuswamy Linux Kernel Developer