From patchwork Mon Aug 22 22:38:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Lendacky X-Patchwork-Id: 9294609 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 77B51607FF for ; Mon, 22 Aug 2016 23:15:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6601F28AEC for ; Mon, 22 Aug 2016 23:15:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5819728AEF; Mon, 22 Aug 2016 23:15:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB9DE28AD7 for ; Mon, 22 Aug 2016 23:15:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932959AbcHVXNp (ORCPT ); Mon, 22 Aug 2016 19:13:45 -0400 Received: from mail-dm3nam03on0089.outbound.protection.outlook.com ([104.47.41.89]:61046 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756096AbcHVXNG (ORCPT ); Mon, 22 Aug 2016 19:13:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=xWCme4Xbi+ojJDlgMLRhyyqrR4azJdJDjFETp6WEWfc=; b=WePcyslFTraj+AYeHbJOg486iqdSTWjz4spYBCtLo+lpSqxSu36R469cwjn7i5CpXdC+lnHubo6PQx0HvhvyWO3bruMDe139C/arnJgsnn1lmJ6cTGb+jsOTEQ7hjqYaIZBFfjQs7M0YmaxkAb4+nWbZO8QoMWvNmaD5fh9ve6E= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Thomas.Lendacky@amd.com; Received: from tlendack-t1.amdoffice.net (165.204.77.1) by BN6PR12MB1138.namprd12.prod.outlook.com (10.168.226.140) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.557.21; Mon, 22 Aug 2016 22:38:42 +0000 From: Tom Lendacky Subject: [RFC PATCH v2 17/20] x86: Do not specify encrypted memory for VGA mapping To: , , , , , , , , CC: Radim =?utf-8?b?S3LEjW3DocWZ?= , Arnd Bergmann , Jonathan Corbet , Matt Fleming , Joerg Roedel , "Konrad Rzeszutek Wilk" , Andrey Ryabinin , Ingo Molnar , Borislav Petkov , "Andy Lutomirski" , "H. Peter Anvin" , "Paolo Bonzini" , Alexander Potapenko , Thomas Gleixner , Dmitry Vyukov Date: Mon, 22 Aug 2016 17:38:39 -0500 Message-ID: <20160822223839.29880.85800.stgit@tlendack-t1.amdoffice.net> In-Reply-To: <20160822223529.29880.50884.stgit@tlendack-t1.amdoffice.net> References: <20160822223529.29880.50884.stgit@tlendack-t1.amdoffice.net> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: SN1PR12CA0036.namprd12.prod.outlook.com (10.162.96.174) To BN6PR12MB1138.namprd12.prod.outlook.com (10.168.226.140) X-MS-Office365-Filtering-Correlation-Id: bc575d77-b048-4ce9-6ddb-08d3cadd1255 X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1138; 2:h2HIJJMrtQxnnWrE1lA8J0areIklOYdjCtPPHGNvYUa+9h0yu1Gn48v2F69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FmGhObzhs0v6TFGY6/GDq0Ts2Qye6wA25AAyh5V3lhtbXLBfnkjcX+Ng+BtMgtbh3lxmD63ACb73MlELFgMB8AB9Io+7W8rwTjfbjpOh+zYYm+jABlE/V7BX/uvszc5W3aLFyuL1GESgJ7M1pxrEerrphDD6rKpkkfS48loJowENUbvUDdtnGfhVFN6jg90oo2lBlVTCJb5uBhV29mCo0AjIEnTdFJdNSnfB/eTpszlqFnytzT8yA/IXQhsmdWOQ/OLbNTXC8XjXY8Jdf62c7CCZ58G54qg+7Tjc675vGnS7P/DVpWFhxIofk7JHazirnaS4BOiBQS6kY4YY7p9sO+vqTN9Wnj+KcPQlRs5WxDdEy1vWoyvOWpWBIgx+W2vHN7+vNyf1Pz3SvtqF9PV/AcJpTUK+1CjgjhnxYpopJvIBLsXZPqvpoXxh1m1Ldt0aODmHJ018S02cjWyOPi+Sf9FK3 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:BN6PR12MB1138; BCL:0; PCL:0; RULEID:; SRVR:BN6PR12MB1138; X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1138; 4:0dQZnZdzMubEudRaE1RvgKLPVlSRE5DlGSRuKaODmK1exbzCqNQ/rguONFRPAkL5/XRpgCyKN3WAfWbOQUXgaIhKc8opCEQ1wvMtl5nMZluscmhZ7gJS+TFlDDksvFYAK157Uaf1WMVRsl7N5MVLui2u7p3NSYk5CkowKg+kPeM/3W6BFiBUG9JH7Gvu0nN/EXjtOTfIkx8o64Nwb24Q7NxUeqvzH97yFufpMMq/NeLzlHgr7/Bo+mKzG0cKXCVwNcUcBjTvRtzTUcXPAftcefhVtWWeRgjRIsHcVgjs/4BHGukKKIg68jhRgCNa1/83FkiwDH5UiqJ2gEtcBYIVhfeRkMYpFJI9d+bTsYEDgWwUi6DpL0HMh6T+ExiZUXscbk0vUwTo9wsHeU29zsYUdoBVMOj4/QgclA0/WsMRZTgd16VuN6HDPXoEtVMiL7wh X-Forefront-PRVS: 00429279BA X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(199003)(189002)(47776003)(9686002)(68736007)(7846002)(86362001)(19580395003)(7736002)(66066001)(230700001)(6116002)(42186005)(189998001)(103116003)(4326007)(69596002)(2906002)(19580405001)(1076002)(50466002)(305945005)(33646002)(83506001)(5660300001)(229853001)(105586002)(7416002)(54356999)(76176999)(50986999)(97746001)(2201001)(92566002)(8676002)(23676002)(77096005)(81156014)(586003)(3846002)(5001770100001)(4001350100001)(101416001)(53416004)(106356001)(2950100001)(81166006)(97736004)(71626007)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR12MB1138; H:tlendack-t1.amdoffice.net; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCTjZQUjEyTUIxMTM4OzIzOkFGYllWS3pldDczR25ETi9wVnRrQjBPWHYv?= =?utf-8?B?QTB4NlpIVzA1Ym9kWFRUZm1NT1dzV0o5MzlORzdOSGsyN3h4QjgvLy9jTU4w?= =?utf-8?B?NllkRURmNXZYVm1aVUoxRFIvVWs1TjBOK3haQzZabUpNZ0tIeGFiRzRUb2lm?= =?utf-8?B?V3ZZVXNRNXR0Y0xIV0I0UWhRSnRqN3ExeklkaUJRdmFXY2h6T0UrdE1wTjBk?= =?utf-8?B?MXcyM0M3bU5DczFyZzkzYmI1aGtGUUx0M2FHdEpaTzZxa1pWbmU0V2JPM2FL?= =?utf-8?B?QTVVa3hNNWc3ajVjTUxqRzBWRDFDUkVUS2ZkRWdZVzFqSElGZWZEcTlRdkgw?= =?utf-8?B?S3owWXlxQXhKSGxBTWtIb2VWLzF2V1NUdGl4L1VkYi9reUtPaVdE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+lqkkVbCw9r1q1KRk4ogZmN9RXSVIRBS3Egw3+phxXUONbcJi3MM0b/iarWqMaIIQ==; 24:KEQpV3h1xEiG76f5t1Hsm/IafbmOlNqUnn3lBit5Hyj643Zn5J4yrojDMXVYVZ37NevMO2aF8g3orYy7yaZuV59uGFcOdEDiofurW3WVipo=; 7:s0uNRHPwi0jpL2chum51xnduA+KdbXJBza2Ub2osPO+fA5cTLZNalByR/IdEBL/iz2MR7icBV2mJdiE6JajTE/4Q2YTyGFjuC0BuRqfMn3D5nDaBqUg2pMJdQ3YKNV2S9FJ4Zpqdi7agmnFTHS6OqYzn9bprRjWShylhmB1O7WPPBbmS1xXDtYZcEX3rHmupZlEmtsP/YN9eX7zZl1PkaXuxtrnsbSKZj4Jaj5DsOLJWf1XID6MxTU9s/iUf1awo SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1138; 20:MhZX4iOTE65oJiwHSJ6qBtOWc5pCIU5KdewPYqW8eYWD7CoIKJOBa+7ybdcZ3zjthYPwcnf9vWHlEK3rFkWtH6F6mTq1V62S3UVd/LCJK7Xt0OKRp8vr16/0zWa0FRUpjP6TUaUNEH/NEnYqwFxMh34lfRkvJwkYOUSwmhhNf7CbRg/Oj3+nw07hhZkdexbML/j1B8NLl9IQf+Wt8Wqmll4M/GmNHOB12abq5qQ6u00YDXrG1wDcD8oTA7uJoiKE X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2016 22:38:42.1663 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1138 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since the VGA memory needs to be accessed unencrypted be sure that the memory encryption mask is not set for the VGA range being mapped. Signed-off-by: Tom Lendacky --- arch/x86/include/asm/vga.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/x86/include/asm/vga.h b/arch/x86/include/asm/vga.h index c4b9dc2..55fe164 100644 --- a/arch/x86/include/asm/vga.h +++ b/arch/x86/include/asm/vga.h @@ -7,12 +7,25 @@ #ifndef _ASM_X86_VGA_H #define _ASM_X86_VGA_H +#include + /* * On the PC, we can just recalculate addresses and then * access the videoram directly without any black magic. + * To support memory encryption however, we need to access + * the videoram as un-encrypted memory. */ +#ifdef CONFIG_AMD_MEM_ENCRYPT +#define VGA_MAP_MEM(x, s) \ +({ \ + unsigned long start = (unsigned long)phys_to_virt(x); \ + sme_set_mem_dec((void *)start, s); \ + start; \ +}) +#else #define VGA_MAP_MEM(x, s) (unsigned long)phys_to_virt(x) +#endif #define vga_readb(x) (*(x)) #define vga_writeb(x, y) (*(y) = (x))