From patchwork Thu May 7 15:49:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 6359251 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 46131BEEE1 for ; Thu, 7 May 2015 15:49:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7A9C52013D for ; Thu, 7 May 2015 15:49:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0AFEE20361 for ; Thu, 7 May 2015 15:49:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751899AbbEGPtp (ORCPT ); Thu, 7 May 2015 11:49:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44580 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751388AbbEGPto (ORCPT ); Thu, 7 May 2015 11:49:44 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 7A3D1B5998; Thu, 7 May 2015 15:49:43 +0000 (UTC) Received: from thh440s.redhat.com (vpn1-5-79.ams2.redhat.com [10.36.5.79]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t47Fnei6011490; Thu, 7 May 2015 11:49:41 -0400 From: Thomas Huth To: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, paulus@samba.org, agraf@suse.de Cc: gleb@kernel.org, pbonzini@redhat.com, benh@kernel.crashing.org, mpe@ellerman.id.au Subject: [PATCH] KVM: PPC: Book3S HV: Replace kvmppc_find_vcpu() with kvm_get_vcpu() Date: Thu, 7 May 2015 17:49:39 +0200 Message-Id: <1431013779-28910-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Both functions are doing the same thing - looking up the struct kvm_vcpu pointer for a given vCPU ID. So there's no need for the kvmppc_find_vcpu() function, simply use the common function instead. Signed-off-by: Thomas Huth --- arch/powerpc/kvm/book3s_hv.c | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index 48d3c5d..78e62cf 100644 --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c @@ -292,22 +292,6 @@ void kvmppc_dump_regs(struct kvm_vcpu *vcpu) vcpu->arch.last_inst); } -struct kvm_vcpu *kvmppc_find_vcpu(struct kvm *kvm, int id) -{ - int r; - struct kvm_vcpu *v, *ret = NULL; - - mutex_lock(&kvm->lock); - kvm_for_each_vcpu(r, v, kvm) { - if (v->vcpu_id == id) { - ret = v; - break; - } - } - mutex_unlock(&kvm->lock); - return ret; -} - static void init_vpa(struct kvm_vcpu *vcpu, struct lppaca *vpa) { vpa->__old_status |= LPPACA_OLD_SHARED_PROC; @@ -358,7 +342,7 @@ static unsigned long do_h_register_vpa(struct kvm_vcpu *vcpu, int subfunc; struct kvmppc_vpa *vpap; - tvcpu = kvmppc_find_vcpu(kvm, vcpuid); + tvcpu = kvm_get_vcpu(kvm, vcpuid); if (!tvcpu) return H_PARAMETER; @@ -678,7 +662,7 @@ int kvmppc_pseries_do_hcall(struct kvm_vcpu *vcpu) break; case H_PROD: target = kvmppc_get_gpr(vcpu, 4); - tvcpu = kvmppc_find_vcpu(vcpu->kvm, target); + tvcpu = kvm_get_vcpu(vcpu->kvm, target); if (!tvcpu) { ret = H_PARAMETER; break; @@ -696,7 +680,7 @@ int kvmppc_pseries_do_hcall(struct kvm_vcpu *vcpu) target = kvmppc_get_gpr(vcpu, 4); if (target == -1) break; - tvcpu = kvmppc_find_vcpu(vcpu->kvm, target); + tvcpu = kvm_get_vcpu(vcpu->kvm, target); if (!tvcpu) { ret = H_PARAMETER; break;