Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932414AbcKJAvu (ORCPT ); Wed, 9 Nov 2016 19:51:50 -0500 Received: from mail-cys01nam02on0073.outbound.protection.outlook.com ([104.47.37.73]:25039 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932295AbcKJAvl (ORCPT ); Wed, 9 Nov 2016 19:51:41 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Thomas.Lendacky@amd.com; From: Tom Lendacky Subject: [RFC PATCH v3 14/20] iommu/amd: Disable AMD IOMMU if memory encryption is active To: , , , , , , , , CC: Rik van Riel , Radim =?utf-8?b?S3LEjW3DocWZ?= , Arnd Bergmann , Jonathan Corbet , Matt Fleming , Joerg Roedel , Konrad Rzeszutek Wilk , "Paolo Bonzini" , Larry Woodman , "Ingo Molnar" , Borislav Petkov , Andy Lutomirski , "H. Peter Anvin" , Andrey Ryabinin , Alexander Potapenko , "Thomas Gleixner" , Dmitry Vyukov Date: Wed, 9 Nov 2016 18:37:32 -0600 Message-ID: <20161110003731.3280.67205.stgit@tlendack-t1.amdoffice.net> In-Reply-To: <20161110003426.3280.2999.stgit@tlendack-t1.amdoffice.net> References: <20161110003426.3280.2999.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: DM5PR20CA0023.namprd20.prod.outlook.com (10.173.136.161) To CY4PR12MB1141.namprd12.prod.outlook.com (10.168.163.149) X-MS-Office365-Filtering-Correlation-Id: a20a778b-bae4-4add-ba09-08d40901c3f5 X-Microsoft-Exchange-Diagnostics: 1;CY4PR12MB1141;2:4vqfwW/GpyfYkzTqBCbZgGtn48hbrtrE7jGzzlITBmjoSZsATmWZa5xHfNsTTDQ2MHW1pFdQNyZ8hfIFQSBsPEiy/SkhT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Kt6wwRZsASSmLsxC7FUpqdDxEQ7cJmctVrAyPR1uN6YY= X-Microsoft-Exchange-Diagnostics: 1;CY4PR12MB1141;31:epvVMk5phT6cs/SXxToMgWdsPJKS1UNCDBjd2bTpQGseVdElLKFbZPvO2JrAHewvxJVsWqvi012NSANE9Z3Jqx5io9oWqm4MaJjrjxAlQCsLQF9G64sBueRxjsiark4dm++qCxCA+Um0bD+rUbbendjJp2HMvarbZdFFAQ2qOQO1ulcmZ7MjT1bKfMJ+AvrlbvMwn0BXa39bjcWa1TwdEXpkUudIaJBltNLN2XscxUa6vF8mr+rHuKeFEQDruNitetEWwm0yONKGmxZLbWLILw==;20:dupioPKs5z+RyRQ0/0rH9REG0RSWHRXxtG6Rhp4GGmnl2t7HjUCOMLZ06S6C5BxvzRTrWUCTGKIlljer3oDNtofDv6X7nToWnrEZ+K2K89R+IGNSR8etwHRV8LJJ3gg0ZCFx9auvzcdfpmUPrKCjTyhowhlYdy1TKLOitUoGg12EjdQKpRLJdh71LFTO4hA7W/7pI0+PfU1pdLgei9iUZ12T4+/OqQp5fBnBu4O6hs4NutWnMK3Fkp7DWcMWWS5iA1mtatXTWqjJ17kYauyYQb5v4jjtHex8/Rjx65jTf/LHZjIjoKTnqHSxd7pOWYY2iI1B5yBzbSZBG5Kj4s8NQT1uh52lfp8YauCD2ELfA/8DLRrFK/dEBJskWntIC8h7KuWVTRFe8mAigiT+YhqQfMek/7ge+kw0Exhdezz27eDHAFCnfxvhQEnAgqH9pn3FajNkpweSOhN/i7sctqo5ketW+bSiYdYfSM8jke/Rvi9DBHzgYth//eJGb/omfTZh 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)(3002001)(10201501046)(6055026);SRVR:CY4PR12MB1141;BCL:0;PCL:0;RULEID:;SRVR:CY4PR12MB1141; X-Microsoft-Exchange-Diagnostics: 1;CY4PR12MB1141;4:OWiUQULnZ6Qyd6gYJz/2OJsVps2BWy9Z3TMAz7UJKE1R0ROWz7bawpBJV3tthi0wDRT+A9Sr9U4zK4wIln0p7HqN5uMnrjeXNxH5pbuTf7C5ej5DNz1mHRy1I96LhvbFZp6VPPlr5SHLfokQlEsWdQRtsMn0mVzhLpuSWFytdS8STabUPtqpz1qa641LQEBVBJSjaa9wwtSfEHp1UuMMR4bRhnI643DvcrGmJlg1b45CDi/Up/6tvmPZB9uyQwFQ87TDwsyRSDVd7m/SiO4j6jaI2pQeSbwVqQ+UN7RofQzQ+bC6gZPp3TNmiqZ8U164+JwFRiF5FGbatvNsvEe91gcLjDZB2wGgktm5ms4ONkRLIDhYv+j215O9J+iUF4lNJvWmN4j3ixIOQc5HrCHkAYPYkAEJTqwvSPTIIf8y9Sz92TvuxDeCrvwUzKAbrSlKlqwEQXXp9ay+6SqevIulzA== X-Forefront-PRVS: 01221E3973 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(7916002)(199003)(189002)(103116003)(92566002)(47776003)(23676002)(8676002)(7736002)(69596002)(50466002)(189998001)(81166006)(66066001)(9686002)(305945005)(5660300001)(77096005)(7846002)(101416001)(86362001)(2201001)(2950100002)(5001770100001)(50986999)(4001350100001)(76176999)(54356999)(97736004)(1076002)(81156014)(53416004)(105586002)(42186005)(4326007)(83506001)(7416002)(97746001)(6116002)(230700001)(3846002)(586003)(68736007)(106356001)(33646002)(2906002)(71626007)(217873001);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR12MB1141;H:tlendack-t1.amdoffice.net;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTRQUjEyTUIxMTQxOzIzOkRvU08zUjZGbzRTOWNOT25pWXlRSkZib0lq?= =?utf-8?B?ZTBYUTJNcCtmYzJrcFJVZzl2dVhrZExNRVZZdFExSWZmMDMzMGF1VXFBbFo0?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NsGpGfG8xY4lOyzUVBqoy53qebbiKV X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Nov 2016 00:37:34.2631 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1141 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 941 Lines: 31 For now, disable the AMD IOMMU if memory encryption is active. A future patch will re-enable the function with full memory encryption support. Signed-off-by: Tom Lendacky --- drivers/iommu/amd_iommu_init.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index 59741ea..136a24e 100644 --- a/drivers/iommu/amd_iommu_init.c +++ b/drivers/iommu/amd_iommu_init.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -2388,6 +2389,10 @@ int __init amd_iommu_detect(void) if (amd_iommu_disabled) return -ENODEV; + /* For now, disable the IOMMU if SME is active */ + if (sme_me_mask) + return -ENODEV; + ret = iommu_go_to_state(IOMMU_IVRS_DETECTED); if (ret) return ret;