Message ID | 147190846546.9523.8365293594479732082.stgit@brijesh-build-machine (mailing list archive) |
---|---|
State | Not Applicable |
Delegated to: | Herbert Xu |
Headers | show
Return-Path: <linux-crypto-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 F1113608A7 for <patchwork-linux-crypto@patchwork.kernel.org>; Tue, 23 Aug 2016 00:03:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD57F28AE3 for <patchwork-linux-crypto@patchwork.kernel.org>; Tue, 23 Aug 2016 00:03:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D0E0528B32; Tue, 23 Aug 2016 00:03:32 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham 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 9EFD828AE9 for <patchwork-linux-crypto@patchwork.kernel.org>; Tue, 23 Aug 2016 00:03:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756822AbcHWAD2 (ORCPT <rfc822;patchwork-linux-crypto@patchwork.kernel.org>); Mon, 22 Aug 2016 20:03:28 -0400 Received: from mail-sn1nam01on0088.outbound.protection.outlook.com ([104.47.32.88]:55566 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752800AbcHWADL (ORCPT <rfc822;linux-crypto@vger.kernel.org>); Mon, 22 Aug 2016 20:03:11 -0400 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=9Mikt6XWUcAirAEXUsWro65cS8GfPfRCKUEPDXtFmYc=; b=a1DvP7bVxrqiPth3HiYEcwBBwwF0Dpa5PsMtRUagMQ45uzZUcHJUCm39mxcnPpDHiFlGgBM0JqIgzrzXZ9bwg1PI/iLOrT35tMKKPdpWnCSyfZBx9Gz3dkkK9tw5R86PekAGrqMgrBR1Nt0tcuEE3gQneikXzznTnrb8j314W+c= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from [127.0.1.1] (165.204.77.1) by BY2PR12MB0661.namprd12.prod.outlook.com (10.163.113.150) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.557.21; Mon, 22 Aug 2016 23:27:51 +0000 Subject: [RFC PATCH v1 19/28] 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>, <linus.walleij@linaro.org>, <linux-mm@kvack.org>, <paul.gortmaker@windriver.com>, <hpa@zytor.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>, <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>, <toshi.kani@hpe.com>, <mathieu.desnoyers@efficios.com>, <devel@linuxdriverproject.org>, <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>, <linux-crypto@vger.kernel.org>, <pbonzini@redhat.com>, <akpm@linux-foundation.org>, <davem@davemloft.net> Date: Mon, 22 Aug 2016 19:27:45 -0400 Message-ID: <147190846546.9523.8365293594479732082.stgit@brijesh-build-machine> In-Reply-To: <147190820782.9523.4967724730957229273.stgit@brijesh-build-machine> References: <147190820782.9523.4967724730957229273.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: BN6PR08CA0051.namprd08.prod.outlook.com (10.172.144.13) To BY2PR12MB0661.namprd12.prod.outlook.com (10.163.113.150) X-MS-Office365-Filtering-Correlation-Id: 12cae601-b49c-46c1-c696-08d3cae3f268 X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0661; 2:d19h+OxrCzQ11BvTSf5M/8VPr4ifLgPdgA2fZZGtgPSH0W7KMrujWV2Z5EjWP//Nf+Xj61eBi1EnUPKQ206kbEKvCqN+AmBBtZ8up0dMrWF97pRgrl+00lllcJZUpnUopmLS+Hy/aqhMEwm0brqEkOwgI3G0FZRO9pDo33hyv948d0sP0WUbBBJ8VmdY6XPV; 3:Seeh7L+jWwyaz950WjZNabz5fbsL0WzqJ5jaeLnEMzLtjs5mHClpJv2yNcR0RZSuwcJYKXRU+30UEAvGCPJkAcwzWzsfIurWy2eyXM80rDr3xzoSPwyCvQCfldmu7GmX; 25:52KQwrlz0JqBbh5LoFRyF4J2Pgj0E+WEJEVxSfI7Rq1croYU5dXq2ZXhZ7aWKJAdDvFNQ/1XhSRYV0o3ylA4Tcykkaoq+W1n3nafGmbgI608LsOkTTk13gS8u4A1DYIv8Hi5aWdN62ehRLN671nxd2rKr5sWaCFJ38uV0IG+zZ1iN5l6qNhstOtAMGpWtjVt9YgeMUmg5oefuUHfcvFELl91KsfXJCkP39NKGiY37YCCIsGlJnRfphzoeihE8kR9buV6jgyM+89KrFHAa4g9GCkB+NtbfBHOFX9VZmb5iISBJhptpo/VAHru3qB7XVSbaqlTljfeHEaVe/w6aGGrSYzCaIeVEAyiItUOfkoYvbPJKVwtgSC4PkdgZ4kq7wBucx1vYEo23fV+f19eFjJ5+GE/EaHAsjsoP5yn/rp+seo= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR12MB0661; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0661; 31:K1y/NqGuhO1utHYb+ZFvbXd6HCiVuPCRxpHzVoPDmLHW3j881tt2htdqta3fPq01wkgE99OrfDmXCEQcTSkYcUu0704SPUXb+e1LfpjBWFzy8i6mXW0cp4oI3YvLOAADfyEug5yowcZsxZ1xkpeqkbPT3tdVXac7yE/SZmXJZiq1n+S4sbDWPxSbza4eMfonbBvUPCQNsyxRzWW2hJeMMsCn8N27+1Q6IHChq6pP8EY=; 20:kycN9ajTb+ugvXidGfC7rQ22PFAvrOGlaR7w+RDSTTnVe3cAfmW8lhFHOARnniFjSYpvQJPlXJZirLP+o6sxbIOGWTL+98kTP6u4vpdvkwFd45lPCCOybx9jctcpT8C6u8A5bL5X6X5/t2dDqECjS0qVVrGCJaPi00mF77cxfa3U+7ijQuOd/FVzO5KP6j6AfpBn8ONiq0XRenPccKtnOvtVWf82HYn7/e3wWWDaficvSW401L/38z8yN1rQIPKKLXZGIDkmXv6SP6A3yD8ZbevqQPxV0pE8HM5E9ULUHEa+co1KKPiDY4hh8E6l16jcuNb9ONees9o43ARq3HXenWFXVhfbqZf4KTf5BLBEFbtHzxjT4lHdxA1yGKyj2Baad7XdJa1xqN7DMtEYU+qbF+bKBeZYv2mpMQXx+GSgWdUisBLzLFrqfHytWSjU97XumFCPIyaDboT+Fm+v4uc+g0/wh977QQXrOLWrE+tZzO826Zj6g5+aGxoF2ckWzp5G X-Microsoft-Antispam-PRVS: <BY2PR12MB06611B461DEFB5CC3ECD22B6E5E80@BY2PR12MB0661.namprd12.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026); SRVR:BY2PR12MB0661; BCL:0; PCL:0; RULEID:; SRVR:BY2PR12MB0661; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0661; 4:EsvarF4qxc3PwZF8ss6fmIWioLesTiQTz4z/7Wdm4QQv2iQvw9qLGqfnon0+I5ltx6qPvRqC01vyLB+HiCbJP/g+YkG/m5KXEQBx6fkmRRAdVpAMPdaZ0HR0jxWl3+WoFAGZ2Uhx+C6na/ZCCSIvqdIRT8nQce0txHWkf+LbOzFAHJxpGZYlEphrbqcKTeTcCMCCZswaFTjHnFfiX/Z72ppDWizOMS/2ELSGqXjFrYKKMWHuJFh6DBY402Uum4AS6xwRpNjcHDGwEhkDt8DeBxmLsOox5ZQhNZP8F+f8gPN40rwJtODfzTm6TpH7TZyy7Y5Ycyj0unWhTjfF+AgJ3iynSgTUQT3boTIRfq8wofSOdVdK7Ya9GfYzNUDsefmosGgYwKZyj2CrDCCx+pIXCtrWF4B3jlSTodzGXsY8sEeYl68h5RS7d3WIIdGiELCn X-Forefront-PRVS: 00429279BA X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6049001)(6009001)(7916002)(189002)(199003)(5001770100001)(107886002)(83506001)(42186005)(77096005)(189998001)(97736004)(23676002)(7416002)(7406005)(81156014)(8676002)(105586002)(81166006)(7736002)(33646002)(2950100001)(229853001)(106356001)(5660300001)(7846002)(4001350100001)(305945005)(101416001)(66066001)(47776003)(6116002)(3846002)(76176999)(50986999)(50466002)(54356999)(586003)(103116003)(68736007)(86362001)(9686002)(2201001)(33716001)(92566002)(19580395003)(2906002)(230700001)(19580405001)(921003)(2101003)(83996005)(1121003)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0661; H:[127.0.1.1]; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCWTJQUjEyTUIwNjYxOzIzOlNxRFRSRkZGZ2Vhb1M0akJBOWtsZGJPNHlj?= =?utf-8?B?dmZpcXlIQmcxcWZ6aUNtbTBHVUJlNHNJWm5OWXlyS0o2a1BIWXlJUlJuRjJG?= =?utf-8?B?MTRDZ0RKZEZMb1Z4QzNqZmFJeU1QRXpXMnd1b1p5RnZCMTBlQWJhU2NOQVdM?= =?utf-8?B?NndMaG8xU2xNZi9WbnNKNUVLVHBaWlpWK1hZclhZNUllVnBJL1FOQUp3dlBP?= =?utf-8?B?RUFLc05ob0hOZHdaTjNnVy9iQ3dtSm5uRjNyQW1FdTVOcXdKYlYvNE9RdEhm?= =?utf-8?B?RURoMW9rS3JhTk1kMHpzUDYxTCtUYk1CSWV3c00yTC9udTExSWZxVWFIWkFr?= =?utf-8?B?VU9XSGZyTi82OEwvWVBJTTNyM3VNdk51d2pDN3NxSG4yTHBzVEZRZFRDMXZF?= =?utf-8?B?dWNrZmpHQ2ZoVWI0T0J0cjJBMk1waDhuQVI4b1ZOb050SlVlTHFJRzZqVnNr?= =?utf-8?B?cEJRNit0UEdidkMxQlNpZWw0RXIvRm5URmEvRnRSSzBLTWZxbzM0QzB1NkFS?= =?utf-8?B?UmVId1hPUGdkcEtzTU9lL05sT2VZaWkrandGZzc2dzBRZ2R0QWVuTWRVamZR?= =?utf-8?B?STZPbVhMNStuVlNYSzhZaFNXK3h6VmlxN3JHS1l3aXZ1K1pvdGhoWmo3ODZN?= =?utf-8?B?OWwvQjU3QnZYakgxTnN4NlU1VWZCQVc0bFlrVnpucEFDTVNJVVBIVmxUUUtJ?= =?utf-8?B?YXBFM25WNGRveFErREVuYX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cHcGg1olTwuBGDOZ1bd4XqdDFV4yoHlfdQeOTwDdoJsggU5HEMfqd08EOX SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0661; 20:fST5rcVB777t5kypnqmQCRWQq29qglh6W6xgJqAwlBt20oZXFKe3/oW7FknAGP/Zvddm7Ox56wtVs3jvHCh0r3mpGJdbC3MIBXXoL0URbKkSvpEArSUMWncKAYKX15uisUbtiqKIxoqtVBJ8pgEkBZlXWjpOc/iNX4yC/Ccdv8emmUGiQV/skUK5gw98NRX+miFEwfv9NIlW921mFIj/I0b2vVZ23MUkrL6xqLgh7CkZm1yHiH0oavMA+Mw2sIHR X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2016 23:27:51.6524 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0661 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: <linux-crypto.vger.kernel.org> X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 211be94..f010b23 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -470,6 +470,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; @@ -726,6 +727,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; @@ -1887,7 +1889,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; }
In current implementation, asid allocation starts from 1, this patch adds a min_asid variable in svm_vcpu structure to allow starting asid from something other than 1. Signed-off-by: Brijesh Singh <brijesh.singh@amd.com> --- arch/x86/kvm/svm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html