Message ID | 20221130230934.1014142-27-seanjc@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1199747wrr; Wed, 30 Nov 2022 15:14:42 -0800 (PST) X-Google-Smtp-Source: AA0mqf7uhMImqHKeaYFJI6srASr7/q4Qv5E4H6K21FEvkYoLtUmihTZPbw2I/kOCaUUzXZuDDNu+ X-Received: by 2002:a17:90a:fa46:b0:200:1df3:a7a9 with SMTP id dt6-20020a17090afa4600b002001df3a7a9mr71593832pjb.202.1669850082043; Wed, 30 Nov 2022 15:14:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669850082; cv=none; d=google.com; s=arc-20160816; b=SyLGIfHELXusnF7GETEgncRnHgEyBMU3+NVe+HrYAGx62t9JeybXupMAp+4gNgUWAh 9BlEgIbRi43HvsrOKhXOcBJsaM5upaLnpnnaoMlPfm8VjHbh70aYK+lbfJKZCnhUZyxL TGXhx61Y8C2A68+ngIzbtzeMYs/RFz4+CPKVTYCm1h+x2gsqvIzxiEUIhtZA9hRQo0X4 8Hbdqk8GOAL0wv8VwXYHQIdpl/9CIJVzvecvrUjb0bKd7ZSciQWiD/vbRVeO40GrSjbG Iwb4GZr/ylPmhvdigMQTgYC9JTtIMie706sA4QB/KS8OKuOIJQ3ocmhJITxv3xEURvmG mMdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:reply-to:dkim-signature; bh=Ajf/v6plBmBpvMRb25eu7yZbuYHVVa1MLg3BBW1ApnM=; b=T1ZWgwoPR1Vd3NhuTVxPCGRNhi2by2ZUzQj3i3khUN+JMmTlqBr965eJLlqj03cS1O CoIy5UPW2bVQ2hiCvoj6nBnuDr9dfizaKcHIoatNxF1pCQc/N0e7UGelJktA1U8F04OD a+XLgzHDYfo+JtDIQxRzioKfgmpTYk3gnO+49+P95QLr2lkHpOs1mEWHIDFzbfQcf3ZB V+kcdhszj8LNeK9lV1BNy1D1NlGNfaBUEpFOKptMICxWe+gPczAd0b3eKohEaNiCv+3Q 9qPlB2tGxC/MX/cgcVM54EnEcUTmG1KoGU3g4TNvoSXnkhmNtZAPUyFRjfK8l3K0Onwz YywQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="Q7q/5TXz"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h16-20020a170902f55000b00189b048c9e4si1083772plf.500.2022.11.30.15.14.29; Wed, 30 Nov 2022 15:14:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="Q7q/5TXz"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230076AbiK3XOD (ORCPT <rfc822;heyuhang3455@gmail.com> + 99 others); Wed, 30 Nov 2022 18:14:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229615AbiK3XNR (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 30 Nov 2022 18:13:17 -0500 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40C6E99F23 for <linux-kernel@vger.kernel.org>; Wed, 30 Nov 2022 15:10:44 -0800 (PST) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-3bd1ff8fadfso134847177b3.18 for <linux-kernel@vger.kernel.org>; Wed, 30 Nov 2022 15:10:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=Ajf/v6plBmBpvMRb25eu7yZbuYHVVa1MLg3BBW1ApnM=; b=Q7q/5TXzNDPohOMoxUDiD0nnqEk1FoSW4RF/EEt8HMYjM52gPxj46PgYF/68/eUC70 R52IpECaCvp222vr9xTL7j44GbL8VsDvPS5HArvcL4xJanWkN6UNBVlmOIcOzEnjqYoe h8mvG1+Ri644iv9eVrF8AA62rM3of5sqQn2h8l1NJ4Hp9LBXQlFjVGfCJ0M8iuidAG/g r3QoWBzS8+6cQpNc7qHKOescERK5wH+DxZ5oURQjRLgPy9Nq0G8eKIEZQN5DdxTswpJO dO7YdMWEfCe6tuDQ8/4qvPOOW5vLDHcu9lY8BtQx5KXbThVrpdnPftQhmMi0Ij7DKBRT iKQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Ajf/v6plBmBpvMRb25eu7yZbuYHVVa1MLg3BBW1ApnM=; b=AaQozI0ZjRahIsJGvNQogAVcrAdrj6har7cJNzNS1CEoEoA5FarS7kvrehLysiGnV6 YOBWpq2rBZV3b/KL7oDhj2gK2dw/6EyJIB+1SJUMmx0JUzbONeFWUjmKBhTsIPGtLL3o B2Ava8LrcT4EpOvh4wdVf47c7n6CI4FynM/5lLkFZDOMTlkhuzW0Ls1WTFBXGr3AU/5O SBJ6Aqi5AtXmlcclghqJ0n2biHoZQXxeqcKiiqMaPBSfYkfmkND97guPb6WLsyTwYDDZ NIv+eRiCJltroNg5sOdqpbUYguhbF8pymHXem2gBnKZhe858KNuGJdn+v4w3cTBvMSnu hC6g== X-Gm-Message-State: ANoB5pm7QmCb8J3VcPgu2rQrSkHHl6A1PpoyZ5d3n6UGwMsChqdiTEBa VlcfGp3NmoJ158d0LQiFlS8HdUWbuHA= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a25:8401:0:b0:6f1:4590:92b9 with SMTP id u1-20020a258401000000b006f1459092b9mr33613349ybk.430.1669849822483; Wed, 30 Nov 2022 15:10:22 -0800 (PST) Reply-To: Sean Christopherson <seanjc@google.com> Date: Wed, 30 Nov 2022 23:09:10 +0000 In-Reply-To: <20221130230934.1014142-1-seanjc@google.com> Mime-Version: 1.0 References: <20221130230934.1014142-1-seanjc@google.com> X-Mailer: git-send-email 2.38.1.584.g0f3c55d4c2-goog Message-ID: <20221130230934.1014142-27-seanjc@google.com> Subject: [PATCH v2 26/50] KVM: PPC: Move processor compatibility check to module init From: Sean Christopherson <seanjc@google.com> To: Paolo Bonzini <pbonzini@redhat.com>, Marc Zyngier <maz@kernel.org>, Huacai Chen <chenhuacai@kernel.org>, Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>, Anup Patel <anup@brainfault.org>, Paul Walmsley <paul.walmsley@sifive.com>, Palmer Dabbelt <palmer@dabbelt.com>, Albert Ou <aou@eecs.berkeley.edu>, Christian Borntraeger <borntraeger@linux.ibm.com>, Janosch Frank <frankja@linux.ibm.com>, Claudio Imbrenda <imbrenda@linux.ibm.com>, Matthew Rosato <mjrosato@linux.ibm.com>, Eric Farman <farman@linux.ibm.com>, Sean Christopherson <seanjc@google.com>, Vitaly Kuznetsov <vkuznets@redhat.com>, David Woodhouse <dwmw2@infradead.org>, Paul Durrant <paul@xen.org> Cc: James Morse <james.morse@arm.com>, Alexandru Elisei <alexandru.elisei@arm.com>, Suzuki K Poulose <suzuki.poulose@arm.com>, Oliver Upton <oliver.upton@linux.dev>, Atish Patra <atishp@atishpatra.org>, David Hildenbrand <david@redhat.com>, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, Yuan Yao <yuan.yao@intel.com>, Cornelia Huck <cohuck@redhat.com>, Isaku Yamahata <isaku.yamahata@intel.com>, " =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= " <philmd@linaro.org>, Fabiano Rosas <farosas@linux.ibm.com>, Michael Ellerman <mpe@ellerman.id.au>, Kai Huang <kai.huang@intel.com>, Chao Gao <chao.gao@intel.com>, Thomas Gleixner <tglx@linutronix.de> Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750964719730533641?= X-GMAIL-MSGID: =?utf-8?q?1750964719730533641?= |
Series |
KVM: Rework kvm_init() and hardware enabling
|
|
Commit Message
Sean Christopherson
Nov. 30, 2022, 11:09 p.m. UTC
Move KVM PPC's compatibility checks to their respective module_init()
hooks, there's no need to wait until KVM's common compat check, nor is
there a need to perform the check on every CPU (provided by common KVM's
hook), as the compatibility checks operate on global data.
arch/powerpc/include/asm/cputable.h: extern struct cpu_spec *cur_cpu_spec;
arch/powerpc/kvm/book3s.c: return 0
arch/powerpc/kvm/e500.c: strcmp(cur_cpu_spec->cpu_name, "e500v2")
arch/powerpc/kvm/e500mc.c: strcmp(cur_cpu_spec->cpu_name, "e500mc")
strcmp(cur_cpu_spec->cpu_name, "e5500")
strcmp(cur_cpu_spec->cpu_name, "e6500")
Cc: Fabiano Rosas <farosas@linux.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Sean Christopherson <seanjc@google.com>
---
arch/powerpc/include/asm/kvm_ppc.h | 1 -
arch/powerpc/kvm/book3s.c | 10 ----------
arch/powerpc/kvm/e500.c | 4 ++--
arch/powerpc/kvm/e500mc.c | 4 ++++
arch/powerpc/kvm/powerpc.c | 2 +-
5 files changed, 7 insertions(+), 14 deletions(-)
Comments
Sean Christopherson <seanjc@google.com> writes: > Move KVM PPC's compatibility checks to their respective module_init() > hooks, there's no need to wait until KVM's common compat check, nor is > there a need to perform the check on every CPU (provided by common KVM's > hook), as the compatibility checks operate on global data. > > arch/powerpc/include/asm/cputable.h: extern struct cpu_spec *cur_cpu_spec; > arch/powerpc/kvm/book3s.c: return 0 > arch/powerpc/kvm/e500.c: strcmp(cur_cpu_spec->cpu_name, "e500v2") > arch/powerpc/kvm/e500mc.c: strcmp(cur_cpu_spec->cpu_name, "e500mc") > strcmp(cur_cpu_spec->cpu_name, "e5500") > strcmp(cur_cpu_spec->cpu_name, "e6500") I'm not sure that output is really useful in the change log unless you explain more about what it is. > diff --git a/arch/powerpc/kvm/e500mc.c b/arch/powerpc/kvm/e500mc.c > index 57e0ad6a2ca3..795667f7ebf0 100644 > --- a/arch/powerpc/kvm/e500mc.c > +++ b/arch/powerpc/kvm/e500mc.c > @@ -388,6 +388,10 @@ static int __init kvmppc_e500mc_init(void) > { > int r; > > + r = kvmppc_e500mc_check_processor_compat(); > + if (r) > + return kvmppc_e500mc; This doesn't build: linux/arch/powerpc/kvm/e500mc.c: In function ‘kvmppc_e500mc_init’: linux/arch/powerpc/kvm/e500mc.c:391:13: error: implicit declaration of function ‘kvmppc_e500mc_check_processor_compat’; did you mean ‘kvmppc_core_check_processor_compat’? [-Werror=implicit-function-declaration] 391 | r = kvmppc_e500mc_check_processor_compat(); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | kvmppc_core_check_processor_compat linux/arch/powerpc/kvm/e500mc.c:393:24: error: ‘kvmppc_e500mc’ undeclared (first use in this function); did you mean ‘kvm_ops_e500mc’? 393 | return kvmppc_e500mc; | ^~~~~~~~~~~~~ | kvm_ops_e500mc linux/arch/powerpc/kvm/e500mc.c:393:24: note: each undeclared identifier is reported only once for each function it appears in It needs the delta below to compile. With that: Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc) cheers diff --git a/arch/powerpc/kvm/e500mc.c b/arch/powerpc/kvm/e500mc.c index 795667f7ebf0..4564aa27edcf 100644 --- a/arch/powerpc/kvm/e500mc.c +++ b/arch/powerpc/kvm/e500mc.c @@ -168,7 +168,7 @@ static void kvmppc_core_vcpu_put_e500mc(struct kvm_vcpu *vcpu) kvmppc_booke_vcpu_put(vcpu); } -int kvmppc_core_check_processor_compat(void) +int kvmppc_e500mc_check_processor_compat(void) { int r; @@ -390,7 +390,7 @@ static int __init kvmppc_e500mc_init(void) r = kvmppc_e500mc_check_processor_compat(); if (r) - return kvmppc_e500mc; + goto err_out; r = kvmppc_booke_init(); if (r)
On Thu, Dec 01, 2022, Michael Ellerman wrote: > Sean Christopherson <seanjc@google.com> writes: > > Move KVM PPC's compatibility checks to their respective module_init() > > hooks, there's no need to wait until KVM's common compat check, nor is > > there a need to perform the check on every CPU (provided by common KVM's > > hook), as the compatibility checks operate on global data. > > > > arch/powerpc/include/asm/cputable.h: extern struct cpu_spec *cur_cpu_spec; > > arch/powerpc/kvm/book3s.c: return 0 > > arch/powerpc/kvm/e500.c: strcmp(cur_cpu_spec->cpu_name, "e500v2") > > arch/powerpc/kvm/e500mc.c: strcmp(cur_cpu_spec->cpu_name, "e500mc") > > strcmp(cur_cpu_spec->cpu_name, "e5500") > > strcmp(cur_cpu_spec->cpu_name, "e6500") > > I'm not sure that output is really useful in the change log unless you > explain more about what it is. Agreed, I got lazy. I'll write a proper description. > > diff --git a/arch/powerpc/kvm/e500mc.c b/arch/powerpc/kvm/e500mc.c > > index 57e0ad6a2ca3..795667f7ebf0 100644 > > --- a/arch/powerpc/kvm/e500mc.c > > +++ b/arch/powerpc/kvm/e500mc.c > > @@ -388,6 +388,10 @@ static int __init kvmppc_e500mc_init(void) > > { > > int r; > > > > + r = kvmppc_e500mc_check_processor_compat(); > > + if (r) > > + return kvmppc_e500mc; > > This doesn't build: > > linux/arch/powerpc/kvm/e500mc.c: In function ‘kvmppc_e500mc_init’: > linux/arch/powerpc/kvm/e500mc.c:391:13: error: implicit declaration of function ‘kvmppc_e500mc_check_processor_compat’; did you mean ‘kvmppc_core_check_processor_compat’? [-Werror=implicit-function-declaration] > 391 | r = kvmppc_e500mc_check_processor_compat(); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > | kvmppc_core_check_processor_compat > linux/arch/powerpc/kvm/e500mc.c:393:24: error: ‘kvmppc_e500mc’ undeclared (first use in this function); did you mean ‘kvm_ops_e500mc’? > 393 | return kvmppc_e500mc; > | ^~~~~~~~~~~~~ > | kvm_ops_e500mc > linux/arch/powerpc/kvm/e500mc.c:393:24: note: each undeclared identifier is reported only once for each function it appears in Huh, CONFIG_PPC_E500MC got unselected in the config I use to compile test this flavor. I suspect I botched an oldconfig at some point. Anyways, fixed that and the bugs. Thanks much! -- Subject: [PATCH] KVM: PPC: Move processor compatibility check to module init Move KVM PPC's compatibility checks to their respective module_init() hooks, there's no need to wait until KVM's common compat check, nor is there a need to perform the check on every CPU (provided by common KVM's hook). The compatibility checks are either a nop (Book3S), or simply check the CPU name stored in the global CPU spec (e500 and e500mc). Cc: Fabiano Rosas <farosas@linux.ibm.com> Cc: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Sean Christopherson <seanjc@google.com> --- arch/powerpc/include/asm/kvm_ppc.h | 1 - arch/powerpc/kvm/book3s.c | 10 ---------- arch/powerpc/kvm/e500.c | 4 ++-- arch/powerpc/kvm/e500mc.c | 6 +++++- arch/powerpc/kvm/powerpc.c | 2 +- 5 files changed, 8 insertions(+), 15 deletions(-) diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h index bfacf12784dd..51a1824b0a16 100644 --- a/arch/powerpc/include/asm/kvm_ppc.h +++ b/arch/powerpc/include/asm/kvm_ppc.h @@ -118,7 +118,6 @@ extern int kvmppc_xlate(struct kvm_vcpu *vcpu, ulong eaddr, extern int kvmppc_core_vcpu_create(struct kvm_vcpu *vcpu); extern void kvmppc_core_vcpu_free(struct kvm_vcpu *vcpu); extern int kvmppc_core_vcpu_setup(struct kvm_vcpu *vcpu); -extern int kvmppc_core_check_processor_compat(void); extern int kvmppc_core_vcpu_translate(struct kvm_vcpu *vcpu, struct kvm_translation *tr); diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c index 6d525285dbe8..87283a0e33d8 100644 --- a/arch/powerpc/kvm/book3s.c +++ b/arch/powerpc/kvm/book3s.c @@ -999,16 +999,6 @@ int kvmppc_h_logical_ci_store(struct kvm_vcpu *vcpu) } EXPORT_SYMBOL_GPL(kvmppc_h_logical_ci_store); -int kvmppc_core_check_processor_compat(void) -{ - /* - * We always return 0 for book3s. We check - * for compatibility while loading the HV - * or PR module - */ - return 0; -} - int kvmppc_book3s_hcall_implemented(struct kvm *kvm, unsigned long hcall) { return kvm->arch.kvm_ops->hcall_implemented(hcall); diff --git a/arch/powerpc/kvm/e500.c b/arch/powerpc/kvm/e500.c index c8b2b4478545..0ea61190ec04 100644 --- a/arch/powerpc/kvm/e500.c +++ b/arch/powerpc/kvm/e500.c @@ -314,7 +314,7 @@ static void kvmppc_core_vcpu_put_e500(struct kvm_vcpu *vcpu) kvmppc_booke_vcpu_put(vcpu); } -int kvmppc_core_check_processor_compat(void) +static int kvmppc_e500_check_processor_compat(void) { int r; @@ -507,7 +507,7 @@ static int __init kvmppc_e500_init(void) unsigned long handler_len; unsigned long max_ivor = 0; - r = kvmppc_core_check_processor_compat(); + r = kvmppc_e500_check_processor_compat(); if (r) goto err_out; diff --git a/arch/powerpc/kvm/e500mc.c b/arch/powerpc/kvm/e500mc.c index 57e0ad6a2ca3..4564aa27edcf 100644 --- a/arch/powerpc/kvm/e500mc.c +++ b/arch/powerpc/kvm/e500mc.c @@ -168,7 +168,7 @@ static void kvmppc_core_vcpu_put_e500mc(struct kvm_vcpu *vcpu) kvmppc_booke_vcpu_put(vcpu); } -int kvmppc_core_check_processor_compat(void) +int kvmppc_e500mc_check_processor_compat(void) { int r; @@ -388,6 +388,10 @@ static int __init kvmppc_e500mc_init(void) { int r; + r = kvmppc_e500mc_check_processor_compat(); + if (r) + goto err_out; + r = kvmppc_booke_init(); if (r) goto err_out; diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index 5faf69421f13..d44b85ba8cef 100644 --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c @@ -442,7 +442,7 @@ int kvm_arch_hardware_enable(void) int kvm_arch_check_processor_compat(void *opaque) { - return kvmppc_core_check_processor_compat(); + return 0; } int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) base-commit: 00e4493db7c6163d48d5b45034d1a77e16a1c8dc --
diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h index bfacf12784dd..51a1824b0a16 100644 --- a/arch/powerpc/include/asm/kvm_ppc.h +++ b/arch/powerpc/include/asm/kvm_ppc.h @@ -118,7 +118,6 @@ extern int kvmppc_xlate(struct kvm_vcpu *vcpu, ulong eaddr, extern int kvmppc_core_vcpu_create(struct kvm_vcpu *vcpu); extern void kvmppc_core_vcpu_free(struct kvm_vcpu *vcpu); extern int kvmppc_core_vcpu_setup(struct kvm_vcpu *vcpu); -extern int kvmppc_core_check_processor_compat(void); extern int kvmppc_core_vcpu_translate(struct kvm_vcpu *vcpu, struct kvm_translation *tr); diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c index 6d525285dbe8..87283a0e33d8 100644 --- a/arch/powerpc/kvm/book3s.c +++ b/arch/powerpc/kvm/book3s.c @@ -999,16 +999,6 @@ int kvmppc_h_logical_ci_store(struct kvm_vcpu *vcpu) } EXPORT_SYMBOL_GPL(kvmppc_h_logical_ci_store); -int kvmppc_core_check_processor_compat(void) -{ - /* - * We always return 0 for book3s. We check - * for compatibility while loading the HV - * or PR module - */ - return 0; -} - int kvmppc_book3s_hcall_implemented(struct kvm *kvm, unsigned long hcall) { return kvm->arch.kvm_ops->hcall_implemented(hcall); diff --git a/arch/powerpc/kvm/e500.c b/arch/powerpc/kvm/e500.c index c8b2b4478545..0ea61190ec04 100644 --- a/arch/powerpc/kvm/e500.c +++ b/arch/powerpc/kvm/e500.c @@ -314,7 +314,7 @@ static void kvmppc_core_vcpu_put_e500(struct kvm_vcpu *vcpu) kvmppc_booke_vcpu_put(vcpu); } -int kvmppc_core_check_processor_compat(void) +static int kvmppc_e500_check_processor_compat(void) { int r; @@ -507,7 +507,7 @@ static int __init kvmppc_e500_init(void) unsigned long handler_len; unsigned long max_ivor = 0; - r = kvmppc_core_check_processor_compat(); + r = kvmppc_e500_check_processor_compat(); if (r) goto err_out; diff --git a/arch/powerpc/kvm/e500mc.c b/arch/powerpc/kvm/e500mc.c index 57e0ad6a2ca3..795667f7ebf0 100644 --- a/arch/powerpc/kvm/e500mc.c +++ b/arch/powerpc/kvm/e500mc.c @@ -388,6 +388,10 @@ static int __init kvmppc_e500mc_init(void) { int r; + r = kvmppc_e500mc_check_processor_compat(); + if (r) + return kvmppc_e500mc; + r = kvmppc_booke_init(); if (r) goto err_out; diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index 5faf69421f13..d44b85ba8cef 100644 --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c @@ -442,7 +442,7 @@ int kvm_arch_hardware_enable(void) int kvm_arch_check_processor_compat(void *opaque) { - return kvmppc_core_check_processor_compat(); + return 0; } int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)