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 9613AC4345F for ; Tue, 16 Apr 2024 08:16:29 +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:MIME-Version:References:In-Reply-To: Subject:Cc:To:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=fiCgw9bJZLQPrFTo1Fj9H1+9+QvZepr+a5quUtLZprM=; b=vyUpsNJUpXBvuO GR/CGwd/R81QiTEDiheUWHjlQPYgRNVQudUDLxVk6uwenk+88W60gtao29j/3HqWbY99J8XMQcsDj WwlE2sgy3G/uCrgqLejI2BV7LQvG9DXPSqMr4tNV5kL98jCQBlJI5lCDqDodcCErILwmz12Qs46+e BBop2T7X7xBQKFVyKQtZRZh/N1hS1ZomV0/FJh+2B/gdiWCOBLDcYS9f9qdfDpKBI11t3HBu8+AyZ Cs4Tu7id4P2lEJt4n67tlfMkCJ69fCbdC59q26RC1FNDpZ1rX0TJqXQavYLKj+7c+V2h8QnO8j6X5 XuxcM853sxTW1yCXiETQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwdz8-0000000BPsX-1AgJ; Tue, 16 Apr 2024 08:16:10 +0000 Received: from sin.source.kernel.org ([145.40.73.55]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwdyz-0000000BPqn-2tGJ for linux-arm-kernel@lists.infradead.org; Tue, 16 Apr 2024 08:16:07 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id C9313CE0F30; Tue, 16 Apr 2024 08:15:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4EA6C113CE; Tue, 16 Apr 2024 08:15:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713255358; bh=fMhAsf9mgb8CCtvxhuFDJaA1LT0nBnJDpc/Az6EZ/Ts=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=PyLqi3ORuxNZ6gL32MU/u7qfsQsIPUowtjrTnXc9jBUZL/f+5xXx7Zj2ofs8ZVSbO JxGnTx5CNoZ9j4UNMX89xQR63d8xUPaCXb8epnzfA5tLcFwsBOpf0x4i5AFefXhPVP QXIMri2LvTBVSmyfYBOQgMJOxa6Cqws0dwhyMxhI7hDQ8B4iwkr8geG2ZLHHfM3uFR QI6ISp7A5mUPbLw8LQr3gtQYLgP1paTP6poOxs57W4HtMoMMGHleSNNL2l6KCYOdNj z+kuI/V04POffpc2ECL7ygtKNf0wXCD9Nzk9Qg9cxV1ZdOWNeqO+U3a0LlJbMzQIna GpJ9NENd6mllQ== 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 1rwdyt-004vY1-HS; Tue, 16 Apr 2024 09:15:55 +0100 Date: Tue, 16 Apr 2024 09:15:54 +0100 Message-ID: <864jc1soxx.wl-maz@kernel.org> From: Marc Zyngier To: Anshuman Khandual Cc: linux-arm-kernel@lists.infradead.org, Jonathan Corbet , Oliver Upton , James Morse , Suzuki K Poulose , Catalin Marinas , Will Deacon , Mark Brown , Mark Rutland , kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [RFC 5/8] KVM: arm64: Explicitly handle MDSELR_EL1 traps as UNDEFINED In-Reply-To: <58cdb927-a2d9-4af4-900f-2132472afe9f@arm.com> References: <20240405080008.1225223-1-anshuman.khandual@arm.com> <20240405080008.1225223-6-anshuman.khandual@arm.com> <86a5m8t8s6.wl-maz@kernel.org> <5a2a74b3-f6cd-4cb6-8ee8-5dd7dc2bd686@arm.com> <86mspysuw8.wl-maz@kernel.org> <58cdb927-a2d9-4af4-900f-2132472afe9f@arm.com> 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.2 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: anshuman.khandual@arm.com, linux-arm-kernel@lists.infradead.org, corbet@lwn.net, oliver.upton@linux.dev, james.morse@arm.com, suzuki.poulose@arm.com, catalin.marinas@arm.com, will@kernel.org, broonie@kernel.org, mark.rutland@arm.com, 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-20240416_011602_114956_66387BDB X-CRM114-Status: GOOD ( 19.17 ) 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 Tue, 16 Apr 2024 06:46:13 +0100, Anshuman Khandual wrote: > > On 4/12/24 16:35, Marc Zyngier wrote: > > kvm_init_nv_sysregs() to ensure that these new registers have the > > correct RES0/RES1 behaviour depending on the supported feature set for > > the guest. > > Following might be sufficient for MDSELR_EL1, but wondering if these fine > grained control registers (HDFG[RW]TR2_EL2) need to be completely defined > for the entire guest feature set, probably required. Yes, you should check for all features defining a valid bit in these registers, and apply the correct mask if the feature isn't advertised to the guest, even if KVM doesn't currently support the feature at all. This is a bit cumbersome at first, but we don't have to revisit it when the feature gets enabled, which is a massive maintainability improvement. It also means that we just have to read the documentation and match it against the code, which should be pretty trivial. > > /* HDFG[RW]TR2_EL2 */ > res0 = res1 = 0; > if (!kvm_has_feat(kvm, ID_AA64DFR0_EL1, DebugVer, V8P9)) > res0 |= HDFGRTR2_EL2_nMDSELR_EL1; > set_sysreg_masks(kvm, HDFGRTR2_EL2, res0 | HDFGRTR2_EL2_RES0, res1); > set_sysreg_masks(kvm, HDFGWTR2_EL2, res0 | HDFGWTR2_EL2_RES0, res1); Yup, this looks sensible for that particular bit. A few more to go... ;-) Thanks, M. -- Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel