From patchwork Mon Aug 22 23:26:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 9294769 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 EEC46607FF for ; Mon, 22 Aug 2016 23:58:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE0F9288C3 for ; Mon, 22 Aug 2016 23:58:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D084F28A5B; Mon, 22 Aug 2016 23:58:30 +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 5F119288C3 for ; Mon, 22 Aug 2016 23:58:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757155AbcHVX6K (ORCPT ); Mon, 22 Aug 2016 19:58:10 -0400 Received: from mail-co1nam03on0046.outbound.protection.outlook.com ([104.47.40.46]:16725 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755825AbcHVX6C (ORCPT ); Mon, 22 Aug 2016 19:58:02 -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=+QMwNerF5QnEo+FonC7vVbH3hdAO1XRei4RHIgmj2zo=; b=BFftLA3HgLaS2bsikFhKIHbK79LUT69SxJfgybdaMfYOacIuNL2+10TBGjvMatmiznPp+zkGH0g/xiHyotVAAmRwjKSLAm7dxOISe7mOBy8HuceZ8UCaEg1iL0aZQCDAueXLQoFtmc3yWdcUl0ATkjpI3+lvJBY7Uq9d1V30OSM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from [127.0.1.1] (165.204.77.1) by BLUPR12MB0659.namprd12.prod.outlook.com (10.163.217.29) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.587.9; Mon, 22 Aug 2016 23:26:18 +0000 Subject: [RFC PATCH v1 13/28] iommu/amd: AMD IOMMU support for SEV From: Brijesh Singh To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Mon, 22 Aug 2016 19:26:13 -0400 Message-ID: <147190837333.9523.16962214308407411754.stgit@brijesh-build-machine> In-Reply-To: <147190820782.9523.4967724730957229273.stgit@brijesh-build-machine> References: <147190820782.9523.4967724730957229273.stgit@brijesh-build-machine> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: YQXPR01CA0055.CANPRD01.PROD.OUTLOOK.COM (10.165.103.23) To BLUPR12MB0659.namprd12.prod.outlook.com (10.163.217.29) X-MS-Office365-Filtering-Correlation-Id: fa4e86ef-d05d-43c9-c8ad-08d3cae3ba95 X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0659; 2:6oJEXIFHV8p4T6BnGr/hWfsZ0ZkyRSJRNFJgM8IbIAFR9/x5Q0oYOwsvCg8xcrG9qCX4BHlYmDmRntt4cdHtLDmpXMOjQagi6TL7TEn220gf0+DoqFLVAC+HuriHhQtoU2hN+wqaKU1hR6EWV1jE/ZM5WYYOx7WfEJq22UGZPbGFmlfplcaKr4cEAjEs108V; 3:sHv0lPAGp0IgIARPu0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z3zktZAwrQMj3olR00lKp0GDGD7t4caYhauxsIGTOc7EOTklFSdeSzcxT23lewkxxr+nGaPiwSJMzyBvm3nr5lOOrYpy8u6PYtvGBj3xZN2Z7ksTfr+6gtFjRk6sxe+6T9z3pCFsXlshT8wEzKFIaQfUy0sXfglYMCx+e12EhNfbHhNUZhOScm8ZN4L2SNy/fMSf2yHgl4GNmKG2ihoZ4pKOpeRvpQJA6k7P0iqhUwSJtPpWacFaZ6B4YBDZDBPpdvn7yDNlJZuSQVjl0KF9Hl0zS3HeOnoZVo5rF4MlAVSjblyn/5QTM3UCgzwP6UXcl 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)(5005006)(8121501046)(10201501046)(3002001)(6055026); SRVR:BLUPR12MB0659; BCL:0; PCL:0; RULEID:; SRVR:BLUPR12MB0659; X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0659; 4:5GAHsk+juzxovKOTnUKu6i0QAF4DKsd0XgQjtQJXvTiN9vtdIx05MrhHd6mXV0+/0uQPUhQGEzWTgoj95sGkWLIeiFXYWAYTzNRqov8O6yIbfxaOQgOr5bhm7Pl3ZaXQCj/qqFxH2cqaLYqLP22r8UW8kduGWLGPW2XwrGX0D8LoMQ+6XBB7XWSjoz0uQqmT5uN749a1VvDe/gjtE/GbE7dQ5CFAh5MTViovcbje/ywNvpI2WJFoP82w5xKD7tnZmzoL2+EsRnuLvlr/gv7XqBp14AW6F7T4InhDsQy2ltUY3D236uV1ZuGq7AeM3mSgLECjJfNWNaaSq9/j0Lumq03UvliL4UyYrU6gKxHDeJj6D7Sax86wAutg69ltjfTnkkSPxUltA90U7TOhiv2FvwdGL1Qp5o6Ol/bffi/3ilDKZtClgq34MTrHpNxUOWZX X-Forefront-PRVS: 00429279BA X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6049001)(6009001)(7916002)(189002)(199003)(50986999)(54356999)(19580395003)(66066001)(47776003)(86362001)(2906002)(19580405001)(76176999)(23676002)(105586002)(5660300001)(103116003)(2201001)(50466002)(7846002)(68736007)(101416001)(77096005)(8676002)(2950100001)(81166006)(81156014)(7736002)(92566002)(107886002)(229853001)(33716001)(33646002)(7416002)(106356001)(305945005)(7406005)(189998001)(9686002)(586003)(5001770100001)(83506001)(3846002)(6116002)(230700001)(4001350100001)(97736004)(42186005)(921003)(217873001)(2101003)(1121003)(83996005); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR12MB0659; H:[127.0.1.1]; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCTFVQUjEyTUIwNjU5OzIzOm9JQUs3dVNmbzNPb3o5ZmRzMlEvRGdYSjlU?= =?utf-8?B?MXZINllGTmxuL2tET0QyQ1B0MlBWcWJVUitYMlgzR2xqM2Z4RmZ4OEVDMjls?= =?utf-8?B?WktaZTgwbU1YdHRVaWFVTG1IU1cyQjJmaFhzaHJ4dDB6LzdydTZjYU41WVMy?= =?utf-8?B?VWRObDZBaUlESlBPVHJ4eEwwZXRJUno0K3VkNHZGV2xnemxXMnpTbjhSODhK?= =?utf-8?B?M1VQa0FNT0pPUG9kdkxOK2dHc2ZOdWZ5RVFSVmM2YkFIWGM5SC92R3FJMzdD?= =?utf-8?B?emg1UXhjbm5ScW5MbVg5MktIWTkxd2lGWlEvSVBieVhFeHpvckVKNCtBUG5y?= =?utf-8?B?MmNlbUt0MFNrVlRJckE2QlczNHVqWTB0Qm5BQ0RROFpYNSs3QUtXSS9hZlZH?= =?utf-8?B?WkhUQnNiL0JVTEVvZ2p0alJvb2szMGpXZ3lOQk9SWFF6eitPNzJtbjJVRWVt?= =?utf-8?B?N3gxT0x3dXJaOGJqQWRSdkdxQjFNVklKK0Y4RWRLcDNzWVgyWnRGZ21H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LS/bRbZfzn+uaxkm9Y+6eqb2SztiP/iv74IO3UuLob61dRtEtr55otuuFJv7yM=; 7:eaV/u9BffrS36jFwlf3kctc3c4AHMjy11rbl8zsMHvJ/r6qo1gRlEa9ARfo+s4ViTGg+GOKydCUGENi7Tz+t1JN4jXN3ia2mjqaOBW+D/PQfLR3tgvlNPytvA8kB3TztWJot7C4Aw5oWn+F1sfh4AbTiMVTzK4u8SjZQGv8XQpxBOzjFg7fmVjqT2HVpgWmD1BU99M7XH40KxxJyIDpzlge4/gjGBNwu/YzCW9idDSfciQEZXtrkaYy3frbSY0dW SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0659; 20:I//8rDgZPeKyYCVOwRClXSj/uZkIhFMEElJ7OAhoyq20Ze9kuuFLJvHHDQ/zToUB3MX+4Mzfq/T/xTXlVOOhNZovZ8NNKjQ830QovpPELA3qwBt8xBsTtBB2cHgxnLWqfmANr0p4CA/+Fydair/qzmWd4K+u7Nr7ETpHJ1HLYySjQBre57I9u4MThFk29L4QtGS0qbI/r1A1cxL6oB8Dz7+WKfz6ze9mdXrjtnSSJ7hyvlsYWsI/G35bIfMrtK7k X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2016 23:26:18.5009 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR12MB0659 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Tom Lendacky DMA must be performed to memory that is not mapped encrypted when running with SEV active. So if SEV is active, do not return the encryption mask to the IOMMU. Signed-off-by: Tom Lendacky --- arch/x86/mm/mem_encrypt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 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/mm/mem_encrypt.c b/arch/x86/mm/mem_encrypt.c index ce6e3ea..d6e9f96 100644 --- a/arch/x86/mm/mem_encrypt.c +++ b/arch/x86/mm/mem_encrypt.c @@ -237,7 +237,7 @@ void __init mem_encrypt_init(void) unsigned long amd_iommu_get_me_mask(void) { - return sme_me_mask; + return sev_active ? 0 : sme_me_mask; } unsigned long swiotlb_get_me_mask(void)