Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp593553pxb; Tue, 15 Feb 2022 23:10:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJz7GPHAZ8DrnLc+i1lKttkEEZdmVyleNZZqLIdWT7IBVdGZ4VJbpdWprElypRFC27QL/FUg X-Received: by 2002:a17:902:b401:b0:14d:a09a:fdc2 with SMTP id x1-20020a170902b40100b0014da09afdc2mr1208190plr.131.1644995403539; Tue, 15 Feb 2022 23:10:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644995403; cv=none; d=google.com; s=arc-20160816; b=oyIiheKRX96MSgwzWS6l8Ns0JE4p0CP0JJlo5/nEuIMWGwWLEjFcSUhf8oHKt6syFW Z/eHMJ4t9bJJ9lGb/HyVDAjXVt23PJmIbHYqXBlilUMWTCda1viWTelOoISLCtwrggZZ 1S8qmarwGuEbdxsuHbvO3AxJBNPxnqyAhARaXG1T9kXhJb4RjN470PajyXiGv65a8TgL K+LzpG5OXyxby8ELqlr5HmgDN6qC+43hlxEnjGSMPhpDcMFWFpxq6iB3lesYfFIx2AuA 8BoJPSLYvfgavAOQjMkrB/L+nRHw9nOHkx9K7WdQhvzCE3J2G6dQpM25lpS1DDFQGSOP CP2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1ThFOQM5ZLiNTAtiMwsKTOqwc6hWvcuyFJvQhL+o9uk=; b=CKRNvm3Zk83+oce9eNr/f8Y7KNQZ3/A07+Ddf9GCqpn+A1B8ArRd48dgFC0UqQqLH8 ZlqQdriJAxvcWcya0mTJsejtDSh263PS+qWhIzTUK4nAuaGLK5TkTJ9CLw0ONkEoIbcz ZRAGhOhmxvQpNcDvjuoDnEN24Bnrkvda3nghoP9jpgGQbZPFw65vbVTT4rq8FmFiyPvA 1MYDdn1PV5sGGPKi0hemzDkL/RhrB3+EbXFuzyeWlL7cdR5SwNG0/WMffjdm9dYW0Lir 1HxvOTFvK/mG5uAl0+1x4MPqtmXHdFOPLxTB7TeRck03WmiqhFjdoXRmVPkPDA6yIIrl 5hWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=CLunqwH7; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id k71si2360499pgd.599.2022.02.15.23.10.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Feb 2022 23:10:03 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=CLunqwH7; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 680F9197; Tue, 15 Feb 2022 22:46:25 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344132AbiBPDQR (ORCPT + 99 others); Tue, 15 Feb 2022 22:16:17 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:58094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241101AbiBPDQQ (ORCPT ); Tue, 15 Feb 2022 22:16:16 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2EE7DCE0D; Tue, 15 Feb 2022 19:16:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644981364; x=1676517364; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OL/CJpx3e1GRIpNB1pTJCWsC1hGcn+U6/rlTNg6FcmQ=; b=CLunqwH7BLPaZ1oQbBmQrX13uXAoTbppuSJEduZSamzC7arLYfuggNy5 oLWMi1fwM8s2nKVXx9Vpn9g3e+W++02/R+Yu9YVv6JSL/ju0rLiDdL4mX v9p0BJqRNnvt8r14iu53o4mXlM3CbS0EKYR3nJhRLxIOC34sYtGzZHWjt tVc8MYu8yOPY3p05MhypP3/42aN/2ju2JRKPzth1yoXW+UhozFoPmpPVU 6lNjaCEvJh+9SEfxJjxVH4msWBugl8OFJGePJRBB8T6DfYc5TtqTY3na0 e0sgmbQeiJ5XtOZOGFSPycQ5Maq2iEKp5W3W5PdP35YmOhXXkpJIzRFX5 Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10259"; a="248110834" X-IronPort-AV: E=Sophos;i="5.88,371,1635231600"; d="scan'208";a="248110834" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Feb 2022 19:16:04 -0800 X-IronPort-AV: E=Sophos;i="5.88,371,1635231600"; d="scan'208";a="773798219" Received: from hyperv-sh4.sh.intel.com ([10.239.48.22]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Feb 2022 19:15:54 -0800 From: Chao Gao To: seanjc@google.com, maz@kernel.org, kvm@vger.kernel.org, pbonzini@redhat.com, kevin.tian@intel.com, tglx@linutronix.de Cc: Chao Gao , James Morse , Alexandru Elisei , Suzuki K Poulose , Catalin Marinas , Will Deacon , Huacai Chen , Aleksandar Markovic , Thomas Bogendoerfer , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Anup Patel , Atish Patra , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , David Hildenbrand , Claudio Imbrenda , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Sven Schnelle , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , "Maciej S. Szmigiero" , Bharata B Rao , Nicholas Piggin , Nick Desaulniers , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, 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 Subject: [PATCH v4 2/6] Partially revert "KVM: Pass kvm_init()'s opaque param to additional arch funcs" Date: Wed, 16 Feb 2022 11:15:17 +0800 Message-Id: <20220216031528.92558-3-chao.gao@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220216031528.92558-1-chao.gao@intel.com> References: <20220216031528.92558-1-chao.gao@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 This partially reverts commit b99040853738 ("KVM: Pass kvm_init()'s opaque param to additional arch funcs") remove opaque from kvm_arch_check_processor_compat because no one uses this opaque now. Address conflicts for ARM (due to file movement) and manually handle RISC-V which comes after the commit. And changes about kvm_arch_hardware_setup() in original commit are still needed so they are not reverted. Signed-off-by: Chao Gao Reviewed-by: Sean Christopherson --- arch/arm64/kvm/arm.c | 2 +- arch/mips/kvm/mips.c | 2 +- arch/powerpc/kvm/powerpc.c | 2 +- arch/riscv/kvm/main.c | 2 +- arch/s390/kvm/kvm-s390.c | 2 +- arch/x86/kvm/x86.c | 2 +- include/linux/kvm_host.h | 2 +- virt/kvm/kvm_main.c | 16 +++------------- 8 files changed, 10 insertions(+), 20 deletions(-) diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c index ecc5958e27fe..0165cf3aac3a 100644 --- a/arch/arm64/kvm/arm.c +++ b/arch/arm64/kvm/arm.c @@ -73,7 +73,7 @@ int kvm_arch_hardware_setup(void *opaque) return 0; } -int kvm_arch_check_processor_compat(void *opaque) +int kvm_arch_check_processor_compat(void) { return 0; } diff --git a/arch/mips/kvm/mips.c b/arch/mips/kvm/mips.c index a25e0b73ee70..092d09fb6a7e 100644 --- a/arch/mips/kvm/mips.c +++ b/arch/mips/kvm/mips.c @@ -140,7 +140,7 @@ int kvm_arch_hardware_setup(void *opaque) return 0; } -int kvm_arch_check_processor_compat(void *opaque) +int kvm_arch_check_processor_compat(void) { return 0; } diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index 2ad0ccd202d5..30c817f3fa0c 100644 --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c @@ -423,7 +423,7 @@ int kvm_arch_hardware_setup(void *opaque) return 0; } -int kvm_arch_check_processor_compat(void *opaque) +int kvm_arch_check_processor_compat(void) { return kvmppc_core_check_processor_compat(); } diff --git a/arch/riscv/kvm/main.c b/arch/riscv/kvm/main.c index 2e5ca43c8c49..992877e78393 100644 --- a/arch/riscv/kvm/main.c +++ b/arch/riscv/kvm/main.c @@ -20,7 +20,7 @@ long kvm_arch_dev_ioctl(struct file *filp, return -EINVAL; } -int kvm_arch_check_processor_compat(void *opaque) +int kvm_arch_check_processor_compat(void) { return 0; } diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index 577f1ead6a51..0053b81c6b02 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -252,7 +252,7 @@ int kvm_arch_hardware_enable(void) return 0; } -int kvm_arch_check_processor_compat(void *opaque) +int kvm_arch_check_processor_compat(void) { return 0; } diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 9b484ed61f37..ffb88f0b7265 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -11509,7 +11509,7 @@ void kvm_arch_hardware_unsetup(void) static_call(kvm_x86_hardware_unsetup)(); } -int kvm_arch_check_processor_compat(void *opaque) +int kvm_arch_check_processor_compat(void) { struct cpuinfo_x86 *c = &cpu_data(smp_processor_id()); diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index f11039944c08..2ad78e729bf7 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -1413,7 +1413,7 @@ int kvm_arch_hardware_enable(void); void kvm_arch_hardware_disable(void); int kvm_arch_hardware_setup(void *opaque); void kvm_arch_hardware_unsetup(void); -int kvm_arch_check_processor_compat(void *opaque); +int kvm_arch_check_processor_compat(void); 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 83c57bcc6eb6..ee47d33d69e1 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -5643,22 +5643,14 @@ void kvm_unregister_perf_callbacks(void) } #endif -struct kvm_cpu_compat_check { - void *opaque; - int *ret; -}; - -static void check_processor_compat(void *data) +static void check_processor_compat(void *rtn) { - struct kvm_cpu_compat_check *c = data; - - *c->ret = kvm_arch_check_processor_compat(c->opaque); + *(int *)rtn = kvm_arch_check_processor_compat(); } int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align, struct module *module) { - struct kvm_cpu_compat_check c; int r; int cpu; @@ -5686,10 +5678,8 @@ int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align, if (r < 0) goto out_free_1; - c.ret = &r; - c.opaque = opaque; for_each_online_cpu(cpu) { - smp_call_function_single(cpu, check_processor_compat, &c, 1); + smp_call_function_single(cpu, check_processor_compat, &r, 1); if (r < 0) goto out_free_2; } -- 2.25.1