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 45E86D74959 for ; Thu, 31 Oct 2024 13:29:40 +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=vxcIQ04/XdDQ7orCmY+lTbq38V7NFd9mE1O9OVc4100=; b=kauZDcYkmnn35aKPevU0aD9MRj Aior6YdUYuO+e53VmZbTQAq3G6gXn5ZyA3BzXkQ1fdYUCRzt+GYWqyM2J6IU5jZIdsuDj5hN4o0E3 K3OdA9PMAazwt518miCNfcfgAwFThaWpt4qUGYqgs7YrDnhOsimfqQCUf86Wi8i/vwuFTgZ1xFdWq CcIGnbPSgogfwRnTCb02gY/eT7YIyarMRMEDsfoD5gsEpo3rGV7ARZSo1o/1cDEkHmiWCdXxQp8hI DNI+bYuuwNoL5rvbpzcr4XeF9vH9NpY8RoPKXwGrt7R9d45zsHC3Q4AHV2f1umTG/C+JaY5vRtzV0 eYU/OBOw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t6VEv-00000003gI8-22RA; Thu, 31 Oct 2024 13:29:29 +0000 Received: from nyc.source.kernel.org ([2604:1380:45d1:ec00::3]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t6VDF-00000003g4a-2dGU for linux-arm-kernel@lists.infradead.org; Thu, 31 Oct 2024 13:27:47 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 4455CA437AF; Thu, 31 Oct 2024 13:25:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46ABFC4FEBF; Thu, 31 Oct 2024 13:11:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1730380319; bh=iCWUb0yTk/t00TGKYUJLDN0jzPFmg7+JQOY1ZCT+zIQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ARA9s0gfVmCEI+wHwNi7zuLNsoL5njRAFWv9Rm5aiHer/K3KYeyHKza654xfyjzaD AH/GNRE3FrS+P1DjOkjwaEWoulBDkk5o9b2LmIfpiEOTuO/rC0XDKxWDYWsF4Y1rEg NPod8GySXU4V9odEYa8+gIOOtIdUFwpRlJHxikZLc7fYwePO8XqSrOLz6S/wL//tRc joYNCOoDEbTO48n1RvhrufC4q/uIi87nVaKYTb4THgYWjus3wnwsm02aaJPPvV7RsU PHYc+MzLGBaONzQubspVFQ0p2Bm61lVz2r1w1WJTCS1HZvGgxbd+DRi83YWTCO0eqB z5rhBhqr+Y+nA== 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 1t6Uxx-008ZQh-Ck; Thu, 31 Oct 2024 13:11:57 +0000 Date: Thu, 31 Oct 2024 13:11:56 +0000 Message-ID: <86sesc1ko3.wl-maz@kernel.org> From: Marc Zyngier To: Joey Gouly Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, anshuman.khandual@arm.com, gshan@redhat.com, james.morse@arm.com, shameerali.kolothum.thodi@huawei.com, Oliver Upton , Suzuki K Poulose , Zenghui Yu , Jing Zhang , Catalin Marinas , Will Deacon Subject: Re: [PATCH v6 0/7] KVM: arm64: Hide unsupported MPAM from the guest In-Reply-To: <20241030160317.2528209-1-joey.gouly@arm.com> References: <20241030160317.2528209-1-joey.gouly@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.4 (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: joey.gouly@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, anshuman.khandual@arm.com, gshan@redhat.com, james.morse@arm.com, shameerali.kolothum.thodi@huawei.com, oliver.upton@linux.dev, suzuki.poulose@arm.com, yuzenghui@huawei.com, jingzhangos@google.com, catalin.marinas@arm.com, will@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-20241031_062745_814964_35B4569E X-CRM114-Status: GOOD ( 27.93 ) 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 Wed, 30 Oct 2024 16:03:10 +0000, Joey Gouly wrote: > > Hi, > > changes since v5 [1]: > - Removed Kconfig option, the KVM traps shouldn't rely on host kernel support > - Renamed cpus_support_* to system_supports_* since that matches other functions > - Replace static branch arm64_mpam_has_hcr with a normal cpufeature capability > - Add MPAM*_EL2 regs to KVM (undef_access) > - Use constants in the test, instead of hardcoded values > - Added R-b and T-b tags > - Rebased on v6.12-rc5 > > James wrote: > This series fixes up a long standing bug where MPAM was accidentally exposed > to a guest, but the feature was not otherwise trapped or context switched. > This could result in KVM warning about unexpected traps, and injecting an > undef into the guest contradicting the ID registers. > This would prevent an MPAM aware kernel from booting - fortunately, there > aren't any of those. > > Ideally, we'd take the MPAM feature away from the ID registers, but that > would leave existing guests unable to migrate to a newer kernel. Instead, > just ignore that field when it matches the hardware. KVM wasn't going to > expose MPAM anyway. The guest will not see MPAM in the id registers. > > This series includes the head.S and KVM changes to enable/disable traps. If > MPAM is neither enabled nor emulated by EL3 firmware, these system register > accesses will trap to EL3. > If your kernel doesn't boot, and the problem bisects here - please update > your firmware. MPAM has been supported by trusted firmware since v1.6 in > 2018. (also noted on patch 3). > > Thanks, > Joey > > [1] https://lore.kernel.org/kvmarm/20241015133923.3910916-1-joey.gouly@arm.com/ > > James Morse (7): > arm64/sysreg: Convert existing MPAM sysregs and add the remaining > entries > arm64: head.S: Initialise MPAM EL2 registers and disable traps > arm64: cpufeature: discover CPU support for MPAM > KVM: arm64: Fix missing traps of guest accesses to the MPAM registers > KVM: arm64: Add a macro for creating filtered sys_reg_descs entries > KVM: arm64: Disable MPAM visibility by default and ignore VMM writes > KVM: arm64: selftests: Test ID_AA64PFR0.MPAM isn't completely ignored > > .../arch/arm64/cpu-feature-registers.rst | 2 + > arch/arm64/include/asm/cpu.h | 1 + > arch/arm64/include/asm/cpucaps.h | 5 + > arch/arm64/include/asm/cpufeature.h | 17 ++ > arch/arm64/include/asm/el2_setup.h | 14 ++ > arch/arm64/include/asm/kvm_arm.h | 1 + > arch/arm64/include/asm/sysreg.h | 12 -- > arch/arm64/kernel/cpufeature.c | 96 +++++++++++ > arch/arm64/kernel/cpuinfo.c | 3 + > arch/arm64/kvm/hyp/include/hyp/switch.h | 31 ++++ > arch/arm64/kvm/sys_regs.c | 121 +++++++++---- > arch/arm64/tools/cpucaps | 2 + > arch/arm64/tools/sysreg | 161 ++++++++++++++++++ > .../selftests/kvm/aarch64/set_id_regs.c | 99 ++++++++++- > 14 files changed, 523 insertions(+), 42 deletions(-) For the series: Reviewed-by: Marc Zyngier M. -- Without deviation from the norm, progress is not possible.