Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp4155417pxb; Sun, 24 Oct 2021 21:31:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZhYwOVmF7Oe1hLFv9FYApzvBm5YkY2ZvlXRugg4JUjJx64PRoyLfX0qRPvRo2xC9IjoXk X-Received: by 2002:a17:903:11cc:b0:13f:ecf7:22c7 with SMTP id q12-20020a17090311cc00b0013fecf722c7mr14188808plh.5.1635136292372; Sun, 24 Oct 2021 21:31:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1635136292; cv=pass; d=google.com; s=arc-20160816; b=i48j1SQR3AixvEFezVYYrykaD27Qk652bygisMCXe1rc4we4lCOcTe7imorogqyszh X6tQA1Y+nyO6FE6bXQTqIY2p7rtMVobZgCVvexu5GBUHrwmKkcRpJGkDhq1TDi896oMl nbbOdWvhJkGvslQsPmVCiethxvGCNoLugJYzv/slxdwE4esux7F1TK07NtX93HhP1mTW NUCAda1ImaeiZvUP8iZXim6LoPAU6tXFKLxElAm6+SZvWPkYd44pMF7pzfavKZXISY4B SL4rHtr7dwTmw28jmEn7WjIerOjkVmIsakL/9Q4q0xwYGWL7a9+V3PtmmqQucmgMFP/Y VeJw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=xVwu6j+g94krMFOJwr7T5nJEGbasWqpoNUORJOJ3iBc=; b=iAUcQc+0AIRimgFfVCql7xhOTULByy0tRP+Y/h+Oyyj0Qitpu+iSit/zU63B6gd6ZF fLoBitjeZgu1SGey1YWLtY5kY7C6azUshLLBvk2PjYdwpERj2yeFNKyzqNymgjWaL0bn FbKgdGBn2NA3G4mukqSFb/e9r39XL7Ezk/q0FahZRbTsk4X0dv79kD691YhvdjOAr4lL V4ntOzB3aTgJPRH1uzjagituGEo1Ux5ZcoUoCREwrfWae4b3UenG3znCyzy0tpqHVrVt dzgqOEWZozhNMTcolKsCvJ7THtNSoQk6c5jJYlHHHLsGWkrIZP6RAzS1cTnmOpVP+t44 lteA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=sLRkt2h9; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l63si6031631pge.115.2021.10.24.21.31.13; Sun, 24 Oct 2021 21:31:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=sLRkt2h9; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232374AbhJYEcT (ORCPT + 99 others); Mon, 25 Oct 2021 00:32:19 -0400 Received: from mail-sn1anam02on2075.outbound.protection.outlook.com ([40.107.96.75]:6080 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229678AbhJYEcQ (ORCPT ); Mon, 25 Oct 2021 00:32:16 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PjCiK0SQuCaIMO2Inr04sdOBuhfFppe2Pu3wRiweUgSfK484zoQ/szNQKfDDgW+Kpq1Hp8C8myqv16mbitIMci/GlnQpf3UdkaU1tqiI7H7+e6PRA0B/PDyZKRQRWSjW96z370URaXthv1/J5v8G7mG17B6yaNmeVkhY1KhZCR/SJaTW/Dt4OLzxwpByRMOibCjrLRQ4yGygo9ZoO/LsVxlUbYrdWpFvyYoj1Yo+3F9eoW/tRtp7cedyHIzkEn/fvQ6owj6hjsgM1EeN3aAhJ773V47Bii1PWZ2bdPNASdAPVcOU9hdqDHrl7t6trMX6MlVdDKCMYPIIutFC33SaxA== 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=xVwu6j+g94krMFOJwr7T5nJEGbasWqpoNUORJOJ3iBc=; b=f95/+l7KIQBeEyEX+SmIR2JiyU1gqxXs3vF1ueQlcB7ZUCKgeCk+4hqwwNFqdglJ9KrrEopTtP7W7mxp7aUx+BYRdOqCANx54dvgW6SXRVAJPu3eMAPMBxJFRQglHZykbkNyUTJqqIJkTu7ge6Ljk5rCKzLqoXy2MbhzIE9lvlKbRC7nctAfP2rxBMFKEchdWVS4nYjANTh6fuDgpb+/qo5iDQvqyi81beFfjEhgWi1snplVfxJq24aUos+rU/Eg136XpfgRT1toCtc2OYAI0wrKG80xWXKVXGuSHvWyVYxcj0XGdP2uXJB5UCemI1Mil566pFvTkiuVW9MiPaVUrQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com 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=xVwu6j+g94krMFOJwr7T5nJEGbasWqpoNUORJOJ3iBc=; b=sLRkt2h9ybyw+CzmWY2xtgwx2WMiVjnZEjZ5sNWGIK8RKDChEluCeFAwunC+dTns+2YvKYBH4MqbQgeLrgOMQWBHAVeVqaiue7BgsflF2Vgy+vus/jEG5Rfadz5rJuYz4dqnP7gARmBDZVZQ5s0aq+c26vzLmFINWvQx3olaHsY= Received: from MWHPR18CA0058.namprd18.prod.outlook.com (2603:10b6:300:39::20) by CH2PR12MB3830.namprd12.prod.outlook.com (2603:10b6:610:2f::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.20; Mon, 25 Oct 2021 04:29:52 +0000 Received: from CO1NAM11FT028.eop-nam11.prod.protection.outlook.com (2603:10b6:300:39:cafe::fd) by MWHPR18CA0058.outlook.office365.com (2603:10b6:300:39::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.15 via Frontend Transport; Mon, 25 Oct 2021 04:29:52 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; redhat.com; dkim=none (message not signed) header.d=none;redhat.com; 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; Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT028.mail.protection.outlook.com (10.13.175.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4628.16 via Frontend Transport; Mon, 25 Oct 2021 04:29:51 +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.2308.15; Sun, 24 Oct 2021 23:29:50 -0500 Date: Sun, 24 Oct 2021 22:59:01 -0500 From: Michael Roth To: Paolo Bonzini CC: , , , , Nathan Tempelman , Marc Orr , Steve Rutherford , Sean Christopherson , "Mingwei Zhang" , Brijesh Singh , "Tom Lendacky" , Varad Gautam , Shuah Khan , Vitaly Kuznetsov , "David Woodhouse" , Ricardo Koller , "Jim Mattson" , Wanpeng Li , "Joerg Roedel" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" Subject: Re: [RFC 08/16] KVM: SVM: include CR3 in initial VMSA state for SEV-ES guests Message-ID: <20211025035901.r3yxumcygvj22skp@amd.com> References: <20211005234459.430873-1-michael.roth@amd.com> <20211006203747.13479-1-michael.roth@amd.com> <1661def3-45d1-9aab-aeb4-5b934179d3ab@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1661def3-45d1-9aab-aeb4-5b934179d3ab@redhat.com> X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4e5f7a3c-5df5-43b4-d659-08d99770168f X-MS-TrafficTypeDiagnostic: CH2PR12MB3830: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2331; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1PaX8+55Bk49tHwvUvIPap3OSjUdv57XcXBg1BSi8jMrpIms8d8n17cGy7yGU5/fIonEYjDv8ZVK9HOtdztkqzhnb4MsCQ3gr/4BhzvThS3NmyuHCrMM2hECw2xBEDhJwQSBUWn4xExf1f633o2i7sotoeflPhYuYinkmWJDPd4qxKstjS1giA9AXuQOP8h3Cb9B2DPhkuoxitvrva8gEJ6jqKnMBE1P6hrLtyZbZzSy1QF/TsoGmcR/OxgcIB/9lKKVrbu9acWTcxwZ96Ri3v+uuEHvCEpRhXzRJVU2hKlxR+Ro3PW/HcbspOPWEIUEpEu2u/FLVP+j/vCoXTBegE5ob3s2s1lUOFkPoCZW72tmQUeVWfBjIGR6b6o/xMKCbFsnOUyppx3wCPtKE1tHmHyaHSiTYh6uwx/R/pQzFBkCFujOrRD9UUixSaYWk1iNClVW9Qd95K5Bcz4uzdubCqTun5pWVoprJAyVjsSSFEu49oPyr1QSLOmZKpFJ0ruZyq9HJ0FxQlsskFPbPa3KMSvzM2HH+CfTe8B6yVV/FMi0oeSblYtsf493ZH3IGJEiDkRFQJlqe6jRR+mcLRUL2xAjmFZaqWxx7agfd7hnvw5ZAcMqv9ncF5an7uKgt1PEy2EfdYDZ65fkilfJ6c9FTQ01j+UweeHy62iZ+tGHv06zRi3jB4FRF8YhaxOq60CN1D4+5d6Z0/gqmeDkx12FQMZLsdJ4l2v2dKEcxcB6qhA= 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:(4636009)(46966006)(36840700001)(5660300002)(1076003)(426003)(2616005)(508600001)(356005)(36860700001)(6916009)(16526019)(86362001)(316002)(47076005)(4744005)(7416002)(8676002)(6666004)(186003)(336012)(26005)(8936002)(44832011)(36756003)(4326008)(81166007)(54906003)(70206006)(82310400003)(70586007)(2906002)(53546011)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2021 04:29:51.8833 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4e5f7a3c-5df5-43b4-d659-08d99770168f 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: CO1NAM11FT028.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB3830 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 21, 2021 at 06:43:34PM +0200, Paolo Bonzini wrote: > On 06/10/21 22:37, Michael Roth wrote: > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > > index c1a2dd0024b2..d724fa185bef 100644 > > --- a/arch/x86/kvm/x86.c > > +++ b/arch/x86/kvm/x86.c > > @@ -10400,8 +10400,7 @@ static int __set_sregs_common(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs, > > vcpu->arch.cr2 = sregs->cr2; > > *mmu_reset_needed |= kvm_read_cr3(vcpu) != sregs->cr3; > > - vcpu->arch.cr3 = sregs->cr3; > > - kvm_register_mark_available(vcpu, VCPU_EXREG_CR3); > > + static_call(kvm_x86_set_cr3)(vcpu, sregs->cr3); > > kvm_set_cr8(vcpu, sregs->cr8); > > > > Can you instead make the hook "post_set_sregs", and keep these two lines in > __set_sregs_common? Makes sense. Will do. > > Thanks, > > Paolo >