From patchwork Mon Aug 22 23:26:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 9294811 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 F40B7607FF for ; Tue, 23 Aug 2016 00:01:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E472F28A9B for ; Tue, 23 Aug 2016 00:01:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D850C28AA0; Tue, 23 Aug 2016 00:01:29 +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 9D7C628A9C for ; Tue, 23 Aug 2016 00:01:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757278AbcHWABL (ORCPT ); Mon, 22 Aug 2016 20:01:11 -0400 Received: from mail-co1nam03on0044.outbound.protection.outlook.com ([104.47.40.44]:51573 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756683AbcHWABI (ORCPT ); Mon, 22 Aug 2016 20:01:08 -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=j58Cv93A4svmHoZAEymVvWlobzS8Zia0eoMaInPOtm4=; b=SS1ZQ0fl8uwV35pVfhXLwMbrz85UJ2+hjdtLn7fPXDkjIe0Jj+GNRcbbULIPBj0MEYw36vL9IHupWUtHlVMdcHdJr4B7l+DGpySWTwTMEbiociBvEvcO9runxpycWZPGdAncH/+h1Hdy0gr2J3C/8u5Cw9yLf0oxwOaNpkwNWVE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from [127.0.1.1] (165.204.77.1) by SN1PR12MB0670.namprd12.prod.outlook.com (10.163.208.28) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.549.15; Mon, 22 Aug 2016 23:26:43 +0000 Subject: [RFC PATCH v1 15/28] x86: Unroll string I/O when SEV is active From: Brijesh Singh To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Mon, 22 Aug 2016 19:26:40 -0400 Message-ID: <147190840032.9523.7491479364800390492.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: BY2PR21CA0005.namprd21.prod.outlook.com (10.162.74.143) To SN1PR12MB0670.namprd12.prod.outlook.com (10.163.208.28) X-MS-Office365-Filtering-Correlation-Id: e3648293-56dd-4c6a-2e36-08d3cae3c92c X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0670; 2:tnDggbBdAyUpqoFA+vZFoXUUuN2B+GBJsFVzgo6dgojJgCNyyQXp85tpqzCMndYY1i9acrodDeVNXmV/XiLgN80QaQejLKLbroGWdyBJ1BSxl1Ww1MDOQEezYfak9hMjks17Nh3YSCapxAmJnUL5aTo+E7/iwE+MTSmnZRTr1GoF6Gn7u9q4Ap1qoBeH73Pe; 3:8ITG4h2pj0BqNpbm0S1tJe/xCvua1MQrmmH1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6jLTW7K2ViVjyfTkk/NSCGCswz8//gS/nYIzVeHbds+eU2A6Bf8R079C9Mnb+r+7QyKa2pwKXpPhSpUbdgoZRPe8efiFhSuLSo0qi5DEIs1UAXjGZLZsyr9Y1/1DoWrkX1utb9D754ghk91wIhKwtIF0u3SY+eCdxXaJrdvbNCoFGf/eeyJzSVQdv8RuC9MAXwc2XoP/1+N/s9Mw3xi7y5N1DU8G9IZ/RSxSa1xHH6eFflTRxpe24kDTixnWJacOEz4K7HvWHoxuZ3O3LeLtKuGvxLlvWsO 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)(3002001)(10201501046)(6055026); SRVR:SN1PR12MB0670; BCL:0; PCL:0; RULEID:; SRVR:SN1PR12MB0670; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0670; 4:Vtn1AYf5CStAKF+r6nlsUefSERP2eiDSTVx95J4/0lvS59XTRzKsZP86kqkcEu+BnN50fqZxVKutgK0Zi5Da3pnyJiQ0aJjXkjmFiNCNPK+EWL7tocqU/NSHWHSgte/uf6kwgydclj2kG4SGvreM0vSneOd/20NCmEZCE378OXMVlfSN9mEF+dUIbkHg1cY+5ShdbZ6cqvQQQ5+JqPrZuEsvfbpee0AwHafHJiNhvm0gjVzdub9068FBRpRw3LqZNBT8EwijvXcmKb9v+L74zvgNqyd2PyP5A9E+EyrVYa7O2uBua7H9DzjNlXnzTgQlhjLrlkT3faeUWnpgWgZznOhBSMrUZRnNSN6cQacMjDfjJGMUDsZe1j5moV75NBA6vZZnc6XM9JZVw2+7Oc8eOSRufoOrAnW3YgNlahydLXpiqaTEEg1yySddFSPJZill X-Forefront-PRVS: 00429279BA X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6049001)(7916002)(189002)(199003)(92566002)(83506001)(50466002)(4001350100001)(19580405001)(97736004)(19580395003)(107886002)(189998001)(5001770100001)(305945005)(7846002)(7736002)(101416001)(66066001)(33646002)(2201001)(50986999)(23676002)(86362001)(229853001)(47776003)(106356001)(7416002)(54356999)(7406005)(76176999)(5660300001)(9686002)(81156014)(586003)(81166006)(8676002)(230700001)(2906002)(3846002)(42186005)(2950100001)(68736007)(6116002)(77096005)(33716001)(105586002)(103116003)(921003)(217873001)(1121003)(83996005)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB0670; 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?MTtTTjFQUjEyTUIwNjcwOzIzOkhOcURZU08wSlRLb0VCeGJzSG1yb0pmVFhK?= =?utf-8?B?MHZTM3c0SzFNZHZjcWREREgxWGR3R3hQb0xNeFBRQ0RHKzI0bTRFZk1OQnVl?= =?utf-8?B?ZHpFNXFMSzh2eVJSaHkwKy9qOE1UL1EzN3ZuR1JYUDJFZkxzWDdtZzlka2tl?= =?utf-8?B?Q0dHNmV5ZG1tMEw5dXZIWjFIa0dGSGZtSk00TnVweG5kR0RrR3hpQmF5bFVn?= =?utf-8?B?YmNkejNxSklMbkZtLytTVWZZYjVHWnZnOFEvUlFYci9MRXZmYjh4b3BCbDlR?= =?utf-8?B?RWNoMXEwWFZFYTZWdzdsVDdJZUt0dlhIVXprUFZkeC92TllTR2owalEwemw2?= =?utf-8?B?NDgxL2JhRWRCakdIN3JIQ3FaN0l5MUlldlQ3R21vRVo0QUxyTVY1UVRnZU5j?= =?utf-8?B?RzBGNzVUNGtLNm5Dc0s4SW53a1VDd1BkZ2hLNDNwS1VXaTZWWEh2ZEVZNDV0?= =?utf-8?B?TXNkRytiVWNCNGVPQmdSWUZOVGxvZW5vLzNhODVsVzNybVNhL09QaWtMWVRP?= =?utf-8?B?MU5lUVBMc0VFY3ZYT0M3MTkwQWRkVU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Nfom3MyGEuDh3PHqd4Y=; 7:zyJZf2QR0Ql5kMt381/Z9xFd37nSQHGSb8dujuBBDB4P3WMhP4icg9w4neRosVynIe//upi9v0DRHuZH6bny8joLPCc+7Jaa9x2253joLF1QYAQnxgT/3WOPTWNdN6zdsFebfmx/uzaltH4D+n9w7f6GQCJdr4GyYE3A0NFLp3JE1u601SGQl4BodTi9d2RuAXQGQ7hQdG33K2Wd3ArtWeudYBLF9o/jYUdPn885boRiD4a+8ca3hEoU0W58ODpZ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0670; 20:xXajXRgVL8w+IRgkJqSeNlUBSMS+7Q06N9zwAQSlrz7HCsMsCfQEfegjnntr62QVh5EXSwhSMdqAauRnqJTsBANvQfNEH/2K0ilZxfTEP+psTyFtAqvSqOScAzGiNy6fGGyLtWDwT4mq8VDRbEG3E2FkAajmXahRZtQuC6CIiKcjHwXdUmXsbRqO70zJjSoe+QMSmnOhERHFrTm21kFmYmXxvHazZY/vjKAS1u7+pi2O1UrBxBinHPm8ftumcuZ/ X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2016 23:26:43.2874 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0670 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 Secure Encrypted Virtualization (SEV) does not support string I/O, so unroll the string I/O operation into a loop operating on one element at a time. Signed-off-by: Tom Lendacky --- arch/x86/include/asm/io.h | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) -- 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/io.h b/arch/x86/include/asm/io.h index de25aad..130b3e2 100644 --- a/arch/x86/include/asm/io.h +++ b/arch/x86/include/asm/io.h @@ -303,14 +303,32 @@ static inline unsigned type in##bwl##_p(int port) \ \ static inline void outs##bwl(int port, const void *addr, unsigned long count) \ { \ - asm volatile("rep; outs" #bwl \ - : "+S"(addr), "+c"(count) : "d"(port)); \ + if (sev_active) { \ + unsigned type *value = (unsigned type *)addr; \ + while (count) { \ + out##bwl(*value, port); \ + value++; \ + count--; \ + } \ + } else { \ + asm volatile("rep; outs" #bwl \ + : "+S"(addr), "+c"(count) : "d"(port)); \ + } \ } \ \ static inline void ins##bwl(int port, void *addr, unsigned long count) \ { \ - asm volatile("rep; ins" #bwl \ - : "+D"(addr), "+c"(count) : "d"(port)); \ + if (sev_active) { \ + unsigned type *value = (unsigned type *)addr; \ + while (count) { \ + *value = in##bwl(port); \ + value++; \ + count--; \ + } \ + } else { \ + asm volatile("rep; ins" #bwl \ + : "+D"(addr), "+c"(count) : "d"(port)); \ + } \ } BUILDIO(b, b, char)