From patchwork Mon Jan 24 22:08:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabiano Rosas X-Patchwork-Id: 1583737 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=Uq07A2sv; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=kvm-ppc-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by bilbo.ozlabs.org (Postfix) with ESMTP id 4JjQPv4vKhz9s9c for ; Tue, 25 Jan 2022 09:58:27 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1841256AbiAXW6J (ORCPT ); Mon, 24 Jan 2022 17:58:09 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:65468 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1836663AbiAXWkj (ORCPT ); Mon, 24 Jan 2022 17:40:39 -0500 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 20OLGuQN009964; Mon, 24 Jan 2022 22:08:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=aaIroEC29w2ZkcJtlFFdHyKeAzECiRnd1ymma3nB0Wk=; b=Uq07A2svG5jYv3OQki3WDnU45z9pBeQf7KcPMwNz34ykpMvNAgwM/xov2lNN4e9PLagt dqtwoBgbHgmcn66a4h7KPsv30pihaHa5X9qm7tXBtXqMm/ayXnJokkfxjcL3SLYoIRj1 DoS5ouAJcroAZs80JZVlRAXRY5kTiw69cHHzfI/CbTZWXIOmQg/Pv9sMyS1VKh2jBXPx VofVrD+YdKIipLwLTRoVnWCRX/HqPtKA1W4pbyIkGeEQoimcU4lj5h2mWia313t2Wkt0 1JKY+87DAZzf8wBs4l7c+/HkWC606ccfeJxtEychHwv+Yr+jT0DVUbT2VMHmmHTiYhmc dQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 3dt3w08y6d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Jan 2022 22:08:19 +0000 Received: from m0098419.ppops.net (m0098419.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 20OLoFwD030419; Mon, 24 Jan 2022 22:08:18 GMT Received: from ppma04wdc.us.ibm.com (1a.90.2fa9.ip4.static.sl-reverse.com [169.47.144.26]) by mx0b-001b2d01.pphosted.com with ESMTP id 3dt3w08y65-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Jan 2022 22:08:18 +0000 Received: from pps.filterd (ppma04wdc.us.ibm.com [127.0.0.1]) by ppma04wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 20OM7LKa011014; Mon, 24 Jan 2022 22:08:17 GMT Received: from b03cxnp08028.gho.boulder.ibm.com (b03cxnp08028.gho.boulder.ibm.com [9.17.130.20]) by ppma04wdc.us.ibm.com with ESMTP id 3dr9j9yxsq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Jan 2022 22:08:17 +0000 Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp08028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 20OM8FH532113044 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Jan 2022 22:08:15 GMT Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 71E6678063; Mon, 24 Jan 2022 22:08:15 +0000 (GMT) Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B018A78067; Mon, 24 Jan 2022 22:08:13 +0000 (GMT) Received: from farosas.linux.ibm.com.com (unknown [9.163.24.67]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTP; Mon, 24 Jan 2022 22:08:13 +0000 (GMT) From: Fabiano Rosas To: kvm-ppc@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org, paulus@ozlabs.org, mpe@ellerman.id.au, npiggin@gmail.com, aik@ozlabs.ru Subject: [PATCH v2 2/4] KVM: PPC: Book3S HV: Delay setting of kvm ops Date: Mon, 24 Jan 2022 19:08:01 -0300 Message-Id: <20220124220803.1011673-3-farosas@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124220803.1011673-1-farosas@linux.ibm.com> References: <20220124220803.1011673-1-farosas@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: knIANEeki_qawwR-ZnOEiMCoTChsHR0j X-Proofpoint-ORIG-GUID: 1cTtNnutSMBo_zSzXdEDYdDwdxKIcQja X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-24_09,2022-01-24_02,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 priorityscore=1501 adultscore=0 malwarescore=0 lowpriorityscore=0 clxscore=1015 suspectscore=0 mlxlogscore=869 impostorscore=0 mlxscore=0 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2201240143 Precedence: bulk List-ID: X-Mailing-List: kvm-ppc@vger.kernel.org Delay the setting of kvm_hv_ops until after all init code has completed. This avoids leaving the ops still accessible if the init fails. Signed-off-by: Fabiano Rosas --- arch/powerpc/kvm/book3s_hv.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index 3a3845f366d4..b9aace212599 100644 --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c @@ -6127,9 +6127,6 @@ static int kvmppc_book3s_init_hv(void) } #endif - kvm_ops_hv.owner = THIS_MODULE; - kvmppc_hv_ops = &kvm_ops_hv; - init_default_hcalls(); init_vcore_lists(); @@ -6145,10 +6142,15 @@ static int kvmppc_book3s_init_hv(void) } r = kvmppc_uvmem_init(); - if (r < 0) + if (r < 0) { pr_err("KVM-HV: kvmppc_uvmem_init failed %d\n", r); + return r; + } - return r; + kvm_ops_hv.owner = THIS_MODULE; + kvmppc_hv_ops = &kvm_ops_hv; + + return 0; } static void kvmppc_book3s_exit_hv(void)