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 A013AC3DA5D for ; Thu, 25 Jul 2024 14:30:49 +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: References:In-Reply-To:Subject:Cc:To:From:Message-ID:Date: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=Ay48ZI318yFMXtv4MRWeCVOTL/hA0Uc4Zyr4ilKgkP4=; b=XtItjBbGJwhE2xEKxpDVAakuNH JEJLDfLO4aqsNuEAE1IPt/LyDXl9riubu8T89PIUgIka3Tfvq/SwVSGljemgS/XATCCqe3nYHZh83 9zc8uYWnZkH5K0XWCdumAl97eNHSQ6SpQWK2qxGosJmw2mDcpqqUkjVifYc5EADf5uOg9vw4hHzN6 w9Iij0qxlIaJv2KolPXz9J24LgSnS8fXcfD4AuhFplAzWNSk/m91g8hK+r8Hsz9PrL23SresBzp2h GR+q5ob6Zy9vQ+tgy0SRUGq6nuhLS+Lt98M/KmdvDxIh1ypFFtIWQN39e9pZia9C330TfbSWOCXZU UfTWGVnQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sWzUE-00000001GxC-2XeJ; Thu, 25 Jul 2024 14:30:30 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sWzTo-00000001GoV-1pxs for linux-arm-kernel@lists.infradead.org; Thu, 25 Jul 2024 14:30:06 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 7941C61416; Thu, 25 Jul 2024 14:30:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0B78C4AF11; Thu, 25 Jul 2024 14:30:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721917802; bh=+ZMvgiAV1/UM9/xd5fVncKC88Ok0z8C2ZSVPGSklcYk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=qX77dP6jKSf3FBBBkWB9cpAljJZphbPY5WkZpFtst6Su66tYAk7FV49EQL5gG9kVN YFvsNhoopK+bQ7boxmaurAWqUuPhcNXKAiChvZgLl/IJ/N055ZROBJzqFrl1kUJlKa g9AMagqtZBuKDZ/wuZtlIaGYYlNxSgXSKkwotLy/lqxl2i1HAvIgxFjQHpVCpgQWcE 9qtTe0v/jK9t5tJ47RoxP2YZOToGylHzu//EvgUlz86aU4vJiHntZ56fhKeT0vcXRV 2gPtPXX90vLLeslBDAGeJrr5zwYYkaLYlZWs+hILVjVWYNMXfyB1ORno/qDclFPLho hdkKrTRG/CnAA== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1sWzTk-00FK9s-QI; Thu, 25 Jul 2024 15:30:00 +0100 Date: Thu, 25 Jul 2024 15:30:00 +0100 Message-ID: <864j8d35p3.wl-maz@kernel.org> From: Marc Zyngier To: Alexandru Elisei Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Joey Gouly Subject: Re: [PATCH 10/12] KVM: arm64: nv: Add SW walker for AT S1 emulation In-Reply-To: References: <20240625133508.259829-1-maz@kernel.org> <20240708165800.1220065-1-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/29.3 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: alexandru.elisei@arm.com, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, james.morse@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com, joey.gouly@arm.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240725_073004_566756_4F9B574E X-CRM114-Status: GOOD ( 19.75 ) 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 On Thu, 25 Jul 2024 15:16:12 +0100, Alexandru Elisei wrote: > > Hi Marc, > > On Mon, Jul 08, 2024 at 05:57:58PM +0100, Marc Zyngier wrote: > > + if (perm_fail) { > > + struct s1_walk_result tmp; > > I was wondering if you would consider initializing 'tmp' to the empty struct > here. That makes it consistent with the initialization of 'wr' in the !perm_fail > case and I think it will make the code more robust wrt to changes to > compute_par_s1() and what fields it accesses. I think there is a slightly better way, with something like this: diff --git a/arch/arm64/kvm/at.c b/arch/arm64/kvm/at.c index b02d8dbffd209..36fa2801ab4ef 100644 --- a/arch/arm64/kvm/at.c +++ b/arch/arm64/kvm/at.c @@ -803,12 +803,12 @@ static u64 handle_at_slow(struct kvm_vcpu *vcpu, u32 op, u64 vaddr) } if (perm_fail) { - struct s1_walk_result tmp; - - tmp.failed = true; - tmp.fst = ESR_ELx_FSC_PERM | wr.level; - tmp.s2 = false; - tmp.ptw = false; + struct s1_walk_result tmp = (struct s1_walk_result){ + .failed = true, + .fst = ESR_ELx_FSC_PERM | wr.level, + .s2 = false, + .ptw = false, + }; wr = tmp; } Thoughts? M. -- Without deviation from the norm, progress is not possible.