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 DC792C48BF6 for ; Thu, 29 Feb 2024 19:02:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BH2atD2necIc+mYtWzp8aT18fvkCNPdL5woUJbVuc34=; b=CPwhAxoTlIc7UM ZcKKg6kh0FSSCq05ZrN2ZqRz7Mj/6qI1MAmv4v+OzMRFd0iK/Xv2m0lu2k5eWhu0/JfKFWe6Y5BeA d/vT5rJq7daDWzTXM17qsofrqP6vdyvDxP512iTMGfjB4dBDP0Uku6VKBIXfQXp+5vxYkwPQQNSye zheudvPLS/sykHcrtNHkQiKOn7qk+fDZFw9ORIzZ1iyHDuUpbvFOU+KX8ROXZMCX2SlUTxkuyKGK3 4+CLhunDsHosC53Z7riXaUm6cI5/36xmoR+/EBnS0s3DizcWB3lHzHA6aWHPo4rlPauD0uRyRBEgq VBOsOOaHviL5i6pzQ4wA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rflfx-0000000EoOW-188X; Thu, 29 Feb 2024 19:02:37 +0000 Received: from out-185.mta0.migadu.com ([2001:41d0:1004:224b::b9]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rflft-0000000EoNf-43OX for linux-arm-kernel@lists.infradead.org; Thu, 29 Feb 2024 19:02:35 +0000 Date: Thu, 29 Feb 2024 19:02:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1709233348; 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: in-reply-to:in-reply-to:references:references; bh=rC90JL04sHFzjYZv2DlUZVRoD5V6bcjQdETOSNK1DWw=; b=S8sSC1GrQQH7DCK4G8Q4fLTuyJBJU4Ywg0X7Ch0oAgEuE2iNtui+PCyrmnFeXD/f3tqZi/ xJdBYsKRj8dvgvsY+DEkAlhDach+Sx39WXF62qWI413txBOQj617TMRq4ZTjmA0kVYVrtC GjjP6HSjpTflDgxU6UWvbpw5qL/o68c= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Marc Zyngier Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, James Morse , Suzuki K Poulose , Zenghui Yu , James Clark , Anshuman Khandual Subject: Re: [PATCH] KVM: arm64: Fix TRFCR_EL1/PMSCR_EL1 access in hVHE mode Message-ID: References: <20240229145417.3606279-1-maz@kernel.org> <864jdr2knu.wl-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <864jdr2knu.wl-maz@kernel.org> X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240229_110234_594101_F773185A X-CRM114-Status: GOOD ( 22.40 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Feb 29, 2024 at 06:24:37PM +0000, Marc Zyngier wrote: > On Thu, 29 Feb 2024 17:37:08 +0000, Oliver Upton wrote: > > I was wondering if there was a way to surface these screw-ups at compile > > time, but there's nothing elegant that comes to mind. Guess we need to > > be very careful reviewing "nVHE" changes going forward. > > My take on this is that there should hardly be any read_sysreg_s() in > the KVM code at all. We should always use read_sysreg_el*() so that > there is no ambiguity about the state we're dealing with (that's, of > course, only valid for registers that have both an EL1 and an EL2 > counterpart -- registers that are shared across ELs must still use the > read_sysreg_s() accessor). Agreed, I was thinking something along the lines of an accessor that expresses our intent to access EL2 state, but you can't really add compile-time assertions behind that. Perhaps it makes the code slightly more readable, but at that point we're just rolling a turd in glitter. > It would also free the drive-by hacker from having to understand the > subtleties of the E2H redirection. The macros do the right thing > everywhere (they are context aware), and they should be the first port > of call. Right, I think the mechanism for poking at true EL1 state achieves a good abstraction. > > Reviewed-by: Oliver Upton > > Thanks. What should we do about it? Fix for 6.8, or part of the 6.9 > drop? hVHE+tracing is a pretty niche thing, and I don't have any other > fix for the time being... Ah, we are pretty late in the cycle, I should've asked :) Happy to pick this up for 6.9 then. -- Thanks, Oliver _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel