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 C23D1CE8350 for ; Mon, 30 Sep 2024 14:46:59 +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:To:From:Message-ID:Date:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=PCD3bg5HMsmSequRFVpNsDpML6vxhEVYNnPpFqi6kGM=; b=4RgDfDAWCtbrK92gr2lkCBX2CZ RZU5wLuxGCaDRbqjyyrBCn2j8PA3yOpW7RVKLdmsUp7mPkap1B9h0TcsPKE0KuZ3abypTrMA38PmE dOu1FTF8NqEoR+6Fk4s7aeKIEqS7fpih0JOnIObqgNIGUZEciODxesgLECd+pGxrKJvHox8CzL98L xJoNJWH4NsHYL5uNLtKBILNjOZ36aPY8YctuyxHraMTyV4Mvnpwdmru0dIdln5Yen6Y3KeP6h7aUz B/kmQcH/sruhnkdazyqOmcAUUOQ73SlXWTHaAmFXQ5HVdou+4FZSzs7fn+wPw/S41jgZYS7HiQzpg yCxeBqFQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1svHfm-0000000HY6V-1VYK; Mon, 30 Sep 2024 14:46:50 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1svHeV-0000000HXaG-3pVm for linux-arm-kernel@bombadil.infradead.org; Mon, 30 Sep 2024 14:45:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:MIME-Version:References: In-Reply-To:Subject:To:From:Message-ID:Date:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description; bh=PCD3bg5HMsmSequRFVpNsDpML6vxhEVYNnPpFqi6kGM=; b=aavWFLNv/kDiWPr3fmehV9lmUQ 0T2St0mMNJVbw8SDaOYnnNDB9HKB0w67IB0ocmtpMo+m3OFLTzzp7s1D/lH6K2BpYjUtcNHcdBreY cQ6fzjjgSOX3P2MHamS8JBxzIAiavNHzcfANV4TETXKA5IIlRj+mzU/JHS+kcYUydBWfkYJaeiiaZ 6WLIaP5Je18Ke+xuO4dtAnZKwGOJR3Kq9kHXUKvOFJyM24eMIpxcBdxwE/7Xn2BsoyF1+vS+IAYqg DaGRw3sVBbWDZY1yiGGdfFKLJ8E3Sz8UHIXSqRIPONg3LwS63Ab8ilBRFUmPUOuZwjdfjxKX4Mf8y 21erkHag==; Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1svHeS-00000002qVt-18Oh for linux-arm-kernel@lists.infradead.org; Mon, 30 Sep 2024 14:45:30 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 8A68A5C0709; Mon, 30 Sep 2024 14:45:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0CA42C4CEC7; Mon, 30 Sep 2024 14:45:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727707526; bh=toXibZWzNbQCTDtO/xK4MILxz8ZPi0W2drIRCMgiiS0=; h=Date:From:To:Subject:In-Reply-To:References:From; b=Iz98trQnFK36YYFCrVz90DGb6srEAyESJuwt/TSfUGS2v7PUNzUt0cau1Ny4h/n6B /YgDdz/CDQOv0xUn8c1xhTdqPbYZOTRsnIU4vQZpQ6hdSqHshokNZKEzdQe3JSfBow 7QkMl/oo+0e/UGT4bl/GsWMJOGhPpiY9ONKvBctuplAP63mT5Wi7u5eVje9eMhg8FT dJN3aVDDQnzqkji9gelKI2nqeYtLtAanPYGcxqWhEeyxeSngdrtJmkFSPxJJ7K/HLG YFCygIKvmuHSj/zuWGiQAwgqDxAJ8wptHcYNG2guDNdhtRNwYqn1NLUdtuY7OHI7a2 gaU2kXA6eU3Pw== Received: from [12.191.124.166] (helo=wait-a-minute.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 1svHeN-00GTHo-MC; Mon, 30 Sep 2024 15:45:24 +0100 Date: Mon, 30 Sep 2024 15:45:17 +0100 Message-ID: <87o745urnm.wl-maz@kernel.org> From: Marc Zyngier To: Marc Zyngier , Oliver Upton , James Morse , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , Joey Gouly , Jia Qingtong , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] KVM: arm64: vgic: fix GICR_STATUSR in vgic_v3_rd_registers In-Reply-To: References: <20240929043937.242769-2-jiaqingtong97@gmail.com> <87v7yevlyc.wl-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.4 (x86_64-pc-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: 12.191.124.166 X-SA-Exim-Rcpt-To: maz@kernel.org, oliver.upton@linux.dev, james.morse@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, will@kernel.org, joey.gouly@arm.com, jiaqingtong@huawei.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org 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-20240930_154528_832614_636040CE X-CRM114-Status: GOOD ( 28.58 ) 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 Mon, 30 Sep 2024 07:20:35 +0100, Jia Qingtong wrote: > > On 29 Sep 10:38, Marc Zyngier wrote: > > On Sun, 29 Sep 2024 05:39:35 +0100, > > jiaqingtong97@gmail.com wrote: > > > > > > From: Jia Qingtong > > > > > > vgic_uaccess use bsearch search regs in vgic_io_device.regions, but the > > > GICR_STATUSR have wrong order in vgic_v3_rd_registers. > > > When check all vgic_register_region, it turned out that only > > > vgic_v3_rd_registers has this problem. > > > > > > It's harmless since vgic_uaccess behaves as RAZ&WI when it can't find the > > > specified reg. This is exactly the same as the behavior of the GICR_STATUSR > > > register. > > > > > > So just move GICR_STATUSR to the right place. > > > > That looks correct, but I think we should have some code that ensures > > that these tables are correct at boot time, just like we're doing for > > the system registers. Or completely remove our reliance on bsearch(). > > > struct vgic_register_region was defined in vgic-{its,mmio-v2,mmio-v3}, > do you think it's appropriate to extern and check tables's item order in > vgic-init.c's kvm_vgic_hyp_init?. I'd rather we have local functions performing the check, one in each of the GIC "modules", calling a global helper taking a pointer to the register array as a parameter. > > > Another thing is that GICD_STATUSR looks pretty wrong. It is handled > > as RAO, but we never clear any "error" (it is WI). This has been buggy > > since GICv3 save/restore was added, 7 years ago. > > > Let's change it to RAZ? We will implement the complete logic when someone > really needs this feature. Exactly. Which is probably *never*. > > > Do you mind spinning a series fixing this up? > > > Sure. Thanks, M. -- Without deviation from the norm, progress is not possible.