Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp1257956rwn; Thu, 8 Sep 2022 16:27:35 -0700 (PDT) X-Google-Smtp-Source: AA6agR4wr7I5A3b5yNvXxwppFDHEdhInXEEl9FxSbMwrEGBmmdNu/0t4f6CbWtoEplitVFVGkZJL X-Received: by 2002:a05:6a00:1410:b0:528:5a5a:d846 with SMTP id l16-20020a056a00141000b005285a5ad846mr11740052pfu.9.1662679655352; Thu, 08 Sep 2022 16:27:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662679655; cv=none; d=google.com; s=arc-20160816; b=TzI1UTkYJFPLpTIdbSzIO07Q9MpIK14pB5aVXXFtYGhDb6CT+aZA+nmYiikZLCwIqh q7nI6gh60we1Q1g/7qWb27l+sLwd3bh7uRHEeG7jg4KL3cv1EiMsgY7EKihgowVgzJql D80sZhHAfHwuvuOYbDItpGKW4eo87NC49mVPcCI8tbjF9fisGAxrM/Y6jG/Nn3kDdA4s RY+lsb+iaBtrJdIdXPiO6GstRnGb/Njtw7qjOhIciWv+sianAtjqs/6qTw7g2dbx/M7P vRwG6ZKVO4jf0h88JQI6IOe06Hnp8EfMb+Vj1b7JDd5J3ylNwx3WmayWytRyxqGnkaPD QtjQ== 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=c0HJ97MBVDtt8DV5YOwZ7YFnMIuquDqFHfDmSvdnCMg=; b=q+ya9yjHWHS69YodRBlXVhjCDHqYaUOt2nkb8oJRKk/0K0DHJOOgPdSeeAKfePsJy6 X3tS7qHADhx8qjX7rbxXM14JkSuyjbcsQVXfqmjug1cg6bViLKFAHZ9qntOZxjp2j5Si cCkc+r+h8HPtvHH7TfihAmyX0J6od/P4bkV29f50fdfZ0nvVtSfjCEJ+2tWsUNkYKDLL qbhwg8gYblz0IIhs90vH0ctbsqzb8w7jX+RmXwMx42G5eeAEPBvHXeyyUhKw9pqGQNSP 5vNolqPldY1b7R+gi+X6SrfqVtxa754QQiBMXo7QXPE1FKUCpZRNE540rblutIE8MrXm A3Cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=KMwaQELq; 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 o1-20020a639201000000b0042b59c58ab1si41667pgd.498.2022.09.08.16.27.23; Thu, 08 Sep 2022 16:27:35 -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=KMwaQELq; 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 S230078AbiIHX0S (ORCPT + 99 others); Thu, 8 Sep 2022 19:26:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229845AbiIHX0H (ORCPT ); Thu, 8 Sep 2022 19:26:07 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FB6CE5802; Thu, 8 Sep 2022 16:26:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662679566; x=1694215566; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=53WzOSf0JGtTh5VFYsrLaKgBl/Q3W0LzCWVRRVwS+nw=; b=KMwaQELqlcE2e0/mFPRhPCF3qWsAoCzVqvTpWO9b71CGugnuD8/uDy6H S88zxSyJDFtsdQZTniFrBP17CJmcBJOUq4FbbUqjHGRNm6SnJlVRdqc7e yKp9KVARJn1u8pKXuLudWWKyaFkVI1c6UuuxX3The9t5YPUnXH2zylDM7 7kED03hxChZoZ/NA1zjnvCdI9JNEhgSpMOdzPbR2Ib4FC2JmEPCIViMdo t5FaFR6+BPCDfYZP5leXQYhlcGPyNQXVNsd2NdEMEM0StEGYaEIhAuACy 7mXK0JDq6Pup8nq/9ibj8eiY/lsiHKdCvc4eT/ZmOtv4Dm1WAwTn1jgYZ w==; X-IronPort-AV: E=McAfee;i="6500,9779,10464"; a="298686977" X-IronPort-AV: E=Sophos;i="5.93,300,1654585200"; d="scan'208";a="298686977" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Sep 2022 16:26:05 -0700 X-IronPort-AV: E=Sophos;i="5.93,300,1654585200"; d="scan'208";a="610863157" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Sep 2022 16:26:04 -0700 From: isaku.yamahata@intel.com To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Paolo Bonzini , Sean Christopherson , Marc Zyngier , Will Deacon , Yuan Yao Cc: isaku.yamahata@intel.com, isaku.yamahata@gmail.com, Kai Huang , Chao Gao , Atish Patra , Shaokun Zhang , Qi Liu , John Garry , Daniel Lezcano , Huang Ying , Huacai Chen , Suzuki K Poulose , Anup Patel , Claudio Imbrenda , Yuan Yao Subject: [PATCH v4 04/26] Partially revert "KVM: Pass kvm_init()'s opaque param to additional arch funcs" Date: Thu, 8 Sep 2022 16:25:20 -0700 Message-Id: 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,T_SCC_BODY_TEXT_LINE 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 a7fa55ba344d..f6f014e78ab9 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -11998,7 +11998,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