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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC05EC4321E for ; Wed, 12 Oct 2022 13:36:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229782AbiJLNgB (ORCPT ); Wed, 12 Oct 2022 09:36:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229682AbiJLNf7 (ORCPT ); Wed, 12 Oct 2022 09:35:59 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 765F1AC397; Wed, 12 Oct 2022 06:35:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1665581758; x=1697117758; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=8xYxlUm+MGiT1FvcaNdZ+RqLNhLPP9G29jYSgD4vhhk=; b=frVNzTDe9W6qdbSYbRsJ0KxcUA1Jl2sU7wUl6/ZJk1p0eYQjzyeUuN19 AeVWp5B/ijeMl79VSc0v+WGiRFtTb3Cqao8apgjDjNvTWpzRygCcNLlIw djQa6wRe0f9C9qzJYIfaRo75kJmFCY2tKDHXkk5NuzQH6MaEhHL7UkWJ4 7CWqPPw0UePKAj/3LQvs2gex9wkEkDQXeK1sMB8jXdJ/T+EzTJv6qbxfc 2cgr+BeVcu/dUYxs43hlrcNsJCJ1N+cd7xCiEnOI943eNk68PGkNbnO0Q 3R6IGd6jS7DqlnEg83o6Ubv+tV6QcJCGt7KkjYO32yG3I1taGAsxsDy4D w==; X-IronPort-AV: E=McAfee;i="6500,9779,10497"; a="391099733" X-IronPort-AV: E=Sophos;i="5.95,179,1661842800"; d="scan'208";a="391099733" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2022 06:35:58 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10497"; a="955754152" X-IronPort-AV: E=Sophos;i="5.95,179,1661842800"; d="scan'208";a="955754152" Received: from mmarathe-mobl3.amr.corp.intel.com (HELO [10.209.65.51]) ([10.209.65.51]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2022 06:35:56 -0700 Message-ID: Date: Wed, 12 Oct 2022 06:35:56 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0 Thunderbird/91.11.0 Subject: Re: [PATCH v14 1/3] x86/tdx: Make __tdx_module_call() usable in driver module Content-Language: en-US To: Borislav Petkov Cc: Thomas Gleixner , Ingo Molnar , Dave Hansen , x86@kernel.org, Shuah Khan , Jonathan Corbet , "H . Peter Anvin" , Greg Kroah-Hartman , "Kirill A . Shutemov" , Tony Luck , Kai Huang , Wander Lairson Costa , Isaku Yamahata , marcelo.cerri@canonical.com, tim.gardner@canonical.com, khalid.elmously@canonical.com, philip.cox@canonical.com, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org References: <20220928215535.26527-1-sathyanarayanan.kuppuswamy@linux.intel.com> <20220928215535.26527-2-sathyanarayanan.kuppuswamy@linux.intel.com> From: Sathyanarayanan Kuppuswamy In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org On 10/12/22 3:18 AM, Borislav Petkov wrote: > On Wed, Sep 28, 2022 at 02:55:33PM -0700, Kuppuswamy Sathyanarayanan wrote: >> To support TDX attestation, the TDX guest user interface driver must >> use the __tdx module_call() function in the driver to allow the user to >> obtain the TDREPORT. >> >> So export the __tdx_module_call() and move the TDX Module IDs to >> asm/tdx.h. > > The functions with the __ prefix are usually lower-level interfaces > which should be internal. Usually. > > Why aren't you exporting the tdx_module_call() one instead? tdx_module_call() calls panic() on a non-zero error value. So it is only used for cases where failure is fatal to the guest. But in the case of TDG.MR.REPORT TDCALL, there are valid cases for failure (like invalid param or busy condition) and the failure is non-fatal. So we should create a new wrapper for this use case or use __tdx_module_call() which is already exposed in asm/tdx.h. > -- Sathyanarayanan Kuppuswamy Linux Kernel Developer