Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753170AbdGXUEg (ORCPT ); Mon, 24 Jul 2017 16:04:36 -0400 Received: from mail-dm3nam03on0066.outbound.protection.outlook.com ([104.47.41.66]:3232 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752805AbdGXUDl (ORCPT ); Mon, 24 Jul 2017 16:03:41 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; From: Brijesh Singh To: linux-kernel@vger.kernel.org, x86@kernel.org, kvm@vger.kernel.org Cc: Thomas Gleixner , Borislav Petkov , Joerg Roedel , "Michael S . Tsirkin" , Paolo Bonzini , =?UTF-8?q?=5C=22Radim=20Kr=C4=8Dm=C3=A1=C5=99=5C=22?= , Tom Lendacky , Brijesh Singh Subject: [RFC Part2 PATCH v3 05/26] KVM: SVM: Reserve ASID range for SEV guest Date: Mon, 24 Jul 2017 15:02:42 -0500 Message-Id: <20170724200303.12197-6-brijesh.singh@amd.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170724200303.12197-1-brijesh.singh@amd.com> References: <20170724200303.12197-1-brijesh.singh@amd.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: DM3PR12CA0049.namprd12.prod.outlook.com (10.161.151.17) To BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 615b20ab-7b97-4da6-9d1f-08d4d2cf0c82 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:BY2PR12MB0145; X-Microsoft-Exchange-Diagnostics: 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qydgQ3CPmJt1no4B5zbaDt3jcH+Z8D8URAVoW0CHNLT6zDptYrNAo4cxhkZ1MMOks3KiIl7oe7TTfsxwVa2Ca0wR8R3lYiEN3/0Nkdh1YJx6NyC5NiQCnrH+yb5rsCsjaqo8WLl7MQ0RwczzDDXNBAQdcXyjeV0cqE1ooS7+l8ZmOBRD7YI5k1h1jGwDF69qQQet8QfJmcuYcVrcAQlAU/r/mrV4HTnusmAp37FDjGVRyE68+slGNH+JLl9PFuNwBCdA+32ZS/8A5NIr3ogMOzn8lwaoHULv1tv+r/uQBzFMi+mRRMtHRTiSBvzz5eoy1Xj3B3WsV/4VnbFT0q9qDJeQra4/hW2lZDPUOPGpy3n0BAfi71ahZw732E= X-Microsoft-Exchange-Diagnostics: 1;BY2PR12MB0145;20:vujATVxzuRob4Pg3E+R0/4u4+NsTsR2ST7tmRkZdBrG1ngT8OlXMrgYd3kKLdGxyQo7tIdH3FJmPylaWf28bzDIpuvARFBPyufNbCSaP4qfoEXb28IODibsOWzBtX2Wp9w0tKt0j0GTRujFaItPx5EA439QA9vk0eB5MztzZlvAgHVTUiXK1+QFkfarmie9tK7EgHzIoAf2OjsG8yhGPG8D9FdfOJ/koQS7eSQAf1sZqiqAGtaT7ZWxYVJswVJYQJSv+VdSIFTI4FY+3fQKtYJvm6pJmYiOzf/yuEps5Dvxkb9OpqI41Zd154p9SSDMB1oIakxuDBYq210qJvW7Rll4llYNF9g+K/MMT/0SeZzjpJin1XR7BmBwxvT9OxzQ4kGyadradQPKQ8F74YT8wRkoeMp7SStownvIDEIlLoOeCsOFzlkKyowSN9gxLKbMVJeXqqEznQ2EDGYiTiIUaVigkEd3uUEV0MNxPpribdJ4r+cuhGBxGbtsmc23ax36I X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(3002001)(93006095)(93001095)(100000703101)(100105400095)(10201501046)(6055026)(6041248)(20161123562025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123564025)(20161123555025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:BY2PR12MB0145;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:BY2PR12MB0145; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BY2PR12MB0145;4:RpJhsHzXoTz4AKCiB7EPX7unU75S/ETYPH2XcYNfei?= =?us-ascii?Q?vuLtqc9BdWPOrQDSbi4BIEiKoeThGuCSLiEh30w2vD4u+aiV9mnIiEXC9Vul?= =?us-ascii?Q?6Qu5zPTe+WOV3zk2R9mmr2k5ZAcQ8o/mEOzeAshaAvWMobezbGIhl5swomkG?= =?us-ascii?Q?HqoRdV8Goi0XxOal0IkmAk8MuTzAzX1yCKiwbkH47EBOMi7kLdrHjyH66RHs?= =?us-ascii?Q?e/C2yZfk47LePet5B7VGQASD4pNE4Z2Dnm1V7LzIyijV6IWDFEfttEtPH9Rk?= =?us-ascii?Q?FC+IzSWENdQfChDU4PLFX3kKv8yJYqBBC92j8clFLy4YSaGYRE1nYMF1+dZ3?= =?us-ascii?Q?OEluOs4X+YB123b2p0j4QjHmBlV6HE4mvO3+XgrUsUmp/Jsg8XiWs8dGxOMG?= =?us-ascii?Q?Gcg8y3qnRaGToMFW2mkPoM/wNtEAM45Ck4IHAUUlhZyh9VzO1TwXDMh1WZeD?= =?us-ascii?Q?nVPse+gURbilu3smiTpW0ZTjZClfOIPTcssIG7MDmO46jVdm3fh16wqlPqd1?= =?us-ascii?Q?pYgg1J0C6IcQvwz83hU263tRS7TB4t9oSTuyxgf9nv1i+04F+EYxpmlbfQRa?= =?us-ascii?Q?FrJYgqsyOx2mWq+jefqKw53hGS2sraYX9T4Y3Nvj6cAk3FS22FYNWqRFlAen?= =?us-ascii?Q?tdLenllvfy388rtpEff6wM1ZDbi7TFbOcqZKfpLzDliw4JO1s0vr+bJDiIQl?= =?us-ascii?Q?Z5Q5tExK1MXm5e/+rWsgWRn4zaRaGLXBPmtelJjXYiti2DhcEo3yc7DOz30w?= =?us-ascii?Q?dvLI3usNzhcisX/c6ZCOwfX/CSY5H8ZAHz+HFOksWsz6hpGTbE41khA4+aQH?= =?us-ascii?Q?WZO1BhavUbRcN3B73zEkLcRh7tDDe8n/jug6aTTA0FCEFxtSlR1ywEwL/ZnZ?= =?us-ascii?Q?fxg/F9gw1sQReBtJ9hTZtZ9wqyLWPkorWbLjko3dhleeoBlO+7YdUt/oKzYP?= =?us-ascii?Q?PffL/4HX1MQgPZs+6Lw0kqf0zECjeYxjA3K6iQhe0d2cWXoUfbiNEQmYRMYL?= =?us-ascii?Q?j46cLDclwC/eYYorsS5XDUgKeU6JBKCe3QBYvwR2lzBRu8m4TGDSyzKwYjdU?= =?us-ascii?Q?XI/bCImCSmb6Yte1cUP35Xi4q5ZPF/85e46LolYBT5o5k2BmoCqCgIUYSSK0?= =?us-ascii?Q?rX7HGarPa6BLHohHxJs+U8pwztQx/ddpWDQSWMFDRc/NPw0GlvcVvklA43lT?= =?us-ascii?Q?FbMcIKpj8Yq7XwrTyFy9PbttYhz56ARGe7?= X-Forefront-PRVS: 0378F1E47A X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(7370300001)(6009001)(39450400003)(39410400002)(39400400002)(39850400002)(39860400002)(39840400002)(189002)(199003)(7350300001)(68736007)(53416004)(105586002)(54906002)(97736004)(50466002)(6486002)(48376002)(2906002)(106356001)(33646002)(6116002)(1076002)(53936002)(3846002)(189998001)(101416001)(6666003)(2950100002)(478600001)(50986999)(76176999)(81156014)(50226002)(38730400002)(47776003)(5003940100001)(86362001)(25786009)(4326008)(36756003)(42186005)(8676002)(81166006)(110136004)(5660300001)(66066001)(7736002)(305945005);DIR:OUT;SFP:1101;SCL:1;SRVR:BY2PR12MB0145;H:ubuntu-010236106000.amd.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BY2PR12MB0145;23:3ZAE7LIxTDXxOXYPI1O9kAKaHndWnm+r1ZgW0R0LB?= =?us-ascii?Q?HdxZEP/gBbHAGajIfiJ1L3qR3KoFhtb+9fNB5pEu+ItMoEiNWVZCqNYTKV8w?= =?us-ascii?Q?K8v24Arpw8DWl6q6BbJGZB5I43orYBZxvyS9UCQ55xOGgtiOHeaEvbwW0Mg8?= =?us-ascii?Q?3p0x6FlZkFgHw2en3N0YhQR+CUDDjr/BiDSerCNZfkfFxiAtkFgaLtQAc2ND?= =?us-ascii?Q?qaYOxVzgEnr3YFbRfv20SBQiNUw4uA1uLkqFrewvucRlGBVm9KNqZ5X/1Hzt?= =?us-ascii?Q?F44Q9LGWjjy6Q/3uPV0G20siynK13pEgdlQHyfK20oHJzSo6yHmujgSbrSOj?= =?us-ascii?Q?gLkrw+aORb/xiTr0eYlflfyUDc9T2LQPXTpzVVyEGuKCm2rNN+t1Z2jw+WD+?= =?us-ascii?Q?Rsm1Wh/qqZ6dYoCf4p7r76aMG2ysB7MPcaBGldYufEge3lEPI/XqSs0HA3rp?= =?us-ascii?Q?OOuKoariDCWu/VizIO6zgfc3UABNYAsQceKecc17EiLtB+zxOK80D0rqZOrC?= =?us-ascii?Q?6S/tExKyyhjJFltrMxBh0IlBBJh1U4rbn0NQadWuv0etEpAPVoOSy1gvsVHn?= =?us-ascii?Q?TOLXdb9ewQyj39OL3CHuG6QtY7EGmunEkSKXVdmczcPnZCcOEWha3BTnXqNf?= =?us-ascii?Q?a8xyPV56OZ/Lp0tyXUhmuO7iR3xB/eQwGTs+X/07jzVrENx8LuSNsNVAI/AZ?= =?us-ascii?Q?rbeyumx7UBJjaDxubgVoxZSj46/yejOEGtICUOq45kiUrCAPUhpI0Pkv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Jm1G6RAM6ldZNjAXlpcgz1WdGrtWyUjHE1cCyq+4smWXAoj2boscgPjT+z+MXAcyb2onh9azoMJTWScXzJbRhCPTR8G+F8ibTjBNRLsuy+OIq+Yl8ihW73bXPctuCmCkXJema5H4dUvr3JroiVUVbYJFUP2OLqqZw2CIbj8RIj1lbJbE1h4cusYFsTvZRE4y+FK3Fs2NiaQ1Cdg4SdvUsJaFES/TDyf1n9X3L476QAWmHUylTCEdstTnf5NC92NWV5KQ6/vwYiTRPpV/NvdY= X-Microsoft-Exchange-Diagnostics: 1;BY2PR12MB0145;20:jTxT2USvvtKmygNZgoO02sQg2K4UB3ZSjcPlELOk5MsA/fgLsLCEaktH6D1ov2txEZ+v4Gp4W+uxXvOYzO3akr0L3WwPBKAadS4eyhDlT2cQPS7pJVaE3oiwvFy7snaiYMfpA84HQWn26ABMmE/u+AKq1e8TVfGA8cwqNeP/vVv8TOSIg+WgW+D2LEyCcsPgj0RRy/vmW0D3IAUjOOJ0UwWbP7WKZmQnGNFIGRJmA37wlZ0S+Eh6MjKGZZQJhSH7 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2017 20:03:26.6500 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0145 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1822 Lines: 67 SEV-enabled guest must use ASIDs from the defined subset, while non-SEV guests can use the remaining ASID range. The range of ASID allowed for SEV-enabled guest is from 1 to a maximum value defined via CPUID Fn8000_001f[ECX]. Signed-off-by: Brijesh Singh --- arch/x86/kvm/svm.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 46f41bb..06bd902 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -319,6 +319,9 @@ enum { #define VMCB_AVIC_APIC_BAR_MASK 0xFFFFFFFFFF000ULL +/* Secure Encrypted Virtualization */ +static unsigned int max_sev_asid; + static inline void mark_all_dirty(struct vmcb *vmcb) { vmcb->control.clean = 0; @@ -769,7 +772,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; + sd->min_asid = max_sev_asid + 1; gdt = get_current_gdt_rw(); sd->tss_desc = (struct kvm_ldttss_desc *)(gdt + GDT_ENTRY_TSS); @@ -1033,6 +1036,21 @@ static int avic_ga_log_notifier(u32 ga_tag) return 0; } +static __init void sev_hardware_setup(void) +{ + int nguests; + + /* + * Get maximum number of encrypted guest supported: Fn8001_001F[ECX] + * Bit 31:0: Number of supported guest + */ + nguests = cpuid_ecx(0x8000001F); + if (!nguests) + return; + + max_sev_asid = nguests; +} + static __init int svm_hardware_setup(void) { int cpu; @@ -1063,6 +1081,9 @@ static __init int svm_hardware_setup(void) kvm_tsc_scaling_ratio_frac_bits = 32; } + if (boot_cpu_has(X86_FEATURE_SEV)) + sev_hardware_setup(); + if (nested) { printk(KERN_INFO "kvm: Nested Virtualization enabled\n"); kvm_enable_efer_bits(EFER_SVME | EFER_LMSLE); -- 2.9.4