From patchwork Wed May 1 08:52:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 13650320 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A76BC4345F for ; Wed, 1 May 2024 09:05:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 961896B00AA; Wed, 1 May 2024 05:05:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 90F286B00AB; Wed, 1 May 2024 05:05:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 73C326B00AC; Wed, 1 May 2024 05:05:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 55D126B00AA for ; Wed, 1 May 2024 05:05:57 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 185BBC074D for ; Wed, 1 May 2024 09:05:57 +0000 (UTC) X-FDA: 82069244754.12.A915C81 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2082.outbound.protection.outlook.com [40.107.93.82]) by imf11.hostedemail.com (Postfix) with ESMTP id 5CCA740023 for ; Wed, 1 May 2024 09:05:54 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=SZ1fMWAK; dmarc=pass (policy=quarantine) header.from=amd.com; spf=pass (imf11.hostedemail.com: domain of Michael.Roth@amd.com designates 40.107.93.82 as permitted sender) smtp.mailfrom=Michael.Roth@amd.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1714554354; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=sQbyuPzaOb+gGVc90x/XMaLFc7sXGq7Y/GylR/tiuKQ=; b=NgwktHREqquy0FkAVvPDOc3q6wo0zC96u43oq8peEp+Gv5uY1iZtriy1s02LXMKj87URRj rFMM4R9S8fO53Qtl1rCRTccUgFa2s/90zfye5DXE581tjddbQ1eyi/kdy+surgBCu9MQ28 AUhPJmHCxujpDlUURsTuEl/0T3+fBMM= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1714554354; a=rsa-sha256; cv=pass; b=OndshCKyovx5+GBzzqEf5EpAKd3u3ivcMY9uJCLQ18cwf8KDlhuKZnJJTzi1+h/peQ/S9R 2ShVhuNK+mytEM2w3/JIucr2hImaCX8Hq+bcYF4wo7l5hWc7h9y6nBwsAIWY9TDatqBczg Ox9M0XXp7yMPL4OYH0ccxQJwE8RYm44= ARC-Authentication-Results: i=2; imf11.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=SZ1fMWAK; dmarc=pass (policy=quarantine) header.from=amd.com; spf=pass (imf11.hostedemail.com: domain of Michael.Roth@amd.com designates 40.107.93.82 as permitted sender) smtp.mailfrom=Michael.Roth@amd.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XfYrVl9/goC4brzg/QQOXl518Yd0Wj7Um13k3hXNXRBFVw8rf7oWuSTpmbil7S2gV+CBWQuZ+xdu+1ny8wwNuHEz01RjTm2OtA3uWfdB2XI2bGXuKrGE7PtKqByVq/TvkmfzwqpCde23U+wB7c+Fl1CWhEJNsKUC6h0JjmNTC28UWW/NgFE5bAnfHOAk2Np80f3Jw5UvllAOla3kITtU06YAnRdALEJZTQHQn9y+1Xpi4Dkasc64Vqp+RuUXG3hBrW4hJEnkIVumILamLEf3amqhlEP4xbEv4rt56U5hwJ6B0uZVMn92bQIjlWc/XIB+shL4ybZN7apkpce/EXGoSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=sQbyuPzaOb+gGVc90x/XMaLFc7sXGq7Y/GylR/tiuKQ=; b=UwZiqTgEgUjZj7Zg3EVWAj4GcS6yEZP/kvFUKgLrWb1rqS+OL2wadXKCLBPZEDtNowLAU4UAdItCa6lnLLE5Qt0qtGFyZ3Ptht1q3+XAiTXaKxhXRs+o/jShfdt9TqElp+SRlK9f4ZfBKXYahA01rtgo30l/+mMDQghieYwVi64mGQTRCcBIu2r+CgXc5lfckLdxCAAtbPZQd7DKKCSaqtAdaaCZyEL09V/g0gMgeuEVsg3Xa7nm3f7pzC10uqJslKFAzVAUNNp2lkyAElLeXXoLTuiKObq2rwp5QKylleda/H600HHME2wAN5iHxgfzB4QMgE2pW0aPUYIxa/ZWcA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sQbyuPzaOb+gGVc90x/XMaLFc7sXGq7Y/GylR/tiuKQ=; b=SZ1fMWAKh8MSElpF4nZOf0aUZXby/B8TftVqawT40zBqyKXGiVq7Jc2Io/d60jDhpBkdKjGbVUaYQkCqLl3RIdDTZxjRrLSx2jt6NNxzhEYZbDudN9LdgC3YYze7M25MFLZkjcqCG8Bf4PeaKwJ6ZfhCNYr/OT42wbHpRN2NO/M= Received: from BN8PR12CA0016.namprd12.prod.outlook.com (2603:10b6:408:60::29) by MW6PR12MB9019.namprd12.prod.outlook.com (2603:10b6:303:23f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.35; Wed, 1 May 2024 09:05:51 +0000 Received: from BN2PEPF000044A3.namprd02.prod.outlook.com (2603:10b6:408:60:cafe::a6) by BN8PR12CA0016.outlook.office365.com (2603:10b6:408:60::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.28 via Frontend Transport; Wed, 1 May 2024 09:05:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN2PEPF000044A3.mail.protection.outlook.com (10.167.243.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7544.18 via Frontend Transport; Wed, 1 May 2024 09:05:50 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 1 May 2024 04:05:49 -0500 From: Michael Roth To: CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Brijesh Singh , Alexey Kardashevskiy Subject: [PATCH v15 18/20] KVM: SEV: Provide support for SNP_GUEST_REQUEST NAE event Date: Wed, 1 May 2024 03:52:08 -0500 Message-ID: <20240501085210.2213060-19-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240501085210.2213060-1-michael.roth@amd.com> References: <20240501085210.2213060-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF000044A3:EE_|MW6PR12MB9019:EE_ X-MS-Office365-Filtering-Correlation-Id: 63416b37-e41f-4ce1-001d-08dc69bde5ec X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|7416005|1800799015|82310400014|36860700004|376005; X-Microsoft-Antispam-Message-Info: aAZEMNnskWWxV4GkMLp/qWPUuSVQ5DYSGpHj/GDIRiw4KuIUZogB2uB0OLdboEpX/qGOEQ7qGcPHIOAzuFLpkgqDsRaImvkM9Rc9X1XKzfwmVkCSE3z2/snuarzu58ynAKFG8j6jlTjSP0rZjs5bNQ8QUeSMS+5cbSTIBMvIqZf8yHChg2DvPWWwbQYRIAyC+gUMxTWXAPNEayb7b5wRO5Mvg1Y/RWYSEfL88KoUYiZvbNW8cHY1nXIrHLawvrNNXEOLCb22MdTHDi6WnTB76AEMPWwzl6FeFEsXzZFQ9/HgsfyIc1nZ8HSoZGLNpXm3VtKvhMEN4NQs2G5dsJAoN3XqfvQGINPPsUXir4Tw6P6JhD1WZbaRPXTvVGBs9q92MA5FVgV7h5c/nTGI84tiF4a4kMVSu9RpgIYgaP/CERPadN2eDXoiPiUDZTHVwPHrH2Ci7PJ8O/bJbmAs8is7ss+XWOUu8ED3PGNY9atx9sB9u06MmUFVxJZdqeHfL9LGxLiP1NpOaYZNhENK4CiSuIWfJaEB6YI9djfyqNf7WmxYQRNvaP5SmkfcaNsSZ2igcF0s0rmU0uPv5xLZv2UkmRXtQsgzigV4P51fHY4azGHBG2TRHQzQEF5A2/rQWRtYOMLnYJXE1rAC44hKbDt8kJ04ixvwwCt+7k1dZ464DjndFvTwriA8Clri7VcQ25IGW1IonD0ZXI+W8Alfv6ccLb+9pTRYshC0Qk1Z81WYIBc3co+7zi1+Zxb37eUuqnY1u2EQCyLBrHqrfIsWfJiTqRlsUh+box+XIj2ugPgGDY6f05BVL/VZCC3aH0K6VMs1nNV/2b/ipti1Q21ZjDGlfssry3crtfaKePdOiDSVRegEtZsc7ZAaLZe1QtW+4N9X3LW5sJOz+Vwb6/AfKM1D5uOoZap5wK9X877e7ull0+5QC2OfemNtbkJXsSlKlhBCk3A4cp6kGWMWQSRuJtj1FzmUFVtC08tQC08Qn4Rx8vLEPD9/MGmPe9ZU9MpumVItJIerXkGiC5gNixVf5m7NUN3BCyp9NJozMjiX1ftacDVq/opPkdaCyOKY5X6jfEnA9g+VmFvwsJHopH/2HfaqJ2OASIAAqzoy1zHK/FmHKfuQZtPj+3c7pE6aSuRg5ZyTsmKpioy48NeMMlBiAkVmI6mCnBTZl+NRMh9sPQhcMPeuh1pbz6N+AVaywFzTJyyltLsaMzflDrjLYdMtzj0oHl70upZEASr3n4GGKYbkvQb+p3D8QpLI/v+qx7/R8b866kR59WpjtlP4QR2V5EDAmZjWQbnBPzlj0VQy20g6ZvW9Sr1DFZkuKJOAh4njI90HJ4xEv/ESH+CJxDYtzlmmwCY3olX86G7EOSZzF/tJm6LGNG3AfHuYw4py1adtZqYL X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(7416005)(1800799015)(82310400014)(36860700004)(376005);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 May 2024 09:05:50.6327 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 63416b37-e41f-4ce1-001d-08dc69bde5ec X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN2PEPF000044A3.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB9019 X-Rspamd-Queue-Id: 5CCA740023 X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: mpwgoyxoaudefnyiqr6ewdtshgeu3m9r X-HE-Tag: 1714554354-305760 X-HE-Meta: U2FsdGVkX18R8E5+q5IAVsJ7wQdriPA6dj/9pzhenasH9KsVCvJ3eirBYdlDy/mf14M7ihwTstnpzIEjdDk4RzNk5aEz9S169n9PJm/GsyvryLVWUTjtxe4T9Peemb5QHPJf9M9XBmJXpze44b+DEcWUa+PnGii8viI+YzO0PMS4YNwHUQByCg5zjvIPpH4CeJJJ1Hx5WfW3aebDx19ARsGTeH2KQwtVL79crR65elwUx7akOZM0di2qtgoibpxSInCTQVprO8Jc6603tq7Jo/nwbIQM75d/C2Gk4uAuh+nv7GAAVduvBn2VG50EU5vlq250gsTVISV3/BYQ/ypay7OCqeJ1Ox5yCHqyQQQAJK4fUbRHSPOGMmpBT9Ou2Syuo4eWl+JSveuOGdR3Yj96zIMFpchkZHVCxnC0u96v8CmVQc130DMb8WfWbshDS75sqC7kOHPGAyVjTedZkzdByCeOYVWWvD57dn6evKHRKYEF1FEW6cMKoOY9ZncDO6VhIgLuY7OlrfgOsDHYUXBooXvzalo/sG7bZuIfr1dFPWUaapHDkxRXDnXyfezeNKhuEzwjonPFohxwwGOMMY4uTvjlPaOjGHKC2XEdj1OJhIB3q9YXMxpUvZIliTdSTY9TMcqk/IeKbKmTxe8swHkx10Sd+croiP2fqSeWMchks4EmXoO5qVlLV2dDhrRfKh1IG+ePn3DHhpTT5+zwaVkCIhIqtVEowxe8A+kf1my733c8M0MAYlFkeQJBDomwN6v0FQ7nW2blkQcUAw0gT6v8UUSj853y/QtvagINJMl3hPWWwDTY91nPOG8GvQ91GM1bY0dHjDDES+8Os9sTCBVJQw5WMJWdr3rtw/wujn8KZNDlTo7KYZwlxz8Du3Y/2oaGlAoUBckK/wlrCpVjfzKAef7Ztoz+iyePqfEY61y/cQAbsWECyiKZwGeStSbQSWEcw9kKE2IwqsJOIdlanXS Hhsi25LF 47rSi2vyZ4RGLCJhh68SC3XLWkRP70/dS0vVG X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Brijesh Singh Version 2 of GHCB specification added support for the SNP Guest Request Message NAE event. The event allows for an SEV-SNP guest to make requests to the SEV-SNP firmware through hypervisor using the SNP_GUEST_REQUEST API defined in the SEV-SNP firmware specification. This is used by guests primarily to request attestation reports from firmware. There are other request types are available as well, but the specifics of what guest requests are being made are opaque to the hypervisor, which only serves as a proxy for the guest requests and firmware responses. Implement handling for these events. Signed-off-by: Brijesh Singh Co-developed-by: Alexey Kardashevskiy Signed-off-by: Alexey Kardashevskiy Co-developed-by: Ashish Kalra Signed-off-by: Ashish Kalra Reviewed-by: Tom Lendacky [mdr: ensure FW command failures are indicated to guest, drop extended request handling to be re-written as separate patch, massage commit] Signed-off-by: Michael Roth --- arch/x86/kvm/svm/sev.c | 86 ++++++++++++++++++++++++++++++++++ include/uapi/linux/sev-guest.h | 9 ++++ 2 files changed, 95 insertions(+) diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c index 112041ee55e9..5c6262f3232f 100644 --- a/arch/x86/kvm/svm/sev.c +++ b/arch/x86/kvm/svm/sev.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -3292,6 +3293,10 @@ static int sev_es_validate_vmgexit(struct vcpu_svm *svm) if (!sev_snp_guest(vcpu->kvm) || !kvm_ghcb_sw_scratch_is_valid(svm)) goto vmgexit_err; break; + case SVM_VMGEXIT_GUEST_REQUEST: + if (!sev_snp_guest(vcpu->kvm)) + goto vmgexit_err; + break; default: reason = GHCB_ERR_INVALID_EVENT; goto vmgexit_err; @@ -3906,6 +3911,83 @@ static int sev_snp_ap_creation(struct vcpu_svm *svm) return ret; } +static int snp_setup_guest_buf(struct kvm *kvm, struct sev_data_snp_guest_request *data, + gpa_t req_gpa, gpa_t resp_gpa) +{ + struct kvm_sev_info *sev = &to_kvm_svm(kvm)->sev_info; + kvm_pfn_t req_pfn, resp_pfn; + + if (!PAGE_ALIGNED(req_gpa) || !PAGE_ALIGNED(resp_gpa)) + return -EINVAL; + + req_pfn = gfn_to_pfn(kvm, gpa_to_gfn(req_gpa)); + if (is_error_noslot_pfn(req_pfn)) + return -EINVAL; + + resp_pfn = gfn_to_pfn(kvm, gpa_to_gfn(resp_gpa)); + if (is_error_noslot_pfn(resp_pfn)) + return -EINVAL; + + if (rmp_make_private(resp_pfn, 0, PG_LEVEL_4K, 0, true)) + return -EINVAL; + + data->gctx_paddr = __psp_pa(sev->snp_context); + data->req_paddr = __sme_set(req_pfn << PAGE_SHIFT); + data->res_paddr = __sme_set(resp_pfn << PAGE_SHIFT); + + return 0; +} + +static int snp_cleanup_guest_buf(struct sev_data_snp_guest_request *data) +{ + u64 pfn = __sme_clr(data->res_paddr) >> PAGE_SHIFT; + + if (snp_page_reclaim(pfn) || rmp_make_shared(pfn, PG_LEVEL_4K)) + return -EINVAL; + + return 0; +} + +static int __snp_handle_guest_req(struct kvm *kvm, gpa_t req_gpa, gpa_t resp_gpa, + sev_ret_code *fw_err) +{ + struct sev_data_snp_guest_request data = {0}; + struct kvm_sev_info *sev; + int ret; + + if (!sev_snp_guest(kvm)) + return -EINVAL; + + sev = &to_kvm_svm(kvm)->sev_info; + + ret = snp_setup_guest_buf(kvm, &data, req_gpa, resp_gpa); + if (ret) + return ret; + + ret = sev_issue_cmd(kvm, SEV_CMD_SNP_GUEST_REQUEST, &data, fw_err); + if (ret) + return ret; + + ret = snp_cleanup_guest_buf(&data); + if (ret) + return ret; + + return 0; +} + +static void snp_handle_guest_req(struct vcpu_svm *svm, gpa_t req_gpa, gpa_t resp_gpa) +{ + struct kvm_vcpu *vcpu = &svm->vcpu; + struct kvm *kvm = vcpu->kvm; + sev_ret_code fw_err = 0; + int vmm_ret = 0; + + if (__snp_handle_guest_req(kvm, req_gpa, resp_gpa, &fw_err)) + vmm_ret = SNP_GUEST_VMM_ERR_GENERIC; + + ghcb_set_sw_exit_info_2(svm->sev_es.ghcb, SNP_GUEST_ERR(vmm_ret, fw_err)); +} + static int sev_handle_vmgexit_msr_protocol(struct vcpu_svm *svm) { struct vmcb_control_area *control = &svm->vmcb->control; @@ -4178,6 +4260,10 @@ int sev_handle_vmgexit(struct kvm_vcpu *vcpu) ghcb_set_sw_exit_info_2(svm->sev_es.ghcb, GHCB_ERR_INVALID_INPUT); } + ret = 1; + break; + case SVM_VMGEXIT_GUEST_REQUEST: + snp_handle_guest_req(svm, control->exit_info_1, control->exit_info_2); ret = 1; break; case SVM_VMGEXIT_UNSUPPORTED_EVENT: diff --git a/include/uapi/linux/sev-guest.h b/include/uapi/linux/sev-guest.h index 154a87a1eca9..7bd78e258569 100644 --- a/include/uapi/linux/sev-guest.h +++ b/include/uapi/linux/sev-guest.h @@ -89,8 +89,17 @@ struct snp_ext_report_req { #define SNP_GUEST_FW_ERR_MASK GENMASK_ULL(31, 0) #define SNP_GUEST_VMM_ERR_SHIFT 32 #define SNP_GUEST_VMM_ERR(x) (((u64)x) << SNP_GUEST_VMM_ERR_SHIFT) +#define SNP_GUEST_FW_ERR(x) ((x) & SNP_GUEST_FW_ERR_MASK) +#define SNP_GUEST_ERR(vmm_err, fw_err) (SNP_GUEST_VMM_ERR(vmm_err) | \ + SNP_GUEST_FW_ERR(fw_err)) +/* + * The GHCB spec only formally defines INVALID_LEN/BUSY VMM errors, but define + * a GENERIC error code such that it won't ever conflict with GHCB-defined + * errors if any get added in the future. + */ #define SNP_GUEST_VMM_ERR_INVALID_LEN 1 #define SNP_GUEST_VMM_ERR_BUSY 2 +#define SNP_GUEST_VMM_ERR_GENERIC BIT(31) #endif /* __UAPI_LINUX_SEV_GUEST_H_ */