From mboxrd@z Thu Jan 1 00:00:00 1970 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 2C30FC52D7C for ; Thu, 22 Aug 2024 04:05:58 +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:MIME-Version: Message-ID:Date:References:In-Reply-To:Subject:Cc:To:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=9W6gFnJSEAMcUzVi/Z4aEVuvQPZINqnmiFhxRAmX8gk=; b=JpH4XRkwMh6gEqW7nf/KaD+ZBa rvBaVpxCvNs/ooDB+HA+vCk4yhZwo1gOQYfowOaStP/25fHKWb3eX7LL4BQu6lUhMwJGUyrwkRTrn pLxaq1Pvj9esPwW/32aPPxUEIw+WBbWWiAV8UfCJjIYD1kuD8/CkythGhG8CsKMeh5VtBfkDMwVsO JH89FL9aUZ9eSZgHWBB1wWYX777ijpo3P/fUwKWfHLprns6hQHlcLm8RzjWz6R3xuntqRvH+jCGxS +0DX/PRW64etYeIOE47rY1eVDQHvZ7TFvVu8kp2CW0qeswFbpaq88COBkQPlNhhD8by4zC5YaPhTL ePXx+oZw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgz4x-0000000BJTk-3Wj1; Thu, 22 Aug 2024 04:05:43 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgz4D-0000000BJN6-2n5b for linux-arm-kernel@lists.infradead.org; Thu, 22 Aug 2024 04:04:59 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id DBBF9CE0C65; Thu, 22 Aug 2024 04:04:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72061C4AF09; Thu, 22 Aug 2024 04:04:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724299495; bh=tbe4FZUkzz+iVMQdUiF9BG9MZYXNRR57xKnKHiajJZc=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=JFj5BQt989BcieRka9JzUyKpbJpUE0ShZUw/SCgbsDVG7uHs3xVHiYDmFXJm5PNz7 VhpYE3iW91v6e88TQuGd+3ftgW2HnMcU2GKmTfT/aKjGkg0Q+ry4tRQ8W96s0a/9XU KOpvr2PyR/0YUnJEIQ9MeeIJ46O+IDZil9a6/PWmL5BV5anmL5ZbQLFCHYPhdGOqIf rB60oYFxM69i+IUGKwVXS4BEnSaRnk98pDx7HFyRuOwM7kXyz97CkLOMvyqbyWvria WR/cvPhETy/rvHHTBBEBa7RrEn9okX+M8/jxpqD8JLlcTxTK6a38nLqDivtIawDoPO W4tkDpgsMWNdw== X-Mailer: emacs 31.0.50 (via feedmail 11-beta-1 I) From: Aneesh Kumar K.V To: Steven Price , kvm@vger.kernel.org, kvmarm@lists.linux.dev Cc: Steven Price , Catalin Marinas , Marc Zyngier , Will Deacon , James Morse , Oliver Upton , Suzuki K Poulose , Zenghui Yu , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Joey Gouly , Alexandru Elisei , Christoffer Dall , Fuad Tabba , linux-coco@lists.linux.dev, Ganapatrao Kulkarni , Gavin Shan , Shanker Donthineni , Alper Gun Subject: Re: [PATCH v4 18/43] arm64: RME: Handle realm enter/exit In-Reply-To: <20240821153844.60084-19-steven.price@arm.com> References: <20240821153844.60084-1-steven.price@arm.com> <20240821153844.60084-19-steven.price@arm.com> Date: Thu, 22 Aug 2024 09:34:44 +0530 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240821_210457_902556_3E1A8476 X-CRM114-Status: GOOD ( 10.71 ) 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 Steven Price writes: .... > +static int rec_exit_ripas_change(struct kvm_vcpu *vcpu) > +{ > + struct kvm *kvm = vcpu->kvm; > + struct realm *realm = &kvm->arch.realm; > + struct realm_rec *rec = &vcpu->arch.rec; > + unsigned long base = rec->run->exit.ripas_base; > + unsigned long top = rec->run->exit.ripas_top; > + unsigned long ripas = rec->run->exit.ripas_value & 1; > + unsigned long top_ipa; > + int ret = -EINVAL; > + > + if (realm_is_addr_protected(realm, base) && > + realm_is_addr_protected(realm, top - 1)) { > + kvm_mmu_topup_memory_cache(&vcpu->arch.mmu_page_cache, > + kvm_mmu_cache_min_pages(vcpu->arch.hw_mmu)); > + write_lock(&kvm->mmu_lock); > + ret = realm_set_ipa_state(vcpu, base, top, ripas, &top_ipa); > + write_unlock(&kvm->mmu_lock); > + } > + > + WARN(ret && ret != -ENOMEM, > + "Unable to satisfy SET_IPAS for %#lx - %#lx, ripas: %#lx\n", > + base, top, ripas); > + > + /* Exit to VMM to complete the change */ > + kvm_prepare_memory_fault_exit(vcpu, base, top_ipa - base, false, false, > + ripas == 1); > + > + return 0; > +} > + arch/arm64/kvm/rme-exit.c:100:6: warning: variable 'top_ipa' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] if (realm_is_addr_protected(realm, base) && ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/arm64/kvm/rme-exit.c:114:44: note: uninitialized use occurs here kvm_prepare_memory_fault_exit(vcpu, base, top_ipa - base, false, false, ^~~~~~~ -aneesh