Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1257974rwb; Thu, 22 Sep 2022 12:19:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5VZJUS7DfgPU0pz1yWINL5XyOHaguFkNejTnHn/M3ua85v2GtYMe3XgCSH0LM1hpLlzsw9 X-Received: by 2002:a17:907:7621:b0:741:6656:bd14 with SMTP id jy1-20020a170907762100b007416656bd14mr4081092ejc.298.1663874373588; Thu, 22 Sep 2022 12:19:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663874373; cv=none; d=google.com; s=arc-20160816; b=rQgYKVEVFApvL2L5C72YfsD/8OX/9mtSds70fW6UixH9fCv8UJafgruOTJnBk//e+b ni8lqUSz0OssFRj+c33tY9MeOmoa1HZJmvAeni86+7008Z9n+oSDpIucRp3k8tNWM41R 8xD48AkKJyuM6AEI4UeopLnslhkcPApL31rzy0wM1jQbRcWoFh9YcSjrXU6lJapZ4UHE pTFx1rtqsez4wYtFHtMvd4pqJCXrWfl5Fvif+g9gMUqiueQqTFMJcKQXP3uJlPMXs+85 1CpnyjPG6beFmVDk+A3Gzzx4inYNe+8iJD2LU+rc0UCXgN9sNiuTsiud4ok35ts++vYQ RbGw== 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=MeC0TSDJSal1HFRDCXVv6+XwwlkPBIE6/a7rqksqeXU=; b=OOzOP8qmuGbsPSa7vGUlmnAwpEy0StCrpKPpAQ/EjYAb02IPKoxKwoUZVZyGQH5iRT FW6SYCcZW2f3hQKDWORgZKswyc1l36T2J8PEkOzdlhgZDLVXocifJP7skBtzYaq+WSoE cUbws3h8kKiEXjghvdA5rzTIZm4OuzlSvaBJlOHbjkJJeBpnzhxlsL1tuXYq9bEkOKCA vnLgEKTvpg+El2DORl4lCH+t+FjYWXCJ0FZRcU6SK/mgO8x3D06IasEZ/Otsy0Z9L1in Aopkv49K4yUEMoXr7O31cLH6mHOe3FyEzxHbfxzqWLpsbD+lzyRFAn8lLanlw6u/+cPd jtQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=cDI3fXPk; 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=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d5-20020a50ea85000000b00450c8cd976esi4869343edo.224.2022.09.22.12.19.08; Thu, 22 Sep 2022 12:19:33 -0700 (PDT) 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=@intel.com header.s=Intel header.b=cDI3fXPk; 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=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231600AbiIVSVk (ORCPT + 99 others); Thu, 22 Sep 2022 14:21:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231220AbiIVSVY (ORCPT ); Thu, 22 Sep 2022 14:21:24 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0C6410AB10; Thu, 22 Sep 2022 11:21:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663870883; x=1695406883; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=4rIEhITIti8CDX64fvcn1ALaGLiMyhto8tKD00HaSAA=; b=cDI3fXPkHpgCFYGBx86iIKPl8sCRXznXk5NPHwPE+s2ZRBGvu8iUNIZ4 QZPWvYF0dE5H0MSfdTHTYwrbysmZ5RrxOFtO1ElN8TWpDN6O2noYtP3Fq Z+13QoSz7aMh25/6ck+BKRbm+S25+B45rXDsDJri+ZhdJ7oFvHesIW97W tIhm9b3xtcmG6OugUI7qiYcC51eRwe769Jkj+rUNnybuY9w/G88CRdLhH q/F8930zk+MXaz1fQtNrB66JOrt23DmEj5Rvfvw7WCQHHr5O0L2c/4int wF86vykhhCF9Zs4l1f2+gEgYp+MIBk+K5cV3cAB/cnuj6WXq2Cv/hg/SS w==; X-IronPort-AV: E=McAfee;i="6500,9779,10478"; a="386675942" X-IronPort-AV: E=Sophos;i="5.93,337,1654585200"; d="scan'208";a="386675942" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2022 11:21:15 -0700 X-IronPort-AV: E=Sophos;i="5.93,337,1654585200"; d="scan'208";a="653086646" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2022 11:21:14 -0700 From: isaku.yamahata@intel.com To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Paolo Bonzini , Sean Christopherson , Thomas Gleixner , Marc Zyngier , Will Deacon Cc: isaku.yamahata@intel.com, isaku.yamahata@gmail.com, Kai Huang , Chao Gao , Atish Patra , Shaokun Zhang , Daniel Lezcano , Huang Ying , Huacai Chen , Dave Hansen , Borislav Petkov , Suzuki K Poulose , Anup Patel , Claudio Imbrenda , Yuan Yao Subject: [PATCH v5 04/30] Partially revert "KVM: Pass kvm_init()'s opaque param to additional arch funcs" Date: Thu, 22 Sep 2022 11:20:33 -0700 Message-Id: <0e20f8df9549cbee3b764a2a07735b78da4f50a4.1663869838.git.isaku.yamahata@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham 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 From: Chao Gao 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 Reviewed-by: Suzuki K Poulose Acked-by: Anup Patel Acked-by: Claudio Imbrenda Link: https://lore.kernel.org/r/20220216031528.92558-3-chao.gao@intel.com Signed-off-by: Isaku Yamahata Reviewed-by: Kai Huang Reviewed-by: Yuan Yao --- 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 2ff0ef62abad..3385fb57c11a 100644 --- a/arch/arm64/kvm/arm.c +++ b/arch/arm64/kvm/arm.c @@ -68,7 +68,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 fb1490761c87..7b56d6ccfdfb 100644 --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c @@ -447,7 +447,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 1549205fe5fe..f8d6372d208f 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 edfd4bbd0cba..e26d4dd85668 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -254,7 +254,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 34c7336ac581..230812d6cbfd 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -12028,7 +12028,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 f4519d3689e1..eab352902de7 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -1438,7 +1438,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 584a5bab3af3..4243a9541543 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -5799,22 +5799,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; @@ -5842,10 +5834,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