Message ID | 20230220183847.59159-47-michael.roth@amd.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 EF562C27C7C for <linux-mm@archiver.kernel.org>; Mon, 20 Feb 2023 18:57:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 94CA76B0074; Mon, 20 Feb 2023 13:57:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9236A6B0075; Mon, 20 Feb 2023 13:57:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7C3F46B0078; Mon, 20 Feb 2023 13:57:40 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 6D75D6B0074 for <linux-mm@kvack.org>; Mon, 20 Feb 2023 13:57:40 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 42ECD1A04D8 for <linux-mm@kvack.org>; Mon, 20 Feb 2023 18:57:40 +0000 (UTC) X-FDA: 80488579080.15.5B4FE77 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2075.outbound.protection.outlook.com [40.107.220.75]) by imf10.hostedemail.com (Postfix) with ESMTP id 556F7C0007 for <linux-mm@kvack.org>; Mon, 20 Feb 2023 18:57:37 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=CpdKZCb3; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf10.hostedemail.com: domain of Michael.Roth@amd.com designates 40.107.220.75 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=1676919457; 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=BwVXnDi9jaA4a8BdNgxHpkNnSMn7CrcmD4LD5ZDYAv4=; b=xEl0W2fR+4TgINIGOCuDSWLiPq3rVOilekCAEAyHzAReOMScXfF8NVrN0GOFquziOF//mg MNT0rcR5+V0/npMNpU6MeE2H8iEGN2+/0+bmctA7OCAhGdWgkFfJszGf8BGjcbqAWSas+5 nK2ZDxhWfJyUMaENYLjBrgubo3pjKKk= ARC-Authentication-Results: i=2; imf10.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=CpdKZCb3; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf10.hostedemail.com: domain of Michael.Roth@amd.com designates 40.107.220.75 as permitted sender) smtp.mailfrom=Michael.Roth@amd.com; dmarc=pass (policy=quarantine) header.from=amd.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1676919457; a=rsa-sha256; cv=pass; b=uBfIspHxp/y81LK3oziXBBqcWaCVUxc9FlROKy0eUnb8fUUjdHruqV75NZyoUI1i9E1Y7r hrPKNuN9dPjWZtJUPA4HzNAmKC+dSb6vK4KJtk9pkFA9eNxaF69ZBDtw1QGXn7MlPQlLVL O0oBKewcdM2Hbyn1Jk3+IAUTP9hBY10= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PDrNglJ0xX+zgLTD59mSx1wmnALZDybesPSuIBlYzitQGXvAdvvCCcdYFxI/6Dr2lhVnqZPn1cE8lnkH/WIES8eTvBbZ3aQicnOKaHB+xiX5vExO+Q/IZMn0q3m2kmXBczxLXBwZHFxY9qjUJ8hGzsd5ft6U7k3ybKEdRqsDqqmBRqjKkrYiif03lKsWS+IagQtZ+ILCgZHdqa3/a9Txa0DbCI87jZDUxDPp/DI7mguVgaqqUFInPv5v9NtSScUQPWkFOcpkd+N0sst7KiezWOU9j7ttkvQgSui8SpvighvQIDorhtntfCLG0wlMgJA7XqGnLwsOM4DjuDiVfbJV8A== 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=BwVXnDi9jaA4a8BdNgxHpkNnSMn7CrcmD4LD5ZDYAv4=; b=jycO1AGj8yOntyPS8sC7YAhw+aOEiOKNvcSTuMBRzmUFoWOlEK9zywiP1QlpU9jbnmn4I5SyDxVxP0NwUav8UkFD12fRAqC4cbP/NsdzJp9yEYqCLHDDHeHTswY0h/uh1mXheVTdP22bw2mVA2XsAfTh7301UM1wR2PpukZpaDfTYqJ8Tt0h0Wa7SPqLjSMbkomwVmYMftqaP4HcY1KrzLDfoakBQmPg+vb8fkXLK8cdFk7RsohR5klcFyPMotqHPTrBG4kjCi0ZoW5ggohE7gb8CfXlzVpiYn/WYtDC0kdxGBSiqniNESxWhHy87TjHOUZdWQF69XYAWdMAU54nUQ== 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=BwVXnDi9jaA4a8BdNgxHpkNnSMn7CrcmD4LD5ZDYAv4=; b=CpdKZCb3MWz0LJjObZyBRJdvEZt0gYkfYJlOWMtpTp4Y9glzScmTUGFCELmTJOUWaYIYnf0wG8YDWfHrx4wID8R25GvKevV37WOqYz/ncrYkqoYuwMUX/or5Xf1wM3au42yMMz7smX4NHB76n6tOgpnBIqp2blubyTTuQNsaDhw= Received: from BL0PR01CA0019.prod.exchangelabs.com (2603:10b6:208:71::32) by SA0PR12MB4557.namprd12.prod.outlook.com (2603:10b6:806:9d::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.19; Mon, 20 Feb 2023 18:57:34 +0000 Received: from BL02EPF000108EA.namprd05.prod.outlook.com (2603:10b6:208:71:cafe::99) by BL0PR01CA0019.outlook.office365.com (2603:10b6:208:71::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.20 via Frontend Transport; Mon, 20 Feb 2023 18:57:34 +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 BL02EPF000108EA.mail.protection.outlook.com (10.167.241.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6134.14 via Frontend Transport; Mon, 20 Feb 2023 18:57:33 +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.2375.34; Mon, 20 Feb 2023 12:57:31 -0600 From: Michael Roth <michael.roth@amd.com> To: <kvm@vger.kernel.org> CC: <linux-coco@lists.linux.dev>, <linux-mm@kvack.org>, <linux-crypto@vger.kernel.org>, <x86@kernel.org>, <linux-kernel@vger.kernel.org>, <tglx@linutronix.de>, <mingo@redhat.com>, <jroedel@suse.de>, <thomas.lendacky@amd.com>, <hpa@zytor.com>, <ardb@kernel.org>, <pbonzini@redhat.com>, <seanjc@google.com>, <vkuznets@redhat.com>, <jmattson@google.com>, <luto@kernel.org>, <dave.hansen@linux.intel.com>, <slp@redhat.com>, <pgonda@google.com>, <peterz@infradead.org>, <srinivas.pandruvada@linux.intel.com>, <rientjes@google.com>, <dovmurik@linux.ibm.com>, <tobin@ibm.com>, <bp@alien8.de>, <vbabka@suse.cz>, <kirill@shutemov.name>, <ak@linux.intel.com>, <tony.luck@intel.com>, <marcorr@google.com>, <sathyanarayanan.kuppuswamy@linux.intel.com>, <alpergun@google.com>, <dgilbert@redhat.com>, <jarkko@kernel.org>, <ashish.kalra@amd.com>, <nikunj.dadhania@amd.com> Subject: [PATCH RFC v8 46/56] KVM: SVM: Use a VMSA physical address variable for populating VMCB Date: Mon, 20 Feb 2023 12:38:37 -0600 Message-ID: <20230220183847.59159-47-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230220183847.59159-1-michael.roth@amd.com> References: <20230220183847.59159-1-michael.roth@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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-TrafficTypeDiagnostic: BL02EPF000108EA:EE_|SA0PR12MB4557:EE_ X-MS-Office365-Filtering-Correlation-Id: 84fdfd86-3f56-46c7-f60d-08db13745371 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ntxKMRTEXGB1icnLd1eH5EPjxNCt3N1sncm2ALlg0usUPaCz4o5e6q/dljRC/kJ7m58BJmThAGPaQr8hZ2adFYBSXfTuDxrqQH39lxIWMmOyC/Rp/40NoDOdJ6JdkSIVhsP2NGvYyPY35Dn0x4YtdWQv+Gb6+RyRpjTZwWxw+ofeYb8zLV2MAcmFWCEbAhgRCUlHKXt7UPFBBWE7dL3qHpY2iu6TvygwTx6r95UBCkWJqxOFYLfk7b0pKjg6vwO46oY9Iy91qjQ1I24prgSNQhcZkmI1/z6TH9p6O9MsFTQPjE5+vudBzdBn04ylArJ3rIMmMmgMczyTJO1QuZkgwKtZ6hgtbFMJpe3T7y8/CVz5g91wAHAucKPEYi1zqvAf+0R/0O3PX3RCHCeFw5X/TC05H2+xtcwTvm2PzOfMaa5HKa1vI2TbXTZzwPO0h065eLCqCwr2snsv3E4OFj7zssfaeP8dW6kO9U5JFd8hgXAeoMIthbsBVuadSS562zE+DgeE7wARCzxEyv1fQwkFWXAWYfA/rpfS3kkoRVHsDa+/9Cl4+Nd9KH4o5leRSRwpy6UsTXAtWmaVpTjuNzMkobCHnri94yNaJeXteHEUeJOWDIMZr7lT9l0it79nuxfGHDUehDHO50+k/0OJ+mUUqbckXfS0MDABGfRnTUg2JlsF2UtY6sDyhSUEUvhBzLfjRpSWSbFgguuU6AwpiXLheVD17QSL7ZFdxxAlPCqbX/Y= 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:(13230025)(4636009)(136003)(376002)(396003)(39860400002)(346002)(451199018)(36840700001)(46966006)(40470700004)(36756003)(40480700001)(8936002)(7416002)(82310400005)(44832011)(356005)(5660300002)(7406005)(86362001)(1076003)(82740400003)(41300700001)(186003)(4326008)(26005)(36860700001)(2906002)(8676002)(83380400001)(316002)(54906003)(70206006)(6916009)(40460700003)(70586007)(16526019)(47076005)(2616005)(478600001)(81166007)(426003)(336012)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Feb 2023 18:57:33.8137 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 84fdfd86-3f56-46c7-f60d-08db13745371 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: BL02EPF000108EA.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4557 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 556F7C0007 X-Stat-Signature: bfdo1exrtmnf7uimuyocwxu1yyrqhrsm X-Rspam-User: X-HE-Tag: 1676919457-533138 X-HE-Meta: U2FsdGVkX1/czhyQRLN+TGI/ppVPGUQM60zrl7rfh+e6j9EZCXQSR6TcuA/q38Qy5EqRUODp031V50pLQMhPe5S9l3Pg9F+xDiGu8h7hhyIybGXN1Foc91ZXMFwn5EDXxXmUSxc4L9el9w0czrsOkZv0N4W1rNvm46C6fkiHFIkdPQPfyfQhEFmQGCy13AQ/VRak77lbeZL90DEywOer0C6nAOD18fbo0EntybFriz6KjPJgEpTgne9PLATjlokwdmkv65tTwWVsgXS96TPOxCA9jIbpPZApdKctI+jSQc6/brcUpuSVC+ynZulCYjq+kZSTdO+skpn0J0m8pSeAqTvFnJPAlKQBJCNldIJ0+yfXVxOrIJteTl9sRrG55jGQMhjCbVhIN33wx+QGd26+kLYTW5aYwRnnm1x1a6cHZ87kk71qn8EMbHF9ipAYIgxybd+ycaU92ArdXAs3Tbx9QY/dZOObk4XgzdXsMMF9Ka+dTopyBs+DorZvUdedu/WhaphjxgcRoH3Q4qrMXZ5rqMawBOuvOVMpQ9cJ2NoIKICYCJAtC+mcFVtWsUgA0elniR3t4RiSsxJNF6XRKibQz0pmDLQ7QjrNI8fFeaSjz6nAbVB3ptuzm+FMygAkw9R2ZWDr9XW2WG+9dh6QO2Fda9ZX8U2477WUFiqw9U534LcCFTtUBwIqmZOLNC/goxZdJXsdPaMpaEB/XY67+/uJnt8diKM1nLRneT/uO3qMsf/OVsRSPV4hhX4expFo1sDIna5hJHRRc21j3ga7NlMJpK32W8XXUL6Bz+vysbgZ5tW6UQOglEcSIDi3ZPZLr6zCND6jY5k6r0Wge5cRDKnaBJVTgyX00NmjhquiFmBbuRC69BnzYOM3ETGXwu7AxBYFw+NnvOKSOqhjaDMyqJ4m3fx6aeeSfhq9fZJagbtuNROO3E0s0RtbN/55ZDIo4a2lbSvps6bfIC2CT9h8bXn YCSV+wIr lSy+JGWxGJ+5GqK+tgrEmSxwed7tL4cO5tDtvMhB4ESRQlt5DUu/c6HCv6RTtLie9/QZYt3tH7bOCMiQoK46MUU/eoh3MbeX80W03yAzwrC1kcQYsIdqjviGq5donHsrBYGKZXPib+1StvUdeGqgc01bGN5Ca0inuwQdGblie8dkZcgpVL4JLVsIJm5Ezx7bYW94Sf3XwMCEdVURQGRXkvWV8TzhhwVoZi0C+j1BWxRi6N6MhpVONJ24ZhaooMrV8GZXb43J6OGMilmAtYNh7mLH9t3qVhexj/DIa0BDVlRM3TTjuoe23iJoTTRMT5542JG9MP+vWNJuxQbY= 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: <linux-mm.kvack.org> |
Series |
Add AMD Secure Nested Paging (SEV-SNP) Hypervisor Support
|
expand
|
diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c index 92179614102e..6bec2712ecc6 100644 --- a/arch/x86/kvm/svm/sev.c +++ b/arch/x86/kvm/svm/sev.c @@ -3849,10 +3849,9 @@ static void sev_es_init_vmcb(struct vcpu_svm *svm) /* * An SEV-ES guest requires a VMSA area that is a separate from the - * VMCB page. Do not include the encryption mask on the VMSA physical - * address since hardware will access it using the guest key. + * VMCB page. */ - svm->vmcb->control.vmsa_pa = __pa(svm->sev_es.vmsa); + svm->vmcb->control.vmsa_pa = svm->sev_es.vmsa_pa; /* Can't intercept CR register access, HV can't modify CR registers */ svm_clr_intercept(svm, INTERCEPT_CR0_READ); diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index f9ab4bf6d245..745f736d9c98 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -1410,9 +1410,16 @@ static int svm_vcpu_create(struct kvm_vcpu *vcpu) svm->vmcb01.pa = __sme_set(page_to_pfn(vmcb01_page) << PAGE_SHIFT); svm_switch_vmcb(svm, &svm->vmcb01); - if (vmsa_page) + if (vmsa_page) { svm->sev_es.vmsa = page_address(vmsa_page); + /* + * Do not include the encryption mask on the VMSA physical + * address since hardware will access it using the guest key. + */ + svm->sev_es.vmsa_pa = __pa(svm->sev_es.vmsa); + } + svm->guest_state_loaded = false; return 0; diff --git a/arch/x86/kvm/svm/svm.h b/arch/x86/kvm/svm/svm.h index 4a9ffb7e5139..b6ca6657aa6c 100644 --- a/arch/x86/kvm/svm/svm.h +++ b/arch/x86/kvm/svm/svm.h @@ -198,6 +198,7 @@ struct vcpu_sev_es_state { struct sev_es_save_area *vmsa; struct ghcb *ghcb; struct kvm_host_map ghcb_map; + hpa_t vmsa_pa; bool received_first_sipi; unsigned int ap_reset_hold_type;