Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752159AbdFNTtQ (ORCPT ); Wed, 14 Jun 2017 15:49:16 -0400 Received: from mail-dm3nam03on0088.outbound.protection.outlook.com ([104.47.41.88]:27979 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751670AbdFNTtL (ORCPT ); Wed, 14 Jun 2017 15:49:11 -0400 Authentication-Results: google.com; dkim=none (message not signed) header.d=none;google.com; dmarc=none action=none header.from=amd.com; Subject: Re: [PATCH v6 25/34] swiotlb: Add warnings for use of bounce buffers with SME To: Borislav Petkov Cc: linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, kvm@vger.kernel.org, linux-doc@vger.kernel.org, x86@kernel.org, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, linux-mm@kvack.org, iommu@lists.linux-foundation.org, Rik van Riel , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Toshimitsu Kani , Arnd Bergmann , Jonathan Corbet , Matt Fleming , "Michael S. Tsirkin" , Joerg Roedel , Konrad Rzeszutek Wilk , Paolo Bonzini , Larry Woodman , Brijesh Singh , Ingo Molnar , Andy Lutomirski , "H. Peter Anvin" , Andrey Ryabinin , Alexander Potapenko , Dave Young , Thomas Gleixner , Dmitry Vyukov References: <20170607191309.28645.15241.stgit@tlendack-t1.amdoffice.net> <20170607191732.28645.42876.stgit@tlendack-t1.amdoffice.net> <20170614165052.fyn5t4gkq5leczcc@pd.tnic> From: Tom Lendacky Message-ID: <33d1debc-c684-cba1-7d95-493678f086d0@amd.com> Date: Wed, 14 Jun 2017 14:49:02 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <20170614165052.fyn5t4gkq5leczcc@pd.tnic> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: DM5PR1101CA0010.namprd11.prod.outlook.com (10.174.246.20) To DM5PR12MB1146.namprd12.prod.outlook.com (10.168.236.141) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR12MB1146: X-MS-Office365-Filtering-Correlation-Id: d789dfc3-133e-43c3-4278-08d4b35e6b16 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(48565401081)(201703131423075)(201703031133081);SRVR:DM5PR12MB1146; X-Microsoft-Exchange-Diagnostics: 1;DM5PR12MB1146;3:6RCux2gJ90YG5TDPe2DMrL6qQFy8okAGTU8Zm9Y1RQcv2hhBiw/T33XXF33QfUrS9nNeZ/35Xcp/e5slphuKClfJwSuG1eR7mzBcoW4hVgdBZE0k1bPV5+YAkXuiOzJ490r0lYowJ6CSvcQ/23uIYz4/hekfRcGUajCskHMaLKX/FX1+vBi9l/pDCiS6Qn91GG+IayXSCXLtJSwZwobPdQ8Z16h/O98aojiMP+twpWjtChDOA0V/xQxFLYadmq50TAUT2BgoUs5r4oqD08aGZ/k95vCKekMDe5jm4k803Qmmy0tIlPR9a22lshT/5vRI4Yew6Rdcc8kQ66lENUVCEvdlYS1hKuIDBYGEOJ4U12k=;25:PHdcwTGK9j5/agdWcbe3N6Pkz4/FKZ7QLQ/NfZsQ9P1FFoeYmbJX5rENiGob+w8L4Tt3UGOV+cZbbZJuYiOoTt7U0uOnUwBGx5XAeKxGMmTAuh8oFmeHiYLtn3PR4csrlvqB46Fl26mL3S7MsSUPuoT4XHugUuY5EFRJcOgp6Q9HD2EDz3wKPweBrptrs78ImOMc4S/h8fbVx5+gl6aarx0NAV3+jFnCDUXDrudeCtVCXQxhvIbIBwjg2XZ+GgoQMnZC4HZh5q5DpJikLrX4DhW1tnEMqh0dTq6FqItO8KchWADjcWbaLQrCoxfrMUK/8DvWgRPbJYtbJPNdmGiMGttCkRt/FGGp0roKbgds0rUJTrwkImZPyISG3SNGpD6Z46ZmJlM3W8BhDafE1oZBV8zXzGGOJJzf6XCfwig6WWSecjNOZwxX8vLyJoIVwIIpSPxZ+PUwh9T4uPuPBWXJC99XYqk7/cxClSTH5Q3vFvw= X-Microsoft-Exchange-Diagnostics: 1;DM5PR12MB1146;31:jglqamHNj8L0AglxhYuDkoNnNQ8fZ1to4wkW+fHv23dKTtK4+ZxzuVri/c5KOUrZhWjEMtUf7cahRFrQKlSP9/wjCgLQObp50n4QPsrEGV5io9eKg4l9jb0wcz9uiNT/G1HyDjMTCtzSROaHGGtfYWs5ffPjrs0M3hEwGZYbMQNYELuR80O7xgIV3MwlsIkgAE/mP8ipgT3/ZUGntnUPTASpMTA7Nqjfl1Pepq+dUgI=;20:uTVfj1Q+sFbnVrDQvVLKOqkTo2AVK/i93V5qxbQI1ktJQejYJO15a6ws6xy4epTVZhuzasuwvLNJ4fSH5oEcGp0kCa5swyrYOnF4y1bo4MCWffCR8b0gn/CQqIQEMTnOYIJHWw98ibMoVh9BUxLyvblMFSiWYMu/g3FvjDfqmYWgre6ozBSwom0atfduglvngzF7qP4QzJ7/LrY1XfsJ8E38gAGIG5YCFrIeZtm1DsE7kTZs+xLKdzHXkV0/svlFWgzqZGfjwS3grcFTvW0+rNwVNCeaU6h2xhOU2F7NjP3refcgI+jEnXIwn/NcmP2NyQmN5V6r9XpEQOOWfiK0VXdXFcHTktmNhWjXBUbIXeW0O2wzbwmTH7Ky0CoX2QrGUOdaxrH5BoSv+Cr7HPBsi9UYjLlNXJy76WOznIb7gjVrFmp8tOW+8vyztjYJMt5j1nKYIJFwVw7GbgTOsnJE+wPcKYURToiyT1q/DttybVJ+rRxFBC8e4DwHRcgzv6Dy X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(100000703101)(100105400095)(93006095)(93001095)(6055026)(6041248)(20161123558100)(20161123562025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123560025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:DM5PR12MB1146;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:DM5PR12MB1146; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtETTVQUjEyTUIxMTQ2OzQ6bXNUVGg0YU0zcCs4MTd0RkE1MEJMRkRPemtu?= =?utf-8?B?Y0E4U25hTElJVUh6cTVITEE4WGtmSWE1L0tLcjlDVE1UQTI2Wmwxc0Q4eFZS?= =?utf-8?B?WUxIRnEzREdtNVJObERXbTgyblpNNnhpUWYyUFNpU0tJSzJWWjFQUlRWVEtZ?= =?utf-8?B?SWtMcFFnOXVVeWVtbWdIdTdvcWRFZ3laditRa3pMRisvOXlDN3h6KzVkdXVC?= =?utf-8?B?dGtJL1h2R0RkVElHdjUxRUFlTEFCVGhrQmtBUGEyVGxiNkxSSXJEcGJBdjBl?= =?utf-8?B?MDlVemJ6NUdzMC94SGY2c3M0REplV0hzSU5pelFmUDZoWURMNjZjTGZ1UHhl?= =?utf-8?B?clduSUliY1VGUVlFOS96TEsrb0RHdkdqRDdQL0oxZUR1R2hSc0tEaEcvTXk2?= =?utf-8?B?dGNBcmNtMFo5R1dVV3c4aVBKOG5tQ3Nua0dNSW56UFNFR1IvMEd0T09EWjhq?= =?utf-8?B?MVAzTDYzWm1GOE9qNnVMZ2N6WGF3STUybXZiL0hvemVqdlB1N2hFY0V0TlRi?= =?utf-8?B?QkdLdWhjalBxc1VZNnRUTmpHb0p5cVZZTVNxL3B5dmhsdjZ2Q0RXR0JDc0hj?= =?utf-8?B?WnFvZHZTOW5ISEZJS1pkVGpScUx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JcXV0aFE0NjVlREJOckdQVnFBY3RkallaeDYrQW5icVV0?= =?utf-8?B?ejJUd0JkNXM0a3BiZ3N4TThuMU1tNFk1MldmT0tOTlRQV3JMbExKQm9iSXhp?= =?utf-8?Q?092JtoNJftDg6+Yk/8u?= X-Forefront-PRVS: 033857D0BD X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6049001)(6009001)(39840400002)(39850400002)(39400400002)(39410400002)(39860400002)(39450400003)(24454002)(377454003)(2950100002)(50466002)(229853002)(77096006)(110136004)(6486002)(478600001)(3846002)(6116002)(72206003)(83506001)(189998001)(47776003)(90366009)(23676002)(6246003)(53936002)(81166006)(8676002)(230700001)(6666003)(65826007)(305945005)(2906002)(50986999)(33646002)(53546009)(5660300001)(54356999)(76176999)(6916009)(7736002)(25786009)(3260700006)(7416002)(36756003)(38730400002)(42186005)(4001350100001)(65956001)(86362001)(66066001)(31696002)(4326008)(309714004);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR12MB1146;H:[10.236.64.250];FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtETTVQUjEyTUIxMTQ2OzIzOmZVUUFVZkhoZjhmdFZHWGw2c2FVMWE2Mm9N?= =?utf-8?B?RmJtc2NDdHRXLzhPRnVrMDdoWkhTUHYwdm1LOEs2UGZYcE9vQVREcUhVS3dJ?= =?utf-8?B?c0VGZG9jSU9sM3ZIZ3JMcldNY3ozcmd3TVJMZ3BQd1BoZFV6RTRKbDNSWStl?= =?utf-8?B?K08rWUR6TlgzM3lLTnlqeWxHUWhqam1mWE5rWWVOWXZXaUZ5NTVHN0tXbWN0?= =?utf-8?B?SFJsZjJFcjVTYnhiZElIZlNLRERQekVQRlMxU1dNQUM4MGk5TTRMa09lWU5C?= =?utf-8?B?VkljaEdRZ2F2NmhlVHVtSUlibjZjeU5adzluZkNpdzhtSWdhcTh6YThjcTFi?= =?utf-8?B?aHcxN084L3dNV3pCdVdq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pw0ULOGO866JbgXouQY4dK/rNWqgt3iuuHO5JFd X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2017 19:49:05.9594 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1146 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2998 Lines: 86 On 6/14/2017 11:50 AM, Borislav Petkov wrote: > On Wed, Jun 07, 2017 at 02:17:32PM -0500, Tom Lendacky wrote: >> Add warnings to let the user know when bounce buffers are being used for >> DMA when SME is active. Since the bounce buffers are not in encrypted >> memory, these notifications are to allow the user to determine some >> appropriate action - if necessary. >> >> Signed-off-by: Tom Lendacky >> --- >> arch/x86/include/asm/mem_encrypt.h | 8 ++++++++ >> include/asm-generic/mem_encrypt.h | 5 +++++ >> include/linux/dma-mapping.h | 9 +++++++++ >> lib/swiotlb.c | 3 +++ >> 4 files changed, 25 insertions(+) >> >> diff --git a/arch/x86/include/asm/mem_encrypt.h b/arch/x86/include/asm/mem_encrypt.h >> index f1215a4..c7a2525 100644 >> --- a/arch/x86/include/asm/mem_encrypt.h >> +++ b/arch/x86/include/asm/mem_encrypt.h >> @@ -69,6 +69,14 @@ static inline bool sme_active(void) >> return !!sme_me_mask; >> } >> >> +static inline u64 sme_dma_mask(void) >> +{ >> + if (!sme_me_mask) >> + return 0ULL; >> + >> + return ((u64)sme_me_mask << 1) - 1; >> +} >> + >> /* >> * The __sme_pa() and __sme_pa_nodebug() macros are meant for use when >> * writing to or comparing values from the cr3 register. Having the >> diff --git a/include/asm-generic/mem_encrypt.h b/include/asm-generic/mem_encrypt.h >> index b55c3f9..fb02ff0 100644 >> --- a/include/asm-generic/mem_encrypt.h >> +++ b/include/asm-generic/mem_encrypt.h >> @@ -22,6 +22,11 @@ static inline bool sme_active(void) >> return false; >> } >> >> +static inline u64 sme_dma_mask(void) >> +{ >> + return 0ULL; >> +} >> + >> /* >> * The __sme_set() and __sme_clr() macros are useful for adding or removing >> * the encryption mask from a value (e.g. when dealing with pagetable >> diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h >> index 4f3eece..e2c5fda 100644 >> --- a/include/linux/dma-mapping.h >> +++ b/include/linux/dma-mapping.h >> @@ -10,6 +10,7 @@ >> #include >> #include >> #include >> +#include >> >> /** >> * List of possible attributes associated with a DMA mapping. The semantics >> @@ -577,6 +578,10 @@ static inline int dma_set_mask(struct device *dev, u64 mask) >> >> if (!dev->dma_mask || !dma_supported(dev, mask)) >> return -EIO; >> + >> + if (sme_active() && (mask < sme_dma_mask())) >> + dev_warn(dev, "SME is active, device will require DMA bounce buffers\n"); > > Something looks strange here: > > you're checking sme_active() before calling sme_dma_mask() and yet in > it, you're checking !sme_me_mask again. What gives? > I guess I don't need the sme_active() check since the second part of the if statement can only ever be true if SME is active (since mask is unsigned). Thanks, Tom > Why not move the sme_active() check into sme_dma_mask() and thus > simplify callers? >