Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4695021iob; Sun, 8 May 2022 22:17:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxD9f9yBo6cDbZSyjB/U6m4Gr4NPsUuzjFJNntIvwhjjKcfrdj/BWcNHFf9cSFrVNrXKeTf X-Received: by 2002:a17:903:18a:b0:15e:c983:7c14 with SMTP id z10-20020a170903018a00b0015ec9837c14mr14830712plg.9.1652073479703; Sun, 08 May 2022 22:17:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652073479; cv=none; d=google.com; s=arc-20160816; b=oOfSVjdLwdyOWmWfO1wOe0eecTFaax9B6lDOutB/4Y7XNm1/uHbRiJYV88o8Vygxce Q9vhCjL5ZCM4BAfWrVy6ocPcvq6gITY4DFc8izImQJ4Lu1Yx1Hn5/bAX/BeR+So5x9Fg HwAyVo/xo5mAtQ99s6293q0/Ha/bJRpiAnOHwWgZsqrNTpdKqY7XSl+kWe6pME2/adMX sWucCmGYzOYvo4VuI7Ua0Z/5CV18XLrARaNLtvFeKKRo1pds+5qI9tMRJouq7WXqlYRc SLRjTyRHfO+l/ay9ETEpV2mX5FSj43mBaQcgRZ/TQ77SJu3SBi3gS4zYjT8DMO1UoyVl IuMA== 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=RHZ9to4hwpHwAtfH6vTLU9okW1pyjQ+VAzclXQXRrnE=; b=1Kdf7nWxJJr4uVzvf6DQD5VgGYTrXgQ5y+dR4niXJlsohmwNFdlaXeTrHZQA3jgxNi 8KVo0OS7j8MTVIufcyGT+lX8oDYtInZ+oYWytDO7v8lHE2XojaDJohstqvozPhppg3qY EpXwi2hmfACjNfGPrcNzi8HpgJaZIR0wVqSB6KPqP7EdRTeQxNqX1DSk4phzhov6qWAz 5yuXiNB8zQRwYZ8yMutzzQ4u0vnVu7ypB8pOe1nsK1Lv1U0orI6EYs8KNdaFBROItMxv wNjDgdcmKEfmbYhk+8pnvqZOFNNBlWC76TXz0FJKb1tFw5Y/EGNuDu1PkBaesfljKCtE ww2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=VcKxQDnS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id mu4-20020a17090b388400b001dcc9b92a8asi13816730pjb.98.2022.05.08.22.17.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 22:17:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=VcKxQDnS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1BEB113DD32; Sun, 8 May 2022 22:14:28 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383515AbiEESUh (ORCPT + 99 others); Thu, 5 May 2022 14:20:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383105AbiEEST3 (ORCPT ); Thu, 5 May 2022 14:19:29 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5910715A3F; Thu, 5 May 2022 11:15:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651774547; x=1683310547; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Ammg3A2Mnovfv+rRVb0tQyZFWoZUYbJqVmLEz3yGWKI=; b=VcKxQDnSY0QLG1DkZyBUCiWPXOD6imv7XuqrPFR7RL5nqzdVzGpiEORU NqoJh8RbrI6Ca9AkPpN4KhcxW+v6G08wTbBYbC7h7Zf8UE9ca7OzFkNw/ H7FrA9ZhZhZMdFpxERKDD7U+yPDuyk4isU8/0rD4Ar8Tqd1NAZ+2ze5hl YwhetPm3RSXmNgZ7TFWLJ9xQugldF4ysMqckvbc/axDvrV108D1iAoN0k rZ0jWT5lGzsZxyEuzp0NpIT14MJva4xU25VI3dFBG+/Iz1ceP6dGmPFCY WQHvlDjbSipajWxNb54/ZHLxEu2CuIqNHjtlUghJHGUpxDGbXS+oesh7+ A==; X-IronPort-AV: E=McAfee;i="6400,9594,10338"; a="328746240" X-IronPort-AV: E=Sophos;i="5.91,202,1647327600"; d="scan'208";a="328746240" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 May 2022 11:15:41 -0700 X-IronPort-AV: E=Sophos;i="5.91,202,1647327600"; d="scan'208";a="665083182" 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; 05 May 2022 11:15:41 -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 Subject: [RFC PATCH v6 016/104] KVM: TDX: Add TDX "architectural" error codes Date: Thu, 5 May 2022 11:14:10 -0700 Message-Id: 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=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 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..5c878488795d --- /dev/null +++ b/arch/x86/kvm/vmx/tdx_errno.h @@ -0,0 +1,29 @@ +/* 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_LIFECYCLE_STATE_INCORRECT 0xC000060700000000ULL +#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_EPT_WALK_FAILED 0xC0000B0000000000ULL + +/* + * TDG.VP.VMCALL Status Codes (returned in R10) + */ +#define TDG_VP_VMCALL_SUCCESS 0x0000000000000000ULL +#define TDG_VP_VMCALL_INVALID_OPERAND 0x8000000000000000ULL +#define TDG_VP_VMCALL_TDREPORT_FAILED 0x8000000000000001ULL + +#endif /* __KVM_X86_TDX_ERRNO_H */ -- 2.25.1