From patchwork Mon Jun 12 04:25:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 13275560 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 806F1C7EE2E for ; Mon, 12 Jun 2023 04:52:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 00D526B0072; Mon, 12 Jun 2023 00:52:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EE2478E0002; Mon, 12 Jun 2023 00:52:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D513A6B0075; Mon, 12 Jun 2023 00:52:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id C61336B0072 for ; Mon, 12 Jun 2023 00:52:15 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 9E5C7400BD for ; Mon, 12 Jun 2023 04:52:15 +0000 (UTC) X-FDA: 80892874230.27.B1B40F8 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2054.outbound.protection.outlook.com [40.107.212.54]) by imf29.hostedemail.com (Postfix) with ESMTP id AAF14120010 for ; Mon, 12 Jun 2023 04:52:12 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=EfGg3KHU; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf29.hostedemail.com: domain of Michael.Roth@amd.com designates 40.107.212.54 as permitted sender) smtp.mailfrom=Michael.Roth@amd.com; dmarc=pass (policy=quarantine) header.from=amd.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1686545532; 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=sKJx0R4sv5FkQcubDKo/v4xIgCFKS+E772CH7PG+a7A=; b=SCKl+O+a96nCtgV7oejWeXD5+cpXGdyh9l8eYAhljCB+3Mo/zGtEBUTojoEi6n4/FJvq30 FH9xCLBYTL3MjatIT4+UjeHVy32we8pToQoAGhoRHRWfm+MmLdITVRe4eLlUAcz0buOCwP T7DRkrAoIbfNugvZIp/DNL2gfOGEDnY= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1686545532; a=rsa-sha256; cv=pass; b=hymEtwwof8Z6jrFnM1RrR+Clm0x+JT5bSh+BFDb/M+LyEZq4ThKqoukUe1Ogb6GPTRUWAz C8t2wEjCweXqva1NfuiIgI4SF9cmuJpRYtF+t7PMBPdyzejjfVhRS1fsbIAC7N8U7dpsaz Z+ajmIc6lusvg1VEjAzg/1us8XHbNNY= ARC-Authentication-Results: i=2; imf29.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=EfGg3KHU; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf29.hostedemail.com: domain of Michael.Roth@amd.com designates 40.107.212.54 as permitted sender) smtp.mailfrom=Michael.Roth@amd.com; dmarc=pass (policy=quarantine) header.from=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LxeWqIGdkhCYuov+4xBX1NWAVaVJCAfokYratb0heeYvUMHzHTF5qI+5ncuR5OhpPRWCMAGSAT6x0mMWE50uYPtu4SG0vTlefL/JFOHTnVNT1I6nAkkEH9NdSmfk8lkH9unQ9KptzrrgKu8D1WuggZmbgffMGFTq4PyJ/rJPIkieOiLr+RdUd3OS2nz+TCvg/3tPtdk4MfsQYa+Kk91xS5vHY60O9YEKoICMOsfSthn9DbfykXEbt/5qV6+utA03Xk0zEUQzlO06gKASTXNr0hv766Gr77R1rveq1p9z0DfRCHEvgTzV6Z2AzZKLBsFP4extTM8TUlpihu8gqr+vBQ== 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=sKJx0R4sv5FkQcubDKo/v4xIgCFKS+E772CH7PG+a7A=; b=O3mm5XdQKg5O959KSCIKfa7DPmR8cuoHkQkwM9OS2Tl/tM+VmpmHhWBP07PLCsGpPggqHbjZpuUCA2tq2NQdb69YHc65W10CP3ivVjPiBzKQNeU0XnN9sEq1/pbhIp7ylS0wHSo43RCo0ZFn/JeyKmXHaGefuKIZD9Kx3sMg53fpJF30KBRc0Y7+selMZqPDpsWQe52wH1c8CS77/KgZ72eKqskQmb7mL2ThRf8Tuwoyj31+kDlDE3Lk0at5UHE0IhrBDmeQJAM8XbPjbssBcrYCOcI89pk1A7kqQRFfk0zIEEmdF8cjqT73FAAbdWQeX6dvsrvHm41OmDtgCnBNrQ== 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 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=sKJx0R4sv5FkQcubDKo/v4xIgCFKS+E772CH7PG+a7A=; b=EfGg3KHUhajVvLRs0Lb2DIVSrMtwI1r38XO3vQidQ8jN5aHTYavFvJw3TRk4FTF9HCHS/fq6W95K5CFIioLtlbDWEpjWd+Ov0b07SRLs/0VSu+ADd+at1OCklAfVnelrlnuuas95u/1LBjs9tkq+uEhyT+Mzkcv0etHOz/NmpFs= Received: from SN6PR08CA0004.namprd08.prod.outlook.com (2603:10b6:805:66::17) by PH0PR12MB7792.namprd12.prod.outlook.com (2603:10b6:510:281::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.19; Mon, 12 Jun 2023 04:52:08 +0000 Received: from SA2PEPF00001509.namprd04.prod.outlook.com (2603:10b6:805:66:cafe::f1) by SN6PR08CA0004.outlook.office365.com (2603:10b6:805:66::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.34 via Frontend Transport; Mon, 12 Jun 2023 04:52:08 +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 SA2PEPF00001509.mail.protection.outlook.com (10.167.242.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6500.21 via Frontend Transport; Mon, 12 Jun 2023 04:52:08 +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.23; Sun, 11 Jun 2023 23:52:02 -0500 From: Michael Roth To: CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH RFC v9 43/51] KVM: SEV: Configure MMU to check for private fault flags Date: Sun, 11 Jun 2023 23:25:51 -0500 Message-ID: <20230612042559.375660-44-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230612042559.375660-1-michael.roth@amd.com> References: <20230612042559.375660-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: SA2PEPF00001509:EE_|PH0PR12MB7792:EE_ X-MS-Office365-Filtering-Correlation-Id: c99a4267-3fa7-436a-e8e3-08db6b00c6fa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HyjRnG38AX9bs9UjcbW9XGreVbmQQPpE2V285In5KT1Ed79j7kE+Xm5rXnl8lMChvClUNfaCvP2DSEJtSIglR0ilpyt+/caOv9KLN6UIERaj0s4yCuc4a1QD3CPh7DFbfVkY/JVJDkco6PyqWmA+VYiI+l2ja/1lgW5UBBDEXC0enWCCdeEhyHqzVfx66loCtGk01Gkw0QxvGnHnVWHCyOA9fTszysabp7thQyjBC49n0RIaUNNxQ45QM2ofTc3RSlogrsZPsd/D2LugMKP+og5pM2POU1ab/btlpZubaYaLwq35dd/Zczk5c06eQ8d7HU9Yrf2FPML8junDaueXN+crEnVfW0dmW9CUHSd05ioHCqghJsCx1UVGZohqSiNSAE17BJqQPSQy/8N7WJFW5W4Y2OyTetSbAHS9SgLCtv+76nLaakMwxliG+kQkoOOkpqGt5dZ1Vc0vE/sdqazJAvuF3hTgM6r/qiR2FWYu864AHpfGKHc8UWhUf/tv0Sehdz1wdBUqei+TiESI5jHFrsNactQ4ru+LNvCdOsMhI9Tmbl0AOKntM/TQVM14gHYnh+Lm3OXjIRbqRfg+d3eVNvf1nsdatB3cO92reQOe+kS2KDsNntQu7zsZoaATe6rGq2lByDIJ/3pA78K/AOdVQZ+Wr2ZdW8QF+qONO6IWzQVpgCLODNKDHtPBryApihzHzaq8TEEVFaGJOOHY6IV42XMfGME1TelH32bv1tvG75SkbjbVH2/v2ECBmKgFSrryT+rqtNxC771LK/Np4vYJ9g== 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:(13230028)(4636009)(136003)(396003)(376002)(39860400002)(346002)(451199021)(36840700001)(40470700004)(46966006)(47076005)(16526019)(426003)(336012)(86362001)(186003)(4744005)(82740400003)(36756003)(40480700001)(316002)(81166007)(356005)(7406005)(26005)(1076003)(2906002)(44832011)(2616005)(36860700001)(5660300002)(82310400005)(7416002)(41300700001)(6916009)(54906003)(4326008)(70206006)(6666004)(478600001)(70586007)(8936002)(8676002)(40460700003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2023 04:52:08.4780 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c99a4267-3fa7-436a-e8e3-08db6b00c6fa 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: SA2PEPF00001509.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB7792 X-Stat-Signature: pxiho5619jf1f91wowe1n9iibxiwbzx5 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: AAF14120010 X-Rspam-User: X-HE-Tag: 1686545532-662472 X-HE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hRGW3yvM1M6IED2ksjdV5bZzTZZHCCXm3BqYyf5tJEkGSh8U00CvnWYOs5cmSfgfWM1VdJJk13wXWMevCbQRfEs1ULHsOnKKD9800+52mUyBldMdVRSOiWVMErtSNvuWB3VzQ3kkwl7yxzYTPmdVTJFrabIsA6/f+wN/kFHQpLhI4x+5sPjMoLAWjq/Y27QoD6Ao+Wc0BkIJYB5rbtBT6MEGYx8a80Gk1kMQQ== 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: SEV-SNP uses a #NPF flag to indicate whether the guest expects a shared or a private page, which in turn dictates whether the KVM MMU should map a normal page or a gmem page. Set the appropriate mask to enable this handling for SEV-SNP guests. Signed-off-by: Michael Roth --- arch/x86/kvm/svm/sev.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c index ec74ff5e09c7..909ecd90d199 100644 --- a/arch/x86/kvm/svm/sev.c +++ b/arch/x86/kvm/svm/sev.c @@ -2006,6 +2006,8 @@ static int snp_launch_start(struct kvm *kvm, struct kvm_sev_cmd *argp) if (rc) goto e_free_context; + kvm->arch.mmu_private_fault_mask = PFERR_GUEST_ENC_MASK; + return 0; e_free_context: