From patchwork Wed Oct 4 15:58:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josh Poimboeuf X-Patchwork-Id: 9985069 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 31A2A6028E for ; Wed, 4 Oct 2017 16:01:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 23F5128B45 for ; Wed, 4 Oct 2017 16:01:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1896A28B4D; Wed, 4 Oct 2017 16:01:12 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B781C28B45 for ; Wed, 4 Oct 2017 16:01:11 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dzm4f-0000FE-1H; Wed, 04 Oct 2017 15:59:05 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dzm4d-0000Cb-Qo for xen-devel@lists.xenproject.org; Wed, 04 Oct 2017 15:59:03 +0000 Received: from [85.158.143.35] by server-10.bemta-6.messagelabs.com id 5B/FF-03642-74505D95; Wed, 04 Oct 2017 15:59:03 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmphkeJIrShJLcpLzFFi42K52LJdRteZ9Wq kwZwWbYvvWyYzOTB6HP5whSWAMYo1My8pvyKBNePVAuuCwwIVt5+8Zm9gXMjTxcjFISQwm0ni xK8Oli5GTg4WAXuJR3/PMYLYjAJlEkfWzGfrYuQAsnMlJqyUgKjfyCix9PZcZpAaNgEtieN/T 7KD1IgICEksvVsHEmYWOMIq8eKiJkhYWMBW4lOnI8R0VYkDhyeBbeIViJR4u3g22BROAXOJHX 3L2EBsIQEzie3X1oHFJQS0JR6fns4IslZCoI9R4umk1cwTGPkXMDKsYtQoTi0qSy3SNTLQSyr KTM8oyU3MzNE1NDDTy00tLk5MT81JTCrWS87P3cQIDB0GINjB+GtZwCFGSQ4mJVHeXz+vRArx JeWnVGYkFmfEF5XmpBYfYpTh4FCS4I1luRopJFiUmp5akZaZAwximLQEB4+SCG8OSJq3uCAxt zgzHSJ1ilFRSpx3HkhCACSRUZoH1waLnEuMslLCvIxAhwjxFKQW5WaWoMq/YhTnYFQS5u0Amc KTmVcCN/0V0GImoMVzmq6ALC5JREhJNTCKHY/bxLLyR/f+HsXAhFl3lqzequh69+y9eZ/lznA 9ts3T133NknS59Pl1w9YfmrM38U55fv3wjkszkjyfcfmLqnQoLfiYdUyzUidhV/byxgeBTw8a 3eSySImcdGlSwjYTVj7hkArhLS2lHjXNH9Z/cMiotxcwmrbj3B+uHbU9r0z3cF293MeixFKck WioxVxUnAgAsnl1k5cCAAA= X-Env-Sender: jpoimboe@redhat.com X-Msg-Ref: server-10.tower-21.messagelabs.com!1507132738!69670651!1 X-Originating-IP: [209.132.183.28] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMjA5LjEzMi4xODMuMjggPT4gNTQwNjQ=\n X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 1203 invoked from network); 4 Oct 2017 15:58:59 -0000 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by server-10.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 4 Oct 2017 15:58:59 -0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AF8DA267F8; Wed, 4 Oct 2017 15:58:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com AF8DA267F8 Received: from treble.redhat.com (ovpn-120-76.rdu2.redhat.com [10.10.120.76]) by smtp.corp.redhat.com (Postfix) with ESMTP id AB15F6293E; Wed, 4 Oct 2017 15:58:55 +0000 (UTC) From: Josh Poimboeuf To: x86@kernel.org Date: Wed, 4 Oct 2017 10:58:28 -0500 Message-Id: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 04 Oct 2017 15:58:57 +0000 (UTC) Cc: Juergen Gross , Rusty Russell , xen-devel@lists.xenproject.org, Peter Zijlstra , Jiri Slaby , Boris Ostrovsky , Mike Galbraith , linux-kernel@vger.kernel.org, Sasha Levin , Chris Wright , Thomas Gleixner , Andy Lutomirski , "H. Peter Anvin" , Borislav Petkov , live-patching@vger.kernel.org, Alok Kataria , virtualization@lists.linux-foundation.org, Linus Torvalds , Ingo Molnar Subject: [Xen-devel] [PATCH 07/13] x86/paravirt: Simplify ____PVOP_CALL() X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Remove the inline asm duplication in ____PVOP_CALL(). Also add 'IS_ENABLED(CONFIG_X86_32)' to the return variable logic, making the code clearer and rendering the comment unnecessary. Signed-off-by: Josh Poimboeuf Reviewed-by: Juergen Gross --- arch/x86/include/asm/paravirt_types.h | 36 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/arch/x86/include/asm/paravirt_types.h b/arch/x86/include/asm/paravirt_types.h index ab7aabe6b668..01f9e10983c1 100644 --- a/arch/x86/include/asm/paravirt_types.h +++ b/arch/x86/include/asm/paravirt_types.h @@ -529,29 +529,19 @@ int paravirt_disable_iospace(void); rettype __ret; \ PVOP_CALL_ARGS; \ PVOP_TEST_NULL(op); \ - /* This is 32-bit specific, but is okay in 64-bit */ \ - /* since this condition will never hold */ \ - if (sizeof(rettype) > sizeof(unsigned long)) { \ - asm volatile(pre \ - paravirt_alt(PARAVIRT_CALL) \ - post \ - : call_clbr, ASM_CALL_CONSTRAINT \ - : paravirt_type(op), \ - paravirt_clobber(clbr), \ - ##__VA_ARGS__ \ - : "memory", "cc" extra_clbr); \ - __ret = (rettype)((((u64)__edx) << 32) | __eax); \ - } else { \ - asm volatile(pre \ - paravirt_alt(PARAVIRT_CALL) \ - post \ - : call_clbr, ASM_CALL_CONSTRAINT \ - : paravirt_type(op), \ - paravirt_clobber(clbr), \ - ##__VA_ARGS__ \ - : "memory", "cc" extra_clbr); \ - __ret = (rettype)(__eax & PVOP_RETMASK(rettype)); \ - } \ + asm volatile(pre \ + paravirt_alt(PARAVIRT_CALL) \ + post \ + : call_clbr, ASM_CALL_CONSTRAINT \ + : paravirt_type(op), \ + paravirt_clobber(clbr), \ + ##__VA_ARGS__ \ + : "memory", "cc" extra_clbr); \ + if (IS_ENABLED(CONFIG_X86_32) && \ + sizeof(rettype) > sizeof(unsigned long)) \ + __ret = (rettype)((((u64)__edx) << 32) | __eax);\ + else \ + __ret = (rettype)(__eax & PVOP_RETMASK(rettype));\ __ret; \ })