Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753717AbcDZW6S (ORCPT ); Tue, 26 Apr 2016 18:58:18 -0400 Received: from mail-bl2on0071.outbound.protection.outlook.com ([65.55.169.71]:12082 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753632AbcDZW6M (ORCPT ); Tue, 26 Apr 2016 18:58:12 -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 12/18] x86: Access device tree in the clear 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:58:00 -0500 Message-ID: <20160426225800.13567.99120.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: BLUPR0301CA0014.namprd03.prod.outlook.com (10.162.113.152) To CY1PR1201MB1113.namprd12.prod.outlook.com (10.169.19.17) X-MS-Office365-Filtering-Correlation-Id: 115e17b3-de2e-4446-3a54-08d36e263b1f X-Microsoft-Exchange-Diagnostics: 1;CY1PR1201MB1113;2:op1sCq/pDxG4wc3DYNaWYSOEG0Uv9wctBLHkktCSK67yGHTZZ7tipjV4VaLmuTNAiHHzy+ldI1SVHEjJxPRGySkkxmfKkLduVEYeWUCRoqXlawpWllfdODoKX/9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7WXKr4iS5rZLfnD5TqohWfUnq58QgunkaAvyeMHlkayS5pX+2CnDNCs/OwU9rNoNxda7Eqi/VFySK3PhUS5rpMZUL;4:bij1Hv59sOE4P/QXv/499b/F8BLsoiEv6X9Tl2vWb21ZpKq7rV9jUDOwzYc7LgsYJuJbiSqgvzKsduWgiRgeqk/yvwo85uWHf1bykhLy20c30zTyDWhDaX0b6CXADzFvQMcci+nRukncE3JJ0Cqq5vds3jEHh2Wx6UMrElcsx+pKW5n+2i1ZRa2cOvWSVqtrtVID/XCn0UAAaT06oDwr2RzgodV82BdwOO7Kjxpn1CLeHXoD3oiqVs54vz36JpYCUV4f/fgRapWymWlfbarPV+WZhRFyci9OWry0AT81F83KRL/Y31ngb+7klTSmx2/TIN2TWVTQ5mwkSOcfj+PRY4o0aq2dWMML6CGvVlxoGibIdFlgAwiR1f4Ip/MPfXMW8yF5q1XiAHkJgMf7dunIRZ4+3qtN1BQNq4afJyg1V18= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(9101521072)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026);SRVR:CY1PR1201MB1113;BCL:0;PCL:0;RULEID:;SRVR:CY1PR1201MB1113; X-Forefront-PRVS: 0924C6A0D5 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(2201001)(1096002)(103116003)(50466002)(86362001)(5008740100001)(92566002)(230700001)(5004730100002)(23676002)(4326007)(97746001)(2950100001)(33646002)(2906002)(50986999)(19580395003)(76176999)(54356999)(47776003)(19580405001)(66066001)(189998001)(53416004)(5001770100001)(229853001)(81166005)(586003)(4001350100001)(77096005)(6116002)(1076002)(9686002)(42186005)(71626007)(217873001);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR1201MB1113;H:tlendack-t1.amdoffice.net;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =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9YDsYGCI1qHgmPDOInljNtMk4e2+mLiQCX7wDKfu9PJX1GjuaXvCpIV8H223tMu4=;20:zb/OsaLcfjaYtbzG8qZDaqIcxIk0bXumbqXBwljfCeHrFuPcvBojqC2wyl39uWWJUpjQdFTHIq0nB199cPCY+kneK2UXX3UF5BIhuACobyCUKQO8mubCCRTp+V/AykKsTX6x4Kwz1tIDe1aaEx3b07GFtN8ScDG/UrW2AsyvzDbDeyc+KK5rbInkNq5UZdrVpPtqtg58Us19sUfUC1z2lNKI7Ccf0DSrsdbZbxj+mt/FtGH7K0MRmTPK/H6pkHdX X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Apr 2016 22:58:04.5335 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR1201MB1113 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1187 Lines: 35 The device tree is not encrypted and needs to be accessed as such. Be sure to memmap it without the encryption mask set. Signed-off-by: Tom Lendacky --- arch/x86/kernel/devicetree.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/devicetree.c b/arch/x86/kernel/devicetree.c index 3fe45f8..ff11f7a 100644 --- a/arch/x86/kernel/devicetree.c +++ b/arch/x86/kernel/devicetree.c @@ -22,6 +22,7 @@ #include #include #include +#include __initdata u64 initial_dtb; char __initdata cmd_line[COMMAND_LINE_SIZE]; @@ -276,11 +277,12 @@ static void __init x86_flattree_get_config(void) map_len = max(PAGE_SIZE - (initial_dtb & ~PAGE_MASK), (u64)128); - initial_boot_params = dt = early_memremap(initial_dtb, map_len); + initial_boot_params = dt = sme_early_memremap(initial_dtb, map_len); size = of_get_flat_dt_size(); if (map_len < size) { early_memunmap(dt, map_len); - initial_boot_params = dt = early_memremap(initial_dtb, size); + initial_boot_params = dt = sme_early_memremap(initial_dtb, + size); map_len = size; }