From patchwork Tue Apr 23 16:21:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 13640345 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 8D808C04FFE for ; Tue, 23 Apr 2024 16:24:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1ABC46B012D; Tue, 23 Apr 2024 12:24:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 15C3E6B012F; Tue, 23 Apr 2024 12:24:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EF0D56B0130; Tue, 23 Apr 2024 12:24:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id CD3C46B012D for ; Tue, 23 Apr 2024 12:24:18 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 86743A10D3 for ; Tue, 23 Apr 2024 16:24:18 +0000 (UTC) X-FDA: 82041318996.08.E0CC132 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2071.outbound.protection.outlook.com [40.107.96.71]) by imf01.hostedemail.com (Postfix) with ESMTP id B08A44000C for ; Tue, 23 Apr 2024 16:24:14 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b="41FS75/K"; spf=pass (imf01.hostedemail.com: domain of Michael.Roth@amd.com designates 40.107.96.71 as permitted sender) smtp.mailfrom=Michael.Roth@amd.com; dmarc=pass (policy=quarantine) header.from=amd.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1713889454; a=rsa-sha256; cv=pass; b=hH8nrZ5WyjdhpFkd234N2jY9VrQvbGNpQ51Y7U34CF6/t3OWo39s64oBXsRkaQfZ7whtnV t+jEPS/4i1BC/dKyHhrRprLr0EJjm+Q3yZz/K4L8sXRYHhdRJibW0xX9LNkQWa1LgmoP2d aYGEON0DNkMJO23g84ASy6OHN126Nes= ARC-Authentication-Results: i=2; imf01.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b="41FS75/K"; spf=pass (imf01.hostedemail.com: domain of Michael.Roth@amd.com designates 40.107.96.71 as permitted sender) smtp.mailfrom=Michael.Roth@amd.com; dmarc=pass (policy=quarantine) header.from=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=1713889454; 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=42poRSSSZjU7ZDIoATOoyv6W5iD879/831zPKtREN28=; b=vl411zJzogzOScbUlZ9X0ylZ8cjQICf+WwhtGVZemLN3L6KRVeXkEgFdp1169yNy5yed+h +i3eLJzA8Vi60LlFrmSWiqJYoTjlJeRcgiftNWPc0ClvLlTLPDotVCw3FtWB1/ok0KIMXZ eK6sGZEVtrxSxyDLelJSDPFiqd19sW8= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UaGiWUn6ozUhSQFnBvZUkQj60BR/s8Aui9Yks9nOIoSyex+lgIeccwbFhdgM1pnQAVyjY/BcdI3PLtEt1MA8YTdBWqBqgbLhTcOPmLT1BIalAtJ/4LCBRLFYcKTYTC+y5PyIuZ4HSP5hZKiLIJg/rk5hBcud4xAcPQ+5jih5OWRzVkYHDyJHHwpao4g/Zxzz3X6njiZ5hz3zI3JIh+3zjVoPkziEo/uj1ofvkHRZGCeTsNCFVr3y/qAdnGBJygLABawpy3ME20gRrDnRbsEdqAR5AcRTV04xgL94x7eBqS3UGKjuCVpMzNR2iyIGLHrqBYbETDvyy4HqhxO652EELw== 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=42poRSSSZjU7ZDIoATOoyv6W5iD879/831zPKtREN28=; b=OVM2Nm4qweTtoHO/vFQXmYfbq5E0U0uTaY/iB5KP4ckVzCT28v641VwgtSfkIKYLezhPKw5WqA/5QAGSSePywQns9mC1hGsqfzpJhwYYAjj2smAcVZCy5M6YinAx0Ya2Dy0mJWFmxjHjvuYM/Yu3GCAI74qEqkBD+z9GnO+aiByOI4k4DWlha2slcHYbOITFW/4xbaVDOth+jo+TNPf7Tr81v74nEERdZdn/sbyYJW5N9nft4v2VsqI5y1FT/mqlqs/CsjQYxZvS15WtLQTUkfVLGfXVLmRhta0rG1r0PWAL6JE46PasfHcC5FEiu/K+f22jhpB04K2RUSDqg603nw== 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=42poRSSSZjU7ZDIoATOoyv6W5iD879/831zPKtREN28=; b=41FS75/KPaWpArDiiBZLd+PkK5YTj51RaEea0Jh+aEQv4jvZUJYowTYe+zvf8XC0K6jPS4oxFESWXPeY9eAjgYDT3j3N3AKcvj8wCtXznXggM4uumWQfbRVtfnUFCF881LUPRDb9T1PqrFf6xoO6ro+T0Ybw/4J4yY1eQkcvMlY= Received: from CH2PR05CA0026.namprd05.prod.outlook.com (2603:10b6:610::39) by SA1PR12MB5637.namprd12.prod.outlook.com (2603:10b6:806:228::13) 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:11 +0000 Received: from CH1PEPF0000AD83.namprd04.prod.outlook.com (2603:10b6:610:0:cafe::df) by CH2PR05CA0026.outlook.office365.com (2603:10b6:610::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.22 via Frontend Transport; Tue, 23 Apr 2024 16:24:11 +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 CH1PEPF0000AD83.mail.protection.outlook.com (10.167.244.85) 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:10 +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:10 -0500 From: Michael Roth To: CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v14 24/22] [SQUASH] KVM: SEV: Add support to handle MSR based Page State Change VMGEXIT Date: Tue, 23 Apr 2024 11:21:39 -0500 Message-ID: <20240423162144.1780159-2-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: CH1PEPF0000AD83:EE_|SA1PR12MB5637:EE_ X-MS-Office365-Filtering-Correlation-Id: 3e43b350-c4c4-4d9b-040e-08dc63b1cebc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CClBPY/hTgsf3/TZ1EyxMIJJ65mWV0yWnXodD/weCP8SiKzFUmyns/Zs9Pnd8QlRqugiHlst36tFTTadDsAZNlsJVUi3kjSx/ppeD8ybkx6GOWn8BWxYC96TEd3pQ2h5EN7oDcaVCwrMKt4eJXH6DJHqvD0yiOPdosXzm00Gf2vV+Rxkwa+JRT1prB8O9HbPKpruwyPHcNGywDH1A2a4MRRnZQYCl4A+mLJhyOnQgdRBkCkk4YGkI0PuH+gQT5G2szr/yxMtNmLYGNwy2Eq4SlGrvTbuK3RlfNa5J+yKPBpDAkHxkSS4U2c3vdlA/29S/e+SF35Q1pmzbgreRxszIsaOLPjXZUhPH9UArWZ2qFvAHOQLjOySFe4uCpi/QOLD8INHDZ0+fbNtqxtLUoVra4o0xTiB3OEx75AL2XiS4CWVqI71E+NcHeOj6d+5wac9caecwm0xjdSAd/4cjdQ7CSur3tQxZ1OlD9B7L/xsNoWi70Jlt2pyAhZR0mMgdto7a7w8t8+YsLzoAxeVpA+99waPRZyRh5YxXHzNHEvzM0gzJ45lEWHuDDqyaTSNEK4J2/lDRtnQt6jN34m0Kgvrb5HUGn5HG6h1XLVDX4osB67RXJLkvfp3QfH/pWQbO2XKSUbDYhXyB5N9WFiPtZ/Nh3hCguMSLKiAqRDkoXngY2GHpt4u1E5YZigdBbYCLS/bgtzD+Hl/LJ486FIHVcpsfTJTkt+9gIu2o33YKML4qUUqRJdNUw6D7i/tWdl2M4kzpDN6aAdBXsqKGAXQ+XTAbAc6PLh3cJGkXBeY4YVbJ513zeM7a9rY+PcrBXSuG1OpZyYxLF6QuaKWbj1pMATPObqskFTVZFhJ8FJHJzOs/NollXpKwdSUQU11QPv3q7rKOoiiJF8L4s+T+JlRyLgHjn1ihsvCFqvZyuPICKVmA26dLh0dKIJ2B5f/7iiCjE5my5Qjl3pRefmKHzowEQym9Bkd9HownqeHcVY4dIRwa+WpoVjUqOtRrqwTMmR9C9prA1Jrly27ys6WX4Vu3BwHvmUt3u3121lyXMCUZDY4u1JKT94AM/D3dnQFxN9Hzgswa3z/ev2vpH+MnB6v81U9eRj8vNDqdqFo6pjmFjqmNV/vRv4Ze8+TTs3GVq70NmmfCAhTI6IXvbk6YTAoI/0JCTW3n+g3/m9vUrcsEJUibMEsdzGu/Hv2CrWv6f15qbUMQExlih71Dwg0m4QDD86sy1jGP66V+4NXKqyt5KUgU7K2lHqm4J6hhEWt9U2EvLj0t1Pg/TKrcaR+MxdK075afJtyJkcqunG3vNC2trJZSvjkR+f2Tmo5Qum6ufmuGeRe+Cuep7qTwBWJQJbkZAIns+rjMzlBHWt4oH3GYJHicjs= 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)(376005)(1800799015)(82310400014)(36860700004);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Apr 2024 16:24:10.7776 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3e43b350-c4c4-4d9b-040e-08dc63b1cebc 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: CH1PEPF0000AD83.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB5637 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: B08A44000C X-Stat-Signature: xrn6eifxqzk6kuufx1xqr5ysnfqz6ys5 X-Rspam-User: X-HE-Tag: 1713889454-556313 X-HE-Meta: U2FsdGVkX1/CeShc5nP39PEDsDna2XO07Ks1a/JkaWZow/8YwFeagJq7ut1bzOWRcYqEoVXyQtT31bp/GSKbw0tyWnC+m3lma9LH/8LjAMyENnAWDJlJZoI1FhFmd0QO8tN1Qk6yOzh0vBEknKdVUxobi1Mw8lbqQQhGqxkjjNK6nkdDTP0y78K2j7ur1LzABLsak6rC37B9OmNvMSD3Xigl2FAwXQ2GD/m/1IKudd6qCluc0rzYsRJV0Msi7vCV8CZy3Y/lIkWkXUrPktdJDBonA58aMgIE1D/Q/Y7lZkEbSA98d8CcEpHTQ08g2AISPWbtnPhUQBeaOGNzLHanWhsi492S38S7FN06+14IS8ePu9ct6Mq7XbhusMmiiolY+q6W3uEnMqwDoQc085Eg3V0ub8rQ+9J30+sdLeVvEyIjpkYNICMrT5bKvbP9ko/FRstVWtsLULrHN+FtFY77hFrzt3V0APGywxSQYjvtHdRoZup16Qlfh+jLq0JBDhzkTmAEyd2jnROfA/8TzTJxch6h3hb9fPQ0HL1HtgwNxvClRCee6kb+UpCA7HtG+I3q4KYX8XQDb0RkoTPiMXsrNcviZTeXyj688LX7BWdDAEc+/wKlIG7e/X6mM1fAq8WzjMNFK2q2rNQTunHj7I896mT2wKjYslY4VmMH+/NBtrk3p7UyfLo1rSeKtXON49jv2nAkNqnlf37VEd60WrPBL3Tihi8dOtWixMgKBobC99lg9i7HUOsUxgyETOfwD0Xi6Yl4CvTOyQS2hNEQL2x9cV55qwdMbCWDYDZ38cIObSW/w6i6w6a/lnh8zQ8/R4eKlgXFSBVWiWnR/2juX9Mpg77EGvWMbbjX9xumobYjo7fydUYPrqktAVRCVuM5LWIypogVYKCt7+YDN+aoiZQ2QB/l5tJ2IZI7NBhrk0zL7EAr8/UYTFmNOsjNxta2KlByEBpId0h9U9rWsSGJlTD PhGimHiS AVccCZag8AuJbk7WHqn82AL6eES6o4HSzWAbX0Qx0dA1HRUGIVo/kjaTR2WwuhRVl/YF4NPd6MBcZZoSZEUF3SZziXnebipkWX9oJ1JerwWv0PFqA6lcYQulv6aaI25f4RFwKIZ8dMMR1HCsnXsSiy3OuO4dFVrk5Qg+00V1LRwhltRzBYUPuHPnbT2dBrlVNG8IW959FJb5xBLjjD7PE3dy+FTz3ZDRHqJO0a/tAN7+7CENxnDbPBr06WxWuon2HAtkvAZzN15UF8uv0Fw0ZD+ULPAjuUtbAKyx9p/AgQZCWZry+w3YROUIS55D2s66pltzsldhBfogG99M= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Terminate if an non-SNP guest attempts to issue a Page State Change GHCB request; this is only allowed for SNP. Signed-off-by: Michael Roth --- arch/x86/kvm/svm/sev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c index 088eca85a6ac..0d8fbd5e25fe 100644 --- a/arch/x86/kvm/svm/sev.c +++ b/arch/x86/kvm/svm/sev.c @@ -3996,6 +3996,9 @@ static int sev_handle_vmgexit_msr_protocol(struct vcpu_svm *svm) break; } case GHCB_MSR_PSC_REQ: + if (!sev_snp_guest(vcpu->kvm)) + goto out_terminate; + ret = snp_begin_psc_msr(vcpu, control->ghcb_gpa); break; case GHCB_MSR_TERM_REQ: {