Message ID | 20210602141057.27107-34-brijesh.singh@amd.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <SRS0=1WO3=K4=kvack.org=owner-linux-mm@kernel.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04882C47083 for <linux-mm@archiver.kernel.org>; Wed, 2 Jun 2021 14:13:03 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 98DE6613EE for <linux-mm@archiver.kernel.org>; Wed, 2 Jun 2021 14:13:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 98DE6613EE Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8BA508E0033; Wed, 2 Jun 2021 10:12:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7E3EE8E0031; Wed, 2 Jun 2021 10:12:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6388A8E0034; Wed, 2 Jun 2021 10:12:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0145.hostedemail.com [216.40.44.145]) by kanga.kvack.org (Postfix) with ESMTP id 272708E0031 for <linux-mm@kvack.org>; Wed, 2 Jun 2021 10:12:42 -0400 (EDT) Received: from smtpin32.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id BA5C1DE09 for <linux-mm@kvack.org>; Wed, 2 Jun 2021 14:12:41 +0000 (UTC) X-FDA: 78208974522.32.4BB4405 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam07on2065.outbound.protection.outlook.com [40.107.95.65]) by imf29.hostedemail.com (Postfix) with ESMTP id 94B5854F for <linux-mm@kvack.org>; Wed, 2 Jun 2021 14:12:24 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NL5ebzugTnu1zo5h4aZi6PAuNEWELYbz2g/2SQYVOrk7SSR5JI0RBPoKcQmDdL0mfmTEVzL6nlEm3Slp/eq1PX48bKnvYZgeza7Mprjtn5HE+mFqUV1IQTAl+i8gVYG4qp63eYRG1f6bIVFnn2VdQA2cT7VQhFkFAC6owioyr4o0APphbQYudJwM9ICDhrk0IXM++EwEjEEUwPnUIc3+N/284tKR10an6LIO/Ko2auMZb0GbjCeGJY/ZNxVEPdJt29ovrYVtlBQx9wLVrtUhqt5/S3MSP46H5MR6ZTUn6fg8L4aAr+LTbJJ8HijBNPCSrybaCjeQ373wRTVS451gcQ== 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-SenderADCheck; bh=amc345V0ABYnWmTuzWs5XId5+/6yv4cUgrvfJJyi0mk=; b=kzxKmexNo/NYdQ130Z4WZNUbKd7Kl3vrpEyUqSkQJiVEbGITy+pkyNzsA0qn1JDi2sSravUDp3dazf+ODlnSbw+dOIRKrz4NRhx+yveTCP2aj/pZo+BamzkTAb3Rn13aCMmJxWKF/uHnx9Oyc3DY5DT5UaXVftvwI77BJPgEtUHobl5l4a4TDAtnbUb7tjC2R+4NGCEIgHbxG/sxM0n3jgTB+YqCDtGzMKSIvnIkL7/o0vhpUi2FgHIYP0yDKZMcHHVQcTZ7bNLrCXmSak3Rgvfa+ZWhWethqkTmibO+o6ysapLVIy9G8B1Klq/+fuikNz1PUpdOyrO4QglSoKmklQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; 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=amc345V0ABYnWmTuzWs5XId5+/6yv4cUgrvfJJyi0mk=; b=aaWDW4R1GPn46l0IHHVVXwMAX15jBo80y2X30dOEmgArgyikU0iTLmFTLMl1FsL8W55xbipYeIclGsb+Tl9kW9BXTly5suQMggWKgBzqd95yRq9xjc7iglL7ILyWfdHg9KgK02STvNffkndsAmhBZSyd1hM0oFMdjrDhMXY7dLs= Received: from SN6PR12MB2718.namprd12.prod.outlook.com (2603:10b6:805:6f::22) by SA0PR12MB4574.namprd12.prod.outlook.com (2603:10b6:806:94::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4173.20; Wed, 2 Jun 2021 14:12:39 +0000 Received: from SN6PR12MB2718.namprd12.prod.outlook.com ([fe80::9898:5b48:a062:db94]) by SN6PR12MB2718.namprd12.prod.outlook.com ([fe80::9898:5b48:a062:db94%6]) with mapi id 15.20.4173.030; Wed, 2 Jun 2021 14:12:39 +0000 From: Brijesh Singh <brijesh.singh@amd.com> To: x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-coco@lists.linux.dev, linux-mm@kvack.org, linux-crypto@vger.kernel.org Cc: Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, Joerg Roedel <jroedel@suse.de>, Tom Lendacky <thomas.lendacky@amd.com>, "H. Peter Anvin" <hpa@zytor.com>, Ard Biesheuvel <ardb@kernel.org>, Paolo Bonzini <pbonzini@redhat.com>, Sean Christopherson <seanjc@google.com>, Vitaly Kuznetsov <vkuznets@redhat.com>, Wanpeng Li <wanpengli@tencent.com>, Jim Mattson <jmattson@google.com>, Andy Lutomirski <luto@kernel.org>, Dave Hansen <dave.hansen@linux.intel.com>, Sergio Lopez <slp@redhat.com>, Peter Gonda <pgonda@google.com>, Peter Zijlstra <peterz@infradead.org>, Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>, David Rientjes <rientjes@google.com>, tony.luck@intel.com, npmccallum@redhat.com, Borislav Petkov <bp@suse.de>, Brijesh Singh <brijesh.singh@amd.com> Subject: [PATCH Part2 RFC v3 33/37] KVM: X86: Export the kvm_zap_gfn_range() for the SNP use Date: Wed, 2 Jun 2021 09:10:53 -0500 Message-Id: <20210602141057.27107-34-brijesh.singh@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210602141057.27107-1-brijesh.singh@amd.com> References: <20210602141057.27107-1-brijesh.singh@amd.com> Content-Type: text/plain X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: SA0PR11CA0056.namprd11.prod.outlook.com (2603:10b6:806:d0::31) To SN6PR12MB2718.namprd12.prod.outlook.com (2603:10b6:805:6f::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sbrijesh-desktop.amd.com (165.204.77.1) by SA0PR11CA0056.namprd11.prod.outlook.com (2603:10b6:806:d0::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.20 via Frontend Transport; Wed, 2 Jun 2021 14:12:10 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 809a9246-b86a-4dbf-295d-08d925d069ee X-MS-TrafficTypeDiagnostic: SA0PR12MB4574: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: <SA0PR12MB4574984843BFE85206162141E53D9@SA0PR12MB4574.namprd12.prod.outlook.com> X-MS-Oob-TLC-OOBClassifiers: OLM:4303; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UEbKIGTWZvDIY4UrzbuASNP51O3jU5QlTTAAdKyHKTTZoVU5wMqsfE1AfPi94hXgcuR0+9gtfAPREExC63Tx9mRZ6qjF9qcOjVVR2WgZE7wUPWsNIATkwQ6yhZuCvYvQ6k30ueNAx5lqbDul8Mf2GZ6miwHpjl/FLhAWrO/EZDmgh+I+HwZX15k3ju2p9KYnLDABfAN2nTgOuLQOdhlQr+4iT/cAfnbSv6qZTBNOVyyZtSmVFmGIJa3PZ4EG2DQS1euitDiOeZinvwb+Huchb6tqMoPzouh9wqvY46IQkO06dStK5xacE1glsnrq0K3Enf1PTKGa8JyUODWYTOGOF29y0hBBvUbDerCFXBEEXqv0C6AJLeh1rSuzBmsqRgExYEq+cksiEMAeuUCSRuMmueQCq8GA7uhYvrt9ZC4QVjXgfL/64V07iOiX+7eCKoyA8fPgnwIs17Xcsy+jqzHkcz0LzbCtIDhAHb6tGgIw+08C2nRgo27P/xW8PPtSX4x1VybeW9x8OjBWjan/wvcox+RcIWCNSFxMXO+NAqEygYtCxJF1SC10z4PqlGP/mEDnuL2eCeleVq8uDklaepQuCDAubD9OCa00H0nKYvym5KalAxcMUqYIPSpH80aVS1ShIF525JHID+qRvBRwYq7JyQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR12MB2718.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(346002)(366004)(376002)(396003)(136003)(39860400002)(86362001)(8936002)(7696005)(52116002)(956004)(478600001)(2616005)(66476007)(66946007)(2906002)(26005)(186003)(16526019)(7416002)(4326008)(1076003)(316002)(6666004)(38100700002)(38350700002)(66556008)(44832011)(83380400001)(8676002)(5660300002)(6486002)(54906003)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: bstt14rqnUMAcyEdFCScnwLh+Moxevg6CBWKOAXmuxkdDOjb8lTvfr4qLWepcoyTvBkKAGs9/c0FG7CElslRtI4c7UZWPu4kQh/S89bRcfui9eZ1PGSVTO8GWP+zK0xEVkl3Yoni45e1I3/5UwwEtl8beyYUxxVtv4pWTT+IlCoftqDLrcV6dyKTrE1XD5HatN1gpTbBNPrdCeFvOEnLt1947jHcKcTqcxaH+UaXbNQx/DJ0+Yl58S6vgCBNL5LBEPPIsiQ6velkHQbY+CHoXZgMj8EQK9s7bu5v4lKcU38k3fo0I0DEGHDv197sqd47Sa3azG+CLdgDZieWzpPIyjxeRFLonC2kC8cPqynFVSNJlfR4W9R8A9Jk5mFDeor6zP1fdZsc3/qYcgIGucm6YRvelCa8fLxXianqdbNgjA3Sc/CtRO8ydGAVLYOCchmioy4ofH01XM4J0H9b2r6U30+FFeLQ2A5VQ5/g8jw6RYyZzW9aiVomvOlmvxznzniz7WksOqLmBnGN73lDEVr4FCxU2s/e+DIth89Iv/oe8Iih2Gb+kZmmY5WEt/YwCdZfVSx1U06xOd2cqJgjUMffZqWPwSyG+r0IU4C3j6HSpxa0wwrB0DsMloN8hLlu2lPVuoKIaokMuvlQx5ZFng8ankYOFZRi4cHwmrf20nNH1mF0v1BJ2rHJBXhW4cS2ao7QZH5CbdddDQjYAaEaphszoodliiNP8aWpsMAwieB3NBs/ge89MLTQiLrvEeheykbuAAl8hJsMUHU5RtWxakbi9mA86WDFFYqrVofGoeMjlXLp9fXEjjo536gEVVskZX/2xy5McESMuQW2mvC0Bq9+0AVoxVeJo0Kr03A0lYp74kc2wWXsrUigzwNrO6KuAAVNx0IkvcWwdT46wEIz6fux6HH9OmmSMiPNJoMcpN2a1/aPzmFS/MIQel4iC0LXcXU6riYKGLSpnhgGEBxkfxyKsKvat6o9KowCYeJhjT3nEKAMnNPygObM/JqMxEAamJBKnsM4JrUxRLZ2kM7mXDZL44gLDO8ckZ3LnmDpnP6N7KAL9a0CV+eZinwtkk1MydNODQlW5wSyDkX+8ds1oXWRRatxAoQgiLjkuxn2LNFDJ9fgOPoVJhdeqX0/beoQDy+Sm5OMMwUvzmLSLt9bastWcxMfrpQ0QtQSP+cRU4M7kj2Dvk6dDc94Bm02mrH7t1TT772NozMPvSryngbbyQ6umMQRgn6YTk+9xzfz8bjNn4fRLj8Mb97uJ9ASjUOkUFYvqYrhrRnZgBGEc6KspSaMQgzJjqzqJLCi4UUtQ5yeFfTMkqD8JeyQhVXr0vpH0wlH X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 809a9246-b86a-4dbf-295d-08d925d069ee X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB2718.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jun 2021 14:12:11.6073 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: vmBKTPoW/KyDJwI3VH6Udw3D/ipsW4FRm0eFjZBkXybxm7XbxhpYEASvHDJN4FS9RnEZRijcdJ6LD00YXeJF+w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4574 Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=aaWDW4R1; dmarc=pass (policy=quarantine) header.from=amd.com; spf=pass (imf29.hostedemail.com: domain of brijesh.singh@amd.com designates 40.107.95.65 as permitted sender) smtp.mailfrom=brijesh.singh@amd.com X-Stat-Signature: ksxhdqnyj3okxz9rgyf3wzdyiz46quyd X-Rspamd-Queue-Id: 94B5854F X-Rspamd-Server: rspam02 X-HE-Tag: 1622643144-468963 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/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 678992e9966a..46323af09995 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -1490,6 +1490,8 @@ void kvm_mmu_zap_all(struct kvm *kvm); void kvm_mmu_invalidate_mmio_sptes(struct kvm *kvm, u64 gen); unsigned long kvm_mmu_calculate_default_mmu_pages(struct kvm *kvm); void kvm_mmu_change_mmu_pages(struct kvm *kvm, unsigned long kvm_nr_mmu_pages); +void kvm_zap_gfn_range(struct kvm *kvm, gfn_t gfn_start, gfn_t gfn_end); + int load_pdptrs(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, unsigned long cr3); bool pdptrs_changed(struct kvm_vcpu *vcpu); diff --git a/arch/x86/kvm/mmu.h b/arch/x86/kvm/mmu.h index 147e76ab1536..eec62011bb2e 100644 --- a/arch/x86/kvm/mmu.h +++ b/arch/x86/kvm/mmu.h @@ -228,8 +228,6 @@ static inline u8 permission_fault(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, return -(u32)fault & errcode; } -void kvm_zap_gfn_range(struct kvm *kvm, gfn_t gfn_start, gfn_t gfn_end); - int kvm_arch_write_log_dirty(struct kvm_vcpu *vcpu); int kvm_mmu_post_init_vm(struct kvm *kvm); diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c index 4abc0dc49d55..e60f54455cdc 100644 --- a/arch/x86/kvm/mmu/mmu.c +++ b/arch/x86/kvm/mmu/mmu.c @@ -5657,6 +5657,7 @@ static bool kvm_mmu_zap_collapsible_spte(struct kvm *kvm, return need_tlb_flush; } +EXPORT_SYMBOL_GPL(kvm_zap_gfn_range); void kvm_mmu_zap_collapsible_sptes(struct kvm *kvm, const struct kvm_memory_slot *memslot)
While resolving the RMP page fault, we may run into cases where the page level between the RMP entry and TDP does not match and the 2M RMP entry must be split into 4K RMP entries. Or a 2M TDP page need to be broken into multiple of 4K pages. To keep the RMP and TDP page level in sync, we will zap the gfn range after splitting the pages in the RMP entry. The zap should force the TDP to gets rebuilt with the new page level. Signed-off-by: Brijesh Singh <brijesh.singh@amd.com> --- arch/x86/include/asm/kvm_host.h | 2 ++ arch/x86/kvm/mmu.h | 2 -- arch/x86/kvm/mmu/mmu.c | 1 + 3 files changed, 3 insertions(+), 2 deletions(-)