Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S939011AbcKOOkX (ORCPT ); Tue, 15 Nov 2016 09:40:23 -0500 Received: from mail-dm3nam03on0059.outbound.protection.outlook.com ([104.47.41.59]:57312 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934302AbcKOOkR (ORCPT ); Tue, 15 Nov 2016 09:40:17 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Thomas.Lendacky@amd.com; Subject: Re: [RFC PATCH v3 04/20] x86: Handle reduction in physical address size with SME To: Borislav Petkov , Joerg Roedel References: <20161110003426.3280.2999.stgit@tlendack-t1.amdoffice.net> <20161110003513.3280.12104.stgit@tlendack-t1.amdoffice.net> <20161115121035.GD24857@8bytes.org> <20161115121456.f4slpk4i2jl3e2ke@pd.tnic> CC: , , , , , , , , , Rik van Riel , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Arnd Bergmann , Jonathan Corbet , Matt Fleming , Konrad Rzeszutek Wilk , Paolo Bonzini , Larry Woodman , Ingo Molnar , Andy Lutomirski , "H. Peter Anvin" , Andrey Ryabinin , Alexander Potapenko , Thomas Gleixner , Dmitry Vyukov From: Tom Lendacky Message-ID: Date: Tue, 15 Nov 2016 08:40:05 -0600 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161115121456.f4slpk4i2jl3e2ke@pd.tnic> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: BLUPR01CA041.prod.exchangelabs.com (10.160.23.31) To CY4PR12MB1144.namprd12.prod.outlook.com (10.168.164.136) X-Microsoft-Exchange-Diagnostics: 1;CY4PR12MB1144;2:C5O08XvB0Buki/d//WgWu21MwNBEos0viikBfJVfYcQlYZee4Qpd0NHk3qMk2X8fiXXSy3qA438074Km7K+ZJK91vLIhiIokZBHr+WDpgigk71xF0lqFB/LqhJWO6mLLj5VMdZdco6uqmAANQX8YtPJvkj/j0+OrBoujFuM3T1Y=;3:juwZtlzaa6HvB16OA5x1qawMuGGareX5fST5Y/+w8H+JiPisBPhdO4Z2aKOux8fTkSGh6ls3aCKjtzdLN7N/UfhhZOaQu9+d8VzBgliioHUF8KqD9RwHhXB1hJc7AyYlK4EqWdzlKfZPbydYzmkdmig9n4BYbALQBiHED5igcLk= X-MS-Office365-Filtering-Correlation-Id: b0312b77-9c34-4585-05a9-08d40d654f3c X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY4PR12MB1144; X-Microsoft-Exchange-Diagnostics: 1;CY4PR12MB1144;25:7ZA7X6ztXlzBc3QUciNHB5+XyF2DWPh+53HHavy2tmCgqAlgQWnQovdr/W4/a6f3iVTjCWvYjX1QFZh7RFeAyrMWgo+PC1/swPxh68A/b5+Tkg+vdx6WV0E285qxI/nOqwvTSAbOcwd5KigMYO+5bdclFI6xdLSQZGTQtnl8u7Q2MHCOZgF6RdbTetbRz06ObnhK6iyGhONnII5pTJD0i80dS6Q8b/2KkzOovRFwQrzTc5U5Yq14cxCmx42jf6uX73DV9QVvgW5UIZRl45z8T07hZv4qEPoSdoXP81SgrrCnS079+8AeJjyy4iWzRmQR+S7cGhCTbvS5JKB5UmUcnTRBtL92xBKPBayuveXlVyFknjhZs9hSRVDkmk9orGZSSSVgrfG5Sxvl2CLTb7bsGFWnXVJkTryWuSrYl5T51ivwtP21AtElgS0OTbM5KmsM6r5r9WViXHeHq+kNz4KG/j2OnN6tr4KTcIGemsBhtTqGccfH3VWKQmHvbvAT6jw4ljmpcC7CqPB7XOTRzuegr1O1Zy0IDW1v/2yxM9GOZGOGPX54S+2PJCBX3I9s8H3Gny4OcppcQ4poQkiQ8S5Ss0hVFNCddGOBXDBdO4SS8GuqJ0GNL0zX5Y24NJewkRtBKkbm7vkdamfeze5ogMlf6c9bDST6UwZ4dj0cc3b9vGDmV2PyJdmT2AXIN9IX0Fb2rTVBNxOF6ZtKuFWc/Yty1QFxmNlXrsIHB5+UNbdSyXoYfD1duiU0IzzkONiDQWiQ X-Microsoft-Exchange-Diagnostics: 1;CY4PR12MB1144;31:U/lebWIzpH9WSZGDAhvjtX+IhN1OSbHacWV/9aWlc140jDQlzuZU+o+UzMGAXV+KsBvWtkohxqHx21ZHnYysgqeGlI/N1D17H985MupG/vy85HMunRU7/DjAuhBj7xgJATds0kvLbMasPElM4MLgAmRvTnEtXAv4d06VYEWGI0JAp7HLCpvRaYcFeqSTxcDRiTVB38u+GSdjQHR8cCNJ1q9vOyktvUOUHAG9gfwqPaIp56HHJXpe/iAv2cpfEETP/YcC7KZut3EBPQF4wGCiBg==;20:6DIAx1341PznHszVHiNYnQ0WC5msucbmqJu12AalhNIyoF1KlASuEn/ClCxDspVWBb9q4XDwtCGXu+axG+TlT6sVO+9K4WCu0jjRkeor1gth2yDycHEn2LBh1gxEy5s6QBscQfLuEqq0gJciDobgqj1bDkGWP7i4E//aYMbaCvwUo7QO5OT44IBwsMVw/7wGNZpnU+kfW2OBdjMjIU6gFw3JlGoDAcwjn9gFBNCRAhyNR8UieDbFDsAz1kIBMER9X6D5Gcmcfblhb4vUTgL/WTlHEA8TssQkAjkTH8adnExajcqynXrOFxmWSkF6iTUTkYAP6y2Cu7/1hLlFrpFDofj5HV1bClOQLUq55H5S6Kx6j1cbgGDdu7MwWART74TMqOPYTCxioK+bzkHn+kiLjhMxsr72v64XO0OkkLYXL5do7K/IYBs3gu2GNcWtFVmAmOv0+ON5uz7hPuooTBFs9/p/boJkOOOKbh0eYyC7Ag3boYDREN/haKcYWAxtuNlG X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6060326)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026)(6061324);SRVR:CY4PR12MB1144;BCL:0;PCL:0;RULEID:;SRVR:CY4PR12MB1144; X-Microsoft-Exchange-Diagnostics: 1;CY4PR12MB1144;4:PvqNyvCEygnaqf1YzJgjek5utSC+SYSrLKpk7+yI94iBEGNXNcar3hzQbw6Nl6gwxxWsLKTCZZ2hFWNdabBf3vPn4/r9Jl4MKdMY493DESUfynCzRBlK/i+iXCDoebVx0RZC9rXHxQqmqCC+BIiy7NAtnuPHNpPVXsjBNc+yz0PiZI5nRWFSVMmOLFseR73Kkbcc3Rgu1YZi8dBwS5u9QnhJz6I1+MM1cR/VcUDwCCBT9CktQbnLFysRLopY8sXBuvVRPvvtw28SdiRKtIgzmLGex/YF8xErdq0pPvGTHuxGtXdnxtgqA6RMcwFfk83CaGzV9voVfsdR50dD4zjtNYF85KjD3O9PuI/ZEG8EbuxpTvy5H5o/C27luva2k0gyHsiDme/GUKlATp6MybzThnyZw2Nx7dYMFKL7xRg2Kmx2xCFBdusnHOg9BLg04Ncl X-Forefront-PRVS: 012792EC17 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(6049001)(7916002)(24454002)(377454003)(189002)(199003)(65826007)(86362001)(66066001)(64126003)(305945005)(76176999)(230700001)(23676002)(7846002)(7736002)(54356999)(50986999)(3846002)(92566002)(7416002)(5660300001)(105586002)(2950100002)(6666003)(5001770100001)(42186005)(6116002)(101416001)(106356001)(77096005)(189998001)(4326007)(97736004)(93886004)(4001350100001)(50466002)(36756003)(8676002)(65806001)(33646002)(31686004)(2906002)(83506001)(31696002)(47776003)(81156014)(229853002)(68736007)(81166006)(65956001)(217873001);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR12MB1144;H:[10.236.64.222];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTRQUjEyTUIxMTQ0OzIzOnZJZ2VST2VIdkxOblduZDBmd2Q5MVhRWk04?= =?utf-8?B?dGVDOXRKTGRWVlJEb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pEO3TkREvwpwBWWStu8/FNGDR7mzwdKH4NMBXBbLCYheYaEMteMgcgmxDI6QD2IumA1A/8WrLlzV8pUgxQOPoZ54zUEVcx5veWW21PpCH92IKgXKQqNB3g3VIvYdZ2f2Is3Mo/qwMGSLhxs6q59GaYhqG4F7xGeZh721HkndMJ/mmZQREI7t/F3mVB16bS9b0P+a8zDyIHH3S6qjLgdilGLC/tNw0fr26uHLtYRupoN3Wk/5w X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Nov 2016 14:40:11.0871 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1144 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 972 Lines: 24 On 11/15/2016 6:14 AM, Borislav Petkov wrote: > On Tue, Nov 15, 2016 at 01:10:35PM +0100, Joerg Roedel wrote: >> Maybe add a comment here why you can't use cpu_has (yet). > > So that could be alleviated by moving this function *after* > init_scattered_cpuid_features(). Then you can simply do *cpu_has(). Yes, I can move it after init_scattered_cpuid_features() and then use the cpu_has() function. I'll make sure to include a comment that the function needs to be called after init_scattered_cpuid_features(). > > Also, I'm not sure why we're checking CPUID for the SME feature when we > have sme_get_me_mask() et al which have been setup much earlier... > The feature may be present and enabled even if it is not currently active. In other words, the SYS_CFG MSR bit could be set but we aren't actually using encryption (sme_me_mask is 0). As long as the SYS_CFG MSR bit is set we need to take into account the physical reduction in address space. Thanks, Tom