Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp694368rwi; Wed, 2 Nov 2022 17:21:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6pECzD6g00Wx26wqasUKeF4w4Tk/oXPbJVDWXeE811LVIQWVnOnn05AEXZvHYUvclygizr X-Received: by 2002:a62:1e04:0:b0:56d:a2cf:e7fb with SMTP id e4-20020a621e04000000b0056da2cfe7fbmr14808842pfe.48.1667434879805; Wed, 02 Nov 2022 17:21:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667434879; cv=none; d=google.com; s=arc-20160816; b=KyvA74ifWohHpGcwrBkqOcVTAVlyv5nmUDFvXcGPvCCU2NH//hnDUQGiN2AmV60i3i wI74bm8041HdTY6YgHHhfa0csLOUDzWOk1ersJR+hTQ+UQ0eBNIjtKPD5wdzmjs01PJR pD/JXkS+LEYXgwpvO/3GABjtfAh5wHCd/lr3YZ65oYJ2zeoj2sUe3SQ52hf0b5B5xqym Rck3F4hzbQqaaocs/5pexwoiFGgq0yEOs3e04aHykzo9Be3jA9wjuocPke3G68ELm950 UGlVSkDjnHvmTnHLk88OOYnYZF+/IDyHrbVBa2OdtTbUXmu/FmBJ6KkiKXZgSJAkDmIC 48uQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:reply-to:dkim-signature; bh=KSp9zIzHXrxcJceHX59wYlpimn2+3DBl6/EkdM22YDo=; b=CUpJnV2SxNFGI+REVR4fD0BTPTEGGHF5vD2WauEwIrw3afdHcX+5LHB1NEE/6oncZ5 v7+XgbcJ2gDe/u32ufIeTnZLXF7wmrODHdYS3a0bGhPeYflREAcZKvIbqmksgTYx8p43 pkGFSiDmfR3yX5+ASPbTwlCJg8JHLDGPHxFLNpUpIY5qxAotRqPs0fADZNGKE0lRQKLZ 7DTctHGMtM7nY8A0pdt907JcnsALKcFeG5Wasduf0gwoPK4e7D87jAOmpBmSoIWBJpGD nQJM3zevtb38win8EHfrezx20EwEHFLwS6Yfn5JWHXkIKV0Vy3tbp6lqCp8J3UPIPll4 qDwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=GazJIJPM; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x6-20020aa79a46000000b0056bb424088csi16097442pfj.212.2022.11.02.17.21.07; Wed, 02 Nov 2022 17:21:19 -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=@google.com header.s=20210112 header.b=GazJIJPM; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230527AbiKBXVQ (ORCPT + 97 others); Wed, 2 Nov 2022 19:21:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230451AbiKBXUO (ORCPT ); Wed, 2 Nov 2022 19:20:14 -0400 Received: from mail-pl1-x64a.google.com (mail-pl1-x64a.google.com [IPv6:2607:f8b0:4864:20::64a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 373455F79 for ; Wed, 2 Nov 2022 16:19:43 -0700 (PDT) Received: by mail-pl1-x64a.google.com with SMTP id t3-20020a170902e84300b00186ab03043dso206947plg.20 for ; Wed, 02 Nov 2022 16:19:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=KSp9zIzHXrxcJceHX59wYlpimn2+3DBl6/EkdM22YDo=; b=GazJIJPM/pHmiFZ05wEIEUmIWAlYuh2ZlyTopcNekluhV4UHGi1yTDkMNANFS1jscV sHaoW06GH/7QoV/u1MZ9MSnC1FGAiLQO/y23W8/5eah4jm88WvvNxPaF2O5WlqNX6AA2 8Gs4UT7UUi7/ZwHf5DCZWbM2vulQhHbwn2WtGD6rJzl/FOBfxZ8G3NM+geD74+eDAUum o1o3demNZa7SFz5SsAwJ7XKog0NdlraaEfYhRzZpffEE3gOpiTfLkShIIvuV3L13yEjN xam914sm21iReYi10+r23ej5bJnTbIKx2d2irwZwjp5ibbzs0gCmvLJoawOipg8dYos5 2Zgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=KSp9zIzHXrxcJceHX59wYlpimn2+3DBl6/EkdM22YDo=; b=7P50vtmJ02ANSZye/08/bsvAe/KjipuyyzXb4/UjuqmWdp0y/jP9vwEBZSSYbiYHyI +12F3reLPE7Q+PCt5w6EA+hB3YTVsqBHrHXcpLrI0+FMfxQKVIVQHYsCWf6m6ISw6J5I BbTrxRJ7tkcOSHXDivRcgljmvrixBmFsK4ZPRDwVXlHj3hYIzFCMOCPnFJTvAo3Zgbmr pCsnOO4ybFVErEsYMTJL5kGnhhCYxXsbD7h4PbPMVAc63bR7nNyBIJvk34Gq2Yyj+DOM SehyAxv87vBHJwALt2l4+iOKRCgjNwv6pDBYp5J0YN2m9YwBfIlbiRqdx55OsovmzdPW yfdg== X-Gm-Message-State: ACrzQf1wYWuqwrcsDUezv614yzNRnfz+I3Gnt785jAOsiDUV6PtWYLMJ EcqZTtyTSZ/kdhlTmuWobdSxU2pooSM= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a05:6a00:e0b:b0:56c:8c13:2a54 with SMTP id bq11-20020a056a000e0b00b0056c8c132a54mr27442020pfb.17.1667431182821; Wed, 02 Nov 2022 16:19:42 -0700 (PDT) Reply-To: Sean Christopherson Date: Wed, 2 Nov 2022 23:18:44 +0000 In-Reply-To: <20221102231911.3107438-1-seanjc@google.com> Mime-Version: 1.0 References: <20221102231911.3107438-1-seanjc@google.com> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog Message-ID: <20221102231911.3107438-18-seanjc@google.com> Subject: [PATCH 17/44] KVM: arm64: Do arm/arch initialiation without bouncing through kvm_init() From: Sean Christopherson To: Paolo Bonzini , Marc Zyngier , Huacai Chen , Aleksandar Markovic , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Matthew Rosato , Eric Farman , Sean Christopherson , Vitaly Kuznetsov Cc: 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=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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 Move arm/arch specific initialization directly in arm's module_init(), now called kvm_arm_init(), instead of bouncing through kvm_init() to reach kvm_arch_init(). Invoking kvm_arch_init() is the very first action performed by kvm_init(), i.e. this is a glorified nop. Making kvm_arch_init() a nop will allow dropping it entirely once all other architectures follow suit. No functional change intended. Signed-off-by: Sean Christopherson --- arch/arm64/kvm/arm.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c index f400a8c029dd..bfa2dcd3db11 100644 --- a/arch/arm64/kvm/arm.c +++ b/arch/arm64/kvm/arm.c @@ -2190,7 +2190,7 @@ void kvm_arch_irq_bypass_start(struct irq_bypass_consumer *cons) /** * Initialize Hyp-mode and memory mappings on all CPUs. */ -int kvm_arch_init(void *opaque) +int kvm_arm_init(void) { int err; bool in_hyp_mode; @@ -2264,6 +2264,14 @@ int kvm_arch_init(void *opaque) kvm_info("Hyp mode initialized successfully\n"); } + /* + * 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); + if (err) + goto out_subs; + return 0; out_subs: @@ -2276,10 +2284,15 @@ int kvm_arch_init(void *opaque) return err; } +int kvm_arch_init(void *opaque) +{ + return 0; +} + /* NOP: Compiling as a module not supported */ void kvm_arch_exit(void) { - kvm_unregister_perf_callbacks(); + } static int __init early_kvm_mode_cfg(char *arg) @@ -2320,10 +2333,4 @@ enum kvm_mode kvm_get_mode(void) return kvm_mode; } -static int arm_init(void) -{ - int rc = kvm_init(NULL, sizeof(struct kvm_vcpu), 0, THIS_MODULE); - return rc; -} - -module_init(arm_init); +module_init(kvm_arm_init); -- 2.38.1.431.g37b22c650d-goog