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.3 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 4E063C47094 for ; Mon, 7 Jun 2021 22:26:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 29D2960FEB for ; Mon, 7 Jun 2021 22:26:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230405AbhFGW2u (ORCPT ); Mon, 7 Jun 2021 18:28:50 -0400 Received: from mga02.intel.com ([134.134.136.20]:20349 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230264AbhFGW2s (ORCPT ); Mon, 7 Jun 2021 18:28:48 -0400 IronPort-SDR: tan22k0OQbCP8nEBO8iRsSuiLRsf9f+diONMhKaGoIpHM2ZoselvMATxhn9Whhn2jm+GMHTwRW Rvd3UMDa6nrA== X-IronPort-AV: E=McAfee;i="6200,9189,10008"; a="191836117" X-IronPort-AV: E=Sophos;i="5.83,256,1616482800"; d="scan'208";a="191836117" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jun 2021 15:26:55 -0700 IronPort-SDR: L1Oqxf6/YcrJyEasuyDTiubV0+zBzpPaR+R4cvg4+ud+99ycMSH3Ewdk0x8ansxYeg50vsFXuj 2sHSiX+XAqGQ== X-IronPort-AV: E=Sophos;i="5.83,256,1616482800"; d="scan'208";a="619091717" Received: from ssanje1x-mobl1.amr.corp.intel.com (HELO skuppusw-mobl5.amr.corp.intel.com) ([10.251.153.170]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jun 2021 15:26:53 -0700 Subject: Re: [RFC v2-fix-v2 1/1] x86: Introduce generic protected guest abstractionn To: Borislav Petkov , "Kirill A. Shutemov" Cc: Peter Zijlstra , Andy Lutomirski , Dave Hansen , Tony Luck , Andi Kleen , Kirill Shutemov , Kuppuswamy Sathyanarayanan , Dan Williams , Raj Ashok , Sean Christopherson , linux-kernel@vger.kernel.org, Tom Lendacky References: <20210527042356.3983284-2-sathyanarayanan.kuppuswamy@linux.intel.com> <20210601211417.2177598-1-sathyanarayanan.kuppuswamy@linux.intel.com> <20210607195544.qlya6i5s2l2fkms2@box> From: "Kuppuswamy, Sathyanarayanan" Message-ID: Date: Mon, 7 Jun 2021 15:26:51 -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: 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/7/21 1:14 PM, Borislav Petkov wrote: > On Mon, Jun 07, 2021 at 10:55:44PM +0300, Kirill A. Shutemov wrote: >> I think conversions like this are wrong: relocate_kernel(), which got >> called here, only knows how to deal with SME, not how to handle some >> generic case. > > What do you mean wrong? Wrong for TDX? > > If so, then that can be > > protected_guest_has(SME) > > or so, which would be false on Intel. I agree. Since most of the code changed in this patch is not applicable to TDX, it might need product specific or new function specific flags. > > And this patch was only a mechanical conversion to see how it would look > like. > >> If code is written to handle a specific technology we need to stick >> with a check that makes it clear. Trying to make sound generic only >> leads to confusion. > > Sure, fine by me. > > And I don't want a zoo of gazillion small checking functions per > technology. sev_, tdx_, yadda yadda. > > So stuff better be unified. Even if you'd have vendor-specific defines > you hand into that function - and you will have such - it is still much > saner than what it turns into with the AMD side of things. Agree. Currently we share code with AMD SEV in memory encryption support and string I/O handling code. So defining common flag for such code is useful. > -- Sathyanarayanan Kuppuswamy Linux Kernel Developer