Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp746603rwi; Wed, 2 Nov 2022 18:11:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6YYtwruZAlHXLa/onN5yqgPhtrqg8ZJu5TN3QceBJX2G9QZ8yuZ/1TolVJScQF2NpTHjmj X-Received: by 2002:a05:6a00:3698:b0:56d:3180:e88f with SMTP id dw24-20020a056a00369800b0056d3180e88fmr24428047pfb.66.1667437871941; Wed, 02 Nov 2022 18:11:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667437871; cv=none; d=google.com; s=arc-20160816; b=HRKve+RarImVYB3bDFmUAzR/+TGlLFLhLujp+mHkafflBNQpr42wUXYiDGKrMLH2su Dbt3qkQdQMjjHHR9oe317QeeQ3FgLt97kQN+u1XXF9yqIygaRUKlkNOY9eEg/ezBna52 mvGrPn+EDTVUy4CnbCOn5WRKs0A/BZdL1Iw/PMQ1PzgCeIwOc7vyxPO1ruGPukFD4p8V S9wo1BZuHW8TfWMcnIHlMApvu+ed6nTrDHrOZNNwS4uNaxKOTyGES12cJsjSlm7YAFIu bLhPH9BRIBdbK9mqgMCEWPH8QeWywXJgD0i0R5TAwj2Z0ScoCmNPIc4blQ8f2Xuco2bD 9VVQ== 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=CzSf5zn0WCjHNHnOQoVFnBDZCb0UJEWJAWP5e8x7mpU=; b=w1LBlqczvlmYeRSMhPEKCniM7BQfMn3//mBxdE1pY02gdiHP769z+9ygXnW7sM1Vkd mWqpl8GHvUBXasOO5tItePT3+UDbTJ1qBwR2SjUDG6514hXE+wFAExJhKRyKZxv9tTlR 2R730v1OUfiti+7xq8cHmsdJ/PEPE4HvyPhDO0nraNKjWQybF3RWCBvzIWKJT8LVvSnc 9ZdikLJxPxFR58A7xN1X2k7JAKJypwdNnYwTZ9u8rIHYf/xLMrWWnjH/nIimQapb4f7H UbniYl7oC9B3fOpF53+uL/9UKS2WAb/cJdfsN1ZCPCL/VxOUSVdCChVqH27mRz/tjytZ 0ZyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=qayOPbuA; 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 q7-20020a056a00150700b0052e4de9b806si19515545pfu.342.2022.11.02.18.10.58; Wed, 02 Nov 2022 18:11:11 -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=qayOPbuA; 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 S231143AbiKBXWr (ORCPT + 97 others); Wed, 2 Nov 2022 19:22:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229561AbiKBXUo (ORCPT ); Wed, 2 Nov 2022 19:20:44 -0400 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66F5AAE4E for ; Wed, 2 Nov 2022 16:19:56 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-352e29ff8c2so501617b3.21 for ; Wed, 02 Nov 2022 16:19:56 -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=CzSf5zn0WCjHNHnOQoVFnBDZCb0UJEWJAWP5e8x7mpU=; b=qayOPbuABiIuhyUyS81pM4aIXP0zbbDCyOAoStlcDM54io6H46scG/b+AOJZ083vkp 7VUQSDA3F1PV+eczWk9jhX07na0Ee5Y/y96fcuWnjX0SDylBmMM507BoItRwczIvX47w quWZbFbuSFsnuRxvRxHTWN2VK6E9IoRaN3Rn0730zHfCEZF81HBccJpL9kyZIy1KxZA/ 662DkzEQNlhCKGQQORLsI62wqsjL9SN7t5eET3UjVYfrxzuz8jEkm9iuoDgYatGUaOSX hwFfEfHx7Y5bc5lWLW7ELIceyIhTn7UMBpI42o+ooA3Zs7kMfZ0227v/cGHQHHsdYmrl HIHw== 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=CzSf5zn0WCjHNHnOQoVFnBDZCb0UJEWJAWP5e8x7mpU=; b=1qC/wyzgLcJ45FRbGUZzdSV7fB5hDf01fHqlP+fgUqOmzibT7pIGHk6RwoudnH5FJr DAUr4GLrDn3tS81y4uLYGqQuzVMaIjhLZWkrCdA9issiOFOMzuWQl2GlEOClKHMqMXFU d6fPHpfKL48jwa+BwxtMvhVFEH0q9E1WoVS4dPCXWeqI0aj2bujIQ2950PKvwYyUToh/ geW9GmvFOmqZ96AZOrl5G3lh/tS/cu9fMj+8/HWAuPzA7cYvTRKe3wxRhd7XZrOm/ZHY RyC2RdwOKN/PTUXfFvuAYyz05Q28q+ICZ3HWXRTNcEiRH1a82tjKpVm29mGLLt+mAhYL xi/w== X-Gm-Message-State: ACrzQf3o2z/dsGEXXjJygSqeCXRa5P6xzlSHsLIciF9snMQBh2v9YiHC L7z42nYTbhvOnMPYm2DgYl5MFcLvlII= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a81:2544:0:b0:360:c270:15a1 with SMTP id l65-20020a812544000000b00360c27015a1mr24717446ywl.67.1667431196650; Wed, 02 Nov 2022 16:19:56 -0700 (PDT) Reply-To: Sean Christopherson Date: Wed, 2 Nov 2022 23:18:52 +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-26-seanjc@google.com> Subject: [PATCH 25/44] KVM: s390: Do s390 specific init 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 the guts of kvm_arch_init() into a new helper, __kvm_s390_init(), and invoke the new helper directly from kvm_s390_init() instead of bouncing through kvm_init(). Invoking kvm_arch_init() is the very first action performed by kvm_init(), i.e. this is a glorified nop. Moving setup to __kvm_s390_init() will allow tagging more functions as __init, and emptying kvm_arch_init() will allow dropping the hook entirely once all architecture implementations are nops. No functional change intended. Signed-off-by: Sean Christopherson --- arch/s390/kvm/kvm-s390.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index 7fcd2d3b3558..e1c9980aae78 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -461,7 +461,7 @@ static void kvm_s390_cpu_feat_init(void) */ } -int kvm_arch_init(void *opaque) +static int __kvm_s390_init(void) { int rc = -ENOMEM; @@ -519,7 +519,7 @@ int kvm_arch_init(void *opaque) return rc; } -void kvm_arch_exit(void) +static void __kvm_s390_exit(void) { gmap_unregister_pte_notifier(&gmap_notifier); gmap_unregister_pte_notifier(&vsie_gmap_notifier); @@ -533,6 +533,16 @@ void kvm_arch_exit(void) debug_unregister(kvm_s390_dbf_uv); } +int kvm_arch_init(void *opaque) +{ + return 0; +} + +void kvm_arch_exit(void) +{ + +} + /* Section: device related */ long kvm_arch_dev_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg) @@ -5634,7 +5644,7 @@ static inline unsigned long nonhyp_mask(int i) static int __init kvm_s390_init(void) { - int i; + int i, r; if (!sclp.has_sief2) { pr_info("SIE is not available\n"); @@ -5650,12 +5660,23 @@ static int __init kvm_s390_init(void) kvm_s390_fac_base[i] |= stfle_fac_list[i] & nonhyp_mask(i); - return kvm_init(NULL, sizeof(struct kvm_vcpu), 0, THIS_MODULE); + r = __kvm_s390_init(); + if (r) + return r; + + r = kvm_init(NULL, sizeof(struct kvm_vcpu), 0, THIS_MODULE); + if (r) { + __kvm_s390_exit(); + return r; + } + return 0; } static void __exit kvm_s390_exit(void) { kvm_exit(); + + __kvm_s390_exit(); } module_init(kvm_s390_init); -- 2.38.1.431.g37b22c650d-goog