From patchwork Thu Jun 29 03:01:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Wanpeng Li X-Patchwork-Id: 9815797 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 C87536020A for ; Thu, 29 Jun 2017 03:03:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CDB1728518 for ; Thu, 29 Jun 2017 03:03:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C23FF20009; Thu, 29 Jun 2017 03:03:38 +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.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=unavailable 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 7281C2847D for ; Thu, 29 Jun 2017 03:03:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752103AbdF2DDV (ORCPT ); Wed, 28 Jun 2017 23:03:21 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:34033 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751630AbdF2DCJ (ORCPT ); Wed, 28 Jun 2017 23:02:09 -0400 Received: by mail-pf0-f194.google.com with SMTP id d5so11255077pfe.1; Wed, 28 Jun 2017 20:02:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NF9Q+MmqRUeyAL8dZOyW8AF+qMqlvaqkGYKb2npcL4Q=; b=AQpip5McPs0JgLgJkKl2ecKysXbais9i8oWC7TNcNLJAeufDWRrsPQBUsQeJjhxvbx W2qWDJ0TcvcyxNDLtjwuzcT7X6DwdsGJ3ciJTR8+aDJp21vy4o3c9xQ3c/X5jboeU/0p wUfdU9UlhDMo5Elk8/uXprErolffUzrAhDqWgVuI1XAkI98myp19ciuNYWjs3L9r0tAZ p9xLqCuKtCRElPsZwbnpxqmi+kUninkU+nankl3R9+Mj9ME82cCCriRW/oJ+gDMV4lpk BxNacJk+bYT23caydbjKG5wg7VhEcv3Zap5udcB+z3bcV78geqfsFUaXDdrd//B5gHUs 5fSg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=NF9Q+MmqRUeyAL8dZOyW8AF+qMqlvaqkGYKb2npcL4Q=; b=ORdKVxG9BYowhXFh/59Mc6/vRhGoSTYAbk0xNKVFsXIv1bafUMWsASEZodKw9eMRj7 +OZNGDjvWMxoIYtyHhleC8Q+CjsrsaPfYy4UJEefLclkskrRm4EZyKcYEM+w09r0jgCk gqPaQAw9V1Eaw43ms8bt4A6IuOCnifsoQwqCkf/O6uR13VD3ufOMHHS1sZG6pPtRgY3M 37rNmM5cENMCad8qbwUkivoQrxQbJku0R85rZ9D0TXhMqLBMPsAbaiy7SyUnupqbYpbL SLl89dzaD6MRnuK76HW5tC2MdR/SvQT7IlBcp8WynebhkYjZ8XQoagHiBOdZRq0nCyjj 5b/g== X-Gm-Message-State: AKS2vOyo3Rc3Qf5S185LylOdIURql8komNwOoZrLoj8guRpFo4NJhfuN pq1gpm4QFo+EhPiB X-Received: by 10.84.224.133 with SMTP id s5mr15256590plj.93.1498705328306; Wed, 28 Jun 2017 20:02:08 -0700 (PDT) Received: from localhost ([203.205.141.123]) by smtp.gmail.com with ESMTPSA id z70sm5000626pgz.3.2017.06.28.20.02.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Jun 2017 20:02:07 -0700 (PDT) From: Wanpeng Li X-Google-Original-From: Wanpeng Li To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Wanpeng Li Subject: [PATCH v7 1/4] KVM: x86: Simple kvm_x86_ops->queue_exception parameter Date: Wed, 28 Jun 2017 20:01:58 -0700 Message-Id: <1498705321-3927-2-git-send-email-wanpeng.li@hotmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1498705321-3927-1-git-send-email-wanpeng.li@hotmail.com> References: <1498705321-3927-1-git-send-email-wanpeng.li@hotmail.com> 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 From: Wanpeng Li This patch removes all arguments except the first in kvm_x86_ops->queue_exception since they can extract the arguments from vcpu->arch.exception themselves, do the same in nested_{vmx,svm}_check_exception. Cc: Paolo Bonzini Cc: Radim Krčmář Signed-off-by: Wanpeng Li --- arch/x86/include/asm/kvm_host.h | 4 +--- arch/x86/kvm/svm.c | 8 +++++--- arch/x86/kvm/vmx.c | 8 +++++--- arch/x86/kvm/x86.c | 5 +---- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 695605e..1f01bfb 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -948,9 +948,7 @@ struct kvm_x86_ops { unsigned char *hypercall_addr); void (*set_irq)(struct kvm_vcpu *vcpu); void (*set_nmi)(struct kvm_vcpu *vcpu); - void (*queue_exception)(struct kvm_vcpu *vcpu, unsigned nr, - bool has_error_code, u32 error_code, - bool reinject); + void (*queue_exception)(struct kvm_vcpu *vcpu); void (*cancel_injection)(struct kvm_vcpu *vcpu); int (*interrupt_allowed)(struct kvm_vcpu *vcpu); int (*nmi_allowed)(struct kvm_vcpu *vcpu); diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index ba9891a..e1f8e89 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -631,11 +631,13 @@ static void skip_emulated_instruction(struct kvm_vcpu *vcpu) svm_set_interrupt_shadow(vcpu, 0); } -static void svm_queue_exception(struct kvm_vcpu *vcpu, unsigned nr, - bool has_error_code, u32 error_code, - bool reinject) +static void svm_queue_exception(struct kvm_vcpu *vcpu) { struct vcpu_svm *svm = to_svm(vcpu); + unsigned nr = vcpu->arch.exception.nr; + bool has_error_code = vcpu->arch.exception.has_error_code; + bool reinject = vcpu->arch.exception.reinject; + u32 error_code = vcpu->arch.exception.error_code; /* * If we are within a nested VM we'd better #VMEXIT and let the guest diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index ca5d2b9..df825bb 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -2431,11 +2431,13 @@ static int nested_vmx_check_exception(struct kvm_vcpu *vcpu, unsigned nr) return 1; } -static void vmx_queue_exception(struct kvm_vcpu *vcpu, unsigned nr, - bool has_error_code, u32 error_code, - bool reinject) +static void vmx_queue_exception(struct kvm_vcpu *vcpu) { struct vcpu_vmx *vmx = to_vmx(vcpu); + unsigned nr = vcpu->arch.exception.nr; + bool has_error_code = vcpu->arch.exception.has_error_code; + bool reinject = vcpu->arch.exception.reinject; + u32 error_code = vcpu->arch.exception.error_code; u32 intr_info = nr | INTR_INFO_VALID_MASK; if (!reinject && is_guest_mode(vcpu) && diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 0e846f0..7511c0a 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -6347,10 +6347,7 @@ static int inject_pending_event(struct kvm_vcpu *vcpu, bool req_int_win) kvm_update_dr7(vcpu); } - kvm_x86_ops->queue_exception(vcpu, vcpu->arch.exception.nr, - vcpu->arch.exception.has_error_code, - vcpu->arch.exception.error_code, - vcpu->arch.exception.reinject); + kvm_x86_ops->queue_exception(vcpu); return 0; }