Message ID | 148846781666.2349.1816322796563357670.stgit@brijesh-build-machine (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <kvm-owner@kernel.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3DCF060429 for <patchwork-kvm@patchwork.kernel.org>; Thu, 2 Mar 2017 15:56:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2D72D28485 for <patchwork-kvm@patchwork.kernel.org>; Thu, 2 Mar 2017 15:56:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2185C285AA; Thu, 2 Mar 2017 15:56:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F25728485 for <patchwork-kvm@patchwork.kernel.org>; Thu, 2 Mar 2017 15:56:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753644AbdCBPyW (ORCPT <rfc822;patchwork-kvm@patchwork.kernel.org>); Thu, 2 Mar 2017 10:54:22 -0500 Received: from mail-bn3nam01on0087.outbound.protection.outlook.com ([104.47.33.87]:52544 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753362AbdCBPwB (ORCPT <rfc822;kvm@vger.kernel.org>); Thu, 2 Mar 2017 10:52:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=ZX75tJ4Qqu+SdiNE/8IN3i6kAEpFgmf9CeblHpd59rA=; b=5F2AA8aMmylBOoyxjr5TYDGTtfzxyHMfl6QmWo9zR8FXn4VyMF0dXn0ZGSaFm/0ucG+tR/vM+ZKLulr0rxhHdeD5ZOmv3jvSvfQGUQyaSnD+7i7LOl83kCWQdn197gg7ExoS/WYnIWPURiQdsdnIym9F6IPC/5zbBHybRR3MhSc= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=amd.com; Received: from [127.0.1.1] (165.204.77.1) by CY4PR12MB1608.namprd12.prod.outlook.com (10.172.72.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.933.12; Thu, 2 Mar 2017 15:17:00 +0000 Subject: [RFC PATCH v2 22/32] kvm: svm: prepare to reserve asid for SEV guest From: Brijesh Singh <brijesh.singh@amd.com> To: <simon.guinot@sequanux.org>, <linux-efi@vger.kernel.org>, <brijesh.singh@amd.com>, <kvm@vger.kernel.org>, <rkrcmar@redhat.com>, <matt@codeblueprint.co.uk>, <linux-pci@vger.kernel.org>, <linus.walleij@linaro.org>, <gary.hook@amd.com>, <linux-mm@kvack.org>, <paul.gortmaker@windriver.com>, <hpa@zytor.com>, <cl@linux.com>, <dan.j.williams@intel.com>, <aarcange@redhat.com>, <sfr@canb.auug.org.au>, <andriy.shevchenko@linux.intel.com>, <herbert@gondor.apana.org.au>, <bhe@redhat.com>, <xemul@parallels.com>, <joro@8bytes.org>, <x86@kernel.org>, <peterz@infradead.org>, <piotr.luc@intel.com>, <mingo@redhat.com>, <msalter@redhat.com>, <ross.zwisler@linux.intel.com>, <bp@suse.de>, <dyoung@redhat.com>, <thomas.lendacky@amd.com>, <jroedel@suse.de>, <keescook@chromium.org>, <arnd@arndb.de>, <toshi.kani@hpe.com>, <mathieu.desnoyers@efficios.com>, <luto@kernel.org>, <devel@linuxdriverproject.org>, <bhelgaas@google.com>, <tglx@linutronix.de>, <mchehab@kernel.org>, <iamjoonsoo.kim@lge.com>, <labbott@fedoraproject.org>, <tony.luck@intel.com>, <alexandre.bounine@idt.com>, <kuleshovmail@gmail.com>, <linux-kernel@vger.kernel.org>, <mcgrof@kernel.org>, <mst@redhat.com>, <linux-crypto@vger.kernel.org>, <tj@kernel.org>, <pbonzini@redhat.com>, <akpm@linux-foundation.org>, <davem@davemloft.net> Date: Thu, 2 Mar 2017 10:16:56 -0500 Message-ID: <148846781666.2349.1816322796563357670.stgit@brijesh-build-machine> In-Reply-To: <148846752022.2349.13667498174822419498.stgit@brijesh-build-machine> References: <148846752022.2349.13667498174822419498.stgit@brijesh-build-machine> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: BN6PR03CA0034.namprd03.prod.outlook.com (10.175.124.20) To CY4PR12MB1608.namprd12.prod.outlook.com (10.172.72.17) X-MS-Office365-Filtering-Correlation-Id: 43c22158-3d77-4881-d90c-08d4617f2ff3 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401081); SRVR:CY4PR12MB1608; X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1608; 3:9E7F4ODygucmgfQN44q0gFLhu+Cmqrtp0Qw+lGOE8Q/3alMPhD48Brs0BpNoyFfu9RVw3YY7M9OhcRMGrAW5D1cAPgMt0S7ccxXSH6rMe7xvi7M22l173uagpI8WNukmQVKlxKA4sCldmJp2MZXDlcgsBsaZqws06AJ8UyB00DlfvIsJhvCO47eiu1r/XXXiJVoRUHfXqzaOR1ONVtA9/kp35Nxohv1g13DueQ1I5RHCLo2bDeLiRHFlf/ybJSfPTL24lDP4hT5dxe74LDliGbDDbd5r9E4fkuz8FixAZN4=; 25:DMIO7aCt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p34/5P//XJO16mCwPPkfaaFj2ymdiS7VVQRXJCHHxA1AtZYGzjsMNcFBy9XkiQEmJPPJeRw6DSmAOKqAFaOpp9tmflR5lDbYZMXGcuPPLEZAsNq2XAvqea1wlIxkvwIdSzhYovALk6C7trmGs5z68U9uZX/aco X-Microsoft-Antispam-PRVS: <CY4PR12MB16086097CA4848EBFC41F763E5280@CY4PR12MB1608.namprd12.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026)(6041248)(20161123562025)(20161123555025)(20161123560025)(20161123564025)(20161123558025)(6072148); SRVR:CY4PR12MB1608; BCL:0; PCL:0; RULEID:; SRVR:CY4PR12MB1608; X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1608; 4:9kjt1n2OO+7lpZX9yw4phNI7L9721VU1+ScMPUjBub/BSGJdPLsCKLgqfvyJkHvHWlUGYopPKoul0knL+gkb725a8ernGALzpu0vuSC2YHucPSTxV4LHvlG4bYrUt297flNak2zI1A+0G3gacRltEyxxdnqJrWhiUD7Jo9VaPxWfm9WPSMOlBp/xGk/66ClDBL2IHhLZASxGvNxmOFZbARQcGWJQ0q6KEQ/qZ934GBfbvpPwNjYg4YODtcg1zmE9rCGmmyC7JkPEae7atBAxgIXltNmLXgHF+4b69eZkSkZ6GydZaRnG4C6hWVSNSZej7pVPaaaVq2VZf4XiOD9ye2v1Zx6T+5KuuyoRvGdqEoEjnyENh3rnwz9pFhFM3tddChvkVnh2eU6RiIypB022lLRfdEkaktix0/4RkAg6/nClEWLAk5/j2d+jidGDOEml8XbRUy9zkaDMQ+RQT35dvR3Y6scKVdUnGNa2ilnd9ZFozAGiQJAUNvKaM5B3h0r/VepU5CmjkkfZMtKZuHb61dXjwtFSaHrNaootUi40etpARFSztkDvyBmBMqo0mElsbdw+tMkykqVbXYI+Pnx5Xrw5TVGc5jsCs/A5ej/my1FVr9/snXGr/PDMuRmTweWkeiWA5/XelnEAArSncnGZPz7EUZ3gB91s4rqBxU4ZSo4= X-Forefront-PRVS: 023495660C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6049001)(6009001)(7916002)(39410400002)(39450400003)(39840400002)(39850400002)(7406005)(5660300001)(9686003)(83506001)(8676002)(92566002)(33646002)(7366002)(2906002)(42186005)(33716001)(103116003)(66066001)(7416002)(50466002)(81166006)(23676002)(1191002)(7736002)(47776003)(189998001)(53936002)(2201001)(38730400002)(25786008)(305945005)(50986999)(6116002)(3846002)(54356999)(86362001)(230700001)(76176999)(77096006)(6486002)(6666003)(2950100002)(90366009)(921003)(1121003)(84006005)(217873001)(2101003)(83996005); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR12MB1608; H:[127.0.1.1]; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTRQUjEyTUIxNjA4OzIzOnVtcUwrZjU0cVBTQlNsalJiazcycWZCOHZT?= =?utf-8?B?M0hiVVpxUHppK005VTVzTDR4ZWcwRFF0dzZuTXpPNHdTRDFHcVhTOHdjZTZ0?= =?utf-8?B?ZmNicVRDRXNUSmZaOHpMR1RvcXlEdGU3RGh1S2gvSnlDMU1abkt2NlhJMDZ4?= =?utf-8?B?ZmErUExYVThidEZSbjhNcm1xcUdyZEN6bm85ZHZyUENZVUkyY0lzVUZQeEJV?= =?utf-8?B?aFVVQUdKbzBVQWxsOHV2ZTNVTXlZWUs1VzlxTjJnbWZseWp4akEzYzhyWkdG?= =?utf-8?B?S0IwSlpSZkZBWHE0R3FrZ2Fxc2ZSN240Qm1VWFZjSHltTjhIN25mZlExLzYy?= =?utf-8?B?Qk1ScGxNTHE5RE9lV0ZISzV4WTBqV284UW5tNU5sOEFBS1VTTE5DeVZScWdq?= =?utf-8?B?WnF2S2s2eDNyQ3hBYmIwNkI5Z05aZVJSN2RXc3JpWkZlS1ll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Aq0mO+dCvVI9SC22+gqh8iXaHvMLPxKDCbxmoTBeYjW+b2q0ljq0nGWdmwqLtjs= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1608; 7:YKm4qmcvF8UitT3FKML+TIYob/HE/Ic1iOBFKJowBT3xjS2aUOVHmUk/dXqsEfMj7Cl4KumpyxhuUP86+Dn4oNqaUMRBsCJQJtTW/xjd0mYBza00MQrp7OyinoNDUmkLvcGmnxQem7cI5+tECf/NJWXHFLDso1+Tdw/TT/mQePBH8kO0/hESJv/OK0dbvRr49yu8DPnjIhWsrjsmsgsCtBdMfbs0cnTRoT/fy8jwwUYK7Ok+AosFI91Ocn4RAbXKDgJydNSBuRE1b+5FVCGzZr918R98GDGqTOIKM92UocyKPq/ZNVKbHonhu+OM4Oa98+mf9bnQqrBf6RGbBoOsjQ==; 20:OpSsd4kOvdWUxBr02H6ugBno9IYn6AY/vilsVRKkR7gDnWaL2p43gCH5WIFCny77Ff1kU//GQXYbe44WaiK1OwpTEwmbzfqn74YKT82zzGMcWG0MzyJ6t7nzLg5ebjVx+2UsX6fI8lyWUJLO44rr4FnHVh8WvvHP1atVXH9XsuQMth2SixHR1Z4o23T+hKgdlwzY90jBWuuFRMD4yffp+zw1KvCSi1UB+ImSaIIcblx2TYQJDZeuAy9hFMnK1pSh X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2017 15:17:00.4801 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1608 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: <kvm.vger.kernel.org> X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index b581499..8d8fe62 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -507,6 +507,7 @@ struct svm_cpu_data { u64 asid_generation; u32 max_asid; u32 next_asid; + u32 min_asid; struct kvm_ldttss_desc *tss_desc; struct page *save_area; @@ -763,6 +764,7 @@ static int svm_hardware_enable(void) sd->asid_generation = 1; sd->max_asid = cpuid_ebx(SVM_CPUID_FUNC) - 1; sd->next_asid = sd->max_asid + 1; + sd->min_asid = 1; native_store_gdt(&gdt_descr); gdt = (struct desc_struct *)gdt_descr.address; @@ -2026,7 +2028,7 @@ static void new_asid(struct vcpu_svm *svm, struct svm_cpu_data *sd) { if (sd->next_asid > sd->max_asid) { ++sd->asid_generation; - sd->next_asid = 1; + sd->next_asid = sd->min_asid; svm->vmcb->control.tlb_ctl = TLB_CONTROL_FLUSH_ALL_ASID; }