Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3469000rwb; Fri, 30 Sep 2022 04:11:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6CDiOqyDOzAXQg+Y1cTCBMsj9Pmj52wGWQ6+AoyY9P9jb0ICfgeoIl5KE8ZppQUIEkFXJ3 X-Received: by 2002:a17:906:8a76:b0:781:7530:8b05 with SMTP id hy22-20020a1709068a7600b0078175308b05mr6075369ejc.489.1664536262428; Fri, 30 Sep 2022 04:11:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664536262; cv=none; d=google.com; s=arc-20160816; b=KT7AaNuuNcP4KgwdKr7o9tLo1F1HMRfsiQcy0MDHbfIx7JBbf8cC+U+0n6X8hWgtsz P0Ou2Q9ePpUGp8SkcqEAgfbFz3etGmke5RCeqieR/ZgxExOaLedMKKwIkQ1vCcGlpCF+ nNcdux+FtmvQoiIC705wmC//lIG9EXN1+3jXbkJ5o+2aM1FvnNQOg1rCnrbrfB3m4xXJ IXIGx2FCF+ytxszdG7NSF1JYH3iE9WvUQJvLzm18ORTNyJ2omZZwGNToQS6D6zbiDa+R 42VGhCL9LaBWbhHA5/VrN79Smupw7LIU/eBEYsU0o8rhjBJuOOwdorCI9l0QdIv4d3q+ zOxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0EoAKbwCS/SpW+gA4bZNPj75x/vLjCc8KohQn2dSmbI=; b=fj7oh65zXNAhyeGhbWib5Ukzp+CYqPSyBd1NDtRKBwPBwClR5+S1MFqL/qXARMs2nT YPQJWcXauP6/lN1iC48UDTtMVHKEB0WFp7bfudWcDgf/sxfEsjDVEG2MjKsSY/WDLOD/ hXnkpamJvKARYMF2Uw2MdkL5ydWHfu+K9L+pWhEWFO3yYrLZz//xtSPXsRkC0x4wdx7H QmWqd8GZNMBxTSvOcoYjiWU2GsjT/iKPKOQaO6eJ7p60jlR0JxtPvmko2Af0tINZwg71 RRhKpYraSBgks7q6fOgnpu2PHEsiNp+J7L6xN12Q3TeHlCtIw+Jnu2Qi1g0hVOdz3XVp GSfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ngCuTqeF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qq17-20020a17090720d100b006ff49b183e9si1122951ejb.971.2022.09.30.04.10.18; Fri, 30 Sep 2022 04:11:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ngCuTqeF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231733AbiI3KTr (ORCPT + 99 others); Fri, 30 Sep 2022 06:19:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231305AbiI3KS5 (ORCPT ); Fri, 30 Sep 2022 06:18:57 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF674166F02; Fri, 30 Sep 2022 03:18:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664533136; x=1696069136; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KEIAjHg+U4wWqFG4QgHIE8RVytQUcfrlVjc5d4iCVrU=; b=ngCuTqeFwTLU5vdA+nrEn35QaV9DSklH78Fjog3qJ0PdbBXv789JjRWK wuWKcuMZrHwP7av1A7Jcc7b7DwsJHwZH3mQg1z07FM7xFQHqhLGQNsB22 fah7KiYwuNm/3c69C4f2CS0JtsU045ZsVonDikRDqCRopzwZbJZwhnghj LvpoSWiUQTN5ruBTNazketyIsiY3wBGbKm29md/zHoKz+D1Ui63YXt31v ueOLfXbAKjTAJ0eWXl8RU+B5XLDNGuCu9LTvaEfIa2K8cg3h+hVViiUnl x4aLCUDBbsQNDVi5JJl/2NxTvVqXsh5ZDlRl4Tfze3z+VS2UjHuGzV/08 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10485"; a="289320435" X-IronPort-AV: E=Sophos;i="5.93,358,1654585200"; d="scan'208";a="289320435" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Sep 2022 03:18:53 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10485"; a="726807535" X-IronPort-AV: E=Sophos;i="5.93,358,1654585200"; d="scan'208";a="726807535" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Sep 2022 03:18:52 -0700 From: isaku.yamahata@intel.com To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: isaku.yamahata@intel.com, isaku.yamahata@gmail.com, Paolo Bonzini , erdemaktas@google.com, Sean Christopherson , Sagi Shahar , Sean Christopherson Subject: [PATCH v9 010/105] KVM: TDX: Add TDX "architectural" error codes Date: Fri, 30 Sep 2022 03:17:04 -0700 Message-Id: <474651ea784f029cf61a087e870dcc134b189f9e.1664530907.git.isaku.yamahata@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sean Christopherson Add error codes for the TDX SEAMCALLs both for TDX VMM side for TDH SEAMCALL and TDX guest side for TDG.VP.VMCALL. KVM issues the TDX SEAMCALLs and checks its error code. KVM handles hypercall from the TDX guest and may return an error. So error code for the TDX guest is also needed. TDX SEAMCALL uses bits 31:0 to return more information, so these error codes will only exactly match RAX[63:32]. Error codes for TDG.VP.VMCALL is defined by TDX Guest-Host-Communication interface spec. Signed-off-by: Sean Christopherson Signed-off-by: Isaku Yamahata Reviewed-by: Paolo Bonzini --- arch/x86/kvm/vmx/tdx_errno.h | 37 ++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 arch/x86/kvm/vmx/tdx_errno.h diff --git a/arch/x86/kvm/vmx/tdx_errno.h b/arch/x86/kvm/vmx/tdx_errno.h new file mode 100644 index 000000000000..f2b1c4cc516f --- /dev/null +++ b/arch/x86/kvm/vmx/tdx_errno.h @@ -0,0 +1,37 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* architectural status code for SEAMCALL */ + +#ifndef __KVM_X86_TDX_ERRNO_H +#define __KVM_X86_TDX_ERRNO_H + +#define TDX_SEAMCALL_STATUS_MASK 0xFFFFFFFF00000000ULL + +/* + * TDX SEAMCALL Status Codes (returned in RAX) + */ +#define TDX_SUCCESS 0x0000000000000000ULL +#define TDX_NON_RECOVERABLE_VCPU 0x4000000100000000ULL +#define TDX_INTERRUPTED_RESUMABLE 0x8000000300000000ULL +#define TDX_OPERAND_BUSY 0x8000020000000000ULL +#define TDX_VCPU_NOT_ASSOCIATED 0x8000070200000000ULL +#define TDX_KEY_GENERATION_FAILED 0x8000080000000000ULL +#define TDX_KEY_STATE_INCORRECT 0xC000081100000000ULL +#define TDX_KEY_CONFIGURED 0x0000081500000000ULL +#define TDX_NO_HKID_READY_TO_WBCACHE 0x0000082100000000ULL +#define TDX_EPT_WALK_FAILED 0xC0000B0000000000ULL + +/* + * TDG.VP.VMCALL Status Codes (returned in R10) + */ +#define TDG_VP_VMCALL_SUCCESS 0x0000000000000000ULL +#define TDG_VP_VMCALL_RETRY 0x0000000000000001ULL +#define TDG_VP_VMCALL_INVALID_OPERAND 0x8000000000000000ULL +#define TDG_VP_VMCALL_TDREPORT_FAILED 0x8000000000000001ULL + +/* + * TDX module operand ID, appears in 31:0 part of error code as + * detail information + */ +#define TDX_OPERAND_ID_SEPT 0x92 + +#endif /* __KVM_X86_TDX_ERRNO_H */ -- 2.25.1