From patchwork Mon Nov 26 16:00:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 10698577 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7F657181D for ; Mon, 26 Nov 2018 16:00:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 708D529ECE for ; Mon, 26 Nov 2018 16:00:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 64EFA29F03; Mon, 26 Nov 2018 16:00:24 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 4E77429F2D for ; Mon, 26 Nov 2018 16:00:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726549AbeK0Cyx (ORCPT ); Mon, 26 Nov 2018 21:54:53 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:37419 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726167AbeK0Cyx (ORCPT ); Mon, 26 Nov 2018 21:54:53 -0500 Received: by mail-wm1-f68.google.com with SMTP id g67so5602362wmd.2 for ; Mon, 26 Nov 2018 08:00:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=5wihDWCArk0eorQ0BrHXv/iyGWLM5nd5DjxupPbTDJ4=; b=BUldZyuyioQaZwvp/l22UNO1E9hyn8co4nsLuNe+94HDkS5e/4Mz2Ads9zksm7I9UG T8TmGWMHkrIv6akLcRaKN9QtbK86DGpGwXGKaIBKx5WK5hfBpfkkUxV7dit/DuQ3gfKN CtC9SbO0RdL4vivdLjOWCS/3Xv2x6rzg6jluM60uef6kkJv0e+EcghLrqTJKlT5H2q1L 9yTbviDWWtgm4tvrJzGmGFDon/VlLWzfksEdXv3qr52g7NyZleEyb6xN1YEQL+IU827e sXq+4RCK/tzFIDTa2hPKWAH9bYbXotUjgd6IP25FXnAP1h/JhxD03xpoOKaSYWB7Owpg m1zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=5wihDWCArk0eorQ0BrHXv/iyGWLM5nd5DjxupPbTDJ4=; b=hkL3g4rV9dGh60lRxLJZsq0F9rsnZsTxsj3ErJ4Q6TuZRfkGUYshdBfCBZlatWqr9g sPGNerJ/fXcsnx1LRtBHQ75RqtlV34dS7MVCjbwNUouB200vtiQVh7uLkHgxWCQjhtc5 CBcMYRvmRrpQ9JwUZDfj4pIZ2kiViiUJ9LikrY2bK8hq4N9hlbEoiXf6BJsYfK9jFNKE a3tbSXJkucs54vDFGp5cR7o5fSMtXm1nTVrbmglEj9Z29xi1aRNTCMuEI36/BUb9Og41 MX84zZ/QJCcTidkCqeb+alHk+b+YQBPioVCekrF0FV6mEUbFObXPqB0K+Akr4sXUlTtU m4Dw== X-Gm-Message-State: AA+aEWZG5wQ5rd54XHxXa8wDrPcmVNKiC77vFX4HUyC5Az6t7Mija595 anC/qCsnxA85KF+8UwuWwj6YhCc4 X-Google-Smtp-Source: AJdET5cie9klq84sVjaJVoNYT/p4rSdRvrnRWR6vifdv9AvfKoMWCf6h7otCFsxYCKT8Si9bYt1F2Q== X-Received: by 2002:a7b:c095:: with SMTP id r21mr24482032wmh.118.1543248019934; Mon, 26 Nov 2018 08:00:19 -0800 (PST) Received: from localhost.localdomain.com (93-103-18-160.static.t-2.net. [93.103.18.160]) by smtp.gmail.com with ESMTPSA id w18sm796754wru.54.2018.11.26.08.00.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 26 Nov 2018 08:00:18 -0800 (PST) From: Uros Bizjak To: kvm@vger.kernel.org, pbonzini@redhat.com Cc: Uros Bizjak Subject: [PATCH] KVM/x86: Use SVM assembly instruction mnemonics instead of .byte streams Date: Mon, 26 Nov 2018 17:00:08 +0100 Message-Id: <20181126160008.20666-1-ubizjak@gmail.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Recently the minimum required version of binutils was changed to 2.20, which supports all SVM instruction mnemonics. The patch removes all .byte #defines and uses real instruction mnemonics instead. Signed-off-by: Uros Bizjak --- arch/x86/include/asm/svm.h | 7 ------- arch/x86/kvm/svm.c | 12 ++++++------ 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/arch/x86/include/asm/svm.h b/arch/x86/include/asm/svm.h index 93b462e48067..dec9c1e84c78 100644 --- a/arch/x86/include/asm/svm.h +++ b/arch/x86/include/asm/svm.h @@ -290,11 +290,4 @@ struct __attribute__ ((__packed__)) vmcb { #define SVM_CR0_SELECTIVE_MASK (X86_CR0_TS | X86_CR0_MP) -#define SVM_VMLOAD ".byte 0x0f, 0x01, 0xda" -#define SVM_VMRUN ".byte 0x0f, 0x01, 0xd8" -#define SVM_VMSAVE ".byte 0x0f, 0x01, 0xdb" -#define SVM_CLGI ".byte 0x0f, 0x01, 0xdd" -#define SVM_STGI ".byte 0x0f, 0x01, 0xdc" -#define SVM_INVLPGA ".byte 0x0f, 0x01, 0xdf" - #endif diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 0d1a74069a9e..33ff4da0457c 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -711,17 +711,17 @@ static u32 svm_msrpm_offset(u32 msr) static inline void clgi(void) { - asm volatile (__ex(SVM_CLGI)); + asm volatile (__ex("clgi")); } static inline void stgi(void) { - asm volatile (__ex(SVM_STGI)); + asm volatile (__ex("stgi")); } static inline void invlpga(unsigned long addr, u32 asid) { - asm volatile (__ex(SVM_INVLPGA) : : "a"(addr), "c"(asid)); + asm volatile (__ex("invlpga %1, %0") : : "c"(asid), "a"(addr)); } static int get_npt_level(struct kvm_vcpu *vcpu) @@ -5625,9 +5625,9 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu) /* Enter guest mode */ "push %%" _ASM_AX " \n\t" "mov %c[vmcb](%[svm]), %%" _ASM_AX " \n\t" - __ex(SVM_VMLOAD) "\n\t" - __ex(SVM_VMRUN) "\n\t" - __ex(SVM_VMSAVE) "\n\t" + __ex("vmload %%" _ASM_AX) "\n\t" + __ex("vmrun %%" _ASM_AX) "\n\t" + __ex("vmsave %%" _ASM_AX) "\n\t" "pop %%" _ASM_AX " \n\t" /* Save guest registers, load host registers */