From patchwork Tue Apr 23 16:21:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 13640346 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 1DD94C4345F for ; Tue, 23 Apr 2024 16:24:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A37D16B012F; Tue, 23 Apr 2024 12:24:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9E8066B0131; Tue, 23 Apr 2024 12:24:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 83A766B0132; Tue, 23 Apr 2024 12:24:45 -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 6536C6B012F for ; Tue, 23 Apr 2024 12:24:45 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 1FF451A08E3 for ; Tue, 23 Apr 2024 16:24:45 +0000 (UTC) X-FDA: 82041320130.15.84C8F83 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2060.outbound.protection.outlook.com [40.107.212.60]) by imf05.hostedemail.com (Postfix) with ESMTP id 5E4AD100016 for ; Tue, 23 Apr 2024 16:24:42 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=K7W31fdf; dmarc=pass (policy=quarantine) header.from=amd.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf05.hostedemail.com: domain of Michael.Roth@amd.com designates 40.107.212.60 as permitted sender) smtp.mailfrom=Michael.Roth@amd.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1713889482; 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=BY/I7ozujrmCPZSKVlzIglXdTpwpe1w6o5CGT23N+mY=; b=jmggNLPi5qSAXQ3xSPncnMWYs910gEYdzriH7G+WnH99LFYmmG1/6h9jlZ0X3JSes3sN6a DmzXVeNFar42Ju8x3MGFzbiWZmZj+lTTWi3GwNIXQ8pYvDg8eUBnCYVWlZa+MSZBFNqYCk ZzE499jxgRMTThfq5yCi7R+LPs0SE24= ARC-Authentication-Results: i=2; imf05.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=K7W31fdf; dmarc=pass (policy=quarantine) header.from=amd.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf05.hostedemail.com: domain of Michael.Roth@amd.com designates 40.107.212.60 as permitted sender) smtp.mailfrom=Michael.Roth@amd.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1713889482; a=rsa-sha256; cv=pass; b=CIEr1HJtTp9/p94AMOhkPWbODyRFLYxOyzvRZyD+YLqSQW+bKDysKHoyj+ZGlPNZ7UmEuP RR4GLPsgdmSWe952E6DnDDPZrg1fZkXIeVx4zAPbAHPqV0pdWJIh28gHLdrsv6vcGpiVUJ sq34gwnBMulprzVV/WtOqVs2zKl7Q78= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J/EE16NayFsF+FhtM0Iu4/GSdbjyo4C1iBtsaTcjqL7kI1kZMLW+hJCPfwKUKl+mCBOtfyxknY3wlOsFsB7tF2WPZaYVm0UqOuc0aTYzcTlX2N5inQUzs5LFWSpUnfFQ+gMIsCWXSGz1pYCoOPWppTFwZQJCycCEdJ3sTm22Kt6ePj8gH8jDMNc+mENDYC1IEcP03aat1ZKLaAViHhTQHPxhSyuW7iB6WJKwYvtx+pEwBRTB/+IFPnJeSeIWc+xHOxmo/JBgXjt78XsoPAn/Mmgzvilry1/GC3uyp7/kL/vtEL0o476OZbscihkush4CdVcXytDlj+TL3YweoDJQow== 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=BY/I7ozujrmCPZSKVlzIglXdTpwpe1w6o5CGT23N+mY=; b=mP3vAyygOeIg7PLdaITMakd8snoad8LNZZQp6LVxqLb9ik73NsQTW8O4Bd9ddSlayeqoy7o2m6NuS4mZ81WMkwvDD9VNQCowHzEykQXaYM8XkAYgArGk8+X5tYk3UO+0bwCRC1IRU+QhS0UDE5CVyS6jNlrZvqnKNiW9S0U3hBAMSB8lMhuJ64iLSVg/CF6AJZk7MbffRKt3IkKButdbr9Va3RvLoGZcBrAjAJjr7pA66JnJ6r7ZWkKyeWRcrvPmkSpHsPU8mZhSvG46o9NJY56lP7Z5orGbFWOf+jpbCcug4ibT57zr0Oeeq0N53jRRTCMp/lu2lRU3o7DseBDyYw== 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=BY/I7ozujrmCPZSKVlzIglXdTpwpe1w6o5CGT23N+mY=; b=K7W31fdfdblGwh56Y06HEWZETCOz4akX39lfYFbMpVLqbrBgJ+JMqR0WTcEv0IZiDnDb0OqsFH3W8L89NG0H4w07HiUngKC2UDSeSVMNF0l64JaK6R2XmPmxESK8jVUDZfmqnRxXcX6NZKHGShaj4Wv8wqZuW8rTQ7JUHzHmei8= Received: from CH0PR08CA0027.namprd08.prod.outlook.com (2603:10b6:610:33::32) by SN7PR12MB6837.namprd12.prod.outlook.com (2603:10b6:806:267::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.44; Tue, 23 Apr 2024 16:24:38 +0000 Received: from CH1PEPF0000AD7D.namprd04.prod.outlook.com (2603:10b6:610:33:cafe::54) by CH0PR08CA0027.outlook.office365.com (2603:10b6:610:33::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7495.34 via Frontend Transport; Tue, 23 Apr 2024 16:24:38 +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 CH1PEPF0000AD7D.mail.protection.outlook.com (10.167.244.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7452.22 via Frontend Transport; Tue, 23 Apr 2024 16:24:38 +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; Tue, 23 Apr 2024 11:24:31 -0500 From: Michael Roth To: CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v14 25/22] [SQUASH] KVM: SEV: Add support to handle Page State Change VMGEXIT Date: Tue, 23 Apr 2024 11:21:40 -0500 Message-ID: <20240423162144.1780159-3-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240423162144.1780159-1-michael.roth@amd.com> References: <20240421180122.1650812-1-michael.roth@amd.com> <20240423162144.1780159-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: CH1PEPF0000AD7D:EE_|SN7PR12MB6837:EE_ X-MS-Office365-Filtering-Correlation-Id: 5cb5a873-f16f-4084-e72e-08dc63b1df23 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: l6waoU2XMOWanTkZ5WtTnMNx+kcSGXWlJf643oUy21oNNktezfgEw97q2sr0J7spJ1O6NkYxXNFOCYq6CaVdZMeGY0y0ExUmD/yR2ts78c17EJyxcwRoPiRf31oDwUI8kyg0Lc4xPyKjcE9SWpwoJxvQVwRJALwRPnQQSkGHrhnEeY6y/GI9EG9g9KgkE7dgAIYulnrw4JjP+X6Y/o8VSQA9+6qMgUYLfdY3ckK8Q8ovNiqOSFOYGW6kdqQxLPzhee8oxgeVoXedV7xQ/s0kloOQKguPc+RABnxSogeGR5oXcDe4eFbcU3ZAW2ubA2tRlPddbOMmMjfBFa1UFgUvw7Nx+PDloU+LGbGAceUy1oRVmEsuy8AzhWbMTGcTl2FA3nXQasbq0BCRv/8pI+NDKEaEXA2wciKAh2TStB77kMa/krYen79XHNmv/Sf5sOtyPfwjWFnhEAoSJ4Db4ZyYBbXN1Co/48rsIL9AsMTZSQbXJ/MClb+4Hcisz5wIqoMcVmq2kMp+9O9rHFQqpTppUt1zIJKquGvQUo9etSbocUBBYWQOGrmUZbnYOISMzTJA1T/7RW6i+44EwdxxknlDl4nByy0d9g/DOBqBwaxjPwi9YF7Nc9u89ytkMzVMymQ5+wmpDOHYKfCFhI+nKDRtI01YdetCEWEx+TqMMoZRJHZ8yTJJb+WOJ/BNXvdgarBLLD6dRNFTx7Bz2QIf+w5DXAiBZb85kyaPac9h4iHSMm8yx6fbJN3BOfl0UAdqs0+oujAppj8VLMnatATvUJUPqkC3Nr5mw31s6yrDXRW8Cy8vuopM04t2MZBnwysomHSWFyHATpNOzpA2fm2Z/w18Z3nPdcr0HDhjIoK3aA0D4fitMaCAJ8EtjUNDWWvD3wJkupkRkoOL2ZkJwqAz7xIv2iBDZbn1ebbRCwNJDgzTjZsrhhsM1fPcVy1gwG2CNN/PcIPsiPdM2QBn03ksxudd6jKWJAh4OcQCBHM3UrDYMHhuzSpoZJtBjpyUlv+ja3dXpySm7q/9h1+zaE4mpMViaW+lmdL34YRDqYTZ6MABaClnvNX9gAzDo8Khy5bQFfKgUVMj3Pkn/POi2x4eq+qfRXbhfLfmFzy1Cpe0hqvyfTTIv2Vg4DMiI/ZwEycmRL5BUGrQhcYxoZcy1atBeoSQ3ZeRYeoxXDNuCxYEfJwpjPhkwOnHOjaDbE2wq5onJzpQb2obusAN93GM7INhRoNzsxddB9WKYK/x9g5mG0XBazFuEVB8EdPGLVYXc1GJd6jF/awoDmylL4OUp7cYdQKUQcMehNgHU9bvWpCNgeRVrdp83BH1OJUqHE5PfiD8m0xzqlxdX+wG2G1wr+xS/zMOAD57r9VPTjDptS53uMR1EuQ= 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)(376005)(82310400014)(1800799015)(7416005)(36860700004);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Apr 2024 16:24:38.3176 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5cb5a873-f16f-4084-e72e-08dc63b1df23 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: CH1PEPF0000AD7D.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB6837 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 5E4AD100016 X-Rspam-User: X-Stat-Signature: hr44ahpejomgbwytmacwx6kp3fxfc46p X-HE-Tag: 1713889482-237257 X-HE-Meta: U2FsdGVkX1/TGzBdwk2z/jBJnyKV/vTtJ+LbjEekP9pkHakgL8MnuQvULY4x7yDiJGjXqQCqULCb5uTxCb6d6WpScjtxW0CoQAbC2zZtsewtL9HaL2zrcepCL1GEJFyuLKpywnMU7T8TlCP6aJ/N3qLm0Aw/CpEuc4J4679xJEEabUl5VJPk5UqavELHXhkObAHysbLL1J1OOR22GueA9YtdbPnhERtqXJiQ3EVIG0KyofsQWKl8xcZGiT77MH5PsEa/P2/6j+aumYpW3jPJJE9kHKtuxQEReIJX784ZBfAUeoak34X8ifOGbDx9y5TCojmCeVSrmFlBT18VPOtgfeyna26z+0nwotBFiKHX1LxCXDDwTVWAAcYoGdtFjQQcux7dma1bvLB5Aw5t8dvRK+f3imnLSo/M5N/NUBvdiiJDN2clL6eDkbRw1rjHM0HTPhicfmNgJwQi3cbaHRz+9icWPCCflyBksNTq3faOGzxggf8yt1r8hZXjhkDKkeA6d7jU4M9CO9FkxCMIG69Dk9nUfqbEKsJi47Z9fxeWcgu5dvAij9xdPOilQkyWtIoRCAIHG/PsxaxPcjeJF8w/wTFAxpK4MFSrNacgxq5+D+rcH1M4H+UObzLpPXgOUVz8wuAcJ8CD2yCMPlNgeLGAGNzdbjkEXCnYW1qdnemt4B4PzdzX/dWbaruUjbUaTCrPr/OWRH5a64F9TDNOlOKB1tDWl/Y4V26WGYAhfnOIDm5k+GvmlyuRNyc7p4IBSXV5wANYJmDNK8taJAnzXCjYr0HFv7uA5nUtSygQ6YYXC9k/65rwMEuWb2wmpUFcjEHddC6EyRz+k2vkdPK1EeBuAdrmz+MoIUFDOM4gD5Dm3Y6UETwlT5SaSEPk6EWPxCvuwNm2Rl3Zy4cdkpYdLNM0gfQqSXm51+NeJVMSJH3TqGzr/PGWijz99/sPOWWrDb/aNy89lreFRn5vEuMZN0b OuQ== 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: Report an error to guest if non-SNP attempts to issue GHCB-based Page State Change. Signed-off-by: Michael Roth --- arch/x86/kvm/svm/sev.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c index 0d8fbd5e25fe..c00081248ffe 100644 --- a/arch/x86/kvm/svm/sev.c +++ b/arch/x86/kvm/svm/sev.c @@ -3289,7 +3289,11 @@ static int sev_es_validate_vmgexit(struct vcpu_svm *svm) case SVM_VMGEXIT_AP_JUMP_TABLE: case SVM_VMGEXIT_UNSUPPORTED_EVENT: case SVM_VMGEXIT_HV_FEATURES: + break; case SVM_VMGEXIT_PSC: + if (!sev_snp_guest(vcpu->kvm)) + goto vmgexit_err; + break; case SVM_VMGEXIT_TERM_REQUEST: case SVM_VMGEXIT_GUEST_REQUEST: case SVM_VMGEXIT_EXT_GUEST_REQUEST: