Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3608272pxj; Mon, 7 Jun 2021 15:28:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwO6uztYotMMpx6PRiI9IdDfflTydo3Q+lLcpM/MJy4mI6lcwm0QdCUeXJi5DVdwkCPOnkk X-Received: by 2002:aa7:c619:: with SMTP id h25mr22015017edq.388.1623104923618; Mon, 07 Jun 2021 15:28:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623104923; cv=none; d=google.com; s=arc-20160816; b=NrnL+j8+uCzcndl2BtUhGUUlBcA2Aig4gm0yc2R8BASuritSN/aZ3ewHr+5FHR2xf5 p6Inc1Fa/O/AccPbk7BdC9Ewg1WimBDZ1KVoFZHyKKIBltC8r5FOCGADM11zbUQdI3t5 6weSy0fZJXvZE5EQoZ0OXFbNHt+YESUciaXq+xAMFjgWo1PcI6YyZPpxJWtYGmJZn8bO MY84p1XJuPCntqf+LD2rhcudgV0nv7FOAl/Hve5pafPveL7vAYg7MYUNYBhdEkGe+zdd xVa5aBI6smLXBpMSH7upPVjZXX1B6yld5LWrrgZKGABGh4Oo2KIhtA5gtWt7MczI9tyG ZhVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:ironport-sdr:ironport-sdr; bh=nWfJ8Vu+ngjJLaPnpBCfd9x4E51xQE/pdqpEmvJZbVA=; b=DYhMmXeJcO6ubL6gm87HaKgPYa3G7YDjWesHRtqbYf9dcTx1P5m6tm1QyLJTxXqMZa Mq/PGbz4uqVq/ZlWsLM8uBkfvvV5Zd5UQQ2eoXVe/m/Ktl7WsZzLgjTU43Dw7j68dkTn bcI5nBBv8knTQ/1H/D8l1KNDPh/OEuVcSSyGNsmE2g9cJe+Gs5XECeNWGUZna9aYwf4B 1ya4Ue2OImZT+BPoUlcKp1mrwdvFQGwT4XcWKdayfeOeiX4Xf+uOLR/qZvMrWgn0sV2m SN6KVtISA13pPGZwRkFJT1FbmiZLKX4oA/+e+I23DSwCuhj61oD90q12nvd2r5uRFqf5 Gm5w== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p23si13038077ejn.418.2021.06.07.15.28.19; Mon, 07 Jun 2021 15:28:43 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230303AbhFGW2t (ORCPT + 99 others); Mon, 7 Jun 2021 18:28:49 -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