Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1126974rwb; Sun, 6 Nov 2022 19:58:51 -0800 (PST) X-Google-Smtp-Source: AMsMyM6HbFWxIxGA21j/zOfrL/OIR/lPQGITjP3LtP/ct7IxY9nm2wfFWBwWrCzI1ZpytXgLSeyh X-Received: by 2002:a05:6402:448c:b0:457:52eb:b57e with SMTP id er12-20020a056402448c00b0045752ebb57emr48702666edb.178.1667793530957; Sun, 06 Nov 2022 19:58:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667793530; cv=none; d=google.com; s=arc-20160816; b=jjbztd/tQcp8Fvf7/p6lV7FLYOjFN9RRGzW9QGCBgo9pNaMbAaq6buLbY3YEk9uxcK 1SgmfDIpBJQJ/7FJJb96v4pX/RGXJ5jdCwRrBYYDr7S2Fn3CVrUPRcFeBEXhj3mkvVng 7+Y0em8Bt2OwcwAapdFMijCvlgX/3Xla0Bce7cFHdYwKs5LqH8xNVgnR2gAb/1Mm42VG Ke/OmRvaHekbXoMHpfTzDoj2qx/096q12snb7CSsn2dgjl5HhjEY9su5+uq+bGZSe3X0 lLZwEGZu2oVHXrCD8cqw5m1LKinNVDHtZfl0CheIDxuo6YqxbsiD51UwQCaLvG6L4M9K 5iXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=TxlM+axyaXX3sHvVH3hsOYNJG1nMiEhs07IUTNZQ5Hw=; b=niVL6DOxuacnFaa+MlQZRBjj1V/CNatML2SLuVr6qgzVkNoVF8GRFl8nYx1YLXiN2I P+1yJBe4Kluic7sI6VyMXwVDICagqLxNcwqXmIWOKdDrCYv1Hio0PB/B5XgoIcT9498E ZblhbU1T2/u0g2OuLBEvY0yFYsfjBhkcra6Ml8XhK0e+IuNtc/4ysPuPaIVmYzhgP/hd JweHivXvt//XnqAE9y0wgi/uCHegZk6BPruoVaty1n/Tg4PnDn8l8WW2pXDSQDYRBsxc VmDjcP2mqHkt19MnTwtJ3rgT58rpERvKYYELICzQLJsr1Mpw7WHgRN7pvE+Lv8Kx92y8 mYFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20210112.gappssmtp.com header.s=20210112 header.b="ic/9SFvg"; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p17-20020a056402045100b004617c3c9297si7325245edw.252.2022.11.06.19.58.28; Sun, 06 Nov 2022 19:58:50 -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=@brainfault-org.20210112.gappssmtp.com header.s=20210112 header.b="ic/9SFvg"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231299AbiKGDT5 (ORCPT + 96 others); Sun, 6 Nov 2022 22:19:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230490AbiKGDTn (ORCPT ); Sun, 6 Nov 2022 22:19:43 -0500 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38F5513D24 for ; Sun, 6 Nov 2022 19:16:32 -0800 (PST) Received: by mail-ej1-x636.google.com with SMTP id f5so26782542ejc.5 for ; Sun, 06 Nov 2022 19:16:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20210112.gappssmtp.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=TxlM+axyaXX3sHvVH3hsOYNJG1nMiEhs07IUTNZQ5Hw=; b=ic/9SFvgsfWznS4GjPar/gpnVAJneAnLlIRhcZgN0xG3lv0KJMbv1MEZIZvAGUm7uk cdn6XEacyoDfnUim125KMFwJOCKsiWYGTp7qBReOOhoErc9w04YAB6iN7hw2UUAdSwhh xRe4pW+DTQwHwUxCURdhr/OByoqRpcg14rmL4bRRO/NYlqH2FMCQ+r/9aMcxbKqCbhL6 d/GDOmR5AmOHtzkWgt/1yuYnLxCinDSvkWHC6/0OBCegZtU6oIZb+aP7iqvHt3htnDU6 3bBkVfyNQ21o89QOJ7f0UqopqZmm46lWsZ64I/FQSpV/FuqYmuL2smhXyU7CPD0EKRTg q+FQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=TxlM+axyaXX3sHvVH3hsOYNJG1nMiEhs07IUTNZQ5Hw=; b=dWnAJrs+uEXvA4ROy03iQ33G/TeZbCVqwMBDPZTuWO7GU/MJlOCxkx2CwPZnol4tW2 HD72ZKWkTiiyyRMA+p12t+x2M3SErIrBYdqcUeK0B2PXTk82SXXwipkUYyqpZzrG1Dt/ VbOdHPRhFA9P/Thn3yW1PeLBh10+uzv+4040k3/hAF6KTT6aPzSFA/+DdXir/TvpHoZB jxAUuyLqEpI4MQQKFCopF6lWUaivZwpyblsm/n0jhyAyPAWO69N1YafxbPLN3k9lPOf+ aUYuQ0W1Pvb2f3eJ1rwlP6HV1Ge+N07CVRSLLE5Ncuhw6avU9A4oykGvf0le+dkmOatw KYjg== X-Gm-Message-State: ACrzQf3AYTxwlyZivHnSa3BD3cQxy6Wyhgvn7qhjtUYzxP1+wZtkq8Ct oMsMX5KAvP+zSyB3iKLRGRCfFuHz37ZS1N1tuRyilA== X-Received: by 2002:a17:906:eec7:b0:733:189f:b07a with SMTP id wu7-20020a170906eec700b00733189fb07amr46213879ejb.230.1667790985769; Sun, 06 Nov 2022 19:16:25 -0800 (PST) MIME-Version: 1.0 References: <20221102231911.3107438-1-seanjc@google.com> <20221102231911.3107438-31-seanjc@google.com> In-Reply-To: <20221102231911.3107438-31-seanjc@google.com> From: Anup Patel Date: Mon, 7 Nov 2022 08:46:14 +0530 Message-ID: Subject: Re: [PATCH 30/44] KVM: Drop kvm_arch_check_processor_compat() hook To: Sean Christopherson Cc: Paolo Bonzini , Marc Zyngier , Huacai Chen , Aleksandar Markovic , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Matthew Rosato , Eric Farman , Vitaly Kuznetsov , James Morse , Alexandru Elisei , Suzuki K Poulose , Oliver Upton , Atish Patra , David Hildenbrand , 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, Isaku Yamahata , Fabiano Rosas , Michael Ellerman , Chao Gao , Thomas Gleixner , Yuan Yao Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE 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: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 3, 2022 at 4:50 AM Sean Christopherson wrote: > > Drop kvm_arch_check_processor_compat() and its support code now that all > architecture implementations are nops. > > Signed-off-by: Sean Christopherson For KVM RISC-V: Acked-by: Anup Patel Thanks, Anup > --- > arch/arm64/kvm/arm.c | 7 +------ > arch/mips/kvm/mips.c | 7 +------ > arch/powerpc/kvm/book3s.c | 2 +- > arch/powerpc/kvm/e500.c | 2 +- > arch/powerpc/kvm/e500mc.c | 2 +- > arch/powerpc/kvm/powerpc.c | 5 ----- > arch/riscv/kvm/main.c | 7 +------ > arch/s390/kvm/kvm-s390.c | 7 +------ > arch/x86/kvm/svm/svm.c | 4 ++-- > arch/x86/kvm/vmx/vmx.c | 4 ++-- > arch/x86/kvm/x86.c | 5 ----- > include/linux/kvm_host.h | 4 +--- > virt/kvm/kvm_main.c | 24 +----------------------- > 13 files changed, 13 insertions(+), 67 deletions(-) > > diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c > index 75c5125b0dd3..ed1836b6f044 100644 > --- a/arch/arm64/kvm/arm.c > +++ b/arch/arm64/kvm/arm.c > @@ -63,11 +63,6 @@ int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu) > return kvm_vcpu_exiting_guest_mode(vcpu) == IN_GUEST_MODE; > } > > -int kvm_arch_check_processor_compat(void *opaque) > -{ > - return 0; > -} > - > int kvm_vm_ioctl_enable_cap(struct kvm *kvm, > struct kvm_enable_cap *cap) > { > @@ -2268,7 +2263,7 @@ static __init int kvm_arm_init(void) > * FIXME: Do something reasonable if kvm_init() fails after pKVM > * hypervisor protection is finalized. > */ > - err = kvm_init(NULL, sizeof(struct kvm_vcpu), 0, THIS_MODULE); > + err = kvm_init(sizeof(struct kvm_vcpu), 0, THIS_MODULE); > if (err) > goto out_subs; > > diff --git a/arch/mips/kvm/mips.c b/arch/mips/kvm/mips.c > index 3cade648827a..36c8991b5d39 100644 > --- a/arch/mips/kvm/mips.c > +++ b/arch/mips/kvm/mips.c > @@ -135,11 +135,6 @@ void kvm_arch_hardware_disable(void) > kvm_mips_callbacks->hardware_disable(); > } > > -int kvm_arch_check_processor_compat(void *opaque) > -{ > - return 0; > -} > - > extern void kvm_init_loongson_ipi(struct kvm *kvm); > > int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) > @@ -1636,7 +1631,7 @@ static int __init kvm_mips_init(void) > > register_die_notifier(&kvm_mips_csr_die_notifier); > > - ret = kvm_init(NULL, sizeof(struct kvm_vcpu), 0, THIS_MODULE); > + ret = kvm_init(sizeof(struct kvm_vcpu), 0, THIS_MODULE); > if (ret) { > unregister_die_notifier(&kvm_mips_csr_die_notifier); > return ret; > diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c > index 87283a0e33d8..57f4e7896d67 100644 > --- a/arch/powerpc/kvm/book3s.c > +++ b/arch/powerpc/kvm/book3s.c > @@ -1052,7 +1052,7 @@ static int kvmppc_book3s_init(void) > { > int r; > > - r = kvm_init(NULL, sizeof(struct kvm_vcpu), 0, THIS_MODULE); > + r = kvm_init(sizeof(struct kvm_vcpu), 0, THIS_MODULE); > if (r) > return r; > #ifdef CONFIG_KVM_BOOK3S_32_HANDLER > diff --git a/arch/powerpc/kvm/e500.c b/arch/powerpc/kvm/e500.c > index 0ea61190ec04..b0f695428733 100644 > --- a/arch/powerpc/kvm/e500.c > +++ b/arch/powerpc/kvm/e500.c > @@ -531,7 +531,7 @@ static int __init kvmppc_e500_init(void) > flush_icache_range(kvmppc_booke_handlers, kvmppc_booke_handlers + > ivor[max_ivor] + handler_len); > > - r = kvm_init(NULL, sizeof(struct kvmppc_vcpu_e500), 0, THIS_MODULE); > + r = kvm_init(sizeof(struct kvmppc_vcpu_e500), 0, THIS_MODULE); > if (r) > goto err_out; > kvm_ops_e500.owner = THIS_MODULE; > diff --git a/arch/powerpc/kvm/e500mc.c b/arch/powerpc/kvm/e500mc.c > index 795667f7ebf0..611532a0dedc 100644 > --- a/arch/powerpc/kvm/e500mc.c > +++ b/arch/powerpc/kvm/e500mc.c > @@ -404,7 +404,7 @@ static int __init kvmppc_e500mc_init(void) > */ > kvmppc_init_lpid(KVMPPC_NR_LPIDS/threads_per_core); > > - r = kvm_init(NULL, sizeof(struct kvmppc_vcpu_e500), 0, THIS_MODULE); > + r = kvm_init(sizeof(struct kvmppc_vcpu_e500), 0, THIS_MODULE); > if (r) > goto err_out; > kvm_ops_e500mc.owner = THIS_MODULE; > diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c > index 34278042ad27..51268be60dac 100644 > --- a/arch/powerpc/kvm/powerpc.c > +++ b/arch/powerpc/kvm/powerpc.c > @@ -441,11 +441,6 @@ int kvm_arch_hardware_enable(void) > return 0; > } > > -int kvm_arch_check_processor_compat(void *opaque) > -{ > - return 0; > -} > - > int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) > { > struct kvmppc_ops *kvm_ops = NULL; > diff --git a/arch/riscv/kvm/main.c b/arch/riscv/kvm/main.c > index 4710a6751687..34c3dece6990 100644 > --- a/arch/riscv/kvm/main.c > +++ b/arch/riscv/kvm/main.c > @@ -20,11 +20,6 @@ long kvm_arch_dev_ioctl(struct file *filp, > return -EINVAL; > } > > -int kvm_arch_check_processor_compat(void *opaque) > -{ > - return 0; > -} > - > int kvm_arch_hardware_enable(void) > { > unsigned long hideleg, hedeleg; > @@ -110,6 +105,6 @@ static int __init riscv_kvm_init(void) > > kvm_info("VMID %ld bits available\n", kvm_riscv_gstage_vmid_bits()); > > - return kvm_init(NULL, sizeof(struct kvm_vcpu), 0, THIS_MODULE); > + return kvm_init(sizeof(struct kvm_vcpu), 0, THIS_MODULE); > } > module_init(riscv_kvm_init); > diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c > index 7c1c6d81b5d7..949231f1393e 100644 > --- a/arch/s390/kvm/kvm-s390.c > +++ b/arch/s390/kvm/kvm-s390.c > @@ -254,11 +254,6 @@ int kvm_arch_hardware_enable(void) > return 0; > } > > -int kvm_arch_check_processor_compat(void *opaque) > -{ > - return 0; > -} > - > /* forward declarations */ > static void kvm_gmap_notifier(struct gmap *gmap, unsigned long start, > unsigned long end); > @@ -5654,7 +5649,7 @@ static int __init kvm_s390_init(void) > if (r) > return r; > > - r = kvm_init(NULL, sizeof(struct kvm_vcpu), 0, THIS_MODULE); > + r = kvm_init(sizeof(struct kvm_vcpu), 0, THIS_MODULE); > if (r) { > __kvm_s390_exit(); > return r; > diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c > index 368b4db4b240..99c1ac2d9c84 100644 > --- a/arch/x86/kvm/svm/svm.c > +++ b/arch/x86/kvm/svm/svm.c > @@ -5144,8 +5144,8 @@ static int __init svm_init(void) > * Common KVM initialization _must_ come last, after this, /dev/kvm is > * exposed to userspace! > */ > - r = kvm_init(NULL, sizeof(struct vcpu_svm), > - __alignof__(struct vcpu_svm), THIS_MODULE); > + r = kvm_init(sizeof(struct vcpu_svm), __alignof__(struct vcpu_svm), > + THIS_MODULE); > if (r) > goto err_kvm_init; > > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c > index 26baaccb659a..25e28d368274 100644 > --- a/arch/x86/kvm/vmx/vmx.c > +++ b/arch/x86/kvm/vmx/vmx.c > @@ -8562,8 +8562,8 @@ static int __init vmx_init(void) > * Common KVM initialization _must_ come last, after this, /dev/kvm is > * exposed to userspace! > */ > - r = kvm_init(NULL, sizeof(struct vcpu_vmx), > - __alignof__(struct vcpu_vmx), THIS_MODULE); > + r = kvm_init(sizeof(struct vcpu_vmx), __alignof__(struct vcpu_vmx), > + THIS_MODULE); > if (r) > goto err_kvm_init; > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index 94831f1a1d04..5b7b551ae44b 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -12036,11 +12036,6 @@ void kvm_arch_hardware_disable(void) > drop_user_return_notifiers(); > } > > -int kvm_arch_check_processor_compat(void *opaque) > -{ > - return 0; > -} > - > bool kvm_vcpu_is_reset_bsp(struct kvm_vcpu *vcpu) > { > return vcpu->kvm->arch.bsp_vcpu_id == vcpu->vcpu_id; > diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h > index 6c2a28c4c684..0b96d836a051 100644 > --- a/include/linux/kvm_host.h > +++ b/include/linux/kvm_host.h > @@ -936,8 +936,7 @@ static inline void kvm_irqfd_exit(void) > { > } > #endif > -int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align, > - struct module *module); > +int kvm_init(unsigned vcpu_size, unsigned vcpu_align, struct module *module); > void kvm_exit(void); > > void kvm_get_kvm(struct kvm *kvm); > @@ -1444,7 +1443,6 @@ static inline void kvm_create_vcpu_debugfs(struct kvm_vcpu *vcpu) {} > > int kvm_arch_hardware_enable(void); > void kvm_arch_hardware_disable(void); > -int kvm_arch_check_processor_compat(void *opaque); > int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu); > bool kvm_arch_vcpu_in_kernel(struct kvm_vcpu *vcpu); > int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu); > diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c > index 17c852cb6842..dd13af9f06d5 100644 > --- a/virt/kvm/kvm_main.c > +++ b/virt/kvm/kvm_main.c > @@ -5814,36 +5814,14 @@ void kvm_unregister_perf_callbacks(void) > } > #endif > > -struct kvm_cpu_compat_check { > - void *opaque; > - int *ret; > -}; > - > -static void check_processor_compat(void *data) > +int kvm_init(unsigned vcpu_size, unsigned vcpu_align, struct module *module) > { > - struct kvm_cpu_compat_check *c = data; > - > - *c->ret = kvm_arch_check_processor_compat(c->opaque); > -} > - > -int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align, > - struct module *module) > -{ > - struct kvm_cpu_compat_check c; > int r; > int cpu; > > if (!zalloc_cpumask_var(&cpus_hardware_enabled, GFP_KERNEL)) > return -ENOMEM; > > - c.ret = &r; > - c.opaque = opaque; > - for_each_online_cpu(cpu) { > - smp_call_function_single(cpu, check_processor_compat, &c, 1); > - if (r < 0) > - goto out_free_2; > - } > - > r = cpuhp_setup_state_nocalls(CPUHP_AP_KVM_STARTING, "kvm/cpu:starting", > kvm_starting_cpu, kvm_dying_cpu); > if (r) > -- > 2.38.1.431.g37b22c650d-goog >