Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp647588rwi; Wed, 2 Nov 2022 16:41:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7zywt7BesNFatb+fegL18B07pdV5S41Amf4KvJsFbBNrG13jF+IH1wwzb+3QB5vs1ZuXWA X-Received: by 2002:a17:907:7da6:b0:791:997e:58fc with SMTP id oz38-20020a1709077da600b00791997e58fcmr26700028ejc.385.1667432500060; Wed, 02 Nov 2022 16:41:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667432500; cv=none; d=google.com; s=arc-20160816; b=iIFSSFUFFxWGOxtMPTTL7eH+NuP65R3tKyatTPbzt3AW/z2c/MtVEgL3K5ZXyNh+cI 02IqEGV3ZEqWv1ktt6v+gnAZFat2UW9fqJHYFYECpV13WsRonVyl+aSx1tysjmJ5tqwb pm/FMnI1p7S99pw5eo4YhTAGeRyyyRIPE4jT6vw24dw8iyPiecSiKdt0OFrHj70I0LwV HfTSSpEOAXrUpBiOS/kn0TO13vi3iQeHynhqlDvXtB8gq0TgtQypNR7xVFQ57T44sfpi L7M0nW3bwCro1roGLGoet8ppRuMgzWHT4cXtrT6CLyB2LoNk8OhLfthG0eKl+HcnF1+V FKzA== 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=s9AuxTlRjBrfjYkcaQi28he/RkCYbCa6yMT59uzOKa0=; b=GulqreIGZ7IjkAnBf/hSq1BmYNGNhtTFmF6Nm0Y/lOx4fVvCkoPDJbKjm9SEiGuG42 BpOzeu1rtae+51BHLjCVmWMX4KQCwl6ggNXPueLBLqMT8OtaWiB48E1/Mqf3z/Vlx9QF rSjatoD/t9TKZQJJ/2Ei47nw8g/0zsKrEiUE4Jl5PZDccpG5NDT+MIotY5MUPizGi6/F gMNZ+zhcpe04ZOE8z+i5ZXedfDRS2aboPQsfBzTlhFZYm7Teiko1VOlEzxnH2dqJi4bP m92TGzF6e3NlICRBr8YgQTArW00/xlzNqp96uvTEEXW/PS+sxXgGYnI64dguxFv/NnWk 4Rjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=ddAfxHTl; 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 a14-20020a50c30e000000b00461d60a86casi14709794edb.135.2022.11.02.16.41.16; Wed, 02 Nov 2022 16:41:40 -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=ddAfxHTl; 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 S231197AbiKBXVz (ORCPT + 97 others); Wed, 2 Nov 2022 19:21:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231280AbiKBXU3 (ORCPT ); Wed, 2 Nov 2022 19:20:29 -0400 Received: from mail-pl1-x649.google.com (mail-pl1-x649.google.com [IPv6:2607:f8b0:4864:20::649]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4B186431 for ; Wed, 2 Nov 2022 16:19:49 -0700 (PDT) Received: by mail-pl1-x649.google.com with SMTP id e13-20020a17090301cd00b001871e6f8714so216891plh.14 for ; Wed, 02 Nov 2022 16:19:49 -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=s9AuxTlRjBrfjYkcaQi28he/RkCYbCa6yMT59uzOKa0=; b=ddAfxHTlEUHw0qawyyn7Bns3LOyks9re4MtMC6FAIFAvlDf6eK/nu/+/9Fi10x1R6n WWJsCNbWaFv5FoXY2JkfL2gPHfmH7n5Ig/c/8vgYFwan9v+I5VkTcY5cAcyMIsF0YYgl ayeymXyuzlb1ZK6RywTZFK6M2TrYNtbmp52NtBkrAW3CizVOcP2GK1YSKNk0hRzbGX/H t6V+7QqjJlqd98Pv08NBqx2q5El2vxmRcwGZXuIwYC0OoPXag/D+TlMulKYngdYVLuGi IcUk8i0bIt121WR3Ua8dNN2eN53mKcAGIC6t4monNq6evoAdLql3aLFHNiEvl7F6ATwg 1KbQ== 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=s9AuxTlRjBrfjYkcaQi28he/RkCYbCa6yMT59uzOKa0=; b=aQY9PITYwTyAstSESuRzncPG1QTQsxC+2oWcYZZkYX4Jlj2+3lV5MqMA6S7Fzs0fF5 KN511d9f4hvkhQ41Smv7qFGE0p+2di+oKykiMN7l3U+heR9DFlsv6O3Junvp6zdsvHro 3la4kA+STI/xKDNLOhluJh2lCuIR+seOOvO3hDWOSfNfpb3hM1txuWliQkbpRWvctB63 CJVgp0Eymm46C6R/wl0+H1Yr+gKwLcKpIvKMesVz9sZSqKKl4pXE1Zs8VQL/bKjMvwQT WbCmmG30IIoFfAlpkF+RlZ1ZnVYNEFtmN5qcZcXgHt4DWGnVHUv3jBRW2wNrqlxqLenq OCYQ== X-Gm-Message-State: ACrzQf34O0CAasg6NFbgvkS7fmQuKhWED7gIpMAhOIdKSX2AXO+0rFLF lWPTxs1XH7zWtFb5FhBXub0SlB228Lg= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:903:240a:b0:183:6555:7a89 with SMTP id e10-20020a170903240a00b0018365557a89mr27116619plo.68.1667431189462; Wed, 02 Nov 2022 16:19:49 -0700 (PDT) Reply-To: Sean Christopherson Date: Wed, 2 Nov 2022 23:18:48 +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-22-seanjc@google.com> Subject: [PATCH 21/44] KVM: MIPS: Register die notifier prior to 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 Call kvm_init() only after _all_ setup is complete, as kvm_init() exposes /dev/kvm to userspace and thus allows userspace to create VMs (and call other ioctls). Signed-off-by: Sean Christopherson --- arch/mips/kvm/mips.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/mips/kvm/mips.c b/arch/mips/kvm/mips.c index 75681281e2df..ae7a24342fdf 100644 --- a/arch/mips/kvm/mips.c +++ b/arch/mips/kvm/mips.c @@ -1640,16 +1640,17 @@ static int __init kvm_mips_init(void) if (ret) return ret; - ret = kvm_init(NULL, sizeof(struct kvm_vcpu), 0, THIS_MODULE); - - if (ret) - return ret; if (boot_cpu_type() == CPU_LOONGSON64) kvm_priority_to_irq = kvm_loongson3_priority_to_irq; register_die_notifier(&kvm_mips_csr_die_notifier); + ret = kvm_init(NULL, sizeof(struct kvm_vcpu), 0, THIS_MODULE); + if (ret) { + unregister_die_notifier(&kvm_mips_csr_die_notifier); + return ret; + } return 0; } -- 2.38.1.431.g37b22c650d-goog