From patchwork Fri Jul 12 11:03:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Ott X-Patchwork-Id: 13731616 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AF6FDC3DA4A for ; Fri, 12 Jul 2024 11:04:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=veUUGt+GBKRUflAP/4u3UadYVzXIYYKM+vDLIvIs2Yc=; b=Ftc0R2hfBuNnr9l/TyecCmB2ku HpUBb6h5DkjSgQgIJ98pk4+dQh8zDe1QE46mu66CDHKCwnT+QBFtv1IBz7Ynk4h+RzscT8mpYCWBc sf8wBkoIyBnmWUpH+2r4EgWirbCVtEe9RkNjSe/24r4tfBw2qC16PlODQgzWgAfUKJnVzhiZxVgq+ Bfr17CUZ5ipp262QMCEnHlIBXMdKiDw9kG32UI8u7OC3U9hFdK6vnF4T+90IXgi4W0pscQs7EyfR2 /LBfsmo45HB2EVWf4sGjY9AaEWk8dgHSCk5Y/ZFyEDxe02P2jFX5vonUJxr7DQD79cxt+J1NVeQnU GcE9enTQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSE4X-0000000HNoe-19t4; Fri, 12 Jul 2024 11:04:17 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSE44-0000000HNfn-0eS6 for linux-arm-kernel@lists.infradead.org; Fri, 12 Jul 2024 11:03:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1720782226; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=veUUGt+GBKRUflAP/4u3UadYVzXIYYKM+vDLIvIs2Yc=; b=amqrOkbcJiqMpOw4ybz5dukXIrvJPDrfXpp2CaWqtk97YQaFW9RCCDtyjn7OMv8GpWuw1H ZMwYCCu3HV0oVdqzHJyn90SSBxI7pAVlYfMU83I2ByEBgJj7j4reKoS/bWjgNjjHjyIUps CBjuZQi/VkkkuKs+ikN4UTv4AY8ZW04= Received: from mail-oi1-f199.google.com (mail-oi1-f199.google.com [209.85.167.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-497-d7TK_RYpP0uk3rSy7bJkiA-1; Fri, 12 Jul 2024 07:03:45 -0400 X-MC-Unique: d7TK_RYpP0uk3rSy7bJkiA-1 Received: by mail-oi1-f199.google.com with SMTP id 5614622812f47-3d92b2a96beso1725609b6e.3 for ; Fri, 12 Jul 2024 04:03:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720782224; x=1721387024; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=veUUGt+GBKRUflAP/4u3UadYVzXIYYKM+vDLIvIs2Yc=; b=o6ZAUhkuWuf/i2ksep12XOc40wokDnqE3fGR7rLKOgsRoNAmqx7BVuujDpuZvG+0fP 5PUZoI7ClCO7csI514ELUMbwq/fIg9ew3VUrYPCp57E4v09oSXGhSxlm8e7lESKhln4I 31OKK5zCXd0FNUzAZbvybjGXDDye/XeXSFstYrN4cORhIgmX607K1UOnQTx1YFBw4JjH NKE+JSyTbm+haeLp+boNC8e4hmYZEMK3kmHPzqOvrg0o6bqYyrN0vKHerxAbf5kIF49f WUNDYQgqll3b7FfrtyP5FcxADF6nnCcnHELBYLr/UWcfbs8jA67uBREIJYPLvWfog1pW jCFQ== X-Gm-Message-State: AOJu0YwuUYeZmyD8XofbdUmZQFry2nhR5FudPojW7FZBH6U5g0tNaiGt hZKHpJRJ8BxQ4UgNpNFUnfZzNb3bDYxbWpENfFd/jN2l0HgrqBWej2BSFhR6k+ACBWP5LAJ1mVL 9wq5HvI8yV2AO1P3R6lLpxPS7lkjrl83O+150/PKHZo/LUPxN2e3/TbaFjQ3lO1PyobBsP98/Q8 YEdqFUpzXaDQwdOBWiHuIzS0vMHb9aJMqicr1VbeEDrGZHpDLzxeTv/g== X-Received: by 2002:a05:6808:1451:b0:3d6:2fb8:2905 with SMTP id 5614622812f47-3d93c08ccc9mr12087103b6e.42.1720782222559; Fri, 12 Jul 2024 04:03:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHaYoe9jS++ITWpl1K24bjqJ7Ih4Tcqa5GejquSQMQtKX8znz1DvmZfOWT4pcFyOh59vOw1Ew== X-Received: by 2002:a05:6808:1451:b0:3d6:2fb8:2905 with SMTP id 5614622812f47-3d93c08ccc9mr12087065b6e.42.1720782222096; Fri, 12 Jul 2024 04:03:42 -0700 (PDT) Received: from rh.redhat.com (p200300c93f45e50062e5f8c654844c9a.dip0.t-ipconnect.de. [2003:c9:3f45:e500:62e5:f8c6:5484:4c9a]) by smtp.gmail.com with ESMTPSA id af79cd13be357-79f18ff834csm390498685a.5.2024.07.12.04.03.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jul 2024 04:03:41 -0700 (PDT) From: Sebastian Ott To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org Cc: Marc Zyngier , Oliver Upton , James Morse , Suzuki K Poulose , Catalin Marinas , Will Deacon , Zenghui Yu Subject: [PATCH 1/3] KVM: arm64: fix override-init warnings in W=1 builds Date: Fri, 12 Jul 2024 13:03:30 +0200 Message-ID: <20240712110332.10970-2-sebott@redhat.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240712110332.10970-1-sebott@redhat.com> References: <20240712110332.10970-1-sebott@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240712_040348_288897_754D8E03 X-CRM114-Status: GOOD ( 13.36 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Remove double initializations in cases where that's easily possible - like extra NULL initialization in static global structures. In the other cases just silence -Woverride-init. To fix warnings like the following: arch/arm64/kvm/hyp/vhe/switch.c:271:43: warning: initialized field overwritten [-Woverride-init] 271 | [ESR_ELx_EC_CP15_32] = kvm_hyp_handle_cp15_32, | ^~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Sebastian Ott --- arch/arm64/kvm/handle_exit.c | 5 +++++ arch/arm64/kvm/hyp/nvhe/switch.c | 6 ++---- arch/arm64/kvm/hyp/vhe/switch.c | 3 +-- arch/arm64/kvm/sys_regs.c | 5 +++++ 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c index d7c2990e7c9e..2c049746657c 100644 --- a/arch/arm64/kvm/handle_exit.c +++ b/arch/arm64/kvm/handle_exit.c @@ -291,6 +291,9 @@ static int handle_svc(struct kvm_vcpu *vcpu) return 1; } +__diag_push(); +__diag_ignore_all("-Woverride-init", "Allow field overrides in exit_handlers"); + static exit_handle_fn arm_exit_handlers[] = { [0 ... ESR_ELx_EC_MAX] = kvm_handle_unknown_ec, [ESR_ELx_EC_WFx] = kvm_handle_wfx, @@ -319,6 +322,8 @@ static exit_handle_fn arm_exit_handlers[] = { [ESR_ELx_EC_PAC] = kvm_handle_ptrauth, }; +__diag_pop(); + static exit_handle_fn kvm_get_exit_handler(struct kvm_vcpu *vcpu) { u64 esr = kvm_vcpu_get_esr(vcpu); diff --git a/arch/arm64/kvm/hyp/nvhe/switch.c b/arch/arm64/kvm/hyp/nvhe/switch.c index 6af179c6356d..bf49afc01542 100644 --- a/arch/arm64/kvm/hyp/nvhe/switch.c +++ b/arch/arm64/kvm/hyp/nvhe/switch.c @@ -200,8 +200,7 @@ static void kvm_hyp_save_fpsimd_host(struct kvm_vcpu *vcpu) } } -static const exit_handler_fn hyp_exit_handlers[] = { - [0 ... ESR_ELx_EC_MAX] = NULL, +static const exit_handler_fn hyp_exit_handlers[ESR_ELx_EC_MAX + 1] = { [ESR_ELx_EC_CP15_32] = kvm_hyp_handle_cp15_32, [ESR_ELx_EC_SYS64] = kvm_hyp_handle_sysreg, [ESR_ELx_EC_SVE] = kvm_hyp_handle_fpsimd, @@ -212,8 +211,7 @@ static const exit_handler_fn hyp_exit_handlers[] = { [ESR_ELx_EC_MOPS] = kvm_hyp_handle_mops, }; -static const exit_handler_fn pvm_exit_handlers[] = { - [0 ... ESR_ELx_EC_MAX] = NULL, +static const exit_handler_fn pvm_exit_handlers[ESR_ELx_EC_MAX + 1] = { [ESR_ELx_EC_SYS64] = kvm_handle_pvm_sys64, [ESR_ELx_EC_SVE] = kvm_handle_pvm_restricted, [ESR_ELx_EC_FP_ASIMD] = kvm_hyp_handle_fpsimd, diff --git a/arch/arm64/kvm/hyp/vhe/switch.c b/arch/arm64/kvm/hyp/vhe/switch.c index 77010b76c150..4e4ff2bd51c9 100644 --- a/arch/arm64/kvm/hyp/vhe/switch.c +++ b/arch/arm64/kvm/hyp/vhe/switch.c @@ -415,8 +415,7 @@ static bool kvm_hyp_handle_sysreg_vhe(struct kvm_vcpu *vcpu, u64 *exit_code) return kvm_hyp_handle_sysreg(vcpu, exit_code); } -static const exit_handler_fn hyp_exit_handlers[] = { - [0 ... ESR_ELx_EC_MAX] = NULL, +static const exit_handler_fn hyp_exit_handlers[ESR_ELx_EC_MAX + 1] = { [ESR_ELx_EC_CP15_32] = kvm_hyp_handle_cp15_32, [ESR_ELx_EC_SYS64] = kvm_hyp_handle_sysreg_vhe, [ESR_ELx_EC_SVE] = kvm_hyp_handle_fpsimd, diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c index c90324060436..00fb6f1e9a48 100644 --- a/arch/arm64/kvm/sys_regs.c +++ b/arch/arm64/kvm/sys_regs.c @@ -2255,6 +2255,9 @@ static bool access_zcr_el2(struct kvm_vcpu *vcpu, return true; } +__diag_push(); +__diag_ignore_all("-Woverride-init", "Allow field overrides in sys_reg_descs"); + /* * Architected system registers. * Important: Must be sorted ascending by Op0, Op1, CRn, CRm, Op2 @@ -2803,6 +2806,8 @@ static const struct sys_reg_desc sys_reg_descs[] = { EL2_REG(SP_EL2, NULL, reset_unknown, 0), }; +__diag_pop(); + static bool kvm_supported_tlbi_s12_op(struct kvm_vcpu *vpcu, u32 instr) { struct kvm *kvm = vpcu->kvm;