Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp1260576rwn; Thu, 8 Sep 2022 16:30:52 -0700 (PDT) X-Google-Smtp-Source: AA6agR6H1yc++Gdbh3wN7oPlTkvc+W9MVtW3MoV2yNp7jLlNSZZvXYYQ+TwcbQhHM3HLvWJAEPQi X-Received: by 2002:ac2:5462:0:b0:48b:2a7b:3c15 with SMTP id e2-20020ac25462000000b0048b2a7b3c15mr3601308lfn.489.1662679852355; Thu, 08 Sep 2022 16:30:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662679852; cv=none; d=google.com; s=arc-20160816; b=v0MdK10SNh0RXpSLqXmV+iCvZK/GwLqk4VdbkdlgHb1IExpDO2bi4RxagL2qXsk1Uf 2ZhwUJULtyMTbHLEMcitqL/So4ye+Baa1F0vfiPoapBTAktw943roJB9GQ0n4buFaB88 ut2dP69TYbJjSDioZe9b/zVqrWESVGjaiGBk/X4pAD3NPv3RiYk3HxIuApw5Nn1/C302 eFKpuJP8J6Xq3EpoLwEp2eKaB6QCu1awkYPu9eIsJdqYpcIyL0SXOmSorhVHj/XT3Tj7 bnI8YEgyyvPywsAxAhNeTcnMK38R+h1forI7ZR91c1SKR08qWEwz7txrWAXVTbnkQ+PF 8oPw== 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=QtcMCCL3ahb1dvfRBYQrgQyjJ3Cv3jdsTAZJ7k0MoTM=; b=UIJqiuBDbEtYHkk/mSIMvlJveoMPoB/VhJQrCElMwqAFeJVf2Mt909rxddWXjpOrTG lnocRxtlEgpIq/qa8z6zwwkmqJ7+Ivjke8mYNMKlqtPN53zneRLLyl0btFaqWdLEkQZo MuRFdCaxYUwqTDE22XRAn68IABxKmBt/gEAa0rVi8mmYov3+awdGRm5U1Dfbw4JOmIZE E5B/wI/KRmRUBzN+MvYdkCn7jVLAvP70PynhXV85KtsqOEDEQInMv1rIjP0quj0sQFQQ yhvd+ofzU68k/M3q2ShidxQLPr5OEVQ+Z5rmzK9yse5WeOKbW+AItW7Zvlnx7oCFXUnc 9XSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=VdH9HOw+; 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 z40-20020a2ebe28000000b0026acef2f003si111593ljq.192.2022.09.08.16.30.22; Thu, 08 Sep 2022 16:30:52 -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=VdH9HOw+; 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 S230361AbiIHX2O (ORCPT + 99 others); Thu, 8 Sep 2022 19:28:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230147AbiIHX1C (ORCPT ); Thu, 8 Sep 2022 19:27:02 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 054B7115CF2; Thu, 8 Sep 2022 16:26:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662679586; x=1694215586; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jWuQBoK0q0gfpKRVUiGWH6TTCqtzESEI7BQKtOCQK/A=; b=VdH9HOw+wpKg/YHb1ccH+wr82NYVKGrSxAoymdPA+k69luFufPjukpal BcFl6jIn0onEea7Ji0wkniJvTCpn+nRhj/QAC1D+9DNywbyM3qTAP0Dv5 aV76/h4vr+rekk3fiOPDMh64Jq4dJOGY5KyB3InA5jHT1VrzvLCro57x7 ZWxw8/2pkxy1u4LjP+rDW2gdidtBirfU+OdFV3VbAZDtFeeNTbm9gQyEm Q6mYUal53/iiXXZs8Q0h3mK4vbWKGk2MClnUyvGdZDclpF95z7DlTtiQv Bk03Hnd+YXrhsfSv0f98lscqECeluYnBtMzU+71takedPf1x/+NtP1k1z A==; X-IronPort-AV: E=McAfee;i="6500,9779,10464"; a="298687045" X-IronPort-AV: E=Sophos;i="5.93,300,1654585200"; d="scan'208";a="298687045" 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:16 -0700 X-IronPort-AV: E=Sophos;i="5.93,300,1654585200"; d="scan'208";a="610863281" 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:15 -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 , linuxppc-dev@lists.ozlabs.org, Fabiano Rosas Subject: [PATCH v4 23/26] RFC: KVM: powerpc: Move processor compatibility check to hardware setup Date: Thu, 8 Sep 2022 16:25:39 -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: Isaku Yamahata Move processor compatibility check from kvm_arch_processor_compat() into kvm_arch_hardware_setup(). The check does model name comparison with a global variable, cur_cpu_spec. There is no point to check it at run time on all processors. Suggested-by: Sean Christopherson Signed-off-by: Isaku Yamahata Cc: linuxppc-dev@lists.ozlabs.org Cc: Fabiano Rosas --- arch/powerpc/kvm/powerpc.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index 7b56d6ccfdfb..7e3a6659f107 100644 --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c @@ -444,12 +444,21 @@ int kvm_arch_hardware_enable(void) int kvm_arch_hardware_setup(void *opaque) { - return 0; + /* + * kvmppc_core_check_processor_compat() checks the global variable. + * No point to check on all processors or at runtime. + * 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") + */ + return kvmppc_core_check_processor_compat(); } int kvm_arch_check_processor_compat(void) { - return kvmppc_core_check_processor_compat(); + return 0; } int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) -- 2.25.1