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 AA63313A869 for ; Thu, 31 Oct 2024 13:11:59 +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=1730380319; cv=none; b=fj1z49v8x1z9SZaz0Ow+gHeNyOajb7TCpNLGcK7YzA+olrBbDxUEZTZ0WngQvKtruOp2dL0bGSarv/ljI6vHbrs4wOBY+2HwdZm38P7c4wPQUJM6ilLUKYLAi95aonQu8meYpRMgie5g8h+beoXiCcULJJ/NbvbnTy2kL1Jvggc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730380319; c=relaxed/simple; bh=iCWUb0yTk/t00TGKYUJLDN0jzPFmg7+JQOY1ZCT+zIQ=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=jmzmovrBBXrqKD7hknsC2frgUHQT4ekc/H/siG3CxnFtwKbtbcxGcL0Ny3gUaJfPor6gcU+hXQ4IxkwX9DXpRx7jls+ye/IvojUfERexedYzaJaS0BNmHNXstX/ssOLdOxp4Q/SnkJe2oyXP2NYJDUirjq/nl0DArHWzTOQdzkA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ARA9s0gf; 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="ARA9s0gf" 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) Precedence: bulk X-Mailing-List: kvmarm@lists.linux.dev 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: 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 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.