Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3405096iog; Mon, 27 Jun 2022 15:38:09 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uMj8WcWrD0w0e0kxjppl4nDihO1M2W6NGb/WCC1TZKb+coLMCp2rncoOmK2UuBvTW3BeNr X-Received: by 2002:a17:907:7245:b0:726:a909:902e with SMTP id ds5-20020a170907724500b00726a909902emr5918613ejc.308.1656369489129; Mon, 27 Jun 2022 15:38:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656369489; cv=none; d=google.com; s=arc-20160816; b=JxVEr1lYbry/iFZwMgXih+PTYcruKagO50HL9NO3eNDpQCK+THeSVgemrWWvjhnOub h1qOvMVXDifDbM1kEJZJZCn3YekBrqNiBM387l2GblRoGK6HPdlH+KG0dPQpkbgzsmwl JQasrqCdt6rNEBHcsWrHMYssIh7ki/DDFMyGTHaLTPoLgw94BgFcHbAq2v0I8w8cTvzp 584nh9+xdTeE2aqR4qnip0R1ZNQzZhHYkRb9mukD8HW+F7ktjj2F32RJMO58pGSH/Mae cWhSksl/853/rvquy8BYgqRltzfhP1l6Ynsgv8pEqCeAZEClVVn1pFEYsEC7xmMWCz3N AWrw== 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=LzdEeqp6y3rNfaCRkuMQHm+DLARWV4bK6mXHFRuOF8ArJs7c+TBksK08/Ubjnh4BfI OJ2XJ7YykkCAcElkWuK0Jc6qJk6C0bVEWfStu7NhkSMqoVtTG9Erlyv3iQclfxQJR7gh brG90YY0anWDeNMMdr5bJc9hC1jAX7/yyl2jQjDIcngcfTADbcTL+5SPl8k6UO9ywo1v mcBHtPYcsDGjsWnYKX0UyxJts+lUhubivFG6eCq4lRr+YVMe7puCTcsBtzvrBnd0i2wY d8WkytqhAqc61kZp0xJTSkEZ1SrUqz75O2/1o3GGIHAwhrHd00QYzqYK/2OoZ24QL4aF f6XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=cV1bi6lq; 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 n14-20020a05640205ce00b00436d3f2d36esi15535775edx.318.2022.06.27.15.37.44; Mon, 27 Jun 2022 15:38:09 -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=cV1bi6lq; 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 S241628AbiF0V4E (ORCPT + 99 others); Mon, 27 Jun 2022 17:56:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241291AbiF0Vyx (ORCPT ); Mon, 27 Jun 2022 17:54:53 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BCC35F7F; Mon, 27 Jun 2022 14:54:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656366892; x=1687902892; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Ammg3A2Mnovfv+rRVb0tQyZFWoZUYbJqVmLEz3yGWKI=; b=cV1bi6lq2myWZ6zNXdb5Z396q0MVVy/3KHuUEAYPrdDC/Uw0JyJZZFxC nbBq2JBmArarkJsBI8z+t7zpFknRMfNhFdW+a28rk1tJR4KTANoF7hnnO voiaBeM55lvUprLgVVlZONOGPL0+cRi9mkjMQuG7iDZTv58nEAYkUUI2Y c5MvCiV1O72CoUFFlB7Zx0PQ99hHgy7KA/lclLxO4lhiKSa48Ko3ps8f7 9HDJuXZNWtwO0hfOvbLBO9QWbWxBLEAJd8dAof5vqFtE5zWIo38B3rRUx 9kxbymB+glp+F37fJgRyuT9yVooTSdY8FfcB8pG/Ra+ymAufsaKn0YjF+ A==; X-IronPort-AV: E=McAfee;i="6400,9594,10391"; a="281609510" X-IronPort-AV: E=Sophos;i="5.92,227,1650956400"; d="scan'208";a="281609510" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jun 2022 14:54:49 -0700 X-IronPort-AV: E=Sophos;i="5.92,227,1650956400"; d="scan'208";a="657863481" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jun 2022 14:54:49 -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 , Sean Christopherson Subject: [PATCH v7 016/102] KVM: TDX: Add TDX "architectural" error codes Date: Mon, 27 Jun 2022 14:53:08 -0700 Message-Id: <0cf120bfa07e12aa648fc66fba19df7506c69ebf.1656366338.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=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 | 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