Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751549AbdILUYP (ORCPT ); Tue, 12 Sep 2017 16:24:15 -0400 Received: from mail-co1nam03on0088.outbound.protection.outlook.com ([104.47.40.88]:35061 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750993AbdILUYM (ORCPT ); Tue, 12 Sep 2017 16:24:12 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Cc: brijesh.singh@amd.com, linux-kernel@vger.kernel.org, x86@kernel.org, kvm@vger.kernel.org, Thomas Gleixner , Joerg Roedel , "Michael S . Tsirkin" , Paolo Bonzini , =?UTF-8?B?XCJSYWRpbSBLcsSNbcOhxZlcIg==?= , Tom Lendacky Subject: Re: [RFC Part2 PATCH v3 05/26] KVM: SVM: Reserve ASID range for SEV guest To: Borislav Petkov References: <20170724200303.12197-1-brijesh.singh@amd.com> <20170724200303.12197-6-brijesh.singh@amd.com> <20170912200416.ygcsqvznkkp2gd7r@pd.tnic> From: Brijesh Singh Message-ID: Date: Tue, 12 Sep 2017 15:24:05 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170912200416.ygcsqvznkkp2gd7r@pd.tnic> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: DM5PR20CA0021.namprd20.prod.outlook.com (10.173.136.159) To SN1PR12MB0158.namprd12.prod.outlook.com (10.162.3.145) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 29ee39fe-fdf5-4046-28ae-08d4fa1c391f X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:SN1PR12MB0158; X-Microsoft-Exchange-Diagnostics: 1;SN1PR12MB0158;3:osjfg8wQtUZqzL+5Cwb1QIC1DapazgBNKHcntEe419rGB9ADOMc5iJQSa8KyHiFHZhNg1BXA7F4an8jzKSxp8gGJhzAXtWpSv52rGsPKExl+FCsjv38LC0O8Ud94P+6X7mtB3iq/qGfkoJfvMjhPfm5ODHReVul2PI3KW9OLRPXmdXzsbWEObuhSEVZIWGt+naB60F/ytZ8vR4xsx/FADNILj+StnZ0GKgGPW2lQGsghwORoaUPmvdR8M887uvDL;25:EH3oid17ZUgoA7MrBgum9WDnPBhLHxYYiKx68Hl9cRryUmfGWz062mSHQNlaGZ1IS/3bK7HFCx/ySjwXMcEXkls7tt9WuGS13iOsIQsVHb+T36ZoVBLcrDFtT1zEItV27q1COCZ4YiK23H/8vu4oBCswokyXSaZqkif6zreq8sDZoiWDgLJLXkGyLQSZn3y4CsU2y3xtLVd46hsZJH4vOVxCVrgKzFx6+JvxaBTQemC7WNbJ2bZDkIFQcFoZm4uQUUMee8X07QYVFXNtb/z0hGCAEl1K/PCBbGuouy2gH92BYdH7MNXvdeGXqO8mZDdfht9jwKEksLWkSPCe+zcamg==;31:ILrxjrUohlB5TiJ3rHHx8OfttnTnYb3ObdBmlvaXh082vniJU8foRaT3cpve/RjFI3ZTrIODPtJPM8kLAHv8KQKquzNspYIQVj4Yo1LGrDsnQzx+Auu55Wm6pRGLtXI2Q05pl6LCWZO4dUFXDcHD/Zx+xNK5dgJBobA3Old33UEjU1skaffIM0JoUJZN3aAWia8p99sRqEtb/84SefgcYZENo9r3DaZCfF4z4YNU9Xw= X-MS-TrafficTypeDiagnostic: SN1PR12MB0158: X-Microsoft-Exchange-Diagnostics: 1;SN1PR12MB0158;20:3dCzkosWMSYTdRhuDxjaDAUio28LPqMrKhG1hHFE3UQr5OFjuUUEKtu/ZUKhnw5AD+KUGS1V6uki6LCpNek8LbK/mMeyJB/lBommsXXXIId8BMdEzOXG8FqA7lEPpnw9va5xYUC+XpD4WwY4I9sWOiXAnLDGqHBb910UbcMUQD8XqN37VPU4zy9/JjO4BBM/BRd0xBjF+/fdNsnt03ZR+4W+gtj7QKJ9JHgYpNmuqVBkhOgstpGE35Fzr/F9mYV3KjXOra2Ysn+8+812eKjKiPyv5gGA+VFgwls9eiYBTmGh1YZvzxoig8ArLtcPfhfz7NmsMeEtYu0pmZYJa/VJQOTyTuJ+4b+qyJssCiP+Ab1lT5Gf81L6VfKYEiV1VUibL+KeJIww3g7xJmT1gfz+FwE05TGLNrLQyDmfRHd8egasty3DSpPrP0VACSoG7WeGHyA9jB5NiDlCybUFMZtwmChZdV0daWmsMDyts0tDRlvDHa6DipzLeHSXYTLcT8WE;4:Nv7R0ipVidzpy9sZKPy4Jkm6NHo9jI4tIuXZY828UYwsG9eOYpdPbYJe2O9/Y2TGJvZmLhZ/+jHZyX/LTVkA0Pc9LzJ7ahsj8mMVsYs9Kp+eNimrLx5OY4Mgin555eMrmwsibX9jgstXdZPBvqtKzQu21yRbsmOB1oBQSgdmsdUBbHBDDhd9Y6SyDAlMr9mkhDWWEsJbFxIDG8brRQR+tiMgMPoOYtWAXlHdCMExBFS0WnefsPQKuTYDXJdZGq66 X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(3002001)(93006095)(93001095)(100000703101)(100105400095)(10201501046)(6055026)(6041248)(20161123558100)(20161123560025)(20161123555025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:SN1PR12MB0158;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:SN1PR12MB0158; X-Forefront-PRVS: 042857DBB5 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6009001)(6049001)(39860400002)(376002)(366002)(346002)(189002)(377454003)(199003)(24454002)(68736007)(31696002)(23676002)(6116002)(42186005)(65826007)(189998001)(7736002)(105586002)(101416001)(4326008)(305945005)(110136004)(81156014)(5660300001)(2906002)(6246003)(106356001)(54356999)(50986999)(33646002)(316002)(76176999)(8676002)(478600001)(81166006)(229853002)(50466002)(77096006)(3846002)(64126003)(2950100002)(6666003)(53546010)(97736004)(230700001)(6916009)(36756003)(8936002)(65956001)(25786009)(86362001)(66066001)(65806001)(47776003)(6486002)(83506001)(4001350100001)(90366009)(31686004)(53936002)(54906002);DIR:OUT;SFP:1101;SCL:1;SRVR:SN1PR12MB0158;H:[10.236.136.62];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtTTjFQUjEyTUIwMTU4OzIzOmUxWlQxSTlINXRrNS9Qb0V4WGUxVy9qRmkz?= =?utf-8?B?ck1HWlN4SG1rcEFLYW5senBtdEgrTnVVYmVGWG9DcUJPNGdRMnRMM3VKa25n?= =?utf-8?B?SThGcUErbFZNdmdWT3VwbjNLTUhQLy9NbEdZNElOMjViMU40OWo4SVRnT2Vi?= =?utf-8?B?T3FlNHBKOXFzeTVoM29rYnY1SE9ra3pZdU51SjhYRE8zVHZROUtCYXlOQ28y?= =?utf-8?B?WVRLRzZqY3dMU01POHU1R2RPRVpFNUxLMXF0NUJrZi82b3hDZUM5NmthdjVH?= =?utf-8?B?WmhmWUh6TXlsZFhDaEI1RFBYY2RsK2x5R1B5d2doSHdaZ2Mva3FVREY0RU5l?= =?utf-8?B?QnRVdUt5RDVqdHhsRmlMREF1WSt2V0xNZWFZcHkzWHV1dkUwc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FDaUaf4A/doWekx5IBrV28Z1hiTFeK55awaj5IOKboiarMOcp/+9vje430xsDdZoY0Ld8JLA+5+M6y6eS6tQsAgYWQ==;5:7owxC1+tG101NGAVfXfTnERMI2ziPYPT7Jg19iJiyvQMm2al8om4IIHhq64FoH4ix3cPziUq0Txh9wX5pi6fgklDygw7DvG3h7GujGpPsPQMud64NBm6dN2btB7eeb8HKUfR4OnzGkgCQYeY8COafA==;24:n4Ul6niAkCFd/R2SQjMGmJPZA1OHwjRNAfGCT/OX0LknE+YrTdMBKZGrzxS8eR2f1k6hgAnEd9C/62QThfd+FDSFRBrEKDzlPVP3g0xem6Y=;7:sKJI84q63gOCBbXM3/ObJZU/Lg9r3GYTkvZ9mDnlTRODTgUw5yXEBrO4RL8BTqkL5P7K8e/Qn6LzPdcbZxIW5cioqJ4iaprqg1ozXH+dqsYvr7Af/gzNAIO/1WaORPwt69VC8JStuu0q98V96jOMADr3r13ResOLidZt0N4O1yYvchY9dDoMrbNh7YCo/TfNiFgwD8GhzGa4Ve0NdBaYJ7lW6kxURiVk8EQ/SC6DB4w= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;SN1PR12MB0158;20:1PCQ3M/d8TaywcePyrOz/28vsory1WFZOWxn75WLnN+0tcMZTwQB639VOJaS0+WT8U+4Hl/lLoVO1yaax6UGcEEirC+rugEnISKFfc1zfLQCosyvo0EqW0DtfuRsH6EjUOGoBPHFMELYOG2erRosKoB/WT9//PR4uzgyyLDKvm1TxJLiBL7mctM8uIacTxpeyLFYjMZmuEFo7Wt5vfvg5tthW+5vugGzd1v/pXaIwxnIMjTFHnwHObskQYI12JB1 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Sep 2017 20:24:08.3891 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0158 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 874 Lines: 45 On 09/12/2017 03:04 PM, Borislav Petkov wrote: ... >> SEV-enabled guest is from 1 to a maximum value defined via CPUID >> Fn8000_001f[ECX]. > > I'd rewrite that to: > > "The range of allowed SEV guest ASIDs is [1 - CPUID_8000_001F[ECX][31:0]]". > thanks, will do. ... >> >> +/* Secure Encrypted Virtualization */ > > If anything, this comment should explain what that variable is. > Basically the comment you have in sev_hardware_setup() now. > Will add more comments. ... > > max_sev_asid is static and it is already initialized to 0 and thus this > function can be simplified to: > > /* > * Get maximum number of encrypted guest supported: Fn8001_001F[ECX]. > * [31:0]: Number of supported guests. > */ > static __init void sev_hardware_setup(void) > { > max_sev_asid = cpuid_ecx(0x8000001F); > } > Agreed, I will improve it. thanks