Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3157167rwb; Wed, 30 Nov 2022 16:26:38 -0800 (PST) X-Google-Smtp-Source: AA0mqf5Z9aMcBb/8Gfvpvat+QRX9ZMBGfzeCmv+c9/rfnwA9YaQHZo7pn0RVUpWhsas7kFhcMjh6 X-Received: by 2002:a05:6402:189:b0:469:85d:2663 with SMTP id r9-20020a056402018900b00469085d2663mr54934283edv.56.1669854398030; Wed, 30 Nov 2022 16:26:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669854398; cv=none; d=google.com; s=arc-20160816; b=KWBan7AtUbkFQ+9oOE3hMGyElUGpvQzUi59bWiTWemCWMxfp6TkVWm+orX1I7H9eu3 rXPrTKgxxdq3jomClUKrbFMr2Y8m26wXBn8IbGKCBaaE90f89Pha85FpqV19PtbBeP5b 2CnubHXloppXxyHsPZuDDtlFcyOpduRQPMJcPlbP/dmFQXSNftdUPmL028ooorj7GzpC Qx5SJx8BAI3Lzgu1C8l0GR3MQp0OmFYoDt5QLEP7JBJpRstKmoaCRpngZWUw4xifPS5R MXaogdsfM9/2cmL9ip4cRAFJizUVQArBBcIaaY2TebYfKCD5P8nJ5PFUr+3LKjjTiS00 50XA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:from:subject :message-id:references:mime-version:in-reply-to:date:reply-to :dkim-signature; bh=2E/ZNfNVjTWUDx7EclAA9RDMNJ28SDYbq0FBSTNkEW0=; b=Idf34Uv7vkMIxYEb53MTFLHMYNyTN0CCNRI8myaIxPkDZlN74ssn4twmHQQwoGwLcq RUCNqabta/c34TEeETuV1MSBsk5mOVEawFMGAl918Dn3lNH0sx9AlmM7s3zJwTRnC9AV GoFKwjC5R/EkzDif+B92C+6V0u9VCTu7AQd6/GX0vtVjcqT6WyC/Zk6EFdXOrmZHHhpy M5Iayo5BwJs12krzfT0t+MVTVs+yKY5v9t4HzdOT2QwN6RP4DtC/AB1vZw3apG5GmX9C IR1xDbwY4mnZswat1Wv9RGydDEVNA7a3riOMX2zzvDoFKBVxMp4sq5evIp2nE3fm28fa EgcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=YOeUjr5k; 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 z9-20020a05640235c900b004680dcb8900si2682600edc.213.2022.11.30.16.26.18; Wed, 30 Nov 2022 16:26:38 -0800 (PST) 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=YOeUjr5k; 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 S229986AbiK3XNf (ORCPT + 83 others); Wed, 30 Nov 2022 18:13:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229956AbiK3XMw (ORCPT ); Wed, 30 Nov 2022 18:12:52 -0500 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 DBDD89C61D for ; Wed, 30 Nov 2022 15:10:38 -0800 (PST) Received: by mail-pl1-x649.google.com with SMTP id b6-20020a170902d50600b00189a5536820so5305475plg.16 for ; Wed, 30 Nov 2022 15:10:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=content-transfer-encoding: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=2E/ZNfNVjTWUDx7EclAA9RDMNJ28SDYbq0FBSTNkEW0=; b=YOeUjr5k1nRXALq3v0KKdNU/RoNOZHvdJ287PzEh8mewFol14vSXSy8/3fYRK98ogf DM6/FhXti4G1BKHQNvzjRV1tWyFhTyxYu+zxNSNi9IlHcolXKLZsPssVX0dsnM50iavV x2ODcftM6fP7S5M9f/kxN+kBZaYtyIW+z4R08Rc0Nfjpphi6e+XsI1tHwJnKWXkQaHpN Fvd9/AR9wQma2szpaVgVzc80G2d6HwNcimfP60MChrBcVuLXdfKe+wSSxLqRYu4pvEyL hD29cSFZ9nNlD/40iFEC/0Ct0+nb0Drk9Ewou2J1g8F1lSQpSFp12LOPbSOpy+zVepWe HB6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding: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=2E/ZNfNVjTWUDx7EclAA9RDMNJ28SDYbq0FBSTNkEW0=; b=Nz2tbWEiXE3GIdoEiYN7IBZvhivKsiH/YCmD4ofsGA6MeFcomxXoCxSxFoCGXclERD IXzhXQLu2FW4OEA3ynXhuIWLxrTEp8eO6j0iYuzNBgMn89il3rD8rJ00joZh/42wpRvf TAwY0y6Lv/pq2CZh2JROujzXoWptS6aXYHBaHTFiSoALRintvK7WOWAyD+i+5D45FfAx yVms8CoCU/boTOgCmkCtEdZMLaay8NVOt/sZ9iicxS0QfpnmPUkP1x8Et2vuR/2Wm6m7 EDtuji4zsxur4ZLCQtfaRDBqIQqTfL2Y2s9QkehQV/AotfXCbSsT0o3Lz7We7Fmk5o6M JO6Q== X-Gm-Message-State: ANoB5pnJ4C8/ao+dVMqMKDWeCIvyn3Gf3nbhDB6skiqo+M/FDSujOvPR LqMjvEMg0GkX1vyVyB56iUz5wEQUEPc= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a62:6045:0:b0:575:f66b:75a9 with SMTP id u66-20020a626045000000b00575f66b75a9mr3406091pfb.2.1669849816681; Wed, 30 Nov 2022 15:10:16 -0800 (PST) Reply-To: Sean Christopherson Date: Wed, 30 Nov 2022 23:09:07 +0000 In-Reply-To: <20221130230934.1014142-1-seanjc@google.com> Mime-Version: 1.0 References: <20221130230934.1014142-1-seanjc@google.com> X-Mailer: git-send-email 2.38.1.584.g0f3c55d4c2-goog Message-ID: <20221130230934.1014142-24-seanjc@google.com> Subject: [PATCH v2 23/50] 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 , David Woodhouse , Paul Durrant 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, Yuan Yao , Cornelia Huck , Isaku Yamahata , "=?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?=" , Fabiano Rosas , Michael Ellerman , Kai Huang , Chao Gao , Thomas Gleixner Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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=unavailable 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 Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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; =20 - ret =3D kvm_init(NULL, sizeof(struct kvm_vcpu), 0, THIS_MODULE); - - if (ret) - return ret; =20 if (boot_cpu_type() =3D=3D CPU_LOONGSON64) kvm_priority_to_irq =3D kvm_loongson3_priority_to_irq; =20 register_die_notifier(&kvm_mips_csr_die_notifier); =20 + ret =3D kvm_init(NULL, sizeof(struct kvm_vcpu), 0, THIS_MODULE); + if (ret) { + unregister_die_notifier(&kvm_mips_csr_die_notifier); + return ret; + } return 0; } =20 --=20 2.38.1.584.g0f3c55d4c2-goog