Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3838700rdg; Wed, 18 Oct 2023 07:30:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGJUfCSt5VxdxN5Cp8P66Uq1F6mAK3mtnKzj6jcBLqCCsFV8qrjroqJB73eTI7jEx3kmq1W X-Received: by 2002:a05:6a00:1346:b0:6bd:8c4a:ab8f with SMTP id k6-20020a056a00134600b006bd8c4aab8fmr6348285pfu.2.1697639457902; Wed, 18 Oct 2023 07:30:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697639457; cv=none; d=google.com; s=arc-20160816; b=ET+FqZCmHefdfjd/snpOKPNdediK3VSwLokp8JvPBbeOsxXpfUhI7rrxZCiTRpzc57 VTdD/8PeURO39Mp/C2Lq/HRImXCdXUSxcVtidHki9ck5IzU4MBXMO6Ys7hMd3i48GeUQ FCDtsLmEmwi84m0YzjhZdJ8Y7jHJIQoGIdsSj9LbOBCqyWfUDC4bQkExrNlnxx3rVSMi UTggXm0knRlBKMRTxBrPMH3je7S/9cWJvV5gYccB/5JvG1LIHAtc0hHu5q1o5Tcj/nz9 CYOLngAdAknJz/EUWZUBkAWQtVbEdb2fb6V8C3FuWllWecYay1tPaLCPzUzd4054rOV/ JE8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=8smAnt3rTZyULPy/FjuabmPkzdWHlqzFYo4zX/EkqMs=; fh=8eXFfYdvKzYh2ewpIcxvlnOfy0KHTqaj8EYDpK9vJeI=; b=DrtJZz3Z3sU1RUFYYOt0gVYMTZGkBd+ZajZ/nTzHG5FMFq+KiVRuFN7S5G4782n98v Ef+P8Q8ddGGStRz9Kc3JdbtyZujvY//ad85g8oTeHxRMQV2fXqfESWiSEHMb8WQTXWrT TOI0QQNTLzR91IDafxaA9HxQBOGzUkglB1WCKRkSTahUi0yo7330WxaEemon6UKFGGSh zKzJ5djevT54fbYIx9CnoPjcCDpcT+0shq75MVtLNMi5xmgLfn5GiwT6Vugx/+vytasy tP5DRCNTXUZc3Fwqka02AnRW68a1DnoTh+mn8oAj0n+TT38us8NG8Ll5ziAVcQTxf5Fl Z6SQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YzOJDgUg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id d24-20020a637358000000b005ab6142f1besi2186154pgn.169.2023.10.18.07.30.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 07:30:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YzOJDgUg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 8CC64807C7F7; Wed, 18 Oct 2023 07:30:55 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345735AbjJROaZ (ORCPT + 99 others); Wed, 18 Oct 2023 10:30:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235173AbjJROaI (ORCPT ); Wed, 18 Oct 2023 10:30:08 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 427EE10F0; Wed, 18 Oct 2023 07:17:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697638666; x=1729174666; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=E+Z9XZNAGrfXl1gnv1lM2ourrNoPoA1sbsAn5sGZg3o=; b=YzOJDgUgxKP2GM1QcLZbEwy75LNE8Y4GQz1uN0Qi4IaSn63ujQSmkixd j0v7VovSEDiA55GU542wDpB+ReYsIy6TkiiUK8NRmGSccgPZX5W7N14QO EPRYsWD6hNhqwYyoxM1JBTiNIfD9s7osCpQHyX4h38WZwNqIMj61UsFlE kuwYHv+qcOKnRx54bzJKbzBpMhvyP/uaCRsTMYZxx87aVUCVHdg0uxqzw PbDBN+eo9Z0U8QYjWXtuIqURtxvcasAR1BOljjEO8lJ5JstyKgU7OQUGm xrmWJOnajF1cVF6Tpvdl532h6jBKw1Bcl3KPLPJVM8uhuCIZMqfkCLiF8 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10867"; a="450245500" X-IronPort-AV: E=Sophos;i="6.03,235,1694761200"; d="scan'208";a="450245500" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2023 07:17:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10867"; a="733187064" X-IronPort-AV: E=Sophos;i="6.03,235,1694761200"; d="scan'208";a="733187064" Received: from npokhrel-mobl1.amr.corp.intel.com (HELO [10.212.172.232]) ([10.212.172.232]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2023 07:17:12 -0700 Message-ID: <19f8e93e-62c4-485c-a7c3-f29740fc3eca@linux.intel.com> Date: Wed, 18 Oct 2023 07:17:12 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v14 06/23] x86/virt/tdx: Add SEAMCALL error printing for module initialization Content-Language: en-US To: Kai Huang , linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: x86@kernel.org, dave.hansen@intel.com, kirill.shutemov@linux.intel.com, peterz@infradead.org, tony.luck@intel.com, tglx@linutronix.de, bp@alien8.de, mingo@redhat.com, hpa@zytor.com, seanjc@google.com, pbonzini@redhat.com, rafael@kernel.org, david@redhat.com, dan.j.williams@intel.com, len.brown@intel.com, ak@linux.intel.com, isaku.yamahata@intel.com, ying.huang@intel.com, chao.gao@intel.com, nik.borisov@suse.com, bagasdotme@gmail.com, sagis@google.com, imammedo@redhat.com References: <58c44258cb5b1009f0ddfe6b07ac986b9614b8b3.1697532085.git.kai.huang@intel.com> From: Kuppuswamy Sathyanarayanan In-Reply-To: <58c44258cb5b1009f0ddfe6b07ac986b9614b8b3.1697532085.git.kai.huang@intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 18 Oct 2023 07:30:55 -0700 (PDT) On 10/17/2023 3:14 AM, Kai Huang wrote: > The SEAMCALLs involved during the TDX module initialization are not > expected to fail. In fact, they are not expected to return any non-zero > code (except the "running out of entropy error", which can be handled > internally already). > > Add yet another set of SEAMCALL wrappers, which treats all non-zero > return code as error, to support printing SEAMCALL error upon failure > for module initialization. Note the TDX module initialization doesn't > use the _saved_ret() variant thus no wrapper is added for it. > > SEAMCALL assembly can also return kernel-defined error codes for three > special cases: 1) TDX isn't enabled by the BIOS; 2) TDX module isn't > loaded; 3) CPU isn't in VMX operation. Whether they can legally happen > depends on the caller, so leave to the caller to print error message > when desired. > > Also convert the SEAMCALL error codes to the kernel error codes in the > new wrappers so that each SEAMCALL caller doesn't have to repeat the > conversion. > > Signed-off-by: Kai Huang > Reviewed-by: Kirill A. Shutemov > --- > > v13 -> v14: > - Use real functions to replace macros. (Dave) > - Moved printing error message for special error code to the caller > (internal) > - Added Kirill's tag > > v12 -> v13: > - New implementation due to TDCALL assembly series. > > --- Reviewed-by: Kuppuswamy Sathyanarayanan -- Sathyanarayanan Kuppuswamy Linux Kernel Developer