From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7E0DA2032A; Mon, 30 Sep 2024 14:45:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727707526; cv=none; b=Mj2Ry8d13E7JIA2IhDFOeFfLYRzpcy4ryrF1lvMK/jntO/j/mDFUZyhcDNcwDh1rYpiIUPL9t380+BqXMh/RSTAqOq+tXQjF4nCfZhQkqv6cZUFJJWa/F4XfEo8dZpjy2/RHgQQLb6fAmVcWd8YhXhGDO2NxGPjT2gqVPIgBzr4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727707526; c=relaxed/simple; bh=toXibZWzNbQCTDtO/xK4MILxz8ZPi0W2drIRCMgiiS0=; h=Date:Message-ID:From:To:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=pS/fPm4Eu2GLqdC4wLvShutzCw0eC1vjZeIGZxqELbfKMUp4CqEteYOUsFSSkPiU5lxfTVv5loy0NKKe5Fu1uXIRdCbVmGSf1PnLGyoY3mcTwPngW7vap5UbLNqKrsDEbQDjDLSHz6+a+57SMcYmrOIbV9oOZA5iJTTr6boyJ0Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Iz98trQn; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Iz98trQn" 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) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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.