Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753407AbcDZXMx (ORCPT ); Tue, 26 Apr 2016 19:12:53 -0400 Received: from mail-bn1bon0068.outbound.protection.outlook.com ([157.56.111.68]:58891 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752273AbcDZXMu (ORCPT ); Tue, 26 Apr 2016 19:12:50 -0400 Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=amd.com; From: Tom Lendacky Subject: [RFC PATCH v1 05/18] x86: Handle reduction in physical address size with SME To: , , , , , , , , CC: Radim =?utf-8?b?S3LEjW3DocWZ?= , Arnd Bergmann , Jonathan Corbet , Matt Fleming , Joerg Roedel , "Konrad Rzeszutek Wilk" , Paolo Bonzini , "Ingo Molnar" , Borislav Petkov , "H. Peter Anvin" , Andrey Ryabinin , "Alexander Potapenko" , Thomas Gleixner , "Dmitry Vyukov" Date: Tue, 26 Apr 2016 17:56:47 -0500 Message-ID: <20160426225647.13567.16101.stgit@tlendack-t1.amdoffice.net> In-Reply-To: <20160426225553.13567.19459.stgit@tlendack-t1.amdoffice.net> References: <20160426225553.13567.19459.stgit@tlendack-t1.amdoffice.net> 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: BY1PR20CA0006.namprd20.prod.outlook.com (10.162.140.16) To BY2PR1201MB1110.namprd12.prod.outlook.com (10.164.168.18) X-MS-Office365-Filtering-Correlation-Id: 9b090d35-2308-4ee2-8d41-08d36e260e85 X-Microsoft-Exchange-Diagnostics: 1;BY2PR1201MB1110;2:8JqPhWs46FrNbD30xxUHm6IPS2uLL6Lun/vEBL77u4D+DnUp+3UKXczZStTdC7Q74pjxlfd/imGYc1gPUYQhdqtW/uZtNaCkwVMR67MAm6J7l2esE4PCo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WlS4Z3U8dnicl7CV9OH38ML8w9CTt/OUO4pXL2MAb5noOXz3oUzu4BLJURAzuK3zyww8KHrCLPTu;4:boKSmM2DRCUnZxD96seJcEQIidox+6xPcWuc+Booxr64ezakUJVM7Bl+a8wd+p0X/UH1ZIRmSv7SB4lokfy/0AOx6NJLL6I/Km2qE6TMyhdp9FX0ex/FkutpkFQ2vpsAjJcum3duO2AkyDEpGqmKS36iuG3SPzSE3UFpkg2Xy8YRhA2L8S+ZXnAV+KpfCravhUP9MwZwyZCN5jDNtOF1ITXh6sEburFyfHUpCE/e3ivea5S41flDuMBPuWucOWBuV8pwCnuyXODjyi0rF8GvmdiM44g9NXZIaqHShooncuOXHROqXfKCgVXMzfxQE9vRqDoxIfq3YtuKSKNliiY6uk6F4V7y0GXYJADCONDWR9jB9hhNEyCwpwj3Rp2DEDG0e/MIMMAX9R1sOQ9vxyLEyj3Vg+GDkG3OgeIUOj9VENo= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(9101521072)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6055026);SRVR:BY2PR1201MB1110;BCL:0;PCL:0;RULEID:;SRVR:BY2PR1201MB1110; X-Forefront-PRVS: 0924C6A0D5 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(2906002)(5008740100001)(50466002)(42186005)(1076002)(586003)(1096002)(4001350100001)(5004730100002)(9686002)(6116002)(189998001)(5001770100001)(81166005)(4326007)(23676002)(54356999)(76176999)(50986999)(103116003)(33646002)(77096005)(2950100001)(92566002)(230700001)(19580405001)(47776003)(66066001)(229853001)(53416004)(86362001)(97746001)(2201001)(19580395003)(71626007)(217873001);DIR:OUT;SFP:1101;SCL:1;SRVR:BY2PR1201MB1110;H:tlendack-t1.amdoffice.net;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTt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rHeCpRrRcFYhOqDpfRu4MRH4q7ist8AMg9j7II+tB355YSovyfySo2USdSmU=;20:ehNz99Ly38Vkx+W9GFqvycz53qmD7HnTs5upZL1gPI+WQFZysN3erXliE6lzC+rctPhuASeAE7ju8VbyWamDiTcUWPk2wpSYlZTIChMxRBxA3+NtwVyHFpE4LIEmW+v0urZj+IL20RKsR69DVyhAvJJRHkSCNO+IrTaYZ5XwkC3eunFf5r+4HRlwg4aHFd05BdJSk+mc4n1Xu+xR0XbL1XVEinxrTpJtcFFxBLMhS+Lb+7J36M6g8CVPHx/FVqqH X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Apr 2016 22:56:50.7848 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR1201MB1110 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 893 Lines: 29 When System Memory Encryption (SME) is enabled, the physical address space is reduced. Adjust the x86_phys_bits value to reflect this reduction. Signed-off-by: Tom Lendacky --- arch/x86/kernel/cpu/common.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 6bfa36d..b49e7fc 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -43,6 +43,7 @@ #include #include #include +#include #ifdef CONFIG_X86_LOCAL_APIC #include @@ -722,6 +723,7 @@ void get_cpu_cap(struct cpuinfo_x86 *c) c->x86_virt_bits = (eax >> 8) & 0xff; c->x86_phys_bits = eax & 0xff; + c->x86_phys_bits -= sme_get_me_loss(); c->x86_capability[CPUID_8000_0008_EBX] = ebx; } #ifdef CONFIG_X86_32